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