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