]> git.pld-linux.org Git - packages/kernel.git/blame - bootsplash-3.1.4-2.6.7.patch
- obsolete
[packages/kernel.git] / bootsplash-3.1.4-2.6.7.patch
CommitLineData
b6931f7d 1diff -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
4@@ -1059,6 +1059,14 @@
5 if (keycode < BTN_MISC)
6 printk(KERN_WARNING "keyboard.c: can't emulate rawmode for keycode %d\n", keycode);
7
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())
13+ return;
14+ }
15+#endif
16 #ifdef CONFIG_MAGIC_SYSRQ /* Handle the SysRq Hack */
17 if (keycode == KEY_SYSRQ && (sysrq_down || (down == 1 && sysrq_alt))) {
18 sysrq_down = down;
19diff -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
22@@ -994,6 +994,16 @@
23 return -EIO;
24 }
25
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();
33+ }
34+#endif
35+
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
39diff -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 @@
43 return 0;
44 }
45
46+#ifdef CONFIG_BOOTSPLASH
47+void con_remap_def_color(int currcons, int new_color)
48+{
49+ unsigned short *sbuf = screenbuf;
50+ unsigned c, len = screenbuf_size >> 1;
51+ int old_color;
52+
53+ if (sbuf) {
54+ old_color = def_color << 8;
55+ new_color <<= 8;
56+ while(len--) {
57+ c = *sbuf;
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;
62+ sbuf++;
63+ }
64+ new_color >>= 8;
65+ }
66+ def_color = color = new_color;
67+ update_attr(currcons);
68+}
69+#endif
70+
71 /*
72 * Visible symbols for modules
73 */
74diff -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
77@@ -979,5 +979,9 @@
78 source "drivers/video/logo/Kconfig"
79 endif
80
81+if FB
82+ source "drivers/video/bootsplash/Kconfig"
83+endif
84+
85 endmenu
86
87diff -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
90@@ -6,6 +6,7 @@
91
92 obj-$(CONFIG_VT) += console/
93 obj-$(CONFIG_LOGO) += logo/
94+obj-$(CONFIG_BOOTSPLASH) += bootsplash/
95
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
98diff -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
101@@ -0,0 +1,17 @@
102+#
103+# Bootsplash configuration
104+#
105+
106+menu "Bootsplash configuration"
107+
108+config BOOTSPLASH
109+ bool "Bootup splash screen"
110+ depends on FRAMEBUFFER_CONSOLE && FB_VESA
111+ default n
112+ ---help---
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
117+endmenu
118+
119diff -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
122@@ -0,0 +1,5 @@
123+# Makefile for the Linux bootsplash
124+
125+obj-$(CONFIG_BOOTSPLASH) += bootsplash.o
126+obj-$(CONFIG_BOOTSPLASH) += decode-jpg.o
127+obj-$(CONFIG_BOOTSPLASH) += render.o
128diff -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
131@@ -0,0 +1,926 @@
132+/*
133+ * linux/drivers/video/bootsplash/bootsplash.c -
134+ * splash screen handling functions.
135+ *
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>
140+ *
141+ * Ideas & SuSE screen work by Ken Wimer, <wimer@suse.de>
142+ *
143+ * For more information on this code check http://www.bootsplash.org/
144+ */
145+
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>
153+
154+#include <asm/irq.h>
155+#include <asm/system.h>
156+
157+#include "../console/fbcon.h"
158+#include "bootsplash.h"
159+#include "decode-jpg.h"
160+
161+extern struct fb_ops vesafb_ops;
162+
163+#define SPLASH_VERSION "3.1.4-2004/02/19"
164+
165+/* These errors have to match fbcon-jpegdec.h */
166+static unsigned char *jpg_errors[] = {
167+ "no SOI found",
168+ "not 8 bit",
169+ "height mismatch",
170+ "width mismatch",
171+ "bad width or height",
172+ "too many COMPPs",
173+ "illegal HV",
174+ "quant table selector",
175+ "picture is not YCBCR 221111",
176+ "unknow CID in scan",
177+ "dct not sequential",
178+ "wrong marker",
179+ "no EOI",
180+ "bad tables",
181+ "depth mismatch"
182+};
183+
184+static struct jpeg_decdata *decdata = 0; /* private decoder data */
185+
186+static int splash_registered = 0;
187+static int splash_usesilent = 0; /* shall we display the silentjpeg? */
188+int splash_default = 0xf01;
189+
190+static int splash_check_jpeg(unsigned char *jpeg, int width, int height, int depth);
191+
192+static int __init splash_setup(char *options)
193+{
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)
199+ return 0;
200+ options += 7;
201+ }
202+ if(!strncmp("verbose", options, 7)) {
203+ printk(KERN_INFO "bootsplash: verbose mode.\n");
204+ splash_usesilent = 0;
205+ return 0;
206+ }
207+ splash_default = simple_strtoul(options, NULL, 0);
208+ return 0;
209+}
210+
211+__setup("splash=", splash_setup);
212+
213+
214+static int splash_hasinter(unsigned char *buf, int num)
215+{
216+ unsigned char *bufend = buf + num * 12;
217+ while(buf < bufend) {
218+ if (buf[1] > 127) /* inter? */
219+ return 1;
220+ buf += buf[3] > 127 ? 24 : 12; /* blend? */
221+ }
222+ return 0;
223+}
224+
225+static int boxextract(unsigned char *buf, unsigned short *dp, unsigned char *cols, int *blendp)
226+{
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) {
236+ dp[1] = ~dp[1];
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);
240+ *blendp = 1;
241+ return 24;
242+ }
243+ return 12;
244+}
245+
246+static void boxit(unsigned char *pic, int bytes, unsigned char *buf, int num, int percent, int overpaint)
247+{
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;
257+
258+ if (num == 0)
259+ return;
260+ bufend = buf + num * 12;
261+ stipple[0] = 0xffffffff;
262+ stin = 1;
263+ stinn = 0;
264+ stixs = stixe = 0;
265+ stiys = stiye = 0;
266+ while(buf < bufend) {
267+ doblend = 0;
268+ buf += boxextract(buf, data1, cols1, &doblend);
269+ if (data1[0] == 32767 && data1[1] == 32767) {
270+ /* box stipple */
271+ if (stinn == 32)
272+ continue;
273+ if (stinn == 0) {
274+ stixs = data1[2];
275+ stixe = data1[3];
276+ stiys = stiye = 0;
277+ } else if (stinn == 4) {
278+ stiys = data1[2];
279+ stiye = data1[3];
280+ }
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] ;
285+ stin = stinn;
286+ continue;
287+ }
288+ stinn = 0;
289+ if (data1[0] > 32767)
290+ buf += boxextract(buf, data2, cols2, &doblend);
291+ if (data1[0] == 32767 && data1[1] == 32766) {
292+ /* box copy */
293+ i = 12 * (short)data1[3];
294+ doblend = 0;
295+ i += boxextract(buf + i, data1, cols1, &doblend);
296+ if (data1[0] > 32767)
297+ boxextract(buf + i, data2, cols2, &doblend);
298+ }
299+ if (data1[0] == 32767)
300+ continue;
301+ if (data1[2] > 32767) {
302+ if (overpaint)
303+ continue;
304+ data1[2] = ~data1[2];
305+ }
306+ if (data1[3] > 32767) {
307+ if (percent == 65536)
308+ continue;
309+ data1[3] = ~data1[3];
310+ }
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;
317+ }
318+ *(unsigned int *)cols2 = *(unsigned int *)cols1;
319+ a = cols2[3];
320+ if (a == 0 && !doblend)
321+ continue;
322+
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);
329+ xo = xe + 1;
330+ } else {
331+ xo = xs = stixs;
332+ xe = stixe ? stixe : data1[2];
333+ }
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);
340+ yo = ye + 1;
341+ } else {
342+ yo = ys = stiys;
343+ ye = stiye ? stiye : data1[3];
344+ }
345+ xo = 32 - (xo & 31);
346+ yo = stin - (yo % stin);
347+ if (xs < data1[0])
348+ xs = data1[0];
349+ if (xe > data1[2])
350+ xe = data1[2];
351+ if (ys < data1[1])
352+ ys = data1[1];
353+ if (ye > data1[3])
354+ ye = data1[3];
355+
356+ for (y = ys; y <= ye; y++) {
357+ sti = stipple[(y + yo) % stin];
358+ x = (xs + xo) & 31;
359+ if (x)
360+ sti = (sti << x) | (sti >> (32 - x));
361+ if (doblend) {
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;
366+ }
367+ add = (xs & 1);
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)) {
372+ sti <<= 1;
373+ picp++;
374+ add ^= 3;
375+ continue;
376+ }
377+ sti = (sti << 1) | 1;
378+ if (doblend) {
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;
383+ a = cols2[3];
384+ }
385+ r = cols2[0];
386+ g = cols2[1];
387+ b = cols2[2];
388+ if (a != 255) {
389+ i = *picp;
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;
393+ }
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);
398+ *picp++ = i;
399+ add ^= 3;
400+ }
401+ }
402+ }
403+}
404+
405+static int splash_check_jpeg(unsigned char *jpeg, int width, int height, int depth)
406+{
407+ int size, err;
408+ unsigned char *mem;
409+
410+ size = ((width + 15) & ~15) * ((height + 15) & ~15) * (depth >> 3);
411+ mem = vmalloc(size);
412+ if (!mem) {
413+ printk(KERN_INFO "bootsplash: no memory for decoded picture.\n");
414+ return -1;
415+ }
416+ if (!decdata)
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);
420+ vfree(mem);
421+ return err ? -1 : 0;
422+}
423+
424+static void splash_free(struct vc_data *vc, struct fb_info *info)
425+{
426+ if (!vc->vc_splash_data)
427+ return;
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;
436+}
437+
438+static int splash_mkpenguin(struct splash_data *data, int pxo, int pyo, int pwi, int phe, int pr, int pg, int pb)
439+{
440+ unsigned char *buf;
441+ int i;
442+
443+ if (pwi ==0 || phe == 0)
444+ return 0;
445+ buf = (unsigned char *)data + sizeof(*data);
446+ pwi += pxo - 1;
447+ phe += pyo - 1;
448+ *buf++ = pxo;
449+ *buf++ = pxo >> 8;
450+ *buf++ = pyo;
451+ *buf++ = pyo >> 8;
452+ *buf++ = pwi;
453+ *buf++ = pwi >> 8;
454+ *buf++ = phe;
455+ *buf++ = phe >> 8;
456+ *buf++ = pr;
457+ *buf++ = pg;
458+ *buf++ = pb;
459+ *buf++ = 0;
460+ for (i = 0; i < 12; i++, buf++)
461+ *buf = buf[-12];
462+ buf[-24] ^= 0xff;
463+ buf[-23] ^= 0xff;
464+ buf[-1] = 0xff;
465+ return 2;
466+}
467+
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 */
471+ /* V1 */
472+ { 20, -1, 16, -1, -1, -1, 8, 10, 12, 14,
473+ -1, -1, -1, -1, -1, -1 },
474+ /* V2 */
475+ { 35, 8, 12, 9, 10, 11, 16, 18, 20, 22,
476+ -1, -1, -1, -1, -1, -1 },
477+ /* V3 */
478+ { 38, 8, 12, 9, 10, 11, 16, 18, 20, 22,
479+ 24, 28, 32, 34, 36, 37 },
480+};
481+
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]
498+
499+static inline int splash_getb(unsigned char *pos, int off)
500+{
501+ return off == -1 ? 0 : pos[off];
502+}
503+
504+static inline int splash_gets(unsigned char *pos, int off)
505+{
506+ return off == -1 ? 0 : pos[off] | pos[off + 1] << 8;
507+}
508+
509+static inline int splash_geti(unsigned char *pos, int off)
510+{
511+ return off == -1 ? 0 :
512+ pos[off] | pos[off + 1] << 8 | pos[off + 2] << 16 | pos[off + 3] << 24;
513+}
514+
515+static int splash_getraw(unsigned char *start, unsigned char *end)
516+{
517+ unsigned char *ndata;
518+ int version;
519+ int splash_size;
520+ int unit;
521+ int width, height;
522+ int silentsize;
523+ int boxcnt;
524+ int sboxcnt;
525+ int palcnt;
526+ int i, len;
527+ const int *offsets;
528+ struct vc_data *vc;
529+ struct fb_info *info;
530+ struct splash_data *sd;
531+
532+ printk(KERN_INFO "bootsplash %s: looking for picture...", SPLASH_VERSION);
533+
534+ for (ndata = start; ndata < end; ndata++) {
535+ if (ndata[0] != 'B' || ndata[1] != 'O' || ndata[2] != 'O' || ndata[3] != 'T')
536+ continue;
537+ if (ndata[4] != 'S' || ndata[5] != 'P' || ndata[6] != 'L' || ndata[7] < '1' || ndata[7] > '3')
538+ continue;
539+ printk(".");
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)
545+ continue;
546+ if (unit) {
547+ acquire_console_sem();
548+ vc_allocate(unit);
549+ release_console_sem();
550+ }
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);
560+ if (i != 255)
561+ sd->splash_state = i;
562+ i = splash_getb(ndata, SPLASH_OFF_FGCOL);
563+ if (i != 255)
564+ sd->splash_fg_color = i;
565+ i = splash_getb(ndata, SPLASH_OFF_COL);
566+ if (i != 255)
567+ sd->splash_color = i;
568+ }
569+ return unit;
570+ }
571+ if (splash_size == 0) {
572+ printk(" found, freeing memory.\n");
573+ if (vc->vc_splash_data)
574+ splash_free(vc, info);
575+ return unit;
576+ }
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");
581+ return -1;
582+ }
583+ if (!jpeg_check_size(ndata + len + boxcnt * 12 + palcnt, width, height)) {
584+ ndata += len + splash_size - 1;
585+ continue;
586+ }
587+ if (splash_check_jpeg(ndata + len + boxcnt * 12 + palcnt, width, height, info->var.bits_per_pixel))
588+ return -1;
589+ silentsize = splash_geti(ndata, SPLASH_OFF_SSIZE);
590+ if (silentsize)
591+ printk(" silentjpeg size %d bytes,", silentsize);
592+ if (silentsize >= splash_size) {
593+ printk(" bigger than splashsize!\n");
594+ return -1;
595+ }
596+ splash_size -= silentsize;
597+ if (!splash_usesilent)
598+ silentsize = 0;
599+ else if (height * 2 * info->fix.line_length > info->fix.smem_len) {
600+ printk(" does not fit into framebuffer.\n");
601+ silentsize = 0;
602+ }
603+ sboxcnt = splash_gets(ndata, SPLASH_OFF_SBOXCNT);
604+ if (silentsize) {
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");
609+ silentsize = 0;
610+ }
611+ }
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));
615+ if (!sd)
616+ break;
617+ sd->splash_silentjpeg = 0;
618+ sd->splash_sboxes = 0;
619+ sd->splash_sboxcount = 0;
620+ if (silentsize) {
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;
627+ }
628+ }
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;
646+ }
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");
650+ return -1;
651+ }
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");
655+ return -1;
656+ }
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");
661+ }
662+
663+ /* fake penguin box for older formats */
664+ if (version == 1)
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));
668+
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;
676+ return unit;
677+ }
678+ printk(" no good signature found.\n");
679+ return -1;
680+}
681+
682+int splash_verbose(void)
683+{
684+ struct vc_data *vc;
685+ struct fb_info *info;
686+
687+ if (!splash_usesilent)
688+ return 0;
689+
690+ vc = vc_cons[0].d;
691+
692+ if (!vc || !vc->vc_splash_data || !vc->vc_splash_data->splash_state)
693+ return 0;
694+ if (fg_console != vc->vc_num)
695+ return 0;
696+ if (!vc->vc_splash_data->splash_silentjpeg || !vc->vc_splash_data->splash_dosilent)
697+ return 0;
698+ vc->vc_splash_data->splash_dosilent = 0;
699+ info = registered_fb[(int)con2fb_map[0]];
700+ if (!info->silent_screen_base)
701+ return 0;
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;
705+ return 1;
706+}
707+
708+static void splash_off(struct fb_info *info)
709+{
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;
718+}
719+
720+int splash_prepare(struct vc_data *vc, struct fb_info *info)
721+{
722+ int err;
723+ int width, height, depth, size, sbytes;
724+
725+ if (!vc->vc_splash_data || !vc->vc_splash_data->splash_state) {
726+ if (decdata)
727+ vfree(decdata);
728+ decdata = 0;
729+ splash_off(info);
730+ return -1;
731+ }
732+
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 */
737+ splash_off(info);
738+ return -2;
739+ }
740+
741+ sbytes = ((width + 15) & ~15) * (depth >> 3);
742+ size = sbytes * ((height + 15) & ~15);
743+ if (size != info->splash_pic_size)
744+ splash_off(info);
745+ if (!info->splash_pic)
746+ info->splash_pic = vmalloc(size);
747+
748+ if (!info->splash_pic) {
749+ printk(KERN_INFO "bootsplash: not enough memory.\n");
750+ splash_off(info);
751+ return -3;
752+ }
753+
754+ if (!decdata)
755+ decdata = vmalloc(sizeof(*decdata));
756+
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;
765+ } else {
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);
769+
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;
774+ }
775+ } else if (info->silent_screen_base)
776+ info->screen_base = info->silent_screen_base;
777+
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);
781+ splash_off(info);
782+ return -4;
783+ }
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;
790+ else
791+ splash_off(info);
792+ return 0;
793+}
794+
795+
796+#ifdef CONFIG_PROC_FS
797+
798+#include <linux/proc_fs.h>
799+
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);
807+
808+static struct proc_dir_entry *proc_splash;
809+
810+static int splash_recolor(struct vc_data *vc)
811+{
812+ if (!vc->vc_splash_data)
813+ return -1;
814+ if (!vc->vc_splash_data->splash_state)
815+ return 0;
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);
821+ }
822+ return 0;
823+}
824+
825+static int splash_status(struct vc_data *vc)
826+{
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");
829+
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);
843+ }
844+ release_console_sem();
845+ } else {
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();
851+ }
852+ return 0;
853+}
854+
855+static int splash_read_proc(char *buffer, char **start, off_t offset, int size,
856+ int *eof, void *data)
857+{
858+ int len = 0;
859+ off_t begin = 0;
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)
870+ return 0;
871+
872+ *start = buffer + (begin - offset);
873+
874+ return (size < begin + len - offset ? size : begin + len - offset);
875+}
876+
877+static int splash_write_proc(struct file *file, const char *buffer,
878+ unsigned long count, void *data)
879+{
880+ int new, unit;
881+ struct vc_data *vc;
882+
883+ if (!buffer || !splash_default)
884+ return count;
885+
886+ if (!strncmp(buffer, "show", 4) || !strncmp(buffer, "hide", 4)) {
887+ int pe, oldpe;
888+
889+ vc = vc_cons[0].d;
890+ if (buffer[4] == ' ' && buffer[5] == 'p')
891+ pe = 0;
892+ else if (buffer[4] == '\n')
893+ pe = 65535;
894+ else
895+ pe = simple_strtoul(buffer + 5, NULL, 0);
896+ if (pe < 0)
897+ pe = 0;
898+ if (pe > 65535)
899+ pe = 65535;
900+ if (*buffer == 'h')
901+ pe = 65535 - pe;
902+ pe += pe > 32767;
903+ if (vc->vc_splash_data && vc->vc_splash_data->splash_percent != pe) {
904+ struct fb_info *info;
905+
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)
909+ return count;
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))
913+ splash_status(vc);
914+ else
915+ splash_prepare(vc, info);
916+ } else {
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);
920+ }
921+ }
922+ return count;
923+ }
924+ if (!strncmp(buffer,"silent\n",7) || !strncmp(buffer,"verbose\n",8)) {
925+ vc = vc_cons[0].d;
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';
929+ splash_status(vc);
930+ }
931+ }
932+ return count;
933+ }
934+ if (!strncmp(buffer,"freesilent\n",11)) {
935+ vc = vc_cons[0].d;
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)
943+ splash_status(vc);
944+ vc->vc_splash_data->splash_dosilent = 0;
945+ }
946+ return count;
947+ }
948+
949+ if (!strncmp(buffer, "BOOTSPL", 7)) {
950+ unit = splash_getraw((unsigned char *)buffer, (unsigned char *)buffer + count);
951+ if (unit >= 0) {
952+ vc = vc_cons[unit].d;
953+ splash_status(vc);
954+ }
955+ return count;
956+ }
957+ vc = vc_cons[0].d;
958+ if (!vc->vc_splash_data)
959+ return count;
960+ if (buffer[0] == 't') {
961+ vc->vc_splash_data->splash_state ^= 1;
962+ splash_status(vc);
963+ return count;
964+ }
965+ new = simple_strtoul(buffer, NULL, 0);
966+ if (new > 1) {
967+ /* expert user */
968+ vc->vc_splash_data->splash_color = new >> 8 & 0xff;
969+ vc->vc_splash_data->splash_fg_color = new >> 4 & 0x0f;
970+ }
971+ if ((new & 1) == vc->vc_splash_data->splash_state)
972+ splash_recolor(vc);
973+ else {
974+ vc->vc_splash_data->splash_state = new & 1;
975+ splash_status(vc);
976+ }
977+ return count;
978+}
979+
980+static int splash_proc_register(void)
981+{
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;
985+ return 0;
986+ }
987+ return 1;
988+}
989+
990+# if 0
991+static int splash_proc_unregister(void)
992+{
993+ if (proc_splash)
994+ remove_proc_entry("splash", 0);
995+ return 0;
996+}
997+# endif
998+#endif /* CONFIG_PROC_FS */
999+
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);
1003+
1004+void splash_init(void)
1005+{
1006+ struct fb_info *info;
1007+ struct vc_data *vc;
1008+ int isramfs = 1;
1009+ int fd;
1010+ int len;
1011+ int max_len = 1024*1024*2;
1012+ char *mem;
1013+
1014+ if (splash_registered)
1015+ return;
1016+ vc = vc_cons[0].d;
1017+ info = registered_fb[0];
1018+ if (!vc || !info || info->var.bits_per_pixel != 16)
1019+ return;
1020+#ifdef CONFIG_PROC_FS
1021+ splash_proc_register();
1022+#endif
1023+ splash_registered = 1;
1024+ if (vc->vc_splash_data)
1025+ return;
1026+ if ((fd = sys_open("/bootsplash", O_RDONLY, 0)) < 0) {
1027+ isramfs = 0;
1028+ fd = sys_open("/initrd.image", O_RDONLY, 0);
1029+ }
1030+ if (fd < 0)
1031+ return;
1032+ if ((len = (int)sys_lseek(fd, (off_t)0, 2)) <= 0) {
1033+ sys_close(fd);
1034+ return;
1035+ }
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",
1039+ max_len>>20);
1040+ sys_lseek(fd, (off_t)(len - max_len), 0);
1041+ len = max_len;
1042+ } else {
1043+ sys_lseek(fd, (off_t)0, 0);
1044+ }
1045+
1046+ mem = vmalloc(len);
1047+ if (mem) {
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;
1050+ vfree(mem);
1051+ }
1052+ sys_close(fd);
1053+ if (isramfs)
1054+ sys_unlink("/bootsplash");
1055+ return;
1056+}
1057+
1058diff -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
1061@@ -0,0 +1,44 @@
1062+/*
1063+ * linux/drivers/video/bootsplash/bootsplash.h - splash screen definition.
1064+ *
1065+ * (w) 2001-2003 by Volker Poplawski, <volker@poplawski.de>
1066+ * Stefan Reinauer, <stepan@suse.de>
1067+ *
1068+ *
1069+ * idea and SuSE screen work by Ken Wimer, <wimer@suse.de>
1070+ */
1071+
1072+#ifndef __BOOTSPLASH_H
1073+#define __BOOTSPLASH_H
1074+
1075+struct fb_info;
1076+
1077+/* splash.c */
1078+extern int splash_prepare(struct vc_data *, struct fb_info *);
1079+extern void splash_init(void);
1080+
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,
1092+ int bottom_only);
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,
1097+ int blank);
1098+
1099+/* vt.c */
1100+extern void con_remap_def_color(int currcons, int new_color);
1101+
1102+extern void acquire_console_sem(void);
1103+extern void release_console_sem(void);
1104+
1105+#endif
1106diff -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
1109@@ -0,0 +1,958 @@
1110+/*
1111+ * linux/drivers/video/bootsplash/decode-jpg.c - a tiny jpeg decoder.
1112+ *
1113+ * (w) August 2001 by Michael Schroeder, <mls@suse.de>
1114+ *
1115+ */
1116+
1117+#include <linux/config.h>
1118+#include <linux/string.h>
1119+#include <asm/byteorder.h>
1120+
1121+#include "decode-jpg.h"
1122+
1123+#define ISHIFT 11
1124+
1125+#define IFIX(a) ((int)((a) * (1 << ISHIFT) + .5))
1126+#define IMULT(a, b) (((a) * (b)) >> ISHIFT)
1127+#define ITOINT(a) ((a) >> ISHIFT)
1128+
1129+#ifndef __P
1130+# define __P(x) x
1131+#endif
1132+
1133+/* special markers */
1134+#define M_BADHUFF -1
1135+#define M_EOF 0x80
1136+
1137+struct in {
1138+ unsigned char *p;
1139+ unsigned int bits;
1140+ int left;
1141+ int marker;
1142+
1143+ int (*func) __P((void *));
1144+ void *data;
1145+};
1146+
1147+/*********************************/
1148+struct dec_hufftbl;
1149+struct enc_hufftbl;
1150+
1151+union hufftblp {
1152+ struct dec_hufftbl *dhuff;
1153+ struct enc_hufftbl *ehuff;
1154+};
1155+
1156+struct scan {
1157+ int dc; /* old dc value */
1158+
1159+ union hufftblp hudc;
1160+ union hufftblp huac;
1161+ int next; /* when to switch to next scan */
1162+
1163+ int cid; /* component id */
1164+ int hv; /* horiz/vert, copied from comp */
1165+ int tq; /* quant tbl, copied from comp */
1166+};
1167+
1168+/*********************************/
1169+
1170+#define DECBITS 10 /* seems to be the optimum */
1171+
1172+struct dec_hufftbl {
1173+ int maxcode[17];
1174+ int valptr[16];
1175+ unsigned char vals[256];
1176+ unsigned int llvals[1 << DECBITS];
1177+};
1178+
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 *));
1182+
1183+static void setinput __P((struct in *, unsigned char *));
1184+/*********************************/
1185+
1186+#undef PREC
1187+#define PREC int
1188+
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));
1192+
1193+/*********************************/
1194+
1195+static void initcol __P((PREC[][64]));
1196+
1197+static void col221111 __P((int *, unsigned char *, int));
1198+static void col221111_16 __P((int *, unsigned char *, int));
1199+
1200+/*********************************/
1201+
1202+#define M_SOI 0xd8
1203+#define M_APP0 0xe0
1204+#define M_DQT 0xdb
1205+#define M_SOF0 0xc0
1206+#define M_DHT 0xc4
1207+#define M_DRI 0xdd
1208+#define M_SOS 0xda
1209+#define M_RST0 0xd0
1210+#define M_EOI 0xd9
1211+#define M_COM 0xfe
1212+
1213+static unsigned char *datap;
1214+
1215+static int getbyte(void)
1216+{
1217+ return *datap++;
1218+}
1219+
1220+static int getword(void)
1221+{
1222+ int c1, c2;
1223+ c1 = *datap++;
1224+ c2 = *datap++;
1225+ return c1 << 8 | c2;
1226+}
1227+
1228+struct comp {
1229+ int cid;
1230+ int hv;
1231+ int tq;
1232+};
1233+
1234+#define MAXCOMP 4
1235+struct jpginfo {
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 */
1241+};
1242+
1243+static struct jpginfo info;
1244+static struct comp comps[MAXCOMP];
1245+
1246+static struct scan dscans[MAXCOMP];
1247+
1248+static unsigned char quant[4][64];
1249+
1250+static struct dec_hufftbl dhuff[4];
1251+
1252+#define dec_huffdc (dhuff + 0)
1253+#define dec_huffac (dhuff + 2)
1254+
1255+static struct in in;
1256+
1257+static int readtables(int till)
1258+{
1259+ int m, l, i, j, lq, pq, tq;
1260+ int tc, th, tt;
1261+
1262+ for (;;) {
1263+ if (getbyte() != 0xff)
1264+ return -1;
1265+ if ((m = getbyte()) == till)
1266+ break;
1267+
1268+ switch (m) {
1269+ case 0xc2:
1270+ return 0;
1271+
1272+ case M_DQT:
1273+ lq = getword();
1274+ while (lq > 2) {
1275+ pq = getbyte();
1276+ tq = pq & 15;
1277+ if (tq > 3)
1278+ return -1;
1279+ pq >>= 4;
1280+ if (pq != 0)
1281+ return -1;
1282+ for (i = 0; i < 64; i++)
1283+ quant[tq][i] = getbyte();
1284+ lq -= 64 + 1;
1285+ }
1286+ break;
1287+
1288+ case M_DHT:
1289+ l = getword();
1290+ while (l > 2) {
1291+ int hufflen[16], k;
1292+ unsigned char huffvals[256];
1293+
1294+ tc = getbyte();
1295+ th = tc & 15;
1296+ tc >>= 4;
1297+ tt = tc * 2 + th;
1298+ if (tc > 1 || th > 1)
1299+ return -1;
1300+ for (i = 0; i < 16; i++)
1301+ hufflen[i] = getbyte();
1302+ l -= 1 + 16;
1303+ k = 0;
1304+ for (i = 0; i < 16; i++) {
1305+ for (j = 0; j < hufflen[i]; j++)
1306+ huffvals[k++] = getbyte();
1307+ l -= hufflen[i];
1308+ }
1309+ dec_makehuff(dhuff + tt, hufflen,
1310+ huffvals);
1311+ }
1312+ break;
1313+
1314+ case M_DRI:
1315+ l = getword();
1316+ info.dri = getword();
1317+ break;
1318+
1319+ default:
1320+ l = getword();
1321+ while (l-- > 2)
1322+ getbyte();
1323+ break;
1324+ }
1325+ }
1326+ return 0;
1327+}
1328+
1329+static void dec_initscans(void)
1330+{
1331+ int i;
1332+
1333+ info.nm = info.dri + 1;
1334+ info.rm = M_RST0;
1335+ for (i = 0; i < info.ns; i++)
1336+ dscans[i].dc = 0;
1337+}
1338+
1339+static int dec_checkmarker(void)
1340+{
1341+ int i;
1342+
1343+ if (dec_readmarker(&in) != info.rm)
1344+ return -1;
1345+ info.nm = info.dri;
1346+ info.rm = (info.rm + 1) & ~0x08;
1347+ for (i = 0; i < info.ns; i++)
1348+ dscans[i].dc = 0;
1349+ return 0;
1350+}
1351+
1352+int jpeg_check_size(unsigned char *buf, int width, int height)
1353+{
1354+ datap = buf;
1355+ getbyte();
1356+ getbyte();
1357+ readtables(M_SOF0);
1358+ getword();
1359+ getbyte();
1360+ if (height != getword() || width != getword())
1361+ return 0;
1362+ return 1;
1363+}
1364+
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;
1369+{
1370+ int i, j, m, tac, tdc;
1371+ int mcusx, mcusy, mx, my;
1372+ int max[6];
1373+
1374+ if (!decdata)
1375+ return -1;
1376+ datap = buf;
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;
1383+ getword();
1384+ i = getbyte();
1385+ if (i != 8)
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++) {
1397+ int h, v;
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;
1407+ }
1408+ if (readtables(M_SOS))
1409+ return ERR_BAD_TABLES;
1410+ getword();
1411+ info.ns = getbyte();
1412+ if (info.ns != 3)
1413+ return ERR_NOT_YCBCR_221111;
1414+ for (i = 0; i < 3; i++) {
1415+ dscans[i].cid = getbyte();
1416+ tdc = getbyte();
1417+ tac = tdc & 15;
1418+ tdc >>= 4;
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)
1423+ break;
1424+ if (j == info.nc)
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;
1430+ }
1431+
1432+ i = getbyte();
1433+ j = getbyte();
1434+ m = getbyte();
1435+
1436+ if (i != 0 || j != 63 || m != 0)
1437+ return ERR_NOT_SEQUENTIAL_DCT;
1438+
1439+ if (dscans[0].cid != 1 || dscans[1].cid != 2 || dscans[2].cid != 3)
1440+ return ERR_NOT_YCBCR_221111;
1441+
1442+ if (dscans[0].hv != 0x22 || dscans[1].hv != 0x11 || dscans[2].hv != 0x11)
1443+ return ERR_NOT_YCBCR_221111;
1444+
1445+ mcusx = width >> 4;
1446+ mcusy = height >> 4;
1447+
1448+
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);
1454+
1455+#if 0
1456+ /* landing zone */
1457+ img[len] = 0;
1458+ img[len + 1] = 0xff;
1459+ img[len + 2] = M_EOF;
1460+#endif
1461+
1462+ dec_initscans();
1463+
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;
1472+
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]);
1480+
1481+ switch (depth) {
1482+ case 24:
1483+ col221111(decdata->out, pic + (my * 16 * mcusx + mx) * 16 * 3, mcusx * 16 * 3);
1484+ break;
1485+ case 16:
1486+ col221111_16(decdata->out, pic + (my * 16 * mcusx + mx) * (16 * 2), mcusx * (16 * 2));
1487+ break;
1488+ default:
1489+ return ERR_DEPTH_MISMATCH;
1490+ break;
1491+ }
1492+ }
1493+ }
1494+
1495+ m = dec_readmarker(&in);
1496+ if (m != M_EOI)
1497+ return ERR_NO_EOI;
1498+
1499+ return 0;
1500+}
1501+
1502+/****************************************************************/
1503+/************** huffman decoder ***************/
1504+/****************************************************************/
1505+
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));
1509+
1510+static void setinput(in, p)
1511+struct in *in;
1512+unsigned char *p;
1513+{
1514+ in->p = p;
1515+ in->left = 0;
1516+ in->bits = 0;
1517+ in->marker = 0;
1518+}
1519+
1520+static int fillbits(in, le, bi)
1521+struct in *in;
1522+int le;
1523+unsigned int bi;
1524+{
1525+ int b, m;
1526+
1527+ if (in->marker) {
1528+ if (le <= 16)
1529+ in->bits = bi << 16, le += 16;
1530+ return le;
1531+ }
1532+ while (le <= 24) {
1533+ b = *in->p++;
1534+ if (b == 0xff && (m = *in->p++) != 0) {
1535+ if (m == M_EOF) {
1536+ if (in->func && (m = in->func(in->data)) == 0)
1537+ continue;
1538+ }
1539+ in->marker = m;
1540+ if (le <= 16)
1541+ bi = bi << 16, le += 16;
1542+ break;
1543+ }
1544+ bi = bi << 8 | b;
1545+ le += 8;
1546+ }
1547+ in->bits = bi; /* tmp... 2 return values needed */
1548+ return le;
1549+}
1550+
1551+static int dec_readmarker(in)
1552+struct in *in;
1553+{
1554+ int m;
1555+
1556+ in->left = fillbits(in, in->left, in->bits);
1557+ if ((m = in->marker) == 0)
1558+ return 0;
1559+ in->left = 0;
1560+ in->marker = 0;
1561+ return m;
1562+}
1563+
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)
1567+
1568+#define GETBITS(in, n) ( \
1569+ (le < (n) ? le = fillbits(in, le, bi), bi = in->bits : 0), \
1570+ (le -= (n)), \
1571+ bi >> le & ((1 << (n)) - 1) \
1572+)
1573+
1574+#define UNGETBITS(in, n) ( \
1575+ le += (n) \
1576+)
1577+
1578+
1579+static int dec_rec2(in, hu, runp, c, i)
1580+struct in *in;
1581+struct dec_hufftbl *hu;
1582+int *runp;
1583+int c, i;
1584+{
1585+ LEBI_DCL;
1586+
1587+ LEBI_GET(in);
1588+ if (i) {
1589+ UNGETBITS(in, i & 127);
1590+ *runp = i >> 8 & 15;
1591+ i >>= 16;
1592+ } else {
1593+ for (i = DECBITS; (c = ((c << 1) | GETBITS(in, 1))) >= (hu->maxcode[i]); i++);
1594+ if (i >= 16) {
1595+ in->marker = M_BADHUFF;
1596+ return 0;
1597+ }
1598+ i = hu->vals[hu->valptr[i] + c - hu->maxcode[i - 1] * 2];
1599+ *runp = i >> 4;
1600+ i &= 15;
1601+ }
1602+ if (i == 0) { /* sigh, 0xf0 is 11 bit */
1603+ LEBI_PUT(in);
1604+ return 0;
1605+ }
1606+ /* receive part */
1607+ c = GETBITS(in, i);
1608+ if (c < (1 << (i - 1)))
1609+ c += (-1 << i) + 1;
1610+ LEBI_PUT(in);
1611+ return c;
1612+}
1613+
1614+#define DEC_REC(in, hu, r, i) ( \
1615+ r = GETBITS(in, DECBITS), \
1616+ i = hu->llvals[r], \
1617+ i & 128 ? \
1618+ ( \
1619+ UNGETBITS(in, i & 127), \
1620+ r = i >> 8 & 15, \
1621+ i >> 16 \
1622+ ) \
1623+ : \
1624+ ( \
1625+ LEBI_PUT(in), \
1626+ i = dec_rec2(in, hu, &r, r, i), \
1627+ LEBI_GET(in), \
1628+ i \
1629+ ) \
1630+)
1631+
1632+static void decode_mcus(in, dct, n, sc, maxp)
1633+struct in *in;
1634+int *dct;
1635+int n;
1636+struct scan *sc;
1637+int *maxp;
1638+{
1639+ struct dec_hufftbl *hu;
1640+ int i, r, t;
1641+ LEBI_DCL;
1642+
1643+ memset(dct, 0, n * 64 * sizeof(*dct));
1644+ LEBI_GET(in);
1645+ while (n-- > 0) {
1646+ hu = sc->hudc.dhuff;
1647+ *dct++ = (sc->dc += DEC_REC(in, hu, r, t));
1648+
1649+ hu = sc->huac.dhuff;
1650+ i = 63;
1651+ while (i > 0) {
1652+ t = DEC_REC(in, hu, r, t);
1653+ if (t == 0 && r == 0) {
1654+ dct += i;
1655+ break;
1656+ }
1657+ dct += r;
1658+ *dct++ = t;
1659+ i -= r + 1;
1660+ }
1661+ *maxp++ = 64 - i;
1662+ if (n == sc->next)
1663+ sc++;
1664+ }
1665+ LEBI_PUT(in);
1666+}
1667+
1668+static void dec_makehuff(hu, hufflen, huffvals)
1669+struct dec_hufftbl *hu;
1670+int *hufflen;
1671+unsigned char *huffvals;
1672+{
1673+ int code, k, i, j, d, x, c, v;
1674+ for (i = 0; i < (1 << DECBITS); i++)
1675+ hu->llvals[i] = 0;
1676+
1677+/*
1678+ * llvals layout:
1679+ *
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
1686+ */
1687+ code = 0;
1688+ k = 0;
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 -
1699+ i);
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;
1704+ } else
1705+ x = v << 16 | (hu-> vals[k] & 0xf0) << 4 |
1706+ (DECBITS - (i + 1));
1707+ hu->llvals[c | d] = x;
1708+ }
1709+ }
1710+ code++;
1711+ k++;
1712+ }
1713+ hu->maxcode[i] = code;
1714+ }
1715+ hu->maxcode[16] = 0x20000; /* always terminate decode */
1716+}
1717+
1718+/****************************************************************/
1719+/************** idct ***************/
1720+/****************************************************************/
1721+
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))
1726+
1727+#define S22 ((PREC)IFIX(2 * 0.382683432))
1728+#define C22 ((PREC)IFIX(2 * 0.923879532))
1729+#define IC4 ((PREC)IFIX(1 / 0.707106781))
1730+
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 */
1734+
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)
1738+
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)
1742+
1743+#define IDCT \
1744+( \
1745+ XPP(t0, t1), \
1746+ XMP(t2, t3), \
1747+ t2 = IMULT(t2, IC4) - t3, \
1748+ XPP(t0, t3), \
1749+ XPP(t1, t2), \
1750+ XMP(t4, t7), \
1751+ XPP(t5, t6), \
1752+ XMP(t5, t7), \
1753+ t5 = IMULT(t5, IC4), \
1754+ ROT(t4, t6, S22, C22),\
1755+ t6 -= t7, \
1756+ t5 -= t6, \
1757+ t4 -= t5, \
1758+ XPP(t0, t7), \
1759+ XPP(t1, t6), \
1760+ XPP(t2, t5), \
1761+ XPP(t3, t4) \
1762+)
1763+
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
1773+};
1774+
1775+void idct(in, out, quant, off, max)
1776+int *in;
1777+int *out;
1778+PREC *quant;
1779+PREC off;
1780+int max;
1781+{
1782+ PREC t0, t1, t2, t3, t4, t5, t6, t7, t;
1783+ PREC tmp[64], *tmpp;
1784+ int i, j;
1785+ unsigned char *zig2p;
1786+
1787+ t0 = off;
1788+ if (max == 1) {
1789+ t0 += in[0] * quant[0];
1790+ for (i = 0; i < 64; i++)
1791+ out[i] = ITOINT(t0);
1792+ return;
1793+ }
1794+ zig2p = zig2;
1795+ tmpp = tmp;
1796+ for (i = 0; i < 8; i++) {
1797+ j = *zig2p++;
1798+ t0 += in[j] * quant[j];
1799+ j = *zig2p++;
1800+ t5 = in[j] * quant[j];
1801+ j = *zig2p++;
1802+ t2 = in[j] * quant[j];
1803+ j = *zig2p++;
1804+ t7 = in[j] * quant[j];
1805+ j = *zig2p++;
1806+ t1 = in[j] * quant[j];
1807+ j = *zig2p++;
1808+ t4 = in[j] * quant[j];
1809+ j = *zig2p++;
1810+ t3 = in[j] * quant[j];
1811+ j = *zig2p++;
1812+ t6 = in[j] * quant[j];
1813+ IDCT;
1814+ tmpp[0 * 8] = t0;
1815+ tmpp[1 * 8] = t1;
1816+ tmpp[2 * 8] = t2;
1817+ tmpp[3 * 8] = t3;
1818+ tmpp[4 * 8] = t4;
1819+ tmpp[5 * 8] = t5;
1820+ tmpp[6 * 8] = t6;
1821+ tmpp[7 * 8] = t7;
1822+ tmpp++;
1823+ t0 = 0;
1824+ }
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];
1834+ IDCT;
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);
1843+ }
1844+}
1845+
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
1855+};
1856+
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)
1862+};
1863+
1864+
1865+static void idctqtab(qin, qout)
1866+unsigned char *qin;
1867+PREC *qout;
1868+{
1869+ int i, j;
1870+
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]);
1875+}
1876+
1877+static void scaleidctqtab(q, sc)
1878+PREC *q;
1879+PREC sc;
1880+{
1881+ int i;
1882+
1883+ for (i = 0; i < 64; i++)
1884+ q[i] = IMULT(q[i], sc);
1885+}
1886+
1887+/****************************************************************/
1888+/************** color decoder ***************/
1889+/****************************************************************/
1890+
1891+#define ROUND
1892+
1893+/*
1894+ * YCbCr Color transformation:
1895+ *
1896+ * y:0..255 Cb:-128..127 Cr:-128..127
1897+ *
1898+ * R = Y + 1.40200 * Cr
1899+ * G = Y - 0.34414 * Cb - 0.71414 * Cr
1900+ * B = Y + 1.77200 * Cb
1901+ *
1902+ * =>
1903+ * Cr *= 1.40200;
1904+ * Cb *= 1.77200;
1905+ * Cg = 0.19421 * Cb + .50937 * Cr;
1906+ * R = Y + Cr;
1907+ * G = Y - Cg;
1908+ * B = Y + Cb;
1909+ *
1910+ * =>
1911+ * Cg = (50 * Cb + 130 * Cr + 128) >> 8;
1912+ */
1913+
1914+static void initcol(q)
1915+PREC q[][64];
1916+{
1917+ scaleidctqtab(q[1], IFIX(1.77200));
1918+ scaleidctqtab(q[2], IFIX(1.40200));
1919+}
1920+
1921+/* This is optimized for the stupid sun SUNWspro compiler. */
1922+#define STORECLAMP(a,x) \
1923+( \
1924+ (a) = (x), \
1925+ (unsigned int)(x) >= 256 ? \
1926+ ((a) = (x) < 0 ? 0 : 255) \
1927+ : \
1928+ 0 \
1929+)
1930+
1931+#define CLAMP(x) ((unsigned int)(x) >= 256 ? ((x) < 0 ? 0 : 255) : (x))
1932+
1933+#ifdef ROUND
1934+
1935+#define CBCRCG(yin, xin) \
1936+( \
1937+ cb = outc[0 +yin*8+xin], \
1938+ cr = outc[64+yin*8+xin], \
1939+ cg = (50 * cb + 130 * cr + 128) >> 8 \
1940+)
1941+
1942+#else
1943+
1944+#define CBCRCG(yin, xin) \
1945+( \
1946+ cb = outc[0 +yin*8+xin], \
1947+ cr = outc[64+yin*8+xin], \
1948+ cg = (3 * cb + 8 * cr) >> 4 \
1949+)
1950+
1951+#endif
1952+
1953+#define PIC(yin, xin, p, xout) \
1954+( \
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) \
1959+)
1960+
1961+#ifdef __LITTLE_ENDIAN
1962+#define PIC_16(yin, xin, p, xout, add) \
1963+( \
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 \
1970+)
1971+#else
1972+#ifdef CONFIG_PPC
1973+#define PIC_16(yin, xin, p, xout, add) \
1974+( \
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 \
1981+)
1982+#else
1983+#define PIC_16(yin, xin, p, xout, add) \
1984+( \
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 \
1991+)
1992+#endif
1993+#endif
1994+
1995+#define PIC221111(xin) \
1996+( \
1997+ CBCRCG(0, 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) \
2002+)
2003+
2004+#define PIC221111_16(xin) \
2005+( \
2006+ CBCRCG(0, 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) \
2011+)
2012+
2013+static void col221111(out, pic, width)
2014+int *out;
2015+unsigned char *pic;
2016+int width;
2017+{
2018+ int i, j, k;
2019+ unsigned char *pic0, *pic1;
2020+ int *outy, *outc;
2021+ int cr, cg, cb, y;
2022+
2023+ pic0 = pic;
2024+ pic1 = pic + width;
2025+ outy = out;
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++) {
2030+ PIC221111(k);
2031+ }
2032+ outc += 8;
2033+ outy += 16;
2034+ pic0 += 2 * width;
2035+ pic1 += 2 * width;
2036+ }
2037+ outy += 64 * 2 - 16 * 4;
2038+ }
2039+}
2040+
2041+static void col221111_16(out, pic, width)
2042+int *out;
2043+unsigned char *pic;
2044+int width;
2045+{
2046+ int i, j, k;
2047+ unsigned char *pic0, *pic1;
2048+ int *outy, *outc;
2049+ int cr, cg, cb, y;
2050+
2051+ pic0 = pic;
2052+ pic1 = pic + width;
2053+ outy = out;
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++) {
2058+ PIC221111_16(k);
2059+ }
2060+ outc += 8;
2061+ outy += 16;
2062+ pic0 += 2 * width;
2063+ pic1 += 2 * width;
2064+ }
2065+ outy += 64 * 2 - 16 * 4;
2066+ }
2067+}
2068diff -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
2071@@ -0,0 +1,35 @@
2072+/*
2073+ * linux/drivers/video/bootsplash/decode-jpg.h - a tiny jpeg decoder.
2074+ *
2075+ * (w) August 2001 by Michael Schroeder, <mls@suse.de>
2076+ */
2077+
2078+#ifndef __DECODE_JPG_H
2079+#define __DECODE_JPG_H
2080+
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
2096+
2097+struct jpeg_decdata {
2098+ int dcts[6 * 64 + 16];
2099+ int out[64 * 6];
2100+ int dquant[3][64];
2101+};
2102+
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);
2105+
2106+#endif
2107diff -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
2110@@ -0,0 +1,330 @@
2111+/*
2112+ * linux/drivers/video/bootsplash/render.c - splash screen render functions.
2113+ */
2114+
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>
2122+
2123+#include "../console/fbcon.h"
2124+#include "bootsplash.h"
2125+
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)
2128+{
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;
2132+ u8 *src;
2133+ u8 *dst, *splashsrc;
2134+ unsigned int d, x, y;
2135+ u32 dd, fgx, bgx;
2136+ u16 c = scr_readw(s);
2137+
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);
2146+
2147+ fgx = ((u32 *)info->pseudo_palette)[fg_color];
2148+ if (transparent && sd->splash_color == 15) {
2149+ if (fgx == 0xffea)
2150+ fgx = 0xfe4a;
2151+ else if (fgx == 0x57ea)
2152+ fgx = 0x0540;
2153+ else if (fgx == 0xffff)
2154+ fgx = 0x52aa;
2155+ }
2156+ bgx = ((u32 *)info->pseudo_palette)[bg_color];
2157+ d = 0;
2158+
2159+ while (count--) {
2160+ c = scr_readw(s++);
2161+ src = vc->vc_font.data + (c & charmask) * vc->vc_font.height * ((vc->vc_font.width + 7) >> 3);
2162+
2163+ for (y = 0; y < vc->vc_font.height; y++) {
2164+ for (x = 0; x < vc->vc_font.width; x += 2) {
2165+ if ((x & 7) == 0)
2166+ d = *src++;
2167+ if (d & 0x80)
2168+ dd = fgx;
2169+ else
2170+ dd = transparent ? *(u16 *)splashsrc : bgx;
2171+ splashsrc += 2;
2172+ if (d & 0x40)
2173+ dd |= fgx << 16;
2174+ else
2175+ dd |= (transparent ? *(u16 *)splashsrc : bgx) << 16;
2176+ splashsrc += 2;
2177+ d <<= 2;
2178+ fb_writel(dd, dst);
2179+ dst += 4;
2180+ }
2181+ dst += info->fix.line_length - vc->vc_font.width * 2;
2182+ splashsrc += info->splash_bytes - vc->vc_font.width * 2;
2183+ }
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;
2186+ }
2187+}
2188+
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)
2190+{
2191+ int transparent = sd->splash_color == bg_color;
2192+ u32 dd, fgx, bgx;
2193+ u8 *dst, *splashsrc;
2194+ unsigned int d, x, y;
2195+
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)
2201+ fgx = 0xfe4a;
2202+ else if (fgx == 0x57ea)
2203+ fgx = 0x0540;
2204+ else if (fgx == 0xffff)
2205+ fgx = 0x52aa;
2206+ }
2207+ bgx = ((u32 *)info->pseudo_palette)[bg_color];
2208+ d = 0;
2209+ for (y = 0; y < height; y++) {
2210+ for (x = 0; x < width; x += 2) {
2211+ if ((x & 7) == 0)
2212+ d = *src++;
2213+ if (d & 0x80)
2214+ dd = fgx;
2215+ else
2216+ dd = transparent ? *(u16 *)splashsrc : bgx;
2217+ splashsrc += 2;
2218+ if (d & 0x40)
2219+ dd |= fgx << 16;
2220+ else
2221+ dd |= (transparent ? *(u16 *)splashsrc : bgx) << 16;
2222+ splashsrc += 2;
2223+ d <<= 2;
2224+ fb_writel(dd, dst);
2225+ dst += 4;
2226+ }
2227+ dst += info->fix.line_length - width * 2;
2228+ splashsrc += info->splash_bytes - width * 2;
2229+ }
2230+}
2231+
2232+void splash_putc(struct splash_data *sd, struct vc_data *vc, struct fb_info *info,
2233+ int c, int ypos, int xpos)
2234+{
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);
2242+}
2243+
2244+void splashcopy(u8 *dst, u8 *src, int height, int width, int dstbytes, int srcbytes)
2245+{
2246+ int i;
2247+
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++);
2254+ }
2255+ if (width & 2)
2256+ fb_writel(*q++,p++);
2257+ if (width & 1)
2258+ fb_writew(*(u16*)q,(u16*)p);
2259+ dst += dstbytes;
2260+ src += srcbytes;
2261+ }
2262+}
2263+
2264+static void splashset(u8 *dst, int height, int width, int dstbytes, u32 bgx) {
2265+ int i;
2266+
2267+ bgx |= bgx << 16;
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++);
2273+ }
2274+ if (width & 2)
2275+ fb_writel(bgx,p++);
2276+ if (width & 1)
2277+ fb_writew(bgx,(u16*)p);
2278+ dst += dstbytes;
2279+ }
2280+}
2281+
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);
2284+}
2285+
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)
2288+{
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;
2292+ u32 bgx;
2293+ u8 *dst;
2294+
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);
2301+ return;
2302+ }
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);
2306+}
2307+
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)
2310+{
2311+ struct fb_copyarea area;
2312+
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;
2323+
2324+ info->fbops->fb_copyarea(info, &area);
2325+}
2326+
2327+void splash_clear_margins(struct splash_data *sd, struct vc_data *vc, struct fb_info *info,
2328+ int bottom_only)
2329+{
2330+ unsigned int tw = vc->vc_cols*vc->vc_font.width;
2331+ unsigned int th = vc->vc_rows*vc->vc_font.height;
2332+
2333+ if (!bottom_only) {
2334+ /* top margin */
2335+ splashfill(info, 0, 0, sd->splash_text_yo, info->var.xres);
2336+ /* left margin */
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);
2340+
2341+ }
2342+ splashfill(info, sd->splash_text_yo + th, 0, info->var.yres - sd->splash_text_yo - th, info->var.xres);
2343+}
2344+
2345+void splash_cursor(struct splash_data *sd, struct fb_info *info, struct fb_cursor *cursor)
2346+{
2347+ int i;
2348+ unsigned int dsize, s_pitch;
2349+
2350+ if (cursor->set & FB_CUR_SETSIZE) {
2351+ info->cursor.image.height = cursor->image.height;
2352+ info->cursor.image.width = cursor->image.width;
2353+ }
2354+ if (cursor->set & FB_CUR_SETPOS) {
2355+ info->cursor.image.dx = cursor->image.dx;
2356+ info->cursor.image.dy = cursor->image.dy;
2357+ }
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;
2364+ } else {
2365+ if (cursor->image.cmap.len)
2366+ fb_copy_cmap(&cursor->image.cmap, &info->cursor.image.cmap, 0);
2367+ }
2368+ info->cursor.image.depth = cursor->image.depth;
2369+ }
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) {
2374+ case ROP_XOR:
2375+ for (i = 0; i < dsize; i++)
2376+ info->fb_cursordata[i] = cursor->image.data[i] ^ info->cursor.mask[i];
2377+ break;
2378+ case ROP_COPY:
2379+ default:
2380+ for (i = 0; i < dsize; i++)
2381+ info->fb_cursordata[i] = cursor->image.data[i] & info->cursor.mask[i];
2382+ break;
2383+ }
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);
2388+}
2389+
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)
2391+{
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;
2397+ unsigned short c;
2398+ int x = dx;
2399+ unsigned short attr = 1;
2400+
2401+ do {
2402+ c = scr_readw(d);
2403+ if (attr != (c & 0xff00)) {
2404+ attr = c & 0xff00;
2405+ if (d > start) {
2406+ splash_putcs(sd, vc, info, start, d - start, y, x);
2407+ x += d - start;
2408+ start = d;
2409+ }
2410+ }
2411+ if (s >= ls && s < le && c == scr_readw(s)) {
2412+ if (d > start) {
2413+ splash_putcs(sd, vc, info, start, d - start, y, x);
2414+ x += d - start + 1;
2415+ start = d + 1;
2416+ } else {
2417+ x++;
2418+ start++;
2419+ }
2420+ }
2421+ s++;
2422+ d++;
2423+ } while (d < le);
2424+ if (d > start)
2425+ splash_putcs(sd, vc, info, start, d - start, y, x);
2426+}
2427+
2428+void splash_blank(struct splash_data *sd, struct vc_data *vc, struct fb_info *info, int blank)
2429+{
2430+ if (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);
2434+ } else {
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);
2439+ }
2440+}
2441diff -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
2444@@ -93,6 +93,9 @@
2445 #endif
2446
2447 #include "fbcon.h"
2448+#ifdef CONFIG_BOOTSPLASH
2449+#include "../bootsplash/bootsplash.h"
2450+#endif
2451
2452 #ifdef FBCONDEBUG
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)
2457 return;
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);
2463+ return;
2464+ }
2465+#endif
2466+ acquire_console_sem();
2467 info->fbops->fb_cursor(info, &info->cursor);
2468 release_console_sem();
2469 }
2470@@ -312,6 +321,14 @@
2471 {
2472 struct fb_copyarea area;
2473
2474+#ifdef CONFIG_BOOTSPLASH
2475+ if (info->splash_data) {
2476+ splash_bmove(info->splash_data, vc, info,
2477+ sy, sx, dy, dx, height, width);
2478+ return;
2479+ }
2480+#endif
2481+
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;
2488
2489+#ifdef CONFIG_BOOTSPLASH
2490+ if (info->splash_data) {
2491+ splash_clear(info->splash_data, vc, info,
2492+ sy, sx, height, width);
2493+ return;
2494+ }
2495+#endif
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;
2502
2503+#ifdef CONFIG_BOOTSPLASH
2504+ if (info->splash_data) {
2505+ splash_putcs(info->splash_data, vc, info, s, count, yy, xx);
2506+ return;
2507+ }
2508+#endif
2509+
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;
2516
2517+#ifdef CONFIG_BOOTSPLASH
2518+ if (info->splash_data) {
2519+ splash_clear_margins(info->splash_data, vc, info, bottom_only);
2520+ return;
2521+ }
2522+#endif
2523+
2524 region.color = attr_bgcol_ec(bgshift, vc);
2525 region.rop = ROP_COPY;
2526
2527@@ -650,6 +688,14 @@
2528 vc->vc_rows = rows;
2529 }
2530
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;
2535+ logo = 0;
2536+ }
2537+#endif
2538+
2539 if (logo) {
2540 /* Need to make room for the logo */
2541 int cnt;
2542@@ -817,6 +863,12 @@
2543 if (vt_cons[vc->vc_num]->vc_mode != KD_TEXT)
2544 return;
2545
2546+#ifdef CONFIG_BOOTSPLASH
2547+ if (info->splash_data) {
2548+ splash_putc(info->splash_data, vc, info, c, ypos, xpos);
2549+ return;
2550+ }
2551+#endif
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);
2562+ break;
2563+ }
2564+#endif
2565 info->fbops->fb_cursor(info, &cursor);
2566 }
2567 break;
2568@@ -966,6 +1024,13 @@
2569 mask[i++] = 0xff;
2570 }
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;
2576+ break;
2577+ }
2578+#endif
2579 info->fbops->fb_cursor(info, &cursor);
2580 vbl_cursor_cnt = CURSOR_DRAW_DELAY;
2581 break;
2582@@ -1269,6 +1334,10 @@
2583 fbcon_softback_note(vc, t, count);
2584 if (logo_shown >= 0)
2585 goto redraw_up;
2586+#ifdef CONFIG_BOOTSPLASH
2587+ if (info->splash_data)
2588+ goto redraw_up;
2589+#endif
2590 switch (p->scrollmode & __SCROLL_YMASK) {
2591 case __SCROLL_YMOVE:
2592 accel_bmove(vc, info, t + count, 0, t, 0,
2593@@ -1336,6 +1405,10 @@
2594 case SM_DOWN:
2595 if (count > vc->vc_rows) /* Maximum realistic size */
2596 count = vc->vc_rows;
2597+#ifdef CONFIG_BOOTSPLASH
2598+ if (info->splash_data)
2599+ goto redraw_down;
2600+#endif
2601 switch (p->scrollmode & __SCROLL_YMASK) {
2602 case __SCROLL_YMOVE:
2603 accel_bmove(vc, info, t, 0, t + count, 0,
2604@@ -1461,6 +1534,13 @@
2605 }
2606 return;
2607 }
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);
2612+ return;
2613+ }
2614+#endif
2615 accel_bmove(vc, info, real_y(p, sy), sx, real_y(p, dy), dx,
2616 height, width);
2617 }
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];
2621
2622+#ifdef CONFIG_BOOTSPLASH
2623+ splash_prepare(vc, info);
2624+#endif
2625+
2626 if (softback_top) {
2627 int l = fbcon_softback_size / vc->vc_size_row;
2628 if (softback_lines)
2629@@ -1613,6 +1697,12 @@
2630 fbcon_cursor(vc, blank ? CM_ERASE : CM_DRAW);
2631
2632 if (!info->fbops->fb_blank) {
2633+#ifdef CONFIG_BOOTSPLASH
2634+ if (info->splash_data) {
2635+ splash_blank(info->splash_data, vc, info, blank);
2636+ return 0;
2637+ }
2638+#endif
2639 if (blank) {
2640 unsigned short oldc;
2641 u_int height;
2642@@ -1759,7 +1849,13 @@
2643 vc->vc_complement_mask <<= 1;
2644 vc->vc_s_complement_mask <<= 1;
2645 }
2646-
2647+
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);
2651+ }
2652+#endif
2653+
2654 /* ++Edmund: reorder the attribute bits */
2655 {
2656 unsigned short *cp =
2657@@ -1789,6 +1885,7 @@
2658 }
2659
2660 if (resize) {
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 @@
2666
2667 if (!num_registered_fb)
2668 return -ENODEV;
2669+#ifdef CONFIG_BOOTSPLASH
2670+ splash_init();
2671+#endif
2672
2673 err = take_over_console(&fb_con, first_fb_vc, last_fb_vc,
2674 fbcon_is_default);
2675diff -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
2678@@ -23,6 +23,34 @@
2679 * low-level frame buffer device
2680 */
2681
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 */
2702+
2703+ int splash_dosilent; /* show silent jpeg */
2704+ unsigned char *splash_silentjpeg;
2705+ unsigned char *splash_sboxes;
2706+ int splash_sboxcount;
2707+};
2708+#endif
2709+
2710 struct display {
2711 /* Filled in by the frame buffer device */
2712 u_short inverse; /* != 0 text black on white as default */
2713diff -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 @@
2717 return 0;
2718 }
2719
2720-static struct fb_ops vesafb_ops = {
2721+#ifndef CONFIG_BOOTSPLASH
2722+static
2723+#endif
2724+struct fb_ops vesafb_ops = {
2725 .owner = THIS_MODULE,
2726 .fb_setcolreg = vesafb_setcolreg,
2727 .fb_pan_display = vesafb_pan_display,
2728diff -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
2731@@ -87,6 +87,9 @@
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;
2737+#endif
2738 /* additional information is in vt_kern.h */
2739 };
2740
2741diff -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 @@
2745
2746 /* From here on everything is device dependent */
2747 void *par;
2748+#ifdef CONFIG_BOOTSPLASH
2749+ struct splash_data *splash_data;
2750+ unsigned char *splash_pic;
2751+ int splash_pic_size;
2752+ int splash_bytes;
2753+ char *silent_screen_base; /* real screen base */
2754+ char fb_cursordata[64];
2755+#endif
2756+
2757 };
2758
2759 #ifdef MODULE
2760diff -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
2763@@ -82,6 +82,12 @@
2764 * We can't use the "normal" timers since we just panicked..
2765 */
2766 printk(KERN_EMERG "Rebooting in %d seconds..",panic_timeout);
2767+#ifdef CONFIG_BOOTSPLASH
2768+ {
2769+ extern int splash_verbose(void);
2770+ (void)splash_verbose();
2771+ }
2772+#endif
2773 for (i = 0; i < panic_timeout; i++) {
2774 touch_nmi_watchdog();
2775 mdelay(1000);
2776@@ -105,6 +111,12 @@
2777 disabled_wait(caller);
2778 #endif
2779 local_irq_enable();
2780+#ifdef CONFIG_BOOTSPLASH
2781+ {
2782+ extern int splash_verbose(void);
2783+ (void)splash_verbose();
2784+ }
2785+#endif
2786 for (;;)
2787 ;
2788 }
This page took 0.635886 seconds and 4 git commands to generate.