Magellan Linux

Annotation of /trunk/kernel26-magellan/patches-2.6.30-r1/0150-2.6.30-fbcondecor-0.9.6.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1114 - (hide annotations) (download)
Sun Aug 22 17:59:15 2010 UTC (13 years, 9 months ago) by niro
File size: 63938 byte(s)
-added

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