1 diff -ruN linux-2.4.31/Makefile linux-2.4.31-bs/Makefile
2 --- linux-2.4.31/Makefile 2005-04-04 02:42:20.000000000 +0100
3 +++ linux-2.4.31-bs/Makefile 2005-05-18 12:16:16.000000000 +0100
11 KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
13 diff -ruN linux-2.4.31/drivers/char/console.c linux-2.4.31-bs/drivers/char/console.c
14 --- linux-2.4.31/drivers/char/console.c 2005-01-19 14:09:44.000000000 +0000
15 +++ linux-2.4.31-bs/drivers/char/console.c 2005-05-05 22:20:15.000000000 +0100
16 @@ -3031,6 +3031,32 @@
20 +#ifdef CONFIG_FBCON_SPLASHSCREEN
21 +void con_remap_def_color(int currcons, int new_color)
23 + unsigned short *sbuf = screenbuf;
24 + unsigned c, len = screenbuf_size >> 1;
28 + old_color = def_color << 8;
32 + if (((c ^ old_color) & 0xf000) == 0)
33 + *sbuf ^= (old_color ^ new_color) & 0xf000;
34 + if (((c ^ old_color) & 0x0f00) == 0)
35 + *sbuf ^= (old_color ^ new_color) & 0x0f00;
40 + def_color = color = new_color;
41 + update_attr(currcons);
47 * Visible symbols for modules
49 diff -ruN linux-2.4.31/drivers/char/keyboard.c linux-2.4.31-bs/drivers/char/keyboard.c
50 --- linux-2.4.31/drivers/char/keyboard.c 2003-11-28 18:26:20.000000000 +0000
51 +++ linux-2.4.31-bs/drivers/char/keyboard.c 2005-05-05 22:27:48.000000000 +0100
54 rep = test_and_set_bit(keycode, key_down);
56 +#ifdef CONFIG_FBCON_SPLASHSCREEN
57 + /* This code has to be redone for some non-x86 platforms */
58 + if (keycode == 0x3c || keycode == 0x01) { /* F2 and ESC on a PC keyboard */
59 + extern int splash_verbose(void);
60 + if (splash_verbose())
65 #ifdef CONFIG_MAGIC_SYSRQ /* Handle the SysRq Hack */
66 if (keycode == SYSRQ_KEY) {
67 sysrq_pressed = !up_flag;
68 diff -ruN linux-2.4.31/drivers/char/n_tty.c linux-2.4.31-bs/drivers/char/n_tty.c
69 --- linux-2.4.31/drivers/char/n_tty.c 2005-01-19 14:09:47.000000000 +0000
70 +++ linux-2.4.31-bs/drivers/char/n_tty.c 2005-05-05 22:14:50.000000000 +0100
72 #include <linux/string.h>
73 #include <linux/slab.h>
74 #include <linux/poll.h>
75 +#include <linux/config.h>
77 #include <asm/uaccess.h>
78 #include <asm/system.h>
79 @@ -1184,6 +1185,17 @@
83 +#ifdef CONFIG_FBCON_SPLASHSCREEN
84 + if (file->f_dentry->d_inode->i_rdev == CONSOLE_DEV ||
85 + file->f_dentry->d_inode->i_rdev == SYSCONS_DEV ||
86 + file->f_dentry->d_inode->i_rdev == MKDEV(TTYAUX_MAJOR,0) ||
87 + file->f_dentry->d_inode->i_rdev == MKDEV(TTY_MAJOR,1)) {
88 + extern int splash_verbose(void);
89 + (void)splash_verbose();
94 c = job_control(tty, file);
97 diff -ruN linux-2.4.31/drivers/video/Config.in linux-2.4.31-bs/drivers/video/Config.in
98 --- linux-2.4.31/drivers/video/Config.in 2004-02-18 13:36:31.000000000 +0000
99 +++ linux-2.4.31-bs/drivers/video/Config.in 2005-05-05 22:24:55.000000000 +0100
100 @@ -239,13 +239,20 @@
101 tristate ' Virtual Frame Buffer support (ONLY FOR TESTING!) (EXPERIMENTAL)' CONFIG_FB_VIRTUAL
104 + dep_bool ' Use splash screen instead of boot logo' CONFIG_FBCON_SPLASHSCREEN $CONFIG_BLK_DEV_INITRD
105 + if [ "$CONFIG_FBCON_SPLASHSCREEN" = "y" ]; then
106 + define_bool CONFIG_FBCON_CFB16 y
109 bool ' Advanced low level driver options' CONFIG_FBCON_ADVANCED
110 if [ "$CONFIG_FBCON_ADVANCED" = "y" ]; then
111 tristate ' Monochrome support' CONFIG_FBCON_MFB
112 tristate ' 2 bpp packed pixels support' CONFIG_FBCON_CFB2
113 tristate ' 4 bpp packed pixels support' CONFIG_FBCON_CFB4
114 tristate ' 8 bpp packed pixels support' CONFIG_FBCON_CFB8
115 - tristate ' 16 bpp packed pixels support' CONFIG_FBCON_CFB16
116 + if [ "$CONFIG_FBCON_SPLASHSCREEN" != "y" ]; then
117 + tristate ' 16 bpp packed pixels support' CONFIG_FBCON_CFB16
119 tristate ' 24 bpp packed pixels support' CONFIG_FBCON_CFB24
120 tristate ' 32 bpp packed pixels support' CONFIG_FBCON_CFB32
121 tristate ' Amiga bitplanes support' CONFIG_FBCON_AFB
123 "$CONFIG_FB_SIS" = "y" -o "$CONFIG_FB_SA1100" = "y" -o \
124 "$CONFIG_FB_PVR2" = "y" -o "$CONFIG_FB_VOODOO1" = "y" -o \
125 "$CONFIG_FB_NEOMAGIC" = "y" -o "$CONFIG_FB_INTEL" = "y" ]; then
126 - define_tristate CONFIG_FBCON_CFB16 y
127 + if [ "$CONFIG_FBCON_CFB16" != "m" ]; then
128 + define_tristate CONFIG_FBCON_CFB16 y
131 if [ "$CONFIG_FB_ATARI" = "m" -o "$CONFIG_FB_ATY" = "m" -o \
132 "$CONFIG_FB_MAC" = "m" -o "$CONFIG_FB_VESA" = "m" -o \
134 "$CONFIG_FB_INTEL" = "m" -o \
135 "$CONFIG_FB_PVR2" = "m" -o "$CONFIG_FB_VOODOO1" = "m" -o \
136 "$CONFIG_FB_NEOMAGIC" = "m" -o "$CONFIG_FB_INTEL" = "m" ]; then
137 - define_tristate CONFIG_FBCON_CFB16 m
138 + if [ "$CONFIG_FBCON_CFB16" != "y" ]; then
139 + define_tristate CONFIG_FBCON_CFB16 m
143 if [ "$CONFIG_FB_ATY" = "y" -o "$CONFIG_FB_VIRTUAL" = "y" -o \
144 diff -ruN linux-2.4.31/drivers/video/Makefile linux-2.4.31-bs/drivers/video/Makefile
145 --- linux-2.4.31/drivers/video/Makefile 2004-02-18 13:36:31.000000000 +0000
146 +++ linux-2.4.31-bs/drivers/video/Makefile 2005-05-06 11:28:28.000000000 +0100
148 fbcon-vga.o fbcon-iplan2p2.o fbcon-iplan2p4.o \
149 fbcon-iplan2p8.o fbcon-vga-planes.o fbcon-cfb16.o \
150 fbcon-cfb2.o fbcon-cfb24.o fbcon-cfb32.o fbcon-cfb4.o \
151 - fbcon-cfb8.o fbcon-mac.o fbcon-mfb.o \
152 + fbcon-cfb8.o fbcon-splash16.o fbcon-mac.o fbcon-mfb.o \
153 cyber2000fb.o sa1100fb.o fbcon-hga.o fbgen.o
155 # Each configuration option enables a list of files.
157 obj-$(CONFIG_FBCON_VGA) += fbcon-vga.o
158 obj-$(CONFIG_FBCON_HGA) += fbcon-hga.o
159 obj-$(CONFIG_FBCON_STI) += fbcon-sti.o
160 +obj-$(CONFIG_FBCON_SPLASHSCREEN) += fbcon-splash.o
161 +obj-$(CONFIG_FBCON_SPLASHSCREEN) += fbcon-splash16.o
162 +obj-$(CONFIG_FBCON_SPLASHSCREEN) += fbcon-jpegdec.o
164 include $(TOPDIR)/Rules.make
166 diff -ruN linux-2.4.31/drivers/video/fbcon-jpegdec.c linux-2.4.31-bs/drivers/video/fbcon-jpegdec.c
167 --- linux-2.4.31/drivers/video/fbcon-jpegdec.c 1970-01-01 01:00:00.000000000 +0100
168 +++ linux-2.4.31-bs/drivers/video/fbcon-jpegdec.c 2005-05-06 11:22:05.000000000 +0100
171 + * linux/drivers/video/fbcon-jpegdec.c - a tiny jpeg decoder.
173 + * (w) August 2001 by Michael Schroeder, <mls@suse.de>
177 +#include <linux/config.h>
178 +#include <linux/string.h>
179 +#include <asm/byteorder.h>
182 +#include "fbcon-splash.h"
183 +#include "fbcon-jpegdec.h"
187 +#define IFIX(a) ((int)((a) * (1 << ISHIFT) + .5))
188 +#define IMULT(a, b) (((a) * (b)) >> ISHIFT)
189 +#define ITOINT(a) ((a) >> ISHIFT)
195 +/* special markers */
196 +#define M_BADHUFF -1
205 + int (*func) __P((void *));
209 +/*********************************/
214 + struct dec_hufftbl *dhuff;
215 + struct enc_hufftbl *ehuff;
219 + int dc; /* old dc value */
221 + union hufftblp hudc;
222 + union hufftblp huac;
223 + int next; /* when to switch to next scan */
225 + int cid; /* component id */
226 + int hv; /* horiz/vert, copied from comp */
227 + int tq; /* quant tbl, copied from comp */
230 +/*********************************/
232 +#define DECBITS 10 /* seems to be the optimum */
234 +struct dec_hufftbl {
237 + unsigned char vals[256];
238 + unsigned int llvals[1 << DECBITS];
241 +static void decode_mcus __P((struct in *, int *, int, struct scan *, int *));
242 +static int dec_readmarker __P((struct in *));
243 +static void dec_makehuff __P((struct dec_hufftbl *, int *, unsigned char *));
245 +static void setinput __P((struct in *, unsigned char *));
246 +/*********************************/
251 +static void idctqtab __P((unsigned char *, PREC *));
252 +static void idct __P((int *, int *, PREC *, PREC, int));
253 +static void scaleidctqtab __P((PREC *, PREC));
255 +/*********************************/
257 +static void initcol __P((PREC[][64]));
259 +static void col221111 __P((int *, unsigned char *, int));
260 +static void col221111_16 __P((int *, unsigned char *, int));
262 +/*********************************/
275 +static unsigned char *datap;
277 +static int getbyte(void)
282 +static int getword(void)
287 + return c1 << 8 | c2;
298 + int nc; /* number of components */
299 + int ns; /* number of scans */
300 + int dri; /* restart interval */
301 + int nm; /* mcus til next marker */
302 + int rm; /* next restart marker */
305 +static struct jpginfo info;
306 +static struct comp comps[MAXCOMP];
308 +static struct scan dscans[MAXCOMP];
310 +static unsigned char quant[4][64];
312 +static struct dec_hufftbl dhuff[4];
314 +#define dec_huffdc (dhuff + 0)
315 +#define dec_huffac (dhuff + 2)
317 +static struct in in;
319 +static int readtables(int till)
321 + int m, l, i, j, lq, pq, tq;
325 + if (getbyte() != 0xff)
327 + if ((m = getbyte()) == till)
344 + for (i = 0; i < 64; i++)
345 + quant[tq][i] = getbyte();
353 + int hufflen[16], k;
354 + unsigned char huffvals[256];
360 + if (tc > 1 || th > 1)
362 + for (i = 0; i < 16; i++)
363 + hufflen[i] = getbyte();
366 + for (i = 0; i < 16; i++) {
367 + for (j = 0; j < hufflen[i]; j++)
368 + huffvals[k++] = getbyte();
371 + dec_makehuff(dhuff + tt, hufflen,
378 + info.dri = getword();
391 +static void dec_initscans(void)
395 + info.nm = info.dri + 1;
397 + for (i = 0; i < info.ns; i++)
401 +static int dec_checkmarker(void)
405 + if (dec_readmarker(&in) != info.rm)
407 + info.nm = info.dri;
408 + info.rm = (info.rm + 1) & ~0x08;
409 + for (i = 0; i < info.ns; i++)
414 +int jpeg_check_size(unsigned char *buf, int width, int height)
419 + readtables(M_SOF0);
422 + if (height != getword() || width != getword())
427 +int jpeg_decode(buf, pic, width, height, depth, decdata)
428 +unsigned char *buf, *pic;
429 +int width, height, depth;
430 +struct jpeg_decdata *decdata;
432 + int i, j, m, tac, tdc;
433 + int mcusx, mcusy, mx, my;
439 + if (getbyte() != 0xff)
441 + if (getbyte() != M_SOI)
443 + if (readtables(M_SOF0))
444 + return ERR_BAD_TABLES;
448 + return ERR_NOT_8BIT;
449 + if (((getword() + 15) & ~15) != height)
450 + return ERR_HEIGHT_MISMATCH;
451 + if (((getword() + 15) & ~15) != width)
452 + return ERR_WIDTH_MISMATCH;
453 + if ((height & 15) || (width & 15))
454 + return ERR_BAD_WIDTH_OR_HEIGHT;
455 + info.nc = getbyte();
456 + if (info.nc > MAXCOMP)
457 + return ERR_TOO_MANY_COMPPS;
458 + for (i = 0; i < info.nc; i++) {
460 + comps[i].cid = getbyte();
461 + comps[i].hv = getbyte();
462 + v = comps[i].hv & 15;
463 + h = comps[i].hv >> 4;
464 + comps[i].tq = getbyte();
465 + if (h > 3 || v > 3)
466 + return ERR_ILLEGAL_HV;
467 + if (comps[i].tq > 3)
468 + return ERR_QUANT_TABLE_SELECTOR;
470 + if (readtables(M_SOS))
471 + return ERR_BAD_TABLES;
473 + info.ns = getbyte();
475 + return ERR_NOT_YCBCR_221111;
476 + for (i = 0; i < 3; i++) {
477 + dscans[i].cid = getbyte();
481 + if (tdc > 1 || tac > 1)
482 + return ERR_QUANT_TABLE_SELECTOR;
483 + for (j = 0; j < info.nc; j++)
484 + if (comps[j].cid == dscans[i].cid)
487 + return ERR_UNKNOWN_CID_IN_SCAN;
488 + dscans[i].hv = comps[j].hv;
489 + dscans[i].tq = comps[j].tq;
490 + dscans[i].hudc.dhuff = dec_huffdc + tdc;
491 + dscans[i].huac.dhuff = dec_huffac + tac;
498 + if (i != 0 || j != 63 || m != 0)
499 + return ERR_NOT_SEQUENTIAL_DCT;
501 + if (dscans[0].cid != 1 || dscans[1].cid != 2 || dscans[2].cid != 3)
502 + return ERR_NOT_YCBCR_221111;
504 + if (dscans[0].hv != 0x22 || dscans[1].hv != 0x11 || dscans[2].hv != 0x11)
505 + return ERR_NOT_YCBCR_221111;
507 + mcusx = width >> 4;
508 + mcusy = height >> 4;
511 + idctqtab(quant[dscans[0].tq], decdata->dquant[0]);
512 + idctqtab(quant[dscans[1].tq], decdata->dquant[1]);
513 + idctqtab(quant[dscans[2].tq], decdata->dquant[2]);
514 + initcol(decdata->dquant);
515 + setinput(&in, datap);
520 + img[len + 1] = 0xff;
521 + img[len + 2] = M_EOF;
526 + dscans[0].next = 6 - 4;
527 + dscans[1].next = 6 - 4 - 1;
528 + dscans[2].next = 6 - 4 - 1 - 1; /* 411 encoding */
529 + for (my = 0; my < mcusy; my++) {
530 + for (mx = 0; mx < mcusx; mx++) {
531 + if (info.dri && !--info.nm)
532 + if (dec_checkmarker())
533 + return ERR_WRONG_MARKER;
535 + decode_mcus(&in, decdata->dcts, 6, dscans, max);
536 + idct(decdata->dcts, decdata->out, decdata->dquant[0], IFIX(128.5), max[0]);
537 + idct(decdata->dcts + 64, decdata->out + 64, decdata->dquant[0], IFIX(128.5), max[1]);
538 + idct(decdata->dcts + 128, decdata->out + 128, decdata->dquant[0], IFIX(128.5), max[2]);
539 + idct(decdata->dcts + 192, decdata->out + 192, decdata->dquant[0], IFIX(128.5), max[3]);
540 + idct(decdata->dcts + 256, decdata->out + 256, decdata->dquant[1], IFIX(0.5), max[4]);
541 + idct(decdata->dcts + 320, decdata->out + 320, decdata->dquant[2], IFIX(0.5), max[5]);
545 + col221111(decdata->out, pic + (my * 16 * mcusx + mx) * 16 * 3, mcusx * 16 * 3);
548 + col221111_16(decdata->out, pic + (my * 16 * mcusx + mx) * (16 * 2), mcusx * (16 * 2));
551 + return ERR_DEPTH_MISMATCH;
557 + m = dec_readmarker(&in);
564 +/****************************************************************/
565 +/************** huffman decoder ***************/
566 +/****************************************************************/
568 +static int fillbits __P((struct in *, int, unsigned int));
570 +__P((struct in *, struct dec_hufftbl *, int *, int, int));
572 +static void setinput(in, p)
582 +static int fillbits(in, le, bi)
591 + in->bits = bi << 16, le += 16;
596 + if (b == 0xff && (m = *in->p++) != 0) {
598 + if (in->func && (m = in->func(in->data)) == 0)
603 + bi = bi << 16, le += 16;
609 + in->bits = bi; /* tmp... 2 return values needed */
613 +static int dec_readmarker(in)
618 + in->left = fillbits(in, in->left, in->bits);
619 + if ((m = in->marker) == 0)
626 +#define LEBI_DCL int le, bi
627 +#define LEBI_GET(in) (le = in->left, bi = in->bits)
628 +#define LEBI_PUT(in) (in->left = le, in->bits = bi)
630 +#define GETBITS(in, n) ( \
631 + (le < (n) ? le = fillbits(in, le, bi), bi = in->bits : 0), \
633 + bi >> le & ((1 << (n)) - 1) \
636 +#define UNGETBITS(in, n) ( \
641 +static int dec_rec2(in, hu, runp, c, i)
643 +struct dec_hufftbl *hu;
651 + UNGETBITS(in, i & 127);
652 + *runp = i >> 8 & 15;
655 + for (i = DECBITS; (c = ((c << 1) | GETBITS(in, 1))) >= (hu->maxcode[i]); i++);
657 + in->marker = M_BADHUFF;
660 + i = hu->vals[hu->valptr[i] + c - hu->maxcode[i - 1] * 2];
664 + if (i == 0) { /* sigh, 0xf0 is 11 bit */
669 + c = GETBITS(in, i);
670 + if (c < (1 << (i - 1)))
671 + c += (-1 << i) + 1;
676 +#define DEC_REC(in, hu, r, i) ( \
677 + r = GETBITS(in, DECBITS), \
678 + i = hu->llvals[r], \
681 + UNGETBITS(in, i & 127), \
688 + i = dec_rec2(in, hu, &r, r, i), \
694 +static void decode_mcus(in, dct, n, sc, maxp)
701 + struct dec_hufftbl *hu;
705 + memset(dct, 0, n * 64 * sizeof(*dct));
708 + hu = sc->hudc.dhuff;
709 + *dct++ = (sc->dc += DEC_REC(in, hu, r, t));
711 + hu = sc->huac.dhuff;
714 + t = DEC_REC(in, hu, r, t);
715 + if (t == 0 && r == 0) {
730 +static void dec_makehuff(hu, hufflen, huffvals)
731 +struct dec_hufftbl *hu;
733 +unsigned char *huffvals;
735 + int code, k, i, j, d, x, c, v;
736 + for (i = 0; i < (1 << DECBITS); i++)
742 + * value v already known, run r, backup u bits:
743 + * vvvvvvvvvvvvvvvv 0000 rrrr 1 uuuuuuu
744 + * value unknown, size b bits, run r, backup u bits:
745 + * 000000000000bbbb 0000 rrrr 0 uuuuuuu
746 + * value and size unknown:
747 + * 0000000000000000 0000 0000 0 0000000
751 + for (i = 0; i < 16; i++, code <<= 1) { /* sizes */
753 + for (j = 0; j < hufflen[i]; j++) {
754 + hu->vals[k] = *huffvals++;
756 + c = code << (DECBITS - 1 - i);
757 + v = hu->vals[k] & 0x0f; /* size */
758 + for (d = 1 << (DECBITS - 1 - i); --d >= 0;) {
759 + if (v + i < DECBITS) { /* both fit in table */
760 + x = d >> (DECBITS - 1 - v -
762 + if (v && x < (1 << (v - 1)))
763 + x += (-1 << v) + 1;
764 + x = x << 16 | (hu-> vals[k] & 0xf0) << 4 |
765 + (DECBITS - (i + 1 + v)) | 128;
767 + x = v << 16 | (hu-> vals[k] & 0xf0) << 4 |
768 + (DECBITS - (i + 1));
769 + hu->llvals[c | d] = x;
775 + hu->maxcode[i] = code;
777 + hu->maxcode[16] = 0x20000; /* always terminate decode */
780 +/****************************************************************/
781 +/************** idct ***************/
782 +/****************************************************************/
784 +#define ONE ((PREC)IFIX(1.))
785 +#define S2 ((PREC)IFIX(0.382683432))
786 +#define C2 ((PREC)IFIX(0.923879532))
787 +#define C4 ((PREC)IFIX(0.707106781))
789 +#define S22 ((PREC)IFIX(2 * 0.382683432))
790 +#define C22 ((PREC)IFIX(2 * 0.923879532))
791 +#define IC4 ((PREC)IFIX(1 / 0.707106781))
793 +#define C3IC1 ((PREC)IFIX(0.847759065)) /* c3/c1 */
794 +#define C5IC1 ((PREC)IFIX(0.566454497)) /* c5/c1 */
795 +#define C7IC1 ((PREC)IFIX(0.198912367)) /* c7/c1 */
797 +#define XPP(a,b) (t = a + b, b = a - b, a = t)
798 +#define XMP(a,b) (t = a - b, b = a + b, a = t)
799 +#define XPM(a,b) (t = a + b, b = b - a, a = t)
801 +#define ROT(a,b,s,c) ( t = IMULT(a + b, s), \
802 + a = IMULT(a, c - s) + t, \
803 + b = IMULT(b, c + s) - t)
809 + t2 = IMULT(t2, IC4) - t3, \
815 + t5 = IMULT(t5, IC4), \
816 + ROT(t4, t6, S22, C22),\
826 +static unsigned char zig2[64] = {
827 + 0, 2, 3, 9, 10, 20, 21, 35,
828 + 14, 16, 25, 31, 39, 46, 50, 57,
829 + 5, 7, 12, 18, 23, 33, 37, 48,
830 + 27, 29, 41, 44, 52, 55, 59, 62,
831 + 15, 26, 30, 40, 45, 51, 56, 58,
832 + 1, 4, 8, 11, 19, 22, 34, 36,
833 + 28, 42, 43, 53, 54, 60, 61, 63,
834 + 6, 13, 17, 24, 32, 38, 47, 49
837 +void idct(in, out, quant, off, max)
844 + PREC t0, t1, t2, t3, t4, t5, t6, t7, t;
845 + PREC tmp[64], *tmpp;
847 + unsigned char *zig2p;
851 + t0 += in[0] * quant[0];
852 + for (i = 0; i < 64; i++)
853 + out[i] = ITOINT(t0);
858 + for (i = 0; i < 8; i++) {
860 + t0 += in[j] * quant[j];
862 + t5 = in[j] * quant[j];
864 + t2 = in[j] * quant[j];
866 + t7 = in[j] * quant[j];
868 + t1 = in[j] * quant[j];
870 + t4 = in[j] * quant[j];
872 + t3 = in[j] * quant[j];
874 + t6 = in[j] * quant[j];
887 + for (i = 0; i < 8; i++) {
888 + t0 = tmp[8 * i + 0];
889 + t1 = tmp[8 * i + 1];
890 + t2 = tmp[8 * i + 2];
891 + t3 = tmp[8 * i + 3];
892 + t4 = tmp[8 * i + 4];
893 + t5 = tmp[8 * i + 5];
894 + t6 = tmp[8 * i + 6];
895 + t7 = tmp[8 * i + 7];
897 + out[8 * i + 0] = ITOINT(t0);
898 + out[8 * i + 1] = ITOINT(t1);
899 + out[8 * i + 2] = ITOINT(t2);
900 + out[8 * i + 3] = ITOINT(t3);
901 + out[8 * i + 4] = ITOINT(t4);
902 + out[8 * i + 5] = ITOINT(t5);
903 + out[8 * i + 6] = ITOINT(t6);
904 + out[8 * i + 7] = ITOINT(t7);
908 +static unsigned char zig[64] = {
909 + 0, 1, 5, 6, 14, 15, 27, 28,
910 + 2, 4, 7, 13, 16, 26, 29, 42,
911 + 3, 8, 12, 17, 25, 30, 41, 43,
912 + 9, 11, 18, 24, 31, 40, 44, 53,
913 + 10, 19, 23, 32, 39, 45, 52, 54,
914 + 20, 22, 33, 38, 46, 51, 55, 60,
915 + 21, 34, 37, 47, 50, 56, 59, 61,
916 + 35, 36, 48, 49, 57, 58, 62, 63
919 +static PREC aaidct[8] = {
920 + IFIX(0.3535533906), IFIX(0.4903926402),
921 + IFIX(0.4619397663), IFIX(0.4157348062),
922 + IFIX(0.3535533906), IFIX(0.2777851165),
923 + IFIX(0.1913417162), IFIX(0.0975451610)
927 +static void idctqtab(qin, qout)
933 + for (i = 0; i < 8; i++)
934 + for (j = 0; j < 8; j++)
935 + qout[zig[i * 8 + j]] = qin[zig[i * 8 + j]] *
936 + IMULT(aaidct[i], aaidct[j]);
939 +static void scaleidctqtab(q, sc)
945 + for (i = 0; i < 64; i++)
946 + q[i] = IMULT(q[i], sc);
949 +/****************************************************************/
950 +/************** color decoder ***************/
951 +/****************************************************************/
956 + * YCbCr Color transformation:
958 + * y:0..255 Cb:-128..127 Cr:-128..127
960 + * R = Y + 1.40200 * Cr
961 + * G = Y - 0.34414 * Cb - 0.71414 * Cr
962 + * B = Y + 1.77200 * Cb
967 + * Cg = 0.19421 * Cb + .50937 * Cr;
973 + * Cg = (50 * Cb + 130 * Cr + 128) >> 8;
976 +static void initcol(q)
979 + scaleidctqtab(q[1], IFIX(1.77200));
980 + scaleidctqtab(q[2], IFIX(1.40200));
983 +/* This is optimized for the stupid sun SUNWspro compiler. */
984 +#define STORECLAMP(a,x) \
987 + (unsigned int)(x) >= 256 ? \
988 + ((a) = (x) < 0 ? 0 : 255) \
993 +#define CLAMP(x) ((unsigned int)(x) >= 256 ? ((x) < 0 ? 0 : 255) : (x))
997 +#define CBCRCG(yin, xin) \
999 + cb = outc[0 +yin*8+xin], \
1000 + cr = outc[64+yin*8+xin], \
1001 + cg = (50 * cb + 130 * cr + 128) >> 8 \
1006 +#define CBCRCG(yin, xin) \
1008 + cb = outc[0 +yin*8+xin], \
1009 + cr = outc[64+yin*8+xin], \
1010 + cg = (3 * cb + 8 * cr) >> 4 \
1015 +#define PIC(yin, xin, p, xout) \
1017 + y = outy[(yin) * 8 + xin], \
1018 + STORECLAMP(p[(xout) * 3 + 0], y + cr), \
1019 + STORECLAMP(p[(xout) * 3 + 1], y - cg), \
1020 + STORECLAMP(p[(xout) * 3 + 2], y + cb) \
1023 +#ifdef __LITTLE_ENDIAN
1024 +#define PIC_16(yin, xin, p, xout, add) \
1026 + y = outy[(yin) * 8 + xin], \
1027 + y = ((CLAMP(y + cr + add*2+1) & 0xf8) << 8) | \
1028 + ((CLAMP(y - cg + add ) & 0xfc) << 3) | \
1029 + ((CLAMP(y + cb + add*2+1) ) >> 3), \
1030 + p[(xout) * 2 + 0] = y & 0xff, \
1031 + p[(xout) * 2 + 1] = y >> 8 \
1035 +#define PIC_16(yin, xin, p, xout, add) \
1037 + y = outy[(yin) * 8 + xin], \
1038 + y = ((CLAMP(y + cr + add*2+1) & 0xf8) << 7) | \
1039 + ((CLAMP(y - cg + add*2+1) & 0xf8) << 2) | \
1040 + ((CLAMP(y + cb + add*2+1) ) >> 3), \
1041 + p[(xout) * 2 + 0] = y >> 8, \
1042 + p[(xout) * 2 + 1] = y & 0xff \
1045 +#define PIC_16(yin, xin, p, xout, add) \
1047 + y = outy[(yin) * 8 + xin], \
1048 + y = ((CLAMP(y + cr + add*2+1) & 0xf8) << 8) | \
1049 + ((CLAMP(y - cg + add ) & 0xfc) << 3) | \
1050 + ((CLAMP(y + cb + add*2+1) ) >> 3), \
1051 + p[(xout) * 2 + 0] = y >> 8, \
1052 + p[(xout) * 2 + 1] = y & 0xff \
1057 +#define PIC221111(xin) \
1060 + PIC(xin / 4 * 8 + 0, (xin & 3) * 2 + 0, pic0, xin * 2 + 0), \
1061 + PIC(xin / 4 * 8 + 0, (xin & 3) * 2 + 1, pic0, xin * 2 + 1), \
1062 + PIC(xin / 4 * 8 + 1, (xin & 3) * 2 + 0, pic1, xin * 2 + 0), \
1063 + PIC(xin / 4 * 8 + 1, (xin & 3) * 2 + 1, pic1, xin * 2 + 1) \
1066 +#define PIC221111_16(xin) \
1069 + PIC_16(xin / 4 * 8 + 0, (xin & 3) * 2 + 0, pic0, xin * 2 + 0, 3), \
1070 + PIC_16(xin / 4 * 8 + 0, (xin & 3) * 2 + 1, pic0, xin * 2 + 1, 0), \
1071 + PIC_16(xin / 4 * 8 + 1, (xin & 3) * 2 + 0, pic1, xin * 2 + 0, 1), \
1072 + PIC_16(xin / 4 * 8 + 1, (xin & 3) * 2 + 1, pic1, xin * 2 + 1, 2) \
1075 +static void col221111(out, pic, width)
1077 +unsigned char *pic;
1081 + unsigned char *pic0, *pic1;
1083 + int cr, cg, cb, y;
1086 + pic1 = pic + width;
1088 + outc = out + 64 * 4;
1089 + for (i = 2; i > 0; i--) {
1090 + for (j = 4; j > 0; j--) {
1091 + for (k = 0; k < 8; k++) {
1096 + pic0 += 2 * width;
1097 + pic1 += 2 * width;
1099 + outy += 64 * 2 - 16 * 4;
1103 +static void col221111_16(out, pic, width)
1105 +unsigned char *pic;
1109 + unsigned char *pic0, *pic1;
1111 + int cr, cg, cb, y;
1114 + pic1 = pic + width;
1116 + outc = out + 64 * 4;
1117 + for (i = 2; i > 0; i--) {
1118 + for (j = 4; j > 0; j--) {
1119 + for (k = 0; k < 8; k++) {
1124 + pic0 += 2 * width;
1125 + pic1 += 2 * width;
1127 + outy += 64 * 2 - 16 * 4;
1130 diff -ruN linux-2.4.31/drivers/video/fbcon-jpegdec.h linux-2.4.31-bs/drivers/video/fbcon-jpegdec.h
1131 --- linux-2.4.31/drivers/video/fbcon-jpegdec.h 1970-01-01 01:00:00.000000000 +0100
1132 +++ linux-2.4.31-bs/drivers/video/fbcon-jpegdec.h 2005-05-06 11:23:55.000000000 +0100
1134 +#define ERR_NO_SOI 1
1135 +#define ERR_NOT_8BIT 2
1136 +#define ERR_HEIGHT_MISMATCH 3
1137 +#define ERR_WIDTH_MISMATCH 4
1138 +#define ERR_BAD_WIDTH_OR_HEIGHT 5
1139 +#define ERR_TOO_MANY_COMPPS 6
1140 +#define ERR_ILLEGAL_HV 7
1141 +#define ERR_QUANT_TABLE_SELECTOR 8
1142 +#define ERR_NOT_YCBCR_221111 9
1143 +#define ERR_UNKNOWN_CID_IN_SCAN 10
1144 +#define ERR_NOT_SEQUENTIAL_DCT 11
1145 +#define ERR_WRONG_MARKER 12
1146 +#define ERR_NO_EOI 13
1147 +#define ERR_BAD_TABLES 14
1148 +#define ERR_DEPTH_MISMATCH 15
1150 +struct jpeg_decdata {
1151 + int dcts[6 * 64 + 16];
1153 + int dquant[3][64];
1156 +extern int jpeg_decode(unsigned char *, unsigned char *, int, int, int, struct jpeg_decdata *);
1157 +extern int jpeg_check_size(unsigned char *, int, int);
1158 diff -ruN linux-2.4.31/drivers/video/fbcon-splash.c linux-2.4.31-bs/drivers/video/fbcon-splash.c
1159 --- linux-2.4.31/drivers/video/fbcon-splash.c 1970-01-01 01:00:00.000000000 +0100
1160 +++ linux-2.4.31-bs/drivers/video/fbcon-splash.c 2005-05-06 11:24:52.000000000 +0100
1163 + * linux/drivers/video/fbcon-splash.c - splash screen handling functions.
1165 + * (w) 2001-2003 by Volker Poplawski, <volker@suse.de>
1166 + * Stefan Reinauer, <stepan@suse.de>
1167 + * Steffen Winterfeldt, <snwint@suse.de>
1169 + * Ideas & SuSE screen work by Ken Wimer, <wimer@suse.de>
1172 +#include <linux/version.h>
1173 +#include <linux/config.h>
1174 +#include <linux/module.h>
1175 +#include <linux/fb.h>
1176 +#include <linux/vt_kern.h>
1177 +#include <linux/vmalloc.h>
1179 +#include <asm/irq.h>
1180 +#include <asm/system.h>
1182 +#include <video/fbcon.h>
1183 +#include <video/font.h>
1184 +#include <video/fbcon-cfb16.h> /* for fbcon_cfb16 */
1186 +#include "fbcon-splash.h"
1187 +#include "fbcon-jpegdec.h"
1189 +#define SPLASH_VERSION "3.0.7-2003/03/10"
1191 +#ifdef CONFIG_BLK_DEV_INITRD
1192 +unsigned char signature[] = "BOOTSPL1SPL2SPL3";
1195 +/* from drivers/char/console.c */
1196 +extern void con_remap_def_color(int currcons, int new_color);
1198 +/* from drivers/video/fbcon-splash16.c */
1199 +extern void splashfill(u8 *dest, u8 *src, int width, int height,
1200 + int dest_linesize, int src_linesize);
1202 +/* internal control states and data pointers */
1203 +struct splash_data splash_data;
1205 +unsigned char *linux_splash; /* decoded picture */
1206 +int linux_splash_size = 0;
1208 +static struct jpeg_decdata *decdata = 0; /* private decoder data */
1210 +int splash_bytes; /* bytes per line in linux_splash */
1211 +int splash_shown = 0; /* is the splash onscreen? */
1212 +int splash_usesilent = 0; /* shall we display the silentjpeg */
1213 +int splash_default = 0xf01;
1215 +static int splash_status(struct display *p);
1216 +static int splash_recolor(struct display *p);
1217 +static int splash_check_jpeg(unsigned char *jpeg, int width, int height, int depth);
1219 +extern struct display_switch fbcon_splash16;
1221 +int __init splash_init(char *options)
1223 + if(!strncmp("silent",options,6)) {
1224 + printk(KERN_INFO "bootsplash: silent mode.\n");
1225 + splash_usesilent = 1;
1226 + /* skip "silent," */
1227 + if (strlen(options)==6)
1231 + if(!strncmp("verbose",options,7)) {
1232 + printk(KERN_INFO "bootsplash: verbose mode.\n");
1233 + splash_usesilent = 0;
1237 + splash_default = simple_strtoul(options, NULL, 0);
1242 +__setup("splash=", splash_init);
1245 +static int splash_hasinter(unsigned char *buf, int num)
1247 + unsigned char *bufend = buf + num * 12;
1248 + while(buf < bufend) {
1249 + if (buf[1] > 127) /* inter? */
1251 + buf += buf[3] > 127 ? 24 : 12; /* blend? */
1256 +static int boxextract(unsigned char *buf, unsigned short *dp, unsigned char *cols, int *blendp)
1258 + dp[0] = buf[0] | buf[1] << 8;
1259 + dp[1] = buf[2] | buf[3] << 8;
1260 + dp[2] = buf[4] | buf[5] << 8;
1261 + dp[3] = buf[6] | buf[7] << 8;
1262 + *(unsigned int *)(cols + 0) =
1263 + *(unsigned int *)(cols + 4) =
1264 + *(unsigned int *)(cols + 8) =
1265 + *(unsigned int *)(cols + 12) = *(unsigned int *)(buf + 8);
1266 + if (dp[1] > 32767) {
1268 + *(unsigned int *)(cols + 4) = *(unsigned int *)(buf + 12);
1269 + *(unsigned int *)(cols + 8) = *(unsigned int *)(buf + 16);
1270 + *(unsigned int *)(cols + 12) = *(unsigned int *)(buf + 20);
1277 +static void boxit(unsigned char *pic, int bytes, unsigned char *buf, int num, int percent, int overpaint)
1279 + int x, y, i, p, doblend, r, g, b, a, add;
1280 + unsigned short data1[4];
1281 + unsigned char cols1[16];
1282 + unsigned short data2[4];
1283 + unsigned char cols2[16];
1284 + unsigned char *bufend;
1285 + unsigned short *picp;
1289 + bufend = buf + num * 12;
1290 + while(buf < bufend) {
1292 + buf += boxextract(buf, data1, cols1, &doblend);
1293 + if (data1[0] > 32767)
1294 + buf += boxextract(buf, data2, cols2, &doblend);
1295 + if (data1[2] > 32767) {
1298 + data1[2] = ~data1[2];
1300 + if (data1[3] > 32767) {
1301 + if (percent == 65536)
1303 + data1[3] = ~data1[3];
1305 + if (data1[0] > 32767) {
1306 + data1[0] = ~data1[0];
1307 + for (i = 0; i < 4; i++)
1308 + data1[i] = (data1[i] * (65536 - percent) + data2[i] * percent) >> 16;
1309 + for (i = 0; i < 16; i++)
1310 + cols1[i] = (cols1[i] * (65536 - percent) + cols2[i] * percent) >> 16;
1312 + *(unsigned int *)cols2 = *(unsigned int *)cols1;
1314 + if (a == 0 && !doblend)
1316 + for (y = data1[1]; y <= data1[3]; y++) {
1318 + if ((p = data1[3] - data1[1]) != 0)
1319 + p = ((y - data1[1]) << 16) / p;
1320 + for (i = 0; i < 8; i++)
1321 + cols2[i + 8] = (cols1[i] * (65536 - p) + cols1[i + 8] * p) >> 16;
1323 + add = (data1[0] & 1);
1324 + add ^= (add ^ y) & 1 ? 1 : 3; /* 2x2 ordered dithering */
1325 + picp = (unsigned short *)(pic + data1[0] * 2 + y * bytes);
1326 + for (x = data1[0]; x <= data1[2]; x++) {
1328 + if ((p = data1[2] - data1[0]) != 0)
1329 + p = ((x - data1[0]) << 16) / p;
1330 + for (i = 0; i < 4; i++)
1331 + cols2[i] = (cols2[i + 8] * (65536 - p) + cols2[i + 12] * p) >> 16;
1339 + r = ((i >> 8 & 0xf8) * (255 - a) + r * a) / 255;
1340 + g = ((i >> 3 & 0xfc) * (255 - a) + g * a) / 255;
1341 + b = ((i << 3 & 0xf8) * (255 - a) + b * a) / 255;
1343 + #define CLAMP(x) ((x) >= 256 ? 255 : (x))
1344 + i = ((CLAMP(r + add*2+1) & 0xf8) << 8) |
1345 + ((CLAMP(g + add ) & 0xfc) << 3) |
1346 + ((CLAMP(b + add*2+1) ) >> 3);
1354 +static int splash_check_jpeg(unsigned char *jpeg, int width, int height, int depth)
1357 + unsigned char *mem;
1359 + size = ((width + 15) & ~15) * ((height + 15) & ~15) * (depth >> 3);
1360 + mem = vmalloc(size);
1362 + printk(KERN_INFO "No memory for decoded picture!\n");
1366 + decdata = vmalloc(sizeof(*decdata));
1367 + if ((err = jpeg_decode(jpeg, mem, ((width + 15) & ~15), ((height + 15) & ~15), depth, decdata)))
1368 + printk(KERN_INFO "error %d while decompressing picture.\n",err);
1370 + return err ? -1 : 0;
1373 +static void splash_free(struct display * p)
1375 + if (!p->splash_data)
1377 + if (p->splash_data->oldscreen_base)
1378 + p->screen_base = p->splash_data->oldscreen_base;
1379 + if (p->splash_data->olddispsw)
1380 + p->dispsw = p->splash_data->olddispsw;
1381 + if (p->splash_data->splash_silentjpeg)
1382 + vfree(p->splash_data->splash_sboxes);
1383 + vfree(p->splash_data);
1384 + p->splash_data = 0;
1387 +static int splash_mkpenguin(struct splash_data *data, int pxo, int pyo, int pwi, int phe, int pr, int pg, int pb)
1389 + unsigned char *buf;
1392 + if (pwi ==0 || phe == 0)
1394 + buf = (unsigned char *)data + sizeof(*data);
1398 + *buf++ = pxo >> 8;
1400 + *buf++ = pyo >> 8;
1402 + *buf++ = pwi >> 8;
1404 + *buf++ = phe >> 8;
1409 + for (i = 0; i < 12; i++, buf++)
1417 +int splash_getraw(unsigned char *start, unsigned char *end)
1419 + unsigned char *ndata;
1421 + int splash_size = 0;
1422 + void *splash_start = 0;
1424 + int width = 0, height = 0;
1427 + int sboxcount = 0;
1429 + struct display *p;
1431 + printk(KERN_INFO "Looking for splash picture...");
1433 + p = &fb_display[0];
1436 + for (ndata = start; ndata < end; ndata++) {
1437 + if (*((unsigned int *)ndata) != *((unsigned int *)signature))
1439 + if (*((unsigned int *)(ndata+4))==*((unsigned int *)(signature+4))) {
1442 + p = &fb_display[0];
1443 + width = p->var.xres;
1444 + height = p->var.yres;
1446 + splash_size = ndata[16] + (ndata[17] << 8) + (ndata[18] << 16) + (ndata[19] << 24);
1447 + if (ndata + 20 + splash_size > end) {
1448 + printk(" found, but truncated!\n");
1451 + if (!jpeg_check_size(ndata + 20, width, height)) {
1452 + ndata += 20 - 1 + splash_size;
1455 + if (splash_check_jpeg(ndata + 20, width, height, p->var.bits_per_pixel))
1457 + if (p->splash_data)
1459 + p->splash_data = vmalloc(sizeof(*p->splash_data) + splash_size + 24);
1460 + if (!p->splash_data)
1463 + p->splash_data->oldscreen_base = 0;
1464 + p->splash_data->olddispsw = 0;
1465 + p->splash_data->splash_silentjpeg = 0;
1467 + p->splash_data->splash_text_xo = ndata[ 8] + (ndata[ 9] << 8);
1468 + p->splash_data->splash_text_yo = ndata[10] + (ndata[11] << 8);
1469 + p->splash_data->splash_text_wi = ndata[12] + (ndata[13] << 8);
1470 + p->splash_data->splash_text_he = ndata[14] + (ndata[15] << 8);
1471 + /* use 8x16 font... */
1472 + p->splash_data->splash_text_xo *= 8;
1473 + p->splash_data->splash_text_wi *= 8;
1474 + p->splash_data->splash_text_yo *= 16;
1475 + p->splash_data->splash_text_he *= 16;
1476 + p->splash_data->splash_color = (splash_default >> 8) & 0x0f;
1477 + p->splash_data->splash_fg_color = (splash_default >> 4) & 0x0f;
1478 + p->splash_data->splash_state = splash_default & 1;
1479 + p->splash_data->splash_percent = 0;
1480 + p->splash_data->splash_overpaintok = 0;
1481 + boxcount = splash_mkpenguin(p->splash_data, p->splash_data->splash_text_xo + 10, p->splash_data->splash_text_yo + 10, p->splash_data->splash_text_wi - 20, p->splash_data->splash_text_he - 20, 0xf0, 0xf0, 0xf0);
1482 + splash_start = ndata + 20;
1486 + if (*((unsigned int *)(ndata + 4)) == *((unsigned int *)(signature+8))) {
1489 + if (unit >= MAX_NR_CONSOLES)
1492 + vc_allocate(unit);
1493 + p = &fb_display[unit];
1494 + width = fb_display[unit].var.xres;
1495 + height = fb_display[unit].var.yres;
1496 + splash_size = ndata[12] + (ndata[13] << 8) + (ndata[14] << 16) + (ndata[15] << 24);
1497 + if (splash_size == -1) {
1498 + printk(" found, updating values.\n");
1499 + if (p->splash_data) {
1500 + if (ndata[9] != 255)
1501 + p->splash_data->splash_state = ndata[9];
1502 + if (ndata[10] != 255)
1503 + p->splash_data->splash_fg_color = ndata[10];
1504 + if (ndata[11] != 255)
1505 + p->splash_data->splash_color = ndata[11];
1509 + if (splash_size == 0) {
1510 + printk(" found, freeing memory.\n");
1511 + if (p->splash_data)
1515 + if (ndata + 35 + splash_size > end) {
1516 + printk(" found, but truncated!\n");
1519 + if (!jpeg_check_size(ndata + 35, width, height)) {
1520 + ndata += 35 - 1 + splash_size;
1523 + if (splash_check_jpeg(ndata + 35, width, height, p->var.bits_per_pixel))
1525 + if (p->splash_data)
1527 + p->splash_data = vmalloc(sizeof(*p->splash_data) + splash_size + 24);
1528 + if (!p->splash_data)
1531 + p->splash_data->oldscreen_base = 0;
1532 + p->splash_data->olddispsw = 0;
1533 + p->splash_data->splash_silentjpeg = 0;
1535 + p->splash_data->splash_state = ndata[9];
1536 + p->splash_data->splash_fg_color = ndata[10];
1537 + p->splash_data->splash_color = ndata[11];
1538 + p->splash_data->splash_text_xo = ndata[16] + (ndata[17] << 8);
1539 + p->splash_data->splash_text_yo = ndata[18] + (ndata[19] << 8);
1540 + p->splash_data->splash_text_wi = ndata[20] + (ndata[21] << 8);
1541 + p->splash_data->splash_text_he = ndata[22] + (ndata[23] << 8);
1542 + p->splash_data->splash_percent = 0;
1543 + p->splash_data->splash_overpaintok = 0;
1544 + boxcount = splash_mkpenguin(p->splash_data, ndata[24] + (ndata[25] << 8), ndata[26] + (ndata[27] << 8), ndata[28] + (ndata[29] << 8), ndata[30] + (ndata[31] << 8), ndata[32], ndata[33], ndata[34]);
1545 + splash_start = ndata + 35;
1549 + if (*((unsigned int *)(ndata + 4)) == *((unsigned int *)(signature+12))) {
1552 + if (unit >= MAX_NR_CONSOLES)
1555 + vc_allocate(unit);
1556 + p = &fb_display[unit];
1557 + width = p->var.xres;
1558 + height = p->var.yres;
1559 + splash_size = ndata[12] + (ndata[13] << 8) + (ndata[14] << 16) + (ndata[15] << 24);
1560 + if (splash_size == -1) {
1561 + printk(" found, updating values.\n");
1562 + if (p->splash_data) {
1563 + if (ndata[9] != 255)
1564 + p->splash_data->splash_state = ndata[9];
1565 + if (ndata[10] != 255)
1566 + p->splash_data->splash_fg_color = ndata[10];
1567 + if (ndata[11] != 255)
1568 + p->splash_data->splash_color = ndata[11];
1572 + if (splash_size == 0) {
1573 + printk(" found, freeing memory.\n");
1574 + if (p->splash_data)
1578 + boxcount = ndata[24] + (ndata[25] << 8);
1579 + palcnt = ndata[37] * 3;
1580 + if (ndata + 38 + splash_size > end) {
1581 + printk(" found, but truncated!\n");
1584 + if (!jpeg_check_size(ndata + 38 + boxcount * 12 + palcnt, width, height)) {
1585 + ndata += 38 - 1 + splash_size;
1588 + if (splash_check_jpeg(ndata + 38 + boxcount * 12 + palcnt, width, height, p->var.bits_per_pixel))
1590 + silentsize = ndata[28] + (ndata[29] << 8) + (ndata[30] << 16) + (ndata[31] << 24);
1592 + printk(" silenjpeg size %d bytes,", silentsize);
1593 + if (silentsize >= splash_size) {
1594 + printk(" bigger than splashsize!\n");
1597 + splash_size -= silentsize;
1598 + if (!splash_usesilent || !p->fb_info->fbops->fb_get_fix ) {
1601 + struct fb_fix_screeninfo fix;
1602 + p->fb_info->fbops->fb_get_fix(&fix, unit, 0);
1603 + if (height * 2 * p->next_line > fix.smem_len) {
1604 + printk(" does not fit into framebuffer.\n");
1609 + sboxcount = ndata[32] + (ndata[33] << 8);
1611 + char *simage=ndata + 38 + splash_size + 12 * sboxcount;
1612 + if (!jpeg_check_size(simage, width, height) ||
1613 + splash_check_jpeg(simage, width, height, p->var.bits_per_pixel)) {
1614 + printk(" error in silent jpeg.\n");
1618 + if (p->splash_data)
1620 + p->splash_data = vmalloc(sizeof(*p->splash_data) + splash_size);
1621 + if (!p->splash_data)
1623 + p->splash_data->oldscreen_base = 0;
1624 + p->splash_data->olddispsw = 0;
1625 + p->splash_data->splash_silentjpeg = 0;
1627 + p->splash_data->splash_silentjpeg = vmalloc(silentsize);
1628 + if (p->splash_data->splash_silentjpeg) {
1629 + memcpy(p->splash_data->splash_silentjpeg, ndata + 38 + splash_size, silentsize);
1630 + p->splash_data->splash_sboxes = p->splash_data->splash_silentjpeg;
1631 + p->splash_data->splash_silentjpeg += 12 * sboxcount;
1632 + p->splash_data->splash_sboxcount = sboxcount;
1635 + p->splash_data->splash_state = ndata[9];
1636 + p->splash_data->splash_fg_color = ndata[10];
1637 + p->splash_data->splash_color = ndata[11];
1638 + p->splash_data->splash_overpaintok = ndata[36];
1639 + p->splash_data->splash_text_xo = ndata[16] + (ndata[17] << 8);
1640 + p->splash_data->splash_text_yo = ndata[18] + (ndata[19] << 8);
1641 + p->splash_data->splash_text_wi = ndata[20] + (ndata[21] << 8);
1642 + p->splash_data->splash_text_he = ndata[22] + (ndata[23] << 8);
1643 + p->splash_data->splash_percent = ndata[34] + (ndata[35] << 8);
1644 + p->splash_data->splash_percent += p->splash_data->splash_percent > 32767;
1645 + splash_start = ndata + 38;
1652 + printk(" no good signature found.\n");
1655 + if (p->splash_data->splash_text_xo + p->splash_data->splash_text_wi > width || p->splash_data->splash_text_yo + p->splash_data->splash_text_he > height) {
1657 + p->splash_data = 0;
1658 + printk(" found, but has oversized text area!\n");
1661 + if (p->dispsw->setup != fbcon_cfb16.setup) {
1663 + p->splash_data = 0;
1664 + printk(" found, but framebuffer can't handle it!\n");
1667 + printk(" found (%dx%d, %d bytes, v%d).\n", width, height, splash_size, found);
1670 + printk(KERN_WARNING "bootsplash: Using deprecated v1 header. Updating your splash utility recommended.\n");
1671 + printk(KERN_INFO "bootsplash: Find the latest version at ftp.suse.com/pub/people/stepan/bootsplash/\n");
1674 + /* copy data so that initrd memory can be freed. */
1675 + memcpy((char *)p->splash_data + sizeof(*p->splash_data) + (found < 3 ? boxcount * 12 : 0), splash_start, splash_size);
1676 + p->splash_data->splash_boxcount = boxcount;
1677 + p->splash_data->splash_boxes = (unsigned char *)p->splash_data + sizeof(*p->splash_data);
1678 + p->splash_data->splash_jpeg = (unsigned char *)p->splash_data + sizeof(*p->splash_data) + boxcount * 12 + palcnt;
1679 + p->splash_data->splash_palette = (unsigned char *)p->splash_data + sizeof(*p->splash_data) + boxcount * 12;
1680 + p->splash_data->splash_palcnt = palcnt / 3;
1681 + p->splash_data->splash_dosilent = p->splash_data->splash_silentjpeg != 0;
1685 +int splash_verbose(void)
1687 + struct display *p;
1689 + p = &fb_display[0];
1690 + if (!p || !p->splash_data || !p->splash_data->splash_state || !p->conp)
1692 + if (fg_console != p->conp->vc_num)
1694 + if (!p->splash_data->splash_silentjpeg || !p->splash_data->splash_dosilent)
1696 + if (!p->splash_data->oldscreen_base)
1699 + p->splash_data->splash_dosilent = 0;
1701 + splashfill(p->splash_data->oldscreen_base, p->screen_base, p->var.xres, p->var.yres, p->next_line, p->next_line);
1702 + p->screen_base = p->splash_data->oldscreen_base;
1707 +static void splash_off(struct display *p)
1709 + if (p->splash_data && p->splash_data->oldscreen_base)
1710 + p->screen_base = p->splash_data->oldscreen_base;
1711 + if (p->splash_data && p->splash_data->olddispsw)
1712 + p->dispsw = p->splash_data->olddispsw;
1716 +int splash_prepare(struct display *p)
1719 + int width, height, depth, size, sbytes;
1721 + if (!p->splash_data || !p->splash_data->splash_state) {
1723 + vfree(linux_splash);
1728 + linux_splash_size = 0;
1733 + width = p->var.xres;
1734 + height = p->var.yres;
1735 + depth = p->var.bits_per_pixel;
1736 + if (depth != 16) { /* Other targets might need fixing */
1741 + sbytes = ((width + 15) & ~15) * (depth >> 3);
1742 + size = sbytes * ((height + 15) & ~15);
1743 + if (size != linux_splash_size) {
1745 + vfree(linux_splash);
1746 + linux_splash_size = 0;
1750 + if (!linux_splash)
1751 + linux_splash = vmalloc(size);
1753 + if (!linux_splash) {
1754 + linux_splash_size = 0;
1755 + printk(KERN_INFO "Not enough memory for splash screen.\n");
1761 + decdata = vmalloc(sizeof(*decdata));
1763 + if (!p->splash_data->oldscreen_base)
1764 + p->splash_data->oldscreen_base = p->screen_base;
1766 + if (p->splash_data->splash_silentjpeg && p->splash_data->splash_dosilent) {
1767 + printk(KERN_INFO "Got silent jpeg.\n");
1768 + /* fill area after framebuffer with other jpeg */
1769 + if ((err = jpeg_decode(p->splash_data->splash_silentjpeg, linux_splash,
1770 + ((width + 15) & ~15), ((height + 15) & ~15), depth, decdata))) {
1771 + printk(KERN_INFO "Error %d while decompressing silent jpeg.\n", err);
1772 + p->screen_base = p->splash_data->oldscreen_base;
1773 + p->splash_data->splash_dosilent = 0;
1775 + if (p->splash_data->splash_sboxcount)
1776 + boxit(linux_splash, sbytes, p->splash_data->splash_sboxes,
1777 + p->splash_data->splash_sboxcount, p->splash_data->splash_percent, 0);
1779 + splashfill(p->screen_base, linux_splash, p->var.xres, p->var.yres, p->next_line, sbytes);
1780 + p->screen_base = p->splash_data->oldscreen_base + p->next_line * p->var.yres;
1783 + p->screen_base = p->splash_data->oldscreen_base;
1785 + if ((err = jpeg_decode(p->splash_data->splash_jpeg, linux_splash,
1786 + ((width + 15) & ~15), ((height + 15) & ~15), depth, decdata))) {
1787 + printk(KERN_INFO "Error %d while decompressing splash screen.\n", err);
1788 + vfree(linux_splash);
1790 + linux_splash_size = 0;
1794 + linux_splash_size = size;
1795 + splash_bytes = sbytes;
1796 + if (p->splash_data->splash_boxcount)
1797 + boxit(linux_splash, sbytes, p->splash_data->splash_boxes, p->splash_data->splash_boxcount, p->splash_data->splash_percent, 0);
1798 + splash_data = *p->splash_data;
1799 + splash_shown = p->splash_data->splash_state;
1800 + if (splash_shown) {
1801 + if (p->dispsw != &fbcon_splash16)
1802 + p->splash_data->olddispsw = p->dispsw;
1803 + p->dispsw = &fbcon_splash16;
1810 +#ifdef CONFIG_PROC_FS
1811 +#include <linux/proc_fs.h>
1813 +struct proc_dir_entry *proc_splash;
1814 +int splash_read_proc(char *buffer, char **start, off_t offset, int size,
1815 + int *eof, void *data);
1816 +int splash_write_proc(struct file *file, const char *buffer,
1817 + unsigned long count, void *data);
1819 +int splash_read_proc(char *buffer, char **start, off_t offset, int size,
1820 + int *eof, void *data)
1825 + struct display *p = &fb_display[0];
1827 + int color = p->splash_data ? p->splash_data->splash_color << 4 |
1828 + p->splash_data->splash_fg_color : splash_default >> 4;
1829 + int status = p->splash_data ? p->splash_data->splash_state & 1 : 0;
1830 + len += sprintf(buffer + len, "Splash screen v%s (0x%02x, %dx%d%s): %s\n",
1831 + SPLASH_VERSION, color, p->var.xres, p->var.yres,
1832 + (p->splash_data ? p->splash_data->splash_dosilent : 0)? ", silent" : "",
1833 + status ? "on" : "off");
1834 + if (offset >= begin + len)
1837 + *start = buffer + (begin - offset);
1839 + return (size < begin + len - offset ? size : begin + len - offset);
1842 +static int splash_recolor(struct display *p)
1844 + if (!p->splash_data)
1846 + if (!p->splash_data->splash_state)
1848 + con_remap_def_color(p->conp->vc_num, p->splash_data->splash_color << 4 | p->splash_data->splash_fg_color);
1849 + if (fg_console == p->conp->vc_num) {
1850 + splash_data = *p->splash_data;
1851 + update_region(fg_console,
1852 + p->conp->vc_origin +
1853 + p->conp->vc_size_row *
1855 + p->conp->vc_size_row *
1856 + (p->conp->vc_bottom -
1857 + p->conp->vc_top) / 2);
1862 +static int splash_status(struct display *p)
1864 + printk(KERN_INFO "Splash status on console %d changed to %s\n", p->conp->vc_num, p->splash_data && p->splash_data->splash_state ? "on" : "off");
1866 + if (fg_console == p->conp->vc_num)
1867 + splash_prepare(p);
1868 + if (p->splash_data && p->splash_data->splash_state) {
1869 + con_remap_def_color(p->conp->vc_num, p->splash_data->splash_color << 4 | p->splash_data->splash_fg_color);
1870 + /* resize_con also calls con_switch which resets yscroll */
1871 + vc_resize_con(p->splash_data->splash_text_he / fontheight(p),
1872 + p->splash_data->splash_text_wi / fontwidth(p),
1874 + if (fg_console == p->conp->vc_num) {
1875 + update_region(fg_console,
1876 + p->conp->vc_origin +
1877 + p->conp->vc_size_row *
1879 + p->conp->vc_size_row *
1880 + (p->conp->vc_bottom -
1881 + p->conp->vc_top) / 2);
1882 + fbcon_splash16.clear_margins(p->conp, p, 0);
1885 + /* Switch bootsplash off */
1886 + con_remap_def_color(p->conp->vc_num, 0x07);
1887 + vc_resize_con(p->var.yres / fontheight(p),
1888 + p->var.xres / fontwidth(p),
1894 +int splash_write_proc(struct file *file, const char *buffer,
1895 + unsigned long count, void *data)
1898 + struct display *p;
1900 + if (!buffer || !splash_default)
1903 + if (!strncmp(buffer, "show", 4) || !strncmp(buffer, "hide", 4)) {
1906 + p = &fb_display[0];
1907 + if (buffer[4] == ' ' && buffer[5] == 'p')
1909 + else if (buffer[4] == '\n')
1912 + pe = simple_strtoul(buffer + 5, NULL, 0);
1917 + if (*buffer == 'h')
1920 + if (p->splash_data && p->splash_data->splash_percent != pe) {
1921 + p->splash_data->splash_percent = pe;
1922 + if (fg_console != p->conp->vc_num || !p->splash_data->splash_state)
1924 + if (!p->splash_data->splash_overpaintok || p->splash_data->splash_percent == 65536) {
1925 + if (splash_hasinter(p->splash_data->splash_boxes, p->splash_data->splash_boxcount))
1928 + splash_prepare(p);
1930 + if (p->splash_data->splash_silentjpeg && p->splash_data->splash_dosilent && p->splash_data->oldscreen_base)
1931 + boxit(p->splash_data->oldscreen_base, p->next_line, p->splash_data->splash_sboxes, p->splash_data->splash_sboxcount, p->splash_data->splash_percent, 1);
1932 + boxit(p->screen_base, p->next_line, p->splash_data->splash_boxes, p->splash_data->splash_boxcount, p->splash_data->splash_percent, 1);
1937 + if (!strncmp(buffer,"silent\n",7) || !strncmp(buffer,"verbose\n",8)) {
1938 + p = &fb_display[0];
1939 + if (p->splash_data && p->splash_data->splash_silentjpeg) {
1940 + if (p->splash_data->splash_dosilent != (buffer[0] == 's')) {
1941 + p->splash_data->splash_dosilent = buffer[0] == 's';
1947 + if (!strncmp(buffer,"freesilent\n",11)) {
1948 + p = &fb_display[0];
1949 + if (p->splash_data && p->splash_data->splash_silentjpeg) {
1950 + printk(KERN_INFO "bootsplash: freeing silent jpeg\n");
1951 + p->splash_data->splash_silentjpeg = 0;
1952 + vfree(p->splash_data->splash_sboxes);
1953 + p->splash_data->splash_sboxes = 0;
1954 + p->splash_data->splash_sboxcount = 0;
1955 + if (p->splash_data->splash_dosilent)
1957 + p->splash_data->splash_dosilent = 0;
1962 + if (!strncmp(buffer, signature, 7)) {
1963 + unit = splash_getraw((unsigned char *)buffer, (unsigned char *)buffer + count);
1965 + p = &fb_display[unit];
1970 + p = &fb_display[0];
1971 + if (!p->splash_data)
1973 + if (buffer[0] == 't') {
1974 + p->splash_data->splash_state ^= 1;
1978 + new = simple_strtoul(buffer, NULL, 0);
1981 + p->splash_data->splash_color = new >> 8 & 0xff;
1982 + p->splash_data->splash_fg_color = new >> 4 & 0x0f;
1984 + if ((new & 1) == p->splash_data->splash_state)
1985 + splash_recolor(p);
1987 + p->splash_data->splash_state = new & 1;
1993 +int splash_proc_register(void)
1995 + if ((proc_splash = create_proc_entry("splash", 0, 0))) {
1996 + proc_splash->read_proc = splash_read_proc;
1997 + proc_splash->write_proc = splash_write_proc;
2003 +int splash_proc_unregister(void)
2006 + remove_proc_entry("splash", 0);
2010 diff -ruN linux-2.4.31/drivers/video/fbcon-splash.h linux-2.4.31-bs/drivers/video/fbcon-splash.h
2011 --- linux-2.4.31/drivers/video/fbcon-splash.h 1970-01-01 01:00:00.000000000 +0100
2012 +++ linux-2.4.31-bs/drivers/video/fbcon-splash.h 2005-05-06 11:25:18.000000000 +0100
2015 + * linux/drivers/video/splash.h - splash screen definition.
2017 + * (w) 2001-2003 by Volker Poplawski, <volker@suse.de>
2018 + * Stefan Reinauer, <stepan@suse.de>
2021 + * idea and SuSE screen work by Ken Wimer, <wimer@suse.de>
2024 +extern int splash_getraw(unsigned char *, unsigned char *);
2025 +extern int splash_prepare(struct display *);
2027 +extern int splash_shown; /* is splash shown? */
2028 +extern struct splash_data splash_data; /* image data, copied over
2030 +extern unsigned char *linux_splash; /* decoded pic data */
2031 +extern int splash_bytes; /* bytes per line */
2032 diff -ruN linux-2.4.31/drivers/video/fbcon-splash16.c linux-2.4.31-bs/drivers/video/fbcon-splash16.c
2033 --- linux-2.4.31/drivers/video/fbcon-splash16.c 1970-01-01 01:00:00.000000000 +0100
2034 +++ linux-2.4.31-bs/drivers/video/fbcon-splash16.c 2005-05-06 11:24:19.000000000 +0100
2037 + * linux/drivers/video/fbcon-splash16.c -- Low level frame buffer operations for 16 bpp
2038 + * framebuffer operation. Modified to present
2039 + * boot splash screen. 2002/11/7 stepan@suse.de
2041 + * Based on linux/drivers/video/fbcon-cfb16.c, which is
2043 + * Created 5 Apr 1997 by Geert Uytterhoeven
2045 + * This file is subject to the terms and conditions of the GNU General Public
2046 + * License. See the file COPYING in the main directory of this archive for
2050 +#include <linux/module.h>
2051 +#include <linux/config.h>
2052 +#include <linux/tty.h>
2053 +#include <linux/console.h>
2054 +#include <linux/string.h>
2055 +#include <linux/fb.h>
2056 +#include <asm/io.h>
2058 +#include <video/fbcon.h>
2059 +#include <video/fbcon-cfb16.h>
2061 +#include "fbcon-splash.h"
2064 + * 16 bpp packed pixels
2067 +static u32 tab_cfb16[] = {
2068 +#if defined(__BIG_ENDIAN)
2069 + 0x00000000, 0x0000ffff, 0xffff0000, 0xffffffff
2070 +#elif defined(__LITTLE_ENDIAN)
2071 + 0x00000000, 0xffff0000, 0x0000ffff, 0xffffffff
2073 +#error FIXME: No endianness??
2077 +void fbcon_splash16_bmove(struct display *p, int sy, int sx, int dy, int dx,
2078 + int height, int width)
2080 + int bytes = p->next_line, linesize = bytes * fontheight(p), rows;
2083 + if (sx == 0 && dx == 0 && width * fontwidth(p) * 2 == bytes) {
2084 + fb_memmove(p->screen_base + dy * linesize,
2085 + p->screen_base + sy * linesize,
2086 + height * linesize);
2089 + if (fontwidthlog(p)) {
2090 + sx <<= fontwidthlog(p)+1;
2091 + dx <<= fontwidthlog(p)+1;
2092 + width <<= fontwidthlog(p)+1;
2094 + sx *= fontwidth(p)*2;
2095 + dx *= fontwidth(p)*2;
2096 + width *= fontwidth(p)*2;
2098 + sx += splash_data.splash_text_xo*2 + splash_data.splash_text_yo * bytes;
2099 + dx += splash_data.splash_text_xo*2 + splash_data.splash_text_yo * bytes;
2100 + if (dy < sy || (dy == sy && dx < sx)) {
2101 + src = p->screen_base + sy * linesize + sx;
2102 + dst = p->screen_base + dy * linesize + dx;
2103 + for (rows = height * fontheight(p); rows--;) {
2104 + fb_memmove(dst, src, width);
2109 + src = p->screen_base + (sy+height) * linesize + sx - bytes;
2110 + dst = p->screen_base + (dy+height) * linesize + dx - bytes;
2111 + for (rows = height * fontheight(p); rows--;) {
2112 + fb_memmove(dst, src, width);
2119 +static inline void rectfill(u8 *dest, int width, int height, u32 data,
2126 + while (height-- > 0) {
2127 + u32 *p = (u32 *)dest;
2128 + for (i = 0; i < width/4; i++) {
2129 + fb_writel(data, p++);
2130 + fb_writel(data, p++);
2133 + fb_writel(data, p++);
2135 + fb_writew(data, (u16*)p);
2140 +void splashfill(u8 *dest, u8 *src, int width, int height,
2141 + int dest_linesize, int src_linesize)
2146 + while (height-- > 0) {
2147 + u32 *p = (u32 *)dest;
2148 + u32 *q = (u32 *)src;
2150 + for (i=0; i < width/4; i++) {
2151 + fb_writel(*q++,p++);
2152 + fb_writel(*q++,p++);
2155 + fb_writel(*q++,p++);
2157 + fb_writew(*(u16*)q,(u16*)p);
2158 + dest += dest_linesize;
2159 + src += src_linesize;
2163 +void fbcon_splash16_clear(struct vc_data *conp, struct display *p, int sy, int sx,
2164 + int height, int width)
2167 + int bytes = p->next_line, lines = height * fontheight(p);
2169 + int offset, transparent=0;
2171 + dest = p->screen_base + sy * fontheight(p) * bytes + sx * fontwidth(p) * 2;
2173 + bgx = ((u16 *)p->dispsw_data)[attr_bgcol_ec(p, conp)];
2175 + width *= fontwidth(p)/4;
2177 + dest += splash_data.splash_text_yo * bytes +
2178 + splash_data.splash_text_xo * 2;
2180 + transparent = (splash_data.splash_color == attr_bgcol_ec(p, conp));
2182 + if (transparent) {
2183 + offset = (sy * fontheight(p) + splash_data.splash_text_yo) * splash_bytes +
2184 + (sx * fontwidth(p) + splash_data.splash_text_xo) * 2;
2186 + if ((width * 8 == bytes && splash_bytes == bytes))
2187 + splashfill(dest,linux_splash + offset, lines * width * 4,
2188 + 1, bytes, splash_bytes);
2190 + splashfill(dest,linux_splash + offset, width*4, lines,
2191 + bytes, splash_bytes);
2193 + if (width * 8 == bytes)
2194 + rectfill(dest, lines * width * 4, 1, bgx, bytes);
2196 + rectfill(dest, width * 4, lines, bgx, bytes);
2202 + * Helper function to read the background from the splashscreen
2204 +# define SPLASH_BGX(off) \
2205 + if (transparent) { \
2206 + bgx = *(u32*)(splashbgx + (off)); \
2207 + eorx = fgx ^ bgx; \
2211 +void fbcon_splash16_putc(struct vc_data *conp, struct display *p, int c, int yy,
2214 + u8 *dest, *cdat, bits;
2215 + int bytes = p->next_line, rows;
2216 + u32 eorx, fgx, bgx;
2217 + int transparent = 0;
2218 + u8 *splashbgx = 0;
2220 + dest = p->screen_base + yy * fontheight(p) * bytes + xx * fontwidth(p) * 2;
2222 + fgx = ((u16 *)p->dispsw_data)[attr_fgcol(p, c)];
2223 + bgx = ((u16 *)p->dispsw_data)[attr_bgcol(p, c)];
2225 + transparent = (splash_data.splash_color == attr_bgcol(p, c));
2227 + dest += splash_data.splash_text_xo * 2 + splash_data.splash_text_yo * bytes;
2228 + splashbgx = linux_splash +
2229 + (yy * fontheight(p) + splash_data.splash_text_yo) * splash_bytes +
2230 + (xx * fontwidth(p) + splash_data.splash_text_xo) * 2;
2232 + if (transparent && splash_data.splash_color == 0xf) {
2233 + if (fgx == 0xffea)
2235 + else if (fgx == 0x57ea)
2237 + else if (fgx == 0xffff)
2241 + fgx |= (fgx << 16);
2242 + bgx |= (bgx << 16);
2245 + switch (fontwidth(p)) {
2248 + cdat = p->fontdata + (c & p->charmask) * fontheight(p);
2249 + for (rows = fontheight(p); rows--; dest += bytes) {
2252 + fb_writel((tab_cfb16[bits >> 6] & eorx) ^ bgx, dest);
2254 + fb_writel((tab_cfb16[bits >> 4 & 3] & eorx) ^ bgx, dest+4);
2255 + if (fontwidth(p) == 8) {
2257 + fb_writel((tab_cfb16[bits >> 2 & 3] & eorx) ^ bgx, dest+8);
2259 + fb_writel((tab_cfb16[bits & 3] & eorx) ^ bgx, dest+12);
2262 + splashbgx += splash_bytes;
2268 + cdat = p->fontdata + ((c & p->charmask) * fontheight(p) << 1);
2269 + for (rows = fontheight(p); rows--; dest += bytes) {
2272 + fb_writel((tab_cfb16[bits >> 6] & eorx) ^ bgx, dest);
2274 + fb_writel((tab_cfb16[bits >> 4 & 3] & eorx) ^ bgx, dest+4);
2276 + fb_writel((tab_cfb16[bits >> 2 & 3] & eorx) ^ bgx, dest+8);
2278 + fb_writel((tab_cfb16[bits & 3] & eorx) ^ bgx, dest+12);
2281 + fb_writel((tab_cfb16[bits >> 6] & eorx) ^ bgx, dest+16);
2283 + fb_writel((tab_cfb16[bits >> 4 & 3] & eorx) ^ bgx, dest+20);
2284 + if (fontwidth(p) == 16) {
2286 + fb_writel((tab_cfb16[bits >> 2 & 3] & eorx) ^ bgx, dest+24);
2288 + fb_writel((tab_cfb16[bits & 3] & eorx) ^ bgx, dest+28);
2295 +void fbcon_splash16_putcs(struct vc_data *conp, struct display *p,
2296 + const unsigned short *s, int count, int yy, int xx)
2298 + u8 *cdat, *dest, *dest0;
2300 + int rows, bytes = p->next_line;
2301 + u32 eorx, fgx, bgx;
2302 + int transparent = 0;
2303 + u8 *splashbgx0 = 0, *splashbgx;
2305 + dest0 = p->screen_base + yy * fontheight(p) * bytes + xx * fontwidth(p) * 2;
2307 + fgx = ((u16 *)p->dispsw_data)[attr_fgcol(p, c)];
2308 + bgx = ((u16 *)p->dispsw_data)[attr_bgcol(p, c)];
2310 + transparent = (splash_data.splash_color == attr_bgcol(p, c));
2312 + dest0 += splash_data.splash_text_xo * 2 + splash_data.splash_text_yo * bytes;
2313 + splashbgx0 = linux_splash +
2314 + (yy * fontheight(p) + splash_data.splash_text_yo) * splash_bytes +
2315 + (xx * fontwidth(p) + splash_data.splash_text_xo) * 2;
2317 + if (transparent && splash_data.splash_color == 0xf) {
2318 + if (fgx == 0xffea)
2320 + else if (fgx == 0x57ea)
2322 + else if (fgx == 0xffff)
2326 + fgx |= (fgx << 16);
2327 + bgx |= (bgx << 16);
2330 + switch (fontwidth(p)) {
2334 + c = scr_readw(s++) & p->charmask;
2335 + cdat = p->fontdata + c * fontheight(p);
2337 + splashbgx = splashbgx0;
2339 + for (rows = fontheight(p), dest = dest0; rows--; dest += bytes) {
2340 + u8 bits = *cdat++;
2342 + fb_writel((tab_cfb16[bits >> 6] & eorx) ^ bgx, dest);
2344 + fb_writel((tab_cfb16[bits >> 4 & 3] & eorx) ^ bgx, dest+4);
2345 + if (fontwidth(p) == 8) {
2347 + fb_writel((tab_cfb16[bits >> 2 & 3] & eorx) ^ bgx, dest+8);
2349 + fb_writel((tab_cfb16[bits & 3] & eorx) ^ bgx, dest+12);
2351 + splashbgx += splash_bytes;
2354 + dest0 += fontwidth(p)*2;
2355 + splashbgx0 += fontwidth(p) * 2;
2362 + c = scr_readw(s++) & p->charmask;
2363 + cdat = p->fontdata + (c * fontheight(p) << 1);
2365 + splashbgx = splashbgx0;
2367 + for (rows = fontheight(p), dest = dest0; rows--; dest += bytes) {
2368 + u8 bits = *cdat++;
2370 + fb_writel((tab_cfb16[bits >> 6] & eorx) ^ bgx, dest);
2372 + fb_writel((tab_cfb16[bits >> 4 & 3] & eorx) ^ bgx, dest+4);
2374 + fb_writel((tab_cfb16[bits >> 2 & 3] & eorx) ^ bgx, dest+8);
2376 + fb_writel((tab_cfb16[bits & 3] & eorx) ^ bgx, dest+12);
2379 + fb_writel((tab_cfb16[bits >> 6] & eorx) ^ bgx, dest+16);
2381 + fb_writel((tab_cfb16[bits >> 4 & 3] & eorx) ^ bgx, dest+20);
2382 + if (fontwidth(p) == 16) {
2384 + fb_writel((tab_cfb16[bits >> 2 & 3] & eorx) ^ bgx, dest+24);
2386 + fb_writel((tab_cfb16[bits & 3] & eorx) ^ bgx, dest+28);
2388 + splashbgx += splash_bytes;
2391 + dest0 += fontwidth(p)*2;
2392 + splashbgx0 += fontwidth(p) * 2;
2399 +void fbcon_splash16_revc(struct display *p, int xx, int yy)
2402 + int bytes = p->next_line, rows;
2404 + dest = p->screen_base + yy * fontheight(p) * bytes + xx * fontwidth(p)*2;
2405 + dest += splash_data.splash_text_yo * bytes + splash_data.splash_text_xo * 2;
2407 + for (rows = fontheight(p); rows--; dest += bytes) {
2408 + switch (fontwidth(p)) {
2410 + fb_writel(fb_readl(dest+24) ^ 0xffffffff, dest+24);
2411 + fb_writel(fb_readl(dest+28) ^ 0xffffffff, dest+28);
2412 + /* FALL THROUGH */
2414 + fb_writel(fb_readl(dest+16) ^ 0xffffffff, dest+16);
2415 + fb_writel(fb_readl(dest+20) ^ 0xffffffff, dest+20);
2416 + /* FALL THROUGH */
2418 + fb_writel(fb_readl(dest+8) ^ 0xffffffff, dest+8);
2419 + fb_writel(fb_readl(dest+12) ^ 0xffffffff, dest+12);
2420 + /* FALL THROUGH */
2422 + fb_writel(fb_readl(dest+0) ^ 0xffffffff, dest+0);
2423 + fb_writel(fb_readl(dest+4) ^ 0xffffffff, dest+4);
2428 +void fbcon_splash16_clear_margins(struct vc_data *conp, struct display *p,
2431 + int bytes = p->next_line;
2434 + unsigned int right_start = conp->vc_cols*fontwidth(p);
2435 + unsigned int bottom_start = conp->vc_rows*fontheight(p);
2436 + unsigned int right_width, bottom_width;
2438 + int left_margin_width = splash_data.splash_text_xo;
2439 + int text_width = conp->vc_cols * fontwidth(p);
2440 + int right_margin_width = p->var.xres - text_width - left_margin_width;
2441 + int top_margin_height = splash_data.splash_text_yo;
2442 + int text_height = conp->vc_rows * fontheight(p);
2443 + int bottom_margin_height = p->var.yres - text_height - top_margin_height;
2445 + bgx = ((u16 *)p->dispsw_data)[attr_bgcol_ec(p, conp)];
2447 + if (bottom_only == -1) {
2448 + printk(KERN_DEBUG "Called with bottom-only\n");
2449 + splashfill(p->screen_base, linux_splash, p->var.xres, p->var.yres, bytes, splash_bytes);
2453 + if (!bottom_only && (right_width = p->var.xres-right_start)) {
2455 + splashfill(p->screen_base + top_margin_height * bytes,
2456 + linux_splash + top_margin_height *
2457 + splash_bytes, left_margin_width,
2458 + text_height, bytes, splash_bytes);
2460 + /* right margin */
2461 + splashfill(p->screen_base + left_margin_width*2 + text_width*2 +
2462 + top_margin_height * bytes, linux_splash +
2463 + left_margin_width*2 + text_width*2 + top_margin_height *
2464 + splash_bytes, right_margin_width, text_height,
2465 + bytes, splash_bytes);
2468 + if ((bottom_width = p->var.yres-bottom_start))
2469 + /* bottom margin */
2470 + splashfill(p->screen_base + (top_margin_height + text_height) *
2471 + bytes, linux_splash + (top_margin_height +
2472 + text_height) * splash_bytes, p->var.xres,
2473 + bottom_margin_height, bytes, splash_bytes);
2476 + splashfill(p->screen_base, linux_splash,
2477 + p->var.xres, top_margin_height,
2478 + bytes, splash_bytes);
2480 + /* leave function if work is done */
2486 + * `switch' for the low level operations
2489 +struct display_switch fbcon_splash16 = {
2490 + bmove: fbcon_splash16_bmove,
2491 + clear: fbcon_splash16_clear,
2492 + putc: fbcon_splash16_putc,
2493 + putcs: fbcon_splash16_putcs,
2494 + revc: fbcon_splash16_revc,
2495 + clear_margins: fbcon_splash16_clear_margins,
2496 + fontwidthmask: FONTWIDTH(4)|FONTWIDTH(8)|FONTWIDTH(12)|FONTWIDTH(16)
2501 +MODULE_LICENSE("GPL");
2503 +int init_module(void)
2508 +void cleanup_module(void)
2510 +#endif /* MODULE */
2514 + * Visible symbols for modules
2517 +EXPORT_SYMBOL(fbcon_splash16);
2518 +EXPORT_SYMBOL(fbcon_splash16_bmove);
2519 +EXPORT_SYMBOL(fbcon_splash16_clear);
2520 +EXPORT_SYMBOL(fbcon_splash16_putc);
2521 +EXPORT_SYMBOL(fbcon_splash16_putcs);
2522 +EXPORT_SYMBOL(fbcon_splash16_revc);
2523 +EXPORT_SYMBOL(fbcon_splash16_clear_margins);
2524 diff -ruN linux-2.4.31/drivers/video/fbcon.c linux-2.4.31-bs/drivers/video/fbcon.c
2525 --- linux-2.4.31/drivers/video/fbcon.c 2004-11-17 11:54:21.000000000 +0000
2526 +++ linux-2.4.31-bs/drivers/video/fbcon.c 2005-05-06 11:21:29.000000000 +0100
2528 #include <linux/smp.h>
2529 #include <linux/init.h>
2530 #include <linux/pm.h>
2531 +#include <linux/vmalloc.h>
2533 #include <asm/irq.h>
2534 #include <asm/system.h>
2535 @@ -104,6 +105,23 @@
2536 #include <video/fbcon-mac.h> /* for 6x11 font on mac */
2537 #include <video/font.h>
2539 +#ifdef CONFIG_FBCON_SPLASHSCREEN
2540 +#include <video/fbcon-cfb16.h> /* for fbcon_cfb16 */
2541 +#include "fbcon-splash.h"
2543 +extern void con_remap_def_color(int currcons, int new_color);
2545 +extern int splash_default;
2546 +extern int splash_shown;
2548 +extern struct display_switch fbcon_splash16;
2550 +#ifdef CONFIG_PROC_FS
2551 +int splash_proc_register(void);
2552 +int splash_proc_unregister(void);
2557 # define DPRINTK(fmt, args...) printk(KERN_DEBUG "%s: " fmt, __FUNCTION__ , ## args)
2559 @@ -478,6 +496,10 @@
2563 +#ifdef CONFIG_FBCON_SPLASHSCREEN
2564 +static int splash_registered=0;
2567 static void fbcon_init(struct vc_data *conp, int init)
2569 int unit = conp->vc_num;
2570 @@ -501,6 +523,26 @@
2571 fb_display[unit].cmap.green = 0;
2572 fb_display[unit].cmap.blue = 0;
2573 fb_display[unit].cmap.transp = 0;
2575 +#ifdef CONFIG_FBCON_SPLASHSCREEN
2576 + if (!splash_registered && fb_display[unit].var.bits_per_pixel == 16 ) {
2577 + if (unit == 0 && !fb_display[unit].splash_data) {
2578 + extern unsigned long initrd_start, initrd_end;
2580 + if (initrd_start && !splash_getraw((unsigned char *)initrd_start, (unsigned char *)initrd_end) && fb_display[unit].splash_data)
2581 + fb_display[unit].splash_data->splash_state = splash_default & 1;
2583 + splash_registered = 1;
2584 +#ifdef CONFIG_PROC_FS
2585 + splash_proc_register();
2588 + if (fb_display[unit].splash_data && fb_display[unit].var.bits_per_pixel != 16 ) {
2589 + vfree(fb_display[unit].splash_data);
2590 + fb_display[unit].splash_data = 0;
2594 fbcon_setup(unit, init, !init);
2595 /* Must be done after fbcon_setup to prevent excess updates */
2596 conp->vc_display_fg = &info->display_fg;
2597 @@ -517,6 +559,15 @@
2599 p->dispsw = &fbcon_dummy;
2601 +#ifdef CONFIG_FBCON_SPLASHSCREEN
2602 + if (splash_registered) {
2603 +#ifdef CONFIG_PROC_FS
2604 + splash_proc_unregister();
2606 + splash_registered = 0;
2613 @@ -658,6 +709,14 @@
2614 nr_cols = p->var.xres/fontwidth(p);
2615 nr_rows = p->var.yres/fontheight(p);
2617 +#ifdef CONFIG_FBCON_SPLASHSCREEN
2618 + if (p->splash_data && p->splash_data->splash_state) {
2619 + nr_cols = p->splash_data->splash_text_wi / fontwidth(p);
2620 + nr_rows = p->splash_data->splash_text_he / fontheight(p);
2626 /* Need to make room for the logo */
2627 int cnt, step, erase_char;
2628 @@ -735,6 +794,12 @@
2629 p->fgcol = p->var.bits_per_pixel > 2 ? 7 : (1<<p->var.bits_per_pixel)-1;
2632 +#ifdef CONFIG_FBCON_SPLASHSCREEN
2633 + if(p->splash_data && p->splash_data->splash_state)
2634 + con_remap_def_color(con, p->splash_data->splash_color << 4 | p->splash_data->splash_fg_color);
2639 if (conp->vc_cols != nr_cols || conp->vc_rows != nr_rows)
2640 vc_resize_con(nr_rows, nr_cols, con);
2641 @@ -1324,6 +1389,9 @@
2643 fbcon_softback_note(conp, t, count);
2644 if (logo_shown >= 0) goto redraw_up;
2645 +#ifdef CONFIG_FBCON_SPLASHSCREEN
2646 + if (splash_shown) goto redraw_up;
2648 switch (p->scrollmode & __SCROLL_YMASK) {
2649 case __SCROLL_YMOVE:
2650 p->dispsw->bmove(p, t+count, 0, t, 0, b-t-count,
2651 @@ -1384,6 +1452,9 @@
2653 if (count > conp->vc_rows) /* Maximum realistic size */
2654 count = conp->vc_rows;
2655 +#ifdef CONFIG_FBCON_SPLASHSCREEN
2656 + if (splash_shown) goto redraw_down;
2658 switch (p->scrollmode & __SCROLL_YMASK) {
2659 case __SCROLL_YMOVE:
2660 p->dispsw->bmove(p, t, 0, t+count, 0, b-t-count,
2661 @@ -1500,6 +1571,13 @@
2665 +#ifdef CONFIG_FBCON_SPLASHSCREEN
2666 + if (splash_shown && sy == dy) {
2667 + /* must use slower redraw bmove to keep background pic intact */
2668 + fbcon_redraw_bmove(p, real_y(p, sy), sx, real_y(p, dy), dx, height, width);
2672 p->dispsw->bmove(p, real_y(p, sy), sx, real_y(p, dy), dx, height, width);
2675 @@ -1510,6 +1588,10 @@
2676 struct display *p = &fb_display[unit];
2677 struct fb_info *info = p->fb_info;
2679 +#ifdef CONFIG_FBCON_SPLASHSCREEN
2680 + splash_prepare(p);
2684 int l = fbcon_softback_size / conp->vc_size_row;
2686 @@ -1570,13 +1652,40 @@
2687 struct display *p = &fb_display[conp->vc_num];
2688 struct fb_info *info = p->fb_info;
2690 +#ifdef CONFIG_FBCON_SPLASHSCREEN
2691 + struct display_switch *olddispsw=NULL;
2692 + char *oldscreen_base=NULL;
2695 if (blank < 0) /* Entering graphics mode */
2698 +#ifdef CONFIG_FBCON_SPLASHSCREEN
2700 + if (p->splash_data && p->splash_data->oldscreen_base) {
2701 + oldscreen_base = p->screen_base;
2702 + p->screen_base = p->splash_data->oldscreen_base;
2704 + if (p->splash_data && p->splash_data->olddispsw) {
2705 + olddispsw = p->dispsw;
2706 + p->dispsw = p->splash_data->olddispsw;
2710 fbcon_cursor(p->conp, blank ? CM_ERASE : CM_DRAW);
2712 if (!p->can_soft_blank) {
2714 +#ifdef CONFIG_FBCON_SPLASHSCREEN
2715 + if (p->splash_data && p->splash_data->oldscreen_base) {
2716 + oldscreen_base = p->screen_base;
2717 + p->screen_base = p->splash_data->oldscreen_base;
2719 + if (p->splash_data && p->splash_data->olddispsw) {
2720 + olddispsw = p->dispsw;
2721 + p->dispsw = p->splash_data->olddispsw;
2724 if (p->visual == FB_VISUAL_MONO01) {
2726 fb_memset255(p->screen_base,
2727 @@ -1584,20 +1693,33 @@
2728 p->var.bits_per_pixel>>3);
2730 unsigned short oldc;
2732 + u_int height, width;
2735 oldc = conp->vc_video_erase_char;
2736 conp->vc_video_erase_char &= p->charmask;
2737 height = conp->vc_rows;
2738 + width = conp->vc_cols;
2739 y_break = p->vrows-p->yscroll;
2740 +#ifdef CONFIG_FBCON_SPLASHSCREEN
2741 + if (splash_shown) {
2742 + width=p->var.xres/fontwidth(p);
2743 + height=p->var.yres/fontheight(p);
2746 if (height > y_break) {
2747 - p->dispsw->clear(conp, p, real_y(p, 0), 0, y_break, conp->vc_cols);
2748 - p->dispsw->clear(conp, p, real_y(p, y_break), 0, height-y_break, conp->vc_cols);
2749 + p->dispsw->clear(conp, p, real_y(p, 0), 0, y_break, width);
2750 + p->dispsw->clear(conp, p, real_y(p, y_break), 0, height-y_break, width);
2752 - p->dispsw->clear(conp, p, real_y(p, 0), 0, height, conp->vc_cols);
2753 + p->dispsw->clear(conp, p, real_y(p, 0), 0, height, width);
2754 conp->vc_video_erase_char = oldc;
2756 +#ifdef CONFIG_FBCON_SPLASHSCREEN
2757 + if(oldscreen_base)
2758 + p->screen_base=oldscreen_base;
2760 + p->dispsw=olddispsw;
2764 /* Tell console.c that it has to restore the screen itself */
2765 @@ -1763,13 +1885,21 @@
2768 struct vc_data *conp = p->conp;
2769 + __u32 xres = p->var.xres, yres = p->var.yres;
2771 /* reset wrap/pan */
2772 p->var.xoffset = p->var.yoffset = p->yscroll = 0;
2773 p->vrows = p->var.yres_virtual/h;
2774 - if ((p->var.yres % h) && (p->var.yres_virtual % h < p->var.yres % h))
2775 +#ifdef CONFIG_FBCON_SPLASHSCREEN
2776 + if (p->splash_data && p->splash_data->splash_state) {
2777 + xres = p->splash_data->splash_text_wi;
2778 + yres = p->splash_data->splash_text_he;
2781 + if ((yres % h) && (p->var.yres_virtual % h < p->var.yres % h))
2783 updatescrollmode(p);
2784 - vc_resize_con( p->var.yres/h, p->var.xres/w, unit );
2785 + vc_resize_con( yres/h, xres/w, unit );
2786 if (CON_IS_VISIBLE(conp) && softback_buf) {
2787 int l = fbcon_softback_size / conp->vc_size_row;
2789 @@ -2193,6 +2323,9 @@
2790 if (p->fb_info->fbops->fb_rasterimg)
2791 p->fb_info->fbops->fb_rasterimg(p->fb_info, 1);
2793 +#ifdef CONFIG_FBCON_SPLASHSCREEN
2794 + if (!splash_shown) {
2796 for (x = 0; x < smp_num_cpus * (LOGO_W + 8) &&
2797 x < p->var.xres - (LOGO_W + 8); x += (LOGO_W + 8)) {
2799 @@ -2454,7 +2587,9 @@
2804 +#ifdef CONFIG_FBCON_SPLASHSCREEN
2807 if (p->fb_info->fbops->fb_rasterimg)
2808 p->fb_info->fbops->fb_rasterimg(p->fb_info, 0);
2810 diff -ruN linux-2.4.31/include/video/fbcon.h linux-2.4.31-bs/include/video/fbcon.h
2811 --- linux-2.4.31/include/video/fbcon.h 2003-08-25 12:44:44.000000000 +0100
2812 +++ linux-2.4.31-bs/include/video/fbcon.h 2005-05-18 11:02:36.000000000 +0100
2814 unsigned int fontwidthmask; /* 1 at (1 << (width - 1)) if width is supported */
2817 +#ifdef CONFIG_FBCON_SPLASHSCREEN
2818 +struct splash_data {
2819 + int splash_state; /* show splash? */
2820 + int splash_color; /* transparent color */
2821 + int splash_fg_color; /* foreground color */
2822 + int splash_width; /* width of image */
2823 + int splash_height; /* height of image */
2824 + int splash_text_xo; /* text area origin */
2825 + int splash_text_yo;
2826 + int splash_text_wi; /* text area size */
2827 + int splash_text_he;
2828 + int splash_showtext; /* silent/verbose mode */
2829 + int splash_boxcount;
2830 + int splash_percent;
2831 + int splash_overpaintok; /* is it ok to overpaint boxes */
2832 + int splash_palcnt;
2833 + struct display_switch *olddispsw; /* old dispsw, normally &fbcon_cfb16*/
2834 + char *oldscreen_base; /* pointer to top of virtual screen */
2835 + unsigned char *splash_boxes;
2836 + unsigned char *splash_jpeg; /* jpeg */
2837 + unsigned char *splash_palette; /* palette for 8-bit */
2839 + int splash_dosilent; /* show silent jpeg */
2840 + unsigned char *splash_silentjpeg;
2841 + unsigned char *splash_sboxes;
2842 + int splash_sboxcount;
2846 extern struct display_switch fbcon_dummy;
2850 short yscroll; /* Hardware scrolling */
2851 unsigned char fgshift, bgshift;
2852 unsigned short charmask; /* 0xff or 0x1ff */
2854 +#ifdef CONFIG_FBCON_SPLASHSCREEN
2855 + struct splash_data *splash_data;
2860 /* drivers/video/fbcon.c */
2861 diff -ruN linux-2.4.31/kernel/panic.c linux-2.4.31-bs/kernel/panic.c
2862 --- linux-2.4.31/kernel/panic.c 2004-11-17 11:54:22.000000000 +0000
2863 +++ linux-2.4.31-bs/kernel/panic.c 2005-05-18 11:08:01.000000000 +0100
2865 * We can't use the "normal" timers since we just panicked..
2867 printk(KERN_EMERG "Rebooting in %d seconds..",panic_timeout);
2869 +#ifdef CONFIG_FBCON_SPLASHSCREEN
2871 + extern int splash_verbose(void);
2872 + (void)splash_verbose();
2875 mdelay(panic_timeout*1000);
2877 * Should we run the reboot notifier. For the moment Im
2878 @@ -103,6 +110,12 @@
2879 disabled_wait(caller);
2882 +#ifdef CONFIG_FBCON_SPLASHSCREEN
2884 + extern int splash_verbose(void);
2885 + (void)splash_verbose();
2889 #if defined(CONFIG_X86) && defined(CONFIG_VT)
2890 extern void panic_blink(void);