1 diff -Nur --exclude '*.orig' linux-2.6.7-rc1.org/drivers/char/keyboard.c linux-2.6.7-rc1/drivers/char/keyboard.c
2 --- linux-2.6.7-rc1.org/drivers/char/keyboard.c 2004-05-23 07:55:03.000000000 +0200
3 +++ linux-2.6.7-rc1/drivers/char/keyboard.c 2004-05-25 11:51:08.000000000 +0200
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 -Nur --exclude '*.orig' linux-2.6.7-rc1.org/drivers/char/n_tty.c linux-2.6.7-rc1/drivers/char/n_tty.c
20 --- linux-2.6.7-rc1.org/drivers/char/n_tty.c 2004-05-23 07:53:30.000000000 +0200
21 +++ linux-2.6.7-rc1/drivers/char/n_tty.c 2004-05-25 11:51:08.000000000 +0200
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 -Nur --exclude '*.orig' linux-2.6.7-rc1.org/drivers/char/vt.c linux-2.6.7-rc1/drivers/char/vt.c
40 --- linux-2.6.7-rc1.org/drivers/char/vt.c 2004-05-23 07:54:43.000000000 +0200
41 +++ linux-2.6.7-rc1/drivers/char/vt.c 2004-05-25 11:51:08.000000000 +0200
42 @@ -3178,6 +3178,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 -Nur --exclude '*.orig' linux-2.6.7-rc1.org/drivers/video/Kconfig linux-2.6.7-rc1/drivers/video/Kconfig
75 --- linux-2.6.7-rc1.org/drivers/video/Kconfig 2004-05-23 07:53:30.000000000 +0200
76 +++ linux-2.6.7-rc1/drivers/video/Kconfig 2004-05-25 11:51:08.000000000 +0200
78 source "drivers/video/logo/Kconfig"
82 + source "drivers/video/bootsplash/Kconfig"
87 diff -Nur --exclude '*.orig' linux-2.6.7-rc1.org/drivers/video/Makefile linux-2.6.7-rc1/drivers/video/Makefile
88 --- linux-2.6.7-rc1.org/drivers/video/Makefile 2004-05-23 07:53:34.000000000 +0200
89 +++ linux-2.6.7-rc1/drivers/video/Makefile 2004-05-25 11:51:08.000000000 +0200
92 obj-$(CONFIG_VT) += console/
93 obj-$(CONFIG_LOGO) += logo/
94 +obj-$(CONFIG_BOOTSPLASH) += bootsplash/
96 obj-$(CONFIG_FB) += fbmem.o fbmon.o fbcmap.o fbsysfs.o modedb.o softcursor.o
97 # Only include macmodes.o if we have FB support and are PPC
98 diff -Nur --exclude '*.orig' linux-2.6.7-rc1.org/drivers/video/bootsplash/Kconfig linux-2.6.7-rc1/drivers/video/bootsplash/Kconfig
99 --- linux-2.6.7-rc1.org/drivers/video/bootsplash/Kconfig 1970-01-01 01:00:00.000000000 +0100
100 +++ linux-2.6.7-rc1/drivers/video/bootsplash/Kconfig 2004-05-25 11:51:08.000000000 +0200
103 +# Bootsplash configuration
106 +menu "Bootsplash configuration"
109 + bool "Bootup splash screen"
110 + depends on FRAMEBUFFER_CONSOLE && FB_VESA
113 + This option enables the Linux bootsplash screen. For more
114 + information on the bootsplash screen have a look at
115 + http://www.bootsplash.org/.
116 + If you are unsure, say N
119 diff -Nur --exclude '*.orig' linux-2.6.7-rc1.org/drivers/video/bootsplash/Makefile linux-2.6.7-rc1/drivers/video/bootsplash/Makefile
120 --- linux-2.6.7-rc1.org/drivers/video/bootsplash/Makefile 1970-01-01 01:00:00.000000000 +0100
121 +++ linux-2.6.7-rc1/drivers/video/bootsplash/Makefile 2004-05-25 11:51:08.000000000 +0200
123 +# Makefile for the Linux bootsplash
125 +obj-$(CONFIG_BOOTSPLASH) += bootsplash.o
126 +obj-$(CONFIG_BOOTSPLASH) += decode-jpg.o
127 +obj-$(CONFIG_BOOTSPLASH) += render.o
128 diff -Nur --exclude '*.orig' linux-2.6.7-rc1.org/drivers/video/bootsplash/bootsplash.c linux-2.6.7-rc1/drivers/video/bootsplash/bootsplash.c
129 --- linux-2.6.7-rc1.org/drivers/video/bootsplash/bootsplash.c 1970-01-01 01:00:00.000000000 +0100
130 +++ linux-2.6.7-rc1/drivers/video/bootsplash/bootsplash.c 2004-05-25 11:51:08.000000000 +0200
133 + * linux/drivers/video/bootsplash/bootsplash.c -
134 + * splash screen handling functions.
136 + * (w) 2001-2003 by Volker Poplawski, <volker@poplawski.de>,
137 + * Stefan Reinauer, <stepan@suse.de>,
138 + * Steffen Winterfeldt, <snwint@suse.de>,
139 + * Michael Schroeder <mls@suse.de>
141 + * Ideas & SuSE screen work by Ken Wimer, <wimer@suse.de>
143 + * For more information on this code check http://www.bootsplash.org/
146 +#include <linux/config.h>
147 +#include <linux/module.h>
148 +#include <linux/types.h>
149 +#include <linux/fb.h>
150 +#include <linux/vt_kern.h>
151 +#include <linux/vmalloc.h>
152 +#include <linux/unistd.h>
154 +#include <asm/irq.h>
155 +#include <asm/system.h>
157 +#include "../console/fbcon.h"
158 +#include "bootsplash.h"
159 +#include "decode-jpg.h"
161 +extern struct fb_ops vesafb_ops;
163 +#define SPLASH_VERSION "3.1.4-2004/02/19"
165 +/* These errors have to match fbcon-jpegdec.h */
166 +static unsigned char *jpg_errors[] = {
171 + "bad width or height",
174 + "quant table selector",
175 + "picture is not YCBCR 221111",
176 + "unknow CID in scan",
177 + "dct not sequential",
184 +static struct jpeg_decdata *decdata = 0; /* private decoder data */
186 +static int splash_registered = 0;
187 +static int splash_usesilent = 0; /* shall we display the silentjpeg? */
188 +int splash_default = 0xf01;
190 +static int splash_check_jpeg(unsigned char *jpeg, int width, int height, int depth);
192 +static int __init splash_setup(char *options)
194 + if(!strncmp("silent", options, 6)) {
195 + printk(KERN_INFO "bootsplash: silent mode.\n");
196 + splash_usesilent = 1;
197 + /* skip "silent," */
198 + if (strlen(options) == 6)
202 + if(!strncmp("verbose", options, 7)) {
203 + printk(KERN_INFO "bootsplash: verbose mode.\n");
204 + splash_usesilent = 0;
207 + splash_default = simple_strtoul(options, NULL, 0);
211 +__setup("splash=", splash_setup);
214 +static int splash_hasinter(unsigned char *buf, int num)
216 + unsigned char *bufend = buf + num * 12;
217 + while(buf < bufend) {
218 + if (buf[1] > 127) /* inter? */
220 + buf += buf[3] > 127 ? 24 : 12; /* blend? */
225 +static int boxextract(unsigned char *buf, unsigned short *dp, unsigned char *cols, int *blendp)
227 + dp[0] = buf[0] | buf[1] << 8;
228 + dp[1] = buf[2] | buf[3] << 8;
229 + dp[2] = buf[4] | buf[5] << 8;
230 + dp[3] = buf[6] | buf[7] << 8;
231 + *(unsigned int *)(cols + 0) =
232 + *(unsigned int *)(cols + 4) =
233 + *(unsigned int *)(cols + 8) =
234 + *(unsigned int *)(cols + 12) = *(unsigned int *)(buf + 8);
235 + if (dp[1] > 32767) {
237 + *(unsigned int *)(cols + 4) = *(unsigned int *)(buf + 12);
238 + *(unsigned int *)(cols + 8) = *(unsigned int *)(buf + 16);
239 + *(unsigned int *)(cols + 12) = *(unsigned int *)(buf + 20);
246 +static void boxit(unsigned char *pic, int bytes, unsigned char *buf, int num, int percent, int overpaint)
248 + int x, y, i, p, doblend, r, g, b, a, add;
249 + unsigned short data1[4];
250 + unsigned char cols1[16];
251 + unsigned short data2[4];
252 + unsigned char cols2[16];
253 + unsigned char *bufend;
254 + unsigned short *picp;
255 + unsigned int stipple[32], sti, stin, stinn, stixs, stixe, stiys, stiye;
256 + int xs, xe, ys, ye, xo, yo;
260 + bufend = buf + num * 12;
261 + stipple[0] = 0xffffffff;
266 + while(buf < bufend) {
268 + buf += boxextract(buf, data1, cols1, &doblend);
269 + if (data1[0] == 32767 && data1[1] == 32767) {
277 + } else if (stinn == 4) {
281 + stipple[stinn++] = (cols1[ 0] << 24) | (cols1[ 1] << 16) | (cols1[ 2] << 8) | cols1[ 3] ;
282 + stipple[stinn++] = (cols1[ 4] << 24) | (cols1[ 5] << 16) | (cols1[ 6] << 8) | cols1[ 7] ;
283 + stipple[stinn++] = (cols1[ 8] << 24) | (cols1[ 9] << 16) | (cols1[10] << 8) | cols1[11] ;
284 + stipple[stinn++] = (cols1[12] << 24) | (cols1[13] << 16) | (cols1[14] << 8) | cols1[15] ;
289 + if (data1[0] > 32767)
290 + buf += boxextract(buf, data2, cols2, &doblend);
291 + if (data1[0] == 32767 && data1[1] == 32766) {
293 + i = 12 * (short)data1[3];
295 + i += boxextract(buf + i, data1, cols1, &doblend);
296 + if (data1[0] > 32767)
297 + boxextract(buf + i, data2, cols2, &doblend);
299 + if (data1[0] == 32767)
301 + if (data1[2] > 32767) {
304 + data1[2] = ~data1[2];
306 + if (data1[3] > 32767) {
307 + if (percent == 65536)
309 + data1[3] = ~data1[3];
311 + if (data1[0] > 32767) {
312 + data1[0] = ~data1[0];
313 + for (i = 0; i < 4; i++)
314 + data1[i] = (data1[i] * (65536 - percent) + data2[i] * percent) >> 16;
315 + for (i = 0; i < 16; i++)
316 + cols1[i] = (cols1[i] * (65536 - percent) + cols2[i] * percent) >> 16;
318 + *(unsigned int *)cols2 = *(unsigned int *)cols1;
320 + if (a == 0 && !doblend)
323 + if (stixs >= 32768) {
324 + xo = xs = (stixs ^ 65535) + data1[0];
325 + xe = stixe ? stixe + data1[0] : data1[2];
326 + } else if (stixe >= 32768) {
327 + xs = stixs ? data1[2] - stixs : data1[0];
328 + xe = data1[2] - (stixe ^ 65535);
332 + xe = stixe ? stixe : data1[2];
334 + if (stiys >= 32768) {
335 + yo = ys = (stiys ^ 65535) + data1[1];
336 + ye = stiye ? stiye + data1[1] : data1[3];
337 + } else if (stiye >= 32768) {
338 + ys = stiys ? data1[3] - stiys : data1[1];
339 + ye = data1[3] - (stiye ^ 65535);
343 + ye = stiye ? stiye : data1[3];
345 + xo = 32 - (xo & 31);
346 + yo = stin - (yo % stin);
356 + for (y = ys; y <= ye; y++) {
357 + sti = stipple[(y + yo) % stin];
358 + x = (xs + xo) & 31;
360 + sti = (sti << x) | (sti >> (32 - x));
362 + if ((p = data1[3] - data1[1]) != 0)
363 + p = ((y - data1[1]) << 16) / p;
364 + for (i = 0; i < 8; i++)
365 + cols2[i + 8] = (cols1[i] * (65536 - p) + cols1[i + 8] * p) >> 16;
368 + add ^= (add ^ y) & 1 ? 1 : 3; /* 2x2 ordered dithering */
369 + picp = (unsigned short *)(pic + xs * 2 + y * bytes);
370 + for (x = xs; x <= xe; x++) {
371 + if (!(sti & 0x80000000)) {
377 + sti = (sti << 1) | 1;
379 + if ((p = data1[2] - data1[0]) != 0)
380 + p = ((x - data1[0]) << 16) / p;
381 + for (i = 0; i < 4; i++)
382 + cols2[i] = (cols2[i + 8] * (65536 - p) + cols2[i + 12] * p) >> 16;
390 + r = ((i >> 8 & 0xf8) * (255 - a) + r * a) / 255;
391 + g = ((i >> 3 & 0xfc) * (255 - a) + g * a) / 255;
392 + b = ((i << 3 & 0xf8) * (255 - a) + b * a) / 255;
394 + #define CLAMP(x) ((x) >= 256 ? 255 : (x))
395 + i = ((CLAMP(r + add*2+1) & 0xf8) << 8) |
396 + ((CLAMP(g + add ) & 0xfc) << 3) |
397 + ((CLAMP(b + add*2+1) ) >> 3);
405 +static int splash_check_jpeg(unsigned char *jpeg, int width, int height, int depth)
408 + unsigned char *mem;
410 + size = ((width + 15) & ~15) * ((height + 15) & ~15) * (depth >> 3);
411 + mem = vmalloc(size);
413 + printk(KERN_INFO "bootsplash: no memory for decoded picture.\n");
417 + decdata = vmalloc(sizeof(*decdata));
418 + if ((err = jpeg_decode(jpeg, mem, ((width + 15) & ~15), ((height + 15) & ~15), depth, decdata)))
419 + printk(KERN_INFO "bootsplash: error while decompressing picture: %s (%d)\n",jpg_errors[err - 1], err);
421 + return err ? -1 : 0;
424 +static void splash_free(struct vc_data *vc, struct fb_info *info)
426 + if (!vc->vc_splash_data)
428 + if (info->silent_screen_base)
429 + info->screen_base = info->silent_screen_base;
430 + info->silent_screen_base = 0;
431 + if (vc->vc_splash_data->splash_silentjpeg)
432 + vfree(vc->vc_splash_data->splash_sboxes);
433 + vfree(vc->vc_splash_data);
434 + vc->vc_splash_data = 0;
435 + info->splash_data = 0;
438 +static int splash_mkpenguin(struct splash_data *data, int pxo, int pyo, int pwi, int phe, int pr, int pg, int pb)
440 + unsigned char *buf;
443 + if (pwi ==0 || phe == 0)
445 + buf = (unsigned char *)data + sizeof(*data);
460 + for (i = 0; i < 12; i++, buf++)
468 +static const int splash_offsets[3][16] = {
469 + /* len, unit, size, state, fgcol, col, xo, yo, wi, he
470 + boxcnt, ssize, sboxcnt, percent, overok, palcnt */
472 + { 20, -1, 16, -1, -1, -1, 8, 10, 12, 14,
473 + -1, -1, -1, -1, -1, -1 },
475 + { 35, 8, 12, 9, 10, 11, 16, 18, 20, 22,
476 + -1, -1, -1, -1, -1, -1 },
478 + { 38, 8, 12, 9, 10, 11, 16, 18, 20, 22,
479 + 24, 28, 32, 34, 36, 37 },
482 +#define SPLASH_OFF_LEN offsets[0]
483 +#define SPLASH_OFF_UNIT offsets[1]
484 +#define SPLASH_OFF_SIZE offsets[2]
485 +#define SPLASH_OFF_STATE offsets[3]
486 +#define SPLASH_OFF_FGCOL offsets[4]
487 +#define SPLASH_OFF_COL offsets[5]
488 +#define SPLASH_OFF_XO offsets[6]
489 +#define SPLASH_OFF_YO offsets[7]
490 +#define SPLASH_OFF_WI offsets[8]
491 +#define SPLASH_OFF_HE offsets[9]
492 +#define SPLASH_OFF_BOXCNT offsets[10]
493 +#define SPLASH_OFF_SSIZE offsets[11]
494 +#define SPLASH_OFF_SBOXCNT offsets[12]
495 +#define SPLASH_OFF_PERCENT offsets[13]
496 +#define SPLASH_OFF_OVEROK offsets[14]
497 +#define SPLASH_OFF_PALCNT offsets[15]
499 +static inline int splash_getb(unsigned char *pos, int off)
501 + return off == -1 ? 0 : pos[off];
504 +static inline int splash_gets(unsigned char *pos, int off)
506 + return off == -1 ? 0 : pos[off] | pos[off + 1] << 8;
509 +static inline int splash_geti(unsigned char *pos, int off)
511 + return off == -1 ? 0 :
512 + pos[off] | pos[off + 1] << 8 | pos[off + 2] << 16 | pos[off + 3] << 24;
515 +static int splash_getraw(unsigned char *start, unsigned char *end)
517 + unsigned char *ndata;
527 + const int *offsets;
528 + struct vc_data *vc;
529 + struct fb_info *info;
530 + struct splash_data *sd;
532 + printk(KERN_INFO "bootsplash %s: looking for picture...", SPLASH_VERSION);
534 + for (ndata = start; ndata < end; ndata++) {
535 + if (ndata[0] != 'B' || ndata[1] != 'O' || ndata[2] != 'O' || ndata[3] != 'T')
537 + if (ndata[4] != 'S' || ndata[5] != 'P' || ndata[6] != 'L' || ndata[7] < '1' || ndata[7] > '3')
540 + version = ndata[7] - '0';
541 + offsets = splash_offsets[version - 1];
542 + len = SPLASH_OFF_LEN;
543 + unit = splash_getb(ndata, SPLASH_OFF_UNIT);
544 + if (unit >= MAX_NR_CONSOLES)
547 + acquire_console_sem();
549 + release_console_sem();
551 + vc = vc_cons[unit].d;
552 + info = registered_fb[(int)con2fb_map[unit]];
553 + width = info->var.xres;
554 + height = info->var.yres;
555 + splash_size = splash_geti(ndata, SPLASH_OFF_SIZE);
556 + if (splash_size == (int)0xffffffff && version > 1) {
557 + printk(" found, updating values.\n");
558 + if ((sd = vc->vc_splash_data) != 0) {
559 + i = splash_getb(ndata, SPLASH_OFF_STATE);
561 + sd->splash_state = i;
562 + i = splash_getb(ndata, SPLASH_OFF_FGCOL);
564 + sd->splash_fg_color = i;
565 + i = splash_getb(ndata, SPLASH_OFF_COL);
567 + sd->splash_color = i;
571 + if (splash_size == 0) {
572 + printk(" found, freeing memory.\n");
573 + if (vc->vc_splash_data)
574 + splash_free(vc, info);
577 + boxcnt = splash_gets(ndata, SPLASH_OFF_BOXCNT);
578 + palcnt = 3 * splash_getb(ndata, SPLASH_OFF_PALCNT);
579 + if (ndata + len + splash_size > end) {
580 + printk(" found, but truncated!\n");
583 + if (!jpeg_check_size(ndata + len + boxcnt * 12 + palcnt, width, height)) {
584 + ndata += len + splash_size - 1;
587 + if (splash_check_jpeg(ndata + len + boxcnt * 12 + palcnt, width, height, info->var.bits_per_pixel))
589 + silentsize = splash_geti(ndata, SPLASH_OFF_SSIZE);
591 + printk(" silentjpeg size %d bytes,", silentsize);
592 + if (silentsize >= splash_size) {
593 + printk(" bigger than splashsize!\n");
596 + splash_size -= silentsize;
597 + if (!splash_usesilent)
599 + else if (height * 2 * info->fix.line_length > info->fix.smem_len) {
600 + printk(" does not fit into framebuffer.\n");
603 + sboxcnt = splash_gets(ndata, SPLASH_OFF_SBOXCNT);
605 + unsigned char *simage = ndata + len + splash_size + 12 * sboxcnt;
606 + if (!jpeg_check_size(simage, width, height) ||
607 + splash_check_jpeg(simage, width, height, info->var.bits_per_pixel)) {
608 + printk(" error in silent jpeg.\n");
612 + if (vc->vc_splash_data)
613 + splash_free(vc, info);
614 + vc->vc_splash_data = sd = vmalloc(sizeof(*sd) + splash_size + (version < 3 ? 2 * 12 : 0));
617 + sd->splash_silentjpeg = 0;
618 + sd->splash_sboxes = 0;
619 + sd->splash_sboxcount = 0;
621 + sd->splash_silentjpeg = vmalloc(silentsize);
622 + if (sd->splash_silentjpeg) {
623 + memcpy(sd->splash_silentjpeg, ndata + len + splash_size, silentsize);
624 + sd->splash_sboxes = vc->vc_splash_data->splash_silentjpeg;
625 + sd->splash_silentjpeg += 12 * sboxcnt;
626 + sd->splash_sboxcount = sboxcnt;
629 + sd->splash_state = splash_getb(ndata, SPLASH_OFF_STATE);
630 + sd->splash_fg_color = splash_getb(ndata, SPLASH_OFF_FGCOL);
631 + sd->splash_color = splash_getb(ndata, SPLASH_OFF_COL);
632 + sd->splash_overpaintok = splash_getb(ndata, SPLASH_OFF_OVEROK);
633 + sd->splash_text_xo = splash_gets(ndata, SPLASH_OFF_XO);
634 + sd->splash_text_yo = splash_gets(ndata, SPLASH_OFF_YO);
635 + sd->splash_text_wi = splash_gets(ndata, SPLASH_OFF_WI);
636 + sd->splash_text_he = splash_gets(ndata, SPLASH_OFF_HE);
637 + sd->splash_percent = splash_gets(ndata, SPLASH_OFF_PERCENT);
638 + if (version == 1) {
639 + sd->splash_text_xo *= 8;
640 + sd->splash_text_wi *= 8;
641 + sd->splash_text_yo *= 16;
642 + sd->splash_text_he *= 16;
643 + sd->splash_color = (splash_default >> 8) & 0x0f;
644 + sd->splash_fg_color = (splash_default >> 4) & 0x0f;
645 + sd->splash_state = splash_default & 1;
647 + if (sd->splash_text_xo + sd->splash_text_wi > width || sd->splash_text_yo + sd->splash_text_he > height) {
648 + splash_free(vc, info);
649 + printk(" found, but has oversized text area!\n");
652 + if (!vc_cons[unit].d || info->fbops != &vesafb_ops) {
653 + splash_free(vc, info);
654 + printk(" found, but framebuffer can't handle it!\n");
657 + printk(" found (%dx%d, %d bytes, v%d).\n", width, height, splash_size, version);
658 + if (version == 1) {
659 + printk(KERN_WARNING "bootsplash: Using deprecated v1 header. Updating your splash utility recommended.\n");
660 + printk(KERN_INFO "bootsplash: Find the latest version at http://www.bootsplash.org/\n");
663 + /* fake penguin box for older formats */
665 + 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);
666 + else if (version == 2)
667 + 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));
669 + memcpy((char *)sd + sizeof(*sd) + (version < 3 ? boxcnt * 12 : 0), ndata + len, splash_size);
670 + sd->splash_boxcount = boxcnt;
671 + sd->splash_boxes = (unsigned char *)sd + sizeof(*sd);
672 + sd->splash_palette = sd->splash_boxes + boxcnt * 12;
673 + sd->splash_jpeg = sd->splash_palette + palcnt;
674 + sd->splash_palcnt = palcnt / 3;
675 + sd->splash_dosilent = sd->splash_silentjpeg != 0;
678 + printk(" no good signature found.\n");
682 +int splash_verbose(void)
684 + struct vc_data *vc;
685 + struct fb_info *info;
687 + if (!splash_usesilent)
692 + if (!vc || !vc->vc_splash_data || !vc->vc_splash_data->splash_state)
694 + if (fg_console != vc->vc_num)
696 + if (!vc->vc_splash_data->splash_silentjpeg || !vc->vc_splash_data->splash_dosilent)
698 + vc->vc_splash_data->splash_dosilent = 0;
699 + info = registered_fb[(int)con2fb_map[0]];
700 + if (!info->silent_screen_base)
702 + splashcopy(info->silent_screen_base, info->screen_base, info->var.yres, info->var.xres, info->fix.line_length, info->fix.line_length);
703 + info->screen_base = info->silent_screen_base;
704 + info->silent_screen_base = 0;
708 +static void splash_off(struct fb_info *info)
710 + if (info->silent_screen_base)
711 + info->screen_base = info->silent_screen_base;
712 + info->silent_screen_base = 0;
713 + info->splash_data = 0;
714 + if (info->splash_pic)
715 + vfree(info->splash_pic);
716 + info->splash_pic = 0;
717 + info->splash_pic_size = 0;
720 +int splash_prepare(struct vc_data *vc, struct fb_info *info)
723 + int width, height, depth, size, sbytes;
725 + if (!vc->vc_splash_data || !vc->vc_splash_data->splash_state) {
733 + width = info->var.xres;
734 + height = info->var.yres;
735 + depth = info->var.bits_per_pixel;
736 + if (depth != 16) { /* Other targets might need fixing */
741 + sbytes = ((width + 15) & ~15) * (depth >> 3);
742 + size = sbytes * ((height + 15) & ~15);
743 + if (size != info->splash_pic_size)
745 + if (!info->splash_pic)
746 + info->splash_pic = vmalloc(size);
748 + if (!info->splash_pic) {
749 + printk(KERN_INFO "bootsplash: not enough memory.\n");
755 + decdata = vmalloc(sizeof(*decdata));
757 + if (vc->vc_splash_data->splash_silentjpeg && vc->vc_splash_data->splash_dosilent) {
758 + /* fill area after framebuffer with other jpeg */
759 + if ((err = jpeg_decode(vc->vc_splash_data->splash_silentjpeg, info->splash_pic,
760 + ((width + 15) & ~15), ((height + 15) & ~15), depth, decdata))) {
761 + printk(KERN_INFO "bootsplash: error while decompressing silent picture: %s (%d)\n", jpg_errors[err - 1], err);
762 + if (info->silent_screen_base)
763 + info->screen_base = info->silent_screen_base;
764 + vc->vc_splash_data->splash_dosilent = 0;
766 + if (vc->vc_splash_data->splash_sboxcount)
767 + boxit(info->splash_pic, sbytes, vc->vc_splash_data->splash_sboxes,
768 + vc->vc_splash_data->splash_sboxcount, vc->vc_splash_data->splash_percent, 0);
770 + if (!info->silent_screen_base)
771 + info->silent_screen_base = info->screen_base;
772 + splashcopy(info->silent_screen_base, info->splash_pic, info->var.yres, info->var.xres, info->fix.line_length, sbytes);
773 + info->screen_base = info->silent_screen_base + info->fix.line_length * info->var.yres;
775 + } else if (info->silent_screen_base)
776 + info->screen_base = info->silent_screen_base;
778 + if ((err = jpeg_decode(vc->vc_splash_data->splash_jpeg, info->splash_pic,
779 + ((width + 15) & ~15), ((height + 15) & ~15), depth, decdata))) {
780 + printk(KERN_INFO "bootsplash: error while decompressing picture: %s (%d) .\n", jpg_errors[err - 1], err);
784 + info->splash_pic_size = size;
785 + info->splash_bytes = sbytes;
786 + if (vc->vc_splash_data->splash_boxcount)
787 + boxit(info->splash_pic, sbytes, vc->vc_splash_data->splash_boxes, vc->vc_splash_data->splash_boxcount, vc->vc_splash_data->splash_percent, 0);
788 + if (vc->vc_splash_data->splash_state)
789 + info->splash_data = vc->vc_splash_data;
796 +#ifdef CONFIG_PROC_FS
798 +#include <linux/proc_fs.h>
800 +static int splash_read_proc(char *buffer, char **start, off_t offset, int size,
801 + int *eof, void *data);
802 +static int splash_write_proc(struct file *file, const char *buffer,
803 + unsigned long count, void *data);
804 +static int splash_status(struct vc_data *vc);
805 +static int splash_recolor(struct vc_data *vc);
806 +static int splash_proc_register(void);
808 +static struct proc_dir_entry *proc_splash;
810 +static int splash_recolor(struct vc_data *vc)
812 + if (!vc->vc_splash_data)
814 + if (!vc->vc_splash_data->splash_state)
816 + con_remap_def_color(vc->vc_num, vc->vc_splash_data->splash_color << 4 | vc->vc_splash_data->splash_fg_color);
817 + if (fg_console == vc->vc_num) {
818 + update_region(fg_console,
819 + vc->vc_origin + vc->vc_size_row * vc->vc_top,
820 + vc->vc_size_row * (vc->vc_bottom - vc->vc_top) / 2);
825 +static int splash_status(struct vc_data *vc)
827 + struct fb_info *info;
828 + 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");
830 + info = registered_fb[(int) con2fb_map[vc->vc_num]];
831 + if (fg_console == vc->vc_num)
832 + splash_prepare(vc, info);
833 + if (vc->vc_splash_data && vc->vc_splash_data->splash_state) {
834 + con_remap_def_color(vc->vc_num, vc->vc_splash_data->splash_color << 4 | vc->vc_splash_data->splash_fg_color);
835 + acquire_console_sem();
836 + /* vc_resize also calls con_switch which resets yscroll */
837 + 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);
838 + if (fg_console == vc->vc_num) {
839 + update_region(fg_console,
840 + vc->vc_origin + vc->vc_size_row * vc->vc_top,
841 + vc->vc_size_row * (vc->vc_bottom - vc->vc_top) / 2);
842 + splash_clear_margins(vc->vc_splash_data, vc, info, 0);
844 + release_console_sem();
846 + /* Switch bootsplash off */
847 + con_remap_def_color(vc->vc_num, 0x07);
848 + acquire_console_sem();
849 + vc_resize(vc->vc_num, info->var.xres / vc->vc_font.width, info->var.yres / vc->vc_font.height);
850 + release_console_sem();
855 +static int splash_read_proc(char *buffer, char **start, off_t offset, int size,
856 + int *eof, void *data)
860 + struct vc_data *vc = vc_cons[0].d;
861 + struct fb_info *info = registered_fb[(int)con2fb_map[0]];
862 + int color = vc->vc_splash_data ? vc->vc_splash_data->splash_color << 4 |
863 + vc->vc_splash_data->splash_fg_color : splash_default >> 4;
864 + int status = vc->vc_splash_data ? vc->vc_splash_data->splash_state & 1 : 0;
865 + len += sprintf(buffer + len, "Splash screen v%s (0x%02x, %dx%d%s): %s\n",
866 + SPLASH_VERSION, color, info->var.xres, info->var.yres,
867 + (vc->vc_splash_data ? vc->vc_splash_data->splash_dosilent : 0)? ", silent" : "",
868 + status ? "on" : "off");
869 + if (offset >= begin + len)
872 + *start = buffer + (begin - offset);
874 + return (size < begin + len - offset ? size : begin + len - offset);
877 +static int splash_write_proc(struct file *file, const char *buffer,
878 + unsigned long count, void *data)
881 + struct vc_data *vc;
883 + if (!buffer || !splash_default)
886 + if (!strncmp(buffer, "show", 4) || !strncmp(buffer, "hide", 4)) {
890 + if (buffer[4] == ' ' && buffer[5] == 'p')
892 + else if (buffer[4] == '\n')
895 + pe = simple_strtoul(buffer + 5, NULL, 0);
900 + if (*buffer == 'h')
903 + if (vc->vc_splash_data && vc->vc_splash_data->splash_percent != pe) {
904 + struct fb_info *info;
906 + oldpe = vc->vc_splash_data->splash_percent;
907 + vc->vc_splash_data->splash_percent = pe;
908 + if (fg_console != 0 || !vc->vc_splash_data->splash_state)
910 + info = registered_fb[(int) con2fb_map[vc->vc_num]];
911 + if (!vc->vc_splash_data->splash_overpaintok || pe == 65536 || pe < oldpe) {
912 + if (splash_hasinter(vc->vc_splash_data->splash_boxes, vc->vc_splash_data->splash_boxcount))
915 + splash_prepare(vc, info);
917 + if (vc->vc_splash_data->splash_silentjpeg && vc->vc_splash_data->splash_dosilent && info->silent_screen_base)
918 + 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);
919 + 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);
924 + if (!strncmp(buffer,"silent\n",7) || !strncmp(buffer,"verbose\n",8)) {
926 + if (vc->vc_splash_data && vc->vc_splash_data->splash_silentjpeg) {
927 + if (vc->vc_splash_data->splash_dosilent != (buffer[0] == 's')) {
928 + vc->vc_splash_data->splash_dosilent = buffer[0] == 's';
934 + if (!strncmp(buffer,"freesilent\n",11)) {
936 + if (vc->vc_splash_data && vc->vc_splash_data->splash_silentjpeg) {
937 + printk(KERN_INFO "bootsplash: freeing silent jpeg\n");
938 + vc->vc_splash_data->splash_silentjpeg = 0;
939 + vfree(vc->vc_splash_data->splash_sboxes);
940 + vc->vc_splash_data->splash_sboxes = 0;
941 + vc->vc_splash_data->splash_sboxcount = 0;
942 + if (vc->vc_splash_data->splash_dosilent)
944 + vc->vc_splash_data->splash_dosilent = 0;
949 + if (!strncmp(buffer, "BOOTSPL", 7)) {
950 + unit = splash_getraw((unsigned char *)buffer, (unsigned char *)buffer + count);
952 + vc = vc_cons[unit].d;
958 + if (!vc->vc_splash_data)
960 + if (buffer[0] == 't') {
961 + vc->vc_splash_data->splash_state ^= 1;
965 + new = simple_strtoul(buffer, NULL, 0);
968 + vc->vc_splash_data->splash_color = new >> 8 & 0xff;
969 + vc->vc_splash_data->splash_fg_color = new >> 4 & 0x0f;
971 + if ((new & 1) == vc->vc_splash_data->splash_state)
972 + splash_recolor(vc);
974 + vc->vc_splash_data->splash_state = new & 1;
980 +static int splash_proc_register(void)
982 + if ((proc_splash = create_proc_entry("splash", 0, 0))) {
983 + proc_splash->read_proc = splash_read_proc;
984 + proc_splash->write_proc = splash_write_proc;
991 +static int splash_proc_unregister(void)
994 + remove_proc_entry("splash", 0);
998 +#endif /* CONFIG_PROC_FS */
1000 +asmlinkage long sys_lseek(int fd, off_t offset, unsigned int origin);
1001 +asmlinkage long sys_read(int fd, char *buf, size_t count);
1002 +asmlinkage long sys_unlink(const char *name);
1004 +void splash_init(void)
1006 + struct fb_info *info;
1007 + struct vc_data *vc;
1011 + int max_len = 1024*1024*2;
1014 + if (splash_registered)
1016 + vc = vc_cons[0].d;
1017 + info = registered_fb[0];
1018 + if (!vc || !info || info->var.bits_per_pixel != 16)
1020 +#ifdef CONFIG_PROC_FS
1021 + splash_proc_register();
1023 + splash_registered = 1;
1024 + if (vc->vc_splash_data)
1026 + if ((fd = sys_open("/bootsplash", O_RDONLY, 0)) < 0) {
1028 + fd = sys_open("/initrd.image", O_RDONLY, 0);
1032 + if ((len = (int)sys_lseek(fd, (off_t)0, 2)) <= 0) {
1036 + /* Don't look for more than the last 2MB */
1037 + if (len > max_len) {
1038 + printk( KERN_INFO "bootsplash: scanning last %dMB of initrd for signature\n",
1040 + sys_lseek(fd, (off_t)(len - max_len), 0);
1043 + sys_lseek(fd, (off_t)0, 0);
1046 + mem = vmalloc(len);
1048 + if ((int)sys_read(fd, mem, len) == len && splash_getraw((unsigned char *)mem, (unsigned char *)mem + len) == 0 && vc->vc_splash_data)
1049 + vc->vc_splash_data->splash_state = splash_default & 1;
1054 + sys_unlink("/bootsplash");
1058 diff -Nur --exclude '*.orig' linux-2.6.7-rc1.org/drivers/video/bootsplash/bootsplash.h linux-2.6.7-rc1/drivers/video/bootsplash/bootsplash.h
1059 --- linux-2.6.7-rc1.org/drivers/video/bootsplash/bootsplash.h 1970-01-01 01:00:00.000000000 +0100
1060 +++ linux-2.6.7-rc1/drivers/video/bootsplash/bootsplash.h 2004-05-25 11:51:08.000000000 +0200
1063 + * linux/drivers/video/bootsplash/bootsplash.h - splash screen definition.
1065 + * (w) 2001-2003 by Volker Poplawski, <volker@poplawski.de>
1066 + * Stefan Reinauer, <stepan@suse.de>
1069 + * idea and SuSE screen work by Ken Wimer, <wimer@suse.de>
1072 +#ifndef __BOOTSPLASH_H
1073 +#define __BOOTSPLASH_H
1078 +extern int splash_prepare(struct vc_data *, struct fb_info *);
1079 +extern void splash_init(void);
1081 +/* splash_render.c */
1082 +extern void splash_putcs(struct splash_data *sd, struct vc_data *vc, struct fb_info *info,
1083 + const unsigned short *s, int count, int ypos, int xpos);
1084 +extern void splash_putc(struct splash_data *sd, struct vc_data *vc, struct fb_info *info,
1085 + int c, int ypos, int xpos);
1086 +extern void splashcopy(u8 *dst, u8 *src, int height, int width, int dstbytes, int srcbytes);
1087 +extern void splash_clear(struct splash_data *sd, struct vc_data *vc, struct fb_info *info, int sy,
1088 + int sx, int height, int width);
1089 +extern void splash_bmove(struct splash_data *sd, struct vc_data *vc, struct fb_info *info, int sy,
1090 + int sx, int dy, int dx, int height, int width);
1091 +extern void splash_clear_margins(struct splash_data *sd, struct vc_data *vc, struct fb_info *info,
1093 +extern void splash_cursor(struct splash_data *sd, struct fb_info *info, struct fb_cursor *cursor);
1094 +extern void splash_bmove_redraw(struct splash_data *sd, struct vc_data *vc, struct fb_info *info,
1095 + int y, int sx, int dx, int width);
1096 +extern void splash_blank(struct splash_data *sd, struct vc_data *vc, struct fb_info *info,
1100 +extern void con_remap_def_color(int currcons, int new_color);
1102 +extern void acquire_console_sem(void);
1103 +extern void release_console_sem(void);
1106 diff -Nur --exclude '*.orig' linux-2.6.7-rc1.org/drivers/video/bootsplash/decode-jpg.c linux-2.6.7-rc1/drivers/video/bootsplash/decode-jpg.c
1107 --- linux-2.6.7-rc1.org/drivers/video/bootsplash/decode-jpg.c 1970-01-01 01:00:00.000000000 +0100
1108 +++ linux-2.6.7-rc1/drivers/video/bootsplash/decode-jpg.c 2004-05-25 11:51:08.000000000 +0200
1111 + * linux/drivers/video/bootsplash/decode-jpg.c - a tiny jpeg decoder.
1113 + * (w) August 2001 by Michael Schroeder, <mls@suse.de>
1117 +#include <linux/config.h>
1118 +#include <linux/string.h>
1119 +#include <asm/byteorder.h>
1121 +#include "decode-jpg.h"
1125 +#define IFIX(a) ((int)((a) * (1 << ISHIFT) + .5))
1126 +#define IMULT(a, b) (((a) * (b)) >> ISHIFT)
1127 +#define ITOINT(a) ((a) >> ISHIFT)
1133 +/* special markers */
1134 +#define M_BADHUFF -1
1139 + unsigned int bits;
1143 + int (*func) __P((void *));
1147 +/*********************************/
1148 +struct dec_hufftbl;
1149 +struct enc_hufftbl;
1152 + struct dec_hufftbl *dhuff;
1153 + struct enc_hufftbl *ehuff;
1157 + int dc; /* old dc value */
1159 + union hufftblp hudc;
1160 + union hufftblp huac;
1161 + int next; /* when to switch to next scan */
1163 + int cid; /* component id */
1164 + int hv; /* horiz/vert, copied from comp */
1165 + int tq; /* quant tbl, copied from comp */
1168 +/*********************************/
1170 +#define DECBITS 10 /* seems to be the optimum */
1172 +struct dec_hufftbl {
1175 + unsigned char vals[256];
1176 + unsigned int llvals[1 << DECBITS];
1179 +static void decode_mcus __P((struct in *, int *, int, struct scan *, int *));
1180 +static int dec_readmarker __P((struct in *));
1181 +static void dec_makehuff __P((struct dec_hufftbl *, int *, unsigned char *));
1183 +static void setinput __P((struct in *, unsigned char *));
1184 +/*********************************/
1189 +static void idctqtab __P((unsigned char *, PREC *));
1190 +static void idct __P((int *, int *, PREC *, PREC, int));
1191 +static void scaleidctqtab __P((PREC *, PREC));
1193 +/*********************************/
1195 +static void initcol __P((PREC[][64]));
1197 +static void col221111 __P((int *, unsigned char *, int));
1198 +static void col221111_16 __P((int *, unsigned char *, int));
1200 +/*********************************/
1203 +#define M_APP0 0xe0
1205 +#define M_SOF0 0xc0
1209 +#define M_RST0 0xd0
1213 +static unsigned char *datap;
1215 +static int getbyte(void)
1220 +static int getword(void)
1225 + return c1 << 8 | c2;
1236 + int nc; /* number of components */
1237 + int ns; /* number of scans */
1238 + int dri; /* restart interval */
1239 + int nm; /* mcus til next marker */
1240 + int rm; /* next restart marker */
1243 +static struct jpginfo info;
1244 +static struct comp comps[MAXCOMP];
1246 +static struct scan dscans[MAXCOMP];
1248 +static unsigned char quant[4][64];
1250 +static struct dec_hufftbl dhuff[4];
1252 +#define dec_huffdc (dhuff + 0)
1253 +#define dec_huffac (dhuff + 2)
1255 +static struct in in;
1257 +static int readtables(int till)
1259 + int m, l, i, j, lq, pq, tq;
1263 + if (getbyte() != 0xff)
1265 + if ((m = getbyte()) == till)
1282 + for (i = 0; i < 64; i++)
1283 + quant[tq][i] = getbyte();
1291 + int hufflen[16], k;
1292 + unsigned char huffvals[256];
1298 + if (tc > 1 || th > 1)
1300 + for (i = 0; i < 16; i++)
1301 + hufflen[i] = getbyte();
1304 + for (i = 0; i < 16; i++) {
1305 + for (j = 0; j < hufflen[i]; j++)
1306 + huffvals[k++] = getbyte();
1309 + dec_makehuff(dhuff + tt, hufflen,
1316 + info.dri = getword();
1329 +static void dec_initscans(void)
1333 + info.nm = info.dri + 1;
1335 + for (i = 0; i < info.ns; i++)
1339 +static int dec_checkmarker(void)
1343 + if (dec_readmarker(&in) != info.rm)
1345 + info.nm = info.dri;
1346 + info.rm = (info.rm + 1) & ~0x08;
1347 + for (i = 0; i < info.ns; i++)
1352 +int jpeg_check_size(unsigned char *buf, int width, int height)
1357 + readtables(M_SOF0);
1360 + if (height != getword() || width != getword())
1365 +int jpeg_decode(buf, pic, width, height, depth, decdata)
1366 +unsigned char *buf, *pic;
1367 +int width, height, depth;
1368 +struct jpeg_decdata *decdata;
1370 + int i, j, m, tac, tdc;
1371 + int mcusx, mcusy, mx, my;
1377 + if (getbyte() != 0xff)
1378 + return ERR_NO_SOI;
1379 + if (getbyte() != M_SOI)
1380 + return ERR_NO_SOI;
1381 + if (readtables(M_SOF0))
1382 + return ERR_BAD_TABLES;
1386 + return ERR_NOT_8BIT;
1387 + if (((getword() + 15) & ~15) != height)
1388 + return ERR_HEIGHT_MISMATCH;
1389 + if (((getword() + 15) & ~15) != width)
1390 + return ERR_WIDTH_MISMATCH;
1391 + if ((height & 15) || (width & 15))
1392 + return ERR_BAD_WIDTH_OR_HEIGHT;
1393 + info.nc = getbyte();
1394 + if (info.nc > MAXCOMP)
1395 + return ERR_TOO_MANY_COMPPS;
1396 + for (i = 0; i < info.nc; i++) {
1398 + comps[i].cid = getbyte();
1399 + comps[i].hv = getbyte();
1400 + v = comps[i].hv & 15;
1401 + h = comps[i].hv >> 4;
1402 + comps[i].tq = getbyte();
1403 + if (h > 3 || v > 3)
1404 + return ERR_ILLEGAL_HV;
1405 + if (comps[i].tq > 3)
1406 + return ERR_QUANT_TABLE_SELECTOR;
1408 + if (readtables(M_SOS))
1409 + return ERR_BAD_TABLES;
1411 + info.ns = getbyte();
1413 + return ERR_NOT_YCBCR_221111;
1414 + for (i = 0; i < 3; i++) {
1415 + dscans[i].cid = getbyte();
1419 + if (tdc > 1 || tac > 1)
1420 + return ERR_QUANT_TABLE_SELECTOR;
1421 + for (j = 0; j < info.nc; j++)
1422 + if (comps[j].cid == dscans[i].cid)
1425 + return ERR_UNKNOWN_CID_IN_SCAN;
1426 + dscans[i].hv = comps[j].hv;
1427 + dscans[i].tq = comps[j].tq;
1428 + dscans[i].hudc.dhuff = dec_huffdc + tdc;
1429 + dscans[i].huac.dhuff = dec_huffac + tac;
1436 + if (i != 0 || j != 63 || m != 0)
1437 + return ERR_NOT_SEQUENTIAL_DCT;
1439 + if (dscans[0].cid != 1 || dscans[1].cid != 2 || dscans[2].cid != 3)
1440 + return ERR_NOT_YCBCR_221111;
1442 + if (dscans[0].hv != 0x22 || dscans[1].hv != 0x11 || dscans[2].hv != 0x11)
1443 + return ERR_NOT_YCBCR_221111;
1445 + mcusx = width >> 4;
1446 + mcusy = height >> 4;
1449 + idctqtab(quant[dscans[0].tq], decdata->dquant[0]);
1450 + idctqtab(quant[dscans[1].tq], decdata->dquant[1]);
1451 + idctqtab(quant[dscans[2].tq], decdata->dquant[2]);
1452 + initcol(decdata->dquant);
1453 + setinput(&in, datap);
1456 + /* landing zone */
1458 + img[len + 1] = 0xff;
1459 + img[len + 2] = M_EOF;
1464 + dscans[0].next = 6 - 4;
1465 + dscans[1].next = 6 - 4 - 1;
1466 + dscans[2].next = 6 - 4 - 1 - 1; /* 411 encoding */
1467 + for (my = 0; my < mcusy; my++) {
1468 + for (mx = 0; mx < mcusx; mx++) {
1469 + if (info.dri && !--info.nm)
1470 + if (dec_checkmarker())
1471 + return ERR_WRONG_MARKER;
1473 + decode_mcus(&in, decdata->dcts, 6, dscans, max);
1474 + idct(decdata->dcts, decdata->out, decdata->dquant[0], IFIX(128.5), max[0]);
1475 + idct(decdata->dcts + 64, decdata->out + 64, decdata->dquant[0], IFIX(128.5), max[1]);
1476 + idct(decdata->dcts + 128, decdata->out + 128, decdata->dquant[0], IFIX(128.5), max[2]);
1477 + idct(decdata->dcts + 192, decdata->out + 192, decdata->dquant[0], IFIX(128.5), max[3]);
1478 + idct(decdata->dcts + 256, decdata->out + 256, decdata->dquant[1], IFIX(0.5), max[4]);
1479 + idct(decdata->dcts + 320, decdata->out + 320, decdata->dquant[2], IFIX(0.5), max[5]);
1483 + col221111(decdata->out, pic + (my * 16 * mcusx + mx) * 16 * 3, mcusx * 16 * 3);
1486 + col221111_16(decdata->out, pic + (my * 16 * mcusx + mx) * (16 * 2), mcusx * (16 * 2));
1489 + return ERR_DEPTH_MISMATCH;
1495 + m = dec_readmarker(&in);
1497 + return ERR_NO_EOI;
1502 +/****************************************************************/
1503 +/************** huffman decoder ***************/
1504 +/****************************************************************/
1506 +static int fillbits __P((struct in *, int, unsigned int));
1507 +static int dec_rec2
1508 +__P((struct in *, struct dec_hufftbl *, int *, int, int));
1510 +static void setinput(in, p)
1520 +static int fillbits(in, le, bi)
1529 + in->bits = bi << 16, le += 16;
1532 + while (le <= 24) {
1534 + if (b == 0xff && (m = *in->p++) != 0) {
1536 + if (in->func && (m = in->func(in->data)) == 0)
1541 + bi = bi << 16, le += 16;
1547 + in->bits = bi; /* tmp... 2 return values needed */
1551 +static int dec_readmarker(in)
1556 + in->left = fillbits(in, in->left, in->bits);
1557 + if ((m = in->marker) == 0)
1564 +#define LEBI_DCL int le, bi
1565 +#define LEBI_GET(in) (le = in->left, bi = in->bits)
1566 +#define LEBI_PUT(in) (in->left = le, in->bits = bi)
1568 +#define GETBITS(in, n) ( \
1569 + (le < (n) ? le = fillbits(in, le, bi), bi = in->bits : 0), \
1571 + bi >> le & ((1 << (n)) - 1) \
1574 +#define UNGETBITS(in, n) ( \
1579 +static int dec_rec2(in, hu, runp, c, i)
1581 +struct dec_hufftbl *hu;
1589 + UNGETBITS(in, i & 127);
1590 + *runp = i >> 8 & 15;
1593 + for (i = DECBITS; (c = ((c << 1) | GETBITS(in, 1))) >= (hu->maxcode[i]); i++);
1595 + in->marker = M_BADHUFF;
1598 + i = hu->vals[hu->valptr[i] + c - hu->maxcode[i - 1] * 2];
1602 + if (i == 0) { /* sigh, 0xf0 is 11 bit */
1606 + /* receive part */
1607 + c = GETBITS(in, i);
1608 + if (c < (1 << (i - 1)))
1609 + c += (-1 << i) + 1;
1614 +#define DEC_REC(in, hu, r, i) ( \
1615 + r = GETBITS(in, DECBITS), \
1616 + i = hu->llvals[r], \
1619 + UNGETBITS(in, i & 127), \
1620 + r = i >> 8 & 15, \
1626 + i = dec_rec2(in, hu, &r, r, i), \
1632 +static void decode_mcus(in, dct, n, sc, maxp)
1639 + struct dec_hufftbl *hu;
1643 + memset(dct, 0, n * 64 * sizeof(*dct));
1646 + hu = sc->hudc.dhuff;
1647 + *dct++ = (sc->dc += DEC_REC(in, hu, r, t));
1649 + hu = sc->huac.dhuff;
1652 + t = DEC_REC(in, hu, r, t);
1653 + if (t == 0 && r == 0) {
1662 + if (n == sc->next)
1668 +static void dec_makehuff(hu, hufflen, huffvals)
1669 +struct dec_hufftbl *hu;
1671 +unsigned char *huffvals;
1673 + int code, k, i, j, d, x, c, v;
1674 + for (i = 0; i < (1 << DECBITS); i++)
1675 + hu->llvals[i] = 0;
1680 + * value v already known, run r, backup u bits:
1681 + * vvvvvvvvvvvvvvvv 0000 rrrr 1 uuuuuuu
1682 + * value unknown, size b bits, run r, backup u bits:
1683 + * 000000000000bbbb 0000 rrrr 0 uuuuuuu
1684 + * value and size unknown:
1685 + * 0000000000000000 0000 0000 0 0000000
1689 + for (i = 0; i < 16; i++, code <<= 1) { /* sizes */
1690 + hu->valptr[i] = k;
1691 + for (j = 0; j < hufflen[i]; j++) {
1692 + hu->vals[k] = *huffvals++;
1693 + if (i < DECBITS) {
1694 + c = code << (DECBITS - 1 - i);
1695 + v = hu->vals[k] & 0x0f; /* size */
1696 + for (d = 1 << (DECBITS - 1 - i); --d >= 0;) {
1697 + if (v + i < DECBITS) { /* both fit in table */
1698 + x = d >> (DECBITS - 1 - v -
1700 + if (v && x < (1 << (v - 1)))
1701 + x += (-1 << v) + 1;
1702 + x = x << 16 | (hu-> vals[k] & 0xf0) << 4 |
1703 + (DECBITS - (i + 1 + v)) | 128;
1705 + x = v << 16 | (hu-> vals[k] & 0xf0) << 4 |
1706 + (DECBITS - (i + 1));
1707 + hu->llvals[c | d] = x;
1713 + hu->maxcode[i] = code;
1715 + hu->maxcode[16] = 0x20000; /* always terminate decode */
1718 +/****************************************************************/
1719 +/************** idct ***************/
1720 +/****************************************************************/
1722 +#define ONE ((PREC)IFIX(1.))
1723 +#define S2 ((PREC)IFIX(0.382683432))
1724 +#define C2 ((PREC)IFIX(0.923879532))
1725 +#define C4 ((PREC)IFIX(0.707106781))
1727 +#define S22 ((PREC)IFIX(2 * 0.382683432))
1728 +#define C22 ((PREC)IFIX(2 * 0.923879532))
1729 +#define IC4 ((PREC)IFIX(1 / 0.707106781))
1731 +#define C3IC1 ((PREC)IFIX(0.847759065)) /* c3/c1 */
1732 +#define C5IC1 ((PREC)IFIX(0.566454497)) /* c5/c1 */
1733 +#define C7IC1 ((PREC)IFIX(0.198912367)) /* c7/c1 */
1735 +#define XPP(a,b) (t = a + b, b = a - b, a = t)
1736 +#define XMP(a,b) (t = a - b, b = a + b, a = t)
1737 +#define XPM(a,b) (t = a + b, b = b - a, a = t)
1739 +#define ROT(a,b,s,c) ( t = IMULT(a + b, s), \
1740 + a = IMULT(a, c - s) + t, \
1741 + b = IMULT(b, c + s) - t)
1747 + t2 = IMULT(t2, IC4) - t3, \
1753 + t5 = IMULT(t5, IC4), \
1754 + ROT(t4, t6, S22, C22),\
1764 +static unsigned char zig2[64] = {
1765 + 0, 2, 3, 9, 10, 20, 21, 35,
1766 + 14, 16, 25, 31, 39, 46, 50, 57,
1767 + 5, 7, 12, 18, 23, 33, 37, 48,
1768 + 27, 29, 41, 44, 52, 55, 59, 62,
1769 + 15, 26, 30, 40, 45, 51, 56, 58,
1770 + 1, 4, 8, 11, 19, 22, 34, 36,
1771 + 28, 42, 43, 53, 54, 60, 61, 63,
1772 + 6, 13, 17, 24, 32, 38, 47, 49
1775 +void idct(in, out, quant, off, max)
1782 + PREC t0, t1, t2, t3, t4, t5, t6, t7, t;
1783 + PREC tmp[64], *tmpp;
1785 + unsigned char *zig2p;
1789 + t0 += in[0] * quant[0];
1790 + for (i = 0; i < 64; i++)
1791 + out[i] = ITOINT(t0);
1796 + for (i = 0; i < 8; i++) {
1798 + t0 += in[j] * quant[j];
1800 + t5 = in[j] * quant[j];
1802 + t2 = in[j] * quant[j];
1804 + t7 = in[j] * quant[j];
1806 + t1 = in[j] * quant[j];
1808 + t4 = in[j] * quant[j];
1810 + t3 = in[j] * quant[j];
1812 + t6 = in[j] * quant[j];
1825 + for (i = 0; i < 8; i++) {
1826 + t0 = tmp[8 * i + 0];
1827 + t1 = tmp[8 * i + 1];
1828 + t2 = tmp[8 * i + 2];
1829 + t3 = tmp[8 * i + 3];
1830 + t4 = tmp[8 * i + 4];
1831 + t5 = tmp[8 * i + 5];
1832 + t6 = tmp[8 * i + 6];
1833 + t7 = tmp[8 * i + 7];
1835 + out[8 * i + 0] = ITOINT(t0);
1836 + out[8 * i + 1] = ITOINT(t1);
1837 + out[8 * i + 2] = ITOINT(t2);
1838 + out[8 * i + 3] = ITOINT(t3);
1839 + out[8 * i + 4] = ITOINT(t4);
1840 + out[8 * i + 5] = ITOINT(t5);
1841 + out[8 * i + 6] = ITOINT(t6);
1842 + out[8 * i + 7] = ITOINT(t7);
1846 +static unsigned char zig[64] = {
1847 + 0, 1, 5, 6, 14, 15, 27, 28,
1848 + 2, 4, 7, 13, 16, 26, 29, 42,
1849 + 3, 8, 12, 17, 25, 30, 41, 43,
1850 + 9, 11, 18, 24, 31, 40, 44, 53,
1851 + 10, 19, 23, 32, 39, 45, 52, 54,
1852 + 20, 22, 33, 38, 46, 51, 55, 60,
1853 + 21, 34, 37, 47, 50, 56, 59, 61,
1854 + 35, 36, 48, 49, 57, 58, 62, 63
1857 +static PREC aaidct[8] = {
1858 + IFIX(0.3535533906), IFIX(0.4903926402),
1859 + IFIX(0.4619397663), IFIX(0.4157348062),
1860 + IFIX(0.3535533906), IFIX(0.2777851165),
1861 + IFIX(0.1913417162), IFIX(0.0975451610)
1865 +static void idctqtab(qin, qout)
1866 +unsigned char *qin;
1871 + for (i = 0; i < 8; i++)
1872 + for (j = 0; j < 8; j++)
1873 + qout[zig[i * 8 + j]] = qin[zig[i * 8 + j]] *
1874 + IMULT(aaidct[i], aaidct[j]);
1877 +static void scaleidctqtab(q, sc)
1883 + for (i = 0; i < 64; i++)
1884 + q[i] = IMULT(q[i], sc);
1887 +/****************************************************************/
1888 +/************** color decoder ***************/
1889 +/****************************************************************/
1894 + * YCbCr Color transformation:
1896 + * y:0..255 Cb:-128..127 Cr:-128..127
1898 + * R = Y + 1.40200 * Cr
1899 + * G = Y - 0.34414 * Cb - 0.71414 * Cr
1900 + * B = Y + 1.77200 * Cb
1905 + * Cg = 0.19421 * Cb + .50937 * Cr;
1911 + * Cg = (50 * Cb + 130 * Cr + 128) >> 8;
1914 +static void initcol(q)
1917 + scaleidctqtab(q[1], IFIX(1.77200));
1918 + scaleidctqtab(q[2], IFIX(1.40200));
1921 +/* This is optimized for the stupid sun SUNWspro compiler. */
1922 +#define STORECLAMP(a,x) \
1925 + (unsigned int)(x) >= 256 ? \
1926 + ((a) = (x) < 0 ? 0 : 255) \
1931 +#define CLAMP(x) ((unsigned int)(x) >= 256 ? ((x) < 0 ? 0 : 255) : (x))
1935 +#define CBCRCG(yin, xin) \
1937 + cb = outc[0 +yin*8+xin], \
1938 + cr = outc[64+yin*8+xin], \
1939 + cg = (50 * cb + 130 * cr + 128) >> 8 \
1944 +#define CBCRCG(yin, xin) \
1946 + cb = outc[0 +yin*8+xin], \
1947 + cr = outc[64+yin*8+xin], \
1948 + cg = (3 * cb + 8 * cr) >> 4 \
1953 +#define PIC(yin, xin, p, xout) \
1955 + y = outy[(yin) * 8 + xin], \
1956 + STORECLAMP(p[(xout) * 3 + 0], y + cr), \
1957 + STORECLAMP(p[(xout) * 3 + 1], y - cg), \
1958 + STORECLAMP(p[(xout) * 3 + 2], y + cb) \
1961 +#ifdef __LITTLE_ENDIAN
1962 +#define PIC_16(yin, xin, p, xout, add) \
1964 + y = outy[(yin) * 8 + xin], \
1965 + y = ((CLAMP(y + cr + add*2+1) & 0xf8) << 8) | \
1966 + ((CLAMP(y - cg + add ) & 0xfc) << 3) | \
1967 + ((CLAMP(y + cb + add*2+1) ) >> 3), \
1968 + p[(xout) * 2 + 0] = y & 0xff, \
1969 + p[(xout) * 2 + 1] = y >> 8 \
1973 +#define PIC_16(yin, xin, p, xout, add) \
1975 + y = outy[(yin) * 8 + xin], \
1976 + y = ((CLAMP(y + cr + add*2+1) & 0xf8) << 7) | \
1977 + ((CLAMP(y - cg + add*2+1) & 0xf8) << 2) | \
1978 + ((CLAMP(y + cb + add*2+1) ) >> 3), \
1979 + p[(xout) * 2 + 0] = y >> 8, \
1980 + p[(xout) * 2 + 1] = y & 0xff \
1983 +#define PIC_16(yin, xin, p, xout, add) \
1985 + y = outy[(yin) * 8 + xin], \
1986 + y = ((CLAMP(y + cr + add*2+1) & 0xf8) << 8) | \
1987 + ((CLAMP(y - cg + add ) & 0xfc) << 3) | \
1988 + ((CLAMP(y + cb + add*2+1) ) >> 3), \
1989 + p[(xout) * 2 + 0] = y >> 8, \
1990 + p[(xout) * 2 + 1] = y & 0xff \
1995 +#define PIC221111(xin) \
1998 + PIC(xin / 4 * 8 + 0, (xin & 3) * 2 + 0, pic0, xin * 2 + 0), \
1999 + PIC(xin / 4 * 8 + 0, (xin & 3) * 2 + 1, pic0, xin * 2 + 1), \
2000 + PIC(xin / 4 * 8 + 1, (xin & 3) * 2 + 0, pic1, xin * 2 + 0), \
2001 + PIC(xin / 4 * 8 + 1, (xin & 3) * 2 + 1, pic1, xin * 2 + 1) \
2004 +#define PIC221111_16(xin) \
2007 + PIC_16(xin / 4 * 8 + 0, (xin & 3) * 2 + 0, pic0, xin * 2 + 0, 3), \
2008 + PIC_16(xin / 4 * 8 + 0, (xin & 3) * 2 + 1, pic0, xin * 2 + 1, 0), \
2009 + PIC_16(xin / 4 * 8 + 1, (xin & 3) * 2 + 0, pic1, xin * 2 + 0, 1), \
2010 + PIC_16(xin / 4 * 8 + 1, (xin & 3) * 2 + 1, pic1, xin * 2 + 1, 2) \
2013 +static void col221111(out, pic, width)
2015 +unsigned char *pic;
2019 + unsigned char *pic0, *pic1;
2021 + int cr, cg, cb, y;
2024 + pic1 = pic + width;
2026 + outc = out + 64 * 4;
2027 + for (i = 2; i > 0; i--) {
2028 + for (j = 4; j > 0; j--) {
2029 + for (k = 0; k < 8; k++) {
2034 + pic0 += 2 * width;
2035 + pic1 += 2 * width;
2037 + outy += 64 * 2 - 16 * 4;
2041 +static void col221111_16(out, pic, width)
2043 +unsigned char *pic;
2047 + unsigned char *pic0, *pic1;
2049 + int cr, cg, cb, y;
2052 + pic1 = pic + width;
2054 + outc = out + 64 * 4;
2055 + for (i = 2; i > 0; i--) {
2056 + for (j = 4; j > 0; j--) {
2057 + for (k = 0; k < 8; k++) {
2062 + pic0 += 2 * width;
2063 + pic1 += 2 * width;
2065 + outy += 64 * 2 - 16 * 4;
2068 diff -Nur --exclude '*.orig' linux-2.6.7-rc1.org/drivers/video/bootsplash/decode-jpg.h linux-2.6.7-rc1/drivers/video/bootsplash/decode-jpg.h
2069 --- linux-2.6.7-rc1.org/drivers/video/bootsplash/decode-jpg.h 1970-01-01 01:00:00.000000000 +0100
2070 +++ linux-2.6.7-rc1/drivers/video/bootsplash/decode-jpg.h 2004-05-25 11:51:08.000000000 +0200
2073 + * linux/drivers/video/bootsplash/decode-jpg.h - a tiny jpeg decoder.
2075 + * (w) August 2001 by Michael Schroeder, <mls@suse.de>
2078 +#ifndef __DECODE_JPG_H
2079 +#define __DECODE_JPG_H
2081 +#define ERR_NO_SOI 1
2082 +#define ERR_NOT_8BIT 2
2083 +#define ERR_HEIGHT_MISMATCH 3
2084 +#define ERR_WIDTH_MISMATCH 4
2085 +#define ERR_BAD_WIDTH_OR_HEIGHT 5
2086 +#define ERR_TOO_MANY_COMPPS 6
2087 +#define ERR_ILLEGAL_HV 7
2088 +#define ERR_QUANT_TABLE_SELECTOR 8
2089 +#define ERR_NOT_YCBCR_221111 9
2090 +#define ERR_UNKNOWN_CID_IN_SCAN 10
2091 +#define ERR_NOT_SEQUENTIAL_DCT 11
2092 +#define ERR_WRONG_MARKER 12
2093 +#define ERR_NO_EOI 13
2094 +#define ERR_BAD_TABLES 14
2095 +#define ERR_DEPTH_MISMATCH 15
2097 +struct jpeg_decdata {
2098 + int dcts[6 * 64 + 16];
2100 + int dquant[3][64];
2103 +extern int jpeg_decode(unsigned char *, unsigned char *, int, int, int, struct jpeg_decdata *);
2104 +extern int jpeg_check_size(unsigned char *, int, int);
2107 diff -Nur --exclude '*.orig' linux-2.6.7-rc1.org/drivers/video/bootsplash/render.c linux-2.6.7-rc1/drivers/video/bootsplash/render.c
2108 --- linux-2.6.7-rc1.org/drivers/video/bootsplash/render.c 1970-01-01 01:00:00.000000000 +0100
2109 +++ linux-2.6.7-rc1/drivers/video/bootsplash/render.c 2004-05-25 11:51:08.000000000 +0200
2112 + * linux/drivers/video/bootsplash/render.c - splash screen render functions.
2115 +#include <linux/config.h>
2116 +#include <linux/module.h>
2117 +#include <linux/types.h>
2118 +#include <linux/fb.h>
2119 +#include <linux/vt_kern.h>
2120 +#include <asm/irq.h>
2121 +#include <asm/system.h>
2123 +#include "../console/fbcon.h"
2124 +#include "bootsplash.h"
2126 +void splash_putcs(struct splash_data *sd, struct vc_data *vc, struct fb_info *info,
2127 + const unsigned short *s, int count, int ypos, int xpos)
2129 + unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff;
2130 + int bgshift = (vc->vc_hi_font_mask) ? 13 : 12;
2131 + int fgshift = (vc->vc_hi_font_mask) ? 9 : 8;
2133 + u8 *dst, *splashsrc;
2134 + unsigned int d, x, y;
2136 + u16 c = scr_readw(s);
2138 + int fg_color, bg_color, transparent;
2139 + fg_color = attr_fgcol(fgshift, c);
2140 + bg_color = attr_bgcol(bgshift, c);
2141 + transparent = sd->splash_color == bg_color;
2142 + xpos = xpos * vc->vc_font.width + sd->splash_text_xo;
2143 + ypos = ypos * vc->vc_font.height + sd->splash_text_yo;
2144 + splashsrc = (u8 *)(info->splash_pic + ypos * info->splash_bytes + xpos * 2);
2145 + dst = (u8 *)(info->screen_base + ypos * info->fix.line_length + xpos * 2);
2147 + fgx = ((u32 *)info->pseudo_palette)[fg_color];
2148 + if (transparent && sd->splash_color == 15) {
2149 + if (fgx == 0xffea)
2151 + else if (fgx == 0x57ea)
2153 + else if (fgx == 0xffff)
2156 + bgx = ((u32 *)info->pseudo_palette)[bg_color];
2160 + c = scr_readw(s++);
2161 + src = vc->vc_font.data + (c & charmask) * vc->vc_font.height * ((vc->vc_font.width + 7) >> 3);
2163 + for (y = 0; y < vc->vc_font.height; y++) {
2164 + for (x = 0; x < vc->vc_font.width; x += 2) {
2170 + dd = transparent ? *(u16 *)splashsrc : bgx;
2175 + dd |= (transparent ? *(u16 *)splashsrc : bgx) << 16;
2178 + fb_writel(dd, dst);
2181 + dst += info->fix.line_length - vc->vc_font.width * 2;
2182 + splashsrc += info->splash_bytes - vc->vc_font.width * 2;
2184 + dst -= info->fix.line_length * vc->vc_font.height - vc->vc_font.width * 2;
2185 + splashsrc -= info->splash_bytes * vc->vc_font.height - vc->vc_font.width * 2;
2189 +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)
2191 + int transparent = sd->splash_color == bg_color;
2193 + u8 *dst, *splashsrc;
2194 + unsigned int d, x, y;
2196 + splashsrc = (u8 *)(info->splash_pic + ypos * info->splash_bytes + xpos * 2);
2197 + dst = (u8 *)(info->screen_base + ypos * info->fix.line_length + xpos * 2);
2198 + fgx = ((u32 *)info->pseudo_palette)[fg_color];
2199 + if (transparent && sd->splash_color == 15) {
2200 + if (fgx == 0xffea)
2202 + else if (fgx == 0x57ea)
2204 + else if (fgx == 0xffff)
2207 + bgx = ((u32 *)info->pseudo_palette)[bg_color];
2209 + for (y = 0; y < height; y++) {
2210 + for (x = 0; x < width; x += 2) {
2216 + dd = transparent ? *(u16 *)splashsrc : bgx;
2221 + dd |= (transparent ? *(u16 *)splashsrc : bgx) << 16;
2224 + fb_writel(dd, dst);
2227 + dst += info->fix.line_length - width * 2;
2228 + splashsrc += info->splash_bytes - width * 2;
2232 +void splash_putc(struct splash_data *sd, struct vc_data *vc, struct fb_info *info,
2233 + int c, int ypos, int xpos)
2235 + unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff;
2236 + int bgshift = (vc->vc_hi_font_mask) ? 13 : 12;
2237 + int fgshift = (vc->vc_hi_font_mask) ? 9 : 8;
2238 + u8 *src = vc->vc_font.data + (c & charmask) * vc->vc_font.height * ((vc->vc_font.width + 7) >> 3);
2239 + xpos = xpos * vc->vc_font.width + sd->splash_text_xo;
2240 + ypos = ypos * vc->vc_font.height + sd->splash_text_yo;
2241 + splash_renderc(sd, info, attr_fgcol(fgshift, c), attr_bgcol(bgshift, c), src, ypos, xpos, vc->vc_font.height, vc->vc_font.width);
2244 +void splashcopy(u8 *dst, u8 *src, int height, int width, int dstbytes, int srcbytes)
2248 + while (height-- > 0) {
2249 + u32 *p = (u32 *)dst;
2250 + u32 *q = (u32 *)src;
2251 + for (i=0; i < width/4; i++) {
2252 + fb_writel(*q++,p++);
2253 + fb_writel(*q++,p++);
2256 + fb_writel(*q++,p++);
2258 + fb_writew(*(u16*)q,(u16*)p);
2264 +static void splashset(u8 *dst, int height, int width, int dstbytes, u32 bgx) {
2268 + while (height-- > 0) {
2269 + u32 *p = (u32 *)dst;
2270 + for (i=0; i < width/4; i++) {
2271 + fb_writel(bgx,p++);
2272 + fb_writel(bgx,p++);
2275 + fb_writel(bgx,p++);
2277 + fb_writew(bgx,(u16*)p);
2282 +static void splashfill(struct fb_info *info, int sy, int sx, int height, int width) {
2283 + 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);
2286 +void splash_clear(struct splash_data *sd, struct vc_data *vc, struct fb_info *info, int sy,
2287 + int sx, int height, int width)
2289 + int bgshift = (vc->vc_hi_font_mask) ? 13 : 12;
2290 + int bg_color = attr_bgcol_ec(bgshift, vc);
2291 + int transparent = sd->splash_color == bg_color;
2295 + sy = sy * vc->vc_font.height + sd->splash_text_yo;
2296 + sx = sx * vc->vc_font.width + sd->splash_text_xo;
2297 + height *= vc->vc_font.height;
2298 + width *= vc->vc_font.width;
2299 + if (transparent) {
2300 + splashfill(info, sy, sx, height, width);
2303 + dst = (u8 *)(info->screen_base + sy * info->fix.line_length + sx * 2);
2304 + bgx = ((u32 *)info->pseudo_palette)[bg_color];
2305 + splashset(dst, height, width, info->fix.line_length, bgx);
2308 +void splash_bmove(struct splash_data *sd, struct vc_data *vc, struct fb_info *info, int sy,
2309 + int sx, int dy, int dx, int height, int width)
2311 + struct fb_copyarea area;
2313 + area.sx = sx * vc->vc_font.width;
2314 + area.sy = sy * vc->vc_font.height;
2315 + area.dx = dx * vc->vc_font.width;
2316 + area.dy = dy * vc->vc_font.height;
2317 + area.sx += sd->splash_text_xo;
2318 + area.sy += sd->splash_text_yo;
2319 + area.dx += sd->splash_text_xo;
2320 + area.dy += sd->splash_text_yo;
2321 + area.height = height * vc->vc_font.height;
2322 + area.width = width * vc->vc_font.width;
2324 + info->fbops->fb_copyarea(info, &area);
2327 +void splash_clear_margins(struct splash_data *sd, struct vc_data *vc, struct fb_info *info,
2330 + unsigned int tw = vc->vc_cols*vc->vc_font.width;
2331 + unsigned int th = vc->vc_rows*vc->vc_font.height;
2333 + if (!bottom_only) {
2335 + splashfill(info, 0, 0, sd->splash_text_yo, info->var.xres);
2337 + splashfill(info, sd->splash_text_yo, 0, th, sd->splash_text_xo);
2338 + /* right margin */
2339 + splashfill(info, sd->splash_text_yo, sd->splash_text_xo + tw, th, info->var.xres - sd->splash_text_xo - tw);
2342 + splashfill(info, sd->splash_text_yo + th, 0, info->var.yres - sd->splash_text_yo - th, info->var.xres);
2345 +void splash_cursor(struct splash_data *sd, struct fb_info *info, struct fb_cursor *cursor)
2348 + unsigned int dsize, s_pitch;
2350 + if (cursor->set & FB_CUR_SETSIZE) {
2351 + info->cursor.image.height = cursor->image.height;
2352 + info->cursor.image.width = cursor->image.width;
2354 + if (cursor->set & FB_CUR_SETPOS) {
2355 + info->cursor.image.dx = cursor->image.dx;
2356 + info->cursor.image.dy = cursor->image.dy;
2358 + if (cursor->set & FB_CUR_SETHOT)
2359 + info->cursor.hot = cursor->hot;
2360 + if (cursor->set & FB_CUR_SETCMAP) {
2361 + if (cursor->image.depth == 1) {
2362 + info->cursor.image.bg_color = cursor->image.bg_color;
2363 + info->cursor.image.fg_color = cursor->image.fg_color;
2365 + if (cursor->image.cmap.len)
2366 + fb_copy_cmap(&cursor->image.cmap, &info->cursor.image.cmap, 0);
2368 + info->cursor.image.depth = cursor->image.depth;
2370 + s_pitch = (info->cursor.image.width + 7) >> 3;
2371 + dsize = s_pitch * info->cursor.image.height;
2372 + if (info->cursor.enable) {
2373 + switch (info->cursor.rop) {
2375 + for (i = 0; i < dsize; i++)
2376 + info->fb_cursordata[i] = cursor->image.data[i] ^ info->cursor.mask[i];
2380 + for (i = 0; i < dsize; i++)
2381 + info->fb_cursordata[i] = cursor->image.data[i] & info->cursor.mask[i];
2384 + } else if (info->fb_cursordata != cursor->image.data)
2385 + memcpy(info->fb_cursordata, cursor->image.data, dsize);
2386 + info->cursor.image.data = info->fb_cursordata;
2387 + 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);
2390 +void splash_bmove_redraw(struct splash_data *sd, struct vc_data *vc, struct fb_info *info, int y, int sx, int dx, int width)
2392 + unsigned short *d = (unsigned short *) (vc->vc_origin + vc->vc_size_row * y + dx * 2);
2393 + unsigned short *s = d + (dx - sx);
2394 + unsigned short *start = d;
2395 + unsigned short *ls = d;
2396 + unsigned short *le = d + width;
2399 + unsigned short attr = 1;
2403 + if (attr != (c & 0xff00)) {
2404 + attr = c & 0xff00;
2406 + splash_putcs(sd, vc, info, start, d - start, y, x);
2411 + if (s >= ls && s < le && c == scr_readw(s)) {
2413 + splash_putcs(sd, vc, info, start, d - start, y, x);
2414 + x += d - start + 1;
2425 + splash_putcs(sd, vc, info, start, d - start, y, x);
2428 +void splash_blank(struct splash_data *sd, struct vc_data *vc, struct fb_info *info, int blank)
2431 + if (info->silent_screen_base)
2432 + splashset((u8 *)info->silent_screen_base, info->var.yres, info->var.xres, info->fix.line_length, 0);
2433 + splashset((u8 *)info->screen_base, info->var.yres, info->var.xres, info->fix.line_length, 0);
2435 + if (info->silent_screen_base)
2436 + splash_prepare(vc, info);
2437 + update_screen(vc->vc_num);
2438 + splash_clear_margins(vc->vc_splash_data, vc, info, 0);
2441 diff -Nur --exclude '*.orig' linux-2.6.7-rc1.org/drivers/video/console/fbcon.c linux-2.6.7-rc1/drivers/video/console/fbcon.c
2442 --- linux-2.6.7-rc1.org/drivers/video/console/fbcon.c 2004-05-23 07:54:23.000000000 +0200
2443 +++ linux-2.6.7-rc1/drivers/video/console/fbcon.c 2004-05-25 13:17:44.000000000 +0200
2448 +#ifdef CONFIG_BOOTSPLASH
2449 +#include "../bootsplash/bootsplash.h"
2453 # define DPRINTK(fmt, args...) printk(KERN_DEBUG "%s: " fmt, __FUNCTION__ , ## args)
2454 @@ -198,8 +201,14 @@
2455 if (!info || info->state != FBINFO_STATE_RUNNING ||
2456 info->cursor.rop == ROP_COPY)
2458 - acquire_console_sem();
2459 info->cursor.enable ^= 1;
2460 +#ifdef CONFIG_BOOTSPLASH
2461 + if (info->splash_data) {
2462 + splash_cursor(info->splash_data, info, &info->cursor);
2466 + acquire_console_sem();
2467 info->fbops->fb_cursor(info, &info->cursor);
2468 release_console_sem();
2470 @@ -312,6 +321,14 @@
2472 struct fb_copyarea area;
2474 +#ifdef CONFIG_BOOTSPLASH
2475 + if (info->splash_data) {
2476 + splash_bmove(info->splash_data, vc, info,
2477 + sy, sx, dy, dx, height, width);
2482 area.sx = sx * vc->vc_font.width;
2483 area.sy = sy * vc->vc_font.height;
2484 area.dx = dx * vc->vc_font.width;
2485 @@ -328,6 +345,13 @@
2486 int bgshift = (vc->vc_hi_font_mask) ? 13 : 12;
2487 struct fb_fillrect region;
2489 +#ifdef CONFIG_BOOTSPLASH
2490 + if (info->splash_data) {
2491 + splash_clear(info->splash_data, vc, info,
2492 + sy, sx, height, width);
2496 region.color = attr_bgcol_ec(bgshift, vc);
2497 region.dx = sx * vc->vc_font.width;
2498 region.dy = sy * vc->vc_font.height;
2499 @@ -356,6 +380,13 @@
2500 u16 c = scr_readw(s);
2501 u8 *src, *dst, *dst0;
2503 +#ifdef CONFIG_BOOTSPLASH
2504 + if (info->splash_data) {
2505 + splash_putcs(info->splash_data, vc, info, s, count, yy, xx);
2510 image.fg_color = attr_fgcol(fgshift, c);
2511 image.bg_color = attr_bgcol(bgshift, c);
2512 image.dx = xx * vc->vc_font.width;
2513 @@ -412,6 +443,13 @@
2514 unsigned int bs = info->var.yres - bh;
2515 struct fb_fillrect region;
2517 +#ifdef CONFIG_BOOTSPLASH
2518 + if (info->splash_data) {
2519 + splash_clear_margins(info->splash_data, vc, info, bottom_only);
2524 region.color = attr_bgcol_ec(bgshift, vc);
2525 region.rop = ROP_COPY;
2527 @@ -650,6 +688,14 @@
2531 +#ifdef CONFIG_BOOTSPLASH
2532 + if (vc->vc_splash_data && vc->vc_splash_data->splash_state) {
2533 + cols = vc->vc_splash_data->splash_text_wi / vc->vc_font.width;
2534 + rows = vc->vc_splash_data->splash_text_he / vc->vc_font.height;
2540 /* Need to make room for the logo */
2542 @@ -817,6 +863,12 @@
2543 if (vt_cons[vc->vc_num]->vc_mode != KD_TEXT)
2546 +#ifdef CONFIG_BOOTSPLASH
2547 + if (info->splash_data) {
2548 + splash_putc(info->splash_data, vc, info, c, ypos, xpos);
2552 image.dx = xpos * vc->vc_font.width;
2553 image.dy = real_y(p, ypos) * vc->vc_font.height;
2554 image.width = vc->vc_font.width;
2555 @@ -891,6 +943,12 @@
2556 if (info->cursor.rop == ROP_XOR) {
2557 info->cursor.enable = 0;
2558 info->cursor.rop = ROP_COPY;
2559 +#ifdef CONFIG_BOOTSPLASH
2560 + if (info->splash_data) {
2561 + splash_cursor(info->splash_data, info, &cursor);
2565 info->fbops->fb_cursor(info, &cursor);
2568 @@ -966,6 +1024,13 @@
2571 info->cursor.rop = ROP_XOR;
2572 +#ifdef CONFIG_BOOTSPLASH
2573 + if (info->splash_data) {
2574 + splash_cursor(info->splash_data, info, &cursor);
2575 + vbl_cursor_cnt = CURSOR_DRAW_DELAY;
2579 info->fbops->fb_cursor(info, &cursor);
2580 vbl_cursor_cnt = CURSOR_DRAW_DELAY;
2582 @@ -1269,6 +1334,10 @@
2583 fbcon_softback_note(vc, t, count);
2584 if (logo_shown >= 0)
2586 +#ifdef CONFIG_BOOTSPLASH
2587 + if (info->splash_data)
2590 switch (p->scrollmode) {
2592 accel_bmove(vc, info, t + count, 0, t, 0,
2593 @@ -1336,6 +1405,10 @@
2595 if (count > vc->vc_rows) /* Maximum realistic size */
2596 count = vc->vc_rows;
2597 +#ifdef CONFIG_BOOTSPLASH
2598 + if (info->splash_data)
2601 switch (p->scrollmode) {
2603 accel_bmove(vc, info, t, 0, t + count, 0,
2604 @@ -1461,6 +1534,13 @@
2608 +#ifdef CONFIG_BOOTSPLASH
2609 + if (info->splash_data && sy == dy && height == 1) {
2610 + /* must use slower redraw bmove to keep background pic intact */
2611 + splash_bmove_redraw(info->splash_data, vc, info, sy, sx, dx, width);
2615 accel_bmove(vc, info, real_y(p, sy), sx, real_y(p, dy), dx,
2618 @@ -1530,6 +1610,10 @@
2619 struct fb_info *info = registered_fb[(int) con2fb_map[vc->vc_num]];
2620 struct display *p = &fb_display[vc->vc_num];
2622 +#ifdef CONFIG_BOOTSPLASH
2623 + splash_prepare(vc, info);
2627 int l = fbcon_softback_size / vc->vc_size_row;
2629 @@ -1613,6 +1697,12 @@
2630 fbcon_cursor(vc, blank ? CM_ERASE : CM_DRAW);
2632 if (!info->fbops->fb_blank) {
2633 +#ifdef CONFIG_BOOTSPLASH
2634 + if (info->splash_data) {
2635 + splash_blank(info->splash_data, vc, info, blank);
2640 unsigned short oldc;
2642 @@ -1759,7 +1849,13 @@
2643 vc->vc_complement_mask <<= 1;
2644 vc->vc_s_complement_mask <<= 1;
2648 +#ifdef CONFIG_BOOTSPLASH
2649 + if(vc->vc_splash_data && vc->vc_splash_data->splash_state) {
2650 + con_remap_def_color(vc->vc_num, vc->vc_splash_data->splash_color << 4 | vc->vc_splash_data->splash_fg_color);
2654 /* ++Edmund: reorder the attribute bits */
2656 unsigned short *cp =
2657 @@ -1789,6 +1885,7 @@
2661 + u32 xres = info->var.xres, yres = info->var.yres;
2662 /* reset wrap/pan */
2663 info->var.xoffset = info->var.yoffset = p->yscroll = 0;
2664 vc_resize(vc->vc_num, info->var.xres / w, info->var.yres / h);
2665 @@ -2233,6 +2330,9 @@
2667 if (!num_registered_fb)
2669 +#ifdef CONFIG_BOOTSPLASH
2673 err = take_over_console(&fb_con, first_fb_vc, last_fb_vc,
2675 diff -Nur --exclude '*.orig' linux-2.6.7-rc1.org/drivers/video/console/fbcon.h linux-2.6.7-rc1/drivers/video/console/fbcon.h
2676 --- linux-2.6.7-rc1.org/drivers/video/console/fbcon.h 2004-05-23 07:54:28.000000000 +0200
2677 +++ linux-2.6.7-rc1/drivers/video/console/fbcon.h 2004-05-25 11:51:08.000000000 +0200
2679 * low-level frame buffer device
2682 +#ifdef CONFIG_BOOTSPLASH
2683 +struct splash_data {
2684 + int splash_state; /* show splash? */
2685 + int splash_color; /* transparent color */
2686 + int splash_fg_color; /* foreground color */
2687 + int splash_width; /* width of image */
2688 + int splash_height; /* height of image */
2689 + int splash_text_xo; /* text area origin */
2690 + int splash_text_yo;
2691 + int splash_text_wi; /* text area size */
2692 + int splash_text_he;
2693 + int splash_showtext; /* silent/verbose mode */
2694 + int splash_boxcount;
2695 + int splash_percent;
2696 + int splash_overpaintok; /* is it ok to overpaint boxes */
2697 + int splash_palcnt;
2698 + char *oldscreen_base; /* pointer to top of virtual screen */
2699 + unsigned char *splash_boxes;
2700 + unsigned char *splash_jpeg; /* jpeg */
2701 + unsigned char *splash_palette; /* palette for 8-bit */
2703 + int splash_dosilent; /* show silent jpeg */
2704 + unsigned char *splash_silentjpeg;
2705 + unsigned char *splash_sboxes;
2706 + int splash_sboxcount;
2711 /* Filled in by the frame buffer device */
2712 u_short inverse; /* != 0 text black on white as default */
2713 diff -Nur --exclude '*.orig' linux-2.6.7-rc1.org/drivers/video/vesafb.c linux-2.6.7-rc1/drivers/video/vesafb.c
2714 --- linux-2.6.7-rc1.org/drivers/video/vesafb.c 2004-05-23 07:53:33.000000000 +0200
2715 +++ linux-2.6.7-rc1/drivers/video/vesafb.c 2004-05-25 11:51:08.000000000 +0200
2716 @@ -171,7 +171,10 @@
2720 -static struct fb_ops vesafb_ops = {
2721 +#ifndef CONFIG_BOOTSPLASH
2724 +struct fb_ops vesafb_ops = {
2725 .owner = THIS_MODULE,
2726 .fb_setcolreg = vesafb_setcolreg,
2727 .fb_pan_display = vesafb_pan_display,
2728 diff -Nur --exclude '*.orig' linux-2.6.7-rc1.org/include/linux/console_struct.h linux-2.6.7-rc1/include/linux/console_struct.h
2729 --- linux-2.6.7-rc1.org/include/linux/console_struct.h 2004-05-23 07:53:30.000000000 +0200
2730 +++ linux-2.6.7-rc1/include/linux/console_struct.h 2004-05-25 11:51:08.000000000 +0200
2732 struct vc_data **vc_display_fg; /* [!] Ptr to var holding fg console for this display */
2733 unsigned long vc_uni_pagedir;
2734 unsigned long *vc_uni_pagedir_loc; /* [!] Location of uni_pagedir variable for this console */
2735 +#ifdef CONFIG_BOOTSPLASH
2736 + struct splash_data *vc_splash_data;
2738 /* additional information is in vt_kern.h */
2741 diff -Nur --exclude '*.orig' linux-2.6.7-rc1.org/include/linux/fb.h linux-2.6.7-rc1/include/linux/fb.h
2742 --- linux-2.6.7-rc1.org/include/linux/fb.h 2004-05-23 07:53:56.000000000 +0200
2743 +++ linux-2.6.7-rc1/include/linux/fb.h 2004-05-25 11:51:08.000000000 +0200
2744 @@ -524,6 +524,15 @@
2746 /* From here on everything is device dependent */
2748 +#ifdef CONFIG_BOOTSPLASH
2749 + struct splash_data *splash_data;
2750 + unsigned char *splash_pic;
2751 + int splash_pic_size;
2753 + char *silent_screen_base; /* real screen base */
2754 + char fb_cursordata[64];
2760 diff -Nur --exclude '*.orig' linux-2.6.7-rc1.org/kernel/panic.c linux-2.6.7-rc1/kernel/panic.c
2761 --- linux-2.6.7-rc1.org/kernel/panic.c 2004-05-23 07:54:44.000000000 +0200
2762 +++ linux-2.6.7-rc1/kernel/panic.c 2004-05-25 11:51:08.000000000 +0200
2764 * We can't use the "normal" timers since we just panicked..
2766 printk(KERN_EMERG "Rebooting in %d seconds..",panic_timeout);
2767 +#ifdef CONFIG_BOOTSPLASH
2769 + extern int splash_verbose(void);
2770 + (void)splash_verbose();
2773 for (i = 0; i < panic_timeout; i++) {
2774 touch_nmi_watchdog();
2776 @@ -105,6 +111,12 @@
2777 disabled_wait(caller);
2780 +#ifdef CONFIG_BOOTSPLASH
2782 + extern int splash_verbose(void);
2783 + (void)splash_verbose();