/[linux-patches]/genpatches-2.6/trunk/2.6.29/4200_fbcondecor-0.9.5.patch
Gentoo

Contents of /genpatches-2.6/trunk/2.6.29/4200_fbcondecor-0.9.5.patch

Parent Directory Parent Directory | Revision Log Revision Log


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

  ViewVC Help
Powered by ViewVC 1.1.20