1 diff -urN linux-2.6.3.orig/drivers/char/keyboard.c linux-2.6.3/drivers/char/keyboard.c
2 --- linux-2.6.3.orig/drivers/char/keyboard.c 2004-02-18 04:57:30.000000000 +0100
3 +++ linux-2.6.3/drivers/char/keyboard.c 2004-02-19 14:19:14.077767815 +0100
5 if (keycode < BTN_MISC)
6 printk(KERN_WARNING "keyboard.c: can't emulate rawmode for keycode %d\n", keycode);
8 +#ifdef CONFIG_BOOTSPLASH
9 + /* This code has to be redone for some non-x86 platforms */
10 + if (down == 1 && (keycode == 0x3c || keycode == 0x01)) { /* F2 and ESC on PC keyboard */
11 + extern int splash_verbose(void);
12 + if (splash_verbose())
16 #ifdef CONFIG_MAGIC_SYSRQ /* Handle the SysRq Hack */
17 if (keycode == KEY_SYSRQ && (sysrq_down || (down == 1 && sysrq_alt))) {
19 diff -urN linux-2.6.3.orig/drivers/char/n_tty.c linux-2.6.3/drivers/char/n_tty.c
20 --- linux-2.6.3.orig/drivers/char/n_tty.c 2004-02-18 04:57:12.000000000 +0100
21 +++ linux-2.6.3/drivers/char/n_tty.c 2004-02-19 14:19:14.077767815 +0100
26 +#ifdef CONFIG_BOOTSPLASH
27 + if (file->f_dentry->d_inode->i_rdev == MKDEV(TTY_MAJOR,0) ||
28 + file->f_dentry->d_inode->i_rdev == MKDEV(TTY_MAJOR,1) ||
29 + file->f_dentry->d_inode->i_rdev == MKDEV(TTYAUX_MAJOR,0) ||
30 + file->f_dentry->d_inode->i_rdev == MKDEV(TTYAUX_MAJOR,1)) {
31 + extern int splash_verbose(void);
32 + (void)splash_verbose();
36 /* Job control check -- must be done at start and after
37 every sleep (POSIX.1 7.1.1.4). */
38 /* NOTE: not yet done after every sleep pending a thorough
39 diff -urN linux-2.6.3.orig/drivers/char/vt.c linux-2.6.3/drivers/char/vt.c
40 --- linux-2.6.3.orig/drivers/char/vt.c 2004-02-19 13:17:26.913088000 +0100
41 +++ linux-2.6.3/drivers/char/vt.c 2004-02-19 14:19:14.079767505 +0100
42 @@ -3132,6 +3132,31 @@
46 +#ifdef CONFIG_BOOTSPLASH
47 +void con_remap_def_color(int currcons, int new_color)
49 + unsigned short *sbuf = screenbuf;
50 + unsigned c, len = screenbuf_size >> 1;
54 + old_color = def_color << 8;
58 + if (((c ^ old_color) & 0xf000) == 0)
59 + *sbuf ^= (old_color ^ new_color) & 0xf000;
60 + if (((c ^ old_color) & 0x0f00) == 0)
61 + *sbuf ^= (old_color ^ new_color) & 0x0f00;
66 + def_color = color = new_color;
67 + update_attr(currcons);
72 * Visible symbols for modules
74 diff -urN linux-2.6.3.orig/drivers/video/bootsplash/bootsplash.c linux-2.6.3/drivers/video/bootsplash/bootsplash.c
75 --- linux-2.6.3.orig/drivers/video/bootsplash/bootsplash.c 1970-01-01 01:00:00.000000000 +0100
76 +++ linux-2.6.3/drivers/video/bootsplash/bootsplash.c 2004-02-19 14:25:12.275152455 +0100
79 + * linux/drivers/video/bootsplash/bootsplash.c -
80 + * splash screen handling functions.
82 + * (w) 2001-2003 by Volker Poplawski, <volker@poplawski.de>,
83 + * Stefan Reinauer, <stepan@suse.de>,
84 + * Steffen Winterfeldt, <snwint@suse.de>,
85 + * Michael Schroeder <mls@suse.de>
87 + * Ideas & SuSE screen work by Ken Wimer, <wimer@suse.de>
89 + * For more information on this code check http://www.bootsplash.org/
92 +#include <linux/config.h>
93 +#include <linux/module.h>
94 +#include <linux/types.h>
95 +#include <linux/fb.h>
96 +#include <linux/vt_kern.h>
97 +#include <linux/vmalloc.h>
98 +#include <linux/unistd.h>
100 +#include <asm/irq.h>
101 +#include <asm/system.h>
103 +#include "../console/fbcon.h"
104 +#include "bootsplash.h"
105 +#include "decode-jpg.h"
107 +extern struct fb_ops vesafb_ops;
109 +#define SPLASH_VERSION "3.1.4-2004/02/19"
111 +/* These errors have to match fbcon-jpegdec.h */
112 +static unsigned char *jpg_errors[] = {
117 + "bad width or height",
120 + "quant table selector",
121 + "picture is not YCBCR 221111",
122 + "unknow CID in scan",
123 + "dct not sequential",
130 +static struct jpeg_decdata *decdata = 0; /* private decoder data */
132 +static int splash_registered = 0;
133 +static int splash_usesilent = 0; /* shall we display the silentjpeg? */
134 +int splash_default = 0xf01;
136 +static int splash_check_jpeg(unsigned char *jpeg, int width, int height, int depth);
138 +static int __init splash_setup(char *options)
140 + if(!strncmp("silent", options, 6)) {
141 + printk(KERN_INFO "bootsplash: silent mode.\n");
142 + splash_usesilent = 1;
143 + /* skip "silent," */
144 + if (strlen(options) == 6)
148 + if(!strncmp("verbose", options, 7)) {
149 + printk(KERN_INFO "bootsplash: verbose mode.\n");
150 + splash_usesilent = 0;
153 + splash_default = simple_strtoul(options, NULL, 0);
157 +__setup("splash=", splash_setup);
160 +static int splash_hasinter(unsigned char *buf, int num)
162 + unsigned char *bufend = buf + num * 12;
163 + while(buf < bufend) {
164 + if (buf[1] > 127) /* inter? */
166 + buf += buf[3] > 127 ? 24 : 12; /* blend? */
171 +static int boxextract(unsigned char *buf, unsigned short *dp, unsigned char *cols, int *blendp)
173 + dp[0] = buf[0] | buf[1] << 8;
174 + dp[1] = buf[2] | buf[3] << 8;
175 + dp[2] = buf[4] | buf[5] << 8;
176 + dp[3] = buf[6] | buf[7] << 8;
177 + *(unsigned int *)(cols + 0) =
178 + *(unsigned int *)(cols + 4) =
179 + *(unsigned int *)(cols + 8) =
180 + *(unsigned int *)(cols + 12) = *(unsigned int *)(buf + 8);
181 + if (dp[1] > 32767) {
183 + *(unsigned int *)(cols + 4) = *(unsigned int *)(buf + 12);
184 + *(unsigned int *)(cols + 8) = *(unsigned int *)(buf + 16);
185 + *(unsigned int *)(cols + 12) = *(unsigned int *)(buf + 20);
192 +static void boxit(unsigned char *pic, int bytes, unsigned char *buf, int num, int percent, int overpaint)
194 + int x, y, i, p, doblend, r, g, b, a, add;
195 + unsigned short data1[4];
196 + unsigned char cols1[16];
197 + unsigned short data2[4];
198 + unsigned char cols2[16];
199 + unsigned char *bufend;
200 + unsigned short *picp;
201 + unsigned int stipple[32], sti, stin, stinn, stixs, stixe, stiys, stiye;
202 + int xs, xe, ys, ye, xo, yo;
206 + bufend = buf + num * 12;
207 + stipple[0] = 0xffffffff;
212 + while(buf < bufend) {
214 + buf += boxextract(buf, data1, cols1, &doblend);
215 + if (data1[0] == 32767 && data1[1] == 32767) {
223 + } else if (stinn == 4) {
227 + stipple[stinn++] = (cols1[ 0] << 24) | (cols1[ 1] << 16) | (cols1[ 2] << 8) | cols1[ 3] ;
228 + stipple[stinn++] = (cols1[ 4] << 24) | (cols1[ 5] << 16) | (cols1[ 6] << 8) | cols1[ 7] ;
229 + stipple[stinn++] = (cols1[ 8] << 24) | (cols1[ 9] << 16) | (cols1[10] << 8) | cols1[11] ;
230 + stipple[stinn++] = (cols1[12] << 24) | (cols1[13] << 16) | (cols1[14] << 8) | cols1[15] ;
235 + if (data1[0] > 32767)
236 + buf += boxextract(buf, data2, cols2, &doblend);
237 + if (data1[0] == 32767 && data1[1] == 32766) {
239 + i = 12 * (short)data1[3];
241 + i += boxextract(buf + i, data1, cols1, &doblend);
242 + if (data1[0] > 32767)
243 + boxextract(buf + i, data2, cols2, &doblend);
245 + if (data1[0] == 32767)
247 + if (data1[2] > 32767) {
250 + data1[2] = ~data1[2];
252 + if (data1[3] > 32767) {
253 + if (percent == 65536)
255 + data1[3] = ~data1[3];
257 + if (data1[0] > 32767) {
258 + data1[0] = ~data1[0];
259 + for (i = 0; i < 4; i++)
260 + data1[i] = (data1[i] * (65536 - percent) + data2[i] * percent) >> 16;
261 + for (i = 0; i < 16; i++)
262 + cols1[i] = (cols1[i] * (65536 - percent) + cols2[i] * percent) >> 16;
264 + *(unsigned int *)cols2 = *(unsigned int *)cols1;
266 + if (a == 0 && !doblend)
269 + if (stixs >= 32768) {
270 + xo = xs = (stixs ^ 65535) + data1[0];
271 + xe = stixe ? stixe + data1[0] : data1[2];
272 + } else if (stixe >= 32768) {
273 + xs = stixs ? data1[2] - stixs : data1[0];
274 + xe = data1[2] - (stixe ^ 65535);
278 + xe = stixe ? stixe : data1[2];
280 + if (stiys >= 32768) {
281 + yo = ys = (stiys ^ 65535) + data1[1];
282 + ye = stiye ? stiye + data1[1] : data1[3];
283 + } else if (stiye >= 32768) {
284 + ys = stiys ? data1[3] - stiys : data1[1];
285 + ye = data1[3] - (stiye ^ 65535);
289 + ye = stiye ? stiye : data1[3];
291 + xo = 32 - (xo & 31);
292 + yo = stin - (yo % stin);
302 + for (y = ys; y <= ye; y++) {
303 + sti = stipple[(y + yo) % stin];
304 + x = (xs + xo) & 31;
306 + sti = (sti << x) | (sti >> (32 - x));
308 + if ((p = data1[3] - data1[1]) != 0)
309 + p = ((y - data1[1]) << 16) / p;
310 + for (i = 0; i < 8; i++)
311 + cols2[i + 8] = (cols1[i] * (65536 - p) + cols1[i + 8] * p) >> 16;
314 + add ^= (add ^ y) & 1 ? 1 : 3; /* 2x2 ordered dithering */
315 + picp = (unsigned short *)(pic + xs * 2 + y * bytes);
316 + for (x = xs; x <= xe; x++) {
317 + if (!(sti & 0x80000000)) {
323 + sti = (sti << 1) | 1;
325 + if ((p = data1[2] - data1[0]) != 0)
326 + p = ((x - data1[0]) << 16) / p;
327 + for (i = 0; i < 4; i++)
328 + cols2[i] = (cols2[i + 8] * (65536 - p) + cols2[i + 12] * p) >> 16;
336 + r = ((i >> 8 & 0xf8) * (255 - a) + r * a) / 255;
337 + g = ((i >> 3 & 0xfc) * (255 - a) + g * a) / 255;
338 + b = ((i << 3 & 0xf8) * (255 - a) + b * a) / 255;
340 + #define CLAMP(x) ((x) >= 256 ? 255 : (x))
341 + i = ((CLAMP(r + add*2+1) & 0xf8) << 8) |
342 + ((CLAMP(g + add ) & 0xfc) << 3) |
343 + ((CLAMP(b + add*2+1) ) >> 3);
351 +static int splash_check_jpeg(unsigned char *jpeg, int width, int height, int depth)
354 + unsigned char *mem;
356 + size = ((width + 15) & ~15) * ((height + 15) & ~15) * (depth >> 3);
357 + mem = vmalloc(size);
359 + printk(KERN_INFO "bootsplash: no memory for decoded picture.\n");
363 + decdata = vmalloc(sizeof(*decdata));
364 + if ((err = jpeg_decode(jpeg, mem, ((width + 15) & ~15), ((height + 15) & ~15), depth, decdata)))
365 + printk(KERN_INFO "bootsplash: error while decompressing picture: %s (%d)\n",jpg_errors[err - 1], err);
367 + return err ? -1 : 0;
370 +static void splash_free(struct vc_data *vc, struct fb_info *info)
372 + if (!vc->vc_splash_data)
374 + if (info->silent_screen_base)
375 + info->screen_base = info->silent_screen_base;
376 + info->silent_screen_base = 0;
377 + if (vc->vc_splash_data->splash_silentjpeg)
378 + vfree(vc->vc_splash_data->splash_sboxes);
379 + vfree(vc->vc_splash_data);
380 + vc->vc_splash_data = 0;
381 + info->splash_data = 0;
384 +static int splash_mkpenguin(struct splash_data *data, int pxo, int pyo, int pwi, int phe, int pr, int pg, int pb)
386 + unsigned char *buf;
389 + if (pwi ==0 || phe == 0)
391 + buf = (unsigned char *)data + sizeof(*data);
406 + for (i = 0; i < 12; i++, buf++)
414 +static const int splash_offsets[3][16] = {
415 + /* len, unit, size, state, fgcol, col, xo, yo, wi, he
416 + boxcnt, ssize, sboxcnt, percent, overok, palcnt */
418 + { 20, -1, 16, -1, -1, -1, 8, 10, 12, 14,
419 + -1, -1, -1, -1, -1, -1 },
421 + { 35, 8, 12, 9, 10, 11, 16, 18, 20, 22,
422 + -1, -1, -1, -1, -1, -1 },
424 + { 38, 8, 12, 9, 10, 11, 16, 18, 20, 22,
425 + 24, 28, 32, 34, 36, 37 },
428 +#define SPLASH_OFF_LEN offsets[0]
429 +#define SPLASH_OFF_UNIT offsets[1]
430 +#define SPLASH_OFF_SIZE offsets[2]
431 +#define SPLASH_OFF_STATE offsets[3]
432 +#define SPLASH_OFF_FGCOL offsets[4]
433 +#define SPLASH_OFF_COL offsets[5]
434 +#define SPLASH_OFF_XO offsets[6]
435 +#define SPLASH_OFF_YO offsets[7]
436 +#define SPLASH_OFF_WI offsets[8]
437 +#define SPLASH_OFF_HE offsets[9]
438 +#define SPLASH_OFF_BOXCNT offsets[10]
439 +#define SPLASH_OFF_SSIZE offsets[11]
440 +#define SPLASH_OFF_SBOXCNT offsets[12]
441 +#define SPLASH_OFF_PERCENT offsets[13]
442 +#define SPLASH_OFF_OVEROK offsets[14]
443 +#define SPLASH_OFF_PALCNT offsets[15]
445 +static inline int splash_getb(unsigned char *pos, int off)
447 + return off == -1 ? 0 : pos[off];
450 +static inline int splash_gets(unsigned char *pos, int off)
452 + return off == -1 ? 0 : pos[off] | pos[off + 1] << 8;
455 +static inline int splash_geti(unsigned char *pos, int off)
457 + return off == -1 ? 0 :
458 + pos[off] | pos[off + 1] << 8 | pos[off + 2] << 16 | pos[off + 3] << 24;
461 +static int splash_getraw(unsigned char *start, unsigned char *end)
463 + unsigned char *ndata;
473 + const int *offsets;
474 + struct vc_data *vc;
475 + struct fb_info *info;
476 + struct splash_data *sd;
478 + printk(KERN_INFO "bootsplash %s: looking for picture...", SPLASH_VERSION);
480 + for (ndata = start; ndata < end; ndata++) {
481 + if (ndata[0] != 'B' || ndata[1] != 'O' || ndata[2] != 'O' || ndata[3] != 'T')
483 + if (ndata[4] != 'S' || ndata[5] != 'P' || ndata[6] != 'L' || ndata[7] < '1' || ndata[7] > '3')
486 + version = ndata[7] - '0';
487 + offsets = splash_offsets[version - 1];
488 + len = SPLASH_OFF_LEN;
489 + unit = splash_getb(ndata, SPLASH_OFF_UNIT);
490 + if (unit >= MAX_NR_CONSOLES)
493 + acquire_console_sem();
495 + release_console_sem();
497 + vc = vc_cons[unit].d;
498 + info = registered_fb[(int)con2fb_map[unit]];
499 + width = info->var.xres;
500 + height = info->var.yres;
501 + splash_size = splash_geti(ndata, SPLASH_OFF_SIZE);
502 + if (splash_size == (int)0xffffffff && version > 1) {
503 + printk(" found, updating values.\n");
504 + if ((sd = vc->vc_splash_data) != 0) {
505 + i = splash_getb(ndata, SPLASH_OFF_STATE);
507 + sd->splash_state = i;
508 + i = splash_getb(ndata, SPLASH_OFF_FGCOL);
510 + sd->splash_fg_color = i;
511 + i = splash_getb(ndata, SPLASH_OFF_COL);
513 + sd->splash_color = i;
517 + if (splash_size == 0) {
518 + printk(" found, freeing memory.\n");
519 + if (vc->vc_splash_data)
520 + splash_free(vc, info);
523 + boxcnt = splash_gets(ndata, SPLASH_OFF_BOXCNT);
524 + palcnt = 3 * splash_getb(ndata, SPLASH_OFF_PALCNT);
525 + if (ndata + len + splash_size > end) {
526 + printk(" found, but truncated!\n");
529 + if (!jpeg_check_size(ndata + len + boxcnt * 12 + palcnt, width, height)) {
530 + ndata += len + splash_size - 1;
533 + if (splash_check_jpeg(ndata + len + boxcnt * 12 + palcnt, width, height, info->var.bits_per_pixel))
535 + silentsize = splash_geti(ndata, SPLASH_OFF_SSIZE);
537 + printk(" silentjpeg size %d bytes,", silentsize);
538 + if (silentsize >= splash_size) {
539 + printk(" bigger than splashsize!\n");
542 + splash_size -= silentsize;
543 + if (!splash_usesilent)
545 + else if (height * 2 * info->fix.line_length > info->fix.smem_len) {
546 + printk(" does not fit into framebuffer.\n");
549 + sboxcnt = splash_gets(ndata, SPLASH_OFF_SBOXCNT);
551 + unsigned char *simage = ndata + len + splash_size + 12 * sboxcnt;
552 + if (!jpeg_check_size(simage, width, height) ||
553 + splash_check_jpeg(simage, width, height, info->var.bits_per_pixel)) {
554 + printk(" error in silent jpeg.\n");
558 + if (vc->vc_splash_data)
559 + splash_free(vc, info);
560 + vc->vc_splash_data = sd = vmalloc(sizeof(*sd) + splash_size + (version < 3 ? 2 * 12 : 0));
563 + sd->splash_silentjpeg = 0;
564 + sd->splash_sboxes = 0;
565 + sd->splash_sboxcount = 0;
567 + sd->splash_silentjpeg = vmalloc(silentsize);
568 + if (sd->splash_silentjpeg) {
569 + memcpy(sd->splash_silentjpeg, ndata + len + splash_size, silentsize);
570 + sd->splash_sboxes = vc->vc_splash_data->splash_silentjpeg;
571 + sd->splash_silentjpeg += 12 * sboxcnt;
572 + sd->splash_sboxcount = sboxcnt;
575 + sd->splash_state = splash_getb(ndata, SPLASH_OFF_STATE);
576 + sd->splash_fg_color = splash_getb(ndata, SPLASH_OFF_FGCOL);
577 + sd->splash_color = splash_getb(ndata, SPLASH_OFF_COL);
578 + sd->splash_overpaintok = splash_getb(ndata, SPLASH_OFF_OVEROK);
579 + sd->splash_text_xo = splash_gets(ndata, SPLASH_OFF_XO);
580 + sd->splash_text_yo = splash_gets(ndata, SPLASH_OFF_YO);
581 + sd->splash_text_wi = splash_gets(ndata, SPLASH_OFF_WI);
582 + sd->splash_text_he = splash_gets(ndata, SPLASH_OFF_HE);
583 + sd->splash_percent = splash_gets(ndata, SPLASH_OFF_PERCENT);
584 + if (version == 1) {
585 + sd->splash_text_xo *= 8;
586 + sd->splash_text_wi *= 8;
587 + sd->splash_text_yo *= 16;
588 + sd->splash_text_he *= 16;
589 + sd->splash_color = (splash_default >> 8) & 0x0f;
590 + sd->splash_fg_color = (splash_default >> 4) & 0x0f;
591 + sd->splash_state = splash_default & 1;
593 + if (sd->splash_text_xo + sd->splash_text_wi > width || sd->splash_text_yo + sd->splash_text_he > height) {
594 + splash_free(vc, info);
595 + printk(" found, but has oversized text area!\n");
598 + if (!vc_cons[unit].d || info->fbops != &vesafb_ops) {
599 + splash_free(vc, info);
600 + printk(" found, but framebuffer can't handle it!\n");
603 + printk(" found (%dx%d, %d bytes, v%d).\n", width, height, splash_size, version);
604 + if (version == 1) {
605 + printk(KERN_WARNING "bootsplash: Using deprecated v1 header. Updating your splash utility recommended.\n");
606 + printk(KERN_INFO "bootsplash: Find the latest version at http://www.bootsplash.org/\n");
609 + /* fake penguin box for older formats */
611 + boxcnt = splash_mkpenguin(sd, sd->splash_text_xo + 10, sd->splash_text_yo + 10, sd->splash_text_wi - 20, sd->splash_text_he - 20, 0xf0, 0xf0, 0xf0);
612 + else if (version == 2)
613 + boxcnt = splash_mkpenguin(sd, splash_gets(ndata, 24), splash_gets(ndata, 26), splash_gets(ndata, 28), splash_gets(ndata, 30), splash_getb(ndata, 32), splash_getb(ndata, 33), splash_getb(ndata, 34));
615 + memcpy((char *)sd + sizeof(*sd) + (version < 3 ? boxcnt * 12 : 0), ndata + len, splash_size);
616 + sd->splash_boxcount = boxcnt;
617 + sd->splash_boxes = (unsigned char *)sd + sizeof(*sd);
618 + sd->splash_palette = sd->splash_boxes + boxcnt * 12;
619 + sd->splash_jpeg = sd->splash_palette + palcnt;
620 + sd->splash_palcnt = palcnt / 3;
621 + sd->splash_dosilent = sd->splash_silentjpeg != 0;
624 + printk(" no good signature found.\n");
628 +int splash_verbose(void)
630 + struct vc_data *vc;
631 + struct fb_info *info;
633 + if (!splash_usesilent)
638 + if (!vc || !vc->vc_splash_data || !vc->vc_splash_data->splash_state)
640 + if (fg_console != vc->vc_num)
642 + if (!vc->vc_splash_data->splash_silentjpeg || !vc->vc_splash_data->splash_dosilent)
644 + vc->vc_splash_data->splash_dosilent = 0;
645 + info = registered_fb[(int)con2fb_map[0]];
646 + if (!info->silent_screen_base)
648 + splashcopy(info->silent_screen_base, info->screen_base, info->var.yres, info->var.xres, info->fix.line_length, info->fix.line_length);
649 + info->screen_base = info->silent_screen_base;
650 + info->silent_screen_base = 0;
654 +static void splash_off(struct fb_info *info)
656 + if (info->silent_screen_base)
657 + info->screen_base = info->silent_screen_base;
658 + info->silent_screen_base = 0;
659 + info->splash_data = 0;
660 + if (info->splash_pic)
661 + vfree(info->splash_pic);
662 + info->splash_pic = 0;
663 + info->splash_pic_size = 0;
666 +int splash_prepare(struct vc_data *vc, struct fb_info *info)
669 + int width, height, depth, size, sbytes;
671 + if (!vc->vc_splash_data || !vc->vc_splash_data->splash_state) {
679 + width = info->var.xres;
680 + height = info->var.yres;
681 + depth = info->var.bits_per_pixel;
682 + if (depth != 16) { /* Other targets might need fixing */
687 + sbytes = ((width + 15) & ~15) * (depth >> 3);
688 + size = sbytes * ((height + 15) & ~15);
689 + if (size != info->splash_pic_size)
691 + if (!info->splash_pic)
692 + info->splash_pic = vmalloc(size);
694 + if (!info->splash_pic) {
695 + printk(KERN_INFO "bootsplash: not enough memory.\n");
701 + decdata = vmalloc(sizeof(*decdata));
703 + if (vc->vc_splash_data->splash_silentjpeg && vc->vc_splash_data->splash_dosilent) {
704 + /* fill area after framebuffer with other jpeg */
705 + if ((err = jpeg_decode(vc->vc_splash_data->splash_silentjpeg, info->splash_pic,
706 + ((width + 15) & ~15), ((height + 15) & ~15), depth, decdata))) {
707 + printk(KERN_INFO "bootsplash: error while decompressing silent picture: %s (%d)\n", jpg_errors[err - 1], err);
708 + if (info->silent_screen_base)
709 + info->screen_base = info->silent_screen_base;
710 + vc->vc_splash_data->splash_dosilent = 0;
712 + if (vc->vc_splash_data->splash_sboxcount)
713 + boxit(info->splash_pic, sbytes, vc->vc_splash_data->splash_sboxes,
714 + vc->vc_splash_data->splash_sboxcount, vc->vc_splash_data->splash_percent, 0);
716 + if (!info->silent_screen_base)
717 + info->silent_screen_base = info->screen_base;
718 + splashcopy(info->silent_screen_base, info->splash_pic, info->var.yres, info->var.xres, info->fix.line_length, sbytes);
719 + info->screen_base = info->silent_screen_base + info->fix.line_length * info->var.yres;
721 + } else if (info->silent_screen_base)
722 + info->screen_base = info->silent_screen_base;
724 + if ((err = jpeg_decode(vc->vc_splash_data->splash_jpeg, info->splash_pic,
725 + ((width + 15) & ~15), ((height + 15) & ~15), depth, decdata))) {
726 + printk(KERN_INFO "bootsplash: error while decompressing picture: %s (%d) .\n", jpg_errors[err - 1], err);
730 + info->splash_pic_size = size;
731 + info->splash_bytes = sbytes;
732 + if (vc->vc_splash_data->splash_boxcount)
733 + boxit(info->splash_pic, sbytes, vc->vc_splash_data->splash_boxes, vc->vc_splash_data->splash_boxcount, vc->vc_splash_data->splash_percent, 0);
734 + if (vc->vc_splash_data->splash_state)
735 + info->splash_data = vc->vc_splash_data;
742 +#ifdef CONFIG_PROC_FS
744 +#include <linux/proc_fs.h>
746 +static int splash_read_proc(char *buffer, char **start, off_t offset, int size,
747 + int *eof, void *data);
748 +static int splash_write_proc(struct file *file, const char *buffer,
749 + unsigned long count, void *data);
750 +static int splash_status(struct vc_data *vc);
751 +static int splash_recolor(struct vc_data *vc);
752 +static int splash_proc_register(void);
754 +static struct proc_dir_entry *proc_splash;
756 +static int splash_recolor(struct vc_data *vc)
758 + if (!vc->vc_splash_data)
760 + if (!vc->vc_splash_data->splash_state)
762 + con_remap_def_color(vc->vc_num, vc->vc_splash_data->splash_color << 4 | vc->vc_splash_data->splash_fg_color);
763 + if (fg_console == vc->vc_num) {
764 + update_region(fg_console,
765 + vc->vc_origin + vc->vc_size_row * vc->vc_top,
766 + vc->vc_size_row * (vc->vc_bottom - vc->vc_top) / 2);
771 +static int splash_status(struct vc_data *vc)
773 + struct fb_info *info;
774 + printk(KERN_INFO "bootsplash: status on console %d changed to %s\n", vc->vc_num, vc->vc_splash_data && vc->vc_splash_data->splash_state ? "on" : "off");
776 + info = registered_fb[(int) con2fb_map[vc->vc_num]];
777 + if (fg_console == vc->vc_num)
778 + splash_prepare(vc, info);
779 + if (vc->vc_splash_data && vc->vc_splash_data->splash_state) {
780 + con_remap_def_color(vc->vc_num, vc->vc_splash_data->splash_color << 4 | vc->vc_splash_data->splash_fg_color);
781 + acquire_console_sem();
782 + /* vc_resize also calls con_switch which resets yscroll */
783 + vc_resize(vc->vc_num, vc->vc_splash_data->splash_text_wi / vc->vc_font.width, vc->vc_splash_data->splash_text_he / vc->vc_font.height);
784 + if (fg_console == vc->vc_num) {
785 + update_region(fg_console,
786 + vc->vc_origin + vc->vc_size_row * vc->vc_top,
787 + vc->vc_size_row * (vc->vc_bottom - vc->vc_top) / 2);
788 + splash_clear_margins(vc->vc_splash_data, vc, info, 0);
790 + release_console_sem();
792 + /* Switch bootsplash off */
793 + con_remap_def_color(vc->vc_num, 0x07);
794 + acquire_console_sem();
795 + vc_resize(vc->vc_num, info->var.xres / vc->vc_font.width, info->var.yres / vc->vc_font.height);
796 + release_console_sem();
801 +static int splash_read_proc(char *buffer, char **start, off_t offset, int size,
802 + int *eof, void *data)
806 + struct vc_data *vc = vc_cons[0].d;
807 + struct fb_info *info = registered_fb[(int)con2fb_map[0]];
808 + int color = vc->vc_splash_data ? vc->vc_splash_data->splash_color << 4 |
809 + vc->vc_splash_data->splash_fg_color : splash_default >> 4;
810 + int status = vc->vc_splash_data ? vc->vc_splash_data->splash_state & 1 : 0;
811 + len += sprintf(buffer + len, "Splash screen v%s (0x%02x, %dx%d%s): %s\n",
812 + SPLASH_VERSION, color, info->var.xres, info->var.yres,
813 + (vc->vc_splash_data ? vc->vc_splash_data->splash_dosilent : 0)? ", silent" : "",
814 + status ? "on" : "off");
815 + if (offset >= begin + len)
818 + *start = buffer + (begin - offset);
820 + return (size < begin + len - offset ? size : begin + len - offset);
823 +static int splash_write_proc(struct file *file, const char *buffer,
824 + unsigned long count, void *data)
827 + struct vc_data *vc;
829 + if (!buffer || !splash_default)
832 + if (!strncmp(buffer, "show", 4) || !strncmp(buffer, "hide", 4)) {
836 + if (buffer[4] == ' ' && buffer[5] == 'p')
838 + else if (buffer[4] == '\n')
841 + pe = simple_strtoul(buffer + 5, NULL, 0);
846 + if (*buffer == 'h')
849 + if (vc->vc_splash_data && vc->vc_splash_data->splash_percent != pe) {
850 + struct fb_info *info;
852 + oldpe = vc->vc_splash_data->splash_percent;
853 + vc->vc_splash_data->splash_percent = pe;
854 + if (fg_console != 0 || !vc->vc_splash_data->splash_state)
856 + info = registered_fb[(int) con2fb_map[vc->vc_num]];
857 + if (!vc->vc_splash_data->splash_overpaintok || pe == 65536 || pe < oldpe) {
858 + if (splash_hasinter(vc->vc_splash_data->splash_boxes, vc->vc_splash_data->splash_boxcount))
861 + splash_prepare(vc, info);
863 + if (vc->vc_splash_data->splash_silentjpeg && vc->vc_splash_data->splash_dosilent && info->silent_screen_base)
864 + boxit(info->silent_screen_base, info->fix.line_length, vc->vc_splash_data->splash_sboxes, vc->vc_splash_data->splash_sboxcount, vc->vc_splash_data->splash_percent, 1);
865 + boxit(info->screen_base, info->fix.line_length, vc->vc_splash_data->splash_boxes, vc->vc_splash_data->splash_boxcount, vc->vc_splash_data->splash_percent, 1);
870 + if (!strncmp(buffer,"silent\n",7) || !strncmp(buffer,"verbose\n",8)) {
872 + if (vc->vc_splash_data && vc->vc_splash_data->splash_silentjpeg) {
873 + if (vc->vc_splash_data->splash_dosilent != (buffer[0] == 's')) {
874 + vc->vc_splash_data->splash_dosilent = buffer[0] == 's';
880 + if (!strncmp(buffer,"freesilent\n",11)) {
882 + if (vc->vc_splash_data && vc->vc_splash_data->splash_silentjpeg) {
883 + printk(KERN_INFO "bootsplash: freeing silent jpeg\n");
884 + vc->vc_splash_data->splash_silentjpeg = 0;
885 + vfree(vc->vc_splash_data->splash_sboxes);
886 + vc->vc_splash_data->splash_sboxes = 0;
887 + vc->vc_splash_data->splash_sboxcount = 0;
888 + if (vc->vc_splash_data->splash_dosilent)
890 + vc->vc_splash_data->splash_dosilent = 0;
895 + if (!strncmp(buffer, "BOOTSPL", 7)) {
896 + unit = splash_getraw((unsigned char *)buffer, (unsigned char *)buffer + count);
898 + vc = vc_cons[unit].d;
904 + if (!vc->vc_splash_data)
906 + if (buffer[0] == 't') {
907 + vc->vc_splash_data->splash_state ^= 1;
911 + new = simple_strtoul(buffer, NULL, 0);
914 + vc->vc_splash_data->splash_color = new >> 8 & 0xff;
915 + vc->vc_splash_data->splash_fg_color = new >> 4 & 0x0f;
917 + if ((new & 1) == vc->vc_splash_data->splash_state)
918 + splash_recolor(vc);
920 + vc->vc_splash_data->splash_state = new & 1;
926 +static int splash_proc_register(void)
928 + if ((proc_splash = create_proc_entry("splash", 0, 0))) {
929 + proc_splash->read_proc = splash_read_proc;
930 + proc_splash->write_proc = splash_write_proc;
937 +static int splash_proc_unregister(void)
940 + remove_proc_entry("splash", 0);
944 +#endif /* CONFIG_PROC_FS */
946 +asmlinkage long sys_lseek(int fd, off_t offset, unsigned int origin);
947 +asmlinkage long sys_read(int fd, char *buf, size_t count);
948 +asmlinkage long sys_unlink(const char *name);
950 +void splash_init(void)
952 + struct fb_info *info;
953 + struct vc_data *vc;
957 + int max_len = 1024*1024*2;
960 + if (splash_registered)
963 + info = registered_fb[0];
964 + if (!vc || !info || info->var.bits_per_pixel != 16)
966 +#ifdef CONFIG_PROC_FS
967 + splash_proc_register();
969 + splash_registered = 1;
970 + if (vc->vc_splash_data)
972 + if ((fd = sys_open("/bootsplash", O_RDONLY, 0)) < 0) {
974 + fd = sys_open("/initrd.image", O_RDONLY, 0);
978 + if ((len = (int)sys_lseek(fd, (off_t)0, 2)) <= 0) {
982 + /* Don't look for more than the last 2MB */
983 + if (len > max_len) {
984 + printk( KERN_INFO "bootsplash: scanning last %dMB of initrd for signature\n",
986 + sys_lseek(fd, (off_t)(len - max_len), 0);
989 + sys_lseek(fd, (off_t)0, 0);
992 + mem = vmalloc(len);
994 + if ((int)sys_read(fd, mem, len) == len && splash_getraw((unsigned char *)mem, (unsigned char *)mem + len) == 0 && vc->vc_splash_data)
995 + vc->vc_splash_data->splash_state = splash_default & 1;
1000 + sys_unlink("/bootsplash");
1004 diff -urN linux-2.6.3.orig/drivers/video/bootsplash/bootsplash.h linux-2.6.3/drivers/video/bootsplash/bootsplash.h
1005 --- linux-2.6.3.orig/drivers/video/bootsplash/bootsplash.h 1970-01-01 01:00:00.000000000 +0100
1006 +++ linux-2.6.3/drivers/video/bootsplash/bootsplash.h 2004-02-19 14:19:14.081767194 +0100
1009 + * linux/drivers/video/bootsplash/bootsplash.h - splash screen definition.
1011 + * (w) 2001-2003 by Volker Poplawski, <volker@poplawski.de>
1012 + * Stefan Reinauer, <stepan@suse.de>
1015 + * idea and SuSE screen work by Ken Wimer, <wimer@suse.de>
1018 +#ifndef __BOOTSPLASH_H
1019 +#define __BOOTSPLASH_H
1024 +extern int splash_prepare(struct vc_data *, struct fb_info *);
1025 +extern void splash_init(void);
1027 +/* splash_render.c */
1028 +extern void splash_putcs(struct splash_data *sd, struct vc_data *vc, struct fb_info *info,
1029 + const unsigned short *s, int count, int ypos, int xpos);
1030 +extern void splash_putc(struct splash_data *sd, struct vc_data *vc, struct fb_info *info,
1031 + int c, int ypos, int xpos);
1032 +extern void splashcopy(u8 *dst, u8 *src, int height, int width, int dstbytes, int srcbytes);
1033 +extern void splash_clear(struct splash_data *sd, struct vc_data *vc, struct fb_info *info, int sy,
1034 + int sx, int height, int width);
1035 +extern void splash_bmove(struct splash_data *sd, struct vc_data *vc, struct fb_info *info, int sy,
1036 + int sx, int dy, int dx, int height, int width);
1037 +extern void splash_clear_margins(struct splash_data *sd, struct vc_data *vc, struct fb_info *info,
1039 +extern void splash_cursor(struct splash_data *sd, struct fb_info *info, struct fb_cursor *cursor);
1040 +extern void splash_bmove_redraw(struct splash_data *sd, struct vc_data *vc, struct fb_info *info,
1041 + int y, int sx, int dx, int width);
1042 +extern void splash_blank(struct splash_data *sd, struct vc_data *vc, struct fb_info *info,
1046 +extern void con_remap_def_color(int currcons, int new_color);
1048 +extern void acquire_console_sem(void);
1049 +extern void release_console_sem(void);
1052 diff -urN linux-2.6.3.orig/drivers/video/bootsplash/decode-jpg.c linux-2.6.3/drivers/video/bootsplash/decode-jpg.c
1053 --- linux-2.6.3.orig/drivers/video/bootsplash/decode-jpg.c 1970-01-01 01:00:00.000000000 +0100
1054 +++ linux-2.6.3/drivers/video/bootsplash/decode-jpg.c 2004-02-19 14:19:14.082767039 +0100
1057 + * linux/drivers/video/bootsplash/decode-jpg.c - a tiny jpeg decoder.
1059 + * (w) August 2001 by Michael Schroeder, <mls@suse.de>
1063 +#include <linux/config.h>
1064 +#include <linux/string.h>
1065 +#include <asm/byteorder.h>
1067 +#include "decode-jpg.h"
1071 +#define IFIX(a) ((int)((a) * (1 << ISHIFT) + .5))
1072 +#define IMULT(a, b) (((a) * (b)) >> ISHIFT)
1073 +#define ITOINT(a) ((a) >> ISHIFT)
1079 +/* special markers */
1080 +#define M_BADHUFF -1
1085 + unsigned int bits;
1089 + int (*func) __P((void *));
1093 +/*********************************/
1094 +struct dec_hufftbl;
1095 +struct enc_hufftbl;
1098 + struct dec_hufftbl *dhuff;
1099 + struct enc_hufftbl *ehuff;
1103 + int dc; /* old dc value */
1105 + union hufftblp hudc;
1106 + union hufftblp huac;
1107 + int next; /* when to switch to next scan */
1109 + int cid; /* component id */
1110 + int hv; /* horiz/vert, copied from comp */
1111 + int tq; /* quant tbl, copied from comp */
1114 +/*********************************/
1116 +#define DECBITS 10 /* seems to be the optimum */
1118 +struct dec_hufftbl {
1121 + unsigned char vals[256];
1122 + unsigned int llvals[1 << DECBITS];
1125 +static void decode_mcus __P((struct in *, int *, int, struct scan *, int *));
1126 +static int dec_readmarker __P((struct in *));
1127 +static void dec_makehuff __P((struct dec_hufftbl *, int *, unsigned char *));
1129 +static void setinput __P((struct in *, unsigned char *));
1130 +/*********************************/
1135 +static void idctqtab __P((unsigned char *, PREC *));
1136 +static void idct __P((int *, int *, PREC *, PREC, int));
1137 +static void scaleidctqtab __P((PREC *, PREC));
1139 +/*********************************/
1141 +static void initcol __P((PREC[][64]));
1143 +static void col221111 __P((int *, unsigned char *, int));
1144 +static void col221111_16 __P((int *, unsigned char *, int));
1146 +/*********************************/
1149 +#define M_APP0 0xe0
1151 +#define M_SOF0 0xc0
1155 +#define M_RST0 0xd0
1159 +static unsigned char *datap;
1161 +static int getbyte(void)
1166 +static int getword(void)
1171 + return c1 << 8 | c2;
1182 + int nc; /* number of components */
1183 + int ns; /* number of scans */
1184 + int dri; /* restart interval */
1185 + int nm; /* mcus til next marker */
1186 + int rm; /* next restart marker */
1189 +static struct jpginfo info;
1190 +static struct comp comps[MAXCOMP];
1192 +static struct scan dscans[MAXCOMP];
1194 +static unsigned char quant[4][64];
1196 +static struct dec_hufftbl dhuff[4];
1198 +#define dec_huffdc (dhuff + 0)
1199 +#define dec_huffac (dhuff + 2)
1201 +static struct in in;
1203 +static int readtables(int till)
1205 + int m, l, i, j, lq, pq, tq;
1209 + if (getbyte() != 0xff)
1211 + if ((m = getbyte()) == till)
1228 + for (i = 0; i < 64; i++)
1229 + quant[tq][i] = getbyte();
1237 + int hufflen[16], k;
1238 + unsigned char huffvals[256];
1244 + if (tc > 1 || th > 1)
1246 + for (i = 0; i < 16; i++)
1247 + hufflen[i] = getbyte();
1250 + for (i = 0; i < 16; i++) {
1251 + for (j = 0; j < hufflen[i]; j++)
1252 + huffvals[k++] = getbyte();
1255 + dec_makehuff(dhuff + tt, hufflen,
1262 + info.dri = getword();
1275 +static void dec_initscans(void)
1279 + info.nm = info.dri + 1;
1281 + for (i = 0; i < info.ns; i++)
1285 +static int dec_checkmarker(void)
1289 + if (dec_readmarker(&in) != info.rm)
1291 + info.nm = info.dri;
1292 + info.rm = (info.rm + 1) & ~0x08;
1293 + for (i = 0; i < info.ns; i++)
1298 +int jpeg_check_size(unsigned char *buf, int width, int height)
1303 + readtables(M_SOF0);
1306 + if (height != getword() || width != getword())
1311 +int jpeg_decode(buf, pic, width, height, depth, decdata)
1312 +unsigned char *buf, *pic;
1313 +int width, height, depth;
1314 +struct jpeg_decdata *decdata;
1316 + int i, j, m, tac, tdc;
1317 + int mcusx, mcusy, mx, my;
1323 + if (getbyte() != 0xff)
1324 + return ERR_NO_SOI;
1325 + if (getbyte() != M_SOI)
1326 + return ERR_NO_SOI;
1327 + if (readtables(M_SOF0))
1328 + return ERR_BAD_TABLES;
1332 + return ERR_NOT_8BIT;
1333 + if (((getword() + 15) & ~15) != height)
1334 + return ERR_HEIGHT_MISMATCH;
1335 + if (((getword() + 15) & ~15) != width)
1336 + return ERR_WIDTH_MISMATCH;
1337 + if ((height & 15) || (width & 15))
1338 + return ERR_BAD_WIDTH_OR_HEIGHT;
1339 + info.nc = getbyte();
1340 + if (info.nc > MAXCOMP)
1341 + return ERR_TOO_MANY_COMPPS;
1342 + for (i = 0; i < info.nc; i++) {
1344 + comps[i].cid = getbyte();
1345 + comps[i].hv = getbyte();
1346 + v = comps[i].hv & 15;
1347 + h = comps[i].hv >> 4;
1348 + comps[i].tq = getbyte();
1349 + if (h > 3 || v > 3)
1350 + return ERR_ILLEGAL_HV;
1351 + if (comps[i].tq > 3)
1352 + return ERR_QUANT_TABLE_SELECTOR;
1354 + if (readtables(M_SOS))
1355 + return ERR_BAD_TABLES;
1357 + info.ns = getbyte();
1359 + return ERR_NOT_YCBCR_221111;
1360 + for (i = 0; i < 3; i++) {
1361 + dscans[i].cid = getbyte();
1365 + if (tdc > 1 || tac > 1)
1366 + return ERR_QUANT_TABLE_SELECTOR;
1367 + for (j = 0; j < info.nc; j++)
1368 + if (comps[j].cid == dscans[i].cid)
1371 + return ERR_UNKNOWN_CID_IN_SCAN;
1372 + dscans[i].hv = comps[j].hv;
1373 + dscans[i].tq = comps[j].tq;
1374 + dscans[i].hudc.dhuff = dec_huffdc + tdc;
1375 + dscans[i].huac.dhuff = dec_huffac + tac;
1382 + if (i != 0 || j != 63 || m != 0)
1383 + return ERR_NOT_SEQUENTIAL_DCT;
1385 + if (dscans[0].cid != 1 || dscans[1].cid != 2 || dscans[2].cid != 3)
1386 + return ERR_NOT_YCBCR_221111;
1388 + if (dscans[0].hv != 0x22 || dscans[1].hv != 0x11 || dscans[2].hv != 0x11)
1389 + return ERR_NOT_YCBCR_221111;
1391 + mcusx = width >> 4;
1392 + mcusy = height >> 4;
1395 + idctqtab(quant[dscans[0].tq], decdata->dquant[0]);
1396 + idctqtab(quant[dscans[1].tq], decdata->dquant[1]);
1397 + idctqtab(quant[dscans[2].tq], decdata->dquant[2]);
1398 + initcol(decdata->dquant);
1399 + setinput(&in, datap);
1402 + /* landing zone */
1404 + img[len + 1] = 0xff;
1405 + img[len + 2] = M_EOF;
1410 + dscans[0].next = 6 - 4;
1411 + dscans[1].next = 6 - 4 - 1;
1412 + dscans[2].next = 6 - 4 - 1 - 1; /* 411 encoding */
1413 + for (my = 0; my < mcusy; my++) {
1414 + for (mx = 0; mx < mcusx; mx++) {
1415 + if (info.dri && !--info.nm)
1416 + if (dec_checkmarker())
1417 + return ERR_WRONG_MARKER;
1419 + decode_mcus(&in, decdata->dcts, 6, dscans, max);
1420 + idct(decdata->dcts, decdata->out, decdata->dquant[0], IFIX(128.5), max[0]);
1421 + idct(decdata->dcts + 64, decdata->out + 64, decdata->dquant[0], IFIX(128.5), max[1]);
1422 + idct(decdata->dcts + 128, decdata->out + 128, decdata->dquant[0], IFIX(128.5), max[2]);
1423 + idct(decdata->dcts + 192, decdata->out + 192, decdata->dquant[0], IFIX(128.5), max[3]);
1424 + idct(decdata->dcts + 256, decdata->out + 256, decdata->dquant[1], IFIX(0.5), max[4]);
1425 + idct(decdata->dcts + 320, decdata->out + 320, decdata->dquant[2], IFIX(0.5), max[5]);
1429 + col221111(decdata->out, pic + (my * 16 * mcusx + mx) * 16 * 3, mcusx * 16 * 3);
1432 + col221111_16(decdata->out, pic + (my * 16 * mcusx + mx) * (16 * 2), mcusx * (16 * 2));
1435 + return ERR_DEPTH_MISMATCH;
1441 + m = dec_readmarker(&in);
1443 + return ERR_NO_EOI;
1448 +/****************************************************************/
1449 +/************** huffman decoder ***************/
1450 +/****************************************************************/
1452 +static int fillbits __P((struct in *, int, unsigned int));
1453 +static int dec_rec2
1454 +__P((struct in *, struct dec_hufftbl *, int *, int, int));
1456 +static void setinput(in, p)
1466 +static int fillbits(in, le, bi)
1475 + in->bits = bi << 16, le += 16;
1478 + while (le <= 24) {
1480 + if (b == 0xff && (m = *in->p++) != 0) {
1482 + if (in->func && (m = in->func(in->data)) == 0)
1487 + bi = bi << 16, le += 16;
1493 + in->bits = bi; /* tmp... 2 return values needed */
1497 +static int dec_readmarker(in)
1502 + in->left = fillbits(in, in->left, in->bits);
1503 + if ((m = in->marker) == 0)
1510 +#define LEBI_DCL int le, bi
1511 +#define LEBI_GET(in) (le = in->left, bi = in->bits)
1512 +#define LEBI_PUT(in) (in->left = le, in->bits = bi)
1514 +#define GETBITS(in, n) ( \
1515 + (le < (n) ? le = fillbits(in, le, bi), bi = in->bits : 0), \
1517 + bi >> le & ((1 << (n)) - 1) \
1520 +#define UNGETBITS(in, n) ( \
1525 +static int dec_rec2(in, hu, runp, c, i)
1527 +struct dec_hufftbl *hu;
1535 + UNGETBITS(in, i & 127);
1536 + *runp = i >> 8 & 15;
1539 + for (i = DECBITS; (c = ((c << 1) | GETBITS(in, 1))) >= (hu->maxcode[i]); i++);
1541 + in->marker = M_BADHUFF;
1544 + i = hu->vals[hu->valptr[i] + c - hu->maxcode[i - 1] * 2];
1548 + if (i == 0) { /* sigh, 0xf0 is 11 bit */
1552 + /* receive part */
1553 + c = GETBITS(in, i);
1554 + if (c < (1 << (i - 1)))
1555 + c += (-1 << i) + 1;
1560 +#define DEC_REC(in, hu, r, i) ( \
1561 + r = GETBITS(in, DECBITS), \
1562 + i = hu->llvals[r], \
1565 + UNGETBITS(in, i & 127), \
1566 + r = i >> 8 & 15, \
1572 + i = dec_rec2(in, hu, &r, r, i), \
1578 +static void decode_mcus(in, dct, n, sc, maxp)
1585 + struct dec_hufftbl *hu;
1589 + memset(dct, 0, n * 64 * sizeof(*dct));
1592 + hu = sc->hudc.dhuff;
1593 + *dct++ = (sc->dc += DEC_REC(in, hu, r, t));
1595 + hu = sc->huac.dhuff;
1598 + t = DEC_REC(in, hu, r, t);
1599 + if (t == 0 && r == 0) {
1608 + if (n == sc->next)
1614 +static void dec_makehuff(hu, hufflen, huffvals)
1615 +struct dec_hufftbl *hu;
1617 +unsigned char *huffvals;
1619 + int code, k, i, j, d, x, c, v;
1620 + for (i = 0; i < (1 << DECBITS); i++)
1621 + hu->llvals[i] = 0;
1626 + * value v already known, run r, backup u bits:
1627 + * vvvvvvvvvvvvvvvv 0000 rrrr 1 uuuuuuu
1628 + * value unknown, size b bits, run r, backup u bits:
1629 + * 000000000000bbbb 0000 rrrr 0 uuuuuuu
1630 + * value and size unknown:
1631 + * 0000000000000000 0000 0000 0 0000000
1635 + for (i = 0; i < 16; i++, code <<= 1) { /* sizes */
1636 + hu->valptr[i] = k;
1637 + for (j = 0; j < hufflen[i]; j++) {
1638 + hu->vals[k] = *huffvals++;
1639 + if (i < DECBITS) {
1640 + c = code << (DECBITS - 1 - i);
1641 + v = hu->vals[k] & 0x0f; /* size */
1642 + for (d = 1 << (DECBITS - 1 - i); --d >= 0;) {
1643 + if (v + i < DECBITS) { /* both fit in table */
1644 + x = d >> (DECBITS - 1 - v -
1646 + if (v && x < (1 << (v - 1)))
1647 + x += (-1 << v) + 1;
1648 + x = x << 16 | (hu-> vals[k] & 0xf0) << 4 |
1649 + (DECBITS - (i + 1 + v)) | 128;
1651 + x = v << 16 | (hu-> vals[k] & 0xf0) << 4 |
1652 + (DECBITS - (i + 1));
1653 + hu->llvals[c | d] = x;
1659 + hu->maxcode[i] = code;
1661 + hu->maxcode[16] = 0x20000; /* always terminate decode */
1664 +/****************************************************************/
1665 +/************** idct ***************/
1666 +/****************************************************************/
1668 +#define ONE ((PREC)IFIX(1.))
1669 +#define S2 ((PREC)IFIX(0.382683432))
1670 +#define C2 ((PREC)IFIX(0.923879532))
1671 +#define C4 ((PREC)IFIX(0.707106781))
1673 +#define S22 ((PREC)IFIX(2 * 0.382683432))
1674 +#define C22 ((PREC)IFIX(2 * 0.923879532))
1675 +#define IC4 ((PREC)IFIX(1 / 0.707106781))
1677 +#define C3IC1 ((PREC)IFIX(0.847759065)) /* c3/c1 */
1678 +#define C5IC1 ((PREC)IFIX(0.566454497)) /* c5/c1 */
1679 +#define C7IC1 ((PREC)IFIX(0.198912367)) /* c7/c1 */
1681 +#define XPP(a,b) (t = a + b, b = a - b, a = t)
1682 +#define XMP(a,b) (t = a - b, b = a + b, a = t)
1683 +#define XPM(a,b) (t = a + b, b = b - a, a = t)
1685 +#define ROT(a,b,s,c) ( t = IMULT(a + b, s), \
1686 + a = IMULT(a, c - s) + t, \
1687 + b = IMULT(b, c + s) - t)
1693 + t2 = IMULT(t2, IC4) - t3, \
1699 + t5 = IMULT(t5, IC4), \
1700 + ROT(t4, t6, S22, C22),\
1710 +static unsigned char zig2[64] = {
1711 + 0, 2, 3, 9, 10, 20, 21, 35,
1712 + 14, 16, 25, 31, 39, 46, 50, 57,
1713 + 5, 7, 12, 18, 23, 33, 37, 48,
1714 + 27, 29, 41, 44, 52, 55, 59, 62,
1715 + 15, 26, 30, 40, 45, 51, 56, 58,
1716 + 1, 4, 8, 11, 19, 22, 34, 36,
1717 + 28, 42, 43, 53, 54, 60, 61, 63,
1718 + 6, 13, 17, 24, 32, 38, 47, 49
1721 +void idct(in, out, quant, off, max)
1728 + PREC t0, t1, t2, t3, t4, t5, t6, t7, t;
1729 + PREC tmp[64], *tmpp;
1731 + unsigned char *zig2p;
1735 + t0 += in[0] * quant[0];
1736 + for (i = 0; i < 64; i++)
1737 + out[i] = ITOINT(t0);
1742 + for (i = 0; i < 8; i++) {
1744 + t0 += in[j] * quant[j];
1746 + t5 = in[j] * quant[j];
1748 + t2 = in[j] * quant[j];
1750 + t7 = in[j] * quant[j];
1752 + t1 = in[j] * quant[j];
1754 + t4 = in[j] * quant[j];
1756 + t3 = in[j] * quant[j];
1758 + t6 = in[j] * quant[j];
1771 + for (i = 0; i < 8; i++) {
1772 + t0 = tmp[8 * i + 0];
1773 + t1 = tmp[8 * i + 1];
1774 + t2 = tmp[8 * i + 2];
1775 + t3 = tmp[8 * i + 3];
1776 + t4 = tmp[8 * i + 4];
1777 + t5 = tmp[8 * i + 5];
1778 + t6 = tmp[8 * i + 6];
1779 + t7 = tmp[8 * i + 7];
1781 + out[8 * i + 0] = ITOINT(t0);
1782 + out[8 * i + 1] = ITOINT(t1);
1783 + out[8 * i + 2] = ITOINT(t2);
1784 + out[8 * i + 3] = ITOINT(t3);
1785 + out[8 * i + 4] = ITOINT(t4);
1786 + out[8 * i + 5] = ITOINT(t5);
1787 + out[8 * i + 6] = ITOINT(t6);
1788 + out[8 * i + 7] = ITOINT(t7);
1792 +static unsigned char zig[64] = {
1793 + 0, 1, 5, 6, 14, 15, 27, 28,
1794 + 2, 4, 7, 13, 16, 26, 29, 42,
1795 + 3, 8, 12, 17, 25, 30, 41, 43,
1796 + 9, 11, 18, 24, 31, 40, 44, 53,
1797 + 10, 19, 23, 32, 39, 45, 52, 54,
1798 + 20, 22, 33, 38, 46, 51, 55, 60,
1799 + 21, 34, 37, 47, 50, 56, 59, 61,
1800 + 35, 36, 48, 49, 57, 58, 62, 63
1803 +static PREC aaidct[8] = {
1804 + IFIX(0.3535533906), IFIX(0.4903926402),
1805 + IFIX(0.4619397663), IFIX(0.4157348062),
1806 + IFIX(0.3535533906), IFIX(0.2777851165),
1807 + IFIX(0.1913417162), IFIX(0.0975451610)
1811 +static void idctqtab(qin, qout)
1812 +unsigned char *qin;
1817 + for (i = 0; i < 8; i++)
1818 + for (j = 0; j < 8; j++)
1819 + qout[zig[i * 8 + j]] = qin[zig[i * 8 + j]] *
1820 + IMULT(aaidct[i], aaidct[j]);
1823 +static void scaleidctqtab(q, sc)
1829 + for (i = 0; i < 64; i++)
1830 + q[i] = IMULT(q[i], sc);
1833 +/****************************************************************/
1834 +/************** color decoder ***************/
1835 +/****************************************************************/
1840 + * YCbCr Color transformation:
1842 + * y:0..255 Cb:-128..127 Cr:-128..127
1844 + * R = Y + 1.40200 * Cr
1845 + * G = Y - 0.34414 * Cb - 0.71414 * Cr
1846 + * B = Y + 1.77200 * Cb
1851 + * Cg = 0.19421 * Cb + .50937 * Cr;
1857 + * Cg = (50 * Cb + 130 * Cr + 128) >> 8;
1860 +static void initcol(q)
1863 + scaleidctqtab(q[1], IFIX(1.77200));
1864 + scaleidctqtab(q[2], IFIX(1.40200));
1867 +/* This is optimized for the stupid sun SUNWspro compiler. */
1868 +#define STORECLAMP(a,x) \
1871 + (unsigned int)(x) >= 256 ? \
1872 + ((a) = (x) < 0 ? 0 : 255) \
1877 +#define CLAMP(x) ((unsigned int)(x) >= 256 ? ((x) < 0 ? 0 : 255) : (x))
1881 +#define CBCRCG(yin, xin) \
1883 + cb = outc[0 +yin*8+xin], \
1884 + cr = outc[64+yin*8+xin], \
1885 + cg = (50 * cb + 130 * cr + 128) >> 8 \
1890 +#define CBCRCG(yin, xin) \
1892 + cb = outc[0 +yin*8+xin], \
1893 + cr = outc[64+yin*8+xin], \
1894 + cg = (3 * cb + 8 * cr) >> 4 \
1899 +#define PIC(yin, xin, p, xout) \
1901 + y = outy[(yin) * 8 + xin], \
1902 + STORECLAMP(p[(xout) * 3 + 0], y + cr), \
1903 + STORECLAMP(p[(xout) * 3 + 1], y - cg), \
1904 + STORECLAMP(p[(xout) * 3 + 2], y + cb) \
1907 +#ifdef __LITTLE_ENDIAN
1908 +#define PIC_16(yin, xin, p, xout, add) \
1910 + y = outy[(yin) * 8 + xin], \
1911 + y = ((CLAMP(y + cr + add*2+1) & 0xf8) << 8) | \
1912 + ((CLAMP(y - cg + add ) & 0xfc) << 3) | \
1913 + ((CLAMP(y + cb + add*2+1) ) >> 3), \
1914 + p[(xout) * 2 + 0] = y & 0xff, \
1915 + p[(xout) * 2 + 1] = y >> 8 \
1919 +#define PIC_16(yin, xin, p, xout, add) \
1921 + y = outy[(yin) * 8 + xin], \
1922 + y = ((CLAMP(y + cr + add*2+1) & 0xf8) << 7) | \
1923 + ((CLAMP(y - cg + add*2+1) & 0xf8) << 2) | \
1924 + ((CLAMP(y + cb + add*2+1) ) >> 3), \
1925 + p[(xout) * 2 + 0] = y >> 8, \
1926 + p[(xout) * 2 + 1] = y & 0xff \
1929 +#define PIC_16(yin, xin, p, xout, add) \
1931 + y = outy[(yin) * 8 + xin], \
1932 + y = ((CLAMP(y + cr + add*2+1) & 0xf8) << 8) | \
1933 + ((CLAMP(y - cg + add ) & 0xfc) << 3) | \
1934 + ((CLAMP(y + cb + add*2+1) ) >> 3), \
1935 + p[(xout) * 2 + 0] = y >> 8, \
1936 + p[(xout) * 2 + 1] = y & 0xff \
1941 +#define PIC221111(xin) \
1944 + PIC(xin / 4 * 8 + 0, (xin & 3) * 2 + 0, pic0, xin * 2 + 0), \
1945 + PIC(xin / 4 * 8 + 0, (xin & 3) * 2 + 1, pic0, xin * 2 + 1), \
1946 + PIC(xin / 4 * 8 + 1, (xin & 3) * 2 + 0, pic1, xin * 2 + 0), \
1947 + PIC(xin / 4 * 8 + 1, (xin & 3) * 2 + 1, pic1, xin * 2 + 1) \
1950 +#define PIC221111_16(xin) \
1953 + PIC_16(xin / 4 * 8 + 0, (xin & 3) * 2 + 0, pic0, xin * 2 + 0, 3), \
1954 + PIC_16(xin / 4 * 8 + 0, (xin & 3) * 2 + 1, pic0, xin * 2 + 1, 0), \
1955 + PIC_16(xin / 4 * 8 + 1, (xin & 3) * 2 + 0, pic1, xin * 2 + 0, 1), \
1956 + PIC_16(xin / 4 * 8 + 1, (xin & 3) * 2 + 1, pic1, xin * 2 + 1, 2) \
1959 +static void col221111(out, pic, width)
1961 +unsigned char *pic;
1965 + unsigned char *pic0, *pic1;
1967 + int cr, cg, cb, y;
1970 + pic1 = pic + width;
1972 + outc = out + 64 * 4;
1973 + for (i = 2; i > 0; i--) {
1974 + for (j = 4; j > 0; j--) {
1975 + for (k = 0; k < 8; k++) {
1980 + pic0 += 2 * width;
1981 + pic1 += 2 * width;
1983 + outy += 64 * 2 - 16 * 4;
1987 +static void col221111_16(out, pic, width)
1989 +unsigned char *pic;
1993 + unsigned char *pic0, *pic1;
1995 + int cr, cg, cb, y;
1998 + pic1 = pic + width;
2000 + outc = out + 64 * 4;
2001 + for (i = 2; i > 0; i--) {
2002 + for (j = 4; j > 0; j--) {
2003 + for (k = 0; k < 8; k++) {
2008 + pic0 += 2 * width;
2009 + pic1 += 2 * width;
2011 + outy += 64 * 2 - 16 * 4;
2014 diff -urN linux-2.6.3.orig/drivers/video/bootsplash/decode-jpg.h linux-2.6.3/drivers/video/bootsplash/decode-jpg.h
2015 --- linux-2.6.3.orig/drivers/video/bootsplash/decode-jpg.h 1970-01-01 01:00:00.000000000 +0100
2016 +++ linux-2.6.3/drivers/video/bootsplash/decode-jpg.h 2004-02-19 14:19:14.082767039 +0100
2019 + * linux/drivers/video/bootsplash/decode-jpg.h - a tiny jpeg decoder.
2021 + * (w) August 2001 by Michael Schroeder, <mls@suse.de>
2024 +#ifndef __DECODE_JPG_H
2025 +#define __DECODE_JPG_H
2027 +#define ERR_NO_SOI 1
2028 +#define ERR_NOT_8BIT 2
2029 +#define ERR_HEIGHT_MISMATCH 3
2030 +#define ERR_WIDTH_MISMATCH 4
2031 +#define ERR_BAD_WIDTH_OR_HEIGHT 5
2032 +#define ERR_TOO_MANY_COMPPS 6
2033 +#define ERR_ILLEGAL_HV 7
2034 +#define ERR_QUANT_TABLE_SELECTOR 8
2035 +#define ERR_NOT_YCBCR_221111 9
2036 +#define ERR_UNKNOWN_CID_IN_SCAN 10
2037 +#define ERR_NOT_SEQUENTIAL_DCT 11
2038 +#define ERR_WRONG_MARKER 12
2039 +#define ERR_NO_EOI 13
2040 +#define ERR_BAD_TABLES 14
2041 +#define ERR_DEPTH_MISMATCH 15
2043 +struct jpeg_decdata {
2044 + int dcts[6 * 64 + 16];
2046 + int dquant[3][64];
2049 +extern int jpeg_decode(unsigned char *, unsigned char *, int, int, int, struct jpeg_decdata *);
2050 +extern int jpeg_check_size(unsigned char *, int, int);
2053 diff -urN linux-2.6.3.orig/drivers/video/bootsplash/Kconfig linux-2.6.3/drivers/video/bootsplash/Kconfig
2054 --- linux-2.6.3.orig/drivers/video/bootsplash/Kconfig 1970-01-01 01:00:00.000000000 +0100
2055 +++ linux-2.6.3/drivers/video/bootsplash/Kconfig 2004-02-19 14:24:26.244296449 +0100
2058 +# Bootsplash configuration
2061 +menu "Bootsplash configuration"
2064 + bool "Bootup splash screen"
2065 + depends on FRAMEBUFFER_CONSOLE && FB_VESA
2068 + This option enables the Linux bootsplash screen. For more
2069 + information on the bootsplash screen have a look at
2070 + http://www.bootsplash.org/.
2071 + If you are unsure, say N
2074 diff -urN linux-2.6.3.orig/drivers/video/bootsplash/Makefile linux-2.6.3/drivers/video/bootsplash/Makefile
2075 --- linux-2.6.3.orig/drivers/video/bootsplash/Makefile 1970-01-01 01:00:00.000000000 +0100
2076 +++ linux-2.6.3/drivers/video/bootsplash/Makefile 2004-02-19 14:19:14.083766884 +0100
2078 +# Makefile for the Linux bootsplash
2080 +obj-$(CONFIG_BOOTSPLASH) += bootsplash.o
2081 +obj-$(CONFIG_BOOTSPLASH) += decode-jpg.o
2082 +obj-$(CONFIG_BOOTSPLASH) += render.o
2083 diff -urN linux-2.6.3.orig/drivers/video/bootsplash/render.c linux-2.6.3/drivers/video/bootsplash/render.c
2084 --- linux-2.6.3.orig/drivers/video/bootsplash/render.c 1970-01-01 01:00:00.000000000 +0100
2085 +++ linux-2.6.3/drivers/video/bootsplash/render.c 2004-02-19 14:19:14.083766884 +0100
2088 + * linux/drivers/video/bootsplash/render.c - splash screen render functions.
2091 +#include <linux/config.h>
2092 +#include <linux/module.h>
2093 +#include <linux/types.h>
2094 +#include <linux/fb.h>
2095 +#include <linux/vt_kern.h>
2096 +#include <asm/irq.h>
2097 +#include <asm/system.h>
2099 +#include "../console/fbcon.h"
2100 +#include "bootsplash.h"
2102 +void splash_putcs(struct splash_data *sd, struct vc_data *vc, struct fb_info *info,
2103 + const unsigned short *s, int count, int ypos, int xpos)
2105 + unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff;
2106 + int bgshift = (vc->vc_hi_font_mask) ? 13 : 12;
2107 + int fgshift = (vc->vc_hi_font_mask) ? 9 : 8;
2109 + u8 *dst, *splashsrc;
2110 + unsigned int d, x, y;
2112 + u16 c = scr_readw(s);
2114 + int fg_color, bg_color, transparent;
2115 + fg_color = attr_fgcol(fgshift, c);
2116 + bg_color = attr_bgcol(bgshift, c);
2117 + transparent = sd->splash_color == bg_color;
2118 + xpos = xpos * vc->vc_font.width + sd->splash_text_xo;
2119 + ypos = ypos * vc->vc_font.height + sd->splash_text_yo;
2120 + splashsrc = (u8 *)(info->splash_pic + ypos * info->splash_bytes + xpos * 2);
2121 + dst = (u8 *)(info->screen_base + ypos * info->fix.line_length + xpos * 2);
2123 + fgx = ((u32 *)info->pseudo_palette)[fg_color];
2124 + if (transparent && sd->splash_color == 15) {
2125 + if (fgx == 0xffea)
2127 + else if (fgx == 0x57ea)
2129 + else if (fgx == 0xffff)
2132 + bgx = ((u32 *)info->pseudo_palette)[bg_color];
2136 + c = scr_readw(s++);
2137 + src = vc->vc_font.data + (c & charmask) * vc->vc_font.height * ((vc->vc_font.width + 7) >> 3);
2139 + for (y = 0; y < vc->vc_font.height; y++) {
2140 + for (x = 0; x < vc->vc_font.width; x += 2) {
2146 + dd = transparent ? *(u16 *)splashsrc : bgx;
2151 + dd |= (transparent ? *(u16 *)splashsrc : bgx) << 16;
2154 + fb_writel(dd, dst);
2157 + dst += info->fix.line_length - vc->vc_font.width * 2;
2158 + splashsrc += info->splash_bytes - vc->vc_font.width * 2;
2160 + dst -= info->fix.line_length * vc->vc_font.height - vc->vc_font.width * 2;
2161 + splashsrc -= info->splash_bytes * vc->vc_font.height - vc->vc_font.width * 2;
2165 +static void splash_renderc(struct splash_data *sd, struct fb_info *info, int fg_color, int bg_color, u8 *src, int ypos, int xpos, int height, int width)
2167 + int transparent = sd->splash_color == bg_color;
2169 + u8 *dst, *splashsrc;
2170 + unsigned int d, x, y;
2172 + splashsrc = (u8 *)(info->splash_pic + ypos * info->splash_bytes + xpos * 2);
2173 + dst = (u8 *)(info->screen_base + ypos * info->fix.line_length + xpos * 2);
2174 + fgx = ((u32 *)info->pseudo_palette)[fg_color];
2175 + if (transparent && sd->splash_color == 15) {
2176 + if (fgx == 0xffea)
2178 + else if (fgx == 0x57ea)
2180 + else if (fgx == 0xffff)
2183 + bgx = ((u32 *)info->pseudo_palette)[bg_color];
2185 + for (y = 0; y < height; y++) {
2186 + for (x = 0; x < width; x += 2) {
2192 + dd = transparent ? *(u16 *)splashsrc : bgx;
2197 + dd |= (transparent ? *(u16 *)splashsrc : bgx) << 16;
2200 + fb_writel(dd, dst);
2203 + dst += info->fix.line_length - width * 2;
2204 + splashsrc += info->splash_bytes - width * 2;
2208 +void splash_putc(struct splash_data *sd, struct vc_data *vc, struct fb_info *info,
2209 + int c, int ypos, int xpos)
2211 + unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff;
2212 + int bgshift = (vc->vc_hi_font_mask) ? 13 : 12;
2213 + int fgshift = (vc->vc_hi_font_mask) ? 9 : 8;
2214 + u8 *src = vc->vc_font.data + (c & charmask) * vc->vc_font.height * ((vc->vc_font.width + 7) >> 3);
2215 + xpos = xpos * vc->vc_font.width + sd->splash_text_xo;
2216 + ypos = ypos * vc->vc_font.height + sd->splash_text_yo;
2217 + splash_renderc(sd, info, attr_fgcol(fgshift, c), attr_bgcol(bgshift, c), src, ypos, xpos, vc->vc_font.height, vc->vc_font.width);
2220 +void splashcopy(u8 *dst, u8 *src, int height, int width, int dstbytes, int srcbytes)
2224 + while (height-- > 0) {
2225 + u32 *p = (u32 *)dst;
2226 + u32 *q = (u32 *)src;
2227 + for (i=0; i < width/4; i++) {
2228 + fb_writel(*q++,p++);
2229 + fb_writel(*q++,p++);
2232 + fb_writel(*q++,p++);
2234 + fb_writew(*(u16*)q,(u16*)p);
2240 +static void splashset(u8 *dst, int height, int width, int dstbytes, u32 bgx) {
2244 + while (height-- > 0) {
2245 + u32 *p = (u32 *)dst;
2246 + for (i=0; i < width/4; i++) {
2247 + fb_writel(bgx,p++);
2248 + fb_writel(bgx,p++);
2251 + fb_writel(bgx,p++);
2253 + fb_writew(bgx,(u16*)p);
2258 +static void splashfill(struct fb_info *info, int sy, int sx, int height, int width) {
2259 + splashcopy((u8 *)(info->screen_base + sy * info->fix.line_length + sx * 2), (u8 *)(info->splash_pic + sy * info->splash_bytes + sx * 2), height, width, info->fix.line_length, info->splash_bytes);
2262 +void splash_clear(struct splash_data *sd, struct vc_data *vc, struct fb_info *info, int sy,
2263 + int sx, int height, int width)
2265 + int bgshift = (vc->vc_hi_font_mask) ? 13 : 12;
2266 + int bg_color = attr_bgcol_ec(bgshift, vc);
2267 + int transparent = sd->splash_color == bg_color;
2271 + sy = sy * vc->vc_font.height + sd->splash_text_yo;
2272 + sx = sx * vc->vc_font.width + sd->splash_text_xo;
2273 + height *= vc->vc_font.height;
2274 + width *= vc->vc_font.width;
2275 + if (transparent) {
2276 + splashfill(info, sy, sx, height, width);
2279 + dst = (u8 *)(info->screen_base + sy * info->fix.line_length + sx * 2);
2280 + bgx = ((u32 *)info->pseudo_palette)[bg_color];
2281 + splashset(dst, height, width, info->fix.line_length, bgx);
2284 +void splash_bmove(struct splash_data *sd, struct vc_data *vc, struct fb_info *info, int sy,
2285 + int sx, int dy, int dx, int height, int width)
2287 + struct fb_copyarea area;
2289 + area.sx = sx * vc->vc_font.width;
2290 + area.sy = sy * vc->vc_font.height;
2291 + area.dx = dx * vc->vc_font.width;
2292 + area.dy = dy * vc->vc_font.height;
2293 + area.sx += sd->splash_text_xo;
2294 + area.sy += sd->splash_text_yo;
2295 + area.dx += sd->splash_text_xo;
2296 + area.dy += sd->splash_text_yo;
2297 + area.height = height * vc->vc_font.height;
2298 + area.width = width * vc->vc_font.width;
2300 + info->fbops->fb_copyarea(info, &area);
2303 +void splash_clear_margins(struct splash_data *sd, struct vc_data *vc, struct fb_info *info,
2306 + unsigned int tw = vc->vc_cols*vc->vc_font.width;
2307 + unsigned int th = vc->vc_rows*vc->vc_font.height;
2309 + if (!bottom_only) {
2311 + splashfill(info, 0, 0, sd->splash_text_yo, info->var.xres);
2313 + splashfill(info, sd->splash_text_yo, 0, th, sd->splash_text_xo);
2314 + /* right margin */
2315 + splashfill(info, sd->splash_text_yo, sd->splash_text_xo + tw, th, info->var.xres - sd->splash_text_xo - tw);
2318 + splashfill(info, sd->splash_text_yo + th, 0, info->var.yres - sd->splash_text_yo - th, info->var.xres);
2321 +void splash_cursor(struct splash_data *sd, struct fb_info *info, struct fb_cursor *cursor)
2324 + unsigned int dsize, s_pitch;
2326 + if (cursor->set & FB_CUR_SETSIZE) {
2327 + info->cursor.image.height = cursor->image.height;
2328 + info->cursor.image.width = cursor->image.width;
2330 + if (cursor->set & FB_CUR_SETPOS) {
2331 + info->cursor.image.dx = cursor->image.dx;
2332 + info->cursor.image.dy = cursor->image.dy;
2334 + if (cursor->set & FB_CUR_SETHOT)
2335 + info->cursor.hot = cursor->hot;
2336 + if (cursor->set & FB_CUR_SETCMAP) {
2337 + if (cursor->image.depth == 1) {
2338 + info->cursor.image.bg_color = cursor->image.bg_color;
2339 + info->cursor.image.fg_color = cursor->image.fg_color;
2341 + if (cursor->image.cmap.len)
2342 + fb_copy_cmap(&cursor->image.cmap, &info->cursor.image.cmap, 0);
2344 + info->cursor.image.depth = cursor->image.depth;
2346 + s_pitch = (info->cursor.image.width + 7) >> 3;
2347 + dsize = s_pitch * info->cursor.image.height;
2348 + if (info->cursor.enable) {
2349 + switch (info->cursor.rop) {
2351 + for (i = 0; i < dsize; i++)
2352 + info->fb_cursordata[i] = cursor->image.data[i] ^ info->cursor.mask[i];
2356 + for (i = 0; i < dsize; i++)
2357 + info->fb_cursordata[i] = cursor->image.data[i] & info->cursor.mask[i];
2360 + } else if (info->fb_cursordata != cursor->image.data)
2361 + memcpy(info->fb_cursordata, cursor->image.data, dsize);
2362 + info->cursor.image.data = info->fb_cursordata;
2363 + splash_renderc(sd, info, info->cursor.image.fg_color, info->cursor.image.bg_color, (u8 *)info->fb_cursordata, info->cursor.image.dy + sd->splash_text_yo, info->cursor.image.dx + sd->splash_text_xo, info->cursor.image.height, info->cursor.image.width);
2366 +void splash_bmove_redraw(struct splash_data *sd, struct vc_data *vc, struct fb_info *info, int y, int sx, int dx, int width)
2368 + unsigned short *d = (unsigned short *) (vc->vc_origin + vc->vc_size_row * y + dx * 2);
2369 + unsigned short *s = d + (dx - sx);
2370 + unsigned short *start = d;
2371 + unsigned short *ls = d;
2372 + unsigned short *le = d + width;
2375 + unsigned short attr = 1;
2379 + if (attr != (c & 0xff00)) {
2380 + attr = c & 0xff00;
2382 + splash_putcs(sd, vc, info, start, d - start, y, x);
2387 + if (s >= ls && s < le && c == scr_readw(s)) {
2389 + splash_putcs(sd, vc, info, start, d - start, y, x);
2390 + x += d - start + 1;
2401 + splash_putcs(sd, vc, info, start, d - start, y, x);
2404 +void splash_blank(struct splash_data *sd, struct vc_data *vc, struct fb_info *info, int blank)
2407 + if (info->silent_screen_base)
2408 + splashset((u8 *)info->silent_screen_base, info->var.yres, info->var.xres, info->fix.line_length, 0);
2409 + splashset((u8 *)info->screen_base, info->var.yres, info->var.xres, info->fix.line_length, 0);
2411 + if (info->silent_screen_base)
2412 + splash_prepare(vc, info);
2413 + update_screen(vc->vc_num);
2414 + splash_clear_margins(vc->vc_splash_data, vc, info, 0);
2417 diff -urN linux-2.6.3.orig/drivers/video/console/fbcon.c linux-2.6.3/drivers/video/console/fbcon.c
2418 --- linux-2.6.3.orig/drivers/video/console/fbcon.c 2004-02-18 04:58:43.000000000 +0100
2419 +++ linux-2.6.3/drivers/video/console/fbcon.c 2004-02-19 14:19:14.085766573 +0100
2424 +#ifdef CONFIG_BOOTSPLASH
2425 +#include "../bootsplash/bootsplash.h"
2429 # define DPRINTK(fmt, args...) printk(KERN_DEBUG "%s: " fmt, __FUNCTION__ , ## args)
2430 @@ -198,8 +201,14 @@
2431 if (!info || info->state != FBINFO_STATE_RUNNING ||
2432 info->cursor.rop == ROP_COPY)
2434 - acquire_console_sem();
2435 info->cursor.enable ^= 1;
2436 +#ifdef CONFIG_BOOTSPLASH
2437 + if (info->splash_data) {
2438 + splash_cursor(info->splash_data, info, &info->cursor);
2442 + acquire_console_sem();
2443 info->fbops->fb_cursor(info, &info->cursor);
2444 release_console_sem();
2446 @@ -403,6 +412,14 @@
2448 struct fb_copyarea area;
2450 +#ifdef CONFIG_BOOTSPLASH
2451 + if (info->splash_data) {
2452 + splash_bmove(info->splash_data, vc, info,
2453 + sy, sx, dy, dx, height, width);
2458 area.sx = sx * vc->vc_font.width;
2459 area.sy = sy * vc->vc_font.height;
2460 area.dx = dx * vc->vc_font.width;
2461 @@ -419,6 +436,13 @@
2462 int bgshift = (vc->vc_hi_font_mask) ? 13 : 12;
2463 struct fb_fillrect region;
2465 +#ifdef CONFIG_BOOTSPLASH
2466 + if (info->splash_data) {
2467 + splash_clear(info->splash_data, vc, info,
2468 + sy, sx, height, width);
2472 region.color = attr_bgcol_ec(bgshift, vc);
2473 region.dx = sx * vc->vc_font.width;
2474 region.dy = sy * vc->vc_font.height;
2475 @@ -442,6 +466,12 @@
2476 struct fb_image image;
2479 +#ifdef CONFIG_BOOTSPLASH
2480 + if (info->splash_data) {
2481 + splash_putc(info->splash_data, vc, info, c, ypos, xpos);
2485 image.dx = xpos * vc->vc_font.width;
2486 image.dy = ypos * vc->vc_font.height;
2487 image.width = vc->vc_font.width;
2488 @@ -472,6 +502,13 @@
2489 struct fb_image image;
2490 u16 c = scr_readw(s);
2492 +#ifdef CONFIG_BOOTSPLASH
2493 + if (info->splash_data) {
2494 + splash_putcs(info->splash_data, vc, info, s, count, yy, xx);
2499 image.fg_color = attr_fgcol(fgshift, c);
2500 image.bg_color = attr_bgcol(bgshift, c);
2501 image.dx = xx * vc->vc_font.width;
2502 @@ -497,6 +534,13 @@
2503 unsigned int bs = info->var.yres - bh;
2504 struct fb_fillrect region;
2506 +#ifdef CONFIG_BOOTSPLASH
2507 + if (info->splash_data) {
2508 + splash_clear_margins(info->splash_data, vc, info, bottom_only);
2513 region.color = attr_bgcol_ec(bgshift, vc);
2514 region.rop = ROP_COPY;
2516 @@ -777,6 +821,14 @@
2517 nr_cols = info->var.xres / vc->vc_font.width;
2518 nr_rows = info->var.yres / vc->vc_font.height;
2520 +#ifdef CONFIG_BOOTSPLASH
2521 + if (vc->vc_splash_data && vc->vc_splash_data->splash_state) {
2522 + nr_cols = vc->vc_splash_data->splash_text_wi / vc->vc_font.width;
2523 + nr_rows = vc->vc_splash_data->splash_text_he / vc->vc_font.height;
2529 /* Need to make room for the logo */
2531 @@ -852,6 +904,12 @@
2532 vc->vc_complement_mask <<= 1;
2535 +#ifdef CONFIG_BOOTSPLASH
2536 + if(vc->vc_splash_data && vc->vc_splash_data->splash_state) {
2537 + con_remap_def_color(vc->vc_num, vc->vc_splash_data->splash_color << 4 | vc->vc_splash_data->splash_fg_color);
2542 if (vc->vc_cols != nr_cols || vc->vc_rows != nr_rows)
2543 vc_resize(vc->vc_num, nr_cols, nr_rows);
2544 @@ -1024,6 +1082,12 @@
2545 if (info->cursor.rop == ROP_XOR) {
2546 info->cursor.enable = 0;
2547 info->cursor.rop = ROP_COPY;
2548 +#ifdef CONFIG_BOOTSPLASH
2549 + if (info->splash_data) {
2550 + splash_cursor(info->splash_data, info, &cursor);
2554 info->fbops->fb_cursor(info, &cursor);
2557 @@ -1099,6 +1163,13 @@
2560 info->cursor.rop = ROP_XOR;
2561 +#ifdef CONFIG_BOOTSPLASH
2562 + if (info->splash_data) {
2563 + splash_cursor(info->splash_data, info, &cursor);
2564 + vbl_cursor_cnt = CURSOR_DRAW_DELAY;
2568 info->fbops->fb_cursor(info, &cursor);
2569 vbl_cursor_cnt = CURSOR_DRAW_DELAY;
2571 @@ -1402,6 +1473,10 @@
2572 fbcon_softback_note(vc, t, count);
2573 if (logo_shown >= 0)
2575 +#ifdef CONFIG_BOOTSPLASH
2576 + if (info->splash_data)
2579 switch (p->scrollmode & __SCROLL_YMASK) {
2580 case __SCROLL_YMOVE:
2581 accel_bmove(vc, info, t + count, 0, t, 0,
2582 @@ -1469,6 +1544,10 @@
2584 if (count > vc->vc_rows) /* Maximum realistic size */
2585 count = vc->vc_rows;
2586 +#ifdef CONFIG_BOOTSPLASH
2587 + if (info->splash_data)
2590 switch (p->scrollmode & __SCROLL_YMASK) {
2591 case __SCROLL_YMOVE:
2592 accel_bmove(vc, info, t, 0, t + count, 0,
2593 @@ -1594,6 +1673,13 @@
2597 +#ifdef CONFIG_BOOTSPLASH
2598 + if (info->splash_data && sy == dy && height == 1) {
2599 + /* must use slower redraw bmove to keep background pic intact */
2600 + splash_bmove_redraw(info->splash_data, vc, info, sy, sx, dx, width);
2604 accel_bmove(vc, info, real_y(p, sy), sx, real_y(p, dy), dx,
2607 @@ -1634,6 +1720,10 @@
2608 struct fb_info *info = registered_fb[(int) con2fb_map[vc->vc_num]];
2609 struct display *p = &fb_display[vc->vc_num];
2611 +#ifdef CONFIG_BOOTSPLASH
2612 + splash_prepare(vc, info);
2616 int l = fbcon_softback_size / vc->vc_size_row;
2618 @@ -1708,6 +1798,12 @@
2619 fbcon_cursor(vc, blank ? CM_ERASE : CM_DRAW);
2621 if (!info->fbops->fb_blank) {
2622 +#ifdef CONFIG_BOOTSPLASH
2623 + if (info->splash_data) {
2624 + splash_blank(info->splash_data, vc, info, blank);
2629 unsigned short oldc;
2631 @@ -1884,19 +1980,26 @@
2635 + u32 xres = info->var.xres, yres = info->var.yres;
2636 /* reset wrap/pan */
2637 info->var.xoffset = info->var.yoffset = p->yscroll = 0;
2638 p->vrows = info->var.yres_virtual / h;
2640 +#ifdef CONFIG_BOOTSPLASH
2641 + if (info->splash_data) {
2642 + xres = info->splash_data->splash_text_wi;
2643 + yres = info->splash_data->splash_text_he;
2646 #if 0 /* INCOMPLETE - let the console gurus handle this */
2647 - if(info->var.yres > (h * (vc->vc_rows + 1))
2648 - p->vrows -= (info->var.yres - (h * vc->vc_rows)) / h;
2649 + if(yres > (h * (vc->vc_rows + 1))
2650 + p->vrows -= (yres - (h * vc->vc_rows)) / h;
2652 - if ((info->var.yres % h)
2654 && (info->var.yres_virtual % h < info->var.yres % h))
2656 updatescrollmode(p, vc);
2657 - vc_resize(vc->vc_num, info->var.xres / w, info->var.yres / h);
2658 + vc_resize(vc->vc_num, xres / w, yres / h);
2659 if (CON_IS_VISIBLE(vc) && softback_buf) {
2660 int l = fbcon_softback_size / vc->vc_size_row;
2662 @@ -2335,6 +2438,9 @@
2664 if (!num_registered_fb)
2666 +#ifdef CONFIG_BOOTSPLASH
2669 take_over_console(&fb_con, first_fb_vc, last_fb_vc, fbcon_is_default);
2670 acquire_console_sem();
2671 if (!fbcon_event_notifier_registered) {
2672 diff -urN linux-2.6.3.orig/drivers/video/console/fbcon.h linux-2.6.3/drivers/video/console/fbcon.h
2673 --- linux-2.6.3.orig/drivers/video/console/fbcon.h 2004-02-18 04:58:48.000000000 +0100
2674 +++ linux-2.6.3/drivers/video/console/fbcon.h 2004-02-19 14:19:14.085766573 +0100
2676 * low-level frame buffer device
2679 +#ifdef CONFIG_BOOTSPLASH
2680 +struct splash_data {
2681 + int splash_state; /* show splash? */
2682 + int splash_color; /* transparent color */
2683 + int splash_fg_color; /* foreground color */
2684 + int splash_width; /* width of image */
2685 + int splash_height; /* height of image */
2686 + int splash_text_xo; /* text area origin */
2687 + int splash_text_yo;
2688 + int splash_text_wi; /* text area size */
2689 + int splash_text_he;
2690 + int splash_showtext; /* silent/verbose mode */
2691 + int splash_boxcount;
2692 + int splash_percent;
2693 + int splash_overpaintok; /* is it ok to overpaint boxes */
2694 + int splash_palcnt;
2695 + char *oldscreen_base; /* pointer to top of virtual screen */
2696 + unsigned char *splash_boxes;
2697 + unsigned char *splash_jpeg; /* jpeg */
2698 + unsigned char *splash_palette; /* palette for 8-bit */
2700 + int splash_dosilent; /* show silent jpeg */
2701 + unsigned char *splash_silentjpeg;
2702 + unsigned char *splash_sboxes;
2703 + int splash_sboxcount;
2708 /* Filled in by the frame buffer device */
2709 u_short inverse; /* != 0 text black on white as default */
2710 diff -urN linux-2.6.3.orig/drivers/video/Kconfig linux-2.6.3/drivers/video/Kconfig
2711 --- linux-2.6.3.orig/drivers/video/Kconfig 2004-02-18 04:57:12.000000000 +0100
2712 +++ linux-2.6.3/drivers/video/Kconfig 2004-02-19 14:19:14.086766418 +0100
2714 source "drivers/video/logo/Kconfig"
2718 + source "drivers/video/bootsplash/Kconfig"
2723 diff -urN linux-2.6.3.orig/drivers/video/Makefile linux-2.6.3/drivers/video/Makefile
2724 --- linux-2.6.3.orig/drivers/video/Makefile 2004-02-18 04:57:16.000000000 +0100
2725 +++ linux-2.6.3/drivers/video/Makefile 2004-02-19 14:19:14.086766418 +0100
2728 obj-$(CONFIG_VT) += console/
2729 obj-$(CONFIG_LOGO) += logo/
2730 +obj-$(CONFIG_BOOTSPLASH) += bootsplash/
2732 obj-$(CONFIG_FB) += fbmem.o fbmon.o fbcmap.o fbsysfs.o modedb.o softcursor.o
2733 # Only include macmodes.o if we have FB support and are PPC
2734 diff -urN linux-2.6.3.orig/drivers/video/vesafb.c linux-2.6.3/drivers/video/vesafb.c
2735 --- linux-2.6.3.orig/drivers/video/vesafb.c 2004-02-18 04:57:15.000000000 +0100
2736 +++ linux-2.6.3/drivers/video/vesafb.c 2004-02-19 14:19:14.086766418 +0100
2737 @@ -174,7 +174,10 @@
2741 -static struct fb_ops vesafb_ops = {
2742 +#ifndef CONFIG_BOOTSPLASH
2745 +struct fb_ops vesafb_ops = {
2746 .owner = THIS_MODULE,
2747 .fb_setcolreg = vesafb_setcolreg,
2748 .fb_pan_display = vesafb_pan_display,
2749 diff -urN linux-2.6.3.orig/include/linux/console_struct.h linux-2.6.3/include/linux/console_struct.h
2750 --- linux-2.6.3.orig/include/linux/console_struct.h 2004-02-18 04:57:12.000000000 +0100
2751 +++ linux-2.6.3/include/linux/console_struct.h 2004-02-19 14:19:14.087766262 +0100
2753 struct vc_data **vc_display_fg; /* [!] Ptr to var holding fg console for this display */
2754 unsigned long vc_uni_pagedir;
2755 unsigned long *vc_uni_pagedir_loc; /* [!] Location of uni_pagedir variable for this console */
2756 +#ifdef CONFIG_BOOTSPLASH
2757 + struct splash_data *vc_splash_data;
2759 /* additional information is in vt_kern.h */
2762 diff -urN linux-2.6.3.orig/include/linux/fb.h linux-2.6.3/include/linux/fb.h
2763 --- linux-2.6.3.orig/include/linux/fb.h 2004-02-19 13:17:26.996075000 +0100
2764 +++ linux-2.6.3/include/linux/fb.h 2004-02-19 14:19:14.088766107 +0100
2765 @@ -506,6 +506,15 @@
2766 u32 state; /* Hardware state i.e suspend */
2767 /* From here on everything is device dependent */
2769 +#ifdef CONFIG_BOOTSPLASH
2770 + struct splash_data *splash_data;
2771 + unsigned char *splash_pic;
2772 + int splash_pic_size;
2774 + char *silent_screen_base; /* real screen base */
2775 + char fb_cursordata[64];
2781 diff -urN linux-2.6.3.orig/kernel/panic.c linux-2.6.3/kernel/panic.c
2782 --- linux-2.6.3.orig/kernel/panic.c 2004-02-18 04:59:34.000000000 +0100
2783 +++ linux-2.6.3/kernel/panic.c 2004-02-19 14:19:14.089765952 +0100
2785 * We can't use the "normal" timers since we just panicked..
2787 printk(KERN_EMERG "Rebooting in %d seconds..",panic_timeout);
2788 +#ifdef CONFIG_BOOTSPLASH
2790 + extern int splash_verbose(void);
2791 + (void)splash_verbose();
2794 for (i = 0; i < panic_timeout; i++) {
2795 touch_nmi_watchdog();
2797 @@ -106,6 +112,12 @@
2798 disabled_wait(caller);
2801 +#ifdef CONFIG_BOOTSPLASH
2803 + extern int splash_verbose(void);
2804 + (void)splash_verbose();