/[linux-patches]/genpatches-2.6/historical/2.6.10/4500_fbsplash-0.9.1-r1.patch
Gentoo

Contents of /genpatches-2.6/historical/2.6.10/4500_fbsplash-0.9.1-r1.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2 - (show annotations) (download) (as text)
Sat Jun 11 23:16:54 2005 UTC (15 years ago) by dsd
File MIME type: text/x-diff
File size: 61566 byte(s)
Import historical releases
1 diff -urNpX dontdiff linux-2.6.10-gentoo-r7/Documentation/fb/00-INDEX linux-dsd/Documentation/fb/00-INDEX
2 --- linux-2.6.10-gentoo-r7/Documentation/fb/00-INDEX 2004-12-24 21:35:00.000000000 +0000
3 +++ linux-dsd/Documentation/fb/00-INDEX 2005-02-05 00:23:45.020484912 +0000
4 @@ -19,6 +19,8 @@ matroxfb.txt
5 - info on the Matrox frame buffer driver
6 pvr2fb.txt
7 - info on the PowerVR 2 frame buffer driver
8 +splash.txt
9 + - info on the Framebuffer Splash
10 tgafb.txt
11 - info on the TGA (DECChip 21030) frame buffer driver
12 vesafb.txt
13 diff -urNpX dontdiff linux-2.6.10-gentoo-r7/Documentation/fb/splash.txt linux-dsd/Documentation/fb/splash.txt
14 --- linux-2.6.10-gentoo-r7/Documentation/fb/splash.txt 1970-01-01 01:00:00.000000000 +0100
15 +++ linux-dsd/Documentation/fb/splash.txt 2005-02-05 00:23:45.021484760 +0000
16 @@ -0,0 +1,230 @@
17 +What is it?
18 +-----------
19 +
20 +The framebuffer splash is a kernel feature that allows displaying a background
21 +picture on selected consoles and switching the first console to the so-called
22 +silent mode, while booting/rebooting/shutting down the system.
23 +
24 +What do I need to get it to work?
25 +---------------------------------
26 +
27 +To get fb splash up-and-running you will have to:
28 + 1) get a copy of splashutils from (FIXME URL)
29 + 2) get some splash themes (FIXME URL)
30 + 3) build the kernel helper program
31 + 4) build your kernel with the FB_SPLASH option enabled.
32 +
33 +To get fb splash operational right after fbcon initialization is finished, you
34 +will have to include a theme and the kernel helper into your initramfs image.
35 +Please refer to splashutils documentation for instructions on how to do that.
36 +
37 +Operation modes
38 +---------------
39 +
40 +The framebuffer splash can work in two modes: verbose and silent. The first
41 +one means "console with a background image". The latter one is a concept
42 +first introduced in bootsplash. When silent mode is active, the console is
43 +switched to a graphic mode and no text is displayed. It's up to the userspace
44 +programs to display something (a progress bar for example) on the screen.
45 +
46 +Kernel command line parameters
47 +------------------------------
48 +
49 +Framebuffer splash can be configured from the kernel command line by passing
50 +options in the following way: "splash=option1,option2".
51 +
52 +The following options are recognized:
53 +
54 +off - do not enable fbsplash after fbcon initialization; this is
55 + default behaviour
56 +verbose - switch fbsplash to verbose mode after fbcon is initialized
57 +silent - switch fbsplash to silent mode after fbcon is initialized
58 +
59 +theme:<name> - use theme 'name' on the first console, default theme name
60 + is 'default' (who'd have guessed?)
61 +
62 +Example - you want to get verbose splash with the theme 'tux' right after
63 +fbcon is up:
64 + splash=verbose,theme:tux
65 +
66 +The userspace helper
67 +--------------------
68 +
69 +The userspace splash helper (by default: /sbin/splash_helper) is called by the
70 +kernel whenever an important event occurs and the kernel needs some kind of
71 +job to be carried out. Important events include console switches and graphic
72 +mode switches (the kernel requests background images and config for the current
73 +console). The splash helper must be accessible at all times. If it's not,
74 +fbsplash will be switched off automatically.
75 +
76 +It's possible to set path to the splash helper by writing it to
77 +/proc/sys/kernel/fbsplash.
78 +
79 +*****************************************************************************
80 +
81 +The information below is mostly technical stuff. If you don't plan to develop
82 +something fbsplash-related, there's probably no need to read it.
83 +
84 +The splash protocol
85 +-------------------
86 +
87 +The splash protocol defines a communication interface between the kernel and
88 +the userspace splash helper.
89 +
90 +The kernel side is responsible for:
91 +
92 + o rendering console text, using an image as a background (instead of a
93 + standard solid color fbcon uses),
94 + o accepting commands from the user via ioctls on the fbsplash device,
95 + o calling the userspace helper to set things up as soon as the fb subsystem is
96 + initialized.
97 +
98 +The userspace helper is responsible for everything else, including parsing
99 +configuration files, decompressing the image files whenever the kernel needs
100 +it, and communicating with the kernel if necessary.
101 +
102 +The splash protocol specifies how communication is done in both ways:
103 +kernel->userspace and userspace->helper.
104 +
105 +Kernel -> Userspace
106 +-------------------
107 +
108 +The kernel communicates with the userspace helper by calling it and specifying
109 +the task that to be done in a series of arguments.
110 +
111 +The arguments follow the pattern:
112 +<splash protocol version> <command> <parameters>
113 +
114 +All commands defined in splash protocol v1 have the following parameters:
115 + virtual console
116 + framebuffer number
117 + splash mode - 'v' indicates verbose, 's' indicates silent
118 + theme
119 +
120 +Splash protocol v1 specifies the following commands:
121 +
122 +getpic
123 +------
124 + The kernel issues this command to request image data. It's up to the userspace
125 + helper to find a background image appropriate for the specified theme and the
126 + current resolution. The userspace helper should respond by issuing the
127 + FBIOSPLASH_SETPIC ioctl.
128 +
129 +init
130 +----
131 + The kernel issues this command if either 'verbose' or 'silent' has been
132 + specified in splash= on the kernel command line. Upon receiving this command,
133 + the userspace helper should find a proper configuration file for the
134 + specified theme and the current resolution, and issue the FBIOSPLASH_SETCFG.
135 + FBIOSPLASH_SETPIC and FBIOSPLASH_SETSTATE commands.
136 +
137 + When the userspace helper is called in an early phase of the boot process
138 + (right after the initialization of fbcon), no filesystems will be mounted.
139 + The helper program should mount sysfs and then create the appropriate
140 + framebuffer, fbsplash and tty0 devices (if they don't already exist) to get
141 + current display settings and to be able to communicate with the kernel side.
142 +
143 + Note that the console sem is not held when the kernel calls splash_helper
144 + with the 'init' command. The splash helper should perform all ioctls with
145 + origin set to FB_SPLASH_IO_ORIG_USER.
146 +
147 +modechange
148 +----------
149 + The kernel issues this command on a mode change. The helper's response should
150 + be similar to the response to the 'init' command. Note that this time the
151 + console sem is held and all ioctls must be performed with origin set to
152 + FB_SPLASH_IO_ORIG_KERNEL.
153 +
154 +
155 +Userspace -> Kernel
156 +-------------------
157 +
158 +Userspace programs can communicate with the kernel side via ioctls on the
159 +on the fbsplash device. These ioctls are to be used by both the userspace helper
160 +(called only by the kernel) and userspace configuration tools (run by the users).
161 +The splash helper should set the origin field to FB_SPLASH_IO_ORIG_KERNEL when
162 +doing the appropriate ioctls. All userspace configuration tools should use
163 +FB_SPLASH_IO_ORIG_USER. Failure to set the appropriate value in the origin
164 +field when performing ioctls from the kernel helper may result in a deadlock.
165 +
166 +The framebuffer splash provides the following ioctls (all defined in linux/fb.h):
167 +
168 +FBIOSPLASH_SETMODE
169 +description: sets the global fbsplash mode
170 +argument: unsigned int; values: FB_SPLASH_MODE_VERBOSE, FB_SPLASH_MODE_SILENT
171 +
172 +FBIOSPLASH_GETMODE
173 +description: gets the global fbsplash mode
174 +argument: unsigned int*; values as in FBIOSPLASH_SETMODE
175 +
176 +FBIOSPLASH_SETPIC
177 +description: loads a background picture for a virtual console
178 +argument: struct fb_splash_iowrapper*; data: struct fb_image*
179 +notes:
180 +If called for consoles other than the current foreground one, the picture data
181 +will be ignored.
182 +
183 +If the current virtual console is running in a 8-bpp mode, the cmap substruct
184 +of fb_image has to be filled appropriately: start should be set to 16 (first 16
185 +colors are reserved for fbcon), len to a value <= 240 and red, green and blue
186 +should point to valid cmap data. The transp field is ingored. The fields dx, dy
187 +bg_color, fg_color in fb_image are ignored as well.
188 +
189 +FBIOSPLASH_SETCFG
190 +description: sets the fbsplash config for a virtual console
191 +argument: struct fb_splash_iowrapper*; data: struct vc_splash*;
192 + the structure has to be filled with valid data.
193 +
194 +FBIOSPLASH_GETCFG
195 +description: gets the fbsplash config for a virtual console
196 +argument: struct fb_splash_iowrapper*; data: struct vc_splash*
197 +
198 +FBIOSPLASH_SETSTATE
199 +description: sets the fbsplash state for a virtual console
200 +argument: struct fb_splash_iowrapper*; data: unsigned int*
201 + values: 0 = disabled, 1 = enabled.
202 +
203 +FBIOSPLASH_GETSTATE
204 +description: gets the fbsplash state for a virtual console
205 +argument: struct fb_splash_iowrapper*; data: unsigned int*
206 + values: as in FBIOSPLASH_SETSTATE
207 +
208 +Info on used structures:
209 +
210 +Definition of struct vc_splash can be found in linux/console_splash.h, it's
211 +heavily commented, so no special descriptions are necessary. Note that
212 +the 'theme' field should point to a string no longer than FB_SPLASH_THEME_LEN.
213 +When FBIOSPLASH_GETCFG call is performed, the theme field should point to a
214 +char buffer of length FB_SPLASH_THEME_LEN.
215 +
216 +Definition of struct fb_splash_iowrapper can be found in linux/fb.h.
217 +The fields in this struct have the following meaning:
218 +
219 +vc:
220 +Virtual console number.
221 +
222 +origin:
223 +Specifies if the ioctl is performed as a response to a kernel request. The
224 +splash helper should set this field to FB_SPLASH_IO_ORIG_KERNEL, userspace
225 +programs should set it to FB_SPLASH_IO_ORIG_USER. This field is necessary to
226 +avoid console semaphore deadlocks.
227 +
228 +data:
229 +Pointer to a data structure appropriate for the performed ioctl. Type of
230 +the data struct is specified in the ioctls description, for example 'data:
231 +struct vc_splash*' means that the 'data' field should be a pointer to a
232 +vc_splash struct.
233 +
234 +*****************************************************************************
235 +
236 +Credit
237 +------
238 +
239 +Original idea & implementation by:
240 + Volker Poplawski <volker@poplawski.de>, Stefan Reinauer <stepan@suse.de>,
241 + Steffen Winterfeldt <snwint@suse.de>, Michael Schroeder <mls@suse.de>,
242 + Ken Wimer <wimer@suse.de>.
243 +
244 +Splash protocol redesign, current implementation, docs by:
245 + Michal Januszewski <spock@gentoo.org>
246 +
247 diff -urNpX dontdiff linux-2.6.10-gentoo-r7/drivers/char/keyboard.c linux-dsd/drivers/char/keyboard.c
248 --- linux-2.6.10-gentoo-r7/drivers/char/keyboard.c 2004-12-24 21:35:50.000000000 +0000
249 +++ linux-dsd/drivers/char/keyboard.c 2005-02-05 00:23:45.022484608 +0000
250 @@ -41,6 +41,8 @@
251 #include <linux/sysrq.h>
252 #include <linux/input.h>
253
254 +#include "../video/fbsplash.h"
255 +
256 static void kbd_disconnect(struct input_handle *handle);
257 extern void ctrl_alt_del(void);
258
259 @@ -1071,6 +1073,12 @@ void kbd_keycode(unsigned int keycode, i
260 if (keycode < BTN_MISC)
261 printk(KERN_WARNING "keyboard.c: can't emulate rawmode for keycode %d\n", keycode);
262
263 + /* switch splash to verbose mode if ESC or F2 is pressed */
264 + if (down == 1 && (keycode == KEY_ESC || keycode == KEY_F2)) {
265 + if (fbsplash_verbose())
266 + return;
267 + }
268 +
269 #ifdef CONFIG_MAGIC_SYSRQ /* Handle the SysRq Hack */
270 if (keycode == KEY_SYSRQ && (sysrq_down || (down == 1 && sysrq_alt))) {
271 sysrq_down = down;
272 diff -urNpX dontdiff linux-2.6.10-gentoo-r7/drivers/char/n_tty.c linux-dsd/drivers/char/n_tty.c
273 --- linux-2.6.10-gentoo-r7/drivers/char/n_tty.c 2004-12-24 21:33:49.000000000 +0000
274 +++ linux-dsd/drivers/char/n_tty.c 2005-02-05 00:23:45.023484456 +0000
275 @@ -49,6 +49,8 @@
276 #include <asm/uaccess.h>
277 #include <asm/system.h>
278
279 +#include "../video/fbsplash.h"
280 +
281 /* number of characters left in xmit buffer before select has we have room */
282 #define WAKEUP_CHARS 256
283
284 @@ -1179,6 +1181,15 @@ extern ssize_t redirected_tty_write(stru
285
286 static int job_control(struct tty_struct *tty, struct file *file)
287 {
288 + /* automatically switch splash to verbose mode if someone tries to
289 + read from tty0 */
290 + if (file->f_dentry->d_inode->i_rdev == MKDEV(TTY_MAJOR,0) ||
291 + file->f_dentry->d_inode->i_rdev == MKDEV(TTY_MAJOR,1) ||
292 + file->f_dentry->d_inode->i_rdev == MKDEV(TTYAUX_MAJOR,0) ||
293 + file->f_dentry->d_inode->i_rdev == MKDEV(TTYAUX_MAJOR,1)) {
294 + fbsplash_verbose();
295 + }
296 +
297 /* Job control check -- must be done at start and after
298 every sleep (POSIX.1 7.1.1.4). */
299 /* NOTE: not yet done after every sleep pending a thorough
300 diff -urNpX dontdiff linux-2.6.10-gentoo-r7/drivers/Makefile linux-dsd/drivers/Makefile
301 --- linux-2.6.10-gentoo-r7/drivers/Makefile 2004-12-24 21:36:00.000000000 +0000
302 +++ linux-dsd/drivers/Makefile 2005-02-05 00:23:45.023484456 +0000
303 @@ -7,16 +7,15 @@
304
305 obj-$(CONFIG_PCI) += pci/
306 obj-$(CONFIG_PARISC) += parisc/
307 +# char/ comes before serial/ etc so that the VT console is the boot-time
308 +# default.
309 +obj-y += char/
310 obj-y += video/
311 obj-$(CONFIG_ACPI_BOOT) += acpi/
312 # PnP must come after ACPI since it will eventually need to check if acpi
313 # was used and do nothing if so
314 obj-$(CONFIG_PNP) += pnp/
315
316 -# char/ comes before serial/ etc so that the VT console is the boot-time
317 -# default.
318 -obj-y += char/
319 -
320 # i810fb and intelfb depend on char/agp/
321 obj-$(CONFIG_FB_I810) += video/i810/
322 obj-$(CONFIG_FB_INTEL) += video/intelfb/
323 diff -urNpX dontdiff linux-2.6.10-gentoo-r7/drivers/video/cfbsplash.c linux-dsd/drivers/video/cfbsplash.c
324 --- linux-2.6.10-gentoo-r7/drivers/video/cfbsplash.c 1970-01-01 01:00:00.000000000 +0100
325 +++ linux-dsd/drivers/video/cfbsplash.c 2005-02-05 00:23:45.024484304 +0000
326 @@ -0,0 +1,467 @@
327 +/*
328 + * linux/drivers/video/cfbsplash.c -- Framebuffer splash render functions
329 + *
330 + * Copyright (C) 2004 Michal Januszewski <spock@gentoo.org>
331 + *
332 + * Code based upon "Bootsplash" (C) 2001-2003
333 + * Volker Poplawski <volker@poplawski.de>,
334 + * Stefan Reinauer <stepan@suse.de>,
335 + * Steffen Winterfeldt <snwint@suse.de>,
336 + * Michael Schroeder <mls@suse.de>,
337 + * Ken Wimer <wimer@suse.de>.
338 + *
339 + * This file is subject to the terms and conditions of the GNU General Public
340 + * License. See the file COPYING in the main directory of this archive for
341 + * more details.
342 + */
343 +#include <linux/config.h>
344 +#include <linux/module.h>
345 +#include <linux/types.h>
346 +#include <linux/fb.h>
347 +#include <linux/selection.h>
348 +#include <linux/vt_kern.h>
349 +#include <asm/irq.h>
350 +#include <asm/system.h>
351 +
352 +#include "console/fbcon.h"
353 +#include "fbsplash.h"
354 +
355 +#define parse_pixel(shift,bpp,type) \
356 + do { \
357 + if (d & (0x80 >> (shift))) \
358 + dd2[(shift)] = fgx; \
359 + else \
360 + dd2[(shift)] = transparent ? *(type *)splash_src : bgx; \
361 + splash_src += (bpp); \
362 + } while (0) \
363 +
364 +extern int get_color(struct vc_data *vc, struct fb_info *info,
365 + u16 c, int is_fg);
366 +
367 +void fbsplash_fix_pseudo_pal(struct fb_info *info, struct vc_data *vc)
368 +{
369 + int i, j, k;
370 + int minlen = min(min(info->var.red.length, info->var.green.length),
371 + info->var.blue.length);
372 + u32 col;
373 +
374 + for (j = i = 0; i < 16; i++) {
375 + k = color_table[i];
376 +
377 + col = ((vc->vc_palette[j++] >> (8-minlen))
378 + << info->var.red.offset);
379 + col |= ((vc->vc_palette[j++] >> (8-minlen))
380 + << info->var.green.offset);
381 + col |= ((vc->vc_palette[j++] >> (8-minlen))
382 + << info->var.blue.offset);
383 + ((u32 *)info->pseudo_palette)[k] = col;
384 + }
385 +}
386 +
387 +void fbsplash_renderc(struct fb_info *info, int ypos, int xpos, int height,
388 + int width, u8* src, u32 fgx, u32 bgx, u8 transparent)
389 +{
390 + unsigned int x, y;
391 + u32 dd;
392 + int bytespp = ((info->var.bits_per_pixel + 7) >> 3);
393 + unsigned int d = ypos * info->fix.line_length + xpos * bytespp;
394 + unsigned int ds = (ypos * info->var.xres + xpos) * bytespp;
395 + u16 dd2[4];
396 +
397 + u8* splash_src = (u8 *)(info->splash.data + ds);
398 + u8* dst = (u8 *)(info->screen_base + d);
399 +
400 + if ((ypos + height) > info->var.yres || (xpos + width) > info->var.xres)
401 + return;
402 +
403 + for (y = 0; y < height; y++) {
404 + switch (info->var.bits_per_pixel) {
405 +
406 + case 32:
407 + for (x = 0; x < width; x++) {
408 +
409 + if ((x & 7) == 0)
410 + d = *src++;
411 + if (d & 0x80)
412 + dd = fgx;
413 + else
414 + dd = transparent ?
415 + *(u32 *)splash_src : bgx;
416 +
417 + d <<= 1;
418 + splash_src += 4;
419 + fb_writel(dd, dst);
420 + dst += 4;
421 + }
422 + break;
423 + case 24:
424 + for (x = 0; x < width; x++) {
425 +
426 + if ((x & 7) == 0)
427 + d = *src++;
428 + if (d & 0x80)
429 + dd = fgx;
430 + else
431 + dd = transparent ?
432 + (*(u32 *)splash_src & 0xffffff) : bgx;
433 +
434 + d <<= 1;
435 + splash_src += 3;
436 +#ifdef __LITTLE_ENDIAN
437 + fb_writew(dd & 0xffff, dst);
438 + dst += 2;
439 + fb_writeb((dd >> 16), dst);
440 +#else
441 + fb_writew(dd >> 8, dst);
442 + dst += 2;
443 + fb_writeb(dd & 0xff, dst);
444 +#endif
445 + dst++;
446 + }
447 + break;
448 + case 16:
449 + for (x = 0; x < width; x += 2) {
450 + if ((x & 7) == 0)
451 + d = *src++;
452 +
453 + parse_pixel(0, 2, u16);
454 + parse_pixel(1, 2, u16);
455 +#ifdef __LITTLE_ENDIAN
456 + dd = dd2[0] | (dd2[1] << 16);
457 +#else
458 + dd = dd2[1] | (dd2[0] << 16);
459 +#endif
460 + d <<= 2;
461 + fb_writel(dd, dst);
462 + dst += 4;
463 + }
464 + break;
465 +
466 + case 8:
467 + for (x = 0; x < width; x += 4) {
468 + if ((x & 7) == 0)
469 + d = *src++;
470 +
471 + parse_pixel(0, 1, u8);
472 + parse_pixel(1, 1, u8);
473 + parse_pixel(2, 1, u8);
474 + parse_pixel(3, 1, u8);
475 +
476 +#ifdef __LITTLE_ENDIAN
477 + dd = dd2[0] | (dd2[1] << 8) | (dd2[2] << 16) | (dd2[3] << 24);
478 +#else
479 + dd = dd2[3] | (dd2[2] << 8) | (dd2[1] << 16) | (dd2[0] << 24);
480 +#endif
481 + d <<= 4;
482 + fb_writel(dd, dst);
483 + dst += 4;
484 + }
485 + }
486 +
487 + dst += info->fix.line_length - width * bytespp;
488 + splash_src += (info->var.xres - width) * bytespp;
489 + }
490 +}
491 +
492 +#define cc2cx(a) \
493 + ((info->fix.visual == FB_VISUAL_TRUECOLOR || \
494 + info->fix.visual == FB_VISUAL_DIRECTCOLOR) ? \
495 + ((u32*)info->pseudo_palette)[a] : a)
496 +
497 +void fbsplash_putcs(struct vc_data *vc, struct fb_info *info,
498 + const unsigned short *s, int count, int yy, int xx)
499 +{
500 + unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff;
501 + int fg_color, bg_color, transparent;
502 +
503 + u8 *src;
504 + u32 bgx, fgx;
505 +
506 + u16 c = scr_readw(s);
507 +
508 + fg_color = get_color(vc, info, c, 1);
509 + bg_color = get_color(vc, info, c, 0);
510 + transparent = vc->vc_splash.bg_color == bg_color;
511 +
512 + xx = xx * vc->vc_font.width + vc->vc_splash.tx;
513 + yy = yy * vc->vc_font.height + vc->vc_splash.ty;
514 +
515 + fgx = cc2cx(fg_color);
516 + bgx = cc2cx(bg_color);
517 +
518 + while (count--) {
519 + c = scr_readw(s++);
520 + src = vc->vc_font.data + (c & charmask) * vc->vc_font.height *
521 + ((vc->vc_font.width + 7) >> 3);
522 +
523 + fbsplash_renderc(info, yy, xx, vc->vc_font.height,
524 + vc->vc_font.width, src, fgx, bgx, transparent);
525 + xx += vc->vc_font.width;
526 + }
527 +}
528 +
529 +void fbsplash_cursor(struct fb_info *info, struct fb_cursor *cursor)
530 +{
531 + int i;
532 + unsigned int dsize, s_pitch;
533 + struct fbcon_ops *ops = info->fbcon_par;
534 + struct vc_data* vc;
535 + u8 *src;
536 +
537 + if (info->state != FBINFO_STATE_RUNNING)
538 + return;
539 +
540 + vc = vc_cons[ops->currcon].d;
541 +
542 + src = kmalloc(64 + sizeof(struct fb_image), GFP_ATOMIC);
543 + if (!src)
544 + return;
545 +
546 + s_pitch = (cursor->image.width + 7) >> 3;
547 + dsize = s_pitch * cursor->image.height;
548 + if (cursor->enable) {
549 + switch (cursor->rop) {
550 + case ROP_XOR:
551 + for (i = 0; i < dsize; i++)
552 + src[i] = cursor->image.data[i] ^ cursor->mask[i];
553 + break;
554 + case ROP_COPY:
555 + default:
556 + for (i = 0; i < dsize; i++)
557 + src[i] = cursor->image.data[i] & cursor->mask[i];
558 + break;
559 + }
560 + } else
561 + memcpy(src, cursor->image.data, dsize);
562 +
563 + fbsplash_renderc(info,
564 + cursor->image.dy + vc->vc_splash.ty,
565 + cursor->image.dx + vc->vc_splash.tx,
566 + cursor->image.height,
567 + cursor->image.width,
568 + (u8*)src,
569 + cc2cx(cursor->image.fg_color),
570 + cc2cx(cursor->image.bg_color),
571 + cursor->image.bg_color == vc->vc_splash.bg_color);
572 +
573 + kfree(src);
574 +}
575 +
576 +static void splashset(u8 *dst, int height, int width, int dstbytes,
577 + u32 bgx, int bpp)
578 +{
579 + int i;
580 +
581 + if (bpp == 8)
582 + bgx |= bgx << 8;
583 + if (bpp == 16 || bpp == 8)
584 + bgx |= bgx << 16;
585 +
586 + while (height-- > 0) {
587 + u8 *p = dst;
588 +
589 + switch (bpp) {
590 +
591 + case 32:
592 + for (i=0; i < width; i++) {
593 + fb_writel(bgx, p); p += 4;
594 + }
595 + break;
596 + case 24:
597 + for (i=0; i < width; i++) {
598 +#ifdef __LITTLE_ENDIAN
599 + fb_writew((bgx & 0xffff),(u16*)p); p += 2;
600 + fb_writeb((bgx >> 16),p++);
601 +#else
602 + fb_writew((bgx >> 8),(u16*)p); p += 2;
603 + fb_writeb((bgx & 0xff),p++);
604 +#endif
605 + }
606 + case 16:
607 + for (i=0; i < width/4; i++) {
608 + fb_writel(bgx,p); p += 4;
609 + fb_writel(bgx,p); p += 4;
610 + }
611 + if (width & 2) {
612 + fb_writel(bgx,p); p += 4;
613 + }
614 + if (width & 1)
615 + fb_writew(bgx,(u16*)p);
616 + break;
617 + case 8:
618 + for (i=0; i < width/4; i++) {
619 + fb_writel(bgx,p); p += 4;
620 + }
621 +
622 + if (width & 2) {
623 + fb_writew(bgx,p); p += 2;
624 + }
625 + if (width & 1)
626 + fb_writeb(bgx,(u8*)p);
627 + break;
628 +
629 + }
630 + dst += dstbytes;
631 + }
632 +}
633 +
634 +void fbsplash_copy(u8 *dst, u8 *src, int height, int width, int linebytes,
635 + int srclinebytes, int bpp)
636 +{
637 + int i;
638 +
639 + while (height-- > 0) {
640 + u32 *p = (u32 *)dst;
641 + u32 *q = (u32 *)src;
642 +
643 + switch (bpp) {
644 +
645 + case 32:
646 + for (i=0; i < width; i++)
647 + fb_writel(*q++, p++);
648 + break;
649 + case 24:
650 + for (i=0; i < (width*3/4); i++)
651 + fb_writel(*q++, p++);
652 + if ((width*3) % 4) {
653 + if (width & 2) {
654 + fb_writeb(*(u8*)q, (u8*)p);
655 + } else if (width & 1) {
656 + fb_writew(*(u16*)q, (u16*)p);
657 + fb_writeb(*(u8*)((u16*)q+1),(u8*)((u16*)p+2));
658 + }
659 + }
660 + break;
661 + case 16:
662 + for (i=0; i < width/4; i++) {
663 + fb_writel(*q++, p++);
664 + fb_writel(*q++, p++);
665 + }
666 + if (width & 2)
667 + fb_writel(*q++, p++);
668 + if (width & 1)
669 + fb_writew(*(u16*)q, (u16*)p);
670 + break;
671 + case 8:
672 + for (i=0; i < width/4; i++)
673 + fb_writel(*q++, p++);
674 +
675 + if (width & 2) {
676 + fb_writew(*(u16*)q, (u16*)p);
677 + q = (u32*) ((u16*)q + 1);
678 + p = (u32*) ((u16*)p + 1);
679 + }
680 + if (width & 1)
681 + fb_writeb(*(u8*)q, (u8*)p);
682 + break;
683 + }
684 +
685 + dst += linebytes;
686 + src += srclinebytes;
687 + }
688 +}
689 +
690 +static void splashfill(struct fb_info *info, int sy, int sx, int height,
691 + int width)
692 +{
693 + int bytespp = ((info->var.bits_per_pixel + 7) >> 3);
694 + int d = sy * info->fix.line_length + sx * bytespp;
695 + int ds = (sy * info->var.xres + sx) * bytespp;
696 +
697 + fbsplash_copy((u8 *)(info->screen_base + d), (u8 *)(info->splash.data + ds),
698 + height, width, info->fix.line_length, info->var.xres * bytespp,
699 + info->var.bits_per_pixel);
700 +}
701 +
702 +void fbsplash_clear(struct vc_data *vc, struct fb_info *info, int sy, int sx,
703 + int height, int width)
704 +{
705 + int bgshift = (vc->vc_hi_font_mask) ? 13 : 12;
706 + int bg_color = attr_bgcol_ec(bgshift, vc);
707 + int transparent = vc->vc_splash.bg_color == bg_color;
708 + u8 *dst;
709 +
710 + sy = sy * vc->vc_font.height + vc->vc_splash.ty;
711 + sx = sx * vc->vc_font.width + vc->vc_splash.tx;
712 + height *= vc->vc_font.height;
713 + width *= vc->vc_font.width;
714 +
715 + if (transparent) {
716 + splashfill(info, sy, sx, height, width);
717 + } else {
718 + dst = (u8 *)(info->screen_base + sy * info->fix.line_length +
719 + sx * ((info->var.bits_per_pixel + 7) >> 3));
720 + splashset(dst, height, width, info->fix.line_length, cc2cx(bg_color),
721 + info->var.bits_per_pixel);
722 + }
723 +}
724 +
725 +void fbsplash_clear_margins(struct vc_data *vc, struct fb_info *info,
726 + int bottom_only)
727 +{
728 + unsigned int tw = vc->vc_cols*vc->vc_font.width;
729 + unsigned int th = vc->vc_rows*vc->vc_font.height;
730 +
731 + if (!bottom_only) {
732 + /* top margin */
733 + splashfill(info, 0, 0, vc->vc_splash.ty, info->var.xres);
734 + /* left margin */
735 + splashfill(info, vc->vc_splash.ty, 0, th, vc->vc_splash.tx);
736 + /* right margin */
737 + splashfill(info, vc->vc_splash.ty, vc->vc_splash.tx + tw, th,
738 + info->var.xres - vc->vc_splash.tx - tw);
739 + }
740 + splashfill(info, vc->vc_splash.ty + th, 0,
741 + info->var.yres - vc->vc_splash.ty - th, info->var.xres);
742 +}
743 +
744 +void fbsplash_bmove_redraw(struct vc_data *vc, struct fb_info *info, int y,
745 + int sx, int dx, int width)
746 +{
747 + u16 *d = (u16 *) (vc->vc_origin + vc->vc_size_row * y + dx * 2);
748 + u16 *s = d + (dx - sx);
749 + u16 *start = d;
750 + u16 *ls = d;
751 + u16 *le = d + width;
752 + u16 c;
753 + int x = dx;
754 + u16 attr = 1;
755 +
756 + do {
757 + c = scr_readw(d);
758 + if (attr != (c & 0xff00)) {
759 + attr = c & 0xff00;
760 + if (d > start) {
761 + fbsplash_putcs(vc, info, start, d - start, y, x);
762 + x += d - start;
763 + start = d;
764 + }
765 + }
766 + if (s >= ls && s < le && c == scr_readw(s)) {
767 + if (d > start) {
768 + fbsplash_putcs(vc, info, start, d - start, y, x);
769 + x += d - start + 1;
770 + start = d + 1;
771 + } else {
772 + x++;
773 + start++;
774 + }
775 + }
776 + s++;
777 + d++;
778 + } while (d < le);
779 + if (d > start)
780 + fbsplash_putcs(vc, info, start, d - start, y, x);
781 +}
782 +
783 +void fbsplash_blank(struct vc_data *vc, struct fb_info *info, int blank)
784 +{
785 + if (blank) {
786 + splashset((u8 *)info->screen_base, info->var.yres, info->var.xres,
787 + info->fix.line_length, 0, info->var.bits_per_pixel);
788 + } else {
789 + update_screen(vc->vc_num);
790 + fbsplash_clear_margins(vc, info, 0);
791 + }
792 +}
793 +
794 diff -urNpX dontdiff linux-2.6.10-gentoo-r7/drivers/video/console/bitblit.c linux-dsd/drivers/video/console/bitblit.c
795 --- linux-2.6.10-gentoo-r7/drivers/video/console/bitblit.c 2004-12-24 21:35:49.000000000 +0000
796 +++ linux-dsd/drivers/video/console/bitblit.c 2005-02-05 00:23:45.025484152 +0000
797 @@ -18,6 +18,7 @@
798 #include <linux/console.h>
799 #include <asm/types.h>
800 #include "fbcon.h"
801 +#include "../fbsplash.h"
802
803 /*
804 * Accelerated handlers.
805 @@ -84,6 +85,13 @@ static void bit_bmove(struct vc_data *vc
806 area.height = height * vc->vc_font.height;
807 area.width = width * vc->vc_font.width;
808
809 + if (fbsplash_active(info, vc)) {
810 + area.sx += vc->vc_splash.tx;
811 + area.sy += vc->vc_splash.ty;
812 + area.dx += vc->vc_splash.tx;
813 + area.dy += vc->vc_splash.ty;
814 + }
815 +
816 info->fbops->fb_copyarea(info, &area);
817 }
818
819 @@ -373,7 +381,11 @@ static void bit_cursor(struct vc_data *v
820 cursor.image.depth = 1;
821 cursor.rop = ROP_XOR;
822
823 - info->fbops->fb_cursor(info, &cursor);
824 + if (fbsplash_active(info, vc)) {
825 + fbsplash_cursor(info, &cursor);
826 + } else {
827 + info->fbops->fb_cursor(info, &cursor);
828 + }
829
830 ops->cursor_reset = 0;
831 }
832 diff -urNpX dontdiff linux-2.6.10-gentoo-r7/drivers/video/console/fbcon.c linux-dsd/drivers/video/console/fbcon.c
833 --- linux-2.6.10-gentoo-r7/drivers/video/console/fbcon.c 2004-12-24 21:35:21.000000000 +0000
834 +++ linux-dsd/drivers/video/console/fbcon.c 2005-02-05 00:23:45.026484000 +0000
835 @@ -93,6 +93,7 @@
836 #endif
837
838 #include "fbcon.h"
839 +#include "../fbsplash.h"
840
841 #ifdef FBCONDEBUG
842 # define DPRINTK(fmt, args...) printk(KERN_DEBUG "%s: " fmt, __FUNCTION__ , ## args)
843 @@ -206,7 +207,7 @@ static inline int fbcon_is_inactive(stru
844 vt_cons[vc->vc_num]->vc_mode != KD_TEXT);
845 }
846
847 -static inline int get_color(struct vc_data *vc, struct fb_info *info,
848 +inline int get_color(struct vc_data *vc, struct fb_info *info,
849 u16 c, int is_fg)
850 {
851 int depth = fb_get_color_depth(info);
852 @@ -279,6 +280,7 @@ static void fb_flashcursor(void *private
853 CM_ERASE : CM_DRAW;
854 ops->cursor(vc, info, p, mode, get_color(vc, info, c, 1),
855 get_color(vc, info, c, 0));
856 +
857 release_console_sem();
858 }
859
860 @@ -404,6 +406,8 @@ static int fbcon_takeover(int show_logo)
861 info_idx = -1;
862 }
863
864 + fbsplash_init();
865 +
866 return err;
867 }
868
869 @@ -802,6 +806,12 @@ static const char *fbcon_startup(void)
870
871 cols = info->var.xres / vc->vc_font.width;
872 rows = info->var.yres / vc->vc_font.height;
873 +
874 + if (fbsplash_active(info, vc)) {
875 + cols = vc->vc_splash.twidth / vc->vc_font.width;
876 + rows = vc->vc_splash.theight / vc->vc_font.height;
877 + }
878 +
879 vc_resize(vc->vc_num, cols, rows);
880
881 DPRINTK("mode: %s\n", info->fix.id);
882 @@ -897,7 +907,7 @@ static void fbcon_init(struct vc_data *v
883 if (info_idx == -1 || info == NULL)
884 return;
885 if (vc->vc_num != display_fg || logo_shown == FBCON_LOGO_DONTSHOW ||
886 - (info->fix.type == FB_TYPE_TEXT))
887 + (info->fix.type == FB_TYPE_TEXT) || fbsplash_active(info, vc))
888 logo = 0;
889
890 info->var.xoffset = info->var.yoffset = p->yscroll = 0; /* reset wrap/pan */
891 @@ -1038,6 +1048,11 @@ static void fbcon_clear(struct vc_data *
892 if (!height || !width)
893 return;
894
895 + if (fbsplash_active(info, vc)) {
896 + fbsplash_clear(vc, info, sy, sx, height, width);
897 + return;
898 + }
899 +
900 /* Split blits that cross physical y_wrap boundary */
901
902 y_break = p->vrows - p->yscroll;
903 @@ -1057,10 +1072,15 @@ static void fbcon_putcs(struct vc_data *
904 struct display *p = &fb_display[vc->vc_num];
905 struct fbcon_ops *ops = info->fbcon_par;
906
907 - if (!fbcon_is_inactive(vc, info))
908 - ops->putcs(vc, info, s, count, real_y(p, ypos), xpos,
909 - get_color(vc, info, scr_readw(s), 1),
910 - get_color(vc, info, scr_readw(s), 0));
911 + if (!fbcon_is_inactive(vc, info)) {
912 +
913 + if (fbsplash_active(info, vc))
914 + fbsplash_putcs(vc, info, s, count, ypos, xpos);
915 + else
916 + ops->putcs(vc, info, s, count, real_y(p, ypos), xpos,
917 + get_color(vc, info, scr_readw(s), 1),
918 + get_color(vc, info, scr_readw(s), 0));
919 + }
920 }
921
922 static void fbcon_putc(struct vc_data *vc, int c, int ypos, int xpos)
923 @@ -1076,8 +1096,15 @@ static void fbcon_clear_margins(struct v
924 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
925 struct fbcon_ops *ops = info->fbcon_par;
926
927 - if (!fbcon_is_inactive(vc, info))
928 - ops->clear_margins(vc, info, bottom_only);
929 + if (!fbcon_is_inactive(vc, info)) {
930 + if (fbsplash_active(info, vc)) {
931 + if (!fbsplash_isverbose)
932 + return;
933 + fbsplash_clear_margins(vc, info, bottom_only);
934 + } else {
935 + ops->clear_margins(vc, info, bottom_only);
936 + }
937 + }
938 }
939
940 static void fbcon_cursor(struct vc_data *vc, int mode)
941 @@ -1544,7 +1571,7 @@ static int fbcon_scroll(struct vc_data *
942 int scroll_partial = info->flags & FBINFO_PARTIAL_PAN_OK;
943
944 if (fbcon_is_inactive(vc, info))
945 - return -EINVAL;
946 + return (fbsplash_issilent) ? 0 : -EINVAL;
947
948 fbcon_cursor(vc, CM_ERASE);
949
950 @@ -1560,7 +1587,7 @@ static int fbcon_scroll(struct vc_data *
951 count = vc->vc_rows;
952 if (softback_top)
953 fbcon_softback_note(vc, t, count);
954 - if (logo_shown >= 0)
955 + if (logo_shown >= 0 || fbsplash_active(info, vc))
956 goto redraw_up;
957 switch (p->scrollmode) {
958 case SCROLL_MOVE:
959 @@ -1646,6 +1673,8 @@ static int fbcon_scroll(struct vc_data *
960 case SM_DOWN:
961 if (count > vc->vc_rows) /* Maximum realistic size */
962 count = vc->vc_rows;
963 + if (fbsplash_active(info, vc))
964 + goto redraw_down;
965 switch (p->scrollmode) {
966 case SCROLL_MOVE:
967 ops->bmove(vc, info, t, 0, t + count, 0,
968 @@ -1788,6 +1817,13 @@ static void fbcon_bmove_rec(struct vc_da
969 }
970 return;
971 }
972 +
973 + if (fbsplash_active(info, vc) && sy == dy && height == 1) {
974 + /* must use slower redraw bmove to keep background pic intact */
975 + fbsplash_bmove_redraw(vc, info, sy, sx, dx, width);
976 + return;
977 + }
978 +
979 ops->bmove(vc, info, real_y(p, sy), sx, real_y(p, dy), dx,
980 height, width);
981 }
982 @@ -1842,7 +1878,8 @@ static int fbcon_resize(struct vc_data *
983 var.yres = height * fh;
984 x_diff = info->var.xres - var.xres;
985 y_diff = info->var.yres - var.yres;
986 - if (x_diff < 0 || x_diff > fw || (y_diff < 0 || y_diff > fh)) {
987 +
988 + if ((x_diff < 0 || x_diff > fw || (y_diff < 0 || y_diff > fh)) && !vc->vc_splash.state) {
989 struct fb_videomode *mode;
990
991 DPRINTK("attempting resize %ix%i\n", var.xres, var.yres);
992 @@ -1889,7 +1926,17 @@ static int fbcon_switch(struct vc_data *
993 int i, prev_console, do_set_par = 0;
994
995 info = registered_fb[con2fb_map[vc->vc_num]];
996 + prev_console = ((struct fbcon_ops *)info->fbcon_par)->currcon;
997 +
998 + if (fbsplash_active_vc(vc)) {
999 + struct vc_data *vc_curr = vc_cons[prev_console].d;
1000
1001 + if (!vc_curr->vc_splash.theme || strcmp(vc->vc_splash.theme, vc_curr->vc_splash.theme)) {
1002 + if (fbsplash_call_helper("getpic", vc->vc_num))
1003 + fbsplash_disable(vc, 0);
1004 + }
1005 + }
1006 +
1007 if (softback_top) {
1008 int l = fbcon_softback_size / vc->vc_size_row;
1009 if (softback_lines)
1010 @@ -1915,8 +1962,6 @@ static int fbcon_switch(struct vc_data *
1011 logo_shown = FBCON_LOGO_CANSHOW;
1012 }
1013
1014 - prev_console = ((struct fbcon_ops *)info->fbcon_par)->currcon;
1015 -
1016 /*
1017 * FIXME: If we have multiple fbdev's loaded, we need to
1018 * update all info->currcon. Perhaps, we can place this
1019 @@ -2069,9 +2114,13 @@ static int fbcon_blank(struct vc_data *v
1020 if (info->fbops->fb_blank)
1021 ret = info->fbops->fb_blank(blank, info);
1022
1023 - if (ret)
1024 - fbcon_generic_blank(vc, info, blank);
1025 -
1026 + if (ret) {
1027 + if (fbsplash_active(info, vc))
1028 + fbsplash_blank(vc, info, blank);
1029 + else
1030 + fbcon_generic_blank(vc, info, blank);
1031 + }
1032 +
1033 if (!blank)
1034 update_screen(vc->vc_num);
1035 }
1036 @@ -2221,9 +2270,15 @@ static int fbcon_do_set_font(struct vc_d
1037 }
1038
1039 if (resize) {
1040 - /* reset wrap/pan */
1041 - info->var.xoffset = info->var.yoffset = p->yscroll = 0;
1042 - vc_resize(vc->vc_num, info->var.xres / w, info->var.yres / h);
1043 + u32 xres = info->var.xres, yres = info->var.yres;
1044 + /* reset wrap/pan */
1045 + info->var.xoffset = info->var.yoffset = p->yscroll = 0;
1046 + if (fbsplash_active(info, vc)) {
1047 + xres = vc->vc_splash.twidth;
1048 + yres = vc->vc_splash.theight;
1049 + }
1050 + vc_resize(vc->vc_num, xres / w, yres / h);
1051 +
1052 if (CON_IS_VISIBLE(vc) && softback_buf) {
1053 int l = fbcon_softback_size / vc->vc_size_row;
1054 if (l > 5)
1055 @@ -2373,7 +2428,49 @@ static int fbcon_set_palette(struct vc_d
1056 } else
1057 fb_copy_cmap(fb_default_cmap(1 << depth), &palette_cmap);
1058
1059 - return fb_set_cmap(&palette_cmap, info);
1060 + if (fbsplash_active(info, vc_cons[fg_console].d) &&
1061 + info->fix.visual == FB_VISUAL_DIRECTCOLOR) {
1062 +
1063 + u16 *red, *green, *blue;
1064 + int minlen = min(min(info->var.red.length, info->var.green.length),
1065 + info->var.blue.length);
1066 + int h;
1067 +
1068 + struct fb_cmap cmap = {
1069 + .start = 0,
1070 + .len = (1 << minlen),
1071 + .red = NULL,
1072 + .green = NULL,
1073 + .blue = NULL,
1074 + .transp = NULL
1075 + };
1076 +
1077 + red = kmalloc(256 * sizeof(u16) * 3, GFP_KERNEL);
1078 +
1079 + if (!red)
1080 + goto out;
1081 +
1082 + green = red + 256;
1083 + blue = green + 265;
1084 + cmap.red = red;
1085 + cmap.green = green;
1086 + cmap.blue = blue;
1087 +
1088 + for (i = 0; i < cmap.len; i++) {
1089 + red[i] = green[i] = blue[i] = (0xffff * i)/(cmap.len-1);
1090 + }
1091 +
1092 + h = fb_set_cmap(&cmap, info);
1093 + fbsplash_fix_pseudo_pal(info, vc_cons[fg_console].d);
1094 + kfree(red);
1095 +
1096 + return h;
1097 +
1098 + } else if (fbsplash_active(info, vc_cons[fg_console].d) &&
1099 + info->var.bits_per_pixel == 8 && info->splash.cmap.red != NULL)
1100 + fb_set_cmap(&info->splash.cmap, info);
1101 +
1102 +out: return fb_set_cmap(&palette_cmap, info);
1103 }
1104
1105 static u16 *fbcon_screen_pos(struct vc_data *vc, int offset)
1106 @@ -2596,7 +2693,14 @@ static void fbcon_modechanged(struct fb_
1107 var_to_display(p, &info->var, info);
1108 cols = info->var.xres / vc->vc_font.width;
1109 rows = info->var.yres / vc->vc_font.height;
1110 - vc_resize(vc->vc_num, cols, rows);
1111 +
1112 + if (!fbsplash_active(info, vc)) {
1113 + vc_resize(vc->vc_num, cols, rows);
1114 + } else {
1115 + if (fbsplash_call_helper("modechange", vc->vc_num))
1116 + fbsplash_disable(vc, 0);
1117 + }
1118 +
1119 updatescrollmode(p, info, vc);
1120 scrollback_max = 0;
1121 scrollback_current = 0;
1122 diff -urNpX dontdiff linux-2.6.10-gentoo-r7/drivers/video/fbcmap.c linux-dsd/drivers/video/fbcmap.c
1123 --- linux-2.6.10-gentoo-r7/drivers/video/fbcmap.c 2004-12-24 21:35:25.000000000 +0000
1124 +++ linux-dsd/drivers/video/fbcmap.c 2005-02-05 00:23:45.027483848 +0000
1125 @@ -16,6 +16,7 @@
1126 #include <linux/tty.h>
1127 #include <linux/fb.h>
1128 #include <linux/slab.h>
1129 +#include "fbsplash.h"
1130
1131 #include <asm/uaccess.h>
1132
1133 @@ -235,6 +236,10 @@ int fb_set_cmap(struct fb_cmap *cmap, st
1134 info))
1135 break;
1136 }
1137 + fb_copy_cmap(cmap, &info->cmap);
1138 + if (fbsplash_active(info, vc_cons[fg_console].d) &&
1139 + info->fix.visual == FB_VISUAL_DIRECTCOLOR)
1140 + fbsplash_fix_pseudo_pal(info, vc_cons[fg_console].d);
1141 return 0;
1142 }
1143
1144 @@ -265,6 +270,9 @@ int fb_set_user_cmap(struct fb_cmap_user
1145 if (transp)
1146 transp++;
1147 }
1148 + if (fbsplash_active(info, vc_cons[fg_console].d) &&
1149 + info->fix.visual == FB_VISUAL_DIRECTCOLOR)
1150 + fbsplash_fix_pseudo_pal(info, vc_cons[fg_console].d);
1151 return 0;
1152 }
1153
1154 diff -urNpX dontdiff linux-2.6.10-gentoo-r7/drivers/video/fbsplash.c linux-dsd/drivers/video/fbsplash.c
1155 --- linux-2.6.10-gentoo-r7/drivers/video/fbsplash.c 1970-01-01 01:00:00.000000000 +0100
1156 +++ linux-dsd/drivers/video/fbsplash.c 2005-02-05 00:23:45.028483696 +0000
1157 @@ -0,0 +1,529 @@
1158 +/*
1159 + * linux/drivers/video/fbsplash.c -- Framebuffer splash routines
1160 + *
1161 + * Copyright (C) 2004 Michal Januszewski <spock@gentoo.org>
1162 + *
1163 + * Code based upon "Bootsplash" (C) 2001-2003
1164 + * Volker Poplawski <volker@poplawski.de>,
1165 + * Stefan Reinauer <stepan@suse.de>,
1166 + * Steffen Winterfeldt <snwint@suse.de>,
1167 + * Michael Schroeder <mls@suse.de>,
1168 + * Ken Wimer <wimer@suse.de>.
1169 + *
1170 + * Splash render routines are located in /linux/drivers/video/cfbsplash.c
1171 + *
1172 + * This file is subject to the terms and conditions of the GNU General Public
1173 + * License. See the file COPYING in the main directory of this archive for
1174 + * more details.
1175 + *
1176 + */
1177 +#include <linux/config.h>
1178 +#include <linux/module.h>
1179 +#include <linux/kernel.h>
1180 +#include <linux/string.h>
1181 +#include <linux/types.h>
1182 +#include <linux/fb.h>
1183 +#include <linux/vt_kern.h>
1184 +#include <linux/vmalloc.h>
1185 +#include <linux/unistd.h>
1186 +#include <linux/syscalls.h>
1187 +#include <linux/init.h>
1188 +#include <linux/proc_fs.h>
1189 +#include <linux/workqueue.h>
1190 +#include <linux/kmod.h>
1191 +#include <linux/miscdevice.h>
1192 +#include <linux/device.h>
1193 +#include <linux/fs.h>
1194 +
1195 +#include <asm/uaccess.h>
1196 +#include <asm/irq.h>
1197 +#include <asm/system.h>
1198 +
1199 +#include "console/fbcon.h"
1200 +#include "fbsplash.h"
1201 +
1202 +#define SPLASH_VERSION "0.9"
1203 +
1204 +#ifdef DEBUG
1205 +#define DPRINTK(fmt, args...) printk(KERN_DEBUG "%s: " fmt, __FUNCTION__ , ## args)
1206 +#else
1207 +#define DPRINTK(fmt, args...)
1208 +#endif
1209 +
1210 +extern signed char con2fb_map[];
1211 +
1212 +static void splash_work_verbose(void *data);
1213 +static int fbsplash_enable(struct vc_data *vc);
1214 +
1215 +DECLARE_WORK(splash_wq_verbose, splash_work_verbose, NULL);
1216 +
1217 +int fbsplash_mode = 0;
1218 +char fbsplash_path[KMOD_PATH_LEN] = "/sbin/splash_helper";
1219 +static char fbsplash_theme[FB_SPLASH_THEME_LEN] __initdata = "default";
1220 +
1221 +int fbsplash_call_helper(char* cmd, unsigned short vc)
1222 +{
1223 + char *envp[] = {
1224 + "HOME=/",
1225 + "PATH=/sbin:/bin",
1226 + NULL
1227 + };
1228 +
1229 + char tfb[5];
1230 + char tcons[5];
1231 + unsigned char fb = (int) con2fb_map[vc];
1232 +
1233 + char *argv[] = {
1234 + fbsplash_path,
1235 + "1",
1236 + cmd,
1237 + tcons,
1238 + tfb,
1239 + (fbsplash_mode == FB_SPLASH_MODE_SILENT) ? "s" : "v",
1240 + vc_cons[vc].d->vc_splash.theme,
1241 + NULL
1242 + };
1243 +
1244 + snprintf(tfb,5,"%d",fb);
1245 + snprintf(tcons,5,"%d",vc);
1246 +
1247 + return call_usermodehelper(fbsplash_path, argv, envp, 1);
1248 +}
1249 +
1250 +int fbsplash_verbose(void)
1251 +{
1252 + if (fbsplash_mode == FB_SPLASH_MODE_VERBOSE)
1253 + return 0;
1254 +
1255 + fbsplash_mode = FB_SPLASH_MODE_VERBOSE;
1256 +
1257 + /* We have to do the switch from a workqueue helper, because chances are this
1258 + * function gets called from interrupt context, and we can't get hold of the
1259 + * console sem this way. */
1260 + schedule_work(&splash_wq_verbose);
1261 +
1262 + return 1;
1263 +}
1264 +
1265 +/* Switches the first console to verbose mode. */
1266 +static void splash_work_verbose(void *data)
1267 +{
1268 + struct fb_info *info;
1269 + struct vc_data *vc;
1270 +
1271 + vc = vc_cons[0].d;
1272 + info = registered_fb[(int) con2fb_map[vc->vc_num]];
1273 +
1274 + if (info == NULL)
1275 + return;
1276 +
1277 + printk(KERN_INFO "fbsplash: switching to verbose mode\n");
1278 +
1279 + vt_cons[0]->vc_mode = KD_TEXT;
1280 +
1281 + acquire_console_sem();
1282 + do_unblank_screen(0);
1283 +
1284 + if (info->splash.data) {
1285 + fbsplash_enable(vc);
1286 + } else {
1287 + fbsplash_disable(vc, 1);
1288 + }
1289 + release_console_sem();
1290 +}
1291 +
1292 +/* Disables fbsplash on a virtual console; called with console sem held. */
1293 +int fbsplash_disable(struct vc_data *vc, unsigned char redraw)
1294 +{
1295 + struct fb_info* info;
1296 +
1297 + if (!vc->vc_splash.state)
1298 + return -EINVAL;
1299 +
1300 + info = registered_fb[(int) con2fb_map[vc->vc_num]];
1301 +
1302 + if (info == NULL)
1303 + return -EINVAL;
1304 +
1305 + vc->vc_splash.state = 0;
1306 + vc_resize(vc->vc_num, info->var.xres / vc->vc_font.width,
1307 + info->var.yres / vc->vc_font.height);
1308 +
1309 + if (fg_console == vc->vc_num && redraw) {
1310 + redraw_screen(fg_console, 0);
1311 + update_region(fg_console, vc->vc_origin +
1312 + vc->vc_size_row * vc->vc_top,
1313 + vc->vc_size_row * (vc->vc_bottom - vc->vc_top) / 2);
1314 + }
1315 +
1316 + printk(KERN_INFO "fbsplash: switched splash state to 'off' on console %d\n",
1317 + vc->vc_num);
1318 +
1319 + return 0;
1320 +}
1321 +
1322 +/* Enables fbsplash on a virtual console; called with console sem held. */
1323 +static int fbsplash_enable(struct vc_data *vc)
1324 +{
1325 + struct fb_info* info;
1326 +
1327 + info = registered_fb[(int) con2fb_map[vc->vc_num]];
1328 +
1329 + if (vc->vc_splash.twidth == 0 || vc->vc_splash.theight == 0 ||
1330 + info == NULL || !info->splash.data || vc->vc_splash.state)
1331 + return -EINVAL;
1332 +
1333 + vc->vc_splash.state = 1;
1334 + vc_resize(vc->vc_num, vc->vc_splash.twidth / vc->vc_font.width,
1335 + vc->vc_splash.theight / vc->vc_font.height);
1336 +
1337 + if (fg_console == vc->vc_num) {
1338 + redraw_screen(fg_console, 0);
1339 + update_region(fg_console, vc->vc_origin +
1340 + vc->vc_size_row * vc->vc_top,
1341 + vc->vc_size_row * (vc->vc_bottom - vc->vc_top) / 2);
1342 + fbsplash_clear_margins(vc, info, 0);
1343 + }
1344 +
1345 + printk(KERN_INFO "fbsplash: switched splash state to 'on' on console %d\n",
1346 + vc->vc_num);
1347 +
1348 + return 0;
1349 +}
1350 +
1351 +static int __init splash_setup(char *options)
1352 +{
1353 + char *this_opt;
1354 +
1355 + while ((this_opt = strsep(&options, ",")) != NULL) {
1356 +
1357 + if (!strcmp(this_opt, "silent")) {
1358 + fbsplash_mode = FB_SPLASH_MODE_SILENT;
1359 + printk(KERN_INFO "fbsplash: silent\n");
1360 + } else if (!strcmp(this_opt, "verbose")) {
1361 + fbsplash_mode = FB_SPLASH_MODE_VERBOSE;
1362 + printk(KERN_INFO "fbsplash: verbose\n");
1363 + } else if (!strcmp(this_opt, "off")) {
1364 + fbsplash_mode = 0;
1365 + } else if (!strncmp(this_opt, "theme:", 6)) {
1366 + strncpy(fbsplash_theme, this_opt+6, 64);
1367 + printk(KERN_INFO "fbsplash: theme %s\n", fbsplash_theme);
1368 + } else {
1369 + printk(KERN_WARNING "fbsplash: unrecognized option %s\n", this_opt);
1370 + }
1371 + }
1372 + return 0;
1373 +}
1374 +
1375 +__setup("splash=", splash_setup);
1376 +
1377 +static int splash_get_info(char *buf, char **start, off_t fpos, int length)
1378 +{
1379 + char *p = buf;
1380 +
1381 + p += sprintf(p, "Framebuffer splash v%s, mode: %s\n", SPLASH_VERSION,
1382 + ((fbsplash_mode == 2) ? "silent" : (fbsplash_mode == 1) ? "verbose" : "off"));
1383 +
1384 + return p - buf;
1385 +}
1386 +
1387 +static inline int fbsplash_ioctl_dosetstate(struct vc_data *vc, unsigned int __user* state, unsigned char origin)
1388 +{
1389 + int tmp, ret;
1390 +
1391 + if (get_user(tmp, state))
1392 + return -EFAULT;
1393 +
1394 + if (origin == FB_SPLASH_IO_ORIG_USER)
1395 + acquire_console_sem();
1396 + if (!tmp)
1397 + ret = fbsplash_disable(vc, 1);
1398 + else
1399 + ret = fbsplash_enable(vc);
1400 + if (origin == FB_SPLASH_IO_ORIG_USER)
1401 + release_console_sem();
1402 +
1403 + return ret;
1404 +}
1405 +
1406 +static inline int fbsplash_ioctl_dogetstate(struct vc_data *vc, unsigned int __user *state)
1407 +{
1408 + return put_user(vc->vc_splash.state, (unsigned int __user*) state);
1409 +}
1410 +
1411 +static int fbsplash_ioctl_dosetcfg(struct vc_data *vc, struct vc_splash __user *arg, unsigned char origin)
1412 +{
1413 + struct vc_splash cfg;
1414 + struct fb_info *info;
1415 + int len;
1416 + char *tmp;
1417 +
1418 + info = registered_fb[(int) con2fb_map[vc->vc_num]];
1419 +
1420 + if (copy_from_user(&cfg, arg, sizeof(struct vc_splash)))
1421 + return -EFAULT;
1422 + if (info == NULL || !cfg.twidth || !cfg.theight ||
1423 + cfg.tx + cfg.twidth > info->var.xres ||
1424 + cfg.ty + cfg.theight > info->var.yres)
1425 + return -EINVAL;
1426 +
1427 + len = strlen_user(cfg.theme);
1428 + if (!len || len > FB_SPLASH_THEME_LEN)
1429 + return -EINVAL;
1430 + tmp = kmalloc(len, GFP_KERNEL);
1431 + if (!tmp)
1432 + return -ENOMEM;
1433 + if (copy_from_user(tmp, (void __user *)cfg.theme, len))
1434 + return -EFAULT;
1435 + cfg.theme = tmp;
1436 + cfg.state = 0;
1437 +
1438 + /* If this ioctl is a response to a request from kernel, the console sem
1439 + * is already held; we also don't need to disable splash because either the
1440 + * new config and background picture will be successfully loaded, and the
1441 + * splash will stay on, or in case of a failure it'll be turned off in fbcon. */
1442 + if (origin == FB_SPLASH_IO_ORIG_USER) {
1443 + acquire_console_sem();
1444 + if (vc->vc_splash.state)
1445 + fbsplash_disable(vc, 1);
1446 + }
1447 +
1448 + if (vc->vc_splash.theme)
1449 + kfree(vc->vc_splash.theme);
1450 +
1451 + vc->vc_splash = cfg;
1452 +
1453 + if (origin == FB_SPLASH_IO_ORIG_USER)
1454 + release_console_sem();
1455 +
1456 + printk(KERN_INFO "fbsplash: console %d using theme '%s'\n",
1457 + vc->vc_num, vc->vc_splash.theme);
1458 + return 0;
1459 +}
1460 +
1461 +static int fbsplash_ioctl_dogetcfg(struct vc_data *vc, struct vc_splash __user *arg)
1462 +{
1463 + struct vc_splash splash;
1464 + char __user *tmp;
1465 +
1466 + if (get_user(tmp, &arg->theme))
1467 + return -EFAULT;
1468 +
1469 + splash = vc->vc_splash;
1470 + splash.theme = tmp;
1471 +
1472 + if (vc->vc_splash.theme) {
1473 + if (copy_to_user(tmp, vc->vc_splash.theme, strlen(vc->vc_splash.theme) + 1))
1474 + return -EFAULT;
1475 + } else
1476 + if (put_user(0, tmp))
1477 + return -EFAULT;
1478 +
1479 + if (copy_to_user(arg, &splash, sizeof(struct vc_splash)))
1480 + return -EFAULT;
1481 +
1482 + return 0;
1483 +}
1484 +
1485 +static int fbsplash_ioctl_dosetpic(struct vc_data *vc, struct fb_image __user *arg, unsigned char origin)
1486 +{
1487 + struct fb_image img;
1488 + struct fb_info *info;
1489 + int len;
1490 + u8 *tmp;
1491 +
1492 + if (vc->vc_num != fg_console)
1493 + return -EINVAL;
1494 +
1495 + info = registered_fb[(int) con2fb_map[vc->vc_num]];
1496 +
1497 + if (info == NULL)
1498 + return -EINVAL;
1499 +
1500 + if (copy_from_user(&img, arg, sizeof(struct fb_image)))
1501 + return -EFAULT;
1502 +
1503 + if (img.width != info->var.xres || img.height != info->var.yres) {
1504 + printk(KERN_ERR "fbsplash: picture dimensions mismatch\n");
1505 + return -EINVAL;
1506 + }
1507 +
1508 + if (img.depth != info->var.bits_per_pixel) {
1509 + printk(KERN_ERR "fbsplash: picture depth mismatch\n");
1510 + return -EINVAL;
1511 + }
1512 +
1513 + if (img.depth == 8) {
1514 + if (!img.cmap.len || !img.cmap.red || !img.cmap.green ||
1515 + !img.cmap.blue)
1516 + return -EINVAL;
1517 +
1518 + tmp = vmalloc(img.cmap.len * 3 * 2);
1519 + if (!tmp)
1520 + return -ENOMEM;
1521 +
1522 + if (copy_from_user(tmp, (void __user*)img.cmap.red, img.cmap.len * 2) ||
1523 + copy_from_user(tmp + (img.cmap.len << 1),
1524 + (void __user*)img.cmap.green, (img.cmap.len << 1)) ||
1525 + copy_from_user(tmp + (img.cmap.len << 2),
1526 + (void __user*)img.cmap.blue, (img.cmap.len << 1))) {
1527 + vfree(tmp);
1528 + return -EFAULT;
1529 + }
1530 +
1531 + img.cmap.transp = NULL;
1532 + img.cmap.red = (u16*)tmp;
1533 + img.cmap.green = img.cmap.red + img.cmap.len;
1534 + img.cmap.blue = img.cmap.green + img.cmap.len;
1535 + } else {
1536 + img.cmap.red = NULL;
1537 + }
1538 +
1539 + len = ((img.depth + 7) >> 3) * img.width * img.height;
1540 + tmp = vmalloc(len);
1541 +
1542 + if (!tmp)
1543 + goto out;
1544 +
1545 + if (copy_from_user(tmp, (void __user*)img.data, len))
1546 + goto out;
1547 +
1548 + img.data = tmp;
1549 +
1550 + /* If this ioctl is a response to a request from kernel, the console sem
1551 + * is already held. */
1552 + if (origin == FB_SPLASH_IO_ORIG_USER)
1553 + acquire_console_sem();
1554 +
1555 + if (info->splash.data)
1556 + vfree((u8*)info->splash.data);
1557 + if (info->splash.cmap.red)
1558 + vfree(info->splash.cmap.red);
1559 +
1560 + info->splash = img;
1561 +
1562 + if (origin == FB_SPLASH_IO_ORIG_USER)
1563 + release_console_sem();
1564 +
1565 + return 0;
1566 +
1567 +out: if (img.cmap.red)
1568 + vfree(img.cmap.red);
1569 + if (tmp)
1570 + vfree(tmp);
1571 + return -ENOMEM;
1572 +}
1573 +
1574 +static int splash_ioctl(struct inode * inode, struct file *filp, u_int cmd,
1575 + u_long arg)
1576 +{
1577 + struct fb_splash_iowrapper __user *wrapper = (void __user*) arg;
1578 + struct vc_data *vc = NULL;
1579 + unsigned short vc_num = 0;
1580 + unsigned char origin = 0;
1581 + void __user *data = NULL;
1582 +
1583 + if (cmd != FBIOSPLASH_SETMODE && cmd != FBIOSPLASH_GETMODE)
1584 + {
1585 + if (verify_area(VERIFY_READ, wrapper,
1586 + sizeof(struct fb_splash_iowrapper)))
1587 + return -EFAULT;
1588 +
1589 + __get_user(vc_num, &wrapper->vc);
1590 + __get_user(origin, &wrapper->origin);
1591 + __get_user(data, &wrapper->data);
1592 +
1593 + if (!vc_cons_allocated(vc_num))
1594 + return -EINVAL;
1595 +
1596 + vc = vc_cons[vc_num].d;
1597 + }
1598 +
1599 + switch (cmd) {
1600 +
1601 + case FBIOSPLASH_SETMODE:
1602 + if (arg != FB_SPLASH_MODE_SILENT && arg != FB_SPLASH_MODE_VERBOSE)
1603 + return -EINVAL;
1604 +
1605 + if (fbsplash_mode == arg)
1606 + return 0;
1607 +
1608 + fbsplash_mode = arg;
1609 + if (arg == FB_SPLASH_MODE_VERBOSE)
1610 + splash_work_verbose(NULL);
1611 + return 0;
1612 +
1613 + case FBIOSPLASH_GETMODE:
1614 + return put_user(fbsplash_mode, (unsigned int __user *)arg);
1615 + case FBIOSPLASH_SETPIC:
1616 + return fbsplash_ioctl_dosetpic(vc, (struct fb_image __user*)data, origin);
1617 + case FBIOSPLASH_SETCFG:
1618 + return fbsplash_ioctl_dosetcfg(vc, (struct vc_splash*)data, origin);
1619 + case FBIOSPLASH_GETCFG:
1620 + return fbsplash_ioctl_dogetcfg(vc, (struct vc_splash*)data);
1621 + case FBIOSPLASH_SETSTATE:
1622 + return fbsplash_ioctl_dosetstate(vc, (unsigned int *)data, origin);
1623 + case FBIOSPLASH_GETSTATE:
1624 + return fbsplash_ioctl_dogetstate(vc, (unsigned int *)data);
1625 + default:
1626 + return -ENOIOCTLCMD;
1627 + }
1628 +}
1629 +
1630 +static struct file_operations splash_ops = {
1631 + .owner = THIS_MODULE,
1632 + .ioctl = splash_ioctl
1633 +};
1634 +
1635 +static struct miscdevice splash_dev = {
1636 + .minor = MISC_DYNAMIC_MINOR,
1637 + .name = "fbsplash",
1638 + .fops = &splash_ops
1639 +};
1640 +
1641 +int fbsplash_init(void)
1642 +{
1643 + struct proc_dir_entry *splash_proc;
1644 + struct fb_info *info;
1645 + struct vc_data *vc;
1646 + int i;
1647 +
1648 + vc = vc_cons[0].d;
1649 + info = registered_fb[0];
1650 +
1651 + for (i = 0; i < num_registered_fb; i++) {
1652 + registered_fb[i]->splash.data = NULL;
1653 + registered_fb[i]->splash.cmap.red = NULL;
1654 + }
1655 +
1656 + for (i = 0; i < MAX_NR_CONSOLES && vc_cons[i].d; i++) {
1657 + vc_cons[i].d->vc_splash.state = vc_cons[i].d->vc_splash.twidth =
1658 + vc_cons[i].d->vc_splash.theight = 0;
1659 + vc_cons[i].d->vc_splash.theme = NULL;
1660 + }
1661 +
1662 + i = misc_register(&splash_dev);
1663 + if (i) {
1664 + printk(KERN_ERR "fbsplash: failed to register device\n");
1665 + return i;
1666 + }
1667 +
1668 +#ifdef CONFIG_PROC_FS
1669 + splash_proc = create_proc_info_entry("fbsplash", 0, NULL, splash_get_info);
1670 + if (splash_proc)
1671 + splash_proc->owner = THIS_MODULE;
1672 +#endif
1673 +
1674 + if (fbsplash_mode && info) {
1675 + vc->vc_splash.theme = kmalloc((strlen(fbsplash_theme)+1) * sizeof(char), GFP_KERNEL);
1676 + strcpy(vc->vc_splash.theme, fbsplash_theme);
1677 + if (fbsplash_call_helper("init", 0))
1678 + fbsplash_mode = FB_SPLASH_MODE_VERBOSE;
1679 + } else {
1680 + fbsplash_mode = FB_SPLASH_MODE_VERBOSE;
1681 + }
1682 +
1683 + return 0;
1684 +}
1685 +
1686 +EXPORT_SYMBOL(fbsplash_path);
1687 diff -urNpX dontdiff linux-2.6.10-gentoo-r7/drivers/video/fbsplash.h linux-dsd/drivers/video/fbsplash.h
1688 --- linux-2.6.10-gentoo-r7/drivers/video/fbsplash.h 1970-01-01 01:00:00.000000000 +0100
1689 +++ linux-dsd/drivers/video/fbsplash.h 2005-02-05 00:23:45.028483696 +0000
1690 @@ -0,0 +1,78 @@
1691 +/*
1692 + * linux/drivers/video/fbsplash.h -- Framebuffer splash headers
1693 + *
1694 + * Copyright (C) 2004 Michal Januszewski <spock@gentoo.org>
1695 + *
1696 + */
1697 +
1698 +#ifndef __FB_SPLASH_H
1699 +#define __FB_SPLASH_H
1700 +
1701 +#ifndef _LINUX_FB_H
1702 +#include <linux/fb.h>
1703 +#endif
1704 +
1705 +/* This is needed for vc_cons in fbcmap.c */
1706 +#include <linux/vt_kern.h>
1707 +
1708 +struct fb_cursor;
1709 +struct fb_info;
1710 +struct vc_data;
1711 +
1712 +#ifdef CONFIG_FB_SPLASH
1713 +/* fbsplash.c */
1714 +int fbsplash_init(void);
1715 +int fbsplash_verbose(void);
1716 +int fbsplash_call_helper(char* cmd, unsigned short cons);
1717 +int fbsplash_disable(struct vc_data *vc, unsigned char redraw);
1718 +
1719 +/* cfbsplash.c */
1720 +void fbsplash_putcs(struct vc_data *vc, struct fb_info *info, const unsigned short *s, int count, int yy, int xx);
1721 +void fbsplash_cursor(struct fb_info *info, struct fb_cursor *cursor);
1722 +void fbsplash_clear(struct vc_data *vc, struct fb_info *info, int sy, int sx, int height, int width);
1723 +void fbsplash_clear_margins(struct vc_data *vc, struct fb_info *info, int bottom_only);
1724 +void fbsplash_blank(struct vc_data *vc, struct fb_info *info, int blank);
1725 +void fbsplash_bmove_redraw(struct vc_data *vc, struct fb_info *info, int y, int sx, int dx, int width);
1726 +void fbsplash_copy(u8 *dst, u8 *src, int height, int width, int linebytes, int srclinesbytes, int bpp);
1727 +void fbsplash_fix_pseudo_pal(struct fb_info *info, struct vc_data *vc);
1728 +
1729 +/* vt.c */
1730 +void acquire_console_sem(void);
1731 +void release_console_sem(void);
1732 +void do_unblank_screen(int entering_gfx);
1733 +
1734 +extern int fbsplash_mode;
1735 +#define fbsplash_isverbose (fbsplash_mode == FB_SPLASH_MODE_VERBOSE)
1736 +#define fbsplash_issilent (fbsplash_mode == FB_SPLASH_MODE_SILENT)
1737 +
1738 +/* struct vc_data *y */
1739 +#define fbsplash_active_vc(y) (y->vc_splash.state && y->vc_splash.theme)
1740 +
1741 +/* struct fb_info *x, struct vc_data *y */
1742 +#define fbsplash_active(x,y) (x->splash.data && fbsplash_active_vc(y) && \
1743 + x->splash.width == x->var.xres && \
1744 + x->splash.height == x->var.yres && \
1745 + x->splash.depth == x->var.bits_per_pixel)
1746 +
1747 +#else /* CONFIG_FB_SPLASH */
1748 +
1749 +static inline void fbsplash_putcs(struct vc_data *vc, struct fb_info *info, const unsigned short *s, int count, int yy, int xx) {}
1750 +static inline void fbsplash_putc(struct vc_data *vc, struct fb_info *info, int c, int ypos, int xpos) {}
1751 +static inline void fbsplash_cursor(struct fb_info *info, struct fb_cursor *cursor) {}
1752 +static inline void fbsplash_clear(struct vc_data *vc, struct fb_info *info, int sy, int sx, int height, int width) {}
1753 +static inline void fbsplash_clear_margins(struct vc_data *vc, struct fb_info *info, int bottom_only) {}
1754 +static inline void fbsplash_blank(struct vc_data *vc, struct fb_info *info, int blank) {}
1755 +static inline void fbsplash_bmove_redraw(struct vc_data *vc, struct fb_info *info, int y, int sx, int dx, int width) {}
1756 +static inline int fbsplash_call_helper(char* cmd, unsigned short cons) { return 0; }
1757 +static inline int fbsplash_init(void) { return 0; }
1758 +static inline int fbsplash_verbose(void) { return 0; }
1759 +static inline int fbsplash_disable(struct vc_data *vc, unsigned char redraw) { return 0; }
1760 +
1761 +#define fbsplash_issilent (0)
1762 +#define fbsplash_isverbose (1)
1763 +#define fbsplash_active_vc(y) (0)
1764 +#define fbsplash_active(x,y) (0)
1765 +
1766 +#endif /* CONFIG_FB_SPLASH */
1767 +
1768 +#endif /* __FB_SPLASH_H */
1769 diff -urNpX dontdiff linux-2.6.10-gentoo-r7/drivers/video/Kconfig linux-dsd/drivers/video/Kconfig
1770 --- linux-2.6.10-gentoo-r7/drivers/video/Kconfig 2005-02-05 00:19:24.516087600 +0000
1771 +++ linux-dsd/drivers/video/Kconfig 2005-02-05 00:23:45.029483544 +0000
1772 @@ -1136,5 +1136,15 @@ if FB || SGI_NEWPORT_CONSOLE
1773 source "drivers/video/logo/Kconfig"
1774 endif
1775
1776 -endmenu
1777 +config FB_SPLASH
1778 + bool "Support for the framebuffer splash"
1779 + depends on FRAMEBUFFER_CONSOLE=y && !FB_TILEBLITTING
1780 + default n
1781 + ---help---
1782 + This option enables support for the Linux boot-up splash screen and
1783 + graphical backgrounds on consoles. Note that you will need userspace
1784 + splashutils in order to take advantage of these features. Refer to
1785 + Documentation/fb/splash.txt for more information.
1786
1787 + If unsure, say N.
1788 +endmenu
1789 diff -urNpX dontdiff linux-2.6.10-gentoo-r7/drivers/video/Makefile linux-dsd/drivers/video/Makefile
1790 --- linux-2.6.10-gentoo-r7/drivers/video/Makefile 2005-02-05 00:19:24.516087600 +0000
1791 +++ linux-dsd/drivers/video/Makefile 2005-02-05 00:23:45.030483392 +0000
1792 @@ -6,6 +6,7 @@
1793
1794 obj-$(CONFIG_VT) += console/
1795 obj-$(CONFIG_LOGO) += logo/
1796 +obj-$(CONFIG_FB_SPLASH) += fbsplash.o cfbsplash.o
1797
1798 obj-$(CONFIG_FB) += fbmem.o fbmon.o fbcmap.o fbsysfs.o modedb.o softcursor.o
1799 # Only include macmodes.o if we have FB support and are PPC
1800 diff -urNpX dontdiff linux-2.6.10-gentoo-r7/include/linux/console_splash.h linux-dsd/include/linux/console_splash.h
1801 --- linux-2.6.10-gentoo-r7/include/linux/console_splash.h 1970-01-01 01:00:00.000000000 +0100
1802 +++ linux-dsd/include/linux/console_splash.h 2005-02-05 00:23:45.030483392 +0000
1803 @@ -0,0 +1,13 @@
1804 +#ifndef _LINUX_CONSOLE_SPLASH_H_
1805 +#define _LINUX_CONSOLE_SPLASH_H_ 1
1806 +
1807 +/* A structure used by the framebuffer splash code (drivers/video/fbsplash.c) */
1808 +struct vc_splash {
1809 + __u8 bg_color; /* The color that is to be treated as transparent */
1810 + __u8 state; /* Current splash state: 0 = off, 1 = on */
1811 + __u16 tx, ty; /* Top left corner coordinates of the text field */
1812 + __u16 twidth, theight; /* Width and height of the text field */
1813 + char* theme;
1814 +};
1815 +
1816 +#endif
1817 diff -urNpX dontdiff linux-2.6.10-gentoo-r7/include/linux/console_struct.h linux-dsd/include/linux/console_struct.h
1818 --- linux-2.6.10-gentoo-r7/include/linux/console_struct.h 2004-12-24 21:33:48.000000000 +0000
1819 +++ linux-dsd/include/linux/console_struct.h 2005-02-05 00:23:45.055479592 +0000
1820 @@ -10,6 +10,7 @@
1821 */
1822
1823 #define NPAR 16
1824 +#include <linux/console_splash.h>
1825
1826 struct vc_data {
1827 unsigned short vc_num; /* Console number */
1828 @@ -87,6 +88,8 @@ struct vc_data {
1829 struct vc_data **vc_display_fg; /* [!] Ptr to var holding fg console for this display */
1830 unsigned long vc_uni_pagedir;
1831 unsigned long *vc_uni_pagedir_loc; /* [!] Location of uni_pagedir variable for this console */
1832 +
1833 + struct vc_splash vc_splash;
1834 /* additional information is in vt_kern.h */
1835 };
1836
1837 diff -urNpX dontdiff linux-2.6.10-gentoo-r7/include/linux/fb.h linux-dsd/include/linux/fb.h
1838 --- linux-2.6.10-gentoo-r7/include/linux/fb.h 2004-12-24 21:34:30.000000000 +0000
1839 +++ linux-dsd/include/linux/fb.h 2005-02-05 00:23:45.056479440 +0000
1840 @@ -8,6 +8,13 @@
1841 #define FB_MAJOR 29
1842 #define FB_MAX 32 /* sufficient for now */
1843
1844 +struct fb_splash_iowrapper
1845 +{
1846 + unsigned short vc; /* Virtual console */
1847 + unsigned char origin; /* Point of origin of the request */
1848 + void *data;
1849 +};
1850 +
1851 /* ioctls
1852 0x46 is 'F' */
1853 #define FBIOGET_VSCREENINFO 0x4600
1854 @@ -35,7 +42,19 @@
1855 #define FBIOGET_HWCINFO 0x4616
1856 #define FBIOPUT_MODEINFO 0x4617
1857 #define FBIOGET_DISPINFO 0x4618
1858 -
1859 +#define FBIOSPLASH_SETCFG _IOWR('F', 0x19, struct fb_splash_iowrapper)
1860 +#define FBIOSPLASH_GETCFG _IOR('F', 0x1A, struct fb_splash_iowrapper)
1861 +#define FBIOSPLASH_SETSTATE _IOWR('F', 0x1B, struct fb_splash_iowrapper)
1862 +#define FBIOSPLASH_GETSTATE _IOR('F', 0x1C, struct fb_splash_iowrapper)
1863 +#define FBIOSPLASH_SETMODE _IOWR('F', 0x1D, unsigned int)
1864 +#define FBIOSPLASH_GETMODE _IOR('F', 0x1E, unsigned int)
1865 +#define FBIOSPLASH_SETPIC _IOWR('F', 0x1F, struct fb_splash_iowrapper)
1866 +
1867 +#define FB_SPLASH_MODE_VERBOSE 1 /* Verbose mode */
1868 +#define FB_SPLASH_MODE_SILENT 2 /* Silent mode */
1869 +#define FB_SPLASH_THEME_LEN 128 /* Maximum lenght of a theme name */
1870 +#define FB_SPLASH_IO_ORIG_KERNEL 0 /* Kernel ioctl origin */
1871 +#define FB_SPLASH_IO_ORIG_USER 1 /* User ioctl origin */
1872
1873 #define FB_TYPE_PACKED_PIXELS 0 /* Packed Pixels */
1874 #define FB_TYPE_PLANES 1 /* Non interleaved planes */
1875 @@ -719,6 +738,9 @@ struct fb_info {
1876 #define FBINFO_STATE_SUSPENDED 1
1877 u32 state; /* Hardware state i.e suspend */
1878 void *fbcon_par; /* fbcon use-only private area */
1879 +
1880 + struct fb_image splash;
1881 +
1882 /* From here on everything is device dependent */
1883 void *par;
1884 };
1885 diff -urNpX dontdiff linux-2.6.10-gentoo-r7/include/linux/sysctl.h linux-dsd/include/linux/sysctl.h
1886 --- linux-2.6.10-gentoo-r7/include/linux/sysctl.h 2005-02-05 00:19:23.661217560 +0000
1887 +++ linux-dsd/include/linux/sysctl.h 2005-02-05 00:24:28.113933712 +0000
1888 @@ -134,8 +134,9 @@ enum
1889 KERN_SPARC_SCONS_PWROFF=64, /* int: serial console power-off halt */
1890 KERN_HZ_TIMER=65, /* int: hz timer on or off */
1891 KERN_UNKNOWN_NMI_PANIC=66, /* int: unknown nmi panic flag */
1892 + KERN_FBSPLASH=67,
1893 #ifdef CONFIG_ALPHA_UAC_SYSCTL
1894 - KERN_UAC_POLICY=67, /* int: Alpha unaligned access control policy flags */
1895 + KERN_UAC_POLICY=68, /* int: Alpha unaligned access control policy flags */
1896 #endif /* CONFIG_ALPHA_UAC_SYSCTL */
1897
1898 };
1899 diff -urNpX dontdiff linux-2.6.10-gentoo-r7/kernel/panic.c linux-dsd/kernel/panic.c
1900 --- linux-2.6.10-gentoo-r7/kernel/panic.c 2005-02-05 00:19:23.758202816 +0000
1901 +++ linux-dsd/kernel/panic.c 2005-02-05 00:23:45.058479136 +0000
1902 @@ -18,6 +18,7 @@
1903 #include <linux/sysrq.h>
1904 #include <linux/interrupt.h>
1905 #include <linux/nmi.h>
1906 +#include "../drivers/video/fbsplash.h"
1907
1908 int panic_timeout;
1909 int panic_on_oops;
1910 @@ -87,6 +88,8 @@ NORET_TYPE void panic(const char * fmt,
1911 * We can't use the "normal" timers since we just panicked..
1912 */
1913 printk(KERN_EMERG "Rebooting in %d seconds..",panic_timeout);
1914 + fbsplash_verbose();
1915 +
1916 for (i = 0; i < panic_timeout*1000; ) {
1917 touch_nmi_watchdog();
1918 i += panic_blink(i);
1919 @@ -112,6 +115,8 @@ NORET_TYPE void panic(const char * fmt,
1920 disabled_wait(caller);
1921 #endif
1922 local_irq_enable();
1923 + fbsplash_verbose();
1924 +
1925 for (i = 0;;) {
1926 i += panic_blink(i);
1927 mdelay(1);
1928 diff -urNpX dontdiff linux-2.6.10-gentoo-r7/kernel/power/console.c linux-dsd/kernel/power/console.c
1929 --- linux-2.6.10-gentoo-r7/kernel/power/console.c 2004-12-24 21:33:48.000000000 +0000
1930 +++ linux-dsd/kernel/power/console.c 2005-02-05 00:23:45.058479136 +0000
1931 @@ -9,6 +9,8 @@
1932 #include <linux/console.h>
1933 #include "power.h"
1934
1935 +#include "../drivers/video/fbsplash.h"
1936 +
1937 static int new_loglevel = 10;
1938 static int orig_loglevel;
1939 #ifdef SUSPEND_CONSOLE
1940 @@ -21,6 +23,9 @@ int pm_prepare_console(void)
1941 console_loglevel = new_loglevel;
1942
1943 #ifdef SUSPEND_CONSOLE
1944 + if (fbsplash_issilent)
1945 + fbsplash_verbose();
1946 +
1947 acquire_console_sem();
1948
1949 orig_fgconsole = fg_console;
1950 diff -urNpX dontdiff linux-2.6.10-gentoo-r7/kernel/sysctl.c linux-dsd/kernel/sysctl.c
1951 --- linux-2.6.10-gentoo-r7/kernel/sysctl.c 2005-02-05 00:19:23.663217256 +0000
1952 +++ linux-dsd/kernel/sysctl.c 2005-02-05 00:23:45.059478984 +0000
1953 @@ -86,6 +86,9 @@ extern char modprobe_path[];
1954 #ifdef CONFIG_HOTPLUG
1955 extern char hotplug_path[];
1956 #endif
1957 +#ifdef CONFIG_FB_SPLASH
1958 +extern char fbsplash_path[];
1959 +#endif
1960 #ifdef CONFIG_CHR_DEV_SG
1961 extern int sg_big_buff;
1962 #endif
1963 @@ -403,6 +406,17 @@ static ctl_table kern_table[] = {
1964 .strategy = &sysctl_string,
1965 },
1966 #endif
1967 +#ifdef CONFIG_FB_SPLASH
1968 + {
1969 + .ctl_name = KERN_FBSPLASH,
1970 + .procname = "fbsplash",
1971 + .data = &fbsplash_path,
1972 + .maxlen = KMOD_PATH_LEN,
1973 + .mode = 0644,
1974 + .proc_handler = &proc_dostring,
1975 + .strategy = &sysctl_string,
1976 + },
1977 +#endif
1978 #ifdef CONFIG_CHR_DEV_SG
1979 {
1980 .ctl_name = KERN_SG_BIG_BUFF,

  ViewVC Help
Powered by ViewVC 1.1.20