1 |
commit: 660f7e02c537cb3413d947fd8aa57970acf707eb |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Feb 9 11:12:45 2015 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Feb 9 11:12:45 2015 +0000 |
6 |
URL: http://sources.gentoo.org/gitweb/?p=proj/linux-patches.git;a=commit;h=660f7e02 |
7 |
|
8 |
Remove broken patch for fbcondecor |
9 |
|
10 |
--- |
11 |
4200_fbcondecor-3.16.patch | 2119 -------------------------------------------- |
12 |
1 file changed, 2119 deletions(-) |
13 |
|
14 |
diff --git a/4200_fbcondecor-3.16.patch b/4200_fbcondecor-3.16.patch |
15 |
deleted file mode 100644 |
16 |
index c96e5dc..0000000 |
17 |
--- a/4200_fbcondecor-3.16.patch |
18 |
+++ /dev/null |
19 |
@@ -1,2119 +0,0 @@ |
20 |
-diff --git a/Documentation/fb/00-INDEX b/Documentation/fb/00-INDEX |
21 |
-index fe85e7c..2230930 100644 |
22 |
---- a/Documentation/fb/00-INDEX |
23 |
-+++ b/Documentation/fb/00-INDEX |
24 |
-@@ -23,6 +23,8 @@ ep93xx-fb.txt |
25 |
- - info on the driver for EP93xx LCD controller. |
26 |
- fbcon.txt |
27 |
- - intro to and usage guide for the framebuffer console (fbcon). |
28 |
-+fbcondecor.txt |
29 |
-+ - info on the Framebuffer Console Decoration |
30 |
- framebuffer.txt |
31 |
- - introduction to frame buffer devices. |
32 |
- gxfb.txt |
33 |
-diff --git a/Documentation/fb/fbcondecor.txt b/Documentation/fb/fbcondecor.txt |
34 |
-new file mode 100644 |
35 |
-index 0000000..3388c61 |
36 |
---- /dev/null |
37 |
-+++ b/Documentation/fb/fbcondecor.txt |
38 |
-@@ -0,0 +1,207 @@ |
39 |
-+What is it? |
40 |
-+----------- |
41 |
-+ |
42 |
-+The framebuffer decorations are a kernel feature which allows displaying a |
43 |
-+background picture on selected consoles. |
44 |
-+ |
45 |
-+What do I need to get it to work? |
46 |
-+--------------------------------- |
47 |
-+ |
48 |
-+To get fbcondecor up-and-running you will have to: |
49 |
-+ 1) get a copy of splashutils [1] or a similar program |
50 |
-+ 2) get some fbcondecor themes |
51 |
-+ 3) build the kernel helper program |
52 |
-+ 4) build your kernel with the FB_CON_DECOR option enabled. |
53 |
-+ |
54 |
-+To get fbcondecor operational right after fbcon initialization is finished, you |
55 |
-+will have to include a theme and the kernel helper into your initramfs image. |
56 |
-+Please refer to splashutils documentation for instructions on how to do that. |
57 |
-+ |
58 |
-+[1] The splashutils package can be downloaded from: |
59 |
-+ http://github.com/alanhaggai/fbsplash |
60 |
-+ |
61 |
-+The userspace helper |
62 |
-+-------------------- |
63 |
-+ |
64 |
-+The userspace fbcondecor helper (by default: /sbin/fbcondecor_helper) is called by the |
65 |
-+kernel whenever an important event occurs and the kernel needs some kind of |
66 |
-+job to be carried out. Important events include console switches and video |
67 |
-+mode switches (the kernel requests background images and configuration |
68 |
-+parameters for the current console). The fbcondecor helper must be accessible at |
69 |
-+all times. If it's not, fbcondecor will be switched off automatically. |
70 |
-+ |
71 |
-+It's possible to set path to the fbcondecor helper by writing it to |
72 |
-+/proc/sys/kernel/fbcondecor. |
73 |
-+ |
74 |
-+***************************************************************************** |
75 |
-+ |
76 |
-+The information below is mostly technical stuff. There's probably no need to |
77 |
-+read it unless you plan to develop a userspace helper. |
78 |
-+ |
79 |
-+The fbcondecor protocol |
80 |
-+----------------------- |
81 |
-+ |
82 |
-+The fbcondecor protocol defines a communication interface between the kernel and |
83 |
-+the userspace fbcondecor helper. |
84 |
-+ |
85 |
-+The kernel side is responsible for: |
86 |
-+ |
87 |
-+ * rendering console text, using an image as a background (instead of a |
88 |
-+ standard solid color fbcon uses), |
89 |
-+ * accepting commands from the user via ioctls on the fbcondecor device, |
90 |
-+ * calling the userspace helper to set things up as soon as the fb subsystem |
91 |
-+ is initialized. |
92 |
-+ |
93 |
-+The userspace helper is responsible for everything else, including parsing |
94 |
-+configuration files, decompressing the image files whenever the kernel needs |
95 |
-+it, and communicating with the kernel if necessary. |
96 |
-+ |
97 |
-+The fbcondecor protocol specifies how communication is done in both ways: |
98 |
-+kernel->userspace and userspace->helper. |
99 |
-+ |
100 |
-+Kernel -> Userspace |
101 |
-+------------------- |
102 |
-+ |
103 |
-+The kernel communicates with the userspace helper by calling it and specifying |
104 |
-+the task to be done in a series of arguments. |
105 |
-+ |
106 |
-+The arguments follow the pattern: |
107 |
-+<fbcondecor protocol version> <command> <parameters> |
108 |
-+ |
109 |
-+All commands defined in fbcondecor protocol v2 have the following parameters: |
110 |
-+ virtual console |
111 |
-+ framebuffer number |
112 |
-+ theme |
113 |
-+ |
114 |
-+Fbcondecor protocol v1 specified an additional 'fbcondecor mode' after the |
115 |
-+framebuffer number. Fbcondecor protocol v1 is deprecated and should not be used. |
116 |
-+ |
117 |
-+Fbcondecor protocol v2 specifies the following commands: |
118 |
-+ |
119 |
-+getpic |
120 |
-+------ |
121 |
-+ The kernel issues this command to request image data. It's up to the |
122 |
-+ userspace helper to find a background image appropriate for the specified |
123 |
-+ theme and the current resolution. The userspace helper should respond by |
124 |
-+ issuing the FBIOCONDECOR_SETPIC ioctl. |
125 |
-+ |
126 |
-+init |
127 |
-+---- |
128 |
-+ The kernel issues this command after the fbcondecor device is created and |
129 |
-+ the fbcondecor interface is initialized. Upon receiving 'init', the userspace |
130 |
-+ helper should parse the kernel command line (/proc/cmdline) or otherwise |
131 |
-+ decide whether fbcondecor is to be activated. |
132 |
-+ |
133 |
-+ To activate fbcondecor on the first console the helper should issue the |
134 |
-+ FBIOCONDECOR_SETCFG, FBIOCONDECOR_SETPIC and FBIOCONDECOR_SETSTATE commands, |
135 |
-+ in the above-mentioned order. |
136 |
-+ |
137 |
-+ When the userspace helper is called in an early phase of the boot process |
138 |
-+ (right after the initialization of fbcon), no filesystems will be mounted. |
139 |
-+ The helper program should mount sysfs and then create the appropriate |
140 |
-+ framebuffer, fbcondecor and tty0 devices (if they don't already exist) to get |
141 |
-+ current display settings and to be able to communicate with the kernel side. |
142 |
-+ It should probably also mount the procfs to be able to parse the kernel |
143 |
-+ command line parameters. |
144 |
-+ |
145 |
-+ Note that the console sem is not held when the kernel calls fbcondecor_helper |
146 |
-+ with the 'init' command. The fbcondecor helper should perform all ioctls with |
147 |
-+ origin set to FBCON_DECOR_IO_ORIG_USER. |
148 |
-+ |
149 |
-+modechange |
150 |
-+---------- |
151 |
-+ The kernel issues this command on a mode change. The helper's response should |
152 |
-+ be similar to the response to the 'init' command. Note that this time the |
153 |
-+ console sem is held and all ioctls must be performed with origin set to |
154 |
-+ FBCON_DECOR_IO_ORIG_KERNEL. |
155 |
-+ |
156 |
-+ |
157 |
-+Userspace -> Kernel |
158 |
-+------------------- |
159 |
-+ |
160 |
-+Userspace programs can communicate with fbcondecor via ioctls on the |
161 |
-+fbcondecor device. These ioctls are to be used by both the userspace helper |
162 |
-+(called only by the kernel) and userspace configuration tools (run by the users). |
163 |
-+ |
164 |
-+The fbcondecor helper should set the origin field to FBCON_DECOR_IO_ORIG_KERNEL |
165 |
-+when doing the appropriate ioctls. All userspace configuration tools should |
166 |
-+use FBCON_DECOR_IO_ORIG_USER. Failure to set the appropriate value in the origin |
167 |
-+field when performing ioctls from the kernel helper will most likely result |
168 |
-+in a console deadlock. |
169 |
-+ |
170 |
-+FBCON_DECOR_IO_ORIG_KERNEL instructs fbcondecor not to try to acquire the console |
171 |
-+semaphore. Not surprisingly, FBCON_DECOR_IO_ORIG_USER instructs it to acquire |
172 |
-+the console sem. |
173 |
-+ |
174 |
-+The framebuffer console decoration provides the following ioctls (all defined in |
175 |
-+linux/fb.h): |
176 |
-+ |
177 |
-+FBIOCONDECOR_SETPIC |
178 |
-+description: loads a background picture for a virtual console |
179 |
-+argument: struct fbcon_decor_iowrapper*; data: struct fb_image* |
180 |
-+notes: |
181 |
-+If called for consoles other than the current foreground one, the picture data |
182 |
-+will be ignored. |
183 |
-+ |
184 |
-+If the current virtual console is running in a 8-bpp mode, the cmap substruct |
185 |
-+of fb_image has to be filled appropriately: start should be set to 16 (first |
186 |
-+16 colors are reserved for fbcon), len to a value <= 240 and red, green and |
187 |
-+blue should point to valid cmap data. The transp field is ingored. The fields |
188 |
-+dx, dy, bg_color, fg_color in fb_image are ignored as well. |
189 |
-+ |
190 |
-+FBIOCONDECOR_SETCFG |
191 |
-+description: sets the fbcondecor config for a virtual console |
192 |
-+argument: struct fbcon_decor_iowrapper*; data: struct vc_decor* |
193 |
-+notes: The structure has to be filled with valid data. |
194 |
-+ |
195 |
-+FBIOCONDECOR_GETCFG |
196 |
-+description: gets the fbcondecor config for a virtual console |
197 |
-+argument: struct fbcon_decor_iowrapper*; data: struct vc_decor* |
198 |
-+ |
199 |
-+FBIOCONDECOR_SETSTATE |
200 |
-+description: sets the fbcondecor state for a virtual console |
201 |
-+argument: struct fbcon_decor_iowrapper*; data: unsigned int* |
202 |
-+ values: 0 = disabled, 1 = enabled. |
203 |
-+ |
204 |
-+FBIOCONDECOR_GETSTATE |
205 |
-+description: gets the fbcondecor state for a virtual console |
206 |
-+argument: struct fbcon_decor_iowrapper*; data: unsigned int* |
207 |
-+ values: as in FBIOCONDECOR_SETSTATE |
208 |
-+ |
209 |
-+Info on used structures: |
210 |
-+ |
211 |
-+Definition of struct vc_decor can be found in linux/console_decor.h. It's |
212 |
-+heavily commented. Note that the 'theme' field should point to a string |
213 |
-+no longer than FBCON_DECOR_THEME_LEN. When FBIOCONDECOR_GETCFG call is |
214 |
-+performed, the theme field should point to a char buffer of length |
215 |
-+FBCON_DECOR_THEME_LEN. |
216 |
-+ |
217 |
-+Definition of struct fbcon_decor_iowrapper can be found in linux/fb.h. |
218 |
-+The fields in this struct have the following meaning: |
219 |
-+ |
220 |
-+vc: |
221 |
-+Virtual console number. |
222 |
-+ |
223 |
-+origin: |
224 |
-+Specifies if the ioctl is performed as a response to a kernel request. The |
225 |
-+fbcondecor helper should set this field to FBCON_DECOR_IO_ORIG_KERNEL, userspace |
226 |
-+programs should set it to FBCON_DECOR_IO_ORIG_USER. This field is necessary to |
227 |
-+avoid console semaphore deadlocks. |
228 |
-+ |
229 |
-+data: |
230 |
-+Pointer to a data structure appropriate for the performed ioctl. Type of |
231 |
-+the data struct is specified in the ioctls description. |
232 |
-+ |
233 |
-+***************************************************************************** |
234 |
-+ |
235 |
-+Credit |
236 |
-+------ |
237 |
-+ |
238 |
-+Original 'bootsplash' project & implementation by: |
239 |
-+ Volker Poplawski <volker@×××××××××.de>, Stefan Reinauer <stepan@××××.de>, |
240 |
-+ Steffen Winterfeldt <snwint@××××.de>, Michael Schroeder <mls@××××.de>, |
241 |
-+ Ken Wimer <wimer@××××.de>. |
242 |
-+ |
243 |
-+Fbcondecor, fbcondecor protocol design, current implementation & docs by: |
244 |
-+ Michal Januszewski <michalj+fbcondecor@×××××.com> |
245 |
-+ |
246 |
-diff --git a/drivers/Makefile b/drivers/Makefile |
247 |
-index 7183b6a..d576148 100644 |
248 |
---- a/drivers/Makefile |
249 |
-+++ b/drivers/Makefile |
250 |
-@@ -17,6 +17,10 @@ obj-y += pwm/ |
251 |
- obj-$(CONFIG_PCI) += pci/ |
252 |
- obj-$(CONFIG_PARISC) += parisc/ |
253 |
- obj-$(CONFIG_RAPIDIO) += rapidio/ |
254 |
-+# tty/ comes before char/ so that the VT console is the boot-time |
255 |
-+# default. |
256 |
-+obj-y += tty/ |
257 |
-+obj-y += char/ |
258 |
- obj-y += video/ |
259 |
- obj-y += idle/ |
260 |
- |
261 |
-@@ -42,11 +46,6 @@ obj-$(CONFIG_REGULATOR) += regulator/ |
262 |
- # reset controllers early, since gpu drivers might rely on them to initialize |
263 |
- obj-$(CONFIG_RESET_CONTROLLER) += reset/ |
264 |
- |
265 |
--# tty/ comes before char/ so that the VT console is the boot-time |
266 |
--# default. |
267 |
--obj-y += tty/ |
268 |
--obj-y += char/ |
269 |
-- |
270 |
- # gpu/ comes after char for AGP vs DRM startup |
271 |
- obj-y += gpu/ |
272 |
- |
273 |
-diff --git a/drivers/video/console/Kconfig b/drivers/video/console/Kconfig |
274 |
-index fe1cd01..6d2e87a 100644 |
275 |
---- a/drivers/video/console/Kconfig |
276 |
-+++ b/drivers/video/console/Kconfig |
277 |
-@@ -126,6 +126,19 @@ config FRAMEBUFFER_CONSOLE_ROTATION |
278 |
- such that other users of the framebuffer will remain normally |
279 |
- oriented. |
280 |
- |
281 |
-+config FB_CON_DECOR |
282 |
-+ bool "Support for the Framebuffer Console Decorations" |
283 |
-+ depends on FRAMEBUFFER_CONSOLE=y && !FB_TILEBLITTING |
284 |
-+ default n |
285 |
-+ ---help--- |
286 |
-+ This option enables support for framebuffer console decorations which |
287 |
-+ makes it possible to display images in the background of the system |
288 |
-+ consoles. Note that userspace utilities are necessary in order to take |
289 |
-+ advantage of these features. Refer to Documentation/fb/fbcondecor.txt |
290 |
-+ for more information. |
291 |
-+ |
292 |
-+ If unsure, say N. |
293 |
-+ |
294 |
- config STI_CONSOLE |
295 |
- bool "STI text console" |
296 |
- depends on PARISC |
297 |
-diff --git a/drivers/video/console/Makefile b/drivers/video/console/Makefile |
298 |
-index 43bfa48..cc104b6 100644 |
299 |
---- a/drivers/video/console/Makefile |
300 |
-+++ b/drivers/video/console/Makefile |
301 |
-@@ -16,4 +16,5 @@ obj-$(CONFIG_FRAMEBUFFER_CONSOLE) += fbcon_rotate.o fbcon_cw.o fbcon_ud.o \ |
302 |
- fbcon_ccw.o |
303 |
- endif |
304 |
- |
305 |
-+obj-$(CONFIG_FB_CON_DECOR) += fbcondecor.o cfbcondecor.o |
306 |
- obj-$(CONFIG_FB_STI) += sticore.o |
307 |
-diff --git a/drivers/video/console/bitblit.c b/drivers/video/console/bitblit.c |
308 |
-index 61b182b..984384b 100644 |
309 |
---- a/drivers/video/console/bitblit.c |
310 |
-+++ b/drivers/video/console/bitblit.c |
311 |
-@@ -18,6 +18,7 @@ |
312 |
- #include <linux/console.h> |
313 |
- #include <asm/types.h> |
314 |
- #include "fbcon.h" |
315 |
-+#include "fbcondecor.h" |
316 |
- |
317 |
- /* |
318 |
- * Accelerated handlers. |
319 |
-@@ -55,6 +56,13 @@ static void bit_bmove(struct vc_data *vc, struct fb_info *info, int sy, |
320 |
- area.height = height * vc->vc_font.height; |
321 |
- area.width = width * vc->vc_font.width; |
322 |
- |
323 |
-+ if (fbcon_decor_active(info, vc)) { |
324 |
-+ area.sx += vc->vc_decor.tx; |
325 |
-+ area.sy += vc->vc_decor.ty; |
326 |
-+ area.dx += vc->vc_decor.tx; |
327 |
-+ area.dy += vc->vc_decor.ty; |
328 |
-+ } |
329 |
-+ |
330 |
- info->fbops->fb_copyarea(info, &area); |
331 |
- } |
332 |
- |
333 |
-@@ -380,11 +388,15 @@ static void bit_cursor(struct vc_data *vc, struct fb_info *info, int mode, |
334 |
- cursor.image.depth = 1; |
335 |
- cursor.rop = ROP_XOR; |
336 |
- |
337 |
-- if (info->fbops->fb_cursor) |
338 |
-- err = info->fbops->fb_cursor(info, &cursor); |
339 |
-+ if (fbcon_decor_active(info, vc)) { |
340 |
-+ fbcon_decor_cursor(info, &cursor); |
341 |
-+ } else { |
342 |
-+ if (info->fbops->fb_cursor) |
343 |
-+ err = info->fbops->fb_cursor(info, &cursor); |
344 |
- |
345 |
-- if (err) |
346 |
-- soft_cursor(info, &cursor); |
347 |
-+ if (err) |
348 |
-+ soft_cursor(info, &cursor); |
349 |
-+ } |
350 |
- |
351 |
- ops->cursor_reset = 0; |
352 |
- } |
353 |
-diff --git a/drivers/video/console/cfbcondecor.c b/drivers/video/console/cfbcondecor.c |
354 |
-new file mode 100644 |
355 |
-index 0000000..a2b4497 |
356 |
---- /dev/null |
357 |
-+++ b/drivers/video/console/cfbcondecor.c |
358 |
-@@ -0,0 +1,471 @@ |
359 |
-+/* |
360 |
-+ * linux/drivers/video/cfbcon_decor.c -- Framebuffer decor render functions |
361 |
-+ * |
362 |
-+ * Copyright (C) 2004 Michal Januszewski <michalj+fbcondecor@×××××.com> |
363 |
-+ * |
364 |
-+ * Code based upon "Bootdecor" (C) 2001-2003 |
365 |
-+ * Volker Poplawski <volker@×××××××××.de>, |
366 |
-+ * Stefan Reinauer <stepan@××××.de>, |
367 |
-+ * Steffen Winterfeldt <snwint@××××.de>, |
368 |
-+ * Michael Schroeder <mls@××××.de>, |
369 |
-+ * Ken Wimer <wimer@××××.de>. |
370 |
-+ * |
371 |
-+ * This file is subject to the terms and conditions of the GNU General Public |
372 |
-+ * License. See the file COPYING in the main directory of this archive for |
373 |
-+ * more details. |
374 |
-+ */ |
375 |
-+#include <linux/module.h> |
376 |
-+#include <linux/types.h> |
377 |
-+#include <linux/fb.h> |
378 |
-+#include <linux/selection.h> |
379 |
-+#include <linux/slab.h> |
380 |
-+#include <linux/vt_kern.h> |
381 |
-+#include <asm/irq.h> |
382 |
-+ |
383 |
-+#include "fbcon.h" |
384 |
-+#include "fbcondecor.h" |
385 |
-+ |
386 |
-+#define parse_pixel(shift,bpp,type) \ |
387 |
-+ do { \ |
388 |
-+ if (d & (0x80 >> (shift))) \ |
389 |
-+ dd2[(shift)] = fgx; \ |
390 |
-+ else \ |
391 |
-+ dd2[(shift)] = transparent ? *(type *)decor_src : bgx; \ |
392 |
-+ decor_src += (bpp); \ |
393 |
-+ } while (0) \ |
394 |
-+ |
395 |
-+extern int get_color(struct vc_data *vc, struct fb_info *info, |
396 |
-+ u16 c, int is_fg); |
397 |
-+ |
398 |
-+void fbcon_decor_fix_pseudo_pal(struct fb_info *info, struct vc_data *vc) |
399 |
-+{ |
400 |
-+ int i, j, k; |
401 |
-+ int minlen = min(min(info->var.red.length, info->var.green.length), |
402 |
-+ info->var.blue.length); |
403 |
-+ u32 col; |
404 |
-+ |
405 |
-+ for (j = i = 0; i < 16; i++) { |
406 |
-+ k = color_table[i]; |
407 |
-+ |
408 |
-+ col = ((vc->vc_palette[j++] >> (8-minlen)) |
409 |
-+ << info->var.red.offset); |
410 |
-+ col |= ((vc->vc_palette[j++] >> (8-minlen)) |
411 |
-+ << info->var.green.offset); |
412 |
-+ col |= ((vc->vc_palette[j++] >> (8-minlen)) |
413 |
-+ << info->var.blue.offset); |
414 |
-+ ((u32 *)info->pseudo_palette)[k] = col; |
415 |
-+ } |
416 |
-+} |
417 |
-+ |
418 |
-+void fbcon_decor_renderc(struct fb_info *info, int ypos, int xpos, int height, |
419 |
-+ int width, u8* src, u32 fgx, u32 bgx, u8 transparent) |
420 |
-+{ |
421 |
-+ unsigned int x, y; |
422 |
-+ u32 dd; |
423 |
-+ int bytespp = ((info->var.bits_per_pixel + 7) >> 3); |
424 |
-+ unsigned int d = ypos * info->fix.line_length + xpos * bytespp; |
425 |
-+ unsigned int ds = (ypos * info->var.xres + xpos) * bytespp; |
426 |
-+ u16 dd2[4]; |
427 |
-+ |
428 |
-+ u8* decor_src = (u8 *)(info->bgdecor.data + ds); |
429 |
-+ u8* dst = (u8 *)(info->screen_base + d); |
430 |
-+ |
431 |
-+ if ((ypos + height) > info->var.yres || (xpos + width) > info->var.xres) |
432 |
-+ return; |
433 |
-+ |
434 |
-+ for (y = 0; y < height; y++) { |
435 |
-+ switch (info->var.bits_per_pixel) { |
436 |
-+ |
437 |
-+ case 32: |
438 |
-+ for (x = 0; x < width; x++) { |
439 |
-+ |
440 |
-+ if ((x & 7) == 0) |
441 |
-+ d = *src++; |
442 |
-+ if (d & 0x80) |
443 |
-+ dd = fgx; |
444 |
-+ else |
445 |
-+ dd = transparent ? |
446 |
-+ *(u32 *)decor_src : bgx; |
447 |
-+ |
448 |
-+ d <<= 1; |
449 |
-+ decor_src += 4; |
450 |
-+ fb_writel(dd, dst); |
451 |
-+ dst += 4; |
452 |
-+ } |
453 |
-+ break; |
454 |
-+ case 24: |
455 |
-+ for (x = 0; x < width; x++) { |
456 |
-+ |
457 |
-+ if ((x & 7) == 0) |
458 |
-+ d = *src++; |
459 |
-+ if (d & 0x80) |
460 |
-+ dd = fgx; |
461 |
-+ else |
462 |
-+ dd = transparent ? |
463 |
-+ (*(u32 *)decor_src & 0xffffff) : bgx; |
464 |
-+ |
465 |
-+ d <<= 1; |
466 |
-+ decor_src += 3; |
467 |
-+#ifdef __LITTLE_ENDIAN |
468 |
-+ fb_writew(dd & 0xffff, dst); |
469 |
-+ dst += 2; |
470 |
-+ fb_writeb((dd >> 16), dst); |
471 |
-+#else |
472 |
-+ fb_writew(dd >> 8, dst); |
473 |
-+ dst += 2; |
474 |
-+ fb_writeb(dd & 0xff, dst); |
475 |
-+#endif |
476 |
-+ dst++; |
477 |
-+ } |
478 |
-+ break; |
479 |
-+ case 16: |
480 |
-+ for (x = 0; x < width; x += 2) { |
481 |
-+ if ((x & 7) == 0) |
482 |
-+ d = *src++; |
483 |
-+ |
484 |
-+ parse_pixel(0, 2, u16); |
485 |
-+ parse_pixel(1, 2, u16); |
486 |
-+#ifdef __LITTLE_ENDIAN |
487 |
-+ dd = dd2[0] | (dd2[1] << 16); |
488 |
-+#else |
489 |
-+ dd = dd2[1] | (dd2[0] << 16); |
490 |
-+#endif |
491 |
-+ d <<= 2; |
492 |
-+ fb_writel(dd, dst); |
493 |
-+ dst += 4; |
494 |
-+ } |
495 |
-+ break; |
496 |
-+ |
497 |
-+ case 8: |
498 |
-+ for (x = 0; x < width; x += 4) { |
499 |
-+ if ((x & 7) == 0) |
500 |
-+ d = *src++; |
501 |
-+ |
502 |
-+ parse_pixel(0, 1, u8); |
503 |
-+ parse_pixel(1, 1, u8); |
504 |
-+ parse_pixel(2, 1, u8); |
505 |
-+ parse_pixel(3, 1, u8); |
506 |
-+ |
507 |
-+#ifdef __LITTLE_ENDIAN |
508 |
-+ dd = dd2[0] | (dd2[1] << 8) | (dd2[2] << 16) | (dd2[3] << 24); |
509 |
-+#else |
510 |
-+ dd = dd2[3] | (dd2[2] << 8) | (dd2[1] << 16) | (dd2[0] << 24); |
511 |
-+#endif |
512 |
-+ d <<= 4; |
513 |
-+ fb_writel(dd, dst); |
514 |
-+ dst += 4; |
515 |
-+ } |
516 |
-+ } |
517 |
-+ |
518 |
-+ dst += info->fix.line_length - width * bytespp; |
519 |
-+ decor_src += (info->var.xres - width) * bytespp; |
520 |
-+ } |
521 |
-+} |
522 |
-+ |
523 |
-+#define cc2cx(a) \ |
524 |
-+ ((info->fix.visual == FB_VISUAL_TRUECOLOR || \ |
525 |
-+ info->fix.visual == FB_VISUAL_DIRECTCOLOR) ? \ |
526 |
-+ ((u32*)info->pseudo_palette)[a] : a) |
527 |
-+ |
528 |
-+void fbcon_decor_putcs(struct vc_data *vc, struct fb_info *info, |
529 |
-+ const unsigned short *s, int count, int yy, int xx) |
530 |
-+{ |
531 |
-+ unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff; |
532 |
-+ struct fbcon_ops *ops = info->fbcon_par; |
533 |
-+ int fg_color, bg_color, transparent; |
534 |
-+ u8 *src; |
535 |
-+ u32 bgx, fgx; |
536 |
-+ u16 c = scr_readw(s); |
537 |
-+ |
538 |
-+ fg_color = get_color(vc, info, c, 1); |
539 |
-+ bg_color = get_color(vc, info, c, 0); |
540 |
-+ |
541 |
-+ /* Don't paint the background image if console is blanked */ |
542 |
-+ transparent = ops->blank_state ? 0 : |
543 |
-+ (vc->vc_decor.bg_color == bg_color); |
544 |
-+ |
545 |
-+ xx = xx * vc->vc_font.width + vc->vc_decor.tx; |
546 |
-+ yy = yy * vc->vc_font.height + vc->vc_decor.ty; |
547 |
-+ |
548 |
-+ fgx = cc2cx(fg_color); |
549 |
-+ bgx = cc2cx(bg_color); |
550 |
-+ |
551 |
-+ while (count--) { |
552 |
-+ c = scr_readw(s++); |
553 |
-+ src = vc->vc_font.data + (c & charmask) * vc->vc_font.height * |
554 |
-+ ((vc->vc_font.width + 7) >> 3); |
555 |
-+ |
556 |
-+ fbcon_decor_renderc(info, yy, xx, vc->vc_font.height, |
557 |
-+ vc->vc_font.width, src, fgx, bgx, transparent); |
558 |
-+ xx += vc->vc_font.width; |
559 |
-+ } |
560 |
-+} |
561 |
-+ |
562 |
-+void fbcon_decor_cursor(struct fb_info *info, struct fb_cursor *cursor) |
563 |
-+{ |
564 |
-+ int i; |
565 |
-+ unsigned int dsize, s_pitch; |
566 |
-+ struct fbcon_ops *ops = info->fbcon_par; |
567 |
-+ struct vc_data* vc; |
568 |
-+ u8 *src; |
569 |
-+ |
570 |
-+ /* we really don't need any cursors while the console is blanked */ |
571 |
-+ if (info->state != FBINFO_STATE_RUNNING || ops->blank_state) |
572 |
-+ return; |
573 |
-+ |
574 |
-+ vc = vc_cons[ops->currcon].d; |
575 |
-+ |
576 |
-+ src = kmalloc(64 + sizeof(struct fb_image), GFP_ATOMIC); |
577 |
-+ if (!src) |
578 |
-+ return; |
579 |
-+ |
580 |
-+ s_pitch = (cursor->image.width + 7) >> 3; |
581 |
-+ dsize = s_pitch * cursor->image.height; |
582 |
-+ if (cursor->enable) { |
583 |
-+ switch (cursor->rop) { |
584 |
-+ case ROP_XOR: |
585 |
-+ for (i = 0; i < dsize; i++) |
586 |
-+ src[i] = cursor->image.data[i] ^ cursor->mask[i]; |
587 |
-+ break; |
588 |
-+ case ROP_COPY: |
589 |
-+ default: |
590 |
-+ for (i = 0; i < dsize; i++) |
591 |
-+ src[i] = cursor->image.data[i] & cursor->mask[i]; |
592 |
-+ break; |
593 |
-+ } |
594 |
-+ } else |
595 |
-+ memcpy(src, cursor->image.data, dsize); |
596 |
-+ |
597 |
-+ fbcon_decor_renderc(info, |
598 |
-+ cursor->image.dy + vc->vc_decor.ty, |
599 |
-+ cursor->image.dx + vc->vc_decor.tx, |
600 |
-+ cursor->image.height, |
601 |
-+ cursor->image.width, |
602 |
-+ (u8*)src, |
603 |
-+ cc2cx(cursor->image.fg_color), |
604 |
-+ cc2cx(cursor->image.bg_color), |
605 |
-+ cursor->image.bg_color == vc->vc_decor.bg_color); |
606 |
-+ |
607 |
-+ kfree(src); |
608 |
-+} |
609 |
-+ |
610 |
-+static void decorset(u8 *dst, int height, int width, int dstbytes, |
611 |
-+ u32 bgx, int bpp) |
612 |
-+{ |
613 |
-+ int i; |
614 |
-+ |
615 |
-+ if (bpp == 8) |
616 |
-+ bgx |= bgx << 8; |
617 |
-+ if (bpp == 16 || bpp == 8) |
618 |
-+ bgx |= bgx << 16; |
619 |
-+ |
620 |
-+ while (height-- > 0) { |
621 |
-+ u8 *p = dst; |
622 |
-+ |
623 |
-+ switch (bpp) { |
624 |
-+ |
625 |
-+ case 32: |
626 |
-+ for (i=0; i < width; i++) { |
627 |
-+ fb_writel(bgx, p); p += 4; |
628 |
-+ } |
629 |
-+ break; |
630 |
-+ case 24: |
631 |
-+ for (i=0; i < width; i++) { |
632 |
-+#ifdef __LITTLE_ENDIAN |
633 |
-+ fb_writew((bgx & 0xffff),(u16*)p); p += 2; |
634 |
-+ fb_writeb((bgx >> 16),p++); |
635 |
-+#else |
636 |
-+ fb_writew((bgx >> 8),(u16*)p); p += 2; |
637 |
-+ fb_writeb((bgx & 0xff),p++); |
638 |
-+#endif |
639 |
-+ } |
640 |
-+ case 16: |
641 |
-+ for (i=0; i < width/4; i++) { |
642 |
-+ fb_writel(bgx,p); p += 4; |
643 |
-+ fb_writel(bgx,p); p += 4; |
644 |
-+ } |
645 |
-+ if (width & 2) { |
646 |
-+ fb_writel(bgx,p); p += 4; |
647 |
-+ } |
648 |
-+ if (width & 1) |
649 |
-+ fb_writew(bgx,(u16*)p); |
650 |
-+ break; |
651 |
-+ case 8: |
652 |
-+ for (i=0; i < width/4; i++) { |
653 |
-+ fb_writel(bgx,p); p += 4; |
654 |
-+ } |
655 |
-+ |
656 |
-+ if (width & 2) { |
657 |
-+ fb_writew(bgx,p); p += 2; |
658 |
-+ } |
659 |
-+ if (width & 1) |
660 |
-+ fb_writeb(bgx,(u8*)p); |
661 |
-+ break; |
662 |
-+ |
663 |
-+ } |
664 |
-+ dst += dstbytes; |
665 |
-+ } |
666 |
-+} |
667 |
-+ |
668 |
-+void fbcon_decor_copy(u8 *dst, u8 *src, int height, int width, int linebytes, |
669 |
-+ int srclinebytes, int bpp) |
670 |
-+{ |
671 |
-+ int i; |
672 |
-+ |
673 |
-+ while (height-- > 0) { |
674 |
-+ u32 *p = (u32 *)dst; |
675 |
-+ u32 *q = (u32 *)src; |
676 |
-+ |
677 |
-+ switch (bpp) { |
678 |
-+ |
679 |
-+ case 32: |
680 |
-+ for (i=0; i < width; i++) |
681 |
-+ fb_writel(*q++, p++); |
682 |
-+ break; |
683 |
-+ case 24: |
684 |
-+ for (i=0; i < (width*3/4); i++) |
685 |
-+ fb_writel(*q++, p++); |
686 |
-+ if ((width*3) % 4) { |
687 |
-+ if (width & 2) { |
688 |
-+ fb_writeb(*(u8*)q, (u8*)p); |
689 |
-+ } else if (width & 1) { |
690 |
-+ fb_writew(*(u16*)q, (u16*)p); |
691 |
-+ fb_writeb(*(u8*)((u16*)q+1),(u8*)((u16*)p+2)); |
692 |
-+ } |
693 |
-+ } |
694 |
-+ break; |
695 |
-+ case 16: |
696 |
-+ for (i=0; i < width/4; i++) { |
697 |
-+ fb_writel(*q++, p++); |
698 |
-+ fb_writel(*q++, p++); |
699 |
-+ } |
700 |
-+ if (width & 2) |
701 |
-+ fb_writel(*q++, p++); |
702 |
-+ if (width & 1) |
703 |
-+ fb_writew(*(u16*)q, (u16*)p); |
704 |
-+ break; |
705 |
-+ case 8: |
706 |
-+ for (i=0; i < width/4; i++) |
707 |
-+ fb_writel(*q++, p++); |
708 |
-+ |
709 |
-+ if (width & 2) { |
710 |
-+ fb_writew(*(u16*)q, (u16*)p); |
711 |
-+ q = (u32*) ((u16*)q + 1); |
712 |
-+ p = (u32*) ((u16*)p + 1); |
713 |
-+ } |
714 |
-+ if (width & 1) |
715 |
-+ fb_writeb(*(u8*)q, (u8*)p); |
716 |
-+ break; |
717 |
-+ } |
718 |
-+ |
719 |
-+ dst += linebytes; |
720 |
-+ src += srclinebytes; |
721 |
-+ } |
722 |
-+} |
723 |
-+ |
724 |
-+static void decorfill(struct fb_info *info, int sy, int sx, int height, |
725 |
-+ int width) |
726 |
-+{ |
727 |
-+ int bytespp = ((info->var.bits_per_pixel + 7) >> 3); |
728 |
-+ int d = sy * info->fix.line_length + sx * bytespp; |
729 |
-+ int ds = (sy * info->var.xres + sx) * bytespp; |
730 |
-+ |
731 |
-+ fbcon_decor_copy((u8 *)(info->screen_base + d), (u8 *)(info->bgdecor.data + ds), |
732 |
-+ height, width, info->fix.line_length, info->var.xres * bytespp, |
733 |
-+ info->var.bits_per_pixel); |
734 |
-+} |
735 |
-+ |
736 |
-+void fbcon_decor_clear(struct vc_data *vc, struct fb_info *info, int sy, int sx, |
737 |
-+ int height, int width) |
738 |
-+{ |
739 |
-+ int bgshift = (vc->vc_hi_font_mask) ? 13 : 12; |
740 |
-+ struct fbcon_ops *ops = info->fbcon_par; |
741 |
-+ u8 *dst; |
742 |
-+ int transparent, bg_color = attr_bgcol_ec(bgshift, vc, info); |
743 |
-+ |
744 |
-+ transparent = (vc->vc_decor.bg_color == bg_color); |
745 |
-+ sy = sy * vc->vc_font.height + vc->vc_decor.ty; |
746 |
-+ sx = sx * vc->vc_font.width + vc->vc_decor.tx; |
747 |
-+ height *= vc->vc_font.height; |
748 |
-+ width *= vc->vc_font.width; |
749 |
-+ |
750 |
-+ /* Don't paint the background image if console is blanked */ |
751 |
-+ if (transparent && !ops->blank_state) { |
752 |
-+ decorfill(info, sy, sx, height, width); |
753 |
-+ } else { |
754 |
-+ dst = (u8 *)(info->screen_base + sy * info->fix.line_length + |
755 |
-+ sx * ((info->var.bits_per_pixel + 7) >> 3)); |
756 |
-+ decorset(dst, height, width, info->fix.line_length, cc2cx(bg_color), |
757 |
-+ info->var.bits_per_pixel); |
758 |
-+ } |
759 |
-+} |
760 |
-+ |
761 |
-+void fbcon_decor_clear_margins(struct vc_data *vc, struct fb_info *info, |
762 |
-+ int bottom_only) |
763 |
-+{ |
764 |
-+ unsigned int tw = vc->vc_cols*vc->vc_font.width; |
765 |
-+ unsigned int th = vc->vc_rows*vc->vc_font.height; |
766 |
-+ |
767 |
-+ if (!bottom_only) { |
768 |
-+ /* top margin */ |
769 |
-+ decorfill(info, 0, 0, vc->vc_decor.ty, info->var.xres); |
770 |
-+ /* left margin */ |
771 |
-+ decorfill(info, vc->vc_decor.ty, 0, th, vc->vc_decor.tx); |
772 |
-+ /* right margin */ |
773 |
-+ decorfill(info, vc->vc_decor.ty, vc->vc_decor.tx + tw, th, |
774 |
-+ info->var.xres - vc->vc_decor.tx - tw); |
775 |
-+ } |
776 |
-+ decorfill(info, vc->vc_decor.ty + th, 0, |
777 |
-+ info->var.yres - vc->vc_decor.ty - th, info->var.xres); |
778 |
-+} |
779 |
-+ |
780 |
-+void fbcon_decor_bmove_redraw(struct vc_data *vc, struct fb_info *info, int y, |
781 |
-+ int sx, int dx, int width) |
782 |
-+{ |
783 |
-+ u16 *d = (u16 *) (vc->vc_origin + vc->vc_size_row * y + dx * 2); |
784 |
-+ u16 *s = d + (dx - sx); |
785 |
-+ u16 *start = d; |
786 |
-+ u16 *ls = d; |
787 |
-+ u16 *le = d + width; |
788 |
-+ u16 c; |
789 |
-+ int x = dx; |
790 |
-+ u16 attr = 1; |
791 |
-+ |
792 |
-+ do { |
793 |
-+ c = scr_readw(d); |
794 |
-+ if (attr != (c & 0xff00)) { |
795 |
-+ attr = c & 0xff00; |
796 |
-+ if (d > start) { |
797 |
-+ fbcon_decor_putcs(vc, info, start, d - start, y, x); |
798 |
-+ x += d - start; |
799 |
-+ start = d; |
800 |
-+ } |
801 |
-+ } |
802 |
-+ if (s >= ls && s < le && c == scr_readw(s)) { |
803 |
-+ if (d > start) { |
804 |
-+ fbcon_decor_putcs(vc, info, start, d - start, y, x); |
805 |
-+ x += d - start + 1; |
806 |
-+ start = d + 1; |
807 |
-+ } else { |
808 |
-+ x++; |
809 |
-+ start++; |
810 |
-+ } |
811 |
-+ } |
812 |
-+ s++; |
813 |
-+ d++; |
814 |
-+ } while (d < le); |
815 |
-+ if (d > start) |
816 |
-+ fbcon_decor_putcs(vc, info, start, d - start, y, x); |
817 |
-+} |
818 |
-+ |
819 |
-+void fbcon_decor_blank(struct vc_data *vc, struct fb_info *info, int blank) |
820 |
-+{ |
821 |
-+ if (blank) { |
822 |
-+ decorset((u8 *)info->screen_base, info->var.yres, info->var.xres, |
823 |
-+ info->fix.line_length, 0, info->var.bits_per_pixel); |
824 |
-+ } else { |
825 |
-+ update_screen(vc); |
826 |
-+ fbcon_decor_clear_margins(vc, info, 0); |
827 |
-+ } |
828 |
-+} |
829 |
-+ |
830 |
-diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c |
831 |
-index f447734..1a840c2 100644 |
832 |
---- a/drivers/video/console/fbcon.c |
833 |
-+++ b/drivers/video/console/fbcon.c |
834 |
-@@ -79,6 +79,7 @@ |
835 |
- #include <asm/irq.h> |
836 |
- |
837 |
- #include "fbcon.h" |
838 |
-+#include "fbcondecor.h" |
839 |
- |
840 |
- #ifdef FBCONDEBUG |
841 |
- # define DPRINTK(fmt, args...) printk(KERN_DEBUG "%s: " fmt, __func__ , ## args) |
842 |
-@@ -94,7 +95,7 @@ enum { |
843 |
- |
844 |
- static struct display fb_display[MAX_NR_CONSOLES]; |
845 |
- |
846 |
--static signed char con2fb_map[MAX_NR_CONSOLES]; |
847 |
-+signed char con2fb_map[MAX_NR_CONSOLES]; |
848 |
- static signed char con2fb_map_boot[MAX_NR_CONSOLES]; |
849 |
- |
850 |
- static int logo_lines; |
851 |
-@@ -286,7 +287,7 @@ static inline int fbcon_is_inactive(struct vc_data *vc, struct fb_info *info) |
852 |
- !vt_force_oops_output(vc); |
853 |
- } |
854 |
- |
855 |
--static int get_color(struct vc_data *vc, struct fb_info *info, |
856 |
-+int get_color(struct vc_data *vc, struct fb_info *info, |
857 |
- u16 c, int is_fg) |
858 |
- { |
859 |
- int depth = fb_get_color_depth(&info->var, &info->fix); |
860 |
-@@ -551,6 +552,9 @@ static int do_fbcon_takeover(int show_logo) |
861 |
- info_idx = -1; |
862 |
- } else { |
863 |
- fbcon_has_console_bind = 1; |
864 |
-+#ifdef CONFIG_FB_CON_DECOR |
865 |
-+ fbcon_decor_init(); |
866 |
-+#endif |
867 |
- } |
868 |
- |
869 |
- return err; |
870 |
-@@ -1007,6 +1011,12 @@ static const char *fbcon_startup(void) |
871 |
- rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres); |
872 |
- cols /= vc->vc_font.width; |
873 |
- rows /= vc->vc_font.height; |
874 |
-+ |
875 |
-+ if (fbcon_decor_active(info, vc)) { |
876 |
-+ cols = vc->vc_decor.twidth / vc->vc_font.width; |
877 |
-+ rows = vc->vc_decor.theight / vc->vc_font.height; |
878 |
-+ } |
879 |
-+ |
880 |
- vc_resize(vc, cols, rows); |
881 |
- |
882 |
- DPRINTK("mode: %s\n", info->fix.id); |
883 |
-@@ -1036,7 +1046,7 @@ static void fbcon_init(struct vc_data *vc, int init) |
884 |
- cap = info->flags; |
885 |
- |
886 |
- if (vc != svc || logo_shown == FBCON_LOGO_DONTSHOW || |
887 |
-- (info->fix.type == FB_TYPE_TEXT)) |
888 |
-+ (info->fix.type == FB_TYPE_TEXT) || fbcon_decor_active(info, vc)) |
889 |
- logo = 0; |
890 |
- |
891 |
- if (var_to_display(p, &info->var, info)) |
892 |
-@@ -1260,6 +1270,11 @@ static void fbcon_clear(struct vc_data *vc, int sy, int sx, int height, |
893 |
- fbcon_clear_margins(vc, 0); |
894 |
- } |
895 |
- |
896 |
-+ if (fbcon_decor_active(info, vc)) { |
897 |
-+ fbcon_decor_clear(vc, info, sy, sx, height, width); |
898 |
-+ return; |
899 |
-+ } |
900 |
-+ |
901 |
- /* Split blits that cross physical y_wrap boundary */ |
902 |
- |
903 |
- y_break = p->vrows - p->yscroll; |
904 |
-@@ -1279,10 +1294,15 @@ static void fbcon_putcs(struct vc_data *vc, const unsigned short *s, |
905 |
- struct display *p = &fb_display[vc->vc_num]; |
906 |
- struct fbcon_ops *ops = info->fbcon_par; |
907 |
- |
908 |
-- if (!fbcon_is_inactive(vc, info)) |
909 |
-- ops->putcs(vc, info, s, count, real_y(p, ypos), xpos, |
910 |
-- get_color(vc, info, scr_readw(s), 1), |
911 |
-- get_color(vc, info, scr_readw(s), 0)); |
912 |
-+ if (!fbcon_is_inactive(vc, info)) { |
913 |
-+ |
914 |
-+ if (fbcon_decor_active(info, vc)) |
915 |
-+ fbcon_decor_putcs(vc, info, s, count, ypos, xpos); |
916 |
-+ else |
917 |
-+ ops->putcs(vc, info, s, count, real_y(p, ypos), xpos, |
918 |
-+ get_color(vc, info, scr_readw(s), 1), |
919 |
-+ get_color(vc, info, scr_readw(s), 0)); |
920 |
-+ } |
921 |
- } |
922 |
- |
923 |
- static void fbcon_putc(struct vc_data *vc, int c, int ypos, int xpos) |
924 |
-@@ -1298,8 +1318,13 @@ static void fbcon_clear_margins(struct vc_data *vc, int bottom_only) |
925 |
- struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; |
926 |
- struct fbcon_ops *ops = info->fbcon_par; |
927 |
- |
928 |
-- if (!fbcon_is_inactive(vc, info)) |
929 |
-- ops->clear_margins(vc, info, bottom_only); |
930 |
-+ if (!fbcon_is_inactive(vc, info)) { |
931 |
-+ if (fbcon_decor_active(info, vc)) { |
932 |
-+ fbcon_decor_clear_margins(vc, info, bottom_only); |
933 |
-+ } else { |
934 |
-+ ops->clear_margins(vc, info, bottom_only); |
935 |
-+ } |
936 |
-+ } |
937 |
- } |
938 |
- |
939 |
- static void fbcon_cursor(struct vc_data *vc, int mode) |
940 |
-@@ -1819,7 +1844,7 @@ static int fbcon_scroll(struct vc_data *vc, int t, int b, int dir, |
941 |
- count = vc->vc_rows; |
942 |
- if (softback_top) |
943 |
- fbcon_softback_note(vc, t, count); |
944 |
-- if (logo_shown >= 0) |
945 |
-+ if (logo_shown >= 0 || fbcon_decor_active(info, vc)) |
946 |
- goto redraw_up; |
947 |
- switch (p->scrollmode) { |
948 |
- case SCROLL_MOVE: |
949 |
-@@ -1912,6 +1937,8 @@ static int fbcon_scroll(struct vc_data *vc, int t, int b, int dir, |
950 |
- count = vc->vc_rows; |
951 |
- if (logo_shown >= 0) |
952 |
- goto redraw_down; |
953 |
-+ if (fbcon_decor_active(info, vc)) |
954 |
-+ goto redraw_down; |
955 |
- switch (p->scrollmode) { |
956 |
- case SCROLL_MOVE: |
957 |
- fbcon_redraw_blit(vc, info, p, b - 1, b - t - count, |
958 |
-@@ -2060,6 +2087,13 @@ static void fbcon_bmove_rec(struct vc_data *vc, struct display *p, int sy, int s |
959 |
- } |
960 |
- return; |
961 |
- } |
962 |
-+ |
963 |
-+ if (fbcon_decor_active(info, vc) && sy == dy && height == 1) { |
964 |
-+ /* must use slower redraw bmove to keep background pic intact */ |
965 |
-+ fbcon_decor_bmove_redraw(vc, info, sy, sx, dx, width); |
966 |
-+ return; |
967 |
-+ } |
968 |
-+ |
969 |
- ops->bmove(vc, info, real_y(p, sy), sx, real_y(p, dy), dx, |
970 |
- height, width); |
971 |
- } |
972 |
-@@ -2130,8 +2164,8 @@ static int fbcon_resize(struct vc_data *vc, unsigned int width, |
973 |
- var.yres = virt_h * virt_fh; |
974 |
- x_diff = info->var.xres - var.xres; |
975 |
- y_diff = info->var.yres - var.yres; |
976 |
-- if (x_diff < 0 || x_diff > virt_fw || |
977 |
-- y_diff < 0 || y_diff > virt_fh) { |
978 |
-+ if ((x_diff < 0 || x_diff > virt_fw || |
979 |
-+ y_diff < 0 || y_diff > virt_fh) && !vc->vc_decor.state) { |
980 |
- const struct fb_videomode *mode; |
981 |
- |
982 |
- DPRINTK("attempting resize %ix%i\n", var.xres, var.yres); |
983 |
-@@ -2167,6 +2201,21 @@ static int fbcon_switch(struct vc_data *vc) |
984 |
- |
985 |
- info = registered_fb[con2fb_map[vc->vc_num]]; |
986 |
- ops = info->fbcon_par; |
987 |
-+ prev_console = ops->currcon; |
988 |
-+ if (prev_console != -1) |
989 |
-+ old_info = registered_fb[con2fb_map[prev_console]]; |
990 |
-+ |
991 |
-+#ifdef CONFIG_FB_CON_DECOR |
992 |
-+ if (!fbcon_decor_active_vc(vc) && info->fix.visual == FB_VISUAL_DIRECTCOLOR) { |
993 |
-+ struct vc_data *vc_curr = vc_cons[prev_console].d; |
994 |
-+ if (vc_curr && fbcon_decor_active_vc(vc_curr)) { |
995 |
-+ /* Clear the screen to avoid displaying funky colors during |
996 |
-+ * palette updates. */ |
997 |
-+ memset((u8*)info->screen_base + info->fix.line_length * info->var.yoffset, |
998 |
-+ 0, info->var.yres * info->fix.line_length); |
999 |
-+ } |
1000 |
-+ } |
1001 |
-+#endif |
1002 |
- |
1003 |
- if (softback_top) { |
1004 |
- if (softback_lines) |
1005 |
-@@ -2185,9 +2234,6 @@ static int fbcon_switch(struct vc_data *vc) |
1006 |
- logo_shown = FBCON_LOGO_CANSHOW; |
1007 |
- } |
1008 |
- |
1009 |
-- prev_console = ops->currcon; |
1010 |
-- if (prev_console != -1) |
1011 |
-- old_info = registered_fb[con2fb_map[prev_console]]; |
1012 |
- /* |
1013 |
- * FIXME: If we have multiple fbdev's loaded, we need to |
1014 |
- * update all info->currcon. Perhaps, we can place this |
1015 |
-@@ -2231,6 +2277,18 @@ static int fbcon_switch(struct vc_data *vc) |
1016 |
- fbcon_del_cursor_timer(old_info); |
1017 |
- } |
1018 |
- |
1019 |
-+ if (fbcon_decor_active_vc(vc)) { |
1020 |
-+ struct vc_data *vc_curr = vc_cons[prev_console].d; |
1021 |
-+ |
1022 |
-+ if (!vc_curr->vc_decor.theme || |
1023 |
-+ strcmp(vc->vc_decor.theme, vc_curr->vc_decor.theme) || |
1024 |
-+ (fbcon_decor_active_nores(info, vc_curr) && |
1025 |
-+ !fbcon_decor_active(info, vc_curr))) { |
1026 |
-+ fbcon_decor_disable(vc, 0); |
1027 |
-+ fbcon_decor_call_helper("modechange", vc->vc_num); |
1028 |
-+ } |
1029 |
-+ } |
1030 |
-+ |
1031 |
- if (fbcon_is_inactive(vc, info) || |
1032 |
- ops->blank_state != FB_BLANK_UNBLANK) |
1033 |
- fbcon_del_cursor_timer(info); |
1034 |
-@@ -2339,15 +2397,20 @@ static int fbcon_blank(struct vc_data *vc, int blank, int mode_switch) |
1035 |
- } |
1036 |
- } |
1037 |
- |
1038 |
-- if (!fbcon_is_inactive(vc, info)) { |
1039 |
-+ if (!fbcon_is_inactive(vc, info)) { |
1040 |
- if (ops->blank_state != blank) { |
1041 |
- ops->blank_state = blank; |
1042 |
- fbcon_cursor(vc, blank ? CM_ERASE : CM_DRAW); |
1043 |
- ops->cursor_flash = (!blank); |
1044 |
- |
1045 |
-- if (!(info->flags & FBINFO_MISC_USEREVENT)) |
1046 |
-- if (fb_blank(info, blank)) |
1047 |
-- fbcon_generic_blank(vc, info, blank); |
1048 |
-+ if (!(info->flags & FBINFO_MISC_USEREVENT)) { |
1049 |
-+ if (fb_blank(info, blank)) { |
1050 |
-+ if (fbcon_decor_active(info, vc)) |
1051 |
-+ fbcon_decor_blank(vc, info, blank); |
1052 |
-+ else |
1053 |
-+ fbcon_generic_blank(vc, info, blank); |
1054 |
-+ } |
1055 |
-+ } |
1056 |
- } |
1057 |
- |
1058 |
- if (!blank) |
1059 |
-@@ -2522,13 +2585,22 @@ static int fbcon_do_set_font(struct vc_data *vc, int w, int h, |
1060 |
- } |
1061 |
- |
1062 |
- if (resize) { |
1063 |
-+ /* reset wrap/pan */ |
1064 |
- int cols, rows; |
1065 |
- |
1066 |
- cols = FBCON_SWAP(ops->rotate, info->var.xres, info->var.yres); |
1067 |
- rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres); |
1068 |
-+ |
1069 |
-+ if (fbcon_decor_active(info, vc)) { |
1070 |
-+ info->var.xoffset = info->var.yoffset = p->yscroll = 0; |
1071 |
-+ cols = vc->vc_decor.twidth; |
1072 |
-+ rows = vc->vc_decor.theight; |
1073 |
-+ } |
1074 |
- cols /= w; |
1075 |
- rows /= h; |
1076 |
-+ |
1077 |
- vc_resize(vc, cols, rows); |
1078 |
-+ |
1079 |
- if (CON_IS_VISIBLE(vc) && softback_buf) |
1080 |
- fbcon_update_softback(vc); |
1081 |
- } else if (CON_IS_VISIBLE(vc) |
1082 |
-@@ -2657,7 +2729,11 @@ static int fbcon_set_palette(struct vc_data *vc, unsigned char *table) |
1083 |
- int i, j, k, depth; |
1084 |
- u8 val; |
1085 |
- |
1086 |
-- if (fbcon_is_inactive(vc, info)) |
1087 |
-+ if (fbcon_is_inactive(vc, info) |
1088 |
-+#ifdef CONFIG_FB_CON_DECOR |
1089 |
-+ || vc->vc_num != fg_console |
1090 |
-+#endif |
1091 |
-+ ) |
1092 |
- return -EINVAL; |
1093 |
- |
1094 |
- if (!CON_IS_VISIBLE(vc)) |
1095 |
-@@ -2683,14 +2759,56 @@ static int fbcon_set_palette(struct vc_data *vc, unsigned char *table) |
1096 |
- } else |
1097 |
- fb_copy_cmap(fb_default_cmap(1 << depth), &palette_cmap); |
1098 |
- |
1099 |
-- return fb_set_cmap(&palette_cmap, info); |
1100 |
-+ if (fbcon_decor_active(info, vc_cons[fg_console].d) && |
1101 |
-+ info->fix.visual == FB_VISUAL_DIRECTCOLOR) { |
1102 |
-+ |
1103 |
-+ u16 *red, *green, *blue; |
1104 |
-+ int minlen = min(min(info->var.red.length, info->var.green.length), |
1105 |
-+ info->var.blue.length); |
1106 |
-+ int h; |
1107 |
-+ |
1108 |
-+ struct fb_cmap cmap = { |
1109 |
-+ .start = 0, |
1110 |
-+ .len = (1 << minlen), |
1111 |
-+ .red = NULL, |
1112 |
-+ .green = NULL, |
1113 |
-+ .blue = NULL, |
1114 |
-+ .transp = NULL |
1115 |
-+ }; |
1116 |
-+ |
1117 |
-+ red = kmalloc(256 * sizeof(u16) * 3, GFP_KERNEL); |
1118 |
-+ |
1119 |
-+ if (!red) |
1120 |
-+ goto out; |
1121 |
-+ |
1122 |
-+ green = red + 256; |
1123 |
-+ blue = green + 256; |
1124 |
-+ cmap.red = red; |
1125 |
-+ cmap.green = green; |
1126 |
-+ cmap.blue = blue; |
1127 |
-+ |
1128 |
-+ for (i = 0; i < cmap.len; i++) { |
1129 |
-+ red[i] = green[i] = blue[i] = (0xffff * i)/(cmap.len-1); |
1130 |
-+ } |
1131 |
-+ |
1132 |
-+ h = fb_set_cmap(&cmap, info); |
1133 |
-+ fbcon_decor_fix_pseudo_pal(info, vc_cons[fg_console].d); |
1134 |
-+ kfree(red); |
1135 |
-+ |
1136 |
-+ return h; |
1137 |
-+ |
1138 |
-+ } else if (fbcon_decor_active(info, vc_cons[fg_console].d) && |
1139 |
-+ info->var.bits_per_pixel == 8 && info->bgdecor.cmap.red != NULL) |
1140 |
-+ fb_set_cmap(&info->bgdecor.cmap, info); |
1141 |
-+ |
1142 |
-+out: return fb_set_cmap(&palette_cmap, info); |
1143 |
- } |
1144 |
- |
1145 |
- static u16 *fbcon_screen_pos(struct vc_data *vc, int offset) |
1146 |
- { |
1147 |
- unsigned long p; |
1148 |
- int line; |
1149 |
-- |
1150 |
-+ |
1151 |
- if (vc->vc_num != fg_console || !softback_lines) |
1152 |
- return (u16 *) (vc->vc_origin + offset); |
1153 |
- line = offset / vc->vc_size_row; |
1154 |
-@@ -2909,7 +3027,14 @@ static void fbcon_modechanged(struct fb_info *info) |
1155 |
- rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres); |
1156 |
- cols /= vc->vc_font.width; |
1157 |
- rows /= vc->vc_font.height; |
1158 |
-- vc_resize(vc, cols, rows); |
1159 |
-+ |
1160 |
-+ if (!fbcon_decor_active_nores(info, vc)) { |
1161 |
-+ vc_resize(vc, cols, rows); |
1162 |
-+ } else { |
1163 |
-+ fbcon_decor_disable(vc, 0); |
1164 |
-+ fbcon_decor_call_helper("modechange", vc->vc_num); |
1165 |
-+ } |
1166 |
-+ |
1167 |
- updatescrollmode(p, info, vc); |
1168 |
- scrollback_max = 0; |
1169 |
- scrollback_current = 0; |
1170 |
-@@ -2954,7 +3079,9 @@ static void fbcon_set_all_vcs(struct fb_info *info) |
1171 |
- rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres); |
1172 |
- cols /= vc->vc_font.width; |
1173 |
- rows /= vc->vc_font.height; |
1174 |
-- vc_resize(vc, cols, rows); |
1175 |
-+ if (!fbcon_decor_active_nores(info, vc)) { |
1176 |
-+ vc_resize(vc, cols, rows); |
1177 |
-+ } |
1178 |
- } |
1179 |
- |
1180 |
- if (fg != -1) |
1181 |
-@@ -3596,6 +3723,7 @@ static void fbcon_exit(void) |
1182 |
- } |
1183 |
- } |
1184 |
- |
1185 |
-+ fbcon_decor_exit(); |
1186 |
- fbcon_has_exited = 1; |
1187 |
- } |
1188 |
- |
1189 |
-diff --git a/drivers/video/console/fbcondecor.c b/drivers/video/console/fbcondecor.c |
1190 |
-new file mode 100644 |
1191 |
-index 0000000..babc8c5 |
1192 |
---- /dev/null |
1193 |
-+++ b/drivers/video/console/fbcondecor.c |
1194 |
-@@ -0,0 +1,555 @@ |
1195 |
-+/* |
1196 |
-+ * linux/drivers/video/console/fbcondecor.c -- Framebuffer console decorations |
1197 |
-+ * |
1198 |
-+ * Copyright (C) 2004-2009 Michal Januszewski <michalj+fbcondecor@×××××.com> |
1199 |
-+ * |
1200 |
-+ * Code based upon "Bootsplash" (C) 2001-2003 |
1201 |
-+ * Volker Poplawski <volker@×××××××××.de>, |
1202 |
-+ * Stefan Reinauer <stepan@××××.de>, |
1203 |
-+ * Steffen Winterfeldt <snwint@××××.de>, |
1204 |
-+ * Michael Schroeder <mls@××××.de>, |
1205 |
-+ * Ken Wimer <wimer@××××.de>. |
1206 |
-+ * |
1207 |
-+ * Compat ioctl support by Thorsten Klein <TK@××××××××××××××.de>. |
1208 |
-+ * |
1209 |
-+ * This file is subject to the terms and conditions of the GNU General Public |
1210 |
-+ * License. See the file COPYING in the main directory of this archive for |
1211 |
-+ * more details. |
1212 |
-+ * |
1213 |
-+ */ |
1214 |
-+#include <linux/module.h> |
1215 |
-+#include <linux/kernel.h> |
1216 |
-+#include <linux/string.h> |
1217 |
-+#include <linux/types.h> |
1218 |
-+#include <linux/fb.h> |
1219 |
-+#include <linux/vt_kern.h> |
1220 |
-+#include <linux/vmalloc.h> |
1221 |
-+#include <linux/unistd.h> |
1222 |
-+#include <linux/syscalls.h> |
1223 |
-+#include <linux/init.h> |
1224 |
-+#include <linux/proc_fs.h> |
1225 |
-+#include <linux/workqueue.h> |
1226 |
-+#include <linux/kmod.h> |
1227 |
-+#include <linux/miscdevice.h> |
1228 |
-+#include <linux/device.h> |
1229 |
-+#include <linux/fs.h> |
1230 |
-+#include <linux/compat.h> |
1231 |
-+#include <linux/console.h> |
1232 |
-+ |
1233 |
-+#include <asm/uaccess.h> |
1234 |
-+#include <asm/irq.h> |
1235 |
-+ |
1236 |
-+#include "fbcon.h" |
1237 |
-+#include "fbcondecor.h" |
1238 |
-+ |
1239 |
-+extern signed char con2fb_map[]; |
1240 |
-+static int fbcon_decor_enable(struct vc_data *vc); |
1241 |
-+char fbcon_decor_path[KMOD_PATH_LEN] = "/sbin/fbcondecor_helper"; |
1242 |
-+static int initialized = 0; |
1243 |
-+ |
1244 |
-+int fbcon_decor_call_helper(char* cmd, unsigned short vc) |
1245 |
-+{ |
1246 |
-+ char *envp[] = { |
1247 |
-+ "HOME=/", |
1248 |
-+ "PATH=/sbin:/bin", |
1249 |
-+ NULL |
1250 |
-+ }; |
1251 |
-+ |
1252 |
-+ char tfb[5]; |
1253 |
-+ char tcons[5]; |
1254 |
-+ unsigned char fb = (int) con2fb_map[vc]; |
1255 |
-+ |
1256 |
-+ char *argv[] = { |
1257 |
-+ fbcon_decor_path, |
1258 |
-+ "2", |
1259 |
-+ cmd, |
1260 |
-+ tcons, |
1261 |
-+ tfb, |
1262 |
-+ vc_cons[vc].d->vc_decor.theme, |
1263 |
-+ NULL |
1264 |
-+ }; |
1265 |
-+ |
1266 |
-+ snprintf(tfb,5,"%d",fb); |
1267 |
-+ snprintf(tcons,5,"%d",vc); |
1268 |
-+ |
1269 |
-+ return call_usermodehelper(fbcon_decor_path, argv, envp, UMH_WAIT_EXEC); |
1270 |
-+} |
1271 |
-+ |
1272 |
-+/* Disables fbcondecor on a virtual console; called with console sem held. */ |
1273 |
-+int fbcon_decor_disable(struct vc_data *vc, unsigned char redraw) |
1274 |
-+{ |
1275 |
-+ struct fb_info* info; |
1276 |
-+ |
1277 |
-+ if (!vc->vc_decor.state) |
1278 |
-+ return -EINVAL; |
1279 |
-+ |
1280 |
-+ info = registered_fb[(int) con2fb_map[vc->vc_num]]; |
1281 |
-+ |
1282 |
-+ if (info == NULL) |
1283 |
-+ return -EINVAL; |
1284 |
-+ |
1285 |
-+ vc->vc_decor.state = 0; |
1286 |
-+ vc_resize(vc, info->var.xres / vc->vc_font.width, |
1287 |
-+ info->var.yres / vc->vc_font.height); |
1288 |
-+ |
1289 |
-+ if (fg_console == vc->vc_num && redraw) { |
1290 |
-+ redraw_screen(vc, 0); |
1291 |
-+ update_region(vc, vc->vc_origin + |
1292 |
-+ vc->vc_size_row * vc->vc_top, |
1293 |
-+ vc->vc_size_row * (vc->vc_bottom - vc->vc_top) / 2); |
1294 |
-+ } |
1295 |
-+ |
1296 |
-+ printk(KERN_INFO "fbcondecor: switched decor state to 'off' on console %d\n", |
1297 |
-+ vc->vc_num); |
1298 |
-+ |
1299 |
-+ return 0; |
1300 |
-+} |
1301 |
-+ |
1302 |
-+/* Enables fbcondecor on a virtual console; called with console sem held. */ |
1303 |
-+static int fbcon_decor_enable(struct vc_data *vc) |
1304 |
-+{ |
1305 |
-+ struct fb_info* info; |
1306 |
-+ |
1307 |
-+ info = registered_fb[(int) con2fb_map[vc->vc_num]]; |
1308 |
-+ |
1309 |
-+ if (vc->vc_decor.twidth == 0 || vc->vc_decor.theight == 0 || |
1310 |
-+ info == NULL || vc->vc_decor.state || (!info->bgdecor.data && |
1311 |
-+ vc->vc_num == fg_console)) |
1312 |
-+ return -EINVAL; |
1313 |
-+ |
1314 |
-+ vc->vc_decor.state = 1; |
1315 |
-+ vc_resize(vc, vc->vc_decor.twidth / vc->vc_font.width, |
1316 |
-+ vc->vc_decor.theight / vc->vc_font.height); |
1317 |
-+ |
1318 |
-+ if (fg_console == vc->vc_num) { |
1319 |
-+ redraw_screen(vc, 0); |
1320 |
-+ update_region(vc, vc->vc_origin + |
1321 |
-+ vc->vc_size_row * vc->vc_top, |
1322 |
-+ vc->vc_size_row * (vc->vc_bottom - vc->vc_top) / 2); |
1323 |
-+ fbcon_decor_clear_margins(vc, info, 0); |
1324 |
-+ } |
1325 |
-+ |
1326 |
-+ printk(KERN_INFO "fbcondecor: switched decor state to 'on' on console %d\n", |
1327 |
-+ vc->vc_num); |
1328 |
-+ |
1329 |
-+ return 0; |
1330 |
-+} |
1331 |
-+ |
1332 |
-+static inline int fbcon_decor_ioctl_dosetstate(struct vc_data *vc, unsigned int state, unsigned char origin) |
1333 |
-+{ |
1334 |
-+ int ret; |
1335 |
-+ |
1336 |
-+// if (origin == FBCON_DECOR_IO_ORIG_USER) |
1337 |
-+ console_lock(); |
1338 |
-+ if (!state) |
1339 |
-+ ret = fbcon_decor_disable(vc, 1); |
1340 |
-+ else |
1341 |
-+ ret = fbcon_decor_enable(vc); |
1342 |
-+// if (origin == FBCON_DECOR_IO_ORIG_USER) |
1343 |
-+ console_unlock(); |
1344 |
-+ |
1345 |
-+ return ret; |
1346 |
-+} |
1347 |
-+ |
1348 |
-+static inline void fbcon_decor_ioctl_dogetstate(struct vc_data *vc, unsigned int *state) |
1349 |
-+{ |
1350 |
-+ *state = vc->vc_decor.state; |
1351 |
-+} |
1352 |
-+ |
1353 |
-+static int fbcon_decor_ioctl_dosetcfg(struct vc_data *vc, struct vc_decor *cfg, unsigned char origin) |
1354 |
-+{ |
1355 |
-+ struct fb_info *info; |
1356 |
-+ int len; |
1357 |
-+ char *tmp; |
1358 |
-+ |
1359 |
-+ info = registered_fb[(int) con2fb_map[vc->vc_num]]; |
1360 |
-+ |
1361 |
-+ if (info == NULL || !cfg->twidth || !cfg->theight || |
1362 |
-+ cfg->tx + cfg->twidth > info->var.xres || |
1363 |
-+ cfg->ty + cfg->theight > info->var.yres) |
1364 |
-+ return -EINVAL; |
1365 |
-+ |
1366 |
-+ len = strlen_user(cfg->theme); |
1367 |
-+ if (!len || len > FBCON_DECOR_THEME_LEN) |
1368 |
-+ return -EINVAL; |
1369 |
-+ tmp = kmalloc(len, GFP_KERNEL); |
1370 |
-+ if (!tmp) |
1371 |
-+ return -ENOMEM; |
1372 |
-+ if (copy_from_user(tmp, (void __user *)cfg->theme, len)) |
1373 |
-+ return -EFAULT; |
1374 |
-+ cfg->theme = tmp; |
1375 |
-+ cfg->state = 0; |
1376 |
-+ |
1377 |
-+ /* If this ioctl is a response to a request from kernel, the console sem |
1378 |
-+ * is already held; we also don't need to disable decor because either the |
1379 |
-+ * new config and background picture will be successfully loaded, and the |
1380 |
-+ * decor will stay on, or in case of a failure it'll be turned off in fbcon. */ |
1381 |
-+// if (origin == FBCON_DECOR_IO_ORIG_USER) { |
1382 |
-+ console_lock(); |
1383 |
-+ if (vc->vc_decor.state) |
1384 |
-+ fbcon_decor_disable(vc, 1); |
1385 |
-+// } |
1386 |
-+ |
1387 |
-+ if (vc->vc_decor.theme) |
1388 |
-+ kfree(vc->vc_decor.theme); |
1389 |
-+ |
1390 |
-+ vc->vc_decor = *cfg; |
1391 |
-+ |
1392 |
-+// if (origin == FBCON_DECOR_IO_ORIG_USER) |
1393 |
-+ console_unlock(); |
1394 |
-+ |
1395 |
-+ printk(KERN_INFO "fbcondecor: console %d using theme '%s'\n", |
1396 |
-+ vc->vc_num, vc->vc_decor.theme); |
1397 |
-+ return 0; |
1398 |
-+} |
1399 |
-+ |
1400 |
-+static int fbcon_decor_ioctl_dogetcfg(struct vc_data *vc, struct vc_decor *decor) |
1401 |
-+{ |
1402 |
-+ char __user *tmp; |
1403 |
-+ |
1404 |
-+ tmp = decor->theme; |
1405 |
-+ *decor = vc->vc_decor; |
1406 |
-+ decor->theme = tmp; |
1407 |
-+ |
1408 |
-+ if (vc->vc_decor.theme) { |
1409 |
-+ if (copy_to_user(tmp, vc->vc_decor.theme, strlen(vc->vc_decor.theme) + 1)) |
1410 |
-+ return -EFAULT; |
1411 |
-+ } else |
1412 |
-+ if (put_user(0, tmp)) |
1413 |
-+ return -EFAULT; |
1414 |
-+ |
1415 |
-+ return 0; |
1416 |
-+} |
1417 |
-+ |
1418 |
-+static int fbcon_decor_ioctl_dosetpic(struct vc_data *vc, struct fb_image *img, unsigned char origin) |
1419 |
-+{ |
1420 |
-+ struct fb_info *info; |
1421 |
-+ int len; |
1422 |
-+ u8 *tmp; |
1423 |
-+ |
1424 |
-+ if (vc->vc_num != fg_console) |
1425 |
-+ return -EINVAL; |
1426 |
-+ |
1427 |
-+ info = registered_fb[(int) con2fb_map[vc->vc_num]]; |
1428 |
-+ |
1429 |
-+ if (info == NULL) |
1430 |
-+ return -EINVAL; |
1431 |
-+ |
1432 |
-+ if (img->width != info->var.xres || img->height != info->var.yres) { |
1433 |
-+ printk(KERN_ERR "fbcondecor: picture dimensions mismatch\n"); |
1434 |
-+ printk(KERN_ERR "%dx%d vs %dx%d\n", img->width, img->height, info->var.xres, info->var.yres); |
1435 |
-+ return -EINVAL; |
1436 |
-+ } |
1437 |
-+ |
1438 |
-+ if (img->depth != info->var.bits_per_pixel) { |
1439 |
-+ printk(KERN_ERR "fbcondecor: picture depth mismatch\n"); |
1440 |
-+ return -EINVAL; |
1441 |
-+ } |
1442 |
-+ |
1443 |
-+ if (img->depth == 8) { |
1444 |
-+ if (!img->cmap.len || !img->cmap.red || !img->cmap.green || |
1445 |
-+ !img->cmap.blue) |
1446 |
-+ return -EINVAL; |
1447 |
-+ |
1448 |
-+ tmp = vmalloc(img->cmap.len * 3 * 2); |
1449 |
-+ if (!tmp) |
1450 |
-+ return -ENOMEM; |
1451 |
-+ |
1452 |
-+ if (copy_from_user(tmp, |
1453 |
-+ (void __user*)img->cmap.red, (img->cmap.len << 1)) || |
1454 |
-+ copy_from_user(tmp + (img->cmap.len << 1), |
1455 |
-+ (void __user*)img->cmap.green, (img->cmap.len << 1)) || |
1456 |
-+ copy_from_user(tmp + (img->cmap.len << 2), |
1457 |
-+ (void __user*)img->cmap.blue, (img->cmap.len << 1))) { |
1458 |
-+ vfree(tmp); |
1459 |
-+ return -EFAULT; |
1460 |
-+ } |
1461 |
-+ |
1462 |
-+ img->cmap.transp = NULL; |
1463 |
-+ img->cmap.red = (u16*)tmp; |
1464 |
-+ img->cmap.green = img->cmap.red + img->cmap.len; |
1465 |
-+ img->cmap.blue = img->cmap.green + img->cmap.len; |
1466 |
-+ } else { |
1467 |
-+ img->cmap.red = NULL; |
1468 |
-+ } |
1469 |
-+ |
1470 |
-+ len = ((img->depth + 7) >> 3) * img->width * img->height; |
1471 |
-+ |
1472 |
-+ /* |
1473 |
-+ * Allocate an additional byte so that we never go outside of the |
1474 |
-+ * buffer boundaries in the rendering functions in a 24 bpp mode. |
1475 |
-+ */ |
1476 |
-+ tmp = vmalloc(len + 1); |
1477 |
-+ |
1478 |
-+ if (!tmp) |
1479 |
-+ goto out; |
1480 |
-+ |
1481 |
-+ if (copy_from_user(tmp, (void __user*)img->data, len)) |
1482 |
-+ goto out; |
1483 |
-+ |
1484 |
-+ img->data = tmp; |
1485 |
-+ |
1486 |
-+ /* If this ioctl is a response to a request from kernel, the console sem |
1487 |
-+ * is already held. */ |
1488 |
-+// if (origin == FBCON_DECOR_IO_ORIG_USER) |
1489 |
-+ console_lock(); |
1490 |
-+ |
1491 |
-+ if (info->bgdecor.data) |
1492 |
-+ vfree((u8*)info->bgdecor.data); |
1493 |
-+ if (info->bgdecor.cmap.red) |
1494 |
-+ vfree(info->bgdecor.cmap.red); |
1495 |
-+ |
1496 |
-+ info->bgdecor = *img; |
1497 |
-+ |
1498 |
-+ if (fbcon_decor_active_vc(vc) && fg_console == vc->vc_num) { |
1499 |
-+ redraw_screen(vc, 0); |
1500 |
-+ update_region(vc, vc->vc_origin + |
1501 |
-+ vc->vc_size_row * vc->vc_top, |
1502 |
-+ vc->vc_size_row * (vc->vc_bottom - vc->vc_top) / 2); |
1503 |
-+ fbcon_decor_clear_margins(vc, info, 0); |
1504 |
-+ } |
1505 |
-+ |
1506 |
-+// if (origin == FBCON_DECOR_IO_ORIG_USER) |
1507 |
-+ console_unlock(); |
1508 |
-+ |
1509 |
-+ return 0; |
1510 |
-+ |
1511 |
-+out: if (img->cmap.red) |
1512 |
-+ vfree(img->cmap.red); |
1513 |
-+ |
1514 |
-+ if (tmp) |
1515 |
-+ vfree(tmp); |
1516 |
-+ return -ENOMEM; |
1517 |
-+} |
1518 |
-+ |
1519 |
-+static long fbcon_decor_ioctl(struct file *filp, u_int cmd, u_long arg) |
1520 |
-+{ |
1521 |
-+ struct fbcon_decor_iowrapper __user *wrapper = (void __user*) arg; |
1522 |
-+ struct vc_data *vc = NULL; |
1523 |
-+ unsigned short vc_num = 0; |
1524 |
-+ unsigned char origin = 0; |
1525 |
-+ void __user *data = NULL; |
1526 |
-+ |
1527 |
-+ if (!access_ok(VERIFY_READ, wrapper, |
1528 |
-+ sizeof(struct fbcon_decor_iowrapper))) |
1529 |
-+ return -EFAULT; |
1530 |
-+ |
1531 |
-+ __get_user(vc_num, &wrapper->vc); |
1532 |
-+ __get_user(origin, &wrapper->origin); |
1533 |
-+ __get_user(data, &wrapper->data); |
1534 |
-+ |
1535 |
-+ if (!vc_cons_allocated(vc_num)) |
1536 |
-+ return -EINVAL; |
1537 |
-+ |
1538 |
-+ vc = vc_cons[vc_num].d; |
1539 |
-+ |
1540 |
-+ switch (cmd) { |
1541 |
-+ case FBIOCONDECOR_SETPIC: |
1542 |
-+ { |
1543 |
-+ struct fb_image img; |
1544 |
-+ if (copy_from_user(&img, (struct fb_image __user *)data, sizeof(struct fb_image))) |
1545 |
-+ return -EFAULT; |
1546 |
-+ |
1547 |
-+ return fbcon_decor_ioctl_dosetpic(vc, &img, origin); |
1548 |
-+ } |
1549 |
-+ case FBIOCONDECOR_SETCFG: |
1550 |
-+ { |
1551 |
-+ struct vc_decor cfg; |
1552 |
-+ if (copy_from_user(&cfg, (struct vc_decor __user *)data, sizeof(struct vc_decor))) |
1553 |
-+ return -EFAULT; |
1554 |
-+ |
1555 |
-+ return fbcon_decor_ioctl_dosetcfg(vc, &cfg, origin); |
1556 |
-+ } |
1557 |
-+ case FBIOCONDECOR_GETCFG: |
1558 |
-+ { |
1559 |
-+ int rval; |
1560 |
-+ struct vc_decor cfg; |
1561 |
-+ |
1562 |
-+ if (copy_from_user(&cfg, (struct vc_decor __user *)data, sizeof(struct vc_decor))) |
1563 |
-+ return -EFAULT; |
1564 |
-+ |
1565 |
-+ rval = fbcon_decor_ioctl_dogetcfg(vc, &cfg); |
1566 |
-+ |
1567 |
-+ if (copy_to_user(data, &cfg, sizeof(struct vc_decor))) |
1568 |
-+ return -EFAULT; |
1569 |
-+ return rval; |
1570 |
-+ } |
1571 |
-+ case FBIOCONDECOR_SETSTATE: |
1572 |
-+ { |
1573 |
-+ unsigned int state = 0; |
1574 |
-+ if (get_user(state, (unsigned int __user *)data)) |
1575 |
-+ return -EFAULT; |
1576 |
-+ return fbcon_decor_ioctl_dosetstate(vc, state, origin); |
1577 |
-+ } |
1578 |
-+ case FBIOCONDECOR_GETSTATE: |
1579 |
-+ { |
1580 |
-+ unsigned int state = 0; |
1581 |
-+ fbcon_decor_ioctl_dogetstate(vc, &state); |
1582 |
-+ return put_user(state, (unsigned int __user *)data); |
1583 |
-+ } |
1584 |
-+ |
1585 |
-+ default: |
1586 |
-+ return -ENOIOCTLCMD; |
1587 |
-+ } |
1588 |
-+} |
1589 |
-+ |
1590 |
-+#ifdef CONFIG_COMPAT |
1591 |
-+ |
1592 |
-+static long fbcon_decor_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) { |
1593 |
-+ |
1594 |
-+ struct fbcon_decor_iowrapper32 __user *wrapper = (void __user *)arg; |
1595 |
-+ struct vc_data *vc = NULL; |
1596 |
-+ unsigned short vc_num = 0; |
1597 |
-+ unsigned char origin = 0; |
1598 |
-+ compat_uptr_t data_compat = 0; |
1599 |
-+ void __user *data = NULL; |
1600 |
-+ |
1601 |
-+ if (!access_ok(VERIFY_READ, wrapper, |
1602 |
-+ sizeof(struct fbcon_decor_iowrapper32))) |
1603 |
-+ return -EFAULT; |
1604 |
-+ |
1605 |
-+ __get_user(vc_num, &wrapper->vc); |
1606 |
-+ __get_user(origin, &wrapper->origin); |
1607 |
-+ __get_user(data_compat, &wrapper->data); |
1608 |
-+ data = compat_ptr(data_compat); |
1609 |
-+ |
1610 |
-+ if (!vc_cons_allocated(vc_num)) |
1611 |
-+ return -EINVAL; |
1612 |
-+ |
1613 |
-+ vc = vc_cons[vc_num].d; |
1614 |
-+ |
1615 |
-+ switch (cmd) { |
1616 |
-+ case FBIOCONDECOR_SETPIC32: |
1617 |
-+ { |
1618 |
-+ struct fb_image32 img_compat; |
1619 |
-+ struct fb_image img; |
1620 |
-+ |
1621 |
-+ if (copy_from_user(&img_compat, (struct fb_image32 __user *)data, sizeof(struct fb_image32))) |
1622 |
-+ return -EFAULT; |
1623 |
-+ |
1624 |
-+ fb_image_from_compat(img, img_compat); |
1625 |
-+ |
1626 |
-+ return fbcon_decor_ioctl_dosetpic(vc, &img, origin); |
1627 |
-+ } |
1628 |
-+ |
1629 |
-+ case FBIOCONDECOR_SETCFG32: |
1630 |
-+ { |
1631 |
-+ struct vc_decor32 cfg_compat; |
1632 |
-+ struct vc_decor cfg; |
1633 |
-+ |
1634 |
-+ if (copy_from_user(&cfg_compat, (struct vc_decor32 __user *)data, sizeof(struct vc_decor32))) |
1635 |
-+ return -EFAULT; |
1636 |
-+ |
1637 |
-+ vc_decor_from_compat(cfg, cfg_compat); |
1638 |
-+ |
1639 |
-+ return fbcon_decor_ioctl_dosetcfg(vc, &cfg, origin); |
1640 |
-+ } |
1641 |
-+ |
1642 |
-+ case FBIOCONDECOR_GETCFG32: |
1643 |
-+ { |
1644 |
-+ int rval; |
1645 |
-+ struct vc_decor32 cfg_compat; |
1646 |
-+ struct vc_decor cfg; |
1647 |
-+ |
1648 |
-+ if (copy_from_user(&cfg_compat, (struct vc_decor32 __user *)data, sizeof(struct vc_decor32))) |
1649 |
-+ return -EFAULT; |
1650 |
-+ cfg.theme = compat_ptr(cfg_compat.theme); |
1651 |
-+ |
1652 |
-+ rval = fbcon_decor_ioctl_dogetcfg(vc, &cfg); |
1653 |
-+ |
1654 |
-+ vc_decor_to_compat(cfg_compat, cfg); |
1655 |
-+ |
1656 |
-+ if (copy_to_user((struct vc_decor32 __user *)data, &cfg_compat, sizeof(struct vc_decor32))) |
1657 |
-+ return -EFAULT; |
1658 |
-+ return rval; |
1659 |
-+ } |
1660 |
-+ |
1661 |
-+ case FBIOCONDECOR_SETSTATE32: |
1662 |
-+ { |
1663 |
-+ compat_uint_t state_compat = 0; |
1664 |
-+ unsigned int state = 0; |
1665 |
-+ |
1666 |
-+ if (get_user(state_compat, (compat_uint_t __user *)data)) |
1667 |
-+ return -EFAULT; |
1668 |
-+ |
1669 |
-+ state = (unsigned int)state_compat; |
1670 |
-+ |
1671 |
-+ return fbcon_decor_ioctl_dosetstate(vc, state, origin); |
1672 |
-+ } |
1673 |
-+ |
1674 |
-+ case FBIOCONDECOR_GETSTATE32: |
1675 |
-+ { |
1676 |
-+ compat_uint_t state_compat = 0; |
1677 |
-+ unsigned int state = 0; |
1678 |
-+ |
1679 |
-+ fbcon_decor_ioctl_dogetstate(vc, &state); |
1680 |
-+ state_compat = (compat_uint_t)state; |
1681 |
-+ |
1682 |
-+ return put_user(state_compat, (compat_uint_t __user *)data); |
1683 |
-+ } |
1684 |
-+ |
1685 |
-+ default: |
1686 |
-+ return -ENOIOCTLCMD; |
1687 |
-+ } |
1688 |
-+} |
1689 |
-+#else |
1690 |
-+ #define fbcon_decor_compat_ioctl NULL |
1691 |
-+#endif |
1692 |
-+ |
1693 |
-+static struct file_operations fbcon_decor_ops = { |
1694 |
-+ .owner = THIS_MODULE, |
1695 |
-+ .unlocked_ioctl = fbcon_decor_ioctl, |
1696 |
-+ .compat_ioctl = fbcon_decor_compat_ioctl |
1697 |
-+}; |
1698 |
-+ |
1699 |
-+static struct miscdevice fbcon_decor_dev = { |
1700 |
-+ .minor = MISC_DYNAMIC_MINOR, |
1701 |
-+ .name = "fbcondecor", |
1702 |
-+ .fops = &fbcon_decor_ops |
1703 |
-+}; |
1704 |
-+ |
1705 |
-+void fbcon_decor_reset(void) |
1706 |
-+{ |
1707 |
-+ int i; |
1708 |
-+ |
1709 |
-+ for (i = 0; i < num_registered_fb; i++) { |
1710 |
-+ registered_fb[i]->bgdecor.data = NULL; |
1711 |
-+ registered_fb[i]->bgdecor.cmap.red = NULL; |
1712 |
-+ } |
1713 |
-+ |
1714 |
-+ for (i = 0; i < MAX_NR_CONSOLES && vc_cons[i].d; i++) { |
1715 |
-+ vc_cons[i].d->vc_decor.state = vc_cons[i].d->vc_decor.twidth = |
1716 |
-+ vc_cons[i].d->vc_decor.theight = 0; |
1717 |
-+ vc_cons[i].d->vc_decor.theme = NULL; |
1718 |
-+ } |
1719 |
-+ |
1720 |
-+ return; |
1721 |
-+} |
1722 |
-+ |
1723 |
-+int fbcon_decor_init(void) |
1724 |
-+{ |
1725 |
-+ int i; |
1726 |
-+ |
1727 |
-+ fbcon_decor_reset(); |
1728 |
-+ |
1729 |
-+ if (initialized) |
1730 |
-+ return 0; |
1731 |
-+ |
1732 |
-+ i = misc_register(&fbcon_decor_dev); |
1733 |
-+ if (i) { |
1734 |
-+ printk(KERN_ERR "fbcondecor: failed to register device\n"); |
1735 |
-+ return i; |
1736 |
-+ } |
1737 |
-+ |
1738 |
-+ fbcon_decor_call_helper("init", 0); |
1739 |
-+ initialized = 1; |
1740 |
-+ return 0; |
1741 |
-+} |
1742 |
-+ |
1743 |
-+int fbcon_decor_exit(void) |
1744 |
-+{ |
1745 |
-+ fbcon_decor_reset(); |
1746 |
-+ return 0; |
1747 |
-+} |
1748 |
-+ |
1749 |
-+EXPORT_SYMBOL(fbcon_decor_path); |
1750 |
-diff --git a/drivers/video/console/fbcondecor.h b/drivers/video/console/fbcondecor.h |
1751 |
-new file mode 100644 |
1752 |
-index 0000000..3b3724b |
1753 |
---- /dev/null |
1754 |
-+++ b/drivers/video/console/fbcondecor.h |
1755 |
-@@ -0,0 +1,78 @@ |
1756 |
-+/* |
1757 |
-+ * linux/drivers/video/console/fbcondecor.h -- Framebuffer Console Decoration headers |
1758 |
-+ * |
1759 |
-+ * Copyright (C) 2004 Michal Januszewski <michalj+fbcondecor@×××××.com> |
1760 |
-+ * |
1761 |
-+ */ |
1762 |
-+ |
1763 |
-+#ifndef __FBCON_DECOR_H |
1764 |
-+#define __FBCON_DECOR_H |
1765 |
-+ |
1766 |
-+#ifndef _LINUX_FB_H |
1767 |
-+#include <linux/fb.h> |
1768 |
-+#endif |
1769 |
-+ |
1770 |
-+/* This is needed for vc_cons in fbcmap.c */ |
1771 |
-+#include <linux/vt_kern.h> |
1772 |
-+ |
1773 |
-+struct fb_cursor; |
1774 |
-+struct fb_info; |
1775 |
-+struct vc_data; |
1776 |
-+ |
1777 |
-+#ifdef CONFIG_FB_CON_DECOR |
1778 |
-+/* fbcondecor.c */ |
1779 |
-+int fbcon_decor_init(void); |
1780 |
-+int fbcon_decor_exit(void); |
1781 |
-+int fbcon_decor_call_helper(char* cmd, unsigned short cons); |
1782 |
-+int fbcon_decor_disable(struct vc_data *vc, unsigned char redraw); |
1783 |
-+ |
1784 |
-+/* cfbcondecor.c */ |
1785 |
-+void fbcon_decor_putcs(struct vc_data *vc, struct fb_info *info, const unsigned short *s, int count, int yy, int xx); |
1786 |
-+void fbcon_decor_cursor(struct fb_info *info, struct fb_cursor *cursor); |
1787 |
-+void fbcon_decor_clear(struct vc_data *vc, struct fb_info *info, int sy, int sx, int height, int width); |
1788 |
-+void fbcon_decor_clear_margins(struct vc_data *vc, struct fb_info *info, int bottom_only); |
1789 |
-+void fbcon_decor_blank(struct vc_data *vc, struct fb_info *info, int blank); |
1790 |
-+void fbcon_decor_bmove_redraw(struct vc_data *vc, struct fb_info *info, int y, int sx, int dx, int width); |
1791 |
-+void fbcon_decor_copy(u8 *dst, u8 *src, int height, int width, int linebytes, int srclinesbytes, int bpp); |
1792 |
-+void fbcon_decor_fix_pseudo_pal(struct fb_info *info, struct vc_data *vc); |
1793 |
-+ |
1794 |
-+/* vt.c */ |
1795 |
-+void acquire_console_sem(void); |
1796 |
-+void release_console_sem(void); |
1797 |
-+void do_unblank_screen(int entering_gfx); |
1798 |
-+ |
1799 |
-+/* struct vc_data *y */ |
1800 |
-+#define fbcon_decor_active_vc(y) (y->vc_decor.state && y->vc_decor.theme) |
1801 |
-+ |
1802 |
-+/* struct fb_info *x, struct vc_data *y */ |
1803 |
-+#define fbcon_decor_active_nores(x,y) (x->bgdecor.data && fbcon_decor_active_vc(y)) |
1804 |
-+ |
1805 |
-+/* struct fb_info *x, struct vc_data *y */ |
1806 |
-+#define fbcon_decor_active(x,y) (fbcon_decor_active_nores(x,y) && \ |
1807 |
-+ x->bgdecor.width == x->var.xres && \ |
1808 |
-+ x->bgdecor.height == x->var.yres && \ |
1809 |
-+ x->bgdecor.depth == x->var.bits_per_pixel) |
1810 |
-+ |
1811 |
-+ |
1812 |
-+#else /* CONFIG_FB_CON_DECOR */ |
1813 |
-+ |
1814 |
-+static inline void fbcon_decor_putcs(struct vc_data *vc, struct fb_info *info, const unsigned short *s, int count, int yy, int xx) {} |
1815 |
-+static inline void fbcon_decor_putc(struct vc_data *vc, struct fb_info *info, int c, int ypos, int xpos) {} |
1816 |
-+static inline void fbcon_decor_cursor(struct fb_info *info, struct fb_cursor *cursor) {} |
1817 |
-+static inline void fbcon_decor_clear(struct vc_data *vc, struct fb_info *info, int sy, int sx, int height, int width) {} |
1818 |
-+static inline void fbcon_decor_clear_margins(struct vc_data *vc, struct fb_info *info, int bottom_only) {} |
1819 |
-+static inline void fbcon_decor_blank(struct vc_data *vc, struct fb_info *info, int blank) {} |
1820 |
-+static inline void fbcon_decor_bmove_redraw(struct vc_data *vc, struct fb_info *info, int y, int sx, int dx, int width) {} |
1821 |
-+static inline void fbcon_decor_fix_pseudo_pal(struct fb_info *info, struct vc_data *vc) {} |
1822 |
-+static inline int fbcon_decor_call_helper(char* cmd, unsigned short cons) { return 0; } |
1823 |
-+static inline int fbcon_decor_init(void) { return 0; } |
1824 |
-+static inline int fbcon_decor_exit(void) { return 0; } |
1825 |
-+static inline int fbcon_decor_disable(struct vc_data *vc, unsigned char redraw) { return 0; } |
1826 |
-+ |
1827 |
-+#define fbcon_decor_active_vc(y) (0) |
1828 |
-+#define fbcon_decor_active_nores(x,y) (0) |
1829 |
-+#define fbcon_decor_active(x,y) (0) |
1830 |
-+ |
1831 |
-+#endif /* CONFIG_FB_CON_DECOR */ |
1832 |
-+ |
1833 |
-+#endif /* __FBCON_DECOR_H */ |
1834 |
-diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig |
1835 |
-index e1f4727..2952e33 100644 |
1836 |
---- a/drivers/video/fbdev/Kconfig |
1837 |
-+++ b/drivers/video/fbdev/Kconfig |
1838 |
-@@ -1204,7 +1204,6 @@ config FB_MATROX |
1839 |
- select FB_CFB_FILLRECT |
1840 |
- select FB_CFB_COPYAREA |
1841 |
- select FB_CFB_IMAGEBLIT |
1842 |
-- select FB_TILEBLITTING |
1843 |
- select FB_MACMODES if PPC_PMAC |
1844 |
- ---help--- |
1845 |
- Say Y here if you have a Matrox Millennium, Matrox Millennium II, |
1846 |
-diff --git a/drivers/video/fbdev/core/fbcmap.c b/drivers/video/fbdev/core/fbcmap.c |
1847 |
-index f89245b..05e036c 100644 |
1848 |
---- a/drivers/video/fbdev/core/fbcmap.c |
1849 |
-+++ b/drivers/video/fbdev/core/fbcmap.c |
1850 |
-@@ -17,6 +17,8 @@ |
1851 |
- #include <linux/slab.h> |
1852 |
- #include <linux/uaccess.h> |
1853 |
- |
1854 |
-+#include "../../console/fbcondecor.h" |
1855 |
-+ |
1856 |
- static u16 red2[] __read_mostly = { |
1857 |
- 0x0000, 0xaaaa |
1858 |
- }; |
1859 |
-@@ -249,14 +251,17 @@ int fb_set_cmap(struct fb_cmap *cmap, struct fb_info *info) |
1860 |
- if (transp) |
1861 |
- htransp = *transp++; |
1862 |
- if (info->fbops->fb_setcolreg(start++, |
1863 |
-- hred, hgreen, hblue, |
1864 |
-+ hred, hgreen, hblue, |
1865 |
- htransp, info)) |
1866 |
- break; |
1867 |
- } |
1868 |
- } |
1869 |
-- if (rc == 0) |
1870 |
-+ if (rc == 0) { |
1871 |
- fb_copy_cmap(cmap, &info->cmap); |
1872 |
-- |
1873 |
-+ if (fbcon_decor_active(info, vc_cons[fg_console].d) && |
1874 |
-+ info->fix.visual == FB_VISUAL_DIRECTCOLOR) |
1875 |
-+ fbcon_decor_fix_pseudo_pal(info, vc_cons[fg_console].d); |
1876 |
-+ } |
1877 |
- return rc; |
1878 |
- } |
1879 |
- |
1880 |
-diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c |
1881 |
-index b6d5008..d6703f2 100644 |
1882 |
---- a/drivers/video/fbdev/core/fbmem.c |
1883 |
-+++ b/drivers/video/fbdev/core/fbmem.c |
1884 |
-@@ -1250,15 +1250,6 @@ struct fb_fix_screeninfo32 { |
1885 |
- u16 reserved[3]; |
1886 |
- }; |
1887 |
- |
1888 |
--struct fb_cmap32 { |
1889 |
-- u32 start; |
1890 |
-- u32 len; |
1891 |
-- compat_caddr_t red; |
1892 |
-- compat_caddr_t green; |
1893 |
-- compat_caddr_t blue; |
1894 |
-- compat_caddr_t transp; |
1895 |
--}; |
1896 |
-- |
1897 |
- static int fb_getput_cmap(struct fb_info *info, unsigned int cmd, |
1898 |
- unsigned long arg) |
1899 |
- { |
1900 |
-diff --git a/include/linux/console_decor.h b/include/linux/console_decor.h |
1901 |
-new file mode 100644 |
1902 |
-index 0000000..04b8d80 |
1903 |
---- /dev/null |
1904 |
-+++ b/include/linux/console_decor.h |
1905 |
-@@ -0,0 +1,46 @@ |
1906 |
-+#ifndef _LINUX_CONSOLE_DECOR_H_ |
1907 |
-+#define _LINUX_CONSOLE_DECOR_H_ 1 |
1908 |
-+ |
1909 |
-+/* A structure used by the framebuffer console decorations (drivers/video/console/fbcondecor.c) */ |
1910 |
-+struct vc_decor { |
1911 |
-+ __u8 bg_color; /* The color that is to be treated as transparent */ |
1912 |
-+ __u8 state; /* Current decor state: 0 = off, 1 = on */ |
1913 |
-+ __u16 tx, ty; /* Top left corner coordinates of the text field */ |
1914 |
-+ __u16 twidth, theight; /* Width and height of the text field */ |
1915 |
-+ char* theme; |
1916 |
-+}; |
1917 |
-+ |
1918 |
-+#ifdef __KERNEL__ |
1919 |
-+#ifdef CONFIG_COMPAT |
1920 |
-+#include <linux/compat.h> |
1921 |
-+ |
1922 |
-+struct vc_decor32 { |
1923 |
-+ __u8 bg_color; /* The color that is to be treated as transparent */ |
1924 |
-+ __u8 state; /* Current decor state: 0 = off, 1 = on */ |
1925 |
-+ __u16 tx, ty; /* Top left corner coordinates of the text field */ |
1926 |
-+ __u16 twidth, theight; /* Width and height of the text field */ |
1927 |
-+ compat_uptr_t theme; |
1928 |
-+}; |
1929 |
-+ |
1930 |
-+#define vc_decor_from_compat(to, from) \ |
1931 |
-+ (to).bg_color = (from).bg_color; \ |
1932 |
-+ (to).state = (from).state; \ |
1933 |
-+ (to).tx = (from).tx; \ |
1934 |
-+ (to).ty = (from).ty; \ |
1935 |
-+ (to).twidth = (from).twidth; \ |
1936 |
-+ (to).theight = (from).theight; \ |
1937 |
-+ (to).theme = compat_ptr((from).theme) |
1938 |
-+ |
1939 |
-+#define vc_decor_to_compat(to, from) \ |
1940 |
-+ (to).bg_color = (from).bg_color; \ |
1941 |
-+ (to).state = (from).state; \ |
1942 |
-+ (to).tx = (from).tx; \ |
1943 |
-+ (to).ty = (from).ty; \ |
1944 |
-+ (to).twidth = (from).twidth; \ |
1945 |
-+ (to).theight = (from).theight; \ |
1946 |
-+ (to).theme = ptr_to_compat((from).theme) |
1947 |
-+ |
1948 |
-+#endif /* CONFIG_COMPAT */ |
1949 |
-+#endif /* __KERNEL__ */ |
1950 |
-+ |
1951 |
-+#endif |
1952 |
-diff --git a/include/linux/console_struct.h b/include/linux/console_struct.h |
1953 |
-index 7f0c329..98f5d60 100644 |
1954 |
---- a/include/linux/console_struct.h |
1955 |
-+++ b/include/linux/console_struct.h |
1956 |
-@@ -19,6 +19,7 @@ |
1957 |
- struct vt_struct; |
1958 |
- |
1959 |
- #define NPAR 16 |
1960 |
-+#include <linux/console_decor.h> |
1961 |
- |
1962 |
- struct vc_data { |
1963 |
- struct tty_port port; /* Upper level data */ |
1964 |
-@@ -107,6 +108,8 @@ struct vc_data { |
1965 |
- unsigned long vc_uni_pagedir; |
1966 |
- unsigned long *vc_uni_pagedir_loc; /* [!] Location of uni_pagedir variable for this console */ |
1967 |
- bool vc_panic_force_write; /* when oops/panic this VC can accept forced output/blanking */ |
1968 |
-+ |
1969 |
-+ struct vc_decor vc_decor; |
1970 |
- /* additional information is in vt_kern.h */ |
1971 |
- }; |
1972 |
- |
1973 |
-diff --git a/include/linux/fb.h b/include/linux/fb.h |
1974 |
-index fe6ac95..1e36b03 100644 |
1975 |
---- a/include/linux/fb.h |
1976 |
-+++ b/include/linux/fb.h |
1977 |
-@@ -219,6 +219,34 @@ struct fb_deferred_io { |
1978 |
- }; |
1979 |
- #endif |
1980 |
- |
1981 |
-+#ifdef __KERNEL__ |
1982 |
-+#ifdef CONFIG_COMPAT |
1983 |
-+struct fb_image32 { |
1984 |
-+ __u32 dx; /* Where to place image */ |
1985 |
-+ __u32 dy; |
1986 |
-+ __u32 width; /* Size of image */ |
1987 |
-+ __u32 height; |
1988 |
-+ __u32 fg_color; /* Only used when a mono bitmap */ |
1989 |
-+ __u32 bg_color; |
1990 |
-+ __u8 depth; /* Depth of the image */ |
1991 |
-+ const compat_uptr_t data; /* Pointer to image data */ |
1992 |
-+ struct fb_cmap32 cmap; /* color map info */ |
1993 |
-+}; |
1994 |
-+ |
1995 |
-+#define fb_image_from_compat(to, from) \ |
1996 |
-+ (to).dx = (from).dx; \ |
1997 |
-+ (to).dy = (from).dy; \ |
1998 |
-+ (to).width = (from).width; \ |
1999 |
-+ (to).height = (from).height; \ |
2000 |
-+ (to).fg_color = (from).fg_color; \ |
2001 |
-+ (to).bg_color = (from).bg_color; \ |
2002 |
-+ (to).depth = (from).depth; \ |
2003 |
-+ (to).data = compat_ptr((from).data); \ |
2004 |
-+ fb_cmap_from_compat((to).cmap, (from).cmap) |
2005 |
-+ |
2006 |
-+#endif /* CONFIG_COMPAT */ |
2007 |
-+#endif /* __KERNEL__ */ |
2008 |
-+ |
2009 |
- /* |
2010 |
- * Frame buffer operations |
2011 |
- * |
2012 |
-@@ -489,6 +517,9 @@ struct fb_info { |
2013 |
- #define FBINFO_STATE_SUSPENDED 1 |
2014 |
- u32 state; /* Hardware state i.e suspend */ |
2015 |
- void *fbcon_par; /* fbcon use-only private area */ |
2016 |
-+ |
2017 |
-+ struct fb_image bgdecor; |
2018 |
-+ |
2019 |
- /* From here on everything is device dependent */ |
2020 |
- void *par; |
2021 |
- /* we need the PCI or similar aperture base/size not |
2022 |
-diff --git a/include/uapi/linux/fb.h b/include/uapi/linux/fb.h |
2023 |
-index fb795c3..dc77a03 100644 |
2024 |
---- a/include/uapi/linux/fb.h |
2025 |
-+++ b/include/uapi/linux/fb.h |
2026 |
-@@ -8,6 +8,25 @@ |
2027 |
- |
2028 |
- #define FB_MAX 32 /* sufficient for now */ |
2029 |
- |
2030 |
-+struct fbcon_decor_iowrapper |
2031 |
-+{ |
2032 |
-+ unsigned short vc; /* Virtual console */ |
2033 |
-+ unsigned char origin; /* Point of origin of the request */ |
2034 |
-+ void *data; |
2035 |
-+}; |
2036 |
-+ |
2037 |
-+#ifdef __KERNEL__ |
2038 |
-+#ifdef CONFIG_COMPAT |
2039 |
-+#include <linux/compat.h> |
2040 |
-+struct fbcon_decor_iowrapper32 |
2041 |
-+{ |
2042 |
-+ unsigned short vc; /* Virtual console */ |
2043 |
-+ unsigned char origin; /* Point of origin of the request */ |
2044 |
-+ compat_uptr_t data; |
2045 |
-+}; |
2046 |
-+#endif /* CONFIG_COMPAT */ |
2047 |
-+#endif /* __KERNEL__ */ |
2048 |
-+ |
2049 |
- /* ioctls |
2050 |
- 0x46 is 'F' */ |
2051 |
- #define FBIOGET_VSCREENINFO 0x4600 |
2052 |
-@@ -35,6 +54,25 @@ |
2053 |
- #define FBIOGET_DISPINFO 0x4618 |
2054 |
- #define FBIO_WAITFORVSYNC _IOW('F', 0x20, __u32) |
2055 |
- |
2056 |
-+#define FBIOCONDECOR_SETCFG _IOWR('F', 0x19, struct fbcon_decor_iowrapper) |
2057 |
-+#define FBIOCONDECOR_GETCFG _IOR('F', 0x1A, struct fbcon_decor_iowrapper) |
2058 |
-+#define FBIOCONDECOR_SETSTATE _IOWR('F', 0x1B, struct fbcon_decor_iowrapper) |
2059 |
-+#define FBIOCONDECOR_GETSTATE _IOR('F', 0x1C, struct fbcon_decor_iowrapper) |
2060 |
-+#define FBIOCONDECOR_SETPIC _IOWR('F', 0x1D, struct fbcon_decor_iowrapper) |
2061 |
-+#ifdef __KERNEL__ |
2062 |
-+#ifdef CONFIG_COMPAT |
2063 |
-+#define FBIOCONDECOR_SETCFG32 _IOWR('F', 0x19, struct fbcon_decor_iowrapper32) |
2064 |
-+#define FBIOCONDECOR_GETCFG32 _IOR('F', 0x1A, struct fbcon_decor_iowrapper32) |
2065 |
-+#define FBIOCONDECOR_SETSTATE32 _IOWR('F', 0x1B, struct fbcon_decor_iowrapper32) |
2066 |
-+#define FBIOCONDECOR_GETSTATE32 _IOR('F', 0x1C, struct fbcon_decor_iowrapper32) |
2067 |
-+#define FBIOCONDECOR_SETPIC32 _IOWR('F', 0x1D, struct fbcon_decor_iowrapper32) |
2068 |
-+#endif /* CONFIG_COMPAT */ |
2069 |
-+#endif /* __KERNEL__ */ |
2070 |
-+ |
2071 |
-+#define FBCON_DECOR_THEME_LEN 128 /* Maximum lenght of a theme name */ |
2072 |
-+#define FBCON_DECOR_IO_ORIG_KERNEL 0 /* Kernel ioctl origin */ |
2073 |
-+#define FBCON_DECOR_IO_ORIG_USER 1 /* User ioctl origin */ |
2074 |
-+ |
2075 |
- #define FB_TYPE_PACKED_PIXELS 0 /* Packed Pixels */ |
2076 |
- #define FB_TYPE_PLANES 1 /* Non interleaved planes */ |
2077 |
- #define FB_TYPE_INTERLEAVED_PLANES 2 /* Interleaved planes */ |
2078 |
-@@ -277,6 +315,29 @@ struct fb_var_screeninfo { |
2079 |
- __u32 reserved[4]; /* Reserved for future compatibility */ |
2080 |
- }; |
2081 |
- |
2082 |
-+#ifdef __KERNEL__ |
2083 |
-+#ifdef CONFIG_COMPAT |
2084 |
-+struct fb_cmap32 { |
2085 |
-+ __u32 start; |
2086 |
-+ __u32 len; /* Number of entries */ |
2087 |
-+ compat_uptr_t red; /* Red values */ |
2088 |
-+ compat_uptr_t green; |
2089 |
-+ compat_uptr_t blue; |
2090 |
-+ compat_uptr_t transp; /* transparency, can be NULL */ |
2091 |
-+}; |
2092 |
-+ |
2093 |
-+#define fb_cmap_from_compat(to, from) \ |
2094 |
-+ (to).start = (from).start; \ |
2095 |
-+ (to).len = (from).len; \ |
2096 |
-+ (to).red = compat_ptr((from).red); \ |
2097 |
-+ (to).green = compat_ptr((from).green); \ |
2098 |
-+ (to).blue = compat_ptr((from).blue); \ |
2099 |
-+ (to).transp = compat_ptr((from).transp) |
2100 |
-+ |
2101 |
-+#endif /* CONFIG_COMPAT */ |
2102 |
-+#endif /* __KERNEL__ */ |
2103 |
-+ |
2104 |
-+ |
2105 |
- struct fb_cmap { |
2106 |
- __u32 start; /* First entry */ |
2107 |
- __u32 len; /* Number of entries */ |
2108 |
-diff --git a/kernel/sysctl.c b/kernel/sysctl.c |
2109 |
-index 74f5b58..6386ab0 100644 |
2110 |
---- a/kernel/sysctl.c |
2111 |
-+++ b/kernel/sysctl.c |
2112 |
-@@ -146,6 +146,10 @@ static const int cap_last_cap = CAP_LAST_CAP; |
2113 |
- static unsigned long hung_task_timeout_max = (LONG_MAX/HZ); |
2114 |
- #endif |
2115 |
- |
2116 |
-+#ifdef CONFIG_FB_CON_DECOR |
2117 |
-+extern char fbcon_decor_path[]; |
2118 |
-+#endif |
2119 |
-+ |
2120 |
- #ifdef CONFIG_INOTIFY_USER |
2121 |
- #include <linux/inotify.h> |
2122 |
- #endif |
2123 |
-@@ -255,6 +259,15 @@ static struct ctl_table sysctl_base_table[] = { |
2124 |
- .mode = 0555, |
2125 |
- .child = dev_table, |
2126 |
- }, |
2127 |
-+#ifdef CONFIG_FB_CON_DECOR |
2128 |
-+ { |
2129 |
-+ .procname = "fbcondecor", |
2130 |
-+ .data = &fbcon_decor_path, |
2131 |
-+ .maxlen = KMOD_PATH_LEN, |
2132 |
-+ .mode = 0644, |
2133 |
-+ .proc_handler = &proc_dostring, |
2134 |
-+ }, |
2135 |
-+#endif |
2136 |
- { } |
2137 |
- }; |
2138 |
- |