1 diff -Naurp -x .git /tmp/linux/Documentation/fb/00-INDEX ./Documentation/fb/00-INDEX
2 --- /tmp/linux/Documentation/fb/00-INDEX 2008-03-25 07:24:16.000000000 +0100
3 +++ ./Documentation/fb/00-INDEX 2008-03-25 23:04:10.000000000 +0100
4 @@ -17,6 +17,8 @@ deferred_io.txt
5 - an introduction to deferred IO.
7 - intro to and usage guide for the framebuffer console (fbcon).
9 + - info on the Framebuffer Console Decoration
11 - introduction to frame buffer devices.
13 diff -Naurp -x .git /tmp/linux/Documentation/fb/fbcondecor.txt ./Documentation/fb/fbcondecor.txt
14 --- /tmp/linux/Documentation/fb/fbcondecor.txt 1970-01-01 01:00:00.000000000 +0100
15 +++ ./Documentation/fb/fbcondecor.txt 2008-03-25 23:04:10.000000000 +0100
20 +The framebuffer decorations are a kernel feature which allows displaying a
21 +background picture on selected consoles.
23 +What do I need to get it to work?
24 +---------------------------------
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.
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.
36 +[1] The splashutils package can be downloaded from:
37 + http://dev.gentoo.org/~spock/projects/splashutils/
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.
49 +It's possible to set path to the fbcondecor helper by writing it to
50 +/proc/sys/kernel/fbcondecor.
52 +*****************************************************************************
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.
57 +The fbcondecor protocol
58 +-----------------------
60 +The fbcondecor protocol defines a communication interface between the kernel and
61 +the userspace fbcondecor helper.
63 +The kernel side is responsible for:
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
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.
75 +The fbcondecor protocol specifies how communication is done in both ways:
76 +kernel->userspace and userspace->helper.
81 +The kernel communicates with the userspace helper by calling it and specifying
82 +the task to be done in a series of arguments.
84 +The arguments follow the pattern:
85 +<fbcondecor protocol version> <command> <parameters>
87 +All commands defined in fbcondecor protocol v2 have the following parameters:
92 +Fbcondecor protocol v1 specified an additional 'fbcondecor mode' after the
93 +framebuffer number. Fbcondecor protocol v1 is deprecated and should not be used.
95 +Fbcondecor protocol v2 specifies the following commands:
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.
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.
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.
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.
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.
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.
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).
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.
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
152 +The framebuffer console decoration provides the following ioctls (all defined in
156 +description: loads a background picture for a virtual console
157 +argument: struct fbcon_decor_iowrapper*; data: struct fb_image*
159 +If called for consoles other than the current foreground one, the picture data
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.
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.
174 +description: gets the fbcondecor config for a virtual console
175 +argument: struct fbcon_decor_iowrapper*; data: struct vc_decor*
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.
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
187 +Info on used structures:
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.
195 +Definition of struct fbcon_decor_iowrapper can be found in linux/fb.h.
196 +The fields in this struct have the following meaning:
199 +Virtual console number.
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.
208 +Pointer to a data structure appropriate for the performed ioctl. Type of
209 +the data struct is specified in the ioctls description.
211 +*****************************************************************************
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>.
221 +Fbcondecor, fbcondecor protocol design, current implementation & docs by:
222 + Michal Januszewski <spock@gentoo.org>
224 diff -Naurp -x .git /tmp/linux/drivers/Makefile ./drivers/Makefile
225 --- /tmp/linux/drivers/Makefile 2008-03-25 07:24:16.000000000 +0100
226 +++ ./drivers/Makefile 2008-03-25 23:04:10.000000000 +0100
227 @@ -9,6 +9,9 @@ obj-$(CONFIG_HAVE_GPIO_LIB) += 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
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/
239 obj-$(CONFIG_XEN) += xen/
241 -# char/ comes before serial/ etc so that the VT console is the boot-time
245 obj-$(CONFIG_CONNECTOR) += connector/
247 # i810fb and intelfb depend on char/agp/
248 diff -Naurp -x .git /tmp/linux/drivers/video/console/bitblit.c ./drivers/video/console/bitblit.c
249 --- /tmp/linux/drivers/video/console/bitblit.c 2008-03-25 07:24:16.000000000 +0100
250 +++ ./drivers/video/console/bitblit.c 2008-03-25 23:04:10.000000000 +0100
252 #include <linux/console.h>
253 #include <asm/types.h>
255 +#include "fbcondecor.h"
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;
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;
270 info->fbops->fb_copyarea(info, &area);
273 @@ -379,11 +387,15 @@ static void bit_cursor(struct vc_data *v
274 cursor.image.depth = 1;
275 cursor.rop = ROP_XOR;
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);
282 + if (info->fbops->fb_cursor)
283 + err = info->fbops->fb_cursor(info, &cursor);
286 - soft_cursor(info, &cursor);
288 + soft_cursor(info, &cursor);
291 ops->cursor_reset = 0;
293 diff -Naurp -x .git /tmp/linux/drivers/video/console/cfbcondecor.c ./drivers/video/console/cfbcondecor.c
294 --- /tmp/linux/drivers/video/console/cfbcondecor.c 1970-01-01 01:00:00.000000000 +0100
295 +++ ./drivers/video/console/cfbcondecor.c 2008-03-25 23:11:30.000000000 +0100
298 + * linux/drivers/video/cfbcon_decor.c -- Framebuffer decor render functions
300 + * Copyright (C) 2004 Michal Januszewski <spock@gentoo.org>
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>.
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
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>
322 +#include "fbcondecor.h"
324 +#define parse_pixel(shift,bpp,type) \
326 + if (d & (0x80 >> (shift))) \
327 + dd2[(shift)] = fgx; \
329 + dd2[(shift)] = transparent ? *(type *)decor_src : bgx; \
330 + decor_src += (bpp); \
333 +extern int get_color(struct vc_data *vc, struct fb_info *info,
336 +void fbcon_decor_fix_pseudo_pal(struct fb_info *info, struct vc_data *vc)
339 + int minlen = min(min(info->var.red.length, info->var.green.length),
340 + info->var.blue.length);
343 + for (j = i = 0; i < 16; i++) {
344 + k = color_table[i];
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;
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)
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;
366 + u8* decor_src = (u8 *)(info->bgdecor.data + ds);
367 + u8* dst = (u8 *)(info->screen_base + d);
369 + if ((ypos + height) > info->var.yres || (xpos + width) > info->var.xres)
372 + for (y = 0; y < height; y++) {
373 + switch (info->var.bits_per_pixel) {
376 + for (x = 0; x < width; x++) {
384 + *(u32 *)decor_src : bgx;
388 + fb_writel(dd, dst);
393 + for (x = 0; x < width; x++) {
401 + (*(u32 *)decor_src & 0xffffff) : bgx;
405 +#ifdef __LITTLE_ENDIAN
406 + fb_writew(dd & 0xffff, dst);
408 + fb_writeb((dd >> 16), dst);
410 + fb_writew(dd >> 8, dst);
412 + fb_writeb(dd & 0xff, dst);
418 + for (x = 0; x < width; x += 2) {
422 + parse_pixel(0, 2, u16);
423 + parse_pixel(1, 2, u16);
424 +#ifdef __LITTLE_ENDIAN
425 + dd = dd2[0] | (dd2[1] << 16);
427 + dd = dd2[1] | (dd2[0] << 16);
430 + fb_writel(dd, dst);
436 + for (x = 0; x < width; x += 4) {
440 + parse_pixel(0, 1, u8);
441 + parse_pixel(1, 1, u8);
442 + parse_pixel(2, 1, u8);
443 + parse_pixel(3, 1, u8);
445 +#ifdef __LITTLE_ENDIAN
446 + dd = dd2[0] | (dd2[1] << 8) | (dd2[2] << 16) | (dd2[3] << 24);
448 + dd = dd2[3] | (dd2[2] << 8) | (dd2[1] << 16) | (dd2[0] << 24);
451 + fb_writel(dd, dst);
456 + dst += info->fix.line_length - width * bytespp;
457 + decor_src += (info->var.xres - width) * bytespp;
462 + ((info->fix.visual == FB_VISUAL_TRUECOLOR || \
463 + info->fix.visual == FB_VISUAL_DIRECTCOLOR) ? \
464 + ((u32*)info->pseudo_palette)[a] : a)
466 +void fbcon_decor_putcs(struct vc_data *vc, struct fb_info *info,
467 + const unsigned short *s, int count, int yy, int xx)
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;
474 + u16 c = scr_readw(s);
476 + fg_color = get_color(vc, info, c, 1);
477 + bg_color = get_color(vc, info, c, 0);
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);
483 + xx = xx * vc->vc_font.width + vc->vc_decor.tx;
484 + yy = yy * vc->vc_font.height + vc->vc_decor.ty;
486 + fgx = cc2cx(fg_color);
487 + bgx = cc2cx(bg_color);
490 + c = scr_readw(s++);
491 + src = vc->vc_font.data + (c & charmask) * vc->vc_font.height *
492 + ((vc->vc_font.width + 7) >> 3);
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;
500 +void fbcon_decor_cursor(struct fb_info *info, struct fb_cursor *cursor)
503 + unsigned int dsize, s_pitch;
504 + struct fbcon_ops *ops = info->fbcon_par;
505 + struct vc_data* vc;
508 + /* we really don't need any cursors while the console is blanked */
509 + if (info->state != FBINFO_STATE_RUNNING || ops->blank_state)
512 + vc = vc_cons[ops->currcon].d;
514 + src = kmalloc(64 + sizeof(struct fb_image), GFP_ATOMIC);
518 + s_pitch = (cursor->image.width + 7) >> 3;
519 + dsize = s_pitch * cursor->image.height;
520 + if (cursor->enable) {
521 + switch (cursor->rop) {
523 + for (i = 0; i < dsize; i++)
524 + src[i] = cursor->image.data[i] ^ cursor->mask[i];
528 + for (i = 0; i < dsize; i++)
529 + src[i] = cursor->image.data[i] & cursor->mask[i];
533 + memcpy(src, cursor->image.data, dsize);
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,
541 + cc2cx(cursor->image.fg_color),
542 + cc2cx(cursor->image.bg_color),
543 + cursor->image.bg_color == vc->vc_decor.bg_color);
548 +static void decorset(u8 *dst, int height, int width, int dstbytes,
555 + if (bpp == 16 || bpp == 8)
558 + while (height-- > 0) {
564 + for (i=0; i < width; i++) {
565 + fb_writel(bgx, p); p += 4;
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++);
574 + fb_writew((bgx >> 8),(u16*)p); p += 2;
575 + fb_writeb((bgx & 0xff),p++);
579 + for (i=0; i < width/4; i++) {
580 + fb_writel(bgx,p); p += 4;
581 + fb_writel(bgx,p); p += 4;
584 + fb_writel(bgx,p); p += 4;
587 + fb_writew(bgx,(u16*)p);
590 + for (i=0; i < width/4; i++) {
591 + fb_writel(bgx,p); p += 4;
595 + fb_writew(bgx,p); p += 2;
598 + fb_writeb(bgx,(u8*)p);
606 +void fbcon_decor_copy(u8 *dst, u8 *src, int height, int width, int linebytes,
607 + int srclinebytes, int bpp)
611 + while (height-- > 0) {
612 + u32 *p = (u32 *)dst;
613 + u32 *q = (u32 *)src;
618 + for (i=0; i < width; i++)
619 + fb_writel(*q++, p++);
622 + for (i=0; i < (width*3/4); i++)
623 + fb_writel(*q++, p++);
624 + if ((width*3) % 4) {
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));
634 + for (i=0; i < width/4; i++) {
635 + fb_writel(*q++, p++);
636 + fb_writel(*q++, p++);
639 + fb_writel(*q++, p++);
641 + fb_writew(*(u16*)q, (u16*)p);
644 + for (i=0; i < width/4; i++)
645 + fb_writel(*q++, p++);
648 + fb_writew(*(u16*)q, (u16*)p);
649 + q = (u32*) ((u16*)q + 1);
650 + p = (u32*) ((u16*)p + 1);
653 + fb_writeb(*(u8*)q, (u8*)p);
658 + src += srclinebytes;
662 +static void decorfill(struct fb_info *info, int sy, int sx, int height,
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;
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);
674 +void fbcon_decor_clear(struct vc_data *vc, struct fb_info *info, int sy, int sx,
675 + int height, int width)
677 + int bgshift = (vc->vc_hi_font_mask) ? 13 : 12;
678 + struct fbcon_ops *ops = info->fbcon_par;
680 + int transparent, bg_color = attr_bgcol_ec(bgshift, vc, info);
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;
688 + /* Don't paint the background image if console is blanked */
689 + if (transparent && !ops->blank_state) {
690 + decorfill(info, sy, sx, height, width);
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);
699 +void fbcon_decor_clear_margins(struct vc_data *vc, struct fb_info *info,
702 + unsigned int tw = vc->vc_cols*vc->vc_font.width;
703 + unsigned int th = vc->vc_rows*vc->vc_font.height;
705 + if (!bottom_only) {
707 + decorfill(info, 0, 0, vc->vc_decor.ty, info->var.xres);
709 + decorfill(info, vc->vc_decor.ty, 0, th, vc->vc_decor.tx);
711 + decorfill(info, vc->vc_decor.ty, vc->vc_decor.tx + tw, th,
712 + info->var.xres - vc->vc_decor.tx - tw);
714 + decorfill(info, vc->vc_decor.ty + th, 0,
715 + info->var.yres - vc->vc_decor.ty - th, info->var.xres);
718 +void fbcon_decor_bmove_redraw(struct vc_data *vc, struct fb_info *info, int y,
719 + int sx, int dx, int width)
721 + u16 *d = (u16 *) (vc->vc_origin + vc->vc_size_row * y + dx * 2);
722 + u16 *s = d + (dx - sx);
725 + u16 *le = d + width;
732 + if (attr != (c & 0xff00)) {
735 + fbcon_decor_putcs(vc, info, start, d - start, y, x);
740 + if (s >= ls && s < le && c == scr_readw(s)) {
742 + fbcon_decor_putcs(vc, info, start, d - start, y, x);
743 + x += d - start + 1;
754 + fbcon_decor_putcs(vc, info, start, d - start, y, x);
757 +void fbcon_decor_blank(struct vc_data *vc, struct fb_info *info, int blank)
760 + decorset((u8 *)info->screen_base, info->var.yres, info->var.xres,
761 + info->fix.line_length, 0, info->var.bits_per_pixel);
764 + fbcon_decor_clear_margins(vc, info, 0);
768 diff -Naurp -x .git /tmp/linux/drivers/video/console/fbcon.c ./drivers/video/console/fbcon.c
769 --- /tmp/linux/drivers/video/console/fbcon.c 2008-03-25 07:24:16.000000000 +0100
770 +++ ./drivers/video/console/fbcon.c 2008-03-25 23:04:10.000000000 +0100
775 +#include "fbcondecor.h"
778 # define DPRINTK(fmt, args...) printk(KERN_DEBUG "%s: " fmt, __FUNCTION__ , ## args)
779 @@ -105,7 +106,7 @@ enum {
781 static struct display fb_display[MAX_NR_CONSOLES];
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];
787 static int logo_height;
788 @@ -315,7 +316,7 @@ static inline int fbcon_is_inactive(stru
789 vc->vc_mode != KD_TEXT || ops->graphics);
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,
796 int depth = fb_get_color_depth(&info->var, &info->fix);
797 @@ -420,6 +421,7 @@ static void fb_flashcursor(struct work_s
799 ops->cursor(vc, info, mode, softback_lines, get_color(vc, info, c, 1),
800 get_color(vc, info, c, 0));
802 release_console_sem();
805 @@ -590,6 +592,8 @@ static int fbcon_takeover(int show_logo)
809 + fbcon_decor_init();
814 @@ -1031,6 +1035,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;
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;
824 vc_resize(vc, cols, rows);
826 DPRINTK("mode: %s\n", info->fix.id);
827 @@ -1114,7 +1124,7 @@ static void fbcon_init(struct vc_data *v
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))
835 if (var_to_display(p, &info->var, info))
836 @@ -1313,6 +1323,11 @@ static void fbcon_clear(struct vc_data *
837 if (!height || !width)
840 + if (fbcon_decor_active(info, vc)) {
841 + fbcon_decor_clear(vc, info, sy, sx, height, width);
845 /* Split blits that cross physical y_wrap boundary */
847 y_break = p->vrows - p->yscroll;
848 @@ -1332,10 +1347,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;
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)) {
858 + if (fbcon_decor_active(info, vc))
859 + fbcon_decor_putcs(vc, info, s, count, ypos, xpos);
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));
867 static void fbcon_putc(struct vc_data *vc, int c, int ypos, int xpos)
868 @@ -1351,8 +1371,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;
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);
878 + ops->clear_margins(vc, info, bottom_only);
883 static void fbcon_cursor(struct vc_data *vc, int mode)
884 @@ -1872,7 +1897,7 @@ static int fbcon_scroll(struct vc_data *
887 fbcon_softback_note(vc, t, count);
888 - if (logo_shown >= 0)
889 + if (logo_shown >= 0 || fbcon_decor_active(info, vc))
891 switch (p->scrollmode) {
893 @@ -1965,6 +1990,8 @@ static int fbcon_scroll(struct vc_data *
897 + if (fbcon_decor_active(info, vc))
899 switch (p->scrollmode) {
901 fbcon_redraw_blit(vc, info, p, b - 1, b - t - count,
902 @@ -2113,6 +2140,13 @@ static void fbcon_bmove_rec(struct vc_da
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);
913 ops->bmove(vc, info, real_y(p, sy), sx, real_y(p, dy), dx,
916 @@ -2183,8 +2217,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;
926 DPRINTK("attempting resize %ix%i\n", var.xres, var.yres);
927 @@ -2220,6 +2254,19 @@ static int fbcon_switch(struct vc_data *
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]];
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);
947 @@ -2238,9 +2285,6 @@ static int fbcon_switch(struct vc_data *
948 logo_shown = FBCON_LOGO_CANSHOW;
951 - prev_console = ops->currcon;
952 - if (prev_console != -1)
953 - old_info = registered_fb[con2fb_map[prev_console]];
955 * FIXME: If we have multiple fbdev's loaded, we need to
956 * update all info->currcon. Perhaps, we can place this
957 @@ -2280,6 +2324,18 @@ static int fbcon_switch(struct vc_data *
958 fbcon_del_cursor_timer(old_info);
961 + if (fbcon_decor_active_vc(vc)) {
962 + struct vc_data *vc_curr = vc_cons[prev_console].d;
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);
973 if (fbcon_is_inactive(vc, info) ||
974 ops->blank_state != FB_BLANK_UNBLANK)
975 fbcon_del_cursor_timer(info);
976 @@ -2394,8 +2450,12 @@ static int fbcon_blank(struct vc_data *v
977 fbcon_cursor(vc, blank ? CM_ERASE : CM_DRAW);
978 ops->cursor_flash = (!blank);
980 - if (fb_blank(info, blank))
981 - fbcon_generic_blank(vc, info, blank);
982 + if (fb_blank(info, blank)) {
983 + if (fbcon_decor_active(info, vc))
984 + fbcon_decor_blank(vc, info, blank);
986 + fbcon_generic_blank(vc, info, blank);
991 @@ -2546,13 +2606,22 @@ static int fbcon_do_set_font(struct vc_d
995 + /* reset wrap/pan */
998 cols = FBCON_SWAP(ops->rotate, info->var.xres, info->var.yres);
999 rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres);
1001 + info->var.xoffset = info->var.yoffset = p->yscroll = 0;
1002 + if (fbcon_decor_active(info, vc)) {
1003 + cols = vc->vc_decor.twidth;
1004 + rows = vc->vc_decor.theight;
1009 vc_resize(vc, cols, rows);
1011 if (CON_IS_VISIBLE(vc) && softback_buf)
1012 fbcon_update_softback(vc);
1013 } else if (CON_IS_VISIBLE(vc)
1014 @@ -2681,7 +2750,7 @@ static int fbcon_set_palette(struct vc_d
1018 - if (fbcon_is_inactive(vc, info))
1019 + if (fbcon_is_inactive(vc, info) || vc->vc_num != fg_console)
1022 if (!CON_IS_VISIBLE(vc))
1023 @@ -2707,7 +2776,49 @@ static int fbcon_set_palette(struct vc_d
1025 fb_copy_cmap(fb_default_cmap(1 << depth), &palette_cmap);
1027 - return fb_set_cmap(&palette_cmap, info);
1028 + if (fbcon_decor_active(info, vc_cons[fg_console].d) &&
1029 + info->fix.visual == FB_VISUAL_DIRECTCOLOR) {
1031 + u16 *red, *green, *blue;
1032 + int minlen = min(min(info->var.red.length, info->var.green.length),
1033 + info->var.blue.length);
1036 + struct fb_cmap cmap = {
1038 + .len = (1 << minlen),
1045 + red = kmalloc(256 * sizeof(u16) * 3, GFP_KERNEL);
1050 + green = red + 256;
1051 + blue = green + 256;
1053 + cmap.green = green;
1056 + for (i = 0; i < cmap.len; i++) {
1057 + red[i] = green[i] = blue[i] = (0xffff * i)/(cmap.len-1);
1060 + h = fb_set_cmap(&cmap, info);
1061 + fbcon_decor_fix_pseudo_pal(info, vc_cons[fg_console].d);
1066 + } else if (fbcon_decor_active(info, vc_cons[fg_console].d) &&
1067 + info->var.bits_per_pixel == 8 && info->bgdecor.cmap.red != NULL)
1068 + fb_set_cmap(&info->bgdecor.cmap, info);
1070 +out: return fb_set_cmap(&palette_cmap, info);
1073 static u16 *fbcon_screen_pos(struct vc_data *vc, int offset)
1074 @@ -2933,7 +3044,14 @@ static void fbcon_modechanged(struct fb_
1075 rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres);
1076 cols /= vc->vc_font.width;
1077 rows /= vc->vc_font.height;
1078 - vc_resize(vc, cols, rows);
1080 + if (!fbcon_decor_active_nores(info, vc)) {
1081 + vc_resize(vc, cols, rows);
1083 + if (fbcon_decor_call_helper("modechange", vc->vc_num))
1084 + fbcon_decor_disable(vc, 0);
1087 updatescrollmode(p, info, vc);
1089 scrollback_current = 0;
1090 @@ -3561,6 +3679,7 @@ static void fbcon_exit(void)
1094 + fbcon_decor_exit();
1095 fbcon_has_exited = 1;
1098 diff -Naurp -x .git /tmp/linux/drivers/video/console/fbcondecor.c ./drivers/video/console/fbcondecor.c
1099 --- /tmp/linux/drivers/video/console/fbcondecor.c 1970-01-01 01:00:00.000000000 +0100
1100 +++ ./drivers/video/console/fbcondecor.c 2008-03-25 23:04:10.000000000 +0100
1103 + * linux/drivers/video/console/fbcondecor.c -- Framebuffer console decorations
1105 + * Copyright (C) 2004 Michal Januszewski <spock@gentoo.org>
1107 + * Code based upon "Bootsplash" (C) 2001-2003
1108 + * Volker Poplawski <volker@poplawski.de>,
1109 + * Stefan Reinauer <stepan@suse.de>,
1110 + * Steffen Winterfeldt <snwint@suse.de>,
1111 + * Michael Schroeder <mls@suse.de>,
1112 + * Ken Wimer <wimer@suse.de>.
1114 + * This file is subject to the terms and conditions of the GNU General Public
1115 + * License. See the file COPYING in the main directory of this archive for
1119 +#include <linux/module.h>
1120 +#include <linux/kernel.h>
1121 +#include <linux/string.h>
1122 +#include <linux/types.h>
1123 +#include <linux/fb.h>
1124 +#include <linux/vt_kern.h>
1125 +#include <linux/vmalloc.h>
1126 +#include <linux/unistd.h>
1127 +#include <linux/syscalls.h>
1128 +#include <linux/init.h>
1129 +#include <linux/proc_fs.h>
1130 +#include <linux/workqueue.h>
1131 +#include <linux/kmod.h>
1132 +#include <linux/miscdevice.h>
1133 +#include <linux/device.h>
1134 +#include <linux/fs.h>
1136 +#include <asm/uaccess.h>
1137 +#include <asm/irq.h>
1138 +#include <asm/system.h>
1141 +#include "fbcondecor.h"
1143 +extern signed char con2fb_map[];
1144 +static int fbcon_decor_enable(struct vc_data *vc);
1145 +char fbcon_decor_path[KMOD_PATH_LEN] = "/sbin/fbcondecor_helper";
1146 +static int initialized = 0;
1148 +int fbcon_decor_call_helper(char* cmd, unsigned short vc)
1152 + "PATH=/sbin:/bin",
1158 + unsigned char fb = (int) con2fb_map[vc];
1166 + vc_cons[vc].d->vc_decor.theme,
1170 + snprintf(tfb,5,"%d",fb);
1171 + snprintf(tcons,5,"%d",vc);
1173 + return call_usermodehelper(fbcon_decor_path, argv, envp, 1);
1176 +/* Disables fbcondecor on a virtual console; called with console sem held. */
1177 +int fbcon_decor_disable(struct vc_data *vc, unsigned char redraw)
1179 + struct fb_info* info;
1181 + if (!vc->vc_decor.state)
1184 + info = registered_fb[(int) con2fb_map[vc->vc_num]];
1189 + vc->vc_decor.state = 0;
1190 + vc_resize(vc, info->var.xres / vc->vc_font.width,
1191 + info->var.yres / vc->vc_font.height);
1193 + if (fg_console == vc->vc_num && redraw) {
1194 + redraw_screen(vc, 0);
1195 + update_region(vc, vc->vc_origin +
1196 + vc->vc_size_row * vc->vc_top,
1197 + vc->vc_size_row * (vc->vc_bottom - vc->vc_top) / 2);
1200 + printk(KERN_INFO "fbcondecor: switched decor state to 'off' on console %d\n",
1206 +/* Enables fbcondecor on a virtual console; called with console sem held. */
1207 +static int fbcon_decor_enable(struct vc_data *vc)
1209 + struct fb_info* info;
1211 + info = registered_fb[(int) con2fb_map[vc->vc_num]];
1213 + if (vc->vc_decor.twidth == 0 || vc->vc_decor.theight == 0 ||
1214 + info == NULL || vc->vc_decor.state || (!info->bgdecor.data &&
1215 + vc->vc_num == fg_console))
1218 + vc->vc_decor.state = 1;
1219 + vc_resize(vc, vc->vc_decor.twidth / vc->vc_font.width,
1220 + vc->vc_decor.theight / vc->vc_font.height);
1222 + if (fg_console == vc->vc_num) {
1223 + redraw_screen(vc, 0);
1224 + update_region(vc, vc->vc_origin +
1225 + vc->vc_size_row * vc->vc_top,
1226 + vc->vc_size_row * (vc->vc_bottom - vc->vc_top) / 2);
1227 + fbcon_decor_clear_margins(vc, info, 0);
1230 + printk(KERN_INFO "fbcondecor: switched decor state to 'on' on console %d\n",
1236 +static inline int fbcon_decor_ioctl_dosetstate(struct vc_data *vc, unsigned int __user* state, unsigned char origin)
1240 + if (get_user(tmp, state))
1243 + if (origin == FBCON_DECOR_IO_ORIG_USER)
1244 + acquire_console_sem();
1246 + ret = fbcon_decor_disable(vc, 1);
1248 + ret = fbcon_decor_enable(vc);
1249 + if (origin == FBCON_DECOR_IO_ORIG_USER)
1250 + release_console_sem();
1255 +static inline int fbcon_decor_ioctl_dogetstate(struct vc_data *vc, unsigned int __user *state)
1257 + return put_user(vc->vc_decor.state, (unsigned int __user*) state);
1260 +static int fbcon_decor_ioctl_dosetcfg(struct vc_data *vc, struct vc_decor __user *arg, unsigned char origin)
1262 + struct vc_decor cfg;
1263 + struct fb_info *info;
1267 + info = registered_fb[(int) con2fb_map[vc->vc_num]];
1269 + if (copy_from_user(&cfg, arg, sizeof(struct vc_decor)))
1271 + if (info == NULL || !cfg.twidth || !cfg.theight ||
1272 + cfg.tx + cfg.twidth > info->var.xres ||
1273 + cfg.ty + cfg.theight > info->var.yres)
1276 + len = strlen_user(cfg.theme);
1277 + if (!len || len > FBCON_DECOR_THEME_LEN)
1279 + tmp = kmalloc(len, GFP_KERNEL);
1282 + if (copy_from_user(tmp, (void __user *)cfg.theme, len))
1287 + /* If this ioctl is a response to a request from kernel, the console sem
1288 + * is already held; we also don't need to disable decor because either the
1289 + * new config and background picture will be successfully loaded, and the
1290 + * decor will stay on, or in case of a failure it'll be turned off in fbcon. */
1291 + if (origin == FBCON_DECOR_IO_ORIG_USER) {
1292 + acquire_console_sem();
1293 + if (vc->vc_decor.state)
1294 + fbcon_decor_disable(vc, 1);
1297 + if (vc->vc_decor.theme)
1298 + kfree(vc->vc_decor.theme);
1300 + vc->vc_decor = cfg;
1302 + if (origin == FBCON_DECOR_IO_ORIG_USER)
1303 + release_console_sem();
1305 + printk(KERN_INFO "fbcondecor: console %d using theme '%s'\n",
1306 + vc->vc_num, vc->vc_decor.theme);
1310 +static int fbcon_decor_ioctl_dogetcfg(struct vc_data *vc, struct vc_decor __user *arg)
1312 + struct vc_decor decor;
1315 + if (get_user(tmp, &arg->theme))
1318 + decor = vc->vc_decor;
1319 + decor.theme = tmp;
1321 + if (vc->vc_decor.theme) {
1322 + if (copy_to_user(tmp, vc->vc_decor.theme, strlen(vc->vc_decor.theme) + 1))
1325 + if (put_user(0, tmp))
1328 + if (copy_to_user(arg, &decor, sizeof(struct vc_decor)))
1334 +static int fbcon_decor_ioctl_dosetpic(struct vc_data *vc, struct fb_image __user *arg, unsigned char origin)
1336 + struct fb_image img;
1337 + struct fb_info *info;
1341 + if (vc->vc_num != fg_console)
1344 + info = registered_fb[(int) con2fb_map[vc->vc_num]];
1349 + if (copy_from_user(&img, arg, sizeof(struct fb_image)))
1352 + if (img.width != info->var.xres || img.height != info->var.yres) {
1353 + printk(KERN_ERR "fbcondecor: picture dimensions mismatch\n");
1357 + if (img.depth != info->var.bits_per_pixel) {
1358 + printk(KERN_ERR "fbcondecor: picture depth mismatch\n");
1362 + if (img.depth == 8) {
1363 + if (!img.cmap.len || !img.cmap.red || !img.cmap.green ||
1367 + tmp = vmalloc(img.cmap.len * 3 * 2);
1371 + if (copy_from_user(tmp, (void __user*)img.cmap.red, img.cmap.len * 2) ||
1372 + copy_from_user(tmp + (img.cmap.len << 1),
1373 + (void __user*)img.cmap.green, (img.cmap.len << 1)) ||
1374 + copy_from_user(tmp + (img.cmap.len << 2),
1375 + (void __user*)img.cmap.blue, (img.cmap.len << 1))) {
1380 + img.cmap.transp = NULL;
1381 + img.cmap.red = (u16*)tmp;
1382 + img.cmap.green = img.cmap.red + img.cmap.len;
1383 + img.cmap.blue = img.cmap.green + img.cmap.len;
1385 + img.cmap.red = NULL;
1388 + len = ((img.depth + 7) >> 3) * img.width * img.height;
1389 + tmp = vmalloc(len);
1394 + if (copy_from_user(tmp, (void __user*)img.data, len))
1399 + /* If this ioctl is a response to a request from kernel, the console sem
1400 + * is already held. */
1401 + if (origin == FBCON_DECOR_IO_ORIG_USER)
1402 + acquire_console_sem();
1404 + if (info->bgdecor.data)
1405 + vfree((u8*)info->bgdecor.data);
1406 + if (info->bgdecor.cmap.red)
1407 + vfree(info->bgdecor.cmap.red);
1409 + info->bgdecor = img;
1411 + if (origin == FBCON_DECOR_IO_ORIG_USER)
1412 + release_console_sem();
1416 +out: if (img.cmap.red)
1417 + vfree(img.cmap.red);
1423 +static int fbcon_decor_ioctl(struct inode * inode, struct file *filp, u_int cmd,
1426 + struct fbcon_decor_iowrapper __user *wrapper = (void __user*) arg;
1427 + struct vc_data *vc = NULL;
1428 + unsigned short vc_num = 0;
1429 + unsigned char origin = 0;
1430 + void __user *data = NULL;
1432 + if (!access_ok(VERIFY_READ, wrapper,
1433 + sizeof(struct fbcon_decor_iowrapper)))
1436 + __get_user(vc_num, &wrapper->vc);
1437 + __get_user(origin, &wrapper->origin);
1438 + __get_user(data, &wrapper->data);
1440 + if (!vc_cons_allocated(vc_num))
1443 + vc = vc_cons[vc_num].d;
1446 + case FBIOCONDECOR_SETPIC:
1447 + return fbcon_decor_ioctl_dosetpic(vc, (struct fb_image __user*)data, origin);
1448 + case FBIOCONDECOR_SETCFG:
1449 + return fbcon_decor_ioctl_dosetcfg(vc, (struct vc_decor*)data, origin);
1450 + case FBIOCONDECOR_GETCFG:
1451 + return fbcon_decor_ioctl_dogetcfg(vc, (struct vc_decor*)data);
1452 + case FBIOCONDECOR_SETSTATE:
1453 + return fbcon_decor_ioctl_dosetstate(vc, (unsigned int *)data, origin);
1454 + case FBIOCONDECOR_GETSTATE:
1455 + return fbcon_decor_ioctl_dogetstate(vc, (unsigned int *)data);
1457 + return -ENOIOCTLCMD;
1461 +static struct file_operations fbcon_decor_ops = {
1462 + .owner = THIS_MODULE,
1463 + .ioctl = fbcon_decor_ioctl
1466 +static struct miscdevice fbcon_decor_dev = {
1467 + .minor = MISC_DYNAMIC_MINOR,
1468 + .name = "fbcondecor",
1469 + .fops = &fbcon_decor_ops
1472 +void fbcon_decor_reset(void)
1474 + struct fb_info *info;
1475 + struct vc_data *vc;
1478 + vc = vc_cons[0].d;
1479 + info = registered_fb[0];
1481 + for (i = 0; i < num_registered_fb; i++) {
1482 + registered_fb[i]->bgdecor.data = NULL;
1483 + registered_fb[i]->bgdecor.cmap.red = NULL;
1486 + for (i = 0; i < MAX_NR_CONSOLES && vc_cons[i].d; i++) {
1487 + vc_cons[i].d->vc_decor.state = vc_cons[i].d->vc_decor.twidth =
1488 + vc_cons[i].d->vc_decor.theight = 0;
1489 + vc_cons[i].d->vc_decor.theme = NULL;
1495 +int fbcon_decor_init(void)
1499 + fbcon_decor_reset();
1504 + i = misc_register(&fbcon_decor_dev);
1506 + printk(KERN_ERR "fbcondecor: failed to register device\n");
1510 + fbcon_decor_call_helper("init", 0);
1515 +int fbcon_decor_exit(void)
1517 + fbcon_decor_reset();
1521 +EXPORT_SYMBOL(fbcon_decor_path);
1522 diff -Naurp -x .git /tmp/linux/drivers/video/console/fbcondecor.h ./drivers/video/console/fbcondecor.h
1523 --- /tmp/linux/drivers/video/console/fbcondecor.h 1970-01-01 01:00:00.000000000 +0100
1524 +++ ./drivers/video/console/fbcondecor.h 2008-03-25 23:04:10.000000000 +0100
1527 + * linux/drivers/video/console/fbcondecor.h -- Framebuffer Console Decoration headers
1529 + * Copyright (C) 2004 Michal Januszewski <spock@gentoo.org>
1533 +#ifndef __FBCON_DECOR_H
1534 +#define __FBCON_DECOR_H
1536 +#ifndef _LINUX_FB_H
1537 +#include <linux/fb.h>
1540 +/* This is needed for vc_cons in fbcmap.c */
1541 +#include <linux/vt_kern.h>
1547 +#ifdef CONFIG_FB_CON_DECOR
1549 +int fbcon_decor_init(void);
1550 +int fbcon_decor_exit(void);
1551 +int fbcon_decor_call_helper(char* cmd, unsigned short cons);
1552 +int fbcon_decor_disable(struct vc_data *vc, unsigned char redraw);
1554 +/* cfbcondecor.c */
1555 +void fbcon_decor_putcs(struct vc_data *vc, struct fb_info *info, const unsigned short *s, int count, int yy, int xx);
1556 +void fbcon_decor_cursor(struct fb_info *info, struct fb_cursor *cursor);
1557 +void fbcon_decor_clear(struct vc_data *vc, struct fb_info *info, int sy, int sx, int height, int width);
1558 +void fbcon_decor_clear_margins(struct vc_data *vc, struct fb_info *info, int bottom_only);
1559 +void fbcon_decor_blank(struct vc_data *vc, struct fb_info *info, int blank);
1560 +void fbcon_decor_bmove_redraw(struct vc_data *vc, struct fb_info *info, int y, int sx, int dx, int width);
1561 +void fbcon_decor_copy(u8 *dst, u8 *src, int height, int width, int linebytes, int srclinesbytes, int bpp);
1562 +void fbcon_decor_fix_pseudo_pal(struct fb_info *info, struct vc_data *vc);
1565 +void acquire_console_sem(void);
1566 +void release_console_sem(void);
1567 +void do_unblank_screen(int entering_gfx);
1569 +/* struct vc_data *y */
1570 +#define fbcon_decor_active_vc(y) (y->vc_decor.state && y->vc_decor.theme)
1572 +/* struct fb_info *x, struct vc_data *y */
1573 +#define fbcon_decor_active_nores(x,y) (x->bgdecor.data && fbcon_decor_active_vc(y))
1575 +/* struct fb_info *x, struct vc_data *y */
1576 +#define fbcon_decor_active(x,y) (fbcon_decor_active_nores(x,y) && \
1577 + x->bgdecor.width == x->var.xres && \
1578 + x->bgdecor.height == x->var.yres && \
1579 + x->bgdecor.depth == x->var.bits_per_pixel)
1582 +#else /* CONFIG_FB_CON_DECOR */
1584 +static inline void fbcon_decor_putcs(struct vc_data *vc, struct fb_info *info, const unsigned short *s, int count, int yy, int xx) {}
1585 +static inline void fbcon_decor_putc(struct vc_data *vc, struct fb_info *info, int c, int ypos, int xpos) {}
1586 +static inline void fbcon_decor_cursor(struct fb_info *info, struct fb_cursor *cursor) {}
1587 +static inline void fbcon_decor_clear(struct vc_data *vc, struct fb_info *info, int sy, int sx, int height, int width) {}
1588 +static inline void fbcon_decor_clear_margins(struct vc_data *vc, struct fb_info *info, int bottom_only) {}
1589 +static inline void fbcon_decor_blank(struct vc_data *vc, struct fb_info *info, int blank) {}
1590 +static inline void fbcon_decor_bmove_redraw(struct vc_data *vc, struct fb_info *info, int y, int sx, int dx, int width) {}
1591 +static inline void fbcon_decor_fix_pseudo_pal(struct fb_info *info, struct vc_data *vc) {}
1592 +static inline int fbcon_decor_call_helper(char* cmd, unsigned short cons) { return 0; }
1593 +static inline int fbcon_decor_init(void) { return 0; }
1594 +static inline int fbcon_decor_exit(void) { return 0; }
1595 +static inline int fbcon_decor_disable(struct vc_data *vc, unsigned char redraw) { return 0; }
1597 +#define fbcon_decor_active_vc(y) (0)
1598 +#define fbcon_decor_active_nores(x,y) (0)
1599 +#define fbcon_decor_active(x,y) (0)
1601 +#endif /* CONFIG_FB_CON_DECOR */
1603 +#endif /* __FBCON_DECOR_H */
1604 diff -Naurp -x .git /tmp/linux/drivers/video/console/Kconfig ./drivers/video/console/Kconfig
1605 --- /tmp/linux/drivers/video/console/Kconfig 2008-03-25 07:24:16.000000000 +0100
1606 +++ ./drivers/video/console/Kconfig 2008-03-25 23:04:10.000000000 +0100
1607 @@ -144,6 +144,19 @@ config FRAMEBUFFER_CONSOLE_ROTATION
1608 such that other users of the framebuffer will remain normally
1611 +config FB_CON_DECOR
1612 + bool "Support for the Framebuffer Console Decorations"
1613 + depends on FRAMEBUFFER_CONSOLE=y && !FB_TILEBLITTING
1616 + This option enables support for framebuffer console decorations which
1617 + makes it possible to display images in the background of the system
1618 + consoles. Note that userspace utilities are necessary in order to take
1619 + advantage of these features. Refer to Documentation/fb/fbcondecor.txt
1620 + for more information.
1625 bool "STI text console"
1627 diff -Naurp -x .git /tmp/linux/drivers/video/console/Makefile ./drivers/video/console/Makefile
1628 --- /tmp/linux/drivers/video/console/Makefile 2008-03-25 07:24:16.000000000 +0100
1629 +++ ./drivers/video/console/Makefile 2008-03-25 23:04:10.000000000 +0100
1630 @@ -35,6 +35,7 @@ obj-$(CONFIG_FRAMEBUFFER_CONSOLE) +=
1634 +obj-$(CONFIG_FB_CON_DECOR) += fbcondecor.o cfbcondecor.o
1635 obj-$(CONFIG_FB_STI) += sticore.o font.o
1637 ifeq ($(CONFIG_USB_SISUSBVGA_CON),y)
1638 diff -Naurp -x .git /tmp/linux/drivers/video/fbcmap.c ./drivers/video/fbcmap.c
1639 --- /tmp/linux/drivers/video/fbcmap.c 2008-03-25 07:24:16.000000000 +0100
1640 +++ ./drivers/video/fbcmap.c 2008-03-25 23:04:10.000000000 +0100
1642 #include <linux/slab.h>
1643 #include <linux/uaccess.h>
1645 +#include "console/fbcondecor.h"
1647 static u16 red2[] __read_mostly = {
1650 @@ -234,14 +236,17 @@ int fb_set_cmap(struct fb_cmap *cmap, st
1652 htransp = *transp++;
1653 if (info->fbops->fb_setcolreg(start++,
1654 - hred, hgreen, hblue,
1655 + hred, hgreen, hblue,
1662 fb_copy_cmap(cmap, &info->cmap);
1664 + if (fbcon_decor_active(info, vc_cons[fg_console].d) &&
1665 + info->fix.visual == FB_VISUAL_DIRECTCOLOR)
1666 + fbcon_decor_fix_pseudo_pal(info, vc_cons[fg_console].d);
1671 @@ -249,7 +254,7 @@ int fb_set_user_cmap(struct fb_cmap_user
1673 int rc, size = cmap->len * sizeof(u16);
1674 struct fb_cmap umap;
1677 if (cmap->start < 0 || (!info->fbops->fb_setcolreg &&
1678 !info->fbops->fb_setcmap))
1680 diff -Naurp -x .git /tmp/linux/drivers/video/Kconfig ./drivers/video/Kconfig
1681 --- /tmp/linux/drivers/video/Kconfig 2008-03-25 07:24:16.000000000 +0100
1682 +++ ./drivers/video/Kconfig 2008-03-25 23:04:10.000000000 +0100
1683 @@ -1134,7 +1134,6 @@ config FB_MATROX
1684 select FB_CFB_FILLRECT
1685 select FB_CFB_COPYAREA
1686 select FB_CFB_IMAGEBLIT
1687 - select FB_TILEBLITTING
1688 select FB_MACMODES if PPC_PMAC
1690 Say Y here if you have a Matrox Millennium, Matrox Millennium II,
1691 diff -Naurp -x .git /tmp/linux/include/linux/console_decor.h ./include/linux/console_decor.h
1692 --- /tmp/linux/include/linux/console_decor.h 1970-01-01 01:00:00.000000000 +0100
1693 +++ ./include/linux/console_decor.h 2008-03-25 23:04:10.000000000 +0100
1695 +#ifndef _LINUX_CONSOLE_DECOR_H_
1696 +#define _LINUX_CONSOLE_DECOR_H_ 1
1698 +/* A structure used by the framebuffer console decorations (drivers/video/console/fbcondecor.c) */
1700 + __u8 bg_color; /* The color that is to be treated as transparent */
1701 + __u8 state; /* Current decor state: 0 = off, 1 = on */
1702 + __u16 tx, ty; /* Top left corner coordinates of the text field */
1703 + __u16 twidth, theight; /* Width and height of the text field */
1708 diff -Naurp -x .git /tmp/linux/include/linux/console_struct.h ./include/linux/console_struct.h
1709 --- /tmp/linux/include/linux/console_struct.h 2008-03-25 07:24:16.000000000 +0100
1710 +++ ./include/linux/console_struct.h 2008-03-25 23:04:10.000000000 +0100
1715 +#include <linux/console_decor.h>
1718 unsigned short vc_num; /* Console number */
1719 @@ -106,6 +107,8 @@ struct vc_data {
1720 struct vc_data **vc_display_fg; /* [!] Ptr to var holding fg console for this display */
1721 unsigned long vc_uni_pagedir;
1722 unsigned long *vc_uni_pagedir_loc; /* [!] Location of uni_pagedir variable for this console */
1724 + struct vc_decor vc_decor;
1725 /* additional information is in vt_kern.h */
1728 diff -Naurp -x .git /tmp/linux/include/linux/fb.h ./include/linux/fb.h
1729 --- /tmp/linux/include/linux/fb.h 2008-03-25 07:24:16.000000000 +0100
1730 +++ ./include/linux/fb.h 2008-03-25 23:04:10.000000000 +0100
1731 @@ -11,6 +11,13 @@ struct dentry;
1733 #define FB_MAX 32 /* sufficient for now */
1735 +struct fbcon_decor_iowrapper
1737 + unsigned short vc; /* Virtual console */
1738 + unsigned char origin; /* Point of origin of the request */
1744 #define FBIOGET_VSCREENINFO 0x4600
1745 @@ -38,7 +45,15 @@ struct dentry;
1746 #define FBIOGET_HWCINFO 0x4616
1747 #define FBIOPUT_MODEINFO 0x4617
1748 #define FBIOGET_DISPINFO 0x4618
1750 +#define FBIOCONDECOR_SETCFG _IOWR('F', 0x19, struct fbcon_decor_iowrapper)
1751 +#define FBIOCONDECOR_GETCFG _IOR('F', 0x1A, struct fbcon_decor_iowrapper)
1752 +#define FBIOCONDECOR_SETSTATE _IOWR('F', 0x1B, struct fbcon_decor_iowrapper)
1753 +#define FBIOCONDECOR_GETSTATE _IOR('F', 0x1C, struct fbcon_decor_iowrapper)
1754 +#define FBIOCONDECOR_SETPIC _IOWR('F', 0x1D, struct fbcon_decor_iowrapper)
1756 +#define FBCON_DECOR_THEME_LEN 128 /* Maximum lenght of a theme name */
1757 +#define FBCON_DECOR_IO_ORIG_KERNEL 0 /* Kernel ioctl origin */
1758 +#define FBCON_DECOR_IO_ORIG_USER 1 /* User ioctl origin */
1760 #define FB_TYPE_PACKED_PIXELS 0 /* Packed Pixels */
1761 #define FB_TYPE_PLANES 1 /* Non interleaved planes */
1762 @@ -833,6 +848,9 @@ struct fb_info {
1763 #define FBINFO_STATE_SUSPENDED 1
1764 u32 state; /* Hardware state i.e suspend */
1765 void *fbcon_par; /* fbcon use-only private area */
1767 + struct fb_image bgdecor;
1769 /* From here on everything is device dependent */
1772 diff -Naurp -x .git /tmp/linux/include/linux/fb.h.rej ./include/linux/fb.h.rej
1773 --- /tmp/linux/include/linux/fb.h.rej 1970-01-01 01:00:00.000000000 +0100
1774 +++ ./include/linux/fb.h.rej 2006-08-21 02:51:22.000000000 +0200
1778 + #ifndef _LINUX_FB_H
1779 + #define _LINUX_FB_H
1781 +- #include <linux/backlight.h>
1782 + #include <asm/types.h>
1784 + /* Definitions of frame buffers */
1786 + #ifndef _LINUX_FB_H
1787 + #define _LINUX_FB_H
1789 + #include <asm/types.h>
1791 + /* Definitions of frame buffers */
1794 + #include <linux/workqueue.h>
1795 + #include <linux/notifier.h>
1796 + #include <linux/list.h>
1797 + #include <asm/io.h>
1799 + struct vm_area_struct;
1801 + #include <linux/workqueue.h>
1802 + #include <linux/notifier.h>
1803 + #include <linux/list.h>
1804 ++ #include <linux/backlight.h>
1805 + #include <asm/io.h>
1807 + struct vm_area_struct;
1808 diff -Naurp -x .git /tmp/linux/kernel/sysctl.c ./kernel/sysctl.c
1809 --- /tmp/linux/kernel/sysctl.c 2008-03-25 07:24:16.000000000 +0100
1810 +++ ./kernel/sysctl.c 2008-03-25 23:04:10.000000000 +0100
1811 @@ -107,6 +107,9 @@ static int ngroups_max = NGROUPS_MAX;
1813 extern char modprobe_path[];
1815 +#ifdef CONFIG_FB_CON_DECOR
1816 +extern char fbcon_decor_path[];
1818 #ifdef CONFIG_CHR_DEV_SG
1819 extern int sg_big_buff;
1821 @@ -820,6 +823,18 @@ static struct ctl_table kern_table[] = {
1822 .proc_handler = &proc_dostring,
1823 .strategy = &sysctl_string,
1825 +#ifdef CONFIG_FB_CON_DECOR
1827 + .ctl_name = CTL_UNNUMBERED,
1828 + .procname = "fbcondecor",
1829 + .data = &fbcon_decor_path,
1830 + .maxlen = KMOD_PATH_LEN,
1832 + .proc_handler = &proc_dostring,
1833 + .strategy = &sysctl_string,
1838 * NOTE: do not add new entries to this table unless you have read
1839 * Documentation/sysctl/ctl_unnumbered.txt