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 fc2d744..7e09d12 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 c40b9b8..375597a 100644
254 --- a/drivers/video/Kconfig
255 +++ b/drivers/video/Kconfig
256 @@ -1616,5 +1616,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 481c6c9..ccb5f64 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..4adeb2e
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/config.h>
308 +#include <linux/module.h>
309 +#include <linux/types.h>
310 +#include <linux/fb.h>
311 +#include <linux/selection.h>
312 +#include <linux/vt_kern.h>
313 +#include <asm/irq.h>
314 +#include <asm/system.h>
316 +#include "console/fbcon.h"
317 +#include "fbsplash.h"
319 +#define parse_pixel(shift,bpp,type) \
321 + if (d & (0x80 >> (shift))) \
322 + dd2[(shift)] = fgx; \
324 + dd2[(shift)] = transparent ? *(type *)splash_src : bgx; \
325 + splash_src += (bpp); \
328 +extern int get_color(struct vc_data *vc, struct fb_info *info,
331 +void fbsplash_fix_pseudo_pal(struct fb_info *info, struct vc_data *vc)
334 + int minlen = min(min(info->var.red.length, info->var.green.length),
335 + info->var.blue.length);
338 + for (j = i = 0; i < 16; i++) {
339 + k = color_table[i];
341 + col = ((vc->vc_palette[j++] >> (8-minlen))
342 + << info->var.red.offset);
343 + col |= ((vc->vc_palette[j++] >> (8-minlen))
344 + << info->var.green.offset);
345 + col |= ((vc->vc_palette[j++] >> (8-minlen))
346 + << info->var.blue.offset);
347 + ((u32 *)info->pseudo_palette)[k] = col;
351 +void fbsplash_renderc(struct fb_info *info, int ypos, int xpos, int height,
352 + int width, u8* src, u32 fgx, u32 bgx, u8 transparent)
356 + int bytespp = ((info->var.bits_per_pixel + 7) >> 3);
357 + unsigned int d = ypos * info->fix.line_length + xpos * bytespp;
358 + unsigned int ds = (ypos * info->var.xres + xpos) * bytespp;
361 + u8* splash_src = (u8 *)(info->splash.data + ds);
362 + u8* dst = (u8 *)(info->screen_base + d);
364 + if ((ypos + height) > info->var.yres || (xpos + width) > info->var.xres)
367 + for (y = 0; y < height; y++) {
368 + switch (info->var.bits_per_pixel) {
371 + for (x = 0; x < width; x++) {
379 + *(u32 *)splash_src : bgx;
383 + fb_writel(dd, dst);
388 + for (x = 0; x < width; x++) {
396 + (*(u32 *)splash_src & 0xffffff) : bgx;
400 +#ifdef __LITTLE_ENDIAN
401 + fb_writew(dd & 0xffff, dst);
403 + fb_writeb((dd >> 16), dst);
405 + fb_writew(dd >> 8, dst);
407 + fb_writeb(dd & 0xff, dst);
413 + for (x = 0; x < width; x += 2) {
417 + parse_pixel(0, 2, u16);
418 + parse_pixel(1, 2, u16);
419 +#ifdef __LITTLE_ENDIAN
420 + dd = dd2[0] | (dd2[1] << 16);
422 + dd = dd2[1] | (dd2[0] << 16);
425 + fb_writel(dd, dst);
431 + for (x = 0; x < width; x += 4) {
435 + parse_pixel(0, 1, u8);
436 + parse_pixel(1, 1, u8);
437 + parse_pixel(2, 1, u8);
438 + parse_pixel(3, 1, u8);
440 +#ifdef __LITTLE_ENDIAN
441 + dd = dd2[0] | (dd2[1] << 8) | (dd2[2] << 16) | (dd2[3] << 24);
443 + dd = dd2[3] | (dd2[2] << 8) | (dd2[1] << 16) | (dd2[0] << 24);
446 + fb_writel(dd, dst);
451 + dst += info->fix.line_length - width * bytespp;
452 + splash_src += (info->var.xres - width) * bytespp;
457 + ((info->fix.visual == FB_VISUAL_TRUECOLOR || \
458 + info->fix.visual == FB_VISUAL_DIRECTCOLOR) ? \
459 + ((u32*)info->pseudo_palette)[a] : a)
461 +void fbsplash_putcs(struct vc_data *vc, struct fb_info *info,
462 + const unsigned short *s, int count, int yy, int xx)
464 + unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff;
465 + struct fbcon_ops *ops = info->fbcon_par;
466 + int fg_color, bg_color, transparent;
469 + u16 c = scr_readw(s);
471 + fg_color = get_color(vc, info, c, 1);
472 + bg_color = get_color(vc, info, c, 0);
474 + /* Don't paint the background image if console is blanked */
475 + transparent = ops->blank_state ? 0 :
476 + (vc->vc_splash.bg_color == bg_color);
478 + xx = xx * vc->vc_font.width + vc->vc_splash.tx;
479 + yy = yy * vc->vc_font.height + vc->vc_splash.ty;
481 + fgx = cc2cx(fg_color);
482 + bgx = cc2cx(bg_color);
485 + c = scr_readw(s++);
486 + src = vc->vc_font.data + (c & charmask) * vc->vc_font.height *
487 + ((vc->vc_font.width + 7) >> 3);
489 + fbsplash_renderc(info, yy, xx, vc->vc_font.height,
490 + vc->vc_font.width, src, fgx, bgx, transparent);
491 + xx += vc->vc_font.width;
495 +void fbsplash_cursor(struct fb_info *info, struct fb_cursor *cursor)
498 + unsigned int dsize, s_pitch;
499 + struct fbcon_ops *ops = info->fbcon_par;
500 + struct vc_data* vc;
503 + /* we really don't need any cursors while the console is blanked */
504 + if (info->state != FBINFO_STATE_RUNNING || ops->blank_state)
507 + vc = vc_cons[ops->currcon].d;
509 + src = kmalloc(64 + sizeof(struct fb_image), GFP_ATOMIC);
513 + s_pitch = (cursor->image.width + 7) >> 3;
514 + dsize = s_pitch * cursor->image.height;
515 + if (cursor->enable) {
516 + switch (cursor->rop) {
518 + for (i = 0; i < dsize; i++)
519 + src[i] = cursor->image.data[i] ^ cursor->mask[i];
523 + for (i = 0; i < dsize; i++)
524 + src[i] = cursor->image.data[i] & cursor->mask[i];
528 + memcpy(src, cursor->image.data, dsize);
530 + fbsplash_renderc(info,
531 + cursor->image.dy + vc->vc_splash.ty,
532 + cursor->image.dx + vc->vc_splash.tx,
533 + cursor->image.height,
534 + cursor->image.width,
536 + cc2cx(cursor->image.fg_color),
537 + cc2cx(cursor->image.bg_color),
538 + cursor->image.bg_color == vc->vc_splash.bg_color);
543 +static void splashset(u8 *dst, int height, int width, int dstbytes,
550 + if (bpp == 16 || bpp == 8)
553 + while (height-- > 0) {
559 + for (i=0; i < width; i++) {
560 + fb_writel(bgx, p); p += 4;
564 + for (i=0; i < width; i++) {
565 +#ifdef __LITTLE_ENDIAN
566 + fb_writew((bgx & 0xffff),(u16*)p); p += 2;
567 + fb_writeb((bgx >> 16),p++);
569 + fb_writew((bgx >> 8),(u16*)p); p += 2;
570 + fb_writeb((bgx & 0xff),p++);
574 + for (i=0; i < width/4; i++) {
575 + fb_writel(bgx,p); p += 4;
576 + fb_writel(bgx,p); p += 4;
579 + fb_writel(bgx,p); p += 4;
582 + fb_writew(bgx,(u16*)p);
585 + for (i=0; i < width/4; i++) {
586 + fb_writel(bgx,p); p += 4;
590 + fb_writew(bgx,p); p += 2;
593 + fb_writeb(bgx,(u8*)p);
601 +void fbsplash_copy(u8 *dst, u8 *src, int height, int width, int linebytes,
602 + int srclinebytes, int bpp)
606 + while (height-- > 0) {
607 + u32 *p = (u32 *)dst;
608 + u32 *q = (u32 *)src;
613 + for (i=0; i < width; i++)
614 + fb_writel(*q++, p++);
617 + for (i=0; i < (width*3/4); i++)
618 + fb_writel(*q++, p++);
619 + if ((width*3) % 4) {
621 + fb_writeb(*(u8*)q, (u8*)p);
622 + } else if (width & 1) {
623 + fb_writew(*(u16*)q, (u16*)p);
624 + fb_writeb(*(u8*)((u16*)q+1),(u8*)((u16*)p+2));
629 + for (i=0; i < width/4; i++) {
630 + fb_writel(*q++, p++);
631 + fb_writel(*q++, p++);
634 + fb_writel(*q++, p++);
636 + fb_writew(*(u16*)q, (u16*)p);
639 + for (i=0; i < width/4; i++)
640 + fb_writel(*q++, p++);
643 + fb_writew(*(u16*)q, (u16*)p);
644 + q = (u32*) ((u16*)q + 1);
645 + p = (u32*) ((u16*)p + 1);
648 + fb_writeb(*(u8*)q, (u8*)p);
653 + src += srclinebytes;
657 +static void splashfill(struct fb_info *info, int sy, int sx, int height,
660 + int bytespp = ((info->var.bits_per_pixel + 7) >> 3);
661 + int d = sy * info->fix.line_length + sx * bytespp;
662 + int ds = (sy * info->var.xres + sx) * bytespp;
664 + fbsplash_copy((u8 *)(info->screen_base + d), (u8 *)(info->splash.data + ds),
665 + height, width, info->fix.line_length, info->var.xres * bytespp,
666 + info->var.bits_per_pixel);
669 +void fbsplash_clear(struct vc_data *vc, struct fb_info *info, int sy, int sx,
670 + int height, int width)
672 + int bgshift = (vc->vc_hi_font_mask) ? 13 : 12;
673 + int bg_color = attr_bgcol_ec(bgshift, vc);
674 + int transparent = vc->vc_splash.bg_color == bg_color;
675 + struct fbcon_ops *ops = info->fbcon_par;
678 + sy = sy * vc->vc_font.height + vc->vc_splash.ty;
679 + sx = sx * vc->vc_font.width + vc->vc_splash.tx;
680 + height *= vc->vc_font.height;
681 + width *= vc->vc_font.width;
683 + /* Don't paint the background image if console is blanked */
684 + if (transparent && !ops->blank_state) {
685 + splashfill(info, sy, sx, height, width);
687 + dst = (u8 *)(info->screen_base + sy * info->fix.line_length +
688 + sx * ((info->var.bits_per_pixel + 7) >> 3));
689 + splashset(dst, height, width, info->fix.line_length, cc2cx(bg_color),
690 + info->var.bits_per_pixel);
694 +void fbsplash_clear_margins(struct vc_data *vc, struct fb_info *info,
697 + unsigned int tw = vc->vc_cols*vc->vc_font.width;
698 + unsigned int th = vc->vc_rows*vc->vc_font.height;
700 + if (!bottom_only) {
702 + splashfill(info, 0, 0, vc->vc_splash.ty, info->var.xres);
704 + splashfill(info, vc->vc_splash.ty, 0, th, vc->vc_splash.tx);
706 + splashfill(info, vc->vc_splash.ty, vc->vc_splash.tx + tw, th,
707 + info->var.xres - vc->vc_splash.tx - tw);
709 + splashfill(info, vc->vc_splash.ty + th, 0,
710 + info->var.yres - vc->vc_splash.ty - th, info->var.xres);
713 +void fbsplash_bmove_redraw(struct vc_data *vc, struct fb_info *info, int y,
714 + int sx, int dx, int width)
716 + u16 *d = (u16 *) (vc->vc_origin + vc->vc_size_row * y + dx * 2);
717 + u16 *s = d + (dx - sx);
720 + u16 *le = d + width;
727 + if (attr != (c & 0xff00)) {
730 + fbsplash_putcs(vc, info, start, d - start, y, x);
735 + if (s >= ls && s < le && c == scr_readw(s)) {
737 + fbsplash_putcs(vc, info, start, d - start, y, x);
738 + x += d - start + 1;
749 + fbsplash_putcs(vc, info, start, d - start, y, x);
752 +void fbsplash_blank(struct vc_data *vc, struct fb_info *info, int blank)
755 + splashset((u8 *)info->screen_base, info->var.yres, info->var.xres,
756 + info->fix.line_length, 0, info->var.bits_per_pixel);
759 + fbsplash_clear_margins(vc, info, 0);
763 diff --git a/drivers/video/console/bitblit.c b/drivers/video/console/bitblit.c
764 index 308850d..36a885c 100644
765 --- a/drivers/video/console/bitblit.c
766 +++ b/drivers/video/console/bitblit.c
767 @@ -17,6 +17,7 @@ #include <linux/vt_kern.h>
768 #include <linux/console.h>
769 #include <asm/types.h>
771 +#include "../fbsplash.h"
774 * Accelerated handlers.
775 @@ -54,6 +55,13 @@ static void bit_bmove(struct vc_data *vc
776 area.height = height * vc->vc_font.height;
777 area.width = width * vc->vc_font.width;
779 + if (fbsplash_active(info, vc)) {
780 + area.sx += vc->vc_splash.tx;
781 + area.sy += vc->vc_splash.ty;
782 + area.dx += vc->vc_splash.tx;
783 + area.dy += vc->vc_splash.ty;
786 info->fbops->fb_copyarea(info, &area);
789 @@ -379,11 +387,15 @@ static void bit_cursor(struct vc_data *v
790 cursor.image.depth = 1;
791 cursor.rop = ROP_XOR;
793 - if (info->fbops->fb_cursor)
794 - err = info->fbops->fb_cursor(info, &cursor);
795 + if (fbsplash_active(info, vc)) {
796 + fbsplash_cursor(info, &cursor);
798 + if (info->fbops->fb_cursor)
799 + err = info->fbops->fb_cursor(info, &cursor);
802 - soft_cursor(info, &cursor);
804 + soft_cursor(info, &cursor);
807 ops->cursor_reset = 0;
809 diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c
810 index 390439b..279850b 100644
811 --- a/drivers/video/console/fbcon.c
812 +++ b/drivers/video/console/fbcon.c
813 @@ -91,6 +91,7 @@ #include <asm/setup.h>
817 +#include "../fbsplash.h"
820 # define DPRINTK(fmt, args...) printk(KERN_DEBUG "%s: " fmt, __FUNCTION__ , ## args)
821 @@ -106,7 +107,7 @@ enum {
823 static struct display fb_display[MAX_NR_CONSOLES];
825 -static signed char con2fb_map[MAX_NR_CONSOLES];
826 +signed char con2fb_map[MAX_NR_CONSOLES];
827 static signed char con2fb_map_boot[MAX_NR_CONSOLES];
828 static int logo_height;
829 static int logo_lines;
830 @@ -300,7 +301,7 @@ static inline int fbcon_is_inactive(stru
831 vc->vc_mode != KD_TEXT || ops->graphics);
834 -static inline int get_color(struct vc_data *vc, struct fb_info *info,
835 +inline int get_color(struct vc_data *vc, struct fb_info *info,
838 int depth = fb_get_color_depth(&info->var, &info->fix);
839 @@ -409,6 +410,7 @@ static void fb_flashcursor(void *private
841 ops->cursor(vc, info, mode, softback_lines, get_color(vc, info, c, 1),
842 get_color(vc, info, c, 0));
844 release_console_sem();
847 @@ -574,6 +576,8 @@ static int fbcon_takeover(int show_logo)
856 @@ -980,6 +984,12 @@ static const char *fbcon_startup(void)
857 rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres);
858 cols /= vc->vc_font.width;
859 rows /= vc->vc_font.height;
861 + if (fbsplash_active(info, vc)) {
862 + cols = vc->vc_splash.twidth / vc->vc_font.width;
863 + rows = vc->vc_splash.theight / vc->vc_font.height;
866 vc_resize(vc, cols, rows);
868 DPRINTK("mode: %s\n", info->fix.id);
869 @@ -1063,7 +1073,7 @@ static void fbcon_init(struct vc_data *v
872 if (vc != svc || logo_shown == FBCON_LOGO_DONTSHOW ||
873 - (info->fix.type == FB_TYPE_TEXT))
874 + (info->fix.type == FB_TYPE_TEXT) || fbsplash_active(info, vc))
877 if (var_to_display(p, &info->var, info))
878 @@ -1257,6 +1267,11 @@ static void fbcon_clear(struct vc_data *
879 if (!height || !width)
882 + if (fbsplash_active(info, vc)) {
883 + fbsplash_clear(vc, info, sy, sx, height, width);
887 /* Split blits that cross physical y_wrap boundary */
889 y_break = p->vrows - p->yscroll;
890 @@ -1276,10 +1291,15 @@ static void fbcon_putcs(struct vc_data *
891 struct display *p = &fb_display[vc->vc_num];
892 struct fbcon_ops *ops = info->fbcon_par;
894 - if (!fbcon_is_inactive(vc, info))
895 - ops->putcs(vc, info, s, count, real_y(p, ypos), xpos,
896 - get_color(vc, info, scr_readw(s), 1),
897 - get_color(vc, info, scr_readw(s), 0));
898 + if (!fbcon_is_inactive(vc, info)) {
900 + if (fbsplash_active(info, vc))
901 + fbsplash_putcs(vc, info, s, count, ypos, xpos);
903 + ops->putcs(vc, info, s, count, real_y(p, ypos), xpos,
904 + get_color(vc, info, scr_readw(s), 1),
905 + get_color(vc, info, scr_readw(s), 0));
909 static void fbcon_putc(struct vc_data *vc, int c, int ypos, int xpos)
910 @@ -1295,8 +1315,13 @@ static void fbcon_clear_margins(struct v
911 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
912 struct fbcon_ops *ops = info->fbcon_par;
914 - if (!fbcon_is_inactive(vc, info))
915 - ops->clear_margins(vc, info, bottom_only);
916 + if (!fbcon_is_inactive(vc, info)) {
917 + if (fbsplash_active(info, vc)) {
918 + fbsplash_clear_margins(vc, info, bottom_only);
920 + ops->clear_margins(vc, info, bottom_only);
925 static void fbcon_cursor(struct vc_data *vc, int mode)
926 @@ -1769,7 +1794,7 @@ static int fbcon_scroll(struct vc_data *
929 fbcon_softback_note(vc, t, count);
930 - if (logo_shown >= 0)
931 + if (logo_shown >= 0 || fbsplash_active(info, vc))
933 switch (p->scrollmode) {
935 @@ -1857,6 +1882,8 @@ static int fbcon_scroll(struct vc_data *
939 + if (fbsplash_active(info, vc))
941 switch (p->scrollmode) {
943 ops->bmove(vc, info, t, 0, t + count, 0,
944 @@ -1999,6 +2026,13 @@ static void fbcon_bmove_rec(struct vc_da
949 + if (fbsplash_active(info, vc) && sy == dy && height == 1) {
950 + /* must use slower redraw bmove to keep background pic intact */
951 + fbsplash_bmove_redraw(vc, info, sy, sx, dx, width);
955 ops->bmove(vc, info, real_y(p, sy), sx, real_y(p, dy), dx,
958 @@ -2069,8 +2103,9 @@ static int fbcon_resize(struct vc_data *
959 var.yres = virt_h * virt_fh;
960 x_diff = info->var.xres - var.xres;
961 y_diff = info->var.yres - var.yres;
962 - if (x_diff < 0 || x_diff > virt_fw ||
963 - y_diff < 0 || y_diff > virt_fh) {
965 + if ((x_diff < 0 || x_diff > virt_fw ||
966 + y_diff < 0 || y_diff > virt_fh) && !vc->vc_splash.state) {
967 struct fb_videomode *mode;
969 DPRINTK("attempting resize %ix%i\n", var.xres, var.yres);
970 @@ -2106,6 +2141,25 @@ static int fbcon_switch(struct vc_data *
972 info = registered_fb[con2fb_map[vc->vc_num]];
973 ops = info->fbcon_par;
974 + prev_console = ops->currcon;
975 + if (prev_console != -1)
976 + old_info = registered_fb[con2fb_map[prev_console]];
978 + if (fbsplash_active_vc(vc)) {
979 + struct vc_data *vc_curr = vc_cons[prev_console].d;
980 + if (!vc_curr->vc_splash.theme || strcmp(vc->vc_splash.theme, vc_curr->vc_splash.theme)) {
981 + if (fbsplash_call_helper("getpic", vc->vc_num))
982 + fbsplash_disable(vc, 0);
984 + } else if (info->fix.visual == FB_VISUAL_DIRECTCOLOR) {
985 + struct vc_data *vc_curr = vc_cons[prev_console].d;
986 + if (vc_curr && fbsplash_active_vc(vc_curr)) {
987 + /* Clear the screen to avoid displaying funky colors during
988 + * palette updates. */
989 + memset((u8*)info->screen_base + info->fix.line_length * info->var.yoffset,
990 + 0, info->var.yres * info->fix.line_length);
996 @@ -2124,9 +2178,6 @@ static int fbcon_switch(struct vc_data *
997 logo_shown = FBCON_LOGO_CANSHOW;
1000 - prev_console = ops->currcon;
1001 - if (prev_console != -1)
1002 - old_info = registered_fb[con2fb_map[prev_console]];
1004 * FIXME: If we have multiple fbdev's loaded, we need to
1005 * update all info->currcon. Perhaps, we can place this
1006 @@ -2165,6 +2216,11 @@ static int fbcon_switch(struct vc_data *
1007 if (old_info != info)
1008 fbcon_del_cursor_timer(old_info);
1011 + if (fbsplash_active_nores(info, vc) && !fbsplash_active(info, vc)) {
1012 + if (fbsplash_call_helper("modechange", vc->vc_num))
1013 + fbsplash_disable(vc, 0);
1016 fbcon_add_cursor_timer(info);
1017 set_blitting_type(vc, info);
1018 @@ -2268,8 +2324,12 @@ static int fbcon_blank(struct vc_data *v
1019 fbcon_cursor(vc, blank ? CM_ERASE : CM_DRAW);
1020 ops->cursor_flash = (!blank);
1022 - if (fb_blank(info, blank))
1023 - fbcon_generic_blank(vc, info, blank);
1024 + if (fb_blank(info, blank)) {
1025 + if (fbsplash_active(info, vc))
1026 + fbsplash_blank(vc, info, blank);
1028 + fbcon_generic_blank(vc, info, blank);
1033 @@ -2419,13 +2479,22 @@ static int fbcon_do_set_font(struct vc_d
1037 + /* reset wrap/pan */
1040 cols = FBCON_SWAP(ops->rotate, info->var.xres, info->var.yres);
1041 rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres);
1043 + info->var.xoffset = info->var.yoffset = p->yscroll = 0;
1044 + if (fbsplash_active(info, vc)) {
1045 + cols = vc->vc_splash.twidth;
1046 + rows = vc->vc_splash.theight;
1051 vc_resize(vc, cols, rows);
1053 if (CON_IS_VISIBLE(vc) && softback_buf)
1054 fbcon_update_softback(vc);
1055 } else if (CON_IS_VISIBLE(vc)
1056 @@ -2543,7 +2612,7 @@ static int fbcon_set_palette(struct vc_d
1060 - if (fbcon_is_inactive(vc, info))
1061 + if (fbcon_is_inactive(vc, info) || vc->vc_num != fg_console)
1064 if (!CON_IS_VISIBLE(vc))
1065 @@ -2569,7 +2638,49 @@ static int fbcon_set_palette(struct vc_d
1067 fb_copy_cmap(fb_default_cmap(1 << depth), &palette_cmap);
1069 - return fb_set_cmap(&palette_cmap, info);
1070 + if (fbsplash_active(info, vc_cons[fg_console].d) &&
1071 + info->fix.visual == FB_VISUAL_DIRECTCOLOR) {
1073 + u16 *red, *green, *blue;
1074 + int minlen = min(min(info->var.red.length, info->var.green.length),
1075 + info->var.blue.length);
1078 + struct fb_cmap cmap = {
1080 + .len = (1 << minlen),
1087 + red = kmalloc(256 * sizeof(u16) * 3, GFP_KERNEL);
1092 + green = red + 256;
1093 + blue = green + 256;
1095 + cmap.green = green;
1098 + for (i = 0; i < cmap.len; i++) {
1099 + red[i] = green[i] = blue[i] = (0xffff * i)/(cmap.len-1);
1102 + h = fb_set_cmap(&cmap, info);
1103 + fbsplash_fix_pseudo_pal(info, vc_cons[fg_console].d);
1108 + } else if (fbsplash_active(info, vc_cons[fg_console].d) &&
1109 + info->var.bits_per_pixel == 8 && info->splash.cmap.red != NULL)
1110 + fb_set_cmap(&info->splash.cmap, info);
1112 +out: return fb_set_cmap(&palette_cmap, info);
1115 static u16 *fbcon_screen_pos(struct vc_data *vc, int offset)
1116 @@ -2795,7 +2906,14 @@ static void fbcon_modechanged(struct fb_
1117 rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres);
1118 cols /= vc->vc_font.width;
1119 rows /= vc->vc_font.height;
1120 - vc_resize(vc, cols, rows);
1122 + if (!fbsplash_active_nores(info, vc)) {
1123 + vc_resize(vc, cols, rows);
1125 + if (fbsplash_call_helper("modechange", vc->vc_num))
1126 + fbsplash_disable(vc, 0);
1129 updatescrollmode(p, info, vc);
1131 scrollback_current = 0;
1132 @@ -3235,6 +3353,7 @@ #endif
1137 fbcon_has_exited = 1;
1140 diff --git a/drivers/video/fbcmap.c b/drivers/video/fbcmap.c
1141 index e8b135f..8622d74 100644
1142 --- a/drivers/video/fbcmap.c
1143 +++ b/drivers/video/fbcmap.c
1144 @@ -15,6 +15,7 @@ #include <linux/string.h>
1145 #include <linux/module.h>
1146 #include <linux/fb.h>
1147 #include <linux/slab.h>
1148 +#include "fbsplash.h"
1150 #include <asm/uaccess.h>
1152 @@ -234,14 +235,17 @@ int fb_set_cmap(struct fb_cmap *cmap, st
1154 htransp = *transp++;
1155 if (info->fbops->fb_setcolreg(start++,
1156 - hred, hgreen, hblue,
1157 + hred, hgreen, hblue,
1164 fb_copy_cmap(cmap, &info->cmap);
1166 + if (fbsplash_active(info, vc_cons[fg_console].d) &&
1167 + info->fix.visual == FB_VISUAL_DIRECTCOLOR)
1168 + fbsplash_fix_pseudo_pal(info, vc_cons[fg_console].d);
1173 @@ -249,7 +253,7 @@ int fb_set_user_cmap(struct fb_cmap_user
1175 int rc, size = cmap->len * sizeof(u16);
1176 struct fb_cmap umap;
1179 if (cmap->start < 0 || (!info->fbops->fb_setcolreg &&
1180 !info->fbops->fb_setcmap))
1182 diff --git a/drivers/video/fbsplash.c b/drivers/video/fbsplash.c
1183 new file mode 100644
1184 index 0000000..e22e544
1186 +++ b/drivers/video/fbsplash.c
1189 + * linux/drivers/video/fbsplash.c -- Framebuffer splash routines
1191 + * Copyright (C) 2004 Michal Januszewski <spock@gentoo.org>
1193 + * Code based upon "Bootsplash" (C) 2001-2003
1194 + * Volker Poplawski <volker@poplawski.de>,
1195 + * Stefan Reinauer <stepan@suse.de>,
1196 + * Steffen Winterfeldt <snwint@suse.de>,
1197 + * Michael Schroeder <mls@suse.de>,
1198 + * Ken Wimer <wimer@suse.de>.
1200 + * Splash render routines are located in /linux/drivers/video/cfbsplash.c
1202 + * This file is subject to the terms and conditions of the GNU General Public
1203 + * License. See the file COPYING in the main directory of this archive for
1207 +#include <linux/config.h>
1208 +#include <linux/module.h>
1209 +#include <linux/kernel.h>
1210 +#include <linux/string.h>
1211 +#include <linux/types.h>
1212 +#include <linux/fb.h>
1213 +#include <linux/vt_kern.h>
1214 +#include <linux/vmalloc.h>
1215 +#include <linux/unistd.h>
1216 +#include <linux/syscalls.h>
1217 +#include <linux/init.h>
1218 +#include <linux/proc_fs.h>
1219 +#include <linux/workqueue.h>
1220 +#include <linux/kmod.h>
1221 +#include <linux/miscdevice.h>
1222 +#include <linux/device.h>
1223 +#include <linux/fs.h>
1225 +#include <asm/uaccess.h>
1226 +#include <asm/irq.h>
1227 +#include <asm/system.h>
1229 +#include "console/fbcon.h"
1230 +#include "fbsplash.h"
1232 +#define SPLASH_VERSION "0.9.2"
1234 +extern signed char con2fb_map[];
1235 +static int fbsplash_enable(struct vc_data *vc);
1236 +char fbsplash_path[KMOD_PATH_LEN] = "/sbin/splash_helper";
1237 +static int initialized = 0;
1239 +int fbsplash_call_helper(char* cmd, unsigned short vc)
1243 + "PATH=/sbin:/bin",
1249 + unsigned char fb = (int) con2fb_map[vc];
1257 + vc_cons[vc].d->vc_splash.theme,
1261 + snprintf(tfb,5,"%d",fb);
1262 + snprintf(tcons,5,"%d",vc);
1264 + return call_usermodehelper(fbsplash_path, argv, envp, 1);
1267 +/* Disables fbsplash on a virtual console; called with console sem held. */
1268 +int fbsplash_disable(struct vc_data *vc, unsigned char redraw)
1270 + struct fb_info* info;
1272 + if (!vc->vc_splash.state)
1275 + info = registered_fb[(int) con2fb_map[vc->vc_num]];
1280 + vc->vc_splash.state = 0;
1281 + vc_resize(vc, info->var.xres / vc->vc_font.width,
1282 + info->var.yres / vc->vc_font.height);
1284 + if (fg_console == vc->vc_num && redraw) {
1285 + redraw_screen(vc, 0);
1286 + update_region(vc, vc->vc_origin +
1287 + vc->vc_size_row * vc->vc_top,
1288 + vc->vc_size_row * (vc->vc_bottom - vc->vc_top) / 2);
1291 + printk(KERN_INFO "fbsplash: switched splash state to 'off' on console %d\n",
1297 +/* Enables fbsplash on a virtual console; called with console sem held. */
1298 +static int fbsplash_enable(struct vc_data *vc)
1300 + struct fb_info* info;
1302 + info = registered_fb[(int) con2fb_map[vc->vc_num]];
1304 + if (vc->vc_splash.twidth == 0 || vc->vc_splash.theight == 0 ||
1305 + info == NULL || vc->vc_splash.state || (!info->splash.data &&
1306 + vc->vc_num == fg_console))
1309 + vc->vc_splash.state = 1;
1310 + vc_resize(vc, vc->vc_splash.twidth / vc->vc_font.width,
1311 + vc->vc_splash.theight / vc->vc_font.height);
1313 + if (fg_console == vc->vc_num) {
1314 + redraw_screen(vc, 0);
1315 + update_region(vc, vc->vc_origin +
1316 + vc->vc_size_row * vc->vc_top,
1317 + vc->vc_size_row * (vc->vc_bottom - vc->vc_top) / 2);
1318 + fbsplash_clear_margins(vc, info, 0);
1321 + printk(KERN_INFO "fbsplash: switched splash state to 'on' on console %d\n",
1327 +static inline int fbsplash_ioctl_dosetstate(struct vc_data *vc, unsigned int __user* state, unsigned char origin)
1331 + if (get_user(tmp, state))
1334 + if (origin == FB_SPLASH_IO_ORIG_USER)
1335 + acquire_console_sem();
1337 + ret = fbsplash_disable(vc, 1);
1339 + ret = fbsplash_enable(vc);
1340 + if (origin == FB_SPLASH_IO_ORIG_USER)
1341 + release_console_sem();
1346 +static inline int fbsplash_ioctl_dogetstate(struct vc_data *vc, unsigned int __user *state)
1348 + return put_user(vc->vc_splash.state, (unsigned int __user*) state);
1351 +static int fbsplash_ioctl_dosetcfg(struct vc_data *vc, struct vc_splash __user *arg, unsigned char origin)
1353 + struct vc_splash cfg;
1354 + struct fb_info *info;
1358 + info = registered_fb[(int) con2fb_map[vc->vc_num]];
1360 + if (copy_from_user(&cfg, arg, sizeof(struct vc_splash)))
1362 + if (info == NULL || !cfg.twidth || !cfg.theight ||
1363 + cfg.tx + cfg.twidth > info->var.xres ||
1364 + cfg.ty + cfg.theight > info->var.yres)
1367 + len = strlen_user(cfg.theme);
1368 + if (!len || len > FB_SPLASH_THEME_LEN)
1370 + tmp = kmalloc(len, GFP_KERNEL);
1373 + if (copy_from_user(tmp, (void __user *)cfg.theme, len))
1378 + /* If this ioctl is a response to a request from kernel, the console sem
1379 + * is already held; we also don't need to disable splash because either the
1380 + * new config and background picture will be successfully loaded, and the
1381 + * splash will stay on, or in case of a failure it'll be turned off in fbcon. */
1382 + if (origin == FB_SPLASH_IO_ORIG_USER) {
1383 + acquire_console_sem();
1384 + if (vc->vc_splash.state)
1385 + fbsplash_disable(vc, 1);
1388 + if (vc->vc_splash.theme)
1389 + kfree(vc->vc_splash.theme);
1391 + vc->vc_splash = cfg;
1393 + if (origin == FB_SPLASH_IO_ORIG_USER)
1394 + release_console_sem();
1396 + printk(KERN_INFO "fbsplash: console %d using theme '%s'\n",
1397 + vc->vc_num, vc->vc_splash.theme);
1401 +static int fbsplash_ioctl_dogetcfg(struct vc_data *vc, struct vc_splash __user *arg)
1403 + struct vc_splash splash;
1406 + if (get_user(tmp, &arg->theme))
1409 + splash = vc->vc_splash;
1410 + splash.theme = tmp;
1412 + if (vc->vc_splash.theme) {
1413 + if (copy_to_user(tmp, vc->vc_splash.theme, strlen(vc->vc_splash.theme) + 1))
1416 + if (put_user(0, tmp))
1419 + if (copy_to_user(arg, &splash, sizeof(struct vc_splash)))
1425 +static int fbsplash_ioctl_dosetpic(struct vc_data *vc, struct fb_image __user *arg, unsigned char origin)
1427 + struct fb_image img;
1428 + struct fb_info *info;
1432 + if (vc->vc_num != fg_console)
1435 + info = registered_fb[(int) con2fb_map[vc->vc_num]];
1440 + if (copy_from_user(&img, arg, sizeof(struct fb_image)))
1443 + if (img.width != info->var.xres || img.height != info->var.yres) {
1444 + printk(KERN_ERR "fbsplash: picture dimensions mismatch\n");
1448 + if (img.depth != info->var.bits_per_pixel) {
1449 + printk(KERN_ERR "fbsplash: picture depth mismatch\n");
1453 + if (img.depth == 8) {
1454 + if (!img.cmap.len || !img.cmap.red || !img.cmap.green ||
1458 + tmp = vmalloc(img.cmap.len * 3 * 2);
1462 + if (copy_from_user(tmp, (void __user*)img.cmap.red, img.cmap.len * 2) ||
1463 + copy_from_user(tmp + (img.cmap.len << 1),
1464 + (void __user*)img.cmap.green, (img.cmap.len << 1)) ||
1465 + copy_from_user(tmp + (img.cmap.len << 2),
1466 + (void __user*)img.cmap.blue, (img.cmap.len << 1))) {
1471 + img.cmap.transp = NULL;
1472 + img.cmap.red = (u16*)tmp;
1473 + img.cmap.green = img.cmap.red + img.cmap.len;
1474 + img.cmap.blue = img.cmap.green + img.cmap.len;
1476 + img.cmap.red = NULL;
1479 + len = ((img.depth + 7) >> 3) * img.width * img.height;
1480 + tmp = vmalloc(len);
1485 + if (copy_from_user(tmp, (void __user*)img.data, len))
1490 + /* If this ioctl is a response to a request from kernel, the console sem
1491 + * is already held. */
1492 + if (origin == FB_SPLASH_IO_ORIG_USER)
1493 + acquire_console_sem();
1495 + if (info->splash.data)
1496 + vfree((u8*)info->splash.data);
1497 + if (info->splash.cmap.red)
1498 + vfree(info->splash.cmap.red);
1500 + info->splash = img;
1502 + if (origin == FB_SPLASH_IO_ORIG_USER)
1503 + release_console_sem();
1507 +out: if (img.cmap.red)
1508 + vfree(img.cmap.red);
1514 +static int splash_ioctl(struct inode * inode, struct file *filp, u_int cmd,
1517 + struct fb_splash_iowrapper __user *wrapper = (void __user*) arg;
1518 + struct vc_data *vc = NULL;
1519 + unsigned short vc_num = 0;
1520 + unsigned char origin = 0;
1521 + void __user *data = NULL;
1523 + if (!access_ok(VERIFY_READ, wrapper,
1524 + sizeof(struct fb_splash_iowrapper)))
1527 + __get_user(vc_num, &wrapper->vc);
1528 + __get_user(origin, &wrapper->origin);
1529 + __get_user(data, &wrapper->data);
1531 + if (!vc_cons_allocated(vc_num))
1534 + vc = vc_cons[vc_num].d;
1537 + case FBIOSPLASH_SETPIC:
1538 + return fbsplash_ioctl_dosetpic(vc, (struct fb_image __user*)data, origin);
1539 + case FBIOSPLASH_SETCFG:
1540 + return fbsplash_ioctl_dosetcfg(vc, (struct vc_splash*)data, origin);
1541 + case FBIOSPLASH_GETCFG:
1542 + return fbsplash_ioctl_dogetcfg(vc, (struct vc_splash*)data);
1543 + case FBIOSPLASH_SETSTATE:
1544 + return fbsplash_ioctl_dosetstate(vc, (unsigned int *)data, origin);
1545 + case FBIOSPLASH_GETSTATE:
1546 + return fbsplash_ioctl_dogetstate(vc, (unsigned int *)data);
1548 + return -ENOIOCTLCMD;
1552 +static struct file_operations splash_ops = {
1553 + .owner = THIS_MODULE,
1554 + .ioctl = splash_ioctl
1557 +static struct miscdevice splash_dev = {
1558 + .minor = MISC_DYNAMIC_MINOR,
1559 + .name = "fbsplash",
1560 + .fops = &splash_ops
1563 +void fbsplash_reset(void)
1565 + struct fb_info *info;
1566 + struct vc_data *vc;
1569 + vc = vc_cons[0].d;
1570 + info = registered_fb[0];
1572 + for (i = 0; i < num_registered_fb; i++) {
1573 + registered_fb[i]->splash.data = NULL;
1574 + registered_fb[i]->splash.cmap.red = NULL;
1577 + for (i = 0; i < MAX_NR_CONSOLES && vc_cons[i].d; i++) {
1578 + vc_cons[i].d->vc_splash.state = vc_cons[i].d->vc_splash.twidth =
1579 + vc_cons[i].d->vc_splash.theight = 0;
1580 + vc_cons[i].d->vc_splash.theme = NULL;
1586 +int fbsplash_init(void)
1595 + i = misc_register(&splash_dev);
1597 + printk(KERN_ERR "fbsplash: failed to register device\n");
1601 + fbsplash_call_helper("init", 0);
1606 +int fbsplash_exit(void)
1612 +EXPORT_SYMBOL(fbsplash_path);
1613 diff --git a/drivers/video/fbsplash.h b/drivers/video/fbsplash.h
1614 new file mode 100644
1615 index 0000000..cb9398f
1617 +++ b/drivers/video/fbsplash.h
1620 + * linux/drivers/video/fbsplash.h -- Framebuffer splash headers
1622 + * Copyright (C) 2004 Michal Januszewski <spock@gentoo.org>
1626 +#ifndef __FB_SPLASH_H
1627 +#define __FB_SPLASH_H
1629 +#ifndef _LINUX_FB_H
1630 +#include <linux/fb.h>
1633 +/* This is needed for vc_cons in fbcmap.c */
1634 +#include <linux/vt_kern.h>
1640 +#ifdef CONFIG_FB_SPLASH
1642 +int fbsplash_init(void);
1643 +int fbsplash_exit(void);
1644 +int fbsplash_call_helper(char* cmd, unsigned short cons);
1645 +int fbsplash_disable(struct vc_data *vc, unsigned char redraw);
1648 +void fbsplash_putcs(struct vc_data *vc, struct fb_info *info, const unsigned short *s, int count, int yy, int xx);
1649 +void fbsplash_cursor(struct fb_info *info, struct fb_cursor *cursor);
1650 +void fbsplash_clear(struct vc_data *vc, struct fb_info *info, int sy, int sx, int height, int width);
1651 +void fbsplash_clear_margins(struct vc_data *vc, struct fb_info *info, int bottom_only);
1652 +void fbsplash_blank(struct vc_data *vc, struct fb_info *info, int blank);
1653 +void fbsplash_bmove_redraw(struct vc_data *vc, struct fb_info *info, int y, int sx, int dx, int width);
1654 +void fbsplash_copy(u8 *dst, u8 *src, int height, int width, int linebytes, int srclinesbytes, int bpp);
1655 +void fbsplash_fix_pseudo_pal(struct fb_info *info, struct vc_data *vc);
1658 +void acquire_console_sem(void);
1659 +void release_console_sem(void);
1660 +void do_unblank_screen(int entering_gfx);
1662 +/* struct vc_data *y */
1663 +#define fbsplash_active_vc(y) (y->vc_splash.state && y->vc_splash.theme)
1665 +/* struct fb_info *x, struct vc_data *y */
1666 +#define fbsplash_active_nores(x,y) (x->splash.data && fbsplash_active_vc(y))
1668 +/* struct fb_info *x, struct vc_data *y */
1669 +#define fbsplash_active(x,y) (fbsplash_active_nores(x,y) && \
1670 + x->splash.width == x->var.xres && \
1671 + x->splash.height == x->var.yres && \
1672 + x->splash.depth == x->var.bits_per_pixel)
1675 +#else /* CONFIG_FB_SPLASH */
1677 +static inline void fbsplash_putcs(struct vc_data *vc, struct fb_info *info, const unsigned short *s, int count, int yy, int xx) {}
1678 +static inline void fbsplash_putc(struct vc_data *vc, struct fb_info *info, int c, int ypos, int xpos) {}
1679 +static inline void fbsplash_cursor(struct fb_info *info, struct fb_cursor *cursor) {}
1680 +static inline void fbsplash_clear(struct vc_data *vc, struct fb_info *info, int sy, int sx, int height, int width) {}
1681 +static inline void fbsplash_clear_margins(struct vc_data *vc, struct fb_info *info, int bottom_only) {}
1682 +static inline void fbsplash_blank(struct vc_data *vc, struct fb_info *info, int blank) {}
1683 +static inline void fbsplash_bmove_redraw(struct vc_data *vc, struct fb_info *info, int y, int sx, int dx, int width) {}
1684 +static inline void fbsplash_fix_pseudo_pal(struct fb_info *info, struct vc_data *vc) {}
1685 +static inline int fbsplash_call_helper(char* cmd, unsigned short cons) { return 0; }
1686 +static inline int fbsplash_init(void) { return 0; }
1687 +static inline int fbsplash_exit(void) { return 0; }
1688 +static inline int fbsplash_disable(struct vc_data *vc, unsigned char redraw) { return 0; }
1690 +#define fbsplash_active_vc(y) (0)
1691 +#define fbsplash_active_nores(x,y) (0)
1692 +#define fbsplash_active(x,y) (0)
1694 +#endif /* CONFIG_FB_SPLASH */
1696 +#endif /* __FB_SPLASH_H */
1697 diff --git a/include/linux/console_splash.h b/include/linux/console_splash.h
1698 new file mode 100644
1699 index 0000000..c448dd2
1701 +++ b/include/linux/console_splash.h
1703 +#ifndef _LINUX_CONSOLE_SPLASH_H_
1704 +#define _LINUX_CONSOLE_SPLASH_H_ 1
1706 +/* A structure used by the framebuffer splash code (drivers/video/fbsplash.c) */
1708 + __u8 bg_color; /* The color that is to be treated as transparent */
1709 + __u8 state; /* Current splash state: 0 = off, 1 = on */
1710 + __u16 tx, ty; /* Top left corner coordinates of the text field */
1711 + __u16 twidth, theight; /* Width and height of the text field */
1716 diff --git a/include/linux/console_struct.h b/include/linux/console_struct.h
1717 index 25423f7..5131f77 100644
1718 --- a/include/linux/console_struct.h
1719 +++ b/include/linux/console_struct.h
1720 @@ -15,6 +15,7 @@ #include <linux/vt.h>
1724 +#include <linux/console_splash.h>
1727 unsigned short vc_num; /* Console number */
1728 @@ -98,6 +99,8 @@ struct vc_data {
1729 struct vc_data **vc_display_fg; /* [!] Ptr to var holding fg console for this display */
1730 unsigned long vc_uni_pagedir;
1731 unsigned long *vc_uni_pagedir_loc; /* [!] Location of uni_pagedir variable for this console */
1733 + struct vc_splash vc_splash;
1734 /* additional information is in vt_kern.h */
1737 diff --git a/include/linux/fb.h b/include/linux/fb.h
1738 index 4ad0673..dcd0950 100644
1739 --- a/include/linux/fb.h
1740 +++ b/include/linux/fb.h
1741 @@ -9,6 +9,13 @@ #include <asm/types.h>
1743 #define FB_MAX 32 /* sufficient for now */
1745 +struct fb_splash_iowrapper
1747 + unsigned short vc; /* Virtual console */
1748 + unsigned char origin; /* Point of origin of the request */
1754 #define FBIOGET_VSCREENINFO 0x4600
1755 @@ -36,7 +43,15 @@ #define FBIOGET_GLYPH 0x4615
1756 #define FBIOGET_HWCINFO 0x4616
1757 #define FBIOPUT_MODEINFO 0x4617
1758 #define FBIOGET_DISPINFO 0x4618
1759 +#define FBIOSPLASH_SETCFG _IOWR('F', 0x19, struct fb_splash_iowrapper)
1760 +#define FBIOSPLASH_GETCFG _IOR('F', 0x1A, struct fb_splash_iowrapper)
1761 +#define FBIOSPLASH_SETSTATE _IOWR('F', 0x1B, struct fb_splash_iowrapper)
1762 +#define FBIOSPLASH_GETSTATE _IOR('F', 0x1C, struct fb_splash_iowrapper)
1763 +#define FBIOSPLASH_SETPIC _IOWR('F', 0x1D, struct fb_splash_iowrapper)
1765 +#define FB_SPLASH_THEME_LEN 128 /* Maximum lenght of a theme name */
1766 +#define FB_SPLASH_IO_ORIG_KERNEL 0 /* Kernel ioctl origin */
1767 +#define FB_SPLASH_IO_ORIG_USER 1 /* User ioctl origin */
1769 #define FB_TYPE_PACKED_PIXELS 0 /* Packed Pixels */
1770 #define FB_TYPE_PLANES 1 /* Non interleaved planes */
1771 @@ -785,6 +800,9 @@ #define FBINFO_STATE_RUNNING 0
1772 #define FBINFO_STATE_SUSPENDED 1
1773 u32 state; /* Hardware state i.e suspend */
1774 void *fbcon_par; /* fbcon use-only private area */
1776 + struct fb_image splash;
1778 /* From here on everything is device dependent */
1781 diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
1782 index e4b1a4d..5741f04 100644
1783 --- a/include/linux/sysctl.h
1784 +++ b/include/linux/sysctl.h
1785 @@ -150,6 +150,7 @@ enum
1786 KERN_IA64_UNALIGNED=72, /* int: ia64 unaligned userland trap enable */
1787 KERN_COMPAT_LOG=73, /* int: print compat layer messages */
1788 KERN_MAX_LOCK_DEPTH=74,
1789 + KERN_FBSPLASH=75, /* string: path to fbsplash helper */
1793 diff --git a/kernel/sysctl.c b/kernel/sysctl.c
1794 index 362a0cc..883c8c9 100644
1795 --- a/kernel/sysctl.c
1796 +++ b/kernel/sysctl.c
1797 @@ -90,6 +90,9 @@ static int ngroups_max = NGROUPS_MAX;
1799 extern char modprobe_path[];
1801 +#ifdef CONFIG_FB_SPLASH
1802 +extern char fbsplash_path[];
1804 #ifdef CONFIG_CHR_DEV_SG
1805 extern int sg_big_buff;
1807 @@ -407,6 +410,17 @@ #if defined(CONFIG_HOTPLUG) && defined(C
1808 .strategy = &sysctl_string,
1811 +#ifdef CONFIG_FB_SPLASH
1813 + .ctl_name = KERN_FBSPLASH,
1814 + .procname = "fbsplash",
1815 + .data = &fbsplash_path,
1816 + .maxlen = KMOD_PATH_LEN,
1818 + .proc_handler = &proc_dostring,
1819 + .strategy = &sysctl_string,
1822 #ifdef CONFIG_CHR_DEV_SG
1824 .ctl_name = KERN_SG_BIG_BUFF,
1825 diff --git a/scripts/hdrcheck.sh b/scripts/hdrcheck.sh