Magellan Linux

Annotation of /trunk/kernel-alx/patches-3.0-r1/0150-3.0-fbcondecor-0.9.6.patch

Parent Directory Parent Directory | Revision Log Revision Log


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