1 diff --git a/Documentation/fb/00-INDEX b/Documentation/fb/00-INDEX
2 index 92e89ae..a6cfacc 100644
3 --- a/Documentation/fb/00-INDEX
4 +++ b/Documentation/fb/00-INDEX
5 @@ -19,6 +19,8 @@ matroxfb.txt
6 - info on the Matrox frame buffer driver
8 - info on the PowerVR 2 frame buffer driver
10 + - info on the Framebuffer Splash
12 - info on the TGA (DECChip 21030) frame buffer driver
14 diff --git a/Documentation/fb/splash.txt b/Documentation/fb/splash.txt
16 index 0000000..6b281c9
18 +++ b/Documentation/fb/splash.txt
23 +The framebuffer splash is a kernel feature that allows displaying a background
24 +picture on selected consoles.
26 +What do I need to get it to work?
27 +---------------------------------
29 +To get fb splash up-and-running you will have to:
30 + 1) get a copy of splashutils [1] or a similar program
31 + 2) get some splash themes
32 + 3) build the kernel helper program
33 + 4) build your kernel with the FB_SPLASH option enabled.
35 +To get fbsplash operational right after fbcon initialization is finished, you
36 +will have to include a theme and the kernel helper into your initramfs image.
37 +Please refer to splashutils documentation for instructions on how to do that.
39 +[1] The splashutils package can be downloaded from:
40 + http://dev.gentoo.org/~spock/projects/splashutils/
45 +The userspace splash helper (by default: /sbin/splash_helper) is called by the
46 +kernel whenever an important event occurs and the kernel needs some kind of
47 +job to be carried out. Important events include console switches and video
48 +mode switches (the kernel requests background images and configuration
49 +parameters for the current console). The splash helper must be accessible at
50 +all times. If it's not, fbsplash will be switched off automatically.
52 +It's possible to set path to the splash helper by writing it to
53 +/proc/sys/kernel/fbsplash.
55 +*****************************************************************************
57 +The information below is mostly technical stuff. There's probably no need to
58 +read it unless you plan to develop a userspace helper.
63 +The splash protocol defines a communication interface between the kernel and
64 +the userspace splash helper.
66 +The kernel side is responsible for:
68 + * rendering console text, using an image as a background (instead of a
69 + standard solid color fbcon uses),
70 + * accepting commands from the user via ioctls on the fbsplash device,
71 + * calling the userspace helper to set things up as soon as the fb subsystem
74 +The userspace helper is responsible for everything else, including parsing
75 +configuration files, decompressing the image files whenever the kernel needs
76 +it, and communicating with the kernel if necessary.
78 +The splash protocol specifies how communication is done in both ways:
79 +kernel->userspace and userspace->helper.
84 +The kernel communicates with the userspace helper by calling it and specifying
85 +the task to be done in a series of arguments.
87 +The arguments follow the pattern:
88 +<splash protocol version> <command> <parameters>
90 +All commands defined in splash protocol v2 have the following parameters:
95 +Splash protocol v1 specified an additional 'fbsplash mode' after the
96 +framebuffer number. Splash protocol v1 is deprecated and should not be used.
98 +Splash protocol v2 specifies the following commands:
102 + The kernel issues this command to request image data. It's up to the
103 + userspace helper to find a background image appropriate for the specified
104 + theme and the current resolution. The userspace helper should respond by
105 + issuing the FBIOSPLASH_SETPIC ioctl.
109 + The kernel issues this command after the fbsplash device is created and
110 + the fbsplash interface is initialized. Upon receiving 'init', the userspace
111 + helper should parse the kernel command line (/proc/cmdline) or otherwise
112 + decide whether fbsplash is to be activated.
114 + To activate fbsplash on the first console the helper should issue the
115 + FBIOSPLASH_SETCFG, FBIOSPLASH_SETPIC and FBIOSPLASH_SETSTATE commands,
116 + in the above-mentioned order.
118 + When the userspace helper is called in an early phase of the boot process
119 + (right after the initialization of fbcon), no filesystems will be mounted.
120 + The helper program should mount sysfs and then create the appropriate
121 + framebuffer, fbsplash and tty0 devices (if they don't already exist) to get
122 + current display settings and to be able to communicate with the kernel side.
123 + It should probably also mount the procfs to be able to parse the kernel
124 + command line parameters.
126 + Note that the console sem is not held when the kernel calls splash_helper
127 + with the 'init' command. The splash helper should perform all ioctls with
128 + origin set to FB_SPLASH_IO_ORIG_USER.
132 + The kernel issues this command on a mode change. The helper's response should
133 + be similar to the response to the 'init' command. Note that this time the
134 + console sem is held and all ioctls must be performed with origin set to
135 + FB_SPLASH_IO_ORIG_KERNEL.
141 +Userspace programs can communicate with fbsplash via ioctls on the fbsplash
142 +device. These ioctls are to be used by both the userspace helper (called
143 +only by the kernel) and userspace configuration tools (run by the users).
145 +The splash helper should set the origin field to FB_SPLASH_IO_ORIG_KERNEL
146 +when doing the appropriate ioctls. All userspace configuration tools should
147 +use FB_SPLASH_IO_ORIG_USER. Failure to set the appropriate value in the origin
148 +field when performing ioctls from the kernel helper will most likely result
149 +in a console deadlock.
151 +FB_SPLASH_IO_ORIG_KERNEL instructs fbsplash not to try to acquire the console
152 +semaphore. Not surprisingly, FB_SPLASH_IO_ORIG_USER instructs it to acquire
155 +The framebuffer splash provides the following ioctls (all defined in
159 +description: loads a background picture for a virtual console
160 +argument: struct fb_splash_iowrapper*; data: struct fb_image*
162 +If called for consoles other than the current foreground one, the picture data
165 +If the current virtual console is running in a 8-bpp mode, the cmap substruct
166 +of fb_image has to be filled appropriately: start should be set to 16 (first
167 +16 colors are reserved for fbcon), len to a value <= 240 and red, green and
168 +blue should point to valid cmap data. The transp field is ingored. The fields
169 +dx, dy, bg_color, fg_color in fb_image are ignored as well.
172 +description: sets the fbsplash config for a virtual console
173 +argument: struct fb_splash_iowrapper*; data: struct vc_splash*
174 +notes: The structure has to be filled with valid data.
177 +description: gets the fbsplash config for a virtual console
178 +argument: struct fb_splash_iowrapper*; data: struct vc_splash*
181 +description: sets the fbsplash state for a virtual console
182 +argument: struct fb_splash_iowrapper*; data: unsigned int*
183 + values: 0 = disabled, 1 = enabled.
186 +description: gets the fbsplash state for a virtual console
187 +argument: struct fb_splash_iowrapper*; data: unsigned int*
188 + values: as in FBIOSPLASH_SETSTATE
190 +Info on used structures:
192 +Definition of struct vc_splash can be found in linux/console_splash.h. It's
193 +heavily commented. Note that the 'theme' field should point to a string
194 +no longer than FB_SPLASH_THEME_LEN. When FBIOSPLASH_GETCFG call is
195 +performed, the theme field should point to a char buffer of length
196 +FB_SPLASH_THEME_LEN.
198 +Definition of struct fb_splash_iowrapper can be found in linux/fb.h.
199 +The fields in this struct have the following meaning:
202 +Virtual console number.
205 +Specifies if the ioctl is performed as a response to a kernel request. The
206 +splash helper should set this field to FB_SPLASH_IO_ORIG_KERNEL, userspace
207 +programs should set it to FB_SPLASH_IO_ORIG_USER. This field is necessary to
208 +avoid console semaphore deadlocks.
211 +Pointer to a data structure appropriate for the performed ioctl. Type of
212 +the data struct is specified in the ioctls description.
214 +*****************************************************************************
219 +Original 'bootsplash' project & implementation by:
220 + Volker Poplawski <volker@poplawski.de>, Stefan Reinauer <stepan@suse.de>,
221 + Steffen Winterfeldt <snwint@suse.de>, Michael Schroeder <mls@suse.de>,
222 + Ken Wimer <wimer@suse.de>.
224 +Fbsplash, splash protocol design, current implementation & docs by:
225 + Michal Januszewski <spock@gentoo.org>
227 diff --git a/drivers/Makefile b/drivers/Makefile
228 index 4ac14da..84eb896 100644
229 --- a/drivers/Makefile
230 +++ b/drivers/Makefile
232 obj-$(CONFIG_PCI) += pci/
233 obj-$(CONFIG_PARISC) += parisc/
234 obj-$(CONFIG_RAPIDIO) += rapidio/
235 +# char/ comes before serial/ etc so that the VT console is the boot-time
239 obj-$(CONFIG_ACPI) += acpi/
240 # PnP must come after ACPI since it will eventually need to check if acpi
241 @@ -15,10 +18,6 @@ # was used and do nothing if so
242 obj-$(CONFIG_PNP) += pnp/
243 obj-$(CONFIG_ARM_AMBA) += amba/
245 -# char/ comes before serial/ etc so that the VT console is the boot-time
249 obj-$(CONFIG_CONNECTOR) += connector/
251 # i810fb and intelfb depend on char/agp/
252 diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
253 index 7a43020..8e93ff3 100644
254 --- a/drivers/video/Kconfig
255 +++ b/drivers/video/Kconfig
256 @@ -1644,5 +1644,15 @@ if SYSFS
257 source "drivers/video/backlight/Kconfig"
262 + bool "Support for the framebuffer splash"
263 + depends on FRAMEBUFFER_CONSOLE=y && !FB_TILEBLITTING
266 + This option enables support for the Linux boot-up splash screen and
267 + graphical backgrounds on consoles. Note that you will need userspace
268 + splash utilities in order to take advantage of these features. Refer
269 + to Documentation/fb/splash.txt for more information.
273 diff --git a/drivers/video/Makefile b/drivers/video/Makefile
274 index a6980e9..c8509fe 100644
275 --- a/drivers/video/Makefile
276 +++ b/drivers/video/Makefile
277 @@ -13,6 +13,7 @@ fb-objs := $(f
278 obj-$(CONFIG_VT) += console/
279 obj-$(CONFIG_LOGO) += logo/
280 obj-$(CONFIG_SYSFS) += backlight/
281 +obj-$(CONFIG_FB_SPLASH) += fbsplash.o cfbsplash.o
283 obj-$(CONFIG_FB_CFB_FILLRECT) += cfbfillrect.o
284 obj-$(CONFIG_FB_CFB_COPYAREA) += cfbcopyarea.o
285 diff --git a/drivers/video/cfbsplash.c b/drivers/video/cfbsplash.c
287 index 0000000..303cd6a
289 +++ b/drivers/video/cfbsplash.c
292 + * linux/drivers/video/cfbsplash.c -- Framebuffer splash render functions
294 + * Copyright (C) 2004 Michal Januszewski <spock@gentoo.org>
296 + * Code based upon "Bootsplash" (C) 2001-2003
297 + * Volker Poplawski <volker@poplawski.de>,
298 + * Stefan Reinauer <stepan@suse.de>,
299 + * Steffen Winterfeldt <snwint@suse.de>,
300 + * Michael Schroeder <mls@suse.de>,
301 + * Ken Wimer <wimer@suse.de>.
303 + * This file is subject to the terms and conditions of the GNU General Public
304 + * License. See the file COPYING in the main directory of this archive for
307 +#include <linux/module.h>
308 +#include <linux/types.h>
309 +#include <linux/fb.h>
310 +#include <linux/selection.h>
311 +#include <linux/vt_kern.h>
312 +#include <asm/irq.h>
313 +#include <asm/system.h>
315 +#include "console/fbcon.h"
316 +#include "fbsplash.h"
318 +#define parse_pixel(shift,bpp,type) \
320 + if (d & (0x80 >> (shift))) \
321 + dd2[(shift)] = fgx; \
323 + dd2[(shift)] = transparent ? *(type *)splash_src : bgx; \
324 + splash_src += (bpp); \
327 +extern int get_color(struct vc_data *vc, struct fb_info *info,
330 +void fbsplash_fix_pseudo_pal(struct fb_info *info, struct vc_data *vc)
333 + int minlen = min(min(info->var.red.length, info->var.green.length),
334 + info->var.blue.length);
337 + for (j = i = 0; i < 16; i++) {
338 + k = color_table[i];
340 + col = ((vc->vc_palette[j++] >> (8-minlen))
341 + << info->var.red.offset);
342 + col |= ((vc->vc_palette[j++] >> (8-minlen))
343 + << info->var.green.offset);
344 + col |= ((vc->vc_palette[j++] >> (8-minlen))
345 + << info->var.blue.offset);
346 + ((u32 *)info->pseudo_palette)[k] = col;
350 +void fbsplash_renderc(struct fb_info *info, int ypos, int xpos, int height,
351 + int width, u8* src, u32 fgx, u32 bgx, u8 transparent)
355 + int bytespp = ((info->var.bits_per_pixel + 7) >> 3);
356 + unsigned int d = ypos * info->fix.line_length + xpos * bytespp;
357 + unsigned int ds = (ypos * info->var.xres + xpos) * bytespp;
360 + u8* splash_src = (u8 *)(info->splash.data + ds);
361 + u8* dst = (u8 *)(info->screen_base + d);
363 + if ((ypos + height) > info->var.yres || (xpos + width) > info->var.xres)
366 + for (y = 0; y < height; y++) {
367 + switch (info->var.bits_per_pixel) {
370 + for (x = 0; x < width; x++) {
378 + *(u32 *)splash_src : bgx;
382 + fb_writel(dd, dst);
387 + for (x = 0; x < width; x++) {
395 + (*(u32 *)splash_src & 0xffffff) : bgx;
399 +#ifdef __LITTLE_ENDIAN
400 + fb_writew(dd & 0xffff, dst);
402 + fb_writeb((dd >> 16), dst);
404 + fb_writew(dd >> 8, dst);
406 + fb_writeb(dd & 0xff, dst);
412 + for (x = 0; x < width; x += 2) {
416 + parse_pixel(0, 2, u16);
417 + parse_pixel(1, 2, u16);
418 +#ifdef __LITTLE_ENDIAN
419 + dd = dd2[0] | (dd2[1] << 16);
421 + dd = dd2[1] | (dd2[0] << 16);
424 + fb_writel(dd, dst);
430 + for (x = 0; x < width; x += 4) {
434 + parse_pixel(0, 1, u8);
435 + parse_pixel(1, 1, u8);
436 + parse_pixel(2, 1, u8);
437 + parse_pixel(3, 1, u8);
439 +#ifdef __LITTLE_ENDIAN
440 + dd = dd2[0] | (dd2[1] << 8) | (dd2[2] << 16) | (dd2[3] << 24);
442 + dd = dd2[3] | (dd2[2] << 8) | (dd2[1] << 16) | (dd2[0] << 24);
445 + fb_writel(dd, dst);
450 + dst += info->fix.line_length - width * bytespp;
451 + splash_src += (info->var.xres - width) * bytespp;
456 + ((info->fix.visual == FB_VISUAL_TRUECOLOR || \
457 + info->fix.visual == FB_VISUAL_DIRECTCOLOR) ? \
458 + ((u32*)info->pseudo_palette)[a] : a)
460 +void fbsplash_putcs(struct vc_data *vc, struct fb_info *info,
461 + const unsigned short *s, int count, int yy, int xx)
463 + unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff;
464 + struct fbcon_ops *ops = info->fbcon_par;
465 + int fg_color, bg_color, transparent;
468 + u16 c = scr_readw(s);
470 + fg_color = get_color(vc, info, c, 1);
471 + bg_color = get_color(vc, info, c, 0);
473 + /* Don't paint the background image if console is blanked */
474 + transparent = ops->blank_state ? 0 :
475 + (vc->vc_splash.bg_color == bg_color);
477 + xx = xx * vc->vc_font.width + vc->vc_splash.tx;
478 + yy = yy * vc->vc_font.height + vc->vc_splash.ty;
480 + fgx = cc2cx(fg_color);
481 + bgx = cc2cx(bg_color);
484 + c = scr_readw(s++);
485 + src = vc->vc_font.data + (c & charmask) * vc->vc_font.height *
486 + ((vc->vc_font.width + 7) >> 3);
488 + fbsplash_renderc(info, yy, xx, vc->vc_font.height,
489 + vc->vc_font.width, src, fgx, bgx, transparent);
490 + xx += vc->vc_font.width;
494 +void fbsplash_cursor(struct fb_info *info, struct fb_cursor *cursor)
497 + unsigned int dsize, s_pitch;
498 + struct fbcon_ops *ops = info->fbcon_par;
499 + struct vc_data* vc;
502 + /* we really don't need any cursors while the console is blanked */
503 + if (info->state != FBINFO_STATE_RUNNING || ops->blank_state)
506 + vc = vc_cons[ops->currcon].d;
508 + src = kmalloc(64 + sizeof(struct fb_image), GFP_ATOMIC);
512 + s_pitch = (cursor->image.width + 7) >> 3;
513 + dsize = s_pitch * cursor->image.height;
514 + if (cursor->enable) {
515 + switch (cursor->rop) {
517 + for (i = 0; i < dsize; i++)
518 + src[i] = cursor->image.data[i] ^ cursor->mask[i];
522 + for (i = 0; i < dsize; i++)
523 + src[i] = cursor->image.data[i] & cursor->mask[i];
527 + memcpy(src, cursor->image.data, dsize);
529 + fbsplash_renderc(info,
530 + cursor->image.dy + vc->vc_splash.ty,
531 + cursor->image.dx + vc->vc_splash.tx,
532 + cursor->image.height,
533 + cursor->image.width,
535 + cc2cx(cursor->image.fg_color),
536 + cc2cx(cursor->image.bg_color),
537 + cursor->image.bg_color == vc->vc_splash.bg_color);
542 +static void splashset(u8 *dst, int height, int width, int dstbytes,
549 + if (bpp == 16 || bpp == 8)
552 + while (height-- > 0) {
558 + for (i=0; i < width; i++) {
559 + fb_writel(bgx, p); p += 4;
563 + for (i=0; i < width; i++) {
564 +#ifdef __LITTLE_ENDIAN
565 + fb_writew((bgx & 0xffff),(u16*)p); p += 2;
566 + fb_writeb((bgx >> 16),p++);
568 + fb_writew((bgx >> 8),(u16*)p); p += 2;
569 + fb_writeb((bgx & 0xff),p++);
573 + for (i=0; i < width/4; i++) {
574 + fb_writel(bgx,p); p += 4;
575 + fb_writel(bgx,p); p += 4;
578 + fb_writel(bgx,p); p += 4;
581 + fb_writew(bgx,(u16*)p);
584 + for (i=0; i < width/4; i++) {
585 + fb_writel(bgx,p); p += 4;
589 + fb_writew(bgx,p); p += 2;
592 + fb_writeb(bgx,(u8*)p);
600 +void fbsplash_copy(u8 *dst, u8 *src, int height, int width, int linebytes,
601 + int srclinebytes, int bpp)
605 + while (height-- > 0) {
606 + u32 *p = (u32 *)dst;
607 + u32 *q = (u32 *)src;
612 + for (i=0; i < width; i++)
613 + fb_writel(*q++, p++);
616 + for (i=0; i < (width*3/4); i++)
617 + fb_writel(*q++, p++);
618 + if ((width*3) % 4) {
620 + fb_writeb(*(u8*)q, (u8*)p);
621 + } else if (width & 1) {
622 + fb_writew(*(u16*)q, (u16*)p);
623 + fb_writeb(*(u8*)((u16*)q+1),(u8*)((u16*)p+2));
628 + for (i=0; i < width/4; i++) {
629 + fb_writel(*q++, p++);
630 + fb_writel(*q++, p++);
633 + fb_writel(*q++, p++);
635 + fb_writew(*(u16*)q, (u16*)p);
638 + for (i=0; i < width/4; i++)
639 + fb_writel(*q++, p++);
642 + fb_writew(*(u16*)q, (u16*)p);
643 + q = (u32*) ((u16*)q + 1);
644 + p = (u32*) ((u16*)p + 1);
647 + fb_writeb(*(u8*)q, (u8*)p);
652 + src += srclinebytes;
656 +static void splashfill(struct fb_info *info, int sy, int sx, int height,
659 + int bytespp = ((info->var.bits_per_pixel + 7) >> 3);
660 + int d = sy * info->fix.line_length + sx * bytespp;
661 + int ds = (sy * info->var.xres + sx) * bytespp;
663 + fbsplash_copy((u8 *)(info->screen_base + d), (u8 *)(info->splash.data + ds),
664 + height, width, info->fix.line_length, info->var.xres * bytespp,
665 + info->var.bits_per_pixel);
668 +void fbsplash_clear(struct vc_data *vc, struct fb_info *info, int sy, int sx,
669 + int height, int width)
671 + int bgshift = (vc->vc_hi_font_mask) ? 13 : 12;
672 + int bg_color = attr_bgcol_ec(bgshift, vc);
673 + int transparent = vc->vc_splash.bg_color == bg_color;
674 + struct fbcon_ops *ops = info->fbcon_par;
677 + sy = sy * vc->vc_font.height + vc->vc_splash.ty;
678 + sx = sx * vc->vc_font.width + vc->vc_splash.tx;
679 + height *= vc->vc_font.height;
680 + width *= vc->vc_font.width;
682 + /* Don't paint the background image if console is blanked */
683 + if (transparent && !ops->blank_state) {
684 + splashfill(info, sy, sx, height, width);
686 + dst = (u8 *)(info->screen_base + sy * info->fix.line_length +
687 + sx * ((info->var.bits_per_pixel + 7) >> 3));
688 + splashset(dst, height, width, info->fix.line_length, cc2cx(bg_color),
689 + info->var.bits_per_pixel);
693 +void fbsplash_clear_margins(struct vc_data *vc, struct fb_info *info,
696 + unsigned int tw = vc->vc_cols*vc->vc_font.width;
697 + unsigned int th = vc->vc_rows*vc->vc_font.height;
699 + if (!bottom_only) {
701 + splashfill(info, 0, 0, vc->vc_splash.ty, info->var.xres);
703 + splashfill(info, vc->vc_splash.ty, 0, th, vc->vc_splash.tx);
705 + splashfill(info, vc->vc_splash.ty, vc->vc_splash.tx + tw, th,
706 + info->var.xres - vc->vc_splash.tx - tw);
708 + splashfill(info, vc->vc_splash.ty + th, 0,
709 + info->var.yres - vc->vc_splash.ty - th, info->var.xres);
712 +void fbsplash_bmove_redraw(struct vc_data *vc, struct fb_info *info, int y,
713 + int sx, int dx, int width)
715 + u16 *d = (u16 *) (vc->vc_origin + vc->vc_size_row * y + dx * 2);
716 + u16 *s = d + (dx - sx);
719 + u16 *le = d + width;
726 + if (attr != (c & 0xff00)) {
729 + fbsplash_putcs(vc, info, start, d - start, y, x);
734 + if (s >= ls && s < le && c == scr_readw(s)) {
736 + fbsplash_putcs(vc, info, start, d - start, y, x);
737 + x += d - start + 1;
748 + fbsplash_putcs(vc, info, start, d - start, y, x);
751 +void fbsplash_blank(struct vc_data *vc, struct fb_info *info, int blank)
754 + splashset((u8 *)info->screen_base, info->var.yres, info->var.xres,
755 + info->fix.line_length, 0, info->var.bits_per_pixel);
758 + fbsplash_clear_margins(vc, info, 0);
762 diff --git a/drivers/video/console/bitblit.c b/drivers/video/console/bitblit.c
763 index 308850d..36a885c 100644
764 --- a/drivers/video/console/bitblit.c
765 +++ b/drivers/video/console/bitblit.c
766 @@ -17,6 +17,7 @@ #include <linux/vt_kern.h>
767 #include <linux/console.h>
768 #include <asm/types.h>
770 +#include "../fbsplash.h"
773 * Accelerated handlers.
774 @@ -54,6 +55,13 @@ static void bit_bmove(struct vc_data *vc
775 area.height = height * vc->vc_font.height;
776 area.width = width * vc->vc_font.width;
778 + if (fbsplash_active(info, vc)) {
779 + area.sx += vc->vc_splash.tx;
780 + area.sy += vc->vc_splash.ty;
781 + area.dx += vc->vc_splash.tx;
782 + area.dy += vc->vc_splash.ty;
785 info->fbops->fb_copyarea(info, &area);
788 @@ -379,11 +387,15 @@ static void bit_cursor(struct vc_data *v
789 cursor.image.depth = 1;
790 cursor.rop = ROP_XOR;
792 - if (info->fbops->fb_cursor)
793 - err = info->fbops->fb_cursor(info, &cursor);
794 + if (fbsplash_active(info, vc)) {
795 + fbsplash_cursor(info, &cursor);
797 + if (info->fbops->fb_cursor)
798 + err = info->fbops->fb_cursor(info, &cursor);
801 - soft_cursor(info, &cursor);
803 + soft_cursor(info, &cursor);
806 ops->cursor_reset = 0;
808 diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c
809 index 302174b..41fa9fc 100644
810 --- a/drivers/video/console/fbcon.c
811 +++ b/drivers/video/console/fbcon.c
812 @@ -91,6 +91,7 @@ #include <asm/setup.h>
816 +#include "../fbsplash.h"
819 # define DPRINTK(fmt, args...) printk(KERN_DEBUG "%s: " fmt, __FUNCTION__ , ## args)
820 @@ -106,7 +107,7 @@ enum {
822 static struct display fb_display[MAX_NR_CONSOLES];
824 -static signed char con2fb_map[MAX_NR_CONSOLES];
825 +signed char con2fb_map[MAX_NR_CONSOLES];
826 static signed char con2fb_map_boot[MAX_NR_CONSOLES];
827 static int logo_height;
828 static int logo_lines;
829 @@ -301,7 +302,7 @@ static inline int fbcon_is_inactive(stru
830 vc->vc_mode != KD_TEXT || ops->graphics);
833 -static inline int get_color(struct vc_data *vc, struct fb_info *info,
834 +inline int get_color(struct vc_data *vc, struct fb_info *info,
837 int depth = fb_get_color_depth(&info->var, &info->fix);
838 @@ -409,6 +410,7 @@ static void fb_flashcursor(void *private
840 ops->cursor(vc, info, mode, softback_lines, get_color(vc, info, c, 1),
841 get_color(vc, info, c, 0));
843 release_console_sem();
846 @@ -574,6 +576,8 @@ static int fbcon_takeover(int show_logo)
855 @@ -980,6 +984,12 @@ static const char *fbcon_startup(void)
856 rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres);
857 cols /= vc->vc_font.width;
858 rows /= vc->vc_font.height;
860 + if (fbsplash_active(info, vc)) {
861 + cols = vc->vc_splash.twidth / vc->vc_font.width;
862 + rows = vc->vc_splash.theight / vc->vc_font.height;
865 vc_resize(vc, cols, rows);
867 DPRINTK("mode: %s\n", info->fix.id);
868 @@ -1063,7 +1073,7 @@ static void fbcon_init(struct vc_data *v
871 if (vc != svc || logo_shown == FBCON_LOGO_DONTSHOW ||
872 - (info->fix.type == FB_TYPE_TEXT))
873 + (info->fix.type == FB_TYPE_TEXT) || fbsplash_active(info, vc))
876 if (var_to_display(p, &info->var, info))
877 @@ -1257,6 +1267,11 @@ static void fbcon_clear(struct vc_data *
878 if (!height || !width)
881 + if (fbsplash_active(info, vc)) {
882 + fbsplash_clear(vc, info, sy, sx, height, width);
886 /* Split blits that cross physical y_wrap boundary */
888 y_break = p->vrows - p->yscroll;
889 @@ -1276,10 +1291,15 @@ static void fbcon_putcs(struct vc_data *
890 struct display *p = &fb_display[vc->vc_num];
891 struct fbcon_ops *ops = info->fbcon_par;
893 - if (!fbcon_is_inactive(vc, info))
894 - ops->putcs(vc, info, s, count, real_y(p, ypos), xpos,
895 - get_color(vc, info, scr_readw(s), 1),
896 - get_color(vc, info, scr_readw(s), 0));
897 + if (!fbcon_is_inactive(vc, info)) {
899 + if (fbsplash_active(info, vc))
900 + fbsplash_putcs(vc, info, s, count, ypos, xpos);
902 + ops->putcs(vc, info, s, count, real_y(p, ypos), xpos,
903 + get_color(vc, info, scr_readw(s), 1),
904 + get_color(vc, info, scr_readw(s), 0));
908 static void fbcon_putc(struct vc_data *vc, int c, int ypos, int xpos)
909 @@ -1295,8 +1315,13 @@ static void fbcon_clear_margins(struct v
910 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
911 struct fbcon_ops *ops = info->fbcon_par;
913 - if (!fbcon_is_inactive(vc, info))
914 - ops->clear_margins(vc, info, bottom_only);
915 + if (!fbcon_is_inactive(vc, info)) {
916 + if (fbsplash_active(info, vc)) {
917 + fbsplash_clear_margins(vc, info, bottom_only);
919 + ops->clear_margins(vc, info, bottom_only);
924 static void fbcon_cursor(struct vc_data *vc, int mode)
925 @@ -1769,7 +1794,7 @@ static int fbcon_scroll(struct vc_data *
928 fbcon_softback_note(vc, t, count);
929 - if (logo_shown >= 0)
930 + if (logo_shown >= 0 || fbsplash_active(info, vc))
932 switch (p->scrollmode) {
934 @@ -1857,6 +1882,8 @@ static int fbcon_scroll(struct vc_data *
938 + if (fbsplash_active(info, vc))
940 switch (p->scrollmode) {
942 ops->bmove(vc, info, t, 0, t + count, 0,
943 @@ -1999,6 +2026,13 @@ static void fbcon_bmove_rec(struct vc_da
948 + if (fbsplash_active(info, vc) && sy == dy && height == 1) {
949 + /* must use slower redraw bmove to keep background pic intact */
950 + fbsplash_bmove_redraw(vc, info, sy, sx, dx, width);
954 ops->bmove(vc, info, real_y(p, sy), sx, real_y(p, dy), dx,
957 @@ -2069,8 +2103,9 @@ static int fbcon_resize(struct vc_data *
958 var.yres = virt_h * virt_fh;
959 x_diff = info->var.xres - var.xres;
960 y_diff = info->var.yres - var.yres;
961 - if (x_diff < 0 || x_diff > virt_fw ||
962 - y_diff < 0 || y_diff > virt_fh) {
964 + if ((x_diff < 0 || x_diff > virt_fw ||
965 + y_diff < 0 || y_diff > virt_fh) && !vc->vc_splash.state) {
966 struct fb_videomode *mode;
968 DPRINTK("attempting resize %ix%i\n", var.xres, var.yres);
969 @@ -2106,6 +2141,25 @@ static int fbcon_switch(struct vc_data *
971 info = registered_fb[con2fb_map[vc->vc_num]];
972 ops = info->fbcon_par;
973 + prev_console = ops->currcon;
974 + if (prev_console != -1)
975 + old_info = registered_fb[con2fb_map[prev_console]];
977 + if (fbsplash_active_vc(vc)) {
978 + struct vc_data *vc_curr = vc_cons[prev_console].d;
979 + if (!vc_curr->vc_splash.theme || strcmp(vc->vc_splash.theme, vc_curr->vc_splash.theme)) {
980 + if (fbsplash_call_helper("getpic", vc->vc_num))
981 + fbsplash_disable(vc, 0);
983 + } else if (info->fix.visual == FB_VISUAL_DIRECTCOLOR) {
984 + struct vc_data *vc_curr = vc_cons[prev_console].d;
985 + if (vc_curr && fbsplash_active_vc(vc_curr)) {
986 + /* Clear the screen to avoid displaying funky colors during
987 + * palette updates. */
988 + memset((u8*)info->screen_base + info->fix.line_length * info->var.yoffset,
989 + 0, info->var.yres * info->fix.line_length);
995 @@ -2124,9 +2178,6 @@ static int fbcon_switch(struct vc_data *
996 logo_shown = FBCON_LOGO_CANSHOW;
999 - prev_console = ops->currcon;
1000 - if (prev_console != -1)
1001 - old_info = registered_fb[con2fb_map[prev_console]];
1003 * FIXME: If we have multiple fbdev's loaded, we need to
1004 * update all info->currcon. Perhaps, we can place this
1005 @@ -2165,6 +2216,11 @@ static int fbcon_switch(struct vc_data *
1006 if (old_info != info)
1007 fbcon_del_cursor_timer(old_info);
1010 + if (fbsplash_active_nores(info, vc) && !fbsplash_active(info, vc)) {
1011 + if (fbsplash_call_helper("modechange", vc->vc_num))
1012 + fbsplash_disable(vc, 0);
1015 if (fbcon_is_inactive(vc, info) ||
1016 ops->blank_state != FB_BLANK_UNBLANK)
1017 @@ -2273,8 +2329,12 @@ static int fbcon_blank(struct vc_data *v
1018 fbcon_cursor(vc, blank ? CM_ERASE : CM_DRAW);
1019 ops->cursor_flash = (!blank);
1021 - if (fb_blank(info, blank))
1022 - fbcon_generic_blank(vc, info, blank);
1023 + if (fb_blank(info, blank)) {
1024 + if (fbsplash_active(info, vc))
1025 + fbsplash_blank(vc, info, blank);
1027 + fbcon_generic_blank(vc, info, blank);
1032 @@ -2425,13 +2485,22 @@ static int fbcon_do_set_font(struct vc_d
1036 + /* reset wrap/pan */
1039 cols = FBCON_SWAP(ops->rotate, info->var.xres, info->var.yres);
1040 rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres);
1042 + info->var.xoffset = info->var.yoffset = p->yscroll = 0;
1043 + if (fbsplash_active(info, vc)) {
1044 + cols = vc->vc_splash.twidth;
1045 + rows = vc->vc_splash.theight;
1050 vc_resize(vc, cols, rows);
1052 if (CON_IS_VISIBLE(vc) && softback_buf)
1053 fbcon_update_softback(vc);
1054 } else if (CON_IS_VISIBLE(vc)
1055 @@ -2549,7 +2618,7 @@ static int fbcon_set_palette(struct vc_d
1059 - if (fbcon_is_inactive(vc, info))
1060 + if (fbcon_is_inactive(vc, info) || vc->vc_num != fg_console)
1063 if (!CON_IS_VISIBLE(vc))
1064 @@ -2575,7 +2644,49 @@ static int fbcon_set_palette(struct vc_d
1066 fb_copy_cmap(fb_default_cmap(1 << depth), &palette_cmap);
1068 - return fb_set_cmap(&palette_cmap, info);
1069 + if (fbsplash_active(info, vc_cons[fg_console].d) &&
1070 + info->fix.visual == FB_VISUAL_DIRECTCOLOR) {
1072 + u16 *red, *green, *blue;
1073 + int minlen = min(min(info->var.red.length, info->var.green.length),
1074 + info->var.blue.length);
1077 + struct fb_cmap cmap = {
1079 + .len = (1 << minlen),
1086 + red = kmalloc(256 * sizeof(u16) * 3, GFP_KERNEL);
1091 + green = red + 256;
1092 + blue = green + 256;
1094 + cmap.green = green;
1097 + for (i = 0; i < cmap.len; i++) {
1098 + red[i] = green[i] = blue[i] = (0xffff * i)/(cmap.len-1);
1101 + h = fb_set_cmap(&cmap, info);
1102 + fbsplash_fix_pseudo_pal(info, vc_cons[fg_console].d);
1107 + } else if (fbsplash_active(info, vc_cons[fg_console].d) &&
1108 + info->var.bits_per_pixel == 8 && info->splash.cmap.red != NULL)
1109 + fb_set_cmap(&info->splash.cmap, info);
1111 +out: return fb_set_cmap(&palette_cmap, info);
1114 static u16 *fbcon_screen_pos(struct vc_data *vc, int offset)
1115 @@ -2801,7 +2912,14 @@ static void fbcon_modechanged(struct fb_
1116 rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres);
1117 cols /= vc->vc_font.width;
1118 rows /= vc->vc_font.height;
1119 - vc_resize(vc, cols, rows);
1121 + if (!fbsplash_active_nores(info, vc)) {
1122 + vc_resize(vc, cols, rows);
1124 + if (fbsplash_call_helper("modechange", vc->vc_num))
1125 + fbsplash_disable(vc, 0);
1128 updatescrollmode(p, info, vc);
1130 scrollback_current = 0;
1131 @@ -3259,6 +3377,7 @@ #endif
1136 fbcon_has_exited = 1;
1139 diff --git a/drivers/video/fbcmap.c b/drivers/video/fbcmap.c
1140 index e8b135f..8622d74 100644
1141 --- a/drivers/video/fbcmap.c
1142 +++ b/drivers/video/fbcmap.c
1143 @@ -15,6 +15,7 @@ #include <linux/string.h>
1144 #include <linux/module.h>
1145 #include <linux/fb.h>
1146 #include <linux/slab.h>
1147 +#include "fbsplash.h"
1149 #include <asm/uaccess.h>
1151 @@ -234,14 +235,17 @@ int fb_set_cmap(struct fb_cmap *cmap, st
1153 htransp = *transp++;
1154 if (info->fbops->fb_setcolreg(start++,
1155 - hred, hgreen, hblue,
1156 + hred, hgreen, hblue,
1163 fb_copy_cmap(cmap, &info->cmap);
1165 + if (fbsplash_active(info, vc_cons[fg_console].d) &&
1166 + info->fix.visual == FB_VISUAL_DIRECTCOLOR)
1167 + fbsplash_fix_pseudo_pal(info, vc_cons[fg_console].d);
1172 @@ -249,7 +253,7 @@ int fb_set_user_cmap(struct fb_cmap_user
1174 int rc, size = cmap->len * sizeof(u16);
1175 struct fb_cmap umap;
1178 if (cmap->start < 0 || (!info->fbops->fb_setcolreg &&
1179 !info->fbops->fb_setcmap))
1181 diff --git a/drivers/video/fbsplash.c b/drivers/video/fbsplash.c
1182 new file mode 100644
1183 index 0000000..75d8db8
1185 +++ b/drivers/video/fbsplash.c
1188 + * linux/drivers/video/fbsplash.c -- Framebuffer splash routines
1190 + * Copyright (C) 2004 Michal Januszewski <spock@gentoo.org>
1192 + * Code based upon "Bootsplash" (C) 2001-2003
1193 + * Volker Poplawski <volker@poplawski.de>,
1194 + * Stefan Reinauer <stepan@suse.de>,
1195 + * Steffen Winterfeldt <snwint@suse.de>,
1196 + * Michael Schroeder <mls@suse.de>,
1197 + * Ken Wimer <wimer@suse.de>.
1199 + * Splash render routines are located in /linux/drivers/video/cfbsplash.c
1201 + * This file is subject to the terms and conditions of the GNU General Public
1202 + * License. See the file COPYING in the main directory of this archive for
1206 +#include <linux/module.h>
1207 +#include <linux/kernel.h>
1208 +#include <linux/string.h>
1209 +#include <linux/types.h>
1210 +#include <linux/fb.h>
1211 +#include <linux/vt_kern.h>
1212 +#include <linux/vmalloc.h>
1213 +#include <linux/unistd.h>
1214 +#include <linux/syscalls.h>
1215 +#include <linux/init.h>
1216 +#include <linux/proc_fs.h>
1217 +#include <linux/workqueue.h>
1218 +#include <linux/kmod.h>
1219 +#include <linux/miscdevice.h>
1220 +#include <linux/device.h>
1221 +#include <linux/fs.h>
1223 +#include <asm/uaccess.h>
1224 +#include <asm/irq.h>
1225 +#include <asm/system.h>
1227 +#include "console/fbcon.h"
1228 +#include "fbsplash.h"
1230 +#define SPLASH_VERSION "0.9.2"
1232 +extern signed char con2fb_map[];
1233 +static int fbsplash_enable(struct vc_data *vc);
1234 +char fbsplash_path[KMOD_PATH_LEN] = "/sbin/splash_helper";
1235 +static int initialized = 0;
1237 +int fbsplash_call_helper(char* cmd, unsigned short vc)
1241 + "PATH=/sbin:/bin",
1247 + unsigned char fb = (int) con2fb_map[vc];
1255 + vc_cons[vc].d->vc_splash.theme,
1259 + snprintf(tfb,5,"%d",fb);
1260 + snprintf(tcons,5,"%d",vc);
1262 + return call_usermodehelper(fbsplash_path, argv, envp, 1);
1265 +/* Disables fbsplash on a virtual console; called with console sem held. */
1266 +int fbsplash_disable(struct vc_data *vc, unsigned char redraw)
1268 + struct fb_info* info;
1270 + if (!vc->vc_splash.state)
1273 + info = registered_fb[(int) con2fb_map[vc->vc_num]];
1278 + vc->vc_splash.state = 0;
1279 + vc_resize(vc, info->var.xres / vc->vc_font.width,
1280 + info->var.yres / vc->vc_font.height);
1282 + if (fg_console == vc->vc_num && redraw) {
1283 + redraw_screen(vc, 0);
1284 + update_region(vc, vc->vc_origin +
1285 + vc->vc_size_row * vc->vc_top,
1286 + vc->vc_size_row * (vc->vc_bottom - vc->vc_top) / 2);
1289 + printk(KERN_INFO "fbsplash: switched splash state to 'off' on console %d\n",
1295 +/* Enables fbsplash on a virtual console; called with console sem held. */
1296 +static int fbsplash_enable(struct vc_data *vc)
1298 + struct fb_info* info;
1300 + info = registered_fb[(int) con2fb_map[vc->vc_num]];
1302 + if (vc->vc_splash.twidth == 0 || vc->vc_splash.theight == 0 ||
1303 + info == NULL || vc->vc_splash.state || (!info->splash.data &&
1304 + vc->vc_num == fg_console))
1307 + vc->vc_splash.state = 1;
1308 + vc_resize(vc, vc->vc_splash.twidth / vc->vc_font.width,
1309 + vc->vc_splash.theight / vc->vc_font.height);
1311 + if (fg_console == vc->vc_num) {
1312 + redraw_screen(vc, 0);
1313 + update_region(vc, vc->vc_origin +
1314 + vc->vc_size_row * vc->vc_top,
1315 + vc->vc_size_row * (vc->vc_bottom - vc->vc_top) / 2);
1316 + fbsplash_clear_margins(vc, info, 0);
1319 + printk(KERN_INFO "fbsplash: switched splash state to 'on' on console %d\n",
1325 +static inline int fbsplash_ioctl_dosetstate(struct vc_data *vc, unsigned int __user* state, unsigned char origin)
1329 + if (get_user(tmp, state))
1332 + if (origin == FB_SPLASH_IO_ORIG_USER)
1333 + acquire_console_sem();
1335 + ret = fbsplash_disable(vc, 1);
1337 + ret = fbsplash_enable(vc);
1338 + if (origin == FB_SPLASH_IO_ORIG_USER)
1339 + release_console_sem();
1344 +static inline int fbsplash_ioctl_dogetstate(struct vc_data *vc, unsigned int __user *state)
1346 + return put_user(vc->vc_splash.state, (unsigned int __user*) state);
1349 +static int fbsplash_ioctl_dosetcfg(struct vc_data *vc, struct vc_splash __user *arg, unsigned char origin)
1351 + struct vc_splash cfg;
1352 + struct fb_info *info;
1356 + info = registered_fb[(int) con2fb_map[vc->vc_num]];
1358 + if (copy_from_user(&cfg, arg, sizeof(struct vc_splash)))
1360 + if (info == NULL || !cfg.twidth || !cfg.theight ||
1361 + cfg.tx + cfg.twidth > info->var.xres ||
1362 + cfg.ty + cfg.theight > info->var.yres)
1365 + len = strlen_user(cfg.theme);
1366 + if (!len || len > FB_SPLASH_THEME_LEN)
1368 + tmp = kmalloc(len, GFP_KERNEL);
1371 + if (copy_from_user(tmp, (void __user *)cfg.theme, len))
1376 + /* If this ioctl is a response to a request from kernel, the console sem
1377 + * is already held; we also don't need to disable splash because either the
1378 + * new config and background picture will be successfully loaded, and the
1379 + * splash will stay on, or in case of a failure it'll be turned off in fbcon. */
1380 + if (origin == FB_SPLASH_IO_ORIG_USER) {
1381 + acquire_console_sem();
1382 + if (vc->vc_splash.state)
1383 + fbsplash_disable(vc, 1);
1386 + if (vc->vc_splash.theme)
1387 + kfree(vc->vc_splash.theme);
1389 + vc->vc_splash = cfg;
1391 + if (origin == FB_SPLASH_IO_ORIG_USER)
1392 + release_console_sem();
1394 + printk(KERN_INFO "fbsplash: console %d using theme '%s'\n",
1395 + vc->vc_num, vc->vc_splash.theme);
1399 +static int fbsplash_ioctl_dogetcfg(struct vc_data *vc, struct vc_splash __user *arg)
1401 + struct vc_splash splash;
1404 + if (get_user(tmp, &arg->theme))
1407 + splash = vc->vc_splash;
1408 + splash.theme = tmp;
1410 + if (vc->vc_splash.theme) {
1411 + if (copy_to_user(tmp, vc->vc_splash.theme, strlen(vc->vc_splash.theme) + 1))
1414 + if (put_user(0, tmp))
1417 + if (copy_to_user(arg, &splash, sizeof(struct vc_splash)))
1423 +static int fbsplash_ioctl_dosetpic(struct vc_data *vc, struct fb_image __user *arg, unsigned char origin)
1425 + struct fb_image img;
1426 + struct fb_info *info;
1430 + if (vc->vc_num != fg_console)
1433 + info = registered_fb[(int) con2fb_map[vc->vc_num]];
1438 + if (copy_from_user(&img, arg, sizeof(struct fb_image)))
1441 + if (img.width != info->var.xres || img.height != info->var.yres) {
1442 + printk(KERN_ERR "fbsplash: picture dimensions mismatch\n");
1446 + if (img.depth != info->var.bits_per_pixel) {
1447 + printk(KERN_ERR "fbsplash: picture depth mismatch\n");
1451 + if (img.depth == 8) {
1452 + if (!img.cmap.len || !img.cmap.red || !img.cmap.green ||
1456 + tmp = vmalloc(img.cmap.len * 3 * 2);
1460 + if (copy_from_user(tmp, (void __user*)img.cmap.red, img.cmap.len * 2) ||
1461 + copy_from_user(tmp + (img.cmap.len << 1),
1462 + (void __user*)img.cmap.green, (img.cmap.len << 1)) ||
1463 + copy_from_user(tmp + (img.cmap.len << 2),
1464 + (void __user*)img.cmap.blue, (img.cmap.len << 1))) {
1469 + img.cmap.transp = NULL;
1470 + img.cmap.red = (u16*)tmp;
1471 + img.cmap.green = img.cmap.red + img.cmap.len;
1472 + img.cmap.blue = img.cmap.green + img.cmap.len;
1474 + img.cmap.red = NULL;
1477 + len = ((img.depth + 7) >> 3) * img.width * img.height;
1478 + tmp = vmalloc(len);
1483 + if (copy_from_user(tmp, (void __user*)img.data, len))
1488 + /* If this ioctl is a response to a request from kernel, the console sem
1489 + * is already held. */
1490 + if (origin == FB_SPLASH_IO_ORIG_USER)
1491 + acquire_console_sem();
1493 + if (info->splash.data)
1494 + vfree((u8*)info->splash.data);
1495 + if (info->splash.cmap.red)
1496 + vfree(info->splash.cmap.red);
1498 + info->splash = img;
1500 + if (origin == FB_SPLASH_IO_ORIG_USER)
1501 + release_console_sem();
1505 +out: if (img.cmap.red)
1506 + vfree(img.cmap.red);
1512 +static int splash_ioctl(struct inode * inode, struct file *filp, u_int cmd,
1515 + struct fb_splash_iowrapper __user *wrapper = (void __user*) arg;
1516 + struct vc_data *vc = NULL;
1517 + unsigned short vc_num = 0;
1518 + unsigned char origin = 0;
1519 + void __user *data = NULL;
1521 + if (!access_ok(VERIFY_READ, wrapper,
1522 + sizeof(struct fb_splash_iowrapper)))
1525 + __get_user(vc_num, &wrapper->vc);
1526 + __get_user(origin, &wrapper->origin);
1527 + __get_user(data, &wrapper->data);
1529 + if (!vc_cons_allocated(vc_num))
1532 + vc = vc_cons[vc_num].d;
1535 + case FBIOSPLASH_SETPIC:
1536 + return fbsplash_ioctl_dosetpic(vc, (struct fb_image __user*)data, origin);
1537 + case FBIOSPLASH_SETCFG:
1538 + return fbsplash_ioctl_dosetcfg(vc, (struct vc_splash*)data, origin);
1539 + case FBIOSPLASH_GETCFG:
1540 + return fbsplash_ioctl_dogetcfg(vc, (struct vc_splash*)data);
1541 + case FBIOSPLASH_SETSTATE:
1542 + return fbsplash_ioctl_dosetstate(vc, (unsigned int *)data, origin);
1543 + case FBIOSPLASH_GETSTATE:
1544 + return fbsplash_ioctl_dogetstate(vc, (unsigned int *)data);
1546 + return -ENOIOCTLCMD;
1550 +static struct file_operations splash_ops = {
1551 + .owner = THIS_MODULE,
1552 + .ioctl = splash_ioctl
1555 +static struct miscdevice splash_dev = {
1556 + .minor = MISC_DYNAMIC_MINOR,
1557 + .name = "fbsplash",
1558 + .fops = &splash_ops
1561 +void fbsplash_reset(void)
1563 + struct fb_info *info;
1564 + struct vc_data *vc;
1567 + vc = vc_cons[0].d;
1568 + info = registered_fb[0];
1570 + for (i = 0; i < num_registered_fb; i++) {
1571 + registered_fb[i]->splash.data = NULL;
1572 + registered_fb[i]->splash.cmap.red = NULL;
1575 + for (i = 0; i < MAX_NR_CONSOLES && vc_cons[i].d; i++) {
1576 + vc_cons[i].d->vc_splash.state = vc_cons[i].d->vc_splash.twidth =
1577 + vc_cons[i].d->vc_splash.theight = 0;
1578 + vc_cons[i].d->vc_splash.theme = NULL;
1584 +int fbsplash_init(void)
1593 + i = misc_register(&splash_dev);
1595 + printk(KERN_ERR "fbsplash: failed to register device\n");
1599 + fbsplash_call_helper("init", 0);
1604 +int fbsplash_exit(void)
1610 +EXPORT_SYMBOL(fbsplash_path);
1611 diff --git a/drivers/video/fbsplash.h b/drivers/video/fbsplash.h
1612 new file mode 100644
1613 index 0000000..cb9398f
1615 +++ b/drivers/video/fbsplash.h
1618 + * linux/drivers/video/fbsplash.h -- Framebuffer splash headers
1620 + * Copyright (C) 2004 Michal Januszewski <spock@gentoo.org>
1624 +#ifndef __FB_SPLASH_H
1625 +#define __FB_SPLASH_H
1627 +#ifndef _LINUX_FB_H
1628 +#include <linux/fb.h>
1631 +/* This is needed for vc_cons in fbcmap.c */
1632 +#include <linux/vt_kern.h>
1638 +#ifdef CONFIG_FB_SPLASH
1640 +int fbsplash_init(void);
1641 +int fbsplash_exit(void);
1642 +int fbsplash_call_helper(char* cmd, unsigned short cons);
1643 +int fbsplash_disable(struct vc_data *vc, unsigned char redraw);
1646 +void fbsplash_putcs(struct vc_data *vc, struct fb_info *info, const unsigned short *s, int count, int yy, int xx);
1647 +void fbsplash_cursor(struct fb_info *info, struct fb_cursor *cursor);
1648 +void fbsplash_clear(struct vc_data *vc, struct fb_info *info, int sy, int sx, int height, int width);
1649 +void fbsplash_clear_margins(struct vc_data *vc, struct fb_info *info, int bottom_only);
1650 +void fbsplash_blank(struct vc_data *vc, struct fb_info *info, int blank);
1651 +void fbsplash_bmove_redraw(struct vc_data *vc, struct fb_info *info, int y, int sx, int dx, int width);
1652 +void fbsplash_copy(u8 *dst, u8 *src, int height, int width, int linebytes, int srclinesbytes, int bpp);
1653 +void fbsplash_fix_pseudo_pal(struct fb_info *info, struct vc_data *vc);
1656 +void acquire_console_sem(void);
1657 +void release_console_sem(void);
1658 +void do_unblank_screen(int entering_gfx);
1660 +/* struct vc_data *y */
1661 +#define fbsplash_active_vc(y) (y->vc_splash.state && y->vc_splash.theme)
1663 +/* struct fb_info *x, struct vc_data *y */
1664 +#define fbsplash_active_nores(x,y) (x->splash.data && fbsplash_active_vc(y))
1666 +/* struct fb_info *x, struct vc_data *y */
1667 +#define fbsplash_active(x,y) (fbsplash_active_nores(x,y) && \
1668 + x->splash.width == x->var.xres && \
1669 + x->splash.height == x->var.yres && \
1670 + x->splash.depth == x->var.bits_per_pixel)
1673 +#else /* CONFIG_FB_SPLASH */
1675 +static inline void fbsplash_putcs(struct vc_data *vc, struct fb_info *info, const unsigned short *s, int count, int yy, int xx) {}
1676 +static inline void fbsplash_putc(struct vc_data *vc, struct fb_info *info, int c, int ypos, int xpos) {}
1677 +static inline void fbsplash_cursor(struct fb_info *info, struct fb_cursor *cursor) {}
1678 +static inline void fbsplash_clear(struct vc_data *vc, struct fb_info *info, int sy, int sx, int height, int width) {}
1679 +static inline void fbsplash_clear_margins(struct vc_data *vc, struct fb_info *info, int bottom_only) {}
1680 +static inline void fbsplash_blank(struct vc_data *vc, struct fb_info *info, int blank) {}
1681 +static inline void fbsplash_bmove_redraw(struct vc_data *vc, struct fb_info *info, int y, int sx, int dx, int width) {}
1682 +static inline void fbsplash_fix_pseudo_pal(struct fb_info *info, struct vc_data *vc) {}
1683 +static inline int fbsplash_call_helper(char* cmd, unsigned short cons) { return 0; }
1684 +static inline int fbsplash_init(void) { return 0; }
1685 +static inline int fbsplash_exit(void) { return 0; }
1686 +static inline int fbsplash_disable(struct vc_data *vc, unsigned char redraw) { return 0; }
1688 +#define fbsplash_active_vc(y) (0)
1689 +#define fbsplash_active_nores(x,y) (0)
1690 +#define fbsplash_active(x,y) (0)
1692 +#endif /* CONFIG_FB_SPLASH */
1694 +#endif /* __FB_SPLASH_H */
1695 diff --git a/include/linux/console_splash.h b/include/linux/console_splash.h
1696 new file mode 100644
1697 index 0000000..c448dd2
1699 +++ b/include/linux/console_splash.h
1701 +#ifndef _LINUX_CONSOLE_SPLASH_H_
1702 +#define _LINUX_CONSOLE_SPLASH_H_ 1
1704 +/* A structure used by the framebuffer splash code (drivers/video/fbsplash.c) */
1706 + __u8 bg_color; /* The color that is to be treated as transparent */
1707 + __u8 state; /* Current splash state: 0 = off, 1 = on */
1708 + __u16 tx, ty; /* Top left corner coordinates of the text field */
1709 + __u16 twidth, theight; /* Width and height of the text field */
1714 diff --git a/include/linux/console_struct.h b/include/linux/console_struct.h
1715 index ed6c0fe..b0cbdfe 100644
1716 --- a/include/linux/console_struct.h
1717 +++ b/include/linux/console_struct.h
1718 @@ -15,6 +15,7 @@ #include <linux/vt.h>
1722 +#include <linux/console_splash.h>
1725 unsigned short vc_num; /* Console number */
1726 @@ -98,6 +99,8 @@ struct vc_data {
1727 struct vc_data **vc_display_fg; /* [!] Ptr to var holding fg console for this display */
1728 unsigned long vc_uni_pagedir;
1729 unsigned long *vc_uni_pagedir_loc; /* [!] Location of uni_pagedir variable for this console */
1731 + struct vc_splash vc_splash;
1732 /* additional information is in vt_kern.h */
1735 diff --git a/include/linux/fb.h b/include/linux/fb.h
1736 index 3e69241..8178427 100644
1737 --- a/include/linux/fb.h
1738 +++ b/include/linux/fb.h
1739 @@ -9,6 +9,13 @@ #include <linux/i2c.h>
1741 #define FB_MAX 32 /* sufficient for now */
1743 +struct fb_splash_iowrapper
1745 + unsigned short vc; /* Virtual console */
1746 + unsigned char origin; /* Point of origin of the request */
1752 #define FBIOGET_VSCREENINFO 0x4600
1753 @@ -36,7 +43,15 @@ #define FBIOGET_GLYPH 0x4615
1754 #define FBIOGET_HWCINFO 0x4616
1755 #define FBIOPUT_MODEINFO 0x4617
1756 #define FBIOGET_DISPINFO 0x4618
1757 +#define FBIOSPLASH_SETCFG _IOWR('F', 0x19, struct fb_splash_iowrapper)
1758 +#define FBIOSPLASH_GETCFG _IOR('F', 0x1A, struct fb_splash_iowrapper)
1759 +#define FBIOSPLASH_SETSTATE _IOWR('F', 0x1B, struct fb_splash_iowrapper)
1760 +#define FBIOSPLASH_GETSTATE _IOR('F', 0x1C, struct fb_splash_iowrapper)
1761 +#define FBIOSPLASH_SETPIC _IOWR('F', 0x1D, struct fb_splash_iowrapper)
1763 +#define FB_SPLASH_THEME_LEN 128 /* Maximum lenght of a theme name */
1764 +#define FB_SPLASH_IO_ORIG_KERNEL 0 /* Kernel ioctl origin */
1765 +#define FB_SPLASH_IO_ORIG_USER 1 /* User ioctl origin */
1767 #define FB_TYPE_PACKED_PIXELS 0 /* Packed Pixels */
1768 #define FB_TYPE_PLANES 1 /* Non interleaved planes */
1769 @@ -787,6 +802,9 @@ #define FBINFO_STATE_RUNNING 0
1770 #define FBINFO_STATE_SUSPENDED 1
1771 u32 state; /* Hardware state i.e suspend */
1772 void *fbcon_par; /* fbcon use-only private area */
1774 + struct fb_image splash;
1776 /* From here on everything is device dependent */
1779 diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
1780 index 1b24bd4..558a8c6 100644
1781 --- a/include/linux/sysctl.h
1782 +++ b/include/linux/sysctl.h
1783 @@ -152,6 +152,7 @@ enum
1784 KERN_MAX_LOCK_DEPTH=74,
1785 KERN_NMI_WATCHDOG=75, /* int: enable/disable nmi watchdog */
1786 KERN_PANIC_ON_NMI=76, /* int: whether we will panic on an unrecovered */
1787 + KERN_FBSPLASH=77, /* string: path to fbsplash helper */
1791 diff --git a/kernel/sysctl.c b/kernel/sysctl.c
1792 index 8bff2c1..d3a986a 100644
1793 --- a/kernel/sysctl.c
1794 +++ b/kernel/sysctl.c
1795 @@ -87,6 +87,9 @@ static int ngroups_max = NGROUPS_MAX;
1797 extern char modprobe_path[];
1799 +#ifdef CONFIG_FB_SPLASH
1800 +extern char fbsplash_path[];
1802 #ifdef CONFIG_CHR_DEV_SG
1803 extern int sg_big_buff;
1805 @@ -456,6 +459,17 @@ #if defined(CONFIG_HOTPLUG) && defined(C
1806 .strategy = &sysctl_string,
1809 +#ifdef CONFIG_FB_SPLASH
1811 + .ctl_name = KERN_FBSPLASH,
1812 + .procname = "fbsplash",
1813 + .data = &fbsplash_path,
1814 + .maxlen = KMOD_PATH_LEN,
1816 + .proc_handler = &proc_dostring,
1817 + .strategy = &sysctl_string,
1820 #ifdef CONFIG_CHR_DEV_SG
1822 .ctl_name = KERN_SG_BIG_BUFF,