Magellan Linux

Annotation of /trunk/kernel26-alx/patches-2.6.27-r3/0150-2.6.27-fbcondecor-0.9.4.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1176 - (hide annotations) (download)
Thu Oct 14 15:11:06 2010 UTC (13 years, 7 months ago) by niro
File size: 55860 byte(s)
-2.6.27-alx-r3: new magellan 0.5.2 kernel
1 niro 1176 diff -Naurp linux-2.6.27-orig/Documentation/fb/00-INDEX linux-2.6.27/Documentation/fb/00-INDEX
2     --- linux-2.6.27-orig/Documentation/fb/00-INDEX 2008-10-15 19:57:25.000000000 +0200
3     +++ linux-2.6.27/Documentation/fb/00-INDEX 2008-10-15 19:58:52.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 -Naurp linux-2.6.27-orig/Documentation/fb/fbcondecor.txt linux-2.6.27/Documentation/fb/fbcondecor.txt
14     --- linux-2.6.27-orig/Documentation/fb/fbcondecor.txt 1970-01-01 01:00:00.000000000 +0100
15     +++ linux-2.6.27/Documentation/fb/fbcondecor.txt 2008-10-15 19:58:52.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 -Naurp linux-2.6.27-orig/drivers/Makefile linux-2.6.27/drivers/Makefile
225     --- linux-2.6.27-orig/drivers/Makefile 2008-10-15 19:57:16.000000000 +0200
226     +++ linux-2.6.27/drivers/Makefile 2008-10-15 20:00:37.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     @@ -18,10 +21,6 @@ obj-$(CONFIG_ARM_AMBA) += amba/
238    
239     obj-$(CONFIG_XEN) += xen/
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 -Naurp linux-2.6.27-orig/drivers/video/console/bitblit.c linux-2.6.27/drivers/video/console/bitblit.c
249     --- linux-2.6.27-orig/drivers/video/console/bitblit.c 2008-10-15 19:57:21.000000000 +0200
250     +++ linux-2.6.27/drivers/video/console/bitblit.c 2008-10-15 19:58:52.000000000 +0200
251     @@ -17,6 +17,7 @@
252     #include <linux/console.h>
253     #include <asm/types.h>
254     #include "fbcon.h"
255     +#include "fbcondecor.h"
256    
257     /*
258     * Accelerated handlers.
259     @@ -54,6 +55,13 @@ static void bit_bmove(struct vc_data *vc
260     area.height = height * vc->vc_font.height;
261     area.width = width * vc->vc_font.width;
262    
263     + if (fbcon_decor_active(info, vc)) {
264     + area.sx += vc->vc_decor.tx;
265     + area.sy += vc->vc_decor.ty;
266     + area.dx += vc->vc_decor.tx;
267     + area.dy += vc->vc_decor.ty;
268     + }
269     +
270     info->fbops->fb_copyarea(info, &area);
271     }
272    
273     @@ -379,11 +387,15 @@ static void bit_cursor(struct vc_data *v
274     cursor.image.depth = 1;
275     cursor.rop = ROP_XOR;
276    
277     - if (info->fbops->fb_cursor)
278     - err = info->fbops->fb_cursor(info, &cursor);
279     + if (fbcon_decor_active(info, vc)) {
280     + fbcon_decor_cursor(info, &cursor);
281     + } else {
282     + if (info->fbops->fb_cursor)
283     + err = info->fbops->fb_cursor(info, &cursor);
284    
285     - if (err)
286     - soft_cursor(info, &cursor);
287     + if (err)
288     + soft_cursor(info, &cursor);
289     + }
290    
291     ops->cursor_reset = 0;
292     }
293     diff -Naurp linux-2.6.27-orig/drivers/video/console/cfbcondecor.c linux-2.6.27/drivers/video/console/cfbcondecor.c
294     --- linux-2.6.27-orig/drivers/video/console/cfbcondecor.c 1970-01-01 01:00:00.000000000 +0100
295     +++ linux-2.6.27/drivers/video/console/cfbcondecor.c 2008-10-15 19:58:52.000000000 +0200
296     @@ -0,0 +1,471 @@
297     +/*
298     + * linux/drivers/video/cfbcon_decor.c -- Framebuffer decor render functions
299     + *
300     + * Copyright (C) 2004 Michal Januszewski <spock@gentoo.org>
301     + *
302     + * Code based upon "Bootdecor" (C) 2001-2003
303     + * Volker Poplawski <volker@poplawski.de>,
304     + * Stefan Reinauer <stepan@suse.de>,
305     + * Steffen Winterfeldt <snwint@suse.de>,
306     + * Michael Schroeder <mls@suse.de>,
307     + * Ken Wimer <wimer@suse.de>.
308     + *
309     + * This file is subject to the terms and conditions of the GNU General Public
310     + * License. See the file COPYING in the main directory of this archive for
311     + * more details.
312     + */
313     +#include <linux/module.h>
314     +#include <linux/types.h>
315     +#include <linux/fb.h>
316     +#include <linux/selection.h>
317     +#include <linux/vt_kern.h>
318     +#include <asm/irq.h>
319     +#include <asm/system.h>
320     +
321     +#include "fbcon.h"
322     +#include "fbcondecor.h"
323     +
324     +#define parse_pixel(shift,bpp,type) \
325     + do { \
326     + if (d & (0x80 >> (shift))) \
327     + dd2[(shift)] = fgx; \
328     + else \
329     + dd2[(shift)] = transparent ? *(type *)decor_src : bgx; \
330     + decor_src += (bpp); \
331     + } while (0) \
332     +
333     +extern int get_color(struct vc_data *vc, struct fb_info *info,
334     + u16 c, int is_fg);
335     +
336     +void fbcon_decor_fix_pseudo_pal(struct fb_info *info, struct vc_data *vc)
337     +{
338     + int i, j, k;
339     + int minlen = min(min(info->var.red.length, info->var.green.length),
340     + info->var.blue.length);
341     + u32 col;
342     +
343     + for (j = i = 0; i < 16; i++) {
344     + k = color_table[i];
345     +
346     + col = ((vc->vc_palette[j++] >> (8-minlen))
347     + << info->var.red.offset);
348     + col |= ((vc->vc_palette[j++] >> (8-minlen))
349     + << info->var.green.offset);
350     + col |= ((vc->vc_palette[j++] >> (8-minlen))
351     + << info->var.blue.offset);
352     + ((u32 *)info->pseudo_palette)[k] = col;
353     + }
354     +}
355     +
356     +void fbcon_decor_renderc(struct fb_info *info, int ypos, int xpos, int height,
357     + int width, u8* src, u32 fgx, u32 bgx, u8 transparent)
358     +{
359     + unsigned int x, y;
360     + u32 dd;
361     + int bytespp = ((info->var.bits_per_pixel + 7) >> 3);
362     + unsigned int d = ypos * info->fix.line_length + xpos * bytespp;
363     + unsigned int ds = (ypos * info->var.xres + xpos) * bytespp;
364     + u16 dd2[4];
365     +
366     + u8* decor_src = (u8 *)(info->bgdecor.data + ds);
367     + u8* dst = (u8 *)(info->screen_base + d);
368     +
369     + if ((ypos + height) > info->var.yres || (xpos + width) > info->var.xres)
370     + return;
371     +
372     + for (y = 0; y < height; y++) {
373     + switch (info->var.bits_per_pixel) {
374     +
375     + case 32:
376     + for (x = 0; x < width; x++) {
377     +
378     + if ((x & 7) == 0)
379     + d = *src++;
380     + if (d & 0x80)
381     + dd = fgx;
382     + else
383     + dd = transparent ?
384     + *(u32 *)decor_src : bgx;
385     +
386     + d <<= 1;
387     + decor_src += 4;
388     + fb_writel(dd, dst);
389     + dst += 4;
390     + }
391     + break;
392     + case 24:
393     + for (x = 0; x < width; x++) {
394     +
395     + if ((x & 7) == 0)
396     + d = *src++;
397     + if (d & 0x80)
398     + dd = fgx;
399     + else
400     + dd = transparent ?
401     + (*(u32 *)decor_src & 0xffffff) : bgx;
402     +
403     + d <<= 1;
404     + decor_src += 3;
405     +#ifdef __LITTLE_ENDIAN
406     + fb_writew(dd & 0xffff, dst);
407     + dst += 2;
408     + fb_writeb((dd >> 16), dst);
409     +#else
410     + fb_writew(dd >> 8, dst);
411     + dst += 2;
412     + fb_writeb(dd & 0xff, dst);
413     +#endif
414     + dst++;
415     + }
416     + break;
417     + case 16:
418     + for (x = 0; x < width; x += 2) {
419     + if ((x & 7) == 0)
420     + d = *src++;
421     +
422     + parse_pixel(0, 2, u16);
423     + parse_pixel(1, 2, u16);
424     +#ifdef __LITTLE_ENDIAN
425     + dd = dd2[0] | (dd2[1] << 16);
426     +#else
427     + dd = dd2[1] | (dd2[0] << 16);
428     +#endif
429     + d <<= 2;
430     + fb_writel(dd, dst);
431     + dst += 4;
432     + }
433     + break;
434     +
435     + case 8:
436     + for (x = 0; x < width; x += 4) {
437     + if ((x & 7) == 0)
438     + d = *src++;
439     +
440     + parse_pixel(0, 1, u8);
441     + parse_pixel(1, 1, u8);
442     + parse_pixel(2, 1, u8);
443     + parse_pixel(3, 1, u8);
444     +
445     +#ifdef __LITTLE_ENDIAN
446     + dd = dd2[0] | (dd2[1] << 8) | (dd2[2] << 16) | (dd2[3] << 24);
447     +#else
448     + dd = dd2[3] | (dd2[2] << 8) | (dd2[1] << 16) | (dd2[0] << 24);
449     +#endif
450     + d <<= 4;
451     + fb_writel(dd, dst);
452     + dst += 4;
453     + }
454     + }
455     +
456     + dst += info->fix.line_length - width * bytespp;
457     + decor_src += (info->var.xres - width) * bytespp;
458     + }
459     +}
460     +
461     +#define cc2cx(a) \
462     + ((info->fix.visual == FB_VISUAL_TRUECOLOR || \
463     + info->fix.visual == FB_VISUAL_DIRECTCOLOR) ? \
464     + ((u32*)info->pseudo_palette)[a] : a)
465     +
466     +void fbcon_decor_putcs(struct vc_data *vc, struct fb_info *info,
467     + const unsigned short *s, int count, int yy, int xx)
468     +{
469     + unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff;
470     + struct fbcon_ops *ops = info->fbcon_par;
471     + int fg_color, bg_color, transparent;
472     + u8 *src;
473     + u32 bgx, fgx;
474     + u16 c = scr_readw(s);
475     +
476     + fg_color = get_color(vc, info, c, 1);
477     + bg_color = get_color(vc, info, c, 0);
478     +
479     + /* Don't paint the background image if console is blanked */
480     + transparent = ops->blank_state ? 0 :
481     + (vc->vc_decor.bg_color == bg_color);
482     +
483     + xx = xx * vc->vc_font.width + vc->vc_decor.tx;
484     + yy = yy * vc->vc_font.height + vc->vc_decor.ty;
485     +
486     + fgx = cc2cx(fg_color);
487     + bgx = cc2cx(bg_color);
488     +
489     + while (count--) {
490     + c = scr_readw(s++);
491     + src = vc->vc_font.data + (c & charmask) * vc->vc_font.height *
492     + ((vc->vc_font.width + 7) >> 3);
493     +
494     + fbcon_decor_renderc(info, yy, xx, vc->vc_font.height,
495     + vc->vc_font.width, src, fgx, bgx, transparent);
496     + xx += vc->vc_font.width;
497     + }
498     +}
499     +
500     +void fbcon_decor_cursor(struct fb_info *info, struct fb_cursor *cursor)
501     +{
502     + int i;
503     + unsigned int dsize, s_pitch;
504     + struct fbcon_ops *ops = info->fbcon_par;
505     + struct vc_data* vc;
506     + u8 *src;
507     +
508     + /* we really don't need any cursors while the console is blanked */
509     + if (info->state != FBINFO_STATE_RUNNING || ops->blank_state)
510     + return;
511     +
512     + vc = vc_cons[ops->currcon].d;
513     +
514     + src = kmalloc(64 + sizeof(struct fb_image), GFP_ATOMIC);
515     + if (!src)
516     + return;
517     +
518     + s_pitch = (cursor->image.width + 7) >> 3;
519     + dsize = s_pitch * cursor->image.height;
520     + if (cursor->enable) {
521     + switch (cursor->rop) {
522     + case ROP_XOR:
523     + for (i = 0; i < dsize; i++)
524     + src[i] = cursor->image.data[i] ^ cursor->mask[i];
525     + break;
526     + case ROP_COPY:
527     + default:
528     + for (i = 0; i < dsize; i++)
529     + src[i] = cursor->image.data[i] & cursor->mask[i];
530     + break;
531     + }
532     + } else
533     + memcpy(src, cursor->image.data, dsize);
534     +
535     + fbcon_decor_renderc(info,
536     + cursor->image.dy + vc->vc_decor.ty,
537     + cursor->image.dx + vc->vc_decor.tx,
538     + cursor->image.height,
539     + cursor->image.width,
540     + (u8*)src,
541     + cc2cx(cursor->image.fg_color),
542     + cc2cx(cursor->image.bg_color),
543     + cursor->image.bg_color == vc->vc_decor.bg_color);
544     +
545     + kfree(src);
546     +}
547     +
548     +static void decorset(u8 *dst, int height, int width, int dstbytes,
549     + u32 bgx, int bpp)
550     +{
551     + int i;
552     +
553     + if (bpp == 8)
554     + bgx |= bgx << 8;
555     + if (bpp == 16 || bpp == 8)
556     + bgx |= bgx << 16;
557     +
558     + while (height-- > 0) {
559     + u8 *p = dst;
560     +
561     + switch (bpp) {
562     +
563     + case 32:
564     + for (i=0; i < width; i++) {
565     + fb_writel(bgx, p); p += 4;
566     + }
567     + break;
568     + case 24:
569     + for (i=0; i < width; i++) {
570     +#ifdef __LITTLE_ENDIAN
571     + fb_writew((bgx & 0xffff),(u16*)p); p += 2;
572     + fb_writeb((bgx >> 16),p++);
573     +#else
574     + fb_writew((bgx >> 8),(u16*)p); p += 2;
575     + fb_writeb((bgx & 0xff),p++);
576     +#endif
577     + }
578     + case 16:
579     + for (i=0; i < width/4; i++) {
580     + fb_writel(bgx,p); p += 4;
581     + fb_writel(bgx,p); p += 4;
582     + }
583     + if (width & 2) {
584     + fb_writel(bgx,p); p += 4;
585     + }
586     + if (width & 1)
587     + fb_writew(bgx,(u16*)p);
588     + break;
589     + case 8:
590     + for (i=0; i < width/4; i++) {
591     + fb_writel(bgx,p); p += 4;
592     + }
593     +
594     + if (width & 2) {
595     + fb_writew(bgx,p); p += 2;
596     + }
597     + if (width & 1)
598     + fb_writeb(bgx,(u8*)p);
599     + break;
600     +
601     + }
602     + dst += dstbytes;
603     + }
604     +}
605     +
606     +void fbcon_decor_copy(u8 *dst, u8 *src, int height, int width, int linebytes,
607     + int srclinebytes, int bpp)
608     +{
609     + int i;
610     +
611     + while (height-- > 0) {
612     + u32 *p = (u32 *)dst;
613     + u32 *q = (u32 *)src;
614     +
615     + switch (bpp) {
616     +
617     + case 32:
618     + for (i=0; i < width; i++)
619     + fb_writel(*q++, p++);
620     + break;
621     + case 24:
622     + for (i=0; i < (width*3/4); i++)
623     + fb_writel(*q++, p++);
624     + if ((width*3) % 4) {
625     + if (width & 2) {
626     + fb_writeb(*(u8*)q, (u8*)p);
627     + } else if (width & 1) {
628     + fb_writew(*(u16*)q, (u16*)p);
629     + fb_writeb(*(u8*)((u16*)q+1),(u8*)((u16*)p+2));
630     + }
631     + }
632     + break;
633     + case 16:
634     + for (i=0; i < width/4; i++) {
635     + fb_writel(*q++, p++);
636     + fb_writel(*q++, p++);
637     + }
638     + if (width & 2)
639     + fb_writel(*q++, p++);
640     + if (width & 1)
641     + fb_writew(*(u16*)q, (u16*)p);
642     + break;
643     + case 8:
644     + for (i=0; i < width/4; i++)
645     + fb_writel(*q++, p++);
646     +
647     + if (width & 2) {
648     + fb_writew(*(u16*)q, (u16*)p);
649     + q = (u32*) ((u16*)q + 1);
650     + p = (u32*) ((u16*)p + 1);
651     + }
652     + if (width & 1)
653     + fb_writeb(*(u8*)q, (u8*)p);
654     + break;
655     + }
656     +
657     + dst += linebytes;
658     + src += srclinebytes;
659     + }
660     +}
661     +
662     +static void decorfill(struct fb_info *info, int sy, int sx, int height,
663     + int width)
664     +{
665     + int bytespp = ((info->var.bits_per_pixel + 7) >> 3);
666     + int d = sy * info->fix.line_length + sx * bytespp;
667     + int ds = (sy * info->var.xres + sx) * bytespp;
668     +
669     + fbcon_decor_copy((u8 *)(info->screen_base + d), (u8 *)(info->bgdecor.data + ds),
670     + height, width, info->fix.line_length, info->var.xres * bytespp,
671     + info->var.bits_per_pixel);
672     +}
673     +
674     +void fbcon_decor_clear(struct vc_data *vc, struct fb_info *info, int sy, int sx,
675     + int height, int width)
676     +{
677     + int bgshift = (vc->vc_hi_font_mask) ? 13 : 12;
678     + struct fbcon_ops *ops = info->fbcon_par;
679     + u8 *dst;
680     + int transparent, bg_color = attr_bgcol_ec(bgshift, vc, info);
681     +
682     + transparent = (vc->vc_decor.bg_color == bg_color);
683     + sy = sy * vc->vc_font.height + vc->vc_decor.ty;
684     + sx = sx * vc->vc_font.width + vc->vc_decor.tx;
685     + height *= vc->vc_font.height;
686     + width *= vc->vc_font.width;
687     +
688     + /* Don't paint the background image if console is blanked */
689     + if (transparent && !ops->blank_state) {
690     + decorfill(info, sy, sx, height, width);
691     + } else {
692     + dst = (u8 *)(info->screen_base + sy * info->fix.line_length +
693     + sx * ((info->var.bits_per_pixel + 7) >> 3));
694     + decorset(dst, height, width, info->fix.line_length, cc2cx(bg_color),
695     + info->var.bits_per_pixel);
696     + }
697     +}
698     +
699     +void fbcon_decor_clear_margins(struct vc_data *vc, struct fb_info *info,
700     + int bottom_only)
701     +{
702     + unsigned int tw = vc->vc_cols*vc->vc_font.width;
703     + unsigned int th = vc->vc_rows*vc->vc_font.height;
704     +
705     + if (!bottom_only) {
706     + /* top margin */
707     + decorfill(info, 0, 0, vc->vc_decor.ty, info->var.xres);
708     + /* left margin */
709     + decorfill(info, vc->vc_decor.ty, 0, th, vc->vc_decor.tx);
710     + /* right margin */
711     + decorfill(info, vc->vc_decor.ty, vc->vc_decor.tx + tw, th,
712     + info->var.xres - vc->vc_decor.tx - tw);
713     + }
714     + decorfill(info, vc->vc_decor.ty + th, 0,
715     + info->var.yres - vc->vc_decor.ty - th, info->var.xres);
716     +}
717     +
718     +void fbcon_decor_bmove_redraw(struct vc_data *vc, struct fb_info *info, int y,
719     + int sx, int dx, int width)
720     +{
721     + u16 *d = (u16 *) (vc->vc_origin + vc->vc_size_row * y + dx * 2);
722     + u16 *s = d + (dx - sx);
723     + u16 *start = d;
724     + u16 *ls = d;
725     + u16 *le = d + width;
726     + u16 c;
727     + int x = dx;
728     + u16 attr = 1;
729     +
730     + do {
731     + c = scr_readw(d);
732     + if (attr != (c & 0xff00)) {
733     + attr = c & 0xff00;
734     + if (d > start) {
735     + fbcon_decor_putcs(vc, info, start, d - start, y, x);
736     + x += d - start;
737     + start = d;
738     + }
739     + }
740     + if (s >= ls && s < le && c == scr_readw(s)) {
741     + if (d > start) {
742     + fbcon_decor_putcs(vc, info, start, d - start, y, x);
743     + x += d - start + 1;
744     + start = d + 1;
745     + } else {
746     + x++;
747     + start++;
748     + }
749     + }
750     + s++;
751     + d++;
752     + } while (d < le);
753     + if (d > start)
754     + fbcon_decor_putcs(vc, info, start, d - start, y, x);
755     +}
756     +
757     +void fbcon_decor_blank(struct vc_data *vc, struct fb_info *info, int blank)
758     +{
759     + if (blank) {
760     + decorset((u8 *)info->screen_base, info->var.yres, info->var.xres,
761     + info->fix.line_length, 0, info->var.bits_per_pixel);
762     + } else {
763     + update_screen(vc);
764     + fbcon_decor_clear_margins(vc, info, 0);
765     + }
766     +}
767     +
768     diff -Naurp linux-2.6.27-orig/drivers/video/console/fbcon.c linux-2.6.27/drivers/video/console/fbcon.c
769     --- linux-2.6.27-orig/drivers/video/console/fbcon.c 2008-10-15 19:57:21.000000000 +0200
770     +++ linux-2.6.27/drivers/video/console/fbcon.c 2008-10-15 20:02:31.000000000 +0200
771     @@ -90,6 +90,7 @@
772     #endif
773    
774     #include "fbcon.h"
775     +#include "fbcondecor.h"
776    
777     #ifdef FBCONDEBUG
778     # define DPRINTK(fmt, args...) printk(KERN_DEBUG "%s: " fmt, __func__ , ## args)
779     @@ -105,7 +106,7 @@ enum {
780    
781     static struct display fb_display[MAX_NR_CONSOLES];
782    
783     -static signed char con2fb_map[MAX_NR_CONSOLES];
784     +signed char con2fb_map[MAX_NR_CONSOLES];
785     static signed char con2fb_map_boot[MAX_NR_CONSOLES];
786    
787     static int logo_lines;
788     @@ -313,7 +314,7 @@ static inline int fbcon_is_inactive(stru
789     vc->vc_mode != KD_TEXT || ops->graphics);
790     }
791    
792     -static inline int get_color(struct vc_data *vc, struct fb_info *info,
793     +inline int get_color(struct vc_data *vc, struct fb_info *info,
794     u16 c, int is_fg)
795     {
796     int depth = fb_get_color_depth(&info->var, &info->fix);
797     @@ -418,6 +419,7 @@ static void fb_flashcursor(struct work_s
798     CM_ERASE : CM_DRAW;
799     ops->cursor(vc, info, mode, softback_lines, get_color(vc, info, c, 1),
800     get_color(vc, info, c, 0));
801     +
802     release_console_sem();
803     }
804    
805     @@ -588,6 +590,8 @@ static int fbcon_takeover(int show_logo)
806     info_idx = -1;
807     }
808    
809     + fbcon_decor_init();
810     +
811     return err;
812     }
813    
814     @@ -1029,6 +1033,12 @@ static const char *fbcon_startup(void)
815     rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres);
816     cols /= vc->vc_font.width;
817     rows /= vc->vc_font.height;
818     +
819     + if (fbcon_decor_active(info, vc)) {
820     + cols = vc->vc_decor.twidth / vc->vc_font.width;
821     + rows = vc->vc_decor.theight / vc->vc_font.height;
822     + }
823     +
824     vc_resize(vc, cols, rows);
825    
826     DPRINTK("mode: %s\n", info->fix.id);
827     @@ -1112,7 +1122,7 @@ static void fbcon_init(struct vc_data *v
828     cap = info->flags;
829    
830     if (vc != svc || logo_shown == FBCON_LOGO_DONTSHOW ||
831     - (info->fix.type == FB_TYPE_TEXT))
832     + (info->fix.type == FB_TYPE_TEXT) || fbcon_decor_active(info, vc))
833     logo = 0;
834    
835     if (var_to_display(p, &info->var, info))
836     @@ -1314,6 +1324,11 @@ static void fbcon_clear(struct vc_data *
837     if (sy < vc->vc_top && vc->vc_top == logo_lines)
838     vc->vc_top = 0;
839    
840     + if (fbcon_decor_active(info, vc)) {
841     + fbcon_decor_clear(vc, info, sy, sx, height, width);
842     + return;
843     + }
844     +
845     /* Split blits that cross physical y_wrap boundary */
846    
847     y_break = p->vrows - p->yscroll;
848     @@ -1333,10 +1348,15 @@ static void fbcon_putcs(struct vc_data *
849     struct display *p = &fb_display[vc->vc_num];
850     struct fbcon_ops *ops = info->fbcon_par;
851    
852     - if (!fbcon_is_inactive(vc, info))
853     - ops->putcs(vc, info, s, count, real_y(p, ypos), xpos,
854     - get_color(vc, info, scr_readw(s), 1),
855     - get_color(vc, info, scr_readw(s), 0));
856     + if (!fbcon_is_inactive(vc, info)) {
857     +
858     + if (fbcon_decor_active(info, vc))
859     + fbcon_decor_putcs(vc, info, s, count, ypos, xpos);
860     + else
861     + ops->putcs(vc, info, s, count, real_y(p, ypos), xpos,
862     + get_color(vc, info, scr_readw(s), 1),
863     + get_color(vc, info, scr_readw(s), 0));
864     + }
865     }
866    
867     static void fbcon_putc(struct vc_data *vc, int c, int ypos, int xpos)
868     @@ -1352,8 +1372,13 @@ static void fbcon_clear_margins(struct v
869     struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
870     struct fbcon_ops *ops = info->fbcon_par;
871    
872     - if (!fbcon_is_inactive(vc, info))
873     - ops->clear_margins(vc, info, bottom_only);
874     + if (!fbcon_is_inactive(vc, info)) {
875     + if (fbcon_decor_active(info, vc)) {
876     + fbcon_decor_clear_margins(vc, info, bottom_only);
877     + } else {
878     + ops->clear_margins(vc, info, bottom_only);
879     + }
880     + }
881     }
882    
883     static void fbcon_cursor(struct vc_data *vc, int mode)
884     @@ -1880,7 +1905,7 @@ static int fbcon_scroll(struct vc_data *
885     count = vc->vc_rows;
886     if (softback_top)
887     fbcon_softback_note(vc, t, count);
888     - if (logo_shown >= 0)
889     + if (logo_shown >= 0 || fbcon_decor_active(info, vc))
890     goto redraw_up;
891     switch (p->scrollmode) {
892     case SCROLL_MOVE:
893     @@ -1974,6 +1999,8 @@ static int fbcon_scroll(struct vc_data *
894     count = vc->vc_rows;
895     if (logo_shown >= 0)
896     goto redraw_down;
897     + if (fbcon_decor_active(info, vc))
898     + goto redraw_down;
899     switch (p->scrollmode) {
900     case SCROLL_MOVE:
901     fbcon_redraw_blit(vc, info, p, b - 1, b - t - count,
902     @@ -2125,6 +2152,13 @@ static void fbcon_bmove_rec(struct vc_da
903     }
904     return;
905     }
906     +
907     + if (fbcon_decor_active(info, vc) && sy == dy && height == 1) {
908     + /* must use slower redraw bmove to keep background pic intact */
909     + fbcon_decor_bmove_redraw(vc, info, sy, sx, dx, width);
910     + return;
911     + }
912     +
913     ops->bmove(vc, info, real_y(p, sy), sx, real_y(p, dy), dx,
914     height, width);
915     }
916     @@ -2195,8 +2229,8 @@ static int fbcon_resize(struct vc_data *
917     var.yres = virt_h * virt_fh;
918     x_diff = info->var.xres - var.xres;
919     y_diff = info->var.yres - var.yres;
920     - if (x_diff < 0 || x_diff > virt_fw ||
921     - y_diff < 0 || y_diff > virt_fh) {
922     + if ((x_diff < 0 || x_diff > virt_fw ||
923     + y_diff < 0 || y_diff > virt_fh) && !vc->vc_decor.state) {
924     const struct fb_videomode *mode;
925    
926     DPRINTK("attempting resize %ix%i\n", var.xres, var.yres);
927     @@ -2232,6 +2266,19 @@ static int fbcon_switch(struct vc_data *
928    
929     info = registered_fb[con2fb_map[vc->vc_num]];
930     ops = info->fbcon_par;
931     + prev_console = ops->currcon;
932     + if (prev_console != -1)
933     + old_info = registered_fb[con2fb_map[prev_console]];
934     +
935     + if (!fbcon_decor_active_vc(vc) && info->fix.visual == FB_VISUAL_DIRECTCOLOR) {
936     + struct vc_data *vc_curr = vc_cons[prev_console].d;
937     + if (vc_curr && fbcon_decor_active_vc(vc_curr)) {
938     + /* Clear the screen to avoid displaying funky colors during
939     + * palette updates. */
940     + memset((u8*)info->screen_base + info->fix.line_length * info->var.yoffset,
941     + 0, info->var.yres * info->fix.line_length);
942     + }
943     + }
944    
945     if (softback_top) {
946     if (softback_lines)
947     @@ -2250,9 +2297,6 @@ static int fbcon_switch(struct vc_data *
948     logo_shown = FBCON_LOGO_CANSHOW;
949     }
950    
951     - prev_console = ops->currcon;
952     - if (prev_console != -1)
953     - old_info = registered_fb[con2fb_map[prev_console]];
954     /*
955     * FIXME: If we have multiple fbdev's loaded, we need to
956     * update all info->currcon. Perhaps, we can place this
957     @@ -2290,6 +2334,18 @@ static int fbcon_switch(struct vc_data *
958     fbcon_del_cursor_timer(old_info);
959     }
960    
961     + if (fbcon_decor_active_vc(vc)) {
962     + struct vc_data *vc_curr = vc_cons[prev_console].d;
963     +
964     + if (!vc_curr->vc_decor.theme ||
965     + strcmp(vc->vc_decor.theme, vc_curr->vc_decor.theme) ||
966     + (fbcon_decor_active_nores(info, vc_curr) &&
967     + !fbcon_decor_active(info, vc_curr))) {
968     + if (fbcon_decor_call_helper("modechange", vc->vc_num))
969     + fbcon_decor_disable(vc, 0);
970     + }
971     + }
972     +
973     if (fbcon_is_inactive(vc, info) ||
974     ops->blank_state != FB_BLANK_UNBLANK)
975     fbcon_del_cursor_timer(info);
976     @@ -2398,7 +2454,7 @@ static int fbcon_blank(struct vc_data *v
977     info->fbops->fb_restore_state(info);
978     }
979    
980     - if (!fbcon_is_inactive(vc, info)) {
981     + if (!fbcon_is_inactive(vc, info)) {
982     if (ops->blank_state != blank) {
983     int ret = 1;
984    
985     @@ -2408,8 +2464,12 @@ static int fbcon_blank(struct vc_data *v
986    
987     if (info->fbops->fb_blank)
988     ret = info->fbops->fb_blank(blank, info);
989     - if (ret)
990     - fbcon_generic_blank(vc, info, blank);
991     + if (ret) {
992     + if (fbcon_decor_active(info, vc))
993     + fbcon_decor_blank(vc, info, blank);
994     + else
995     + fbcon_generic_blank(vc, info, blank);
996     + }
997     }
998    
999     if (!blank)
1000     @@ -2568,13 +2628,22 @@ static int fbcon_do_set_font(struct vc_d
1001     }
1002    
1003     if (resize) {
1004     + /* reset wrap/pan */
1005     int cols, rows;
1006    
1007     cols = FBCON_SWAP(ops->rotate, info->var.xres, info->var.yres);
1008     rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres);
1009     +
1010     + info->var.xoffset = info->var.yoffset = p->yscroll = 0;
1011     + if (fbcon_decor_active(info, vc)) {
1012     + cols = vc->vc_decor.twidth;
1013     + rows = vc->vc_decor.theight;
1014     + }
1015     cols /= w;
1016     rows /= h;
1017     +
1018     vc_resize(vc, cols, rows);
1019     +
1020     if (CON_IS_VISIBLE(vc) && softback_buf)
1021     fbcon_update_softback(vc);
1022     } else if (CON_IS_VISIBLE(vc)
1023     @@ -2703,7 +2772,7 @@ static int fbcon_set_palette(struct vc_d
1024     int i, j, k, depth;
1025     u8 val;
1026    
1027     - if (fbcon_is_inactive(vc, info))
1028     + if (fbcon_is_inactive(vc, info) || vc->vc_num != fg_console)
1029     return -EINVAL;
1030    
1031     if (!CON_IS_VISIBLE(vc))
1032     @@ -2729,7 +2798,49 @@ static int fbcon_set_palette(struct vc_d
1033     } else
1034     fb_copy_cmap(fb_default_cmap(1 << depth), &palette_cmap);
1035    
1036     - return fb_set_cmap(&palette_cmap, info);
1037     + if (fbcon_decor_active(info, vc_cons[fg_console].d) &&
1038     + info->fix.visual == FB_VISUAL_DIRECTCOLOR) {
1039     +
1040     + u16 *red, *green, *blue;
1041     + int minlen = min(min(info->var.red.length, info->var.green.length),
1042     + info->var.blue.length);
1043     + int h;
1044     +
1045     + struct fb_cmap cmap = {
1046     + .start = 0,
1047     + .len = (1 << minlen),
1048     + .red = NULL,
1049     + .green = NULL,
1050     + .blue = NULL,
1051     + .transp = NULL
1052     + };
1053     +
1054     + red = kmalloc(256 * sizeof(u16) * 3, GFP_KERNEL);
1055     +
1056     + if (!red)
1057     + goto out;
1058     +
1059     + green = red + 256;
1060     + blue = green + 256;
1061     + cmap.red = red;
1062     + cmap.green = green;
1063     + cmap.blue = blue;
1064     +
1065     + for (i = 0; i < cmap.len; i++) {
1066     + red[i] = green[i] = blue[i] = (0xffff * i)/(cmap.len-1);
1067     + }
1068     +
1069     + h = fb_set_cmap(&cmap, info);
1070     + fbcon_decor_fix_pseudo_pal(info, vc_cons[fg_console].d);
1071     + kfree(red);
1072     +
1073     + return h;
1074     +
1075     + } else if (fbcon_decor_active(info, vc_cons[fg_console].d) &&
1076     + info->var.bits_per_pixel == 8 && info->bgdecor.cmap.red != NULL)
1077     + fb_set_cmap(&info->bgdecor.cmap, info);
1078     +
1079     +out: return fb_set_cmap(&palette_cmap, info);
1080     }
1081    
1082     static u16 *fbcon_screen_pos(struct vc_data *vc, int offset)
1083     @@ -2955,7 +3066,14 @@ static void fbcon_modechanged(struct fb_
1084     rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres);
1085     cols /= vc->vc_font.width;
1086     rows /= vc->vc_font.height;
1087     - vc_resize(vc, cols, rows);
1088     +
1089     + if (!fbcon_decor_active_nores(info, vc)) {
1090     + vc_resize(vc, cols, rows);
1091     + } else {
1092     + if (fbcon_decor_call_helper("modechange", vc->vc_num))
1093     + fbcon_decor_disable(vc, 0);
1094     + }
1095     +
1096     updatescrollmode(p, info, vc);
1097     scrollback_max = 0;
1098     scrollback_current = 0;
1099     @@ -3583,6 +3701,7 @@ static void fbcon_exit(void)
1100     }
1101     }
1102    
1103     + fbcon_decor_exit();
1104     fbcon_has_exited = 1;
1105     }
1106    
1107     diff -Naurp linux-2.6.27-orig/drivers/video/console/fbcondecor.c linux-2.6.27/drivers/video/console/fbcondecor.c
1108     --- linux-2.6.27-orig/drivers/video/console/fbcondecor.c 1970-01-01 01:00:00.000000000 +0100
1109     +++ linux-2.6.27/drivers/video/console/fbcondecor.c 2008-10-15 19:58:52.000000000 +0200
1110     @@ -0,0 +1,420 @@
1111     +/*
1112     + * linux/drivers/video/console/fbcondecor.c -- Framebuffer console decorations
1113     + *
1114     + * Copyright (C) 2004 Michal Januszewski <spock@gentoo.org>
1115     + *
1116     + * Code based upon "Bootsplash" (C) 2001-2003
1117     + * Volker Poplawski <volker@poplawski.de>,
1118     + * Stefan Reinauer <stepan@suse.de>,
1119     + * Steffen Winterfeldt <snwint@suse.de>,
1120     + * Michael Schroeder <mls@suse.de>,
1121     + * Ken Wimer <wimer@suse.de>.
1122     + *
1123     + * This file is subject to the terms and conditions of the GNU General Public
1124     + * License. See the file COPYING in the main directory of this archive for
1125     + * more details.
1126     + *
1127     + */
1128     +#include <linux/module.h>
1129     +#include <linux/kernel.h>
1130     +#include <linux/string.h>
1131     +#include <linux/types.h>
1132     +#include <linux/fb.h>
1133     +#include <linux/vt_kern.h>
1134     +#include <linux/vmalloc.h>
1135     +#include <linux/unistd.h>
1136     +#include <linux/syscalls.h>
1137     +#include <linux/init.h>
1138     +#include <linux/proc_fs.h>
1139     +#include <linux/workqueue.h>
1140     +#include <linux/kmod.h>
1141     +#include <linux/miscdevice.h>
1142     +#include <linux/device.h>
1143     +#include <linux/fs.h>
1144     +
1145     +#include <asm/uaccess.h>
1146     +#include <asm/irq.h>
1147     +#include <asm/system.h>
1148     +
1149     +#include "fbcon.h"
1150     +#include "fbcondecor.h"
1151     +
1152     +extern signed char con2fb_map[];
1153     +static int fbcon_decor_enable(struct vc_data *vc);
1154     +char fbcon_decor_path[KMOD_PATH_LEN] = "/sbin/fbcondecor_helper";
1155     +static int initialized = 0;
1156     +
1157     +int fbcon_decor_call_helper(char* cmd, unsigned short vc)
1158     +{
1159     + char *envp[] = {
1160     + "HOME=/",
1161     + "PATH=/sbin:/bin",
1162     + NULL
1163     + };
1164     +
1165     + char tfb[5];
1166     + char tcons[5];
1167     + unsigned char fb = (int) con2fb_map[vc];
1168     +
1169     + char *argv[] = {
1170     + fbcon_decor_path,
1171     + "2",
1172     + cmd,
1173     + tcons,
1174     + tfb,
1175     + vc_cons[vc].d->vc_decor.theme,
1176     + NULL
1177     + };
1178     +
1179     + snprintf(tfb,5,"%d",fb);
1180     + snprintf(tcons,5,"%d",vc);
1181     +
1182     + return call_usermodehelper(fbcon_decor_path, argv, envp, 1);
1183     +}
1184     +
1185     +/* Disables fbcondecor on a virtual console; called with console sem held. */
1186     +int fbcon_decor_disable(struct vc_data *vc, unsigned char redraw)
1187     +{
1188     + struct fb_info* info;
1189     +
1190     + if (!vc->vc_decor.state)
1191     + return -EINVAL;
1192     +
1193     + info = registered_fb[(int) con2fb_map[vc->vc_num]];
1194     +
1195     + if (info == NULL)
1196     + return -EINVAL;
1197     +
1198     + vc->vc_decor.state = 0;
1199     + vc_resize(vc, info->var.xres / vc->vc_font.width,
1200     + info->var.yres / vc->vc_font.height);
1201     +
1202     + if (fg_console == vc->vc_num && redraw) {
1203     + redraw_screen(vc, 0);
1204     + update_region(vc, vc->vc_origin +
1205     + vc->vc_size_row * vc->vc_top,
1206     + vc->vc_size_row * (vc->vc_bottom - vc->vc_top) / 2);
1207     + }
1208     +
1209     + printk(KERN_INFO "fbcondecor: switched decor state to 'off' on console %d\n",
1210     + vc->vc_num);
1211     +
1212     + return 0;
1213     +}
1214     +
1215     +/* Enables fbcondecor on a virtual console; called with console sem held. */
1216     +static int fbcon_decor_enable(struct vc_data *vc)
1217     +{
1218     + struct fb_info* info;
1219     +
1220     + info = registered_fb[(int) con2fb_map[vc->vc_num]];
1221     +
1222     + if (vc->vc_decor.twidth == 0 || vc->vc_decor.theight == 0 ||
1223     + info == NULL || vc->vc_decor.state || (!info->bgdecor.data &&
1224     + vc->vc_num == fg_console))
1225     + return -EINVAL;
1226     +
1227     + vc->vc_decor.state = 1;
1228     + vc_resize(vc, vc->vc_decor.twidth / vc->vc_font.width,
1229     + vc->vc_decor.theight / vc->vc_font.height);
1230     +
1231     + if (fg_console == vc->vc_num) {
1232     + redraw_screen(vc, 0);
1233     + update_region(vc, vc->vc_origin +
1234     + vc->vc_size_row * vc->vc_top,
1235     + vc->vc_size_row * (vc->vc_bottom - vc->vc_top) / 2);
1236     + fbcon_decor_clear_margins(vc, info, 0);
1237     + }
1238     +
1239     + printk(KERN_INFO "fbcondecor: switched decor state to 'on' on console %d\n",
1240     + vc->vc_num);
1241     +
1242     + return 0;
1243     +}
1244     +
1245     +static inline int fbcon_decor_ioctl_dosetstate(struct vc_data *vc, unsigned int __user* state, unsigned char origin)
1246     +{
1247     + int tmp, ret;
1248     +
1249     + if (get_user(tmp, state))
1250     + return -EFAULT;
1251     +
1252     + if (origin == FBCON_DECOR_IO_ORIG_USER)
1253     + acquire_console_sem();
1254     + if (!tmp)
1255     + ret = fbcon_decor_disable(vc, 1);
1256     + else
1257     + ret = fbcon_decor_enable(vc);
1258     + if (origin == FBCON_DECOR_IO_ORIG_USER)
1259     + release_console_sem();
1260     +
1261     + return ret;
1262     +}
1263     +
1264     +static inline int fbcon_decor_ioctl_dogetstate(struct vc_data *vc, unsigned int __user *state)
1265     +{
1266     + return put_user(vc->vc_decor.state, (unsigned int __user*) state);
1267     +}
1268     +
1269     +static int fbcon_decor_ioctl_dosetcfg(struct vc_data *vc, struct vc_decor __user *arg, unsigned char origin)
1270     +{
1271     + struct vc_decor cfg;
1272     + struct fb_info *info;
1273     + int len;
1274     + char *tmp;
1275     +
1276     + info = registered_fb[(int) con2fb_map[vc->vc_num]];
1277     +
1278     + if (copy_from_user(&cfg, arg, sizeof(struct vc_decor)))
1279     + return -EFAULT;
1280     + if (info == NULL || !cfg.twidth || !cfg.theight ||
1281     + cfg.tx + cfg.twidth > info->var.xres ||
1282     + cfg.ty + cfg.theight > info->var.yres)
1283     + return -EINVAL;
1284     +
1285     + len = strlen_user(cfg.theme);
1286     + if (!len || len > FBCON_DECOR_THEME_LEN)
1287     + return -EINVAL;
1288     + tmp = kmalloc(len, GFP_KERNEL);
1289     + if (!tmp)
1290     + return -ENOMEM;
1291     + if (copy_from_user(tmp, (void __user *)cfg.theme, len))
1292     + return -EFAULT;
1293     + cfg.theme = tmp;
1294     + cfg.state = 0;
1295     +
1296     + /* If this ioctl is a response to a request from kernel, the console sem
1297     + * is already held; we also don't need to disable decor because either the
1298     + * new config and background picture will be successfully loaded, and the
1299     + * decor will stay on, or in case of a failure it'll be turned off in fbcon. */
1300     + if (origin == FBCON_DECOR_IO_ORIG_USER) {
1301     + acquire_console_sem();
1302     + if (vc->vc_decor.state)
1303     + fbcon_decor_disable(vc, 1);
1304     + }
1305     +
1306     + if (vc->vc_decor.theme)
1307     + kfree(vc->vc_decor.theme);
1308     +
1309     + vc->vc_decor = cfg;
1310     +
1311     + if (origin == FBCON_DECOR_IO_ORIG_USER)
1312     + release_console_sem();
1313     +
1314     + printk(KERN_INFO "fbcondecor: console %d using theme '%s'\n",
1315     + vc->vc_num, vc->vc_decor.theme);
1316     + return 0;
1317     +}
1318     +
1319     +static int fbcon_decor_ioctl_dogetcfg(struct vc_data *vc, struct vc_decor __user *arg)
1320     +{
1321     + struct vc_decor decor;
1322     + char __user *tmp;
1323     +
1324     + if (get_user(tmp, &arg->theme))
1325     + return -EFAULT;
1326     +
1327     + decor = vc->vc_decor;
1328     + decor.theme = tmp;
1329     +
1330     + if (vc->vc_decor.theme) {
1331     + if (copy_to_user(tmp, vc->vc_decor.theme, strlen(vc->vc_decor.theme) + 1))
1332     + return -EFAULT;
1333     + } else
1334     + if (put_user(0, tmp))
1335     + return -EFAULT;
1336     +
1337     + if (copy_to_user(arg, &decor, sizeof(struct vc_decor)))
1338     + return -EFAULT;
1339     +
1340     + return 0;
1341     +}
1342     +
1343     +static int fbcon_decor_ioctl_dosetpic(struct vc_data *vc, struct fb_image __user *arg, unsigned char origin)
1344     +{
1345     + struct fb_image img;
1346     + struct fb_info *info;
1347     + int len;
1348     + u8 *tmp;
1349     +
1350     + if (vc->vc_num != fg_console)
1351     + return -EINVAL;
1352     +
1353     + info = registered_fb[(int) con2fb_map[vc->vc_num]];
1354     +
1355     + if (info == NULL)
1356     + return -EINVAL;
1357     +
1358     + if (copy_from_user(&img, arg, sizeof(struct fb_image)))
1359     + return -EFAULT;
1360     +
1361     + if (img.width != info->var.xres || img.height != info->var.yres) {
1362     + printk(KERN_ERR "fbcondecor: picture dimensions mismatch\n");
1363     + return -EINVAL;
1364     + }
1365     +
1366     + if (img.depth != info->var.bits_per_pixel) {
1367     + printk(KERN_ERR "fbcondecor: picture depth mismatch\n");
1368     + return -EINVAL;
1369     + }
1370     +
1371     + if (img.depth == 8) {
1372     + if (!img.cmap.len || !img.cmap.red || !img.cmap.green ||
1373     + !img.cmap.blue)
1374     + return -EINVAL;
1375     +
1376     + tmp = vmalloc(img.cmap.len * 3 * 2);
1377     + if (!tmp)
1378     + return -ENOMEM;
1379     +
1380     + if (copy_from_user(tmp, (void __user*)img.cmap.red, img.cmap.len * 2) ||
1381     + copy_from_user(tmp + (img.cmap.len << 1),
1382     + (void __user*)img.cmap.green, (img.cmap.len << 1)) ||
1383     + copy_from_user(tmp + (img.cmap.len << 2),
1384     + (void __user*)img.cmap.blue, (img.cmap.len << 1))) {
1385     + vfree(tmp);
1386     + return -EFAULT;
1387     + }
1388     +
1389     + img.cmap.transp = NULL;
1390     + img.cmap.red = (u16*)tmp;
1391     + img.cmap.green = img.cmap.red + img.cmap.len;
1392     + img.cmap.blue = img.cmap.green + img.cmap.len;
1393     + } else {
1394     + img.cmap.red = NULL;
1395     + }
1396     +
1397     + len = ((img.depth + 7) >> 3) * img.width * img.height;
1398     + tmp = vmalloc(len);
1399     +
1400     + if (!tmp)
1401     + goto out;
1402     +
1403     + if (copy_from_user(tmp, (void __user*)img.data, len))
1404     + goto out;
1405     +
1406     + img.data = tmp;
1407     +
1408     + /* If this ioctl is a response to a request from kernel, the console sem
1409     + * is already held. */
1410     + if (origin == FBCON_DECOR_IO_ORIG_USER)
1411     + acquire_console_sem();
1412     +
1413     + if (info->bgdecor.data)
1414     + vfree((u8*)info->bgdecor.data);
1415     + if (info->bgdecor.cmap.red)
1416     + vfree(info->bgdecor.cmap.red);
1417     +
1418     + info->bgdecor = img;
1419     +
1420     + if (origin == FBCON_DECOR_IO_ORIG_USER)
1421     + release_console_sem();
1422     +
1423     + return 0;
1424     +
1425     +out: if (img.cmap.red)
1426     + vfree(img.cmap.red);
1427     + if (tmp)
1428     + vfree(tmp);
1429     + return -ENOMEM;
1430     +}
1431     +
1432     +static int fbcon_decor_ioctl(struct inode * inode, struct file *filp, u_int cmd,
1433     + u_long arg)
1434     +{
1435     + struct fbcon_decor_iowrapper __user *wrapper = (void __user*) arg;
1436     + struct vc_data *vc = NULL;
1437     + unsigned short vc_num = 0;
1438     + unsigned char origin = 0;
1439     + void __user *data = NULL;
1440     +
1441     + if (!access_ok(VERIFY_READ, wrapper,
1442     + sizeof(struct fbcon_decor_iowrapper)))
1443     + return -EFAULT;
1444     +
1445     + __get_user(vc_num, &wrapper->vc);
1446     + __get_user(origin, &wrapper->origin);
1447     + __get_user(data, &wrapper->data);
1448     +
1449     + if (!vc_cons_allocated(vc_num))
1450     + return -EINVAL;
1451     +
1452     + vc = vc_cons[vc_num].d;
1453     +
1454     + switch (cmd) {
1455     + case FBIOCONDECOR_SETPIC:
1456     + return fbcon_decor_ioctl_dosetpic(vc, (struct fb_image __user*)data, origin);
1457     + case FBIOCONDECOR_SETCFG:
1458     + return fbcon_decor_ioctl_dosetcfg(vc, (struct vc_decor*)data, origin);
1459     + case FBIOCONDECOR_GETCFG:
1460     + return fbcon_decor_ioctl_dogetcfg(vc, (struct vc_decor*)data);
1461     + case FBIOCONDECOR_SETSTATE:
1462     + return fbcon_decor_ioctl_dosetstate(vc, (unsigned int *)data, origin);
1463     + case FBIOCONDECOR_GETSTATE:
1464     + return fbcon_decor_ioctl_dogetstate(vc, (unsigned int *)data);
1465     + default:
1466     + return -ENOIOCTLCMD;
1467     + }
1468     +}
1469     +
1470     +static struct file_operations fbcon_decor_ops = {
1471     + .owner = THIS_MODULE,
1472     + .ioctl = fbcon_decor_ioctl
1473     +};
1474     +
1475     +static struct miscdevice fbcon_decor_dev = {
1476     + .minor = MISC_DYNAMIC_MINOR,
1477     + .name = "fbcondecor",
1478     + .fops = &fbcon_decor_ops
1479     +};
1480     +
1481     +void fbcon_decor_reset(void)
1482     +{
1483     + struct fb_info *info;
1484     + struct vc_data *vc;
1485     + int i;
1486     +
1487     + vc = vc_cons[0].d;
1488     + info = registered_fb[0];
1489     +
1490     + for (i = 0; i < num_registered_fb; i++) {
1491     + registered_fb[i]->bgdecor.data = NULL;
1492     + registered_fb[i]->bgdecor.cmap.red = NULL;
1493     + }
1494     +
1495     + for (i = 0; i < MAX_NR_CONSOLES && vc_cons[i].d; i++) {
1496     + vc_cons[i].d->vc_decor.state = vc_cons[i].d->vc_decor.twidth =
1497     + vc_cons[i].d->vc_decor.theight = 0;
1498     + vc_cons[i].d->vc_decor.theme = NULL;
1499     + }
1500     +
1501     + return;
1502     +}
1503     +
1504     +int fbcon_decor_init(void)
1505     +{
1506     + int i;
1507     +
1508     + fbcon_decor_reset();
1509     +
1510     + if (initialized)
1511     + return 0;
1512     +
1513     + i = misc_register(&fbcon_decor_dev);
1514     + if (i) {
1515     + printk(KERN_ERR "fbcondecor: failed to register device\n");
1516     + return i;
1517     + }
1518     +
1519     + fbcon_decor_call_helper("init", 0);
1520     + initialized = 1;
1521     + return 0;
1522     +}
1523     +
1524     +int fbcon_decor_exit(void)
1525     +{
1526     + fbcon_decor_reset();
1527     + return 0;
1528     +}
1529     +
1530     +EXPORT_SYMBOL(fbcon_decor_path);
1531     diff -Naurp linux-2.6.27-orig/drivers/video/console/fbcondecor.h linux-2.6.27/drivers/video/console/fbcondecor.h
1532     --- linux-2.6.27-orig/drivers/video/console/fbcondecor.h 1970-01-01 01:00:00.000000000 +0100
1533     +++ linux-2.6.27/drivers/video/console/fbcondecor.h 2008-10-15 19:58:52.000000000 +0200
1534     @@ -0,0 +1,78 @@
1535     +/*
1536     + * linux/drivers/video/console/fbcondecor.h -- Framebuffer Console Decoration headers
1537     + *
1538     + * Copyright (C) 2004 Michal Januszewski <spock@gentoo.org>
1539     + *
1540     + */
1541     +
1542     +#ifndef __FBCON_DECOR_H
1543     +#define __FBCON_DECOR_H
1544     +
1545     +#ifndef _LINUX_FB_H
1546     +#include <linux/fb.h>
1547     +#endif
1548     +
1549     +/* This is needed for vc_cons in fbcmap.c */
1550     +#include <linux/vt_kern.h>
1551     +
1552     +struct fb_cursor;
1553     +struct fb_info;
1554     +struct vc_data;
1555     +
1556     +#ifdef CONFIG_FB_CON_DECOR
1557     +/* fbcondecor.c */
1558     +int fbcon_decor_init(void);
1559     +int fbcon_decor_exit(void);
1560     +int fbcon_decor_call_helper(char* cmd, unsigned short cons);
1561     +int fbcon_decor_disable(struct vc_data *vc, unsigned char redraw);
1562     +
1563     +/* cfbcondecor.c */
1564     +void fbcon_decor_putcs(struct vc_data *vc, struct fb_info *info, const unsigned short *s, int count, int yy, int xx);
1565     +void fbcon_decor_cursor(struct fb_info *info, struct fb_cursor *cursor);
1566     +void fbcon_decor_clear(struct vc_data *vc, struct fb_info *info, int sy, int sx, int height, int width);
1567     +void fbcon_decor_clear_margins(struct vc_data *vc, struct fb_info *info, int bottom_only);
1568     +void fbcon_decor_blank(struct vc_data *vc, struct fb_info *info, int blank);
1569     +void fbcon_decor_bmove_redraw(struct vc_data *vc, struct fb_info *info, int y, int sx, int dx, int width);
1570     +void fbcon_decor_copy(u8 *dst, u8 *src, int height, int width, int linebytes, int srclinesbytes, int bpp);
1571     +void fbcon_decor_fix_pseudo_pal(struct fb_info *info, struct vc_data *vc);
1572     +
1573     +/* vt.c */
1574     +void acquire_console_sem(void);
1575     +void release_console_sem(void);
1576     +void do_unblank_screen(int entering_gfx);
1577     +
1578     +/* struct vc_data *y */
1579     +#define fbcon_decor_active_vc(y) (y->vc_decor.state && y->vc_decor.theme)
1580     +
1581     +/* struct fb_info *x, struct vc_data *y */
1582     +#define fbcon_decor_active_nores(x,y) (x->bgdecor.data && fbcon_decor_active_vc(y))
1583     +
1584     +/* struct fb_info *x, struct vc_data *y */
1585     +#define fbcon_decor_active(x,y) (fbcon_decor_active_nores(x,y) && \
1586     + x->bgdecor.width == x->var.xres && \
1587     + x->bgdecor.height == x->var.yres && \
1588     + x->bgdecor.depth == x->var.bits_per_pixel)
1589     +
1590     +
1591     +#else /* CONFIG_FB_CON_DECOR */
1592     +
1593     +static inline void fbcon_decor_putcs(struct vc_data *vc, struct fb_info *info, const unsigned short *s, int count, int yy, int xx) {}
1594     +static inline void fbcon_decor_putc(struct vc_data *vc, struct fb_info *info, int c, int ypos, int xpos) {}
1595     +static inline void fbcon_decor_cursor(struct fb_info *info, struct fb_cursor *cursor) {}
1596     +static inline void fbcon_decor_clear(struct vc_data *vc, struct fb_info *info, int sy, int sx, int height, int width) {}
1597     +static inline void fbcon_decor_clear_margins(struct vc_data *vc, struct fb_info *info, int bottom_only) {}
1598     +static inline void fbcon_decor_blank(struct vc_data *vc, struct fb_info *info, int blank) {}
1599     +static inline void fbcon_decor_bmove_redraw(struct vc_data *vc, struct fb_info *info, int y, int sx, int dx, int width) {}
1600     +static inline void fbcon_decor_fix_pseudo_pal(struct fb_info *info, struct vc_data *vc) {}
1601     +static inline int fbcon_decor_call_helper(char* cmd, unsigned short cons) { return 0; }
1602     +static inline int fbcon_decor_init(void) { return 0; }
1603     +static inline int fbcon_decor_exit(void) { return 0; }
1604     +static inline int fbcon_decor_disable(struct vc_data *vc, unsigned char redraw) { return 0; }
1605     +
1606     +#define fbcon_decor_active_vc(y) (0)
1607     +#define fbcon_decor_active_nores(x,y) (0)
1608     +#define fbcon_decor_active(x,y) (0)
1609     +
1610     +#endif /* CONFIG_FB_CON_DECOR */
1611     +
1612     +#endif /* __FBCON_DECOR_H */
1613     diff -Naurp linux-2.6.27-orig/drivers/video/console/Kconfig linux-2.6.27/drivers/video/console/Kconfig
1614     --- linux-2.6.27-orig/drivers/video/console/Kconfig 2008-10-15 19:57:21.000000000 +0200
1615     +++ linux-2.6.27/drivers/video/console/Kconfig 2008-10-15 19:58:52.000000000 +0200
1616     @@ -144,6 +144,19 @@ config FRAMEBUFFER_CONSOLE_ROTATION
1617     such that other users of the framebuffer will remain normally
1618     oriented.
1619    
1620     +config FB_CON_DECOR
1621     + bool "Support for the Framebuffer Console Decorations"
1622     + depends on FRAMEBUFFER_CONSOLE=y && !FB_TILEBLITTING
1623     + default n
1624     + ---help---
1625     + This option enables support for framebuffer console decorations which
1626     + makes it possible to display images in the background of the system
1627     + consoles. Note that userspace utilities are necessary in order to take
1628     + advantage of these features. Refer to Documentation/fb/fbcondecor.txt
1629     + for more information.
1630     +
1631     + If unsure, say N.
1632     +
1633     config STI_CONSOLE
1634     bool "STI text console"
1635     depends on PARISC
1636     diff -Naurp linux-2.6.27-orig/drivers/video/console/Makefile linux-2.6.27/drivers/video/console/Makefile
1637     --- linux-2.6.27-orig/drivers/video/console/Makefile 2008-10-15 19:57:21.000000000 +0200
1638     +++ linux-2.6.27/drivers/video/console/Makefile 2008-10-15 19:58:52.000000000 +0200
1639     @@ -35,6 +35,7 @@ obj-$(CONFIG_FRAMEBUFFER_CONSOLE) +=
1640     fbcon_ccw.o
1641     endif
1642    
1643     +obj-$(CONFIG_FB_CON_DECOR) += fbcondecor.o cfbcondecor.o
1644     obj-$(CONFIG_FB_STI) += sticore.o font.o
1645    
1646     ifeq ($(CONFIG_USB_SISUSBVGA_CON),y)
1647     diff -Naurp linux-2.6.27-orig/drivers/video/fbcmap.c linux-2.6.27/drivers/video/fbcmap.c
1648     --- linux-2.6.27-orig/drivers/video/fbcmap.c 2008-10-15 19:57:21.000000000 +0200
1649     +++ linux-2.6.27/drivers/video/fbcmap.c 2008-10-15 19:58:52.000000000 +0200
1650     @@ -17,6 +17,8 @@
1651     #include <linux/slab.h>
1652     #include <linux/uaccess.h>
1653    
1654     +#include "console/fbcondecor.h"
1655     +
1656     static u16 red2[] __read_mostly = {
1657     0x0000, 0xaaaa
1658     };
1659     @@ -234,14 +236,17 @@ int fb_set_cmap(struct fb_cmap *cmap, st
1660     if (transp)
1661     htransp = *transp++;
1662     if (info->fbops->fb_setcolreg(start++,
1663     - hred, hgreen, hblue,
1664     + hred, hgreen, hblue,
1665     htransp, info))
1666     break;
1667     }
1668     }
1669     - if (rc == 0)
1670     + if (rc == 0) {
1671     fb_copy_cmap(cmap, &info->cmap);
1672     -
1673     + if (fbcon_decor_active(info, vc_cons[fg_console].d) &&
1674     + info->fix.visual == FB_VISUAL_DIRECTCOLOR)
1675     + fbcon_decor_fix_pseudo_pal(info, vc_cons[fg_console].d);
1676     + }
1677     return rc;
1678     }
1679    
1680     @@ -249,7 +254,7 @@ int fb_set_user_cmap(struct fb_cmap_user
1681     {
1682     int rc, size = cmap->len * sizeof(u16);
1683     struct fb_cmap umap;
1684     -
1685     +
1686     if (cmap->start < 0 || (!info->fbops->fb_setcolreg &&
1687     !info->fbops->fb_setcmap))
1688     return -EINVAL;
1689     diff -Naurp linux-2.6.27-orig/drivers/video/Kconfig linux-2.6.27/drivers/video/Kconfig
1690     --- linux-2.6.27-orig/drivers/video/Kconfig 2008-10-15 19:57:21.000000000 +0200
1691     +++ linux-2.6.27/drivers/video/Kconfig 2008-10-15 19:58:52.000000000 +0200
1692     @@ -1163,7 +1163,6 @@ config FB_MATROX
1693     select FB_CFB_FILLRECT
1694     select FB_CFB_COPYAREA
1695     select FB_CFB_IMAGEBLIT
1696     - select FB_TILEBLITTING
1697     select FB_MACMODES if PPC_PMAC
1698     ---help---
1699     Say Y here if you have a Matrox Millennium, Matrox Millennium II,
1700     diff -Naurp linux-2.6.27-orig/include/linux/console_decor.h linux-2.6.27/include/linux/console_decor.h
1701     --- linux-2.6.27-orig/include/linux/console_decor.h 1970-01-01 01:00:00.000000000 +0100
1702     +++ linux-2.6.27/include/linux/console_decor.h 2008-10-15 19:58:52.000000000 +0200
1703     @@ -0,0 +1,13 @@
1704     +#ifndef _LINUX_CONSOLE_DECOR_H_
1705     +#define _LINUX_CONSOLE_DECOR_H_ 1
1706     +
1707     +/* A structure used by the framebuffer console decorations (drivers/video/console/fbcondecor.c) */
1708     +struct vc_decor {
1709     + __u8 bg_color; /* The color that is to be treated as transparent */
1710     + __u8 state; /* Current decor state: 0 = off, 1 = on */
1711     + __u16 tx, ty; /* Top left corner coordinates of the text field */
1712     + __u16 twidth, theight; /* Width and height of the text field */
1713     + char* theme;
1714     +};
1715     +
1716     +#endif
1717     diff -Naurp linux-2.6.27-orig/include/linux/console_struct.h linux-2.6.27/include/linux/console_struct.h
1718     --- linux-2.6.27-orig/include/linux/console_struct.h 2008-10-15 19:57:36.000000000 +0200
1719     +++ linux-2.6.27/include/linux/console_struct.h 2008-10-15 19:58:52.000000000 +0200
1720     @@ -19,6 +19,7 @@
1721     struct vt_struct;
1722    
1723     #define NPAR 16
1724     +#include <linux/console_decor.h>
1725    
1726     struct vc_data {
1727     unsigned short vc_num; /* Console number */
1728     @@ -107,6 +108,8 @@ struct vc_data {
1729     struct vc_data **vc_display_fg; /* [!] Ptr to var holding fg console for this display */
1730     unsigned long vc_uni_pagedir;
1731     unsigned long *vc_uni_pagedir_loc; /* [!] Location of uni_pagedir variable for this console */
1732     +
1733     + struct vc_decor vc_decor;
1734     /* additional information is in vt_kern.h */
1735     };
1736    
1737     diff -Naurp linux-2.6.27-orig/include/linux/fb.h linux-2.6.27/include/linux/fb.h
1738     --- linux-2.6.27-orig/include/linux/fb.h 2008-10-15 19:57:34.000000000 +0200
1739     +++ linux-2.6.27/include/linux/fb.h 2008-10-15 19:58:52.000000000 +0200
1740     @@ -10,6 +10,13 @@ struct dentry;
1741    
1742     #define FB_MAX 32 /* sufficient for now */
1743    
1744     +struct fbcon_decor_iowrapper
1745     +{
1746     + unsigned short vc; /* Virtual console */
1747     + unsigned char origin; /* Point of origin of the request */
1748     + void *data;
1749     +};
1750     +
1751     /* ioctls
1752     0x46 is 'F' */
1753     #define FBIOGET_VSCREENINFO 0x4600
1754     @@ -37,7 +44,15 @@ struct dentry;
1755     #define FBIOGET_HWCINFO 0x4616
1756     #define FBIOPUT_MODEINFO 0x4617
1757     #define FBIOGET_DISPINFO 0x4618
1758     -
1759     +#define FBIOCONDECOR_SETCFG _IOWR('F', 0x19, struct fbcon_decor_iowrapper)
1760     +#define FBIOCONDECOR_GETCFG _IOR('F', 0x1A, struct fbcon_decor_iowrapper)
1761     +#define FBIOCONDECOR_SETSTATE _IOWR('F', 0x1B, struct fbcon_decor_iowrapper)
1762     +#define FBIOCONDECOR_GETSTATE _IOR('F', 0x1C, struct fbcon_decor_iowrapper)
1763     +#define FBIOCONDECOR_SETPIC _IOWR('F', 0x1D, struct fbcon_decor_iowrapper)
1764     +
1765     +#define FBCON_DECOR_THEME_LEN 128 /* Maximum lenght of a theme name */
1766     +#define FBCON_DECOR_IO_ORIG_KERNEL 0 /* Kernel ioctl origin */
1767     +#define FBCON_DECOR_IO_ORIG_USER 1 /* User ioctl origin */
1768    
1769     #define FB_TYPE_PACKED_PIXELS 0 /* Packed Pixels */
1770     #define FB_TYPE_PLANES 1 /* Non interleaved planes */
1771     @@ -847,6 +862,9 @@ struct fb_info {
1772     #define FBINFO_STATE_SUSPENDED 1
1773     u32 state; /* Hardware state i.e suspend */
1774     void *fbcon_par; /* fbcon use-only private area */
1775     +
1776     + struct fb_image bgdecor;
1777     +
1778     /* From here on everything is device dependent */
1779     void *par;
1780     };
1781     diff -Naurp linux-2.6.27-orig/kernel/sysctl.c linux-2.6.27/kernel/sysctl.c
1782     --- linux-2.6.27-orig/kernel/sysctl.c 2008-10-15 19:57:24.000000000 +0200
1783     +++ linux-2.6.27/kernel/sysctl.c 2008-10-15 19:58:52.000000000 +0200
1784     @@ -114,6 +114,9 @@ static int ngroups_max = NGROUPS_MAX;
1785     #ifdef CONFIG_MODULES
1786     extern char modprobe_path[];
1787     #endif
1788     +#ifdef CONFIG_FB_CON_DECOR
1789     +extern char fbcon_decor_path[];
1790     +#endif
1791     #ifdef CONFIG_CHR_DEV_SG
1792     extern int sg_big_buff;
1793     #endif
1794     @@ -220,6 +223,18 @@ static struct ctl_table root_table[] = {
1795     .mode = 0555,
1796     .child = dev_table,
1797     },
1798     +#ifdef CONFIG_FB_CON_DECOR
1799     + {
1800     + .ctl_name = CTL_UNNUMBERED,
1801     + .procname = "fbcondecor",
1802     + .data = &fbcon_decor_path,
1803     + .maxlen = KMOD_PATH_LEN,
1804     + .mode = 0644,
1805     + .proc_handler = &proc_dostring,
1806     + .strategy = &sysctl_string,
1807     + },
1808     +#endif
1809     +
1810     /*
1811     * NOTE: do not add new entries to this table unless you have read
1812     * Documentation/sysctl/ctl_unnumbered.txt