Magellan Linux

Contents of /trunk/kernel26-magellan/patches-2.6.39-r1/0150-2.6.39-fbcondecor-0.9.6.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1327 - (show annotations) (download)
Fri May 27 12:09:46 2011 UTC (12 years, 11 months ago) by niro
File size: 70586 byte(s)
2.6.39-magellan-r1: using linux-2.6.39, fbcondecor-0.9.6, unionfs-2.5.9.1. dropped reiser4 and tuxonice support
1 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 3f135b6..926b28d 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 @@ -24,11 +28,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 e6a8d8c..53c7970 100644
256 --- a/drivers/video/Kconfig
257 +++ b/drivers/video/Kconfig
258 @@ -1223,7 +1223,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..9ce569d 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 @@ -526,6 +527,9 @@ static int search_for_mapped_con(void)
904 static int fbcon_takeover(int show_logo)
905 {
906 int err, i;
907 +#ifdef CONFIG_FB_CON_DECOR
908 + struct fb_info *info;
909 +#endif
910
911 if (!num_registered_fb)
912 return -ENODEV;
913 @@ -546,6 +550,12 @@ static int fbcon_takeover(int show_logo)
914 info_idx = -1;
915 } else {
916 fbcon_has_console_bind = 1;
917 +#ifdef CONFIG_FB_CON_DECOR
918 + info = registered_fb[info_idx];
919 + unlock_fb_info(info);
920 + fbcon_decor_init();
921 + lock_fb_info(info);
922 +#endif
923 }
924
925 return err;
926 @@ -936,7 +946,7 @@ static const char *fbcon_startup(void)
927 info = registered_fb[info_idx];
928 if (!info)
929 return NULL;
930 -
931 +
932 owner = info->fbops->owner;
933 if (!try_module_get(owner))
934 return NULL;
935 @@ -1000,6 +1010,12 @@ static const char *fbcon_startup(void)
936 rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres);
937 cols /= vc->vc_font.width;
938 rows /= vc->vc_font.height;
939 +
940 + if (fbcon_decor_active(info, vc)) {
941 + cols = vc->vc_decor.twidth / vc->vc_font.width;
942 + rows = vc->vc_decor.theight / vc->vc_font.height;
943 + }
944 +
945 vc_resize(vc, cols, rows);
946
947 DPRINTK("mode: %s\n", info->fix.id);
948 @@ -1029,7 +1045,7 @@ static void fbcon_init(struct vc_data *vc, int init)
949 cap = info->flags;
950
951 if (vc != svc || logo_shown == FBCON_LOGO_DONTSHOW ||
952 - (info->fix.type == FB_TYPE_TEXT))
953 + (info->fix.type == FB_TYPE_TEXT) || fbcon_decor_active(info, vc))
954 logo = 0;
955
956 if (var_to_display(p, &info->var, info))
957 @@ -1239,6 +1255,11 @@ static void fbcon_clear(struct vc_data *vc, int sy, int sx, int height,
958 if (sy < vc->vc_top && vc->vc_top == logo_lines)
959 vc->vc_top = 0;
960
961 + if (fbcon_decor_active(info, vc)) {
962 + fbcon_decor_clear(vc, info, sy, sx, height, width);
963 + return;
964 + }
965 +
966 /* Split blits that cross physical y_wrap boundary */
967
968 y_break = p->vrows - p->yscroll;
969 @@ -1258,10 +1279,15 @@ static void fbcon_putcs(struct vc_data *vc, const unsigned short *s,
970 struct display *p = &fb_display[vc->vc_num];
971 struct fbcon_ops *ops = info->fbcon_par;
972
973 - if (!fbcon_is_inactive(vc, info))
974 - ops->putcs(vc, info, s, count, real_y(p, ypos), xpos,
975 - get_color(vc, info, scr_readw(s), 1),
976 - get_color(vc, info, scr_readw(s), 0));
977 + if (!fbcon_is_inactive(vc, info)) {
978 +
979 + if (fbcon_decor_active(info, vc))
980 + fbcon_decor_putcs(vc, info, s, count, ypos, xpos);
981 + else
982 + ops->putcs(vc, info, s, count, real_y(p, ypos), xpos,
983 + get_color(vc, info, scr_readw(s), 1),
984 + get_color(vc, info, scr_readw(s), 0));
985 + }
986 }
987
988 static void fbcon_putc(struct vc_data *vc, int c, int ypos, int xpos)
989 @@ -1277,8 +1303,13 @@ static void fbcon_clear_margins(struct vc_data *vc, int bottom_only)
990 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
991 struct fbcon_ops *ops = info->fbcon_par;
992
993 - if (!fbcon_is_inactive(vc, info))
994 - ops->clear_margins(vc, info, bottom_only);
995 + if (!fbcon_is_inactive(vc, info)) {
996 + if (fbcon_decor_active(info, vc)) {
997 + fbcon_decor_clear_margins(vc, info, bottom_only);
998 + } else {
999 + ops->clear_margins(vc, info, bottom_only);
1000 + }
1001 + }
1002 }
1003
1004 static void fbcon_cursor(struct vc_data *vc, int mode)
1005 @@ -1388,7 +1419,7 @@ static __inline__ void ywrap_up(struct vc_data *vc, int count)
1006 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
1007 struct fbcon_ops *ops = info->fbcon_par;
1008 struct display *p = &fb_display[vc->vc_num];
1009 -
1010 +
1011 p->yscroll += count;
1012 if (p->yscroll >= p->vrows) /* Deal with wrap */
1013 p->yscroll -= p->vrows;
1014 @@ -1407,7 +1438,7 @@ static __inline__ void ywrap_down(struct vc_data *vc, int count)
1015 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
1016 struct fbcon_ops *ops = info->fbcon_par;
1017 struct display *p = &fb_display[vc->vc_num];
1018 -
1019 +
1020 p->yscroll -= count;
1021 if (p->yscroll < 0) /* Deal with wrap */
1022 p->yscroll += p->vrows;
1023 @@ -1474,7 +1505,7 @@ static __inline__ void ypan_down(struct vc_data *vc, int count)
1024 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
1025 struct display *p = &fb_display[vc->vc_num];
1026 struct fbcon_ops *ops = info->fbcon_par;
1027 -
1028 +
1029 p->yscroll -= count;
1030 if (p->yscroll < 0) {
1031 ops->bmove(vc, info, 0, 0, p->vrows - vc->vc_rows,
1032 @@ -1798,7 +1829,7 @@ static int fbcon_scroll(struct vc_data *vc, int t, int b, int dir,
1033 count = vc->vc_rows;
1034 if (softback_top)
1035 fbcon_softback_note(vc, t, count);
1036 - if (logo_shown >= 0)
1037 + if (logo_shown >= 0 || fbcon_decor_active(info, vc))
1038 goto redraw_up;
1039 switch (p->scrollmode) {
1040 case SCROLL_MOVE:
1041 @@ -1891,6 +1922,8 @@ static int fbcon_scroll(struct vc_data *vc, int t, int b, int dir,
1042 count = vc->vc_rows;
1043 if (logo_shown >= 0)
1044 goto redraw_down;
1045 + if (fbcon_decor_active(info, vc))
1046 + goto redraw_down;
1047 switch (p->scrollmode) {
1048 case SCROLL_MOVE:
1049 fbcon_redraw_blit(vc, info, p, b - 1, b - t - count,
1050 @@ -1983,7 +2016,7 @@ static void fbcon_bmove(struct vc_data *vc, int sy, int sx, int dy, int dx,
1051 {
1052 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
1053 struct display *p = &fb_display[vc->vc_num];
1054 -
1055 +
1056 if (fbcon_is_inactive(vc, info))
1057 return;
1058
1059 @@ -2001,7 +2034,7 @@ static void fbcon_bmove(struct vc_data *vc, int sy, int sx, int dy, int dx,
1060 p->vrows - p->yscroll);
1061 }
1062
1063 -static void fbcon_bmove_rec(struct vc_data *vc, struct display *p, int sy, int sx,
1064 +static void fbcon_bmove_rec(struct vc_data *vc, struct display *p, int sy, int sx,
1065 int dy, int dx, int height, int width, u_int y_break)
1066 {
1067 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
1068 @@ -2039,6 +2072,13 @@ static void fbcon_bmove_rec(struct vc_data *vc, struct display *p, int sy, int s
1069 }
1070 return;
1071 }
1072 +
1073 + if (fbcon_decor_active(info, vc) && sy == dy && height == 1) {
1074 + /* must use slower redraw bmove to keep background pic intact */
1075 + fbcon_decor_bmove_redraw(vc, info, sy, sx, dx, width);
1076 + return;
1077 + }
1078 +
1079 ops->bmove(vc, info, real_y(p, sy), sx, real_y(p, dy), dx,
1080 height, width);
1081 }
1082 @@ -2090,7 +2130,7 @@ static void updatescrollmode(struct display *p,
1083 }
1084 }
1085
1086 -static int fbcon_resize(struct vc_data *vc, unsigned int width,
1087 +static int fbcon_resize(struct vc_data *vc, unsigned int width,
1088 unsigned int height, unsigned int user)
1089 {
1090 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
1091 @@ -2109,8 +2149,8 @@ static int fbcon_resize(struct vc_data *vc, unsigned int width,
1092 var.yres = virt_h * virt_fh;
1093 x_diff = info->var.xres - var.xres;
1094 y_diff = info->var.yres - var.yres;
1095 - if (x_diff < 0 || x_diff > virt_fw ||
1096 - y_diff < 0 || y_diff > virt_fh) {
1097 + if ((x_diff < 0 || x_diff > virt_fw ||
1098 + y_diff < 0 || y_diff > virt_fh) && !vc->vc_decor.state) {
1099 const struct fb_videomode *mode;
1100
1101 DPRINTK("attempting resize %ix%i\n", var.xres, var.yres);
1102 @@ -2146,6 +2186,21 @@ static int fbcon_switch(struct vc_data *vc)
1103
1104 info = registered_fb[con2fb_map[vc->vc_num]];
1105 ops = info->fbcon_par;
1106 + prev_console = ops->currcon;
1107 + if (prev_console != -1)
1108 + old_info = registered_fb[con2fb_map[prev_console]];
1109 +
1110 +#ifdef CONFIG_FB_CON_DECOR
1111 + if (!fbcon_decor_active_vc(vc) && info->fix.visual == FB_VISUAL_DIRECTCOLOR) {
1112 + struct vc_data *vc_curr = vc_cons[prev_console].d;
1113 + if (vc_curr && fbcon_decor_active_vc(vc_curr)) {
1114 + /* Clear the screen to avoid displaying funky colors during
1115 + * palette updates. */
1116 + memset((u8*)info->screen_base + info->fix.line_length * info->var.yoffset,
1117 + 0, info->var.yres * info->fix.line_length);
1118 + }
1119 + }
1120 +#endif
1121
1122 if (softback_top) {
1123 if (softback_lines)
1124 @@ -2164,9 +2219,6 @@ static int fbcon_switch(struct vc_data *vc)
1125 logo_shown = FBCON_LOGO_CANSHOW;
1126 }
1127
1128 - prev_console = ops->currcon;
1129 - if (prev_console != -1)
1130 - old_info = registered_fb[con2fb_map[prev_console]];
1131 /*
1132 * FIXME: If we have multiple fbdev's loaded, we need to
1133 * update all info->currcon. Perhaps, we can place this
1134 @@ -2210,6 +2262,18 @@ static int fbcon_switch(struct vc_data *vc)
1135 fbcon_del_cursor_timer(old_info);
1136 }
1137
1138 + if (fbcon_decor_active_vc(vc)) {
1139 + struct vc_data *vc_curr = vc_cons[prev_console].d;
1140 +
1141 + if (!vc_curr->vc_decor.theme ||
1142 + strcmp(vc->vc_decor.theme, vc_curr->vc_decor.theme) ||
1143 + (fbcon_decor_active_nores(info, vc_curr) &&
1144 + !fbcon_decor_active(info, vc_curr))) {
1145 + if (fbcon_decor_call_helper("modechange", vc->vc_num))
1146 + fbcon_decor_disable(vc, 0);
1147 + }
1148 + }
1149 +
1150 if (fbcon_is_inactive(vc, info) ||
1151 ops->blank_state != FB_BLANK_UNBLANK)
1152 fbcon_del_cursor_timer(info);
1153 @@ -2258,7 +2322,7 @@ static int fbcon_switch(struct vc_data *vc)
1154 ops->update_start(info);
1155 }
1156
1157 - fbcon_set_palette(vc, color_table);
1158 + fbcon_set_palette(vc, color_table);
1159 fbcon_clear_margins(vc, 0);
1160
1161 if (logo_shown == FBCON_LOGO_DRAW) {
1162 @@ -2318,15 +2382,20 @@ static int fbcon_blank(struct vc_data *vc, int blank, int mode_switch)
1163 }
1164 }
1165
1166 - if (!fbcon_is_inactive(vc, info)) {
1167 + if (!fbcon_is_inactive(vc, info)) {
1168 if (ops->blank_state != blank) {
1169 ops->blank_state = blank;
1170 fbcon_cursor(vc, blank ? CM_ERASE : CM_DRAW);
1171 ops->cursor_flash = (!blank);
1172
1173 - if (!(info->flags & FBINFO_MISC_USEREVENT))
1174 - if (fb_blank(info, blank))
1175 - fbcon_generic_blank(vc, info, blank);
1176 + if (!(info->flags & FBINFO_MISC_USEREVENT)) {
1177 + if (fb_blank(info, blank)) {
1178 + if (fbcon_decor_active(info, vc))
1179 + fbcon_decor_blank(vc, info, blank);
1180 + else
1181 + fbcon_generic_blank(vc, info, blank);
1182 + }
1183 + }
1184 }
1185
1186 if (!blank)
1187 @@ -2448,7 +2517,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 if (vc->vc_can_do_color) {
1195 unsigned short *cp =
1196 @@ -2471,7 +2540,7 @@ static int fbcon_do_set_font(struct vc_data *vc, int w, int h,
1197 vc->vc_complement_mask <<= 1;
1198 vc->vc_s_complement_mask <<= 1;
1199 }
1200 -
1201 +
1202 /* ++Edmund: reorder the attribute bits */
1203 {
1204 unsigned short *cp =
1205 @@ -2501,13 +2570,22 @@ static int fbcon_do_set_font(struct vc_data *vc, int w, int h,
1206 }
1207
1208 if (resize) {
1209 + /* reset wrap/pan */
1210 int cols, rows;
1211
1212 cols = FBCON_SWAP(ops->rotate, info->var.xres, info->var.yres);
1213 rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres);
1214 +
1215 + if (fbcon_decor_active(info, vc)) {
1216 + info->var.xoffset = info->var.yoffset = p->yscroll = 0;
1217 + cols = vc->vc_decor.twidth;
1218 + rows = vc->vc_decor.theight;
1219 + }
1220 cols /= w;
1221 rows /= h;
1222 +
1223 vc_resize(vc, cols, rows);
1224 +
1225 if (CON_IS_VISIBLE(vc) && softback_buf)
1226 fbcon_update_softback(vc);
1227 } else if (CON_IS_VISIBLE(vc)
1228 @@ -2591,7 +2669,7 @@ static int fbcon_set_font(struct vc_data *vc, struct console_font *font, unsigne
1229 /* Check if the same font is on some other console already */
1230 for (i = first_fb_vc; i <= last_fb_vc; i++) {
1231 struct vc_data *tmp = vc_cons[i].d;
1232 -
1233 +
1234 if (fb_display[i].userfont &&
1235 fb_display[i].fontdata &&
1236 FNTSUM(fb_display[i].fontdata) == csum &&
1237 @@ -2636,7 +2714,11 @@ static int fbcon_set_palette(struct vc_data *vc, unsigned char *table)
1238 int i, j, k, depth;
1239 u8 val;
1240
1241 - if (fbcon_is_inactive(vc, info))
1242 + if (fbcon_is_inactive(vc, info)
1243 +#ifdef CONFIG_FB_CON_DECOR
1244 + || vc->vc_num != fg_console
1245 +#endif
1246 + )
1247 return -EINVAL;
1248
1249 if (!CON_IS_VISIBLE(vc))
1250 @@ -2662,14 +2744,56 @@ static int fbcon_set_palette(struct vc_data *vc, unsigned char *table)
1251 } else
1252 fb_copy_cmap(fb_default_cmap(1 << depth), &palette_cmap);
1253
1254 - return fb_set_cmap(&palette_cmap, info);
1255 + if (fbcon_decor_active(info, vc_cons[fg_console].d) &&
1256 + info->fix.visual == FB_VISUAL_DIRECTCOLOR) {
1257 +
1258 + u16 *red, *green, *blue;
1259 + int minlen = min(min(info->var.red.length, info->var.green.length),
1260 + info->var.blue.length);
1261 + int h;
1262 +
1263 + struct fb_cmap cmap = {
1264 + .start = 0,
1265 + .len = (1 << minlen),
1266 + .red = NULL,
1267 + .green = NULL,
1268 + .blue = NULL,
1269 + .transp = NULL
1270 + };
1271 +
1272 + red = kmalloc(256 * sizeof(u16) * 3, GFP_KERNEL);
1273 +
1274 + if (!red)
1275 + goto out;
1276 +
1277 + green = red + 256;
1278 + blue = green + 256;
1279 + cmap.red = red;
1280 + cmap.green = green;
1281 + cmap.blue = blue;
1282 +
1283 + for (i = 0; i < cmap.len; i++) {
1284 + red[i] = green[i] = blue[i] = (0xffff * i)/(cmap.len-1);
1285 + }
1286 +
1287 + h = fb_set_cmap(&cmap, info);
1288 + fbcon_decor_fix_pseudo_pal(info, vc_cons[fg_console].d);
1289 + kfree(red);
1290 +
1291 + return h;
1292 +
1293 + } else if (fbcon_decor_active(info, vc_cons[fg_console].d) &&
1294 + info->var.bits_per_pixel == 8 && info->bgdecor.cmap.red != NULL)
1295 + fb_set_cmap(&info->bgdecor.cmap, info);
1296 +
1297 +out: return fb_set_cmap(&palette_cmap, info);
1298 }
1299
1300 static u16 *fbcon_screen_pos(struct vc_data *vc, int offset)
1301 {
1302 unsigned long p;
1303 int line;
1304 -
1305 +
1306 if (vc->vc_num != fg_console || !softback_lines)
1307 return (u16 *) (vc->vc_origin + offset);
1308 line = offset / vc->vc_size_row;
1309 @@ -2870,7 +2994,7 @@ static void fbcon_modechanged(struct fb_info *info)
1310 struct fbcon_ops *ops = info->fbcon_par;
1311 struct vc_data *vc;
1312 struct display *p;
1313 - int rows, cols;
1314 + int rows, cols, res;
1315
1316 if (!ops || ops->currcon < 0)
1317 return;
1318 @@ -2888,7 +3012,18 @@ static void fbcon_modechanged(struct fb_info *info)
1319 rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres);
1320 cols /= vc->vc_font.width;
1321 rows /= vc->vc_font.height;
1322 - vc_resize(vc, cols, rows);
1323 +
1324 + if (!fbcon_decor_active_nores(info, vc)) {
1325 + vc_resize(vc, cols, rows);
1326 + } else {
1327 + /* HACK: Do this properly at some point.. */
1328 + unlock_fb_info(info);
1329 + res = fbcon_decor_call_helper("modechange", vc->vc_num);
1330 + lock_fb_info(info);
1331 + if (res)
1332 + fbcon_decor_disable(vc, 0);
1333 + }
1334 +
1335 updatescrollmode(p, info, vc);
1336 scrollback_max = 0;
1337 scrollback_current = 0;
1338 @@ -3543,6 +3678,7 @@ static void fbcon_exit(void)
1339 }
1340 }
1341
1342 + fbcon_decor_exit();
1343 fbcon_has_exited = 1;
1344 }
1345
1346 @@ -3596,7 +3732,7 @@ static void __exit fb_console_exit(void)
1347 fbcon_exit();
1348 console_unlock();
1349 unregister_con_driver(&fb_con);
1350 -}
1351 +}
1352
1353 module_exit(fb_console_exit);
1354
1355 diff --git a/drivers/video/console/fbcondecor.c b/drivers/video/console/fbcondecor.c
1356 new file mode 100644
1357 index 0000000..be42784
1358 --- /dev/null
1359 +++ b/drivers/video/console/fbcondecor.c
1360 @@ -0,0 +1,561 @@
1361 +/*
1362 + * linux/drivers/video/console/fbcondecor.c -- Framebuffer console decorations
1363 + *
1364 + * Copyright (C) 2004-2009 Michal Januszewski <spock@gentoo.org>
1365 + *
1366 + * Code based upon "Bootsplash" (C) 2001-2003
1367 + * Volker Poplawski <volker@poplawski.de>,
1368 + * Stefan Reinauer <stepan@suse.de>,
1369 + * Steffen Winterfeldt <snwint@suse.de>,
1370 + * Michael Schroeder <mls@suse.de>,
1371 + * Ken Wimer <wimer@suse.de>.
1372 + *
1373 + * Compat ioctl support by Thorsten Klein <TK@Thorsten-Klein.de>.
1374 + *
1375 + * This file is subject to the terms and conditions of the GNU General Public
1376 + * License. See the file COPYING in the main directory of this archive for
1377 + * more details.
1378 + *
1379 + */
1380 +#include <linux/module.h>
1381 +#include <linux/kernel.h>
1382 +#include <linux/string.h>
1383 +#include <linux/types.h>
1384 +#include <linux/fb.h>
1385 +#include <linux/vt_kern.h>
1386 +#include <linux/vmalloc.h>
1387 +#include <linux/unistd.h>
1388 +#include <linux/syscalls.h>
1389 +#include <linux/init.h>
1390 +#include <linux/proc_fs.h>
1391 +#include <linux/workqueue.h>
1392 +#include <linux/kmod.h>
1393 +#include <linux/miscdevice.h>
1394 +#include <linux/device.h>
1395 +#include <linux/fs.h>
1396 +#include <linux/compat.h>
1397 +#include <linux/console.h>
1398 +
1399 +#include <asm/uaccess.h>
1400 +#include <asm/irq.h>
1401 +#include <asm/system.h>
1402 +
1403 +#include "fbcon.h"
1404 +#include "fbcondecor.h"
1405 +
1406 +extern signed char con2fb_map[];
1407 +static int fbcon_decor_enable(struct vc_data *vc);
1408 +char fbcon_decor_path[KMOD_PATH_LEN] = "/sbin/fbcondecor_helper";
1409 +static int initialized = 0;
1410 +
1411 +int fbcon_decor_call_helper(char* cmd, unsigned short vc)
1412 +{
1413 + char *envp[] = {
1414 + "HOME=/",
1415 + "PATH=/sbin:/bin",
1416 + NULL
1417 + };
1418 +
1419 + char tfb[5];
1420 + char tcons[5];
1421 + unsigned char fb = (int) con2fb_map[vc];
1422 +
1423 + char *argv[] = {
1424 + fbcon_decor_path,
1425 + "2",
1426 + cmd,
1427 + tcons,
1428 + tfb,
1429 + vc_cons[vc].d->vc_decor.theme,
1430 + NULL
1431 + };
1432 +
1433 + snprintf(tfb,5,"%d",fb);
1434 + snprintf(tcons,5,"%d",vc);
1435 +
1436 + return call_usermodehelper(fbcon_decor_path, argv, envp, 1);
1437 +}
1438 +
1439 +/* Disables fbcondecor on a virtual console; called with console sem held. */
1440 +int fbcon_decor_disable(struct vc_data *vc, unsigned char redraw)
1441 +{
1442 + struct fb_info* info;
1443 +
1444 + if (!vc->vc_decor.state)
1445 + return -EINVAL;
1446 +
1447 + info = registered_fb[(int) con2fb_map[vc->vc_num]];
1448 +
1449 + if (info == NULL)
1450 + return -EINVAL;
1451 +
1452 + vc->vc_decor.state = 0;
1453 + vc_resize(vc, info->var.xres / vc->vc_font.width,
1454 + info->var.yres / vc->vc_font.height);
1455 +
1456 + if (fg_console == vc->vc_num && redraw) {
1457 + redraw_screen(vc, 0);
1458 + update_region(vc, vc->vc_origin +
1459 + vc->vc_size_row * vc->vc_top,
1460 + vc->vc_size_row * (vc->vc_bottom - vc->vc_top) / 2);
1461 + }
1462 +
1463 + printk(KERN_INFO "fbcondecor: switched decor state to 'off' on console %d\n",
1464 + vc->vc_num);
1465 +
1466 + return 0;
1467 +}
1468 +
1469 +/* Enables fbcondecor on a virtual console; called with console sem held. */
1470 +static int fbcon_decor_enable(struct vc_data *vc)
1471 +{
1472 + struct fb_info* info;
1473 +
1474 + info = registered_fb[(int) con2fb_map[vc->vc_num]];
1475 +
1476 + if (vc->vc_decor.twidth == 0 || vc->vc_decor.theight == 0 ||
1477 + info == NULL || vc->vc_decor.state || (!info->bgdecor.data &&
1478 + vc->vc_num == fg_console))
1479 + return -EINVAL;
1480 +
1481 + vc->vc_decor.state = 1;
1482 + vc_resize(vc, vc->vc_decor.twidth / vc->vc_font.width,
1483 + vc->vc_decor.theight / vc->vc_font.height);
1484 +
1485 + if (fg_console == vc->vc_num) {
1486 + redraw_screen(vc, 0);
1487 + update_region(vc, vc->vc_origin +
1488 + vc->vc_size_row * vc->vc_top,
1489 + vc->vc_size_row * (vc->vc_bottom - vc->vc_top) / 2);
1490 + fbcon_decor_clear_margins(vc, info, 0);
1491 + }
1492 +
1493 + printk(KERN_INFO "fbcondecor: switched decor state to 'on' on console %d\n",
1494 + vc->vc_num);
1495 +
1496 + return 0;
1497 +}
1498 +
1499 +static inline int fbcon_decor_ioctl_dosetstate(struct vc_data *vc, unsigned int state, unsigned char origin)
1500 +{
1501 + int ret;
1502 +
1503 + if (origin == FBCON_DECOR_IO_ORIG_USER)
1504 + console_lock();
1505 + if (!state)
1506 + ret = fbcon_decor_disable(vc, 1);
1507 + else
1508 + ret = fbcon_decor_enable(vc);
1509 + if (origin == FBCON_DECOR_IO_ORIG_USER)
1510 + console_unlock();
1511 +
1512 + return ret;
1513 +}
1514 +
1515 +static inline void fbcon_decor_ioctl_dogetstate(struct vc_data *vc, unsigned int *state)
1516 +{
1517 + *state = vc->vc_decor.state;
1518 +}
1519 +
1520 +static int fbcon_decor_ioctl_dosetcfg(struct vc_data *vc, struct vc_decor *cfg, unsigned char origin)
1521 +{
1522 + struct fb_info *info;
1523 + int len;
1524 + char *tmp;
1525 +
1526 + info = registered_fb[(int) con2fb_map[vc->vc_num]];
1527 +
1528 + if (info == NULL || !cfg->twidth || !cfg->theight ||
1529 + cfg->tx + cfg->twidth > info->var.xres ||
1530 + cfg->ty + cfg->theight > info->var.yres)
1531 + return -EINVAL;
1532 +
1533 + len = strlen_user(cfg->theme);
1534 + if (!len || len > FBCON_DECOR_THEME_LEN)
1535 + return -EINVAL;
1536 + tmp = kmalloc(len, GFP_KERNEL);
1537 + if (!tmp)
1538 + return -ENOMEM;
1539 + if (copy_from_user(tmp, (void __user *)cfg->theme, len))
1540 + return -EFAULT;
1541 + cfg->theme = tmp;
1542 + cfg->state = 0;
1543 +
1544 + /* If this ioctl is a response to a request from kernel, the console sem
1545 + * is already held; we also don't need to disable decor because either the
1546 + * new config and background picture will be successfully loaded, and the
1547 + * decor will stay on, or in case of a failure it'll be turned off in fbcon. */
1548 + if (origin == FBCON_DECOR_IO_ORIG_USER) {
1549 + console_lock();
1550 + if (vc->vc_decor.state)
1551 + fbcon_decor_disable(vc, 1);
1552 + }
1553 +
1554 + if (vc->vc_decor.theme)
1555 + kfree(vc->vc_decor.theme);
1556 +
1557 + vc->vc_decor = *cfg;
1558 +
1559 + if (origin == FBCON_DECOR_IO_ORIG_USER)
1560 + console_unlock();
1561 +
1562 + printk(KERN_INFO "fbcondecor: console %d using theme '%s'\n",
1563 + vc->vc_num, vc->vc_decor.theme);
1564 + return 0;
1565 +}
1566 +
1567 +static int fbcon_decor_ioctl_dogetcfg(struct vc_data *vc, struct vc_decor *decor)
1568 +{
1569 + char __user *tmp;
1570 +
1571 + tmp = decor->theme;
1572 + *decor = vc->vc_decor;
1573 + decor->theme = tmp;
1574 +
1575 + if (vc->vc_decor.theme) {
1576 + if (copy_to_user(tmp, vc->vc_decor.theme, strlen(vc->vc_decor.theme) + 1))
1577 + return -EFAULT;
1578 + } else
1579 + if (put_user(0, tmp))
1580 + return -EFAULT;
1581 +
1582 + return 0;
1583 +}
1584 +
1585 +static int fbcon_decor_ioctl_dosetpic(struct vc_data *vc, struct fb_image *img, unsigned char origin)
1586 +{
1587 + struct fb_info *info;
1588 + int len;
1589 + u8 *tmp;
1590 +
1591 + if (vc->vc_num != fg_console)
1592 + return -EINVAL;
1593 +
1594 + info = registered_fb[(int) con2fb_map[vc->vc_num]];
1595 +
1596 + if (info == NULL)
1597 + return -EINVAL;
1598 +
1599 + if (img->width != info->var.xres || img->height != info->var.yres) {
1600 + printk(KERN_ERR "fbcondecor: picture dimensions mismatch\n");
1601 + printk(KERN_ERR "%dx%d vs %dx%d\n", img->width, img->height, info->var.xres, info->var.yres);
1602 + return -EINVAL;
1603 + }
1604 +
1605 + if (img->depth != info->var.bits_per_pixel) {
1606 + printk(KERN_ERR "fbcondecor: picture depth mismatch\n");
1607 + return -EINVAL;
1608 + }
1609 +
1610 + if (img->depth == 8) {
1611 + if (!img->cmap.len || !img->cmap.red || !img->cmap.green ||
1612 + !img->cmap.blue)
1613 + return -EINVAL;
1614 +
1615 + tmp = vmalloc(img->cmap.len * 3 * 2);
1616 + if (!tmp)
1617 + return -ENOMEM;
1618 +
1619 + if (copy_from_user(tmp,
1620 + (void __user*)img->cmap.red, (img->cmap.len << 1)) ||
1621 + copy_from_user(tmp + (img->cmap.len << 1),
1622 + (void __user*)img->cmap.green, (img->cmap.len << 1)) ||
1623 + copy_from_user(tmp + (img->cmap.len << 2),
1624 + (void __user*)img->cmap.blue, (img->cmap.len << 1))) {
1625 + vfree(tmp);
1626 + return -EFAULT;
1627 + }
1628 +
1629 + img->cmap.transp = NULL;
1630 + img->cmap.red = (u16*)tmp;
1631 + img->cmap.green = img->cmap.red + img->cmap.len;
1632 + img->cmap.blue = img->cmap.green + img->cmap.len;
1633 + } else {
1634 + img->cmap.red = NULL;
1635 + }
1636 +
1637 + len = ((img->depth + 7) >> 3) * img->width * img->height;
1638 +
1639 + /*
1640 + * Allocate an additional byte so that we never go outside of the
1641 + * buffer boundaries in the rendering functions in a 24 bpp mode.
1642 + */
1643 + tmp = vmalloc(len + 1);
1644 +
1645 + if (!tmp)
1646 + goto out;
1647 +
1648 + if (copy_from_user(tmp, (void __user*)img->data, len))
1649 + goto out;
1650 +
1651 + img->data = tmp;
1652 +
1653 + /* If this ioctl is a response to a request from kernel, the console sem
1654 + * is already held. */
1655 + if (origin == FBCON_DECOR_IO_ORIG_USER)
1656 + console_lock();
1657 +
1658 + if (info->bgdecor.data)
1659 + vfree((u8*)info->bgdecor.data);
1660 + if (info->bgdecor.cmap.red)
1661 + vfree(info->bgdecor.cmap.red);
1662 +
1663 + info->bgdecor = *img;
1664 +
1665 + if (fbcon_decor_active_vc(vc) && fg_console == vc->vc_num) {
1666 + redraw_screen(vc, 0);
1667 + update_region(vc, vc->vc_origin +
1668 + vc->vc_size_row * vc->vc_top,
1669 + vc->vc_size_row * (vc->vc_bottom - vc->vc_top) / 2);
1670 + fbcon_decor_clear_margins(vc, info, 0);
1671 + }
1672 +
1673 + if (origin == FBCON_DECOR_IO_ORIG_USER)
1674 + console_unlock();
1675 +
1676 + return 0;
1677 +
1678 +out: if (img->cmap.red)
1679 + vfree(img->cmap.red);
1680 +
1681 + if (tmp)
1682 + vfree(tmp);
1683 + return -ENOMEM;
1684 +}
1685 +
1686 +static long fbcon_decor_ioctl(struct file *filp, u_int cmd, u_long arg)
1687 +{
1688 + struct fbcon_decor_iowrapper __user *wrapper = (void __user*) arg;
1689 + struct vc_data *vc = NULL;
1690 + unsigned short vc_num = 0;
1691 + unsigned char origin = 0;
1692 + void __user *data = NULL;
1693 +
1694 + if (!access_ok(VERIFY_READ, wrapper,
1695 + sizeof(struct fbcon_decor_iowrapper)))
1696 + return -EFAULT;
1697 +
1698 + __get_user(vc_num, &wrapper->vc);
1699 + __get_user(origin, &wrapper->origin);
1700 + __get_user(data, &wrapper->data);
1701 +
1702 + if (!vc_cons_allocated(vc_num))
1703 + return -EINVAL;
1704 +
1705 + vc = vc_cons[vc_num].d;
1706 +
1707 + switch (cmd) {
1708 + case FBIOCONDECOR_SETPIC:
1709 + {
1710 + struct fb_image img;
1711 + if (copy_from_user(&img, (struct fb_image __user *)data, sizeof(struct fb_image)))
1712 + return -EFAULT;
1713 +
1714 + return fbcon_decor_ioctl_dosetpic(vc, &img, origin);
1715 + }
1716 + case FBIOCONDECOR_SETCFG:
1717 + {
1718 + struct vc_decor cfg;
1719 + if (copy_from_user(&cfg, (struct vc_decor __user *)data, sizeof(struct vc_decor)))
1720 + return -EFAULT;
1721 +
1722 + return fbcon_decor_ioctl_dosetcfg(vc, &cfg, origin);
1723 + }
1724 + case FBIOCONDECOR_GETCFG:
1725 + {
1726 + int rval;
1727 + struct vc_decor cfg;
1728 +
1729 + if (copy_from_user(&cfg, (struct vc_decor __user *)data, sizeof(struct vc_decor)))
1730 + return -EFAULT;
1731 +
1732 + rval = fbcon_decor_ioctl_dogetcfg(vc, &cfg);
1733 +
1734 + if (copy_to_user(data, &cfg, sizeof(struct vc_decor)))
1735 + return -EFAULT;
1736 + return rval;
1737 + }
1738 + case FBIOCONDECOR_SETSTATE:
1739 + {
1740 + unsigned int state = 0;
1741 + if (get_user(state, (unsigned int __user *)data))
1742 + return -EFAULT;
1743 + return fbcon_decor_ioctl_dosetstate(vc, state, origin);
1744 + }
1745 + case FBIOCONDECOR_GETSTATE:
1746 + {
1747 + unsigned int state = 0;
1748 + fbcon_decor_ioctl_dogetstate(vc, &state);
1749 + return put_user(state, (unsigned int __user *)data);
1750 + }
1751 +
1752 + default:
1753 + return -ENOIOCTLCMD;
1754 + }
1755 +}
1756 +
1757 +#ifdef CONFIG_COMPAT
1758 +
1759 +static long fbcon_decor_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) {
1760 +
1761 + struct fbcon_decor_iowrapper32 __user *wrapper = (void __user *)arg;
1762 + struct vc_data *vc = NULL;
1763 + unsigned short vc_num = 0;
1764 + unsigned char origin = 0;
1765 + compat_uptr_t data_compat = 0;
1766 + void __user *data = NULL;
1767 +
1768 + if (!access_ok(VERIFY_READ, wrapper,
1769 + sizeof(struct fbcon_decor_iowrapper32)))
1770 + return -EFAULT;
1771 +
1772 + __get_user(vc_num, &wrapper->vc);
1773 + __get_user(origin, &wrapper->origin);
1774 + __get_user(data_compat, &wrapper->data);
1775 + data = compat_ptr(data_compat);
1776 +
1777 + if (!vc_cons_allocated(vc_num))
1778 + return -EINVAL;
1779 +
1780 + vc = vc_cons[vc_num].d;
1781 +
1782 + switch (cmd) {
1783 + case FBIOCONDECOR_SETPIC32:
1784 + {
1785 + struct fb_image32 img_compat;
1786 + struct fb_image img;
1787 +
1788 + if (copy_from_user(&img_compat, (struct fb_image32 __user *)data, sizeof(struct fb_image32)))
1789 + return -EFAULT;
1790 +
1791 + fb_image_from_compat(img, img_compat);
1792 +
1793 + return fbcon_decor_ioctl_dosetpic(vc, &img, origin);
1794 + }
1795 +
1796 + case FBIOCONDECOR_SETCFG32:
1797 + {
1798 + struct vc_decor32 cfg_compat;
1799 + struct vc_decor cfg;
1800 +
1801 + if (copy_from_user(&cfg_compat, (struct vc_decor32 __user *)data, sizeof(struct vc_decor32)))
1802 + return -EFAULT;
1803 +
1804 + vc_decor_from_compat(cfg, cfg_compat);
1805 +
1806 + return fbcon_decor_ioctl_dosetcfg(vc, &cfg, origin);
1807 + }
1808 +
1809 + case FBIOCONDECOR_GETCFG32:
1810 + {
1811 + int rval;
1812 + struct vc_decor32 cfg_compat;
1813 + struct vc_decor cfg;
1814 +
1815 + if (copy_from_user(&cfg_compat, (struct vc_decor32 __user *)data, sizeof(struct vc_decor32)))
1816 + return -EFAULT;
1817 + cfg.theme = compat_ptr(cfg_compat.theme);
1818 +
1819 + rval = fbcon_decor_ioctl_dogetcfg(vc, &cfg);
1820 +
1821 + vc_decor_to_compat(cfg_compat, cfg);
1822 +
1823 + if (copy_to_user((struct vc_decor32 __user *)data, &cfg_compat, sizeof(struct vc_decor32)))
1824 + return -EFAULT;
1825 + return rval;
1826 + }
1827 +
1828 + case FBIOCONDECOR_SETSTATE32:
1829 + {
1830 + compat_uint_t state_compat = 0;
1831 + unsigned int state = 0;
1832 +
1833 + if (get_user(state_compat, (compat_uint_t __user *)data))
1834 + return -EFAULT;
1835 +
1836 + state = (unsigned int)state_compat;
1837 +
1838 + return fbcon_decor_ioctl_dosetstate(vc, state, origin);
1839 + }
1840 +
1841 + case FBIOCONDECOR_GETSTATE32:
1842 + {
1843 + compat_uint_t state_compat = 0;
1844 + unsigned int state = 0;
1845 +
1846 + fbcon_decor_ioctl_dogetstate(vc, &state);
1847 + state_compat = (compat_uint_t)state;
1848 +
1849 + return put_user(state_compat, (compat_uint_t __user *)data);
1850 + }
1851 +
1852 + default:
1853 + return -ENOIOCTLCMD;
1854 + }
1855 +}
1856 +#else
1857 + #define fbcon_decor_compat_ioctl NULL
1858 +#endif
1859 +
1860 +static struct file_operations fbcon_decor_ops = {
1861 + .owner = THIS_MODULE,
1862 + .unlocked_ioctl = fbcon_decor_ioctl,
1863 + .compat_ioctl = fbcon_decor_compat_ioctl
1864 +};
1865 +
1866 +static struct miscdevice fbcon_decor_dev = {
1867 + .minor = MISC_DYNAMIC_MINOR,
1868 + .name = "fbcondecor",
1869 + .fops = &fbcon_decor_ops
1870 +};
1871 +
1872 +void fbcon_decor_reset(void)
1873 +{
1874 + struct fb_info *info;
1875 + struct vc_data *vc;
1876 + int i;
1877 +
1878 + vc = vc_cons[0].d;
1879 + info = registered_fb[0];
1880 +
1881 + for (i = 0; i < num_registered_fb; i++) {
1882 + registered_fb[i]->bgdecor.data = NULL;
1883 + registered_fb[i]->bgdecor.cmap.red = NULL;
1884 + }
1885 +
1886 + for (i = 0; i < MAX_NR_CONSOLES && vc_cons[i].d; i++) {
1887 + vc_cons[i].d->vc_decor.state = vc_cons[i].d->vc_decor.twidth =
1888 + vc_cons[i].d->vc_decor.theight = 0;
1889 + vc_cons[i].d->vc_decor.theme = NULL;
1890 + }
1891 +
1892 + return;
1893 +}
1894 +
1895 +int fbcon_decor_init(void)
1896 +{
1897 + int i;
1898 +
1899 + fbcon_decor_reset();
1900 +
1901 + if (initialized)
1902 + return 0;
1903 +
1904 + i = misc_register(&fbcon_decor_dev);
1905 + if (i) {
1906 + printk(KERN_ERR "fbcondecor: failed to register device\n");
1907 + return i;
1908 + }
1909 +
1910 + fbcon_decor_call_helper("init", 0);
1911 + initialized = 1;
1912 + return 0;
1913 +}
1914 +
1915 +int fbcon_decor_exit(void)
1916 +{
1917 + fbcon_decor_reset();
1918 + return 0;
1919 +}
1920 +
1921 +EXPORT_SYMBOL(fbcon_decor_path);
1922 diff --git a/drivers/video/console/fbcondecor.h b/drivers/video/console/fbcondecor.h
1923 new file mode 100644
1924 index 0000000..1d852dd
1925 --- /dev/null
1926 +++ b/drivers/video/console/fbcondecor.h
1927 @@ -0,0 +1,78 @@
1928 +/*
1929 + * linux/drivers/video/console/fbcondecor.h -- Framebuffer Console Decoration headers
1930 + *
1931 + * Copyright (C) 2004 Michal Januszewski <spock@gentoo.org>
1932 + *
1933 + */
1934 +
1935 +#ifndef __FBCON_DECOR_H
1936 +#define __FBCON_DECOR_H
1937 +
1938 +#ifndef _LINUX_FB_H
1939 +#include <linux/fb.h>
1940 +#endif
1941 +
1942 +/* This is needed for vc_cons in fbcmap.c */
1943 +#include <linux/vt_kern.h>
1944 +
1945 +struct fb_cursor;
1946 +struct fb_info;
1947 +struct vc_data;
1948 +
1949 +#ifdef CONFIG_FB_CON_DECOR
1950 +/* fbcondecor.c */
1951 +int fbcon_decor_init(void);
1952 +int fbcon_decor_exit(void);
1953 +int fbcon_decor_call_helper(char* cmd, unsigned short cons);
1954 +int fbcon_decor_disable(struct vc_data *vc, unsigned char redraw);
1955 +
1956 +/* cfbcondecor.c */
1957 +void fbcon_decor_putcs(struct vc_data *vc, struct fb_info *info, const unsigned short *s, int count, int yy, int xx);
1958 +void fbcon_decor_cursor(struct fb_info *info, struct fb_cursor *cursor);
1959 +void fbcon_decor_clear(struct vc_data *vc, struct fb_info *info, int sy, int sx, int height, int width);
1960 +void fbcon_decor_clear_margins(struct vc_data *vc, struct fb_info *info, int bottom_only);
1961 +void fbcon_decor_blank(struct vc_data *vc, struct fb_info *info, int blank);
1962 +void fbcon_decor_bmove_redraw(struct vc_data *vc, struct fb_info *info, int y, int sx, int dx, int width);
1963 +void fbcon_decor_copy(u8 *dst, u8 *src, int height, int width, int linebytes, int srclinesbytes, int bpp);
1964 +void fbcon_decor_fix_pseudo_pal(struct fb_info *info, struct vc_data *vc);
1965 +
1966 +/* vt.c */
1967 +void acquire_console_sem(void);
1968 +void release_console_sem(void);
1969 +void do_unblank_screen(int entering_gfx);
1970 +
1971 +/* struct vc_data *y */
1972 +#define fbcon_decor_active_vc(y) (y->vc_decor.state && y->vc_decor.theme)
1973 +
1974 +/* struct fb_info *x, struct vc_data *y */
1975 +#define fbcon_decor_active_nores(x,y) (x->bgdecor.data && fbcon_decor_active_vc(y))
1976 +
1977 +/* struct fb_info *x, struct vc_data *y */
1978 +#define fbcon_decor_active(x,y) (fbcon_decor_active_nores(x,y) && \
1979 + x->bgdecor.width == x->var.xres && \
1980 + x->bgdecor.height == x->var.yres && \
1981 + x->bgdecor.depth == x->var.bits_per_pixel)
1982 +
1983 +
1984 +#else /* CONFIG_FB_CON_DECOR */
1985 +
1986 +static inline void fbcon_decor_putcs(struct vc_data *vc, struct fb_info *info, const unsigned short *s, int count, int yy, int xx) {}
1987 +static inline void fbcon_decor_putc(struct vc_data *vc, struct fb_info *info, int c, int ypos, int xpos) {}
1988 +static inline void fbcon_decor_cursor(struct fb_info *info, struct fb_cursor *cursor) {}
1989 +static inline void fbcon_decor_clear(struct vc_data *vc, struct fb_info *info, int sy, int sx, int height, int width) {}
1990 +static inline void fbcon_decor_clear_margins(struct vc_data *vc, struct fb_info *info, int bottom_only) {}
1991 +static inline void fbcon_decor_blank(struct vc_data *vc, struct fb_info *info, int blank) {}
1992 +static inline void fbcon_decor_bmove_redraw(struct vc_data *vc, struct fb_info *info, int y, int sx, int dx, int width) {}
1993 +static inline void fbcon_decor_fix_pseudo_pal(struct fb_info *info, struct vc_data *vc) {}
1994 +static inline int fbcon_decor_call_helper(char* cmd, unsigned short cons) { return 0; }
1995 +static inline int fbcon_decor_init(void) { return 0; }
1996 +static inline int fbcon_decor_exit(void) { return 0; }
1997 +static inline int fbcon_decor_disable(struct vc_data *vc, unsigned char redraw) { return 0; }
1998 +
1999 +#define fbcon_decor_active_vc(y) (0)
2000 +#define fbcon_decor_active_nores(x,y) (0)
2001 +#define fbcon_decor_active(x,y) (0)
2002 +
2003 +#endif /* CONFIG_FB_CON_DECOR */
2004 +
2005 +#endif /* __FBCON_DECOR_H */
2006 diff --git a/drivers/video/fbcmap.c b/drivers/video/fbcmap.c
2007 index 5c3960d..162b5f4 100644
2008 --- a/drivers/video/fbcmap.c
2009 +++ b/drivers/video/fbcmap.c
2010 @@ -17,6 +17,8 @@
2011 #include <linux/slab.h>
2012 #include <linux/uaccess.h>
2013
2014 +#include "console/fbcondecor.h"
2015 +
2016 static u16 red2[] __read_mostly = {
2017 0x0000, 0xaaaa
2018 };
2019 @@ -249,14 +251,17 @@ int fb_set_cmap(struct fb_cmap *cmap, struct fb_info *info)
2020 if (transp)
2021 htransp = *transp++;
2022 if (info->fbops->fb_setcolreg(start++,
2023 - hred, hgreen, hblue,
2024 + hred, hgreen, hblue,
2025 htransp, info))
2026 break;
2027 }
2028 }
2029 - if (rc == 0)
2030 + if (rc == 0) {
2031 fb_copy_cmap(cmap, &info->cmap);
2032 -
2033 + if (fbcon_decor_active(info, vc_cons[fg_console].d) &&
2034 + info->fix.visual == FB_VISUAL_DIRECTCOLOR)
2035 + fbcon_decor_fix_pseudo_pal(info, vc_cons[fg_console].d);
2036 + }
2037 return rc;
2038 }
2039
2040 diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c
2041 index e0c2284..49aca85 100644
2042 --- a/drivers/video/fbmem.c
2043 +++ b/drivers/video/fbmem.c
2044 @@ -1166,15 +1166,6 @@ struct fb_fix_screeninfo32 {
2045 u16 reserved[3];
2046 };
2047
2048 -struct fb_cmap32 {
2049 - u32 start;
2050 - u32 len;
2051 - compat_caddr_t red;
2052 - compat_caddr_t green;
2053 - compat_caddr_t blue;
2054 - compat_caddr_t transp;
2055 -};
2056 -
2057 static int fb_getput_cmap(struct fb_info *info, unsigned int cmd,
2058 unsigned long arg)
2059 {
2060 diff --git a/include/linux/console_decor.h b/include/linux/console_decor.h
2061 new file mode 100644
2062 index 0000000..04b8d80
2063 --- /dev/null
2064 +++ b/include/linux/console_decor.h
2065 @@ -0,0 +1,46 @@
2066 +#ifndef _LINUX_CONSOLE_DECOR_H_
2067 +#define _LINUX_CONSOLE_DECOR_H_ 1
2068 +
2069 +/* A structure used by the framebuffer console decorations (drivers/video/console/fbcondecor.c) */
2070 +struct vc_decor {
2071 + __u8 bg_color; /* The color that is to be treated as transparent */
2072 + __u8 state; /* Current decor state: 0 = off, 1 = on */
2073 + __u16 tx, ty; /* Top left corner coordinates of the text field */
2074 + __u16 twidth, theight; /* Width and height of the text field */
2075 + char* theme;
2076 +};
2077 +
2078 +#ifdef __KERNEL__
2079 +#ifdef CONFIG_COMPAT
2080 +#include <linux/compat.h>
2081 +
2082 +struct vc_decor32 {
2083 + __u8 bg_color; /* The color that is to be treated as transparent */
2084 + __u8 state; /* Current decor state: 0 = off, 1 = on */
2085 + __u16 tx, ty; /* Top left corner coordinates of the text field */
2086 + __u16 twidth, theight; /* Width and height of the text field */
2087 + compat_uptr_t theme;
2088 +};
2089 +
2090 +#define vc_decor_from_compat(to, from) \
2091 + (to).bg_color = (from).bg_color; \
2092 + (to).state = (from).state; \
2093 + (to).tx = (from).tx; \
2094 + (to).ty = (from).ty; \
2095 + (to).twidth = (from).twidth; \
2096 + (to).theight = (from).theight; \
2097 + (to).theme = compat_ptr((from).theme)
2098 +
2099 +#define vc_decor_to_compat(to, from) \
2100 + (to).bg_color = (from).bg_color; \
2101 + (to).state = (from).state; \
2102 + (to).tx = (from).tx; \
2103 + (to).ty = (from).ty; \
2104 + (to).twidth = (from).twidth; \
2105 + (to).theight = (from).theight; \
2106 + (to).theme = ptr_to_compat((from).theme)
2107 +
2108 +#endif /* CONFIG_COMPAT */
2109 +#endif /* __KERNEL__ */
2110 +
2111 +#endif
2112 diff --git a/include/linux/console_struct.h b/include/linux/console_struct.h
2113 index 7f0c329..98f5d60 100644
2114 --- a/include/linux/console_struct.h
2115 +++ b/include/linux/console_struct.h
2116 @@ -19,6 +19,7 @@
2117 struct vt_struct;
2118
2119 #define NPAR 16
2120 +#include <linux/console_decor.h>
2121
2122 struct vc_data {
2123 struct tty_port port; /* Upper level data */
2124 @@ -107,6 +108,8 @@ struct vc_data {
2125 unsigned long vc_uni_pagedir;
2126 unsigned long *vc_uni_pagedir_loc; /* [!] Location of uni_pagedir variable for this console */
2127 bool vc_panic_force_write; /* when oops/panic this VC can accept forced output/blanking */
2128 +
2129 + struct vc_decor vc_decor;
2130 /* additional information is in vt_kern.h */
2131 };
2132
2133 diff --git a/include/linux/fb.h b/include/linux/fb.h
2134 index df728c1..ccde756 100644
2135 --- a/include/linux/fb.h
2136 +++ b/include/linux/fb.h
2137 @@ -11,6 +11,25 @@
2138
2139 #define FB_MAX 32 /* sufficient for now */
2140
2141 +struct fbcon_decor_iowrapper
2142 +{
2143 + unsigned short vc; /* Virtual console */
2144 + unsigned char origin; /* Point of origin of the request */
2145 + void *data;
2146 +};
2147 +
2148 +#ifdef __KERNEL__
2149 +#ifdef CONFIG_COMPAT
2150 +#include <linux/compat.h>
2151 +struct fbcon_decor_iowrapper32
2152 +{
2153 + unsigned short vc; /* Virtual console */
2154 + unsigned char origin; /* Point of origin of the request */
2155 + compat_uptr_t data;
2156 +};
2157 +#endif /* CONFIG_COMPAT */
2158 +#endif /* __KERNEL__ */
2159 +
2160 /* ioctls
2161 0x46 is 'F' */
2162 #define FBIOGET_VSCREENINFO 0x4600
2163 @@ -39,6 +58,24 @@
2164 #define FBIOPUT_MODEINFO 0x4617
2165 #define FBIOGET_DISPINFO 0x4618
2166 #define FBIO_WAITFORVSYNC _IOW('F', 0x20, __u32)
2167 +#define FBIOCONDECOR_SETCFG _IOWR('F', 0x19, struct fbcon_decor_iowrapper)
2168 +#define FBIOCONDECOR_GETCFG _IOR('F', 0x1A, struct fbcon_decor_iowrapper)
2169 +#define FBIOCONDECOR_SETSTATE _IOWR('F', 0x1B, struct fbcon_decor_iowrapper)
2170 +#define FBIOCONDECOR_GETSTATE _IOR('F', 0x1C, struct fbcon_decor_iowrapper)
2171 +#define FBIOCONDECOR_SETPIC _IOWR('F', 0x1D, struct fbcon_decor_iowrapper)
2172 +#ifdef __KERNEL__
2173 +#ifdef CONFIG_COMPAT
2174 +#define FBIOCONDECOR_SETCFG32 _IOWR('F', 0x19, struct fbcon_decor_iowrapper32)
2175 +#define FBIOCONDECOR_GETCFG32 _IOR('F', 0x1A, struct fbcon_decor_iowrapper32)
2176 +#define FBIOCONDECOR_SETSTATE32 _IOWR('F', 0x1B, struct fbcon_decor_iowrapper32)
2177 +#define FBIOCONDECOR_GETSTATE32 _IOR('F', 0x1C, struct fbcon_decor_iowrapper32)
2178 +#define FBIOCONDECOR_SETPIC32 _IOWR('F', 0x1D, struct fbcon_decor_iowrapper32)
2179 +#endif /* CONFIG_COMPAT */
2180 +#endif /* __KERNEL__ */
2181 +
2182 +#define FBCON_DECOR_THEME_LEN 128 /* Maximum lenght of a theme name */
2183 +#define FBCON_DECOR_IO_ORIG_KERNEL 0 /* Kernel ioctl origin */
2184 +#define FBCON_DECOR_IO_ORIG_USER 1 /* User ioctl origin */
2185
2186 #define FB_TYPE_PACKED_PIXELS 0 /* Packed Pixels */
2187 #define FB_TYPE_PLANES 1 /* Non interleaved planes */
2188 @@ -285,6 +322,28 @@ struct fb_cmap {
2189 __u16 *transp; /* transparency, can be NULL */
2190 };
2191
2192 +#ifdef __KERNEL__
2193 +#ifdef CONFIG_COMPAT
2194 +struct fb_cmap32 {
2195 + __u32 start;
2196 + __u32 len; /* Number of entries */
2197 + compat_uptr_t red; /* Red values */
2198 + compat_uptr_t green;
2199 + compat_uptr_t blue;
2200 + compat_uptr_t transp; /* transparency, can be NULL */
2201 +};
2202 +
2203 +#define fb_cmap_from_compat(to, from) \
2204 + (to).start = (from).start; \
2205 + (to).len = (from).len; \
2206 + (to).red = compat_ptr((from).red); \
2207 + (to).green = compat_ptr((from).green); \
2208 + (to).blue = compat_ptr((from).blue); \
2209 + (to).transp = compat_ptr((from).transp)
2210 +
2211 +#endif /* CONFIG_COMPAT */
2212 +#endif /* __KERNEL__ */
2213 +
2214 struct fb_con2fbmap {
2215 __u32 console;
2216 __u32 framebuffer;
2217 @@ -366,6 +425,34 @@ struct fb_image {
2218 struct fb_cmap cmap; /* color map info */
2219 };
2220
2221 +#ifdef __KERNEL__
2222 +#ifdef CONFIG_COMPAT
2223 +struct fb_image32 {
2224 + __u32 dx; /* Where to place image */
2225 + __u32 dy;
2226 + __u32 width; /* Size of image */
2227 + __u32 height;
2228 + __u32 fg_color; /* Only used when a mono bitmap */
2229 + __u32 bg_color;
2230 + __u8 depth; /* Depth of the image */
2231 + const compat_uptr_t data; /* Pointer to image data */
2232 + struct fb_cmap32 cmap; /* color map info */
2233 +};
2234 +
2235 +#define fb_image_from_compat(to, from) \
2236 + (to).dx = (from).dx; \
2237 + (to).dy = (from).dy; \
2238 + (to).width = (from).width; \
2239 + (to).height = (from).height; \
2240 + (to).fg_color = (from).fg_color; \
2241 + (to).bg_color = (from).bg_color; \
2242 + (to).depth = (from).depth; \
2243 + (to).data = compat_ptr((from).data); \
2244 + fb_cmap_from_compat((to).cmap, (from).cmap)
2245 +
2246 +#endif /* CONFIG_COMPAT */
2247 +#endif /* __KERNEL__ */
2248 +
2249 /*
2250 * hardware cursor control
2251 */
2252 @@ -875,6 +962,9 @@ struct fb_info {
2253 #define FBINFO_STATE_SUSPENDED 1
2254 u32 state; /* Hardware state i.e suspend */
2255 void *fbcon_par; /* fbcon use-only private area */
2256 +
2257 + struct fb_image bgdecor;
2258 +
2259 /* From here on everything is device dependent */
2260 void *par;
2261 /* we need the PCI or similar aperture base/size not
2262 diff --git a/kernel/sysctl.c b/kernel/sysctl.c
2263 index c0bb324..5281a79 100644
2264 --- a/kernel/sysctl.c
2265 +++ b/kernel/sysctl.c
2266 @@ -134,6 +134,10 @@ static int min_percpu_pagelist_fract = 8;
2267
2268 static int ngroups_max = NGROUPS_MAX;
2269
2270 +#ifdef CONFIG_FB_CON_DECOR
2271 +extern char fbcon_decor_path[];
2272 +#endif
2273 +
2274 #ifdef CONFIG_INOTIFY_USER
2275 #include <linux/inotify.h>
2276 #endif
2277 @@ -253,6 +257,15 @@ static struct ctl_table root_table[] = {
2278 .mode = 0555,
2279 .child = dev_table,
2280 },
2281 +#ifdef CONFIG_FB_CON_DECOR
2282 + {
2283 + .procname = "fbcondecor",
2284 + .data = &fbcon_decor_path,
2285 + .maxlen = KMOD_PATH_LEN,
2286 + .mode = 0644,
2287 + .proc_handler = &proc_dostring,
2288 + },
2289 +#endif
2290 { }
2291 };
2292
2293 @@ -1012,7 +1025,7 @@ static struct ctl_table vm_table[] = {
2294 .proc_handler = proc_dointvec,
2295 },
2296 {
2297 - .procname = "page-cluster",
2298 + .procname = "page-cluster",
2299 .data = &page_cluster,
2300 .maxlen = sizeof(int),
2301 .mode = 0644,
2302 @@ -1458,7 +1471,7 @@ static struct ctl_table fs_table[] = {
2303 .mode = 0555,
2304 .child = inotify_table,
2305 },
2306 -#endif
2307 +#endif
2308 #ifdef CONFIG_EPOLL
2309 {
2310 .procname = "epoll",
2311 @@ -1819,7 +1832,7 @@ static void try_attach(struct ctl_table_header *p, struct ctl_table_header *q)
2312 * cover common cases -
2313 *
2314 * proc_dostring(), proc_dointvec(), proc_dointvec_jiffies(),
2315 - * proc_dointvec_userhz_jiffies(), proc_dointvec_minmax(),
2316 + * proc_dointvec_userhz_jiffies(), proc_dointvec_minmax(),
2317 * proc_doulongvec_ms_jiffies_minmax(), proc_doulongvec_minmax()
2318 *
2319 * It is the handler's job to read the input buffer from user memory
2320 @@ -2259,12 +2272,12 @@ static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table,
2321 unsigned long page = 0;
2322 size_t left;
2323 char *kbuf;
2324 -
2325 +
2326 if (!tbl_data || !table->maxlen || !*lenp || (*ppos && !write)) {
2327 *lenp = 0;
2328 return 0;
2329 }
2330 -
2331 +
2332 i = (int *) tbl_data;
2333 vleft = table->maxlen / sizeof(*i);
2334 left = *lenp;
2335 @@ -2353,7 +2366,7 @@ static int do_proc_dointvec(struct ctl_table *table, int write,
2336 * @ppos: file position
2337 *
2338 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2339 - * values from/to the user buffer, treated as an ASCII string.
2340 + * values from/to the user buffer, treated as an ASCII string.
2341 *
2342 * Returns 0 on success.
2343 */
2344 @@ -2680,7 +2693,7 @@ static int do_proc_dointvec_ms_jiffies_conv(bool *negp, unsigned long *lvalp,
2345 * @ppos: file position
2346 *
2347 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2348 - * values from/to the user buffer, treated as an ASCII string.
2349 + * values from/to the user buffer, treated as an ASCII string.
2350 * The values read are assumed to be in seconds, and are converted into
2351 * jiffies.
2352 *
2353 @@ -2702,8 +2715,8 @@ int proc_dointvec_jiffies(struct ctl_table *table, int write,
2354 * @ppos: pointer to the file position
2355 *
2356 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2357 - * values from/to the user buffer, treated as an ASCII string.
2358 - * The values read are assumed to be in 1/USER_HZ seconds, and
2359 + * values from/to the user buffer, treated as an ASCII string.
2360 + * The values read are assumed to be in 1/USER_HZ seconds, and
2361 * are converted into jiffies.
2362 *
2363 * Returns 0 on success.
2364 @@ -2725,8 +2738,8 @@ int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
2365 * @ppos: the current position in the file
2366 *
2367 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2368 - * values from/to the user buffer, treated as an ASCII string.
2369 - * The values read are assumed to be in 1/1000 seconds, and
2370 + * values from/to the user buffer, treated as an ASCII string.
2371 + * The values read are assumed to be in 1/1000 seconds, and
2372 * are converted into jiffies.
2373 *
2374 * Returns 0 on success.