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