]> git.pld-linux.org Git - packages/kernel.git/blob - bootsplash-3.1.6-2.6.15.diff
- up to 2.6.27.10
[packages/kernel.git] / bootsplash-3.1.6-2.6.15.diff
1 diff -ruNp -X linux-2.6.15/Documentation/dontdiff linux-2.6.15/drivers/char/keyboard.c linux-2.6.15-VinX/drivers/char/keyboard.c
2 --- linux-2.6.15/drivers/char/keyboard.c        2006-01-03 04:21:10.000000000 +0100
3 +++ linux-2.6.15-VinX/drivers/char/keyboard.c   2006-01-05 01:17:07.000000000 +0100
4 @@ -1062,6 +1062,15 @@ static void kbd_keycode(unsigned int key
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 +
17  #ifdef CONFIG_MAGIC_SYSRQ             /* Handle the SysRq Hack */
18         if (keycode == KEY_SYSRQ && (sysrq_down || (down == 1 && sysrq_alt))) {
19                 if (!sysrq_down) {
20 diff -ruNp -X linux-2.6.15/Documentation/dontdiff linux-2.6.15/drivers/char/n_tty.c linux-2.6.15-VinX/drivers/char/n_tty.c
21 --- linux-2.6.15/drivers/char/n_tty.c   2006-01-03 04:21:10.000000000 +0100
22 +++ linux-2.6.15-VinX/drivers/char/n_tty.c      2006-01-05 01:17:07.000000000 +0100
23 @@ -1292,6 +1292,15 @@ do_it_again:
24                         tty->minimum_to_wake = (minimum - (b - buf));
25                 
26                 if (!input_available_p(tty, 0)) {
27 +#ifdef CONFIG_BOOTSPLASH
28 +                       if (file->f_dentry->d_inode->i_rdev == MKDEV(TTY_MAJOR,0) ||
29 +                           file->f_dentry->d_inode->i_rdev == MKDEV(TTY_MAJOR,1) ||
30 +                           file->f_dentry->d_inode->i_rdev == MKDEV(TTYAUX_MAJOR,0) ||
31 +                           file->f_dentry->d_inode->i_rdev == MKDEV(TTYAUX_MAJOR,1)) {
32 +                               extern int splash_verbose(void);
33 +                               (void)splash_verbose();
34 +                       }
35 +#endif
36                         if (test_bit(TTY_OTHER_CLOSED, &tty->flags)) {
37                                 retval = -EIO;
38                                 break;
39 diff -ruNp -X linux-2.6.15/Documentation/dontdiff linux-2.6.15/drivers/char/vt.c linux-2.6.15-VinX/drivers/char/vt.c
40 --- linux-2.6.15/drivers/char/vt.c      2006-01-03 04:21:10.000000000 +0100
41 +++ linux-2.6.15-VinX/drivers/char/vt.c 2006-01-05 01:17:07.000000000 +0100
42 @@ -3260,6 +3260,31 @@ void vcs_scr_writew(struct vc_data *vc, 
43         }
44  }
45  
46 +#ifdef CONFIG_BOOTSPLASH
47 +void con_remap_def_color(struct vc_data *vc, int new_color)
48 +{
49 +       unsigned short *sbuf = vc->vc_screenbuf;
50 +       unsigned c, len = vc->vc_screenbuf_size >> 1;
51 +       int old_color;
52 +
53 +       if (sbuf) {
54 +              old_color = vc->vc_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 +       vc->vc_def_color = vc->vc_color = new_color;
67 +       update_attr(vc);
68 +}
69 +#endif
70 +
71  /*
72   *     Visible symbols for modules
73   */
74 diff -ruNp -X linux-2.6.15/Documentation/dontdiff linux-2.6.15/drivers/video/Kconfig linux-2.6.15-VinX/drivers/video/Kconfig
75 --- linux-2.6.15/drivers/video/Kconfig  2006-01-03 04:21:10.000000000 +0100
76 +++ linux-2.6.15-VinX/drivers/video/Kconfig     2006-01-05 01:17:11.000000000 +0100
77 @@ -1469,5 +1469,9 @@ if FB && SYSFS
78         source "drivers/video/backlight/Kconfig"
79  endif
80  
81 +if FB
82 +       source "drivers/video/bootsplash/Kconfig"
83 +endif
84 +
85  endmenu
86  
87 diff -ruNp -X linux-2.6.15/Documentation/dontdiff linux-2.6.15/drivers/video/Makefile linux-2.6.15-VinX/drivers/video/Makefile
88 --- linux-2.6.15/drivers/video/Makefile 2006-01-03 04:21:10.000000000 +0100
89 +++ linux-2.6.15-VinX/drivers/video/Makefile    2006-01-05 01:17:11.000000000 +0100
90 @@ -7,6 +7,7 @@
91  obj-$(CONFIG_VT)                 += console/
92  obj-$(CONFIG_LOGO)               += logo/
93  obj-$(CONFIG_SYSFS)              += backlight/
94 +obj-$(CONFIG_BOOTSPLASH)         += bootsplash/
95  
96  obj-$(CONFIG_FB_CFB_FILLRECT)  += cfbfillrect.o
97  obj-$(CONFIG_FB_CFB_COPYAREA)  += cfbcopyarea.o
98 diff -ruNp -X linux-2.6.15/Documentation/dontdiff linux-2.6.15/drivers/video/bootsplash/Kconfig linux-2.6.15-VinX/drivers/video/bootsplash/Kconfig
99 --- linux-2.6.15/drivers/video/bootsplash/Kconfig       1970-01-01 01:00:00.000000000 +0100
100 +++ linux-2.6.15-VinX/drivers/video/bootsplash/Kconfig  2006-01-05 01:17:11.000000000 +0100
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 +
119 diff -ruNp -X linux-2.6.15/Documentation/dontdiff linux-2.6.15/drivers/video/bootsplash/Makefile linux-2.6.15-VinX/drivers/video/bootsplash/Makefile
120 --- linux-2.6.15/drivers/video/bootsplash/Makefile      1970-01-01 01:00:00.000000000 +0100
121 +++ linux-2.6.15-VinX/drivers/video/bootsplash/Makefile 2006-01-05 01:17:11.000000000 +0100
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
128 diff -ruNp -X linux-2.6.15/Documentation/dontdiff linux-2.6.15/drivers/video/bootsplash/bootsplash.c linux-2.6.15-VinX/drivers/video/bootsplash/bootsplash.c
129 --- linux-2.6.15/drivers/video/bootsplash/bootsplash.c  1970-01-01 01:00:00.000000000 +0100
130 +++ linux-2.6.15-VinX/drivers/video/bootsplash/bootsplash.c     2006-01-05 01:17:09.000000000 +0100
131 @@ -0,0 +1,984 @@
132 +/* 
133 + *           linux/drivers/video/bootsplash/bootsplash.c - 
134 + *                 splash screen handling functions.
135 + *     
136 + *     (w) 2001-2004 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 +
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 +#include <linux/syscalls.h>
154 +
155 +#include <asm/irq.h>
156 +#include <asm/system.h>
157 +
158 +#include "../console/fbcon.h"
159 +#include "bootsplash.h"
160 +#include "decode-jpg.h"
161 +
162 +/* extern struct fb_ops vesafb_ops; */
163 +extern signed char con2fb_map[MAX_NR_CONSOLES];
164 +
165 +#define SPLASH_VERSION "3.1.6-2004/03/31"
166 +
167 +/* These errors have to match fbcon-jpegdec.h */
168 +static unsigned char *jpg_errors[] = {
169 +       "no SOI found", 
170 +       "not 8 bit", 
171 +       "height mismatch", 
172 +       "width mismatch",
173 +       "bad width or height", 
174 +       "too many COMPPs", 
175 +       "illegal HV", 
176 +       "quant table selector",
177 +       "picture is not YCBCR 221111",
178 +       "unknow CID in scan",
179 +       "dct not sequential",
180 +       "wrong marker",
181 +       "no EOI",
182 +       "bad tables",
183 +       "depth mismatch"
184 +};
185 +
186 +static struct jpeg_decdata *decdata = 0; /* private decoder data */
187 +
188 +static int splash_registered = 0;
189 +static int splash_usesilent = 0;       /* shall we display the silentjpeg? */
190 +int splash_default = 0xf01;
191 +
192 +static int splash_check_jpeg(unsigned char *jpeg, int width, int height, int depth);
193 +
194 +static int __init splash_setup(char *options)
195 +{
196 +       if(!strncmp("silent", options, 6)) {
197 +               printk(KERN_INFO "bootsplash: silent mode.\n");
198 +               splash_usesilent = 1;
199 +               /* skip "silent," */
200 +               if (strlen(options) == 6)
201 +                       return 0;
202 +               options += 7;
203 +       }
204 +       if(!strncmp("verbose", options, 7)) {
205 +               printk(KERN_INFO "bootsplash: verbose mode.\n");
206 +               splash_usesilent = 0;
207 +               return 0;
208 +       }
209 +       splash_default = simple_strtoul(options, NULL, 0);
210 +       return 0;
211 +}
212 +
213 +__setup("splash=", splash_setup);
214 +
215 +
216 +static int splash_hasinter(unsigned char *buf, int num)
217 +{
218 +    unsigned char *bufend = buf + num * 12;
219 +    while(buf < bufend) {
220 +       if (buf[1] > 127)               /* inter? */
221 +           return 1;
222 +       buf += buf[3] > 127 ? 24 : 12;  /* blend? */
223 +    }
224 +    return 0;
225 +}
226 +
227 +static int boxextract(unsigned char *buf, unsigned short *dp, unsigned char *cols, int *blendp)
228 +{
229 +    dp[0] = buf[0] | buf[1] << 8;
230 +    dp[1] = buf[2] | buf[3] << 8;
231 +    dp[2] = buf[4] | buf[5] << 8;
232 +    dp[3] = buf[6] | buf[7] << 8;
233 +    *(unsigned int *)(cols + 0) =
234 +       *(unsigned int *)(cols + 4) =
235 +       *(unsigned int *)(cols + 8) =
236 +       *(unsigned int *)(cols + 12) = *(unsigned int *)(buf + 8);
237 +    if (dp[1] > 32767) {
238 +       dp[1] = ~dp[1];
239 +       *(unsigned int *)(cols + 4) = *(unsigned int *)(buf + 12);
240 +       *(unsigned int *)(cols + 8) = *(unsigned int *)(buf + 16);
241 +       *(unsigned int *)(cols + 12) = *(unsigned int *)(buf + 20);
242 +       *blendp = 1;
243 +       return 24;
244 +    }
245 +    return 12;
246 +}
247 +
248 +static void boxit(unsigned char *pic, int bytes, unsigned char *buf, int num, int percent, int overpaint)
249 +{
250 +    int x, y, i, p, doblend, r, g, b, a, add;
251 +    unsigned short data1[4];
252 +    unsigned char cols1[16];
253 +    unsigned short data2[4];
254 +    unsigned char cols2[16];
255 +    unsigned char *bufend;
256 +    unsigned short *picp;
257 +    unsigned int stipple[32], sti, stin, stinn, stixs, stixe, stiys, stiye;
258 +    int xs, xe, ys, ye, xo, yo;
259 +
260 +    if (num == 0)
261 +       return;
262 +    bufend = buf + num * 12;
263 +    stipple[0] = 0xffffffff;
264 +    stin = 1;
265 +    stinn = 0;
266 +    stixs = stixe = 0;
267 +    stiys = stiye = 0;
268 +    while(buf < bufend) {
269 +       doblend = 0;
270 +       buf += boxextract(buf, data1, cols1, &doblend);
271 +       if (data1[0] == 32767 && data1[1] == 32767) {
272 +           /* box stipple */
273 +           if (stinn == 32)
274 +               continue;
275 +           if (stinn == 0) {
276 +               stixs = data1[2];
277 +               stixe = data1[3];
278 +               stiys = stiye = 0;
279 +           } else if (stinn == 4) {
280 +               stiys = data1[2];
281 +               stiye = data1[3];
282 +           }
283 +           stipple[stinn++] = (cols1[ 0] << 24) | (cols1[ 1] << 16) | (cols1[ 2] << 8) | cols1[ 3] ;
284 +           stipple[stinn++] = (cols1[ 4] << 24) | (cols1[ 5] << 16) | (cols1[ 6] << 8) | cols1[ 7] ;
285 +           stipple[stinn++] = (cols1[ 8] << 24) | (cols1[ 9] << 16) | (cols1[10] << 8) | cols1[11] ;
286 +           stipple[stinn++] = (cols1[12] << 24) | (cols1[13] << 16) | (cols1[14] << 8) | cols1[15] ;
287 +           stin = stinn;
288 +           continue;
289 +       }
290 +       stinn = 0;
291 +       if (data1[0] > 32767)
292 +           buf += boxextract(buf, data2, cols2, &doblend);
293 +       if (data1[0] == 32767 && data1[1] == 32766) {
294 +           /* box copy */
295 +           i = 12 * (short)data1[3];
296 +           doblend = 0;
297 +           i += boxextract(buf + i, data1, cols1, &doblend);
298 +           if (data1[0] > 32767)
299 +               boxextract(buf + i, data2, cols2, &doblend);
300 +       }
301 +       if (data1[0] == 32767)
302 +           continue;
303 +       if (data1[2] > 32767) {
304 +           if (overpaint)
305 +               continue;
306 +           data1[2] = ~data1[2];
307 +       }
308 +       if (data1[3] > 32767) {
309 +           if (percent == 65536)
310 +               continue;
311 +           data1[3] = ~data1[3];
312 +       }
313 +       if (data1[0] > 32767) {
314 +           data1[0] = ~data1[0];
315 +           for (i = 0; i < 4; i++)
316 +               data1[i] = (data1[i] * (65536 - percent) + data2[i] * percent) >> 16;
317 +           for (i = 0; i < 16; i++)
318 +               cols1[i] = (cols1[i] * (65536 - percent) + cols2[i] * percent) >> 16;
319 +       }
320 +       *(unsigned int *)cols2 = *(unsigned int *)cols1;
321 +       a = cols2[3];
322 +       if (a == 0 && !doblend)
323 +           continue;
324 +
325 +       if (stixs >= 32768) {
326 +           xo = xs = (stixs ^ 65535) + data1[0];
327 +           xe = stixe ? stixe + data1[0] : data1[2];
328 +       } else if (stixe >= 32768) {
329 +           xs = stixs ? data1[2] - stixs : data1[0];
330 +           xe = data1[2] - (stixe ^ 65535);
331 +           xo = xe + 1;
332 +       } else {
333 +           xo = xs = stixs;
334 +           xe = stixe ? stixe : data1[2];
335 +       }
336 +       if (stiys >= 32768) {
337 +           yo = ys = (stiys ^ 65535) + data1[1];
338 +           ye = stiye ? stiye + data1[1] : data1[3];
339 +       } else if (stiye >= 32768) {
340 +           ys = stiys ? data1[3] - stiys : data1[1];
341 +           ye = data1[3] - (stiye ^ 65535);
342 +           yo = ye + 1;
343 +       } else {
344 +           yo = ys = stiys;
345 +           ye = stiye ? stiye : data1[3];
346 +       }
347 +       xo = 32 - (xo & 31);
348 +       yo = stin - (yo % stin);
349 +       if (xs < data1[0])
350 +           xs = data1[0];
351 +       if (xe > data1[2])
352 +           xe = data1[2];
353 +       if (ys < data1[1])
354 +           ys = data1[1];
355 +       if (ye > data1[3])
356 +           ye = data1[3];
357 +
358 +       for (y = ys; y <= ye; y++) {
359 +           sti = stipple[(y + yo) % stin];
360 +           x = (xs + xo) & 31;
361 +           if (x)
362 +               sti = (sti << x) | (sti >> (32 - x));
363 +           if (doblend) {
364 +               if ((p = data1[3] - data1[1]) != 0)
365 +                   p = ((y - data1[1]) << 16) / p;
366 +               for (i = 0; i < 8; i++)
367 +                   cols2[i + 8] = (cols1[i] * (65536 - p) + cols1[i + 8] * p) >> 16;
368 +           }
369 +           add = (xs & 1);
370 +           add ^= (add ^ y) & 1 ? 1 : 3;               /* 2x2 ordered dithering */
371 +           picp = (unsigned short *)(pic + xs * 2 + y * bytes);
372 +           for (x = xs; x <= xe; x++) {
373 +               if (!(sti & 0x80000000)) {
374 +                   sti <<= 1;
375 +                   picp++;
376 +                   add ^= 3;
377 +                   continue;
378 +               }
379 +               sti = (sti << 1) | 1;
380 +               if (doblend) {
381 +                   if ((p = data1[2] - data1[0]) != 0)
382 +                       p = ((x - data1[0]) << 16) / p;
383 +                   for (i = 0; i < 4; i++)
384 +                       cols2[i] = (cols2[i + 8] * (65536 - p) + cols2[i + 12] * p) >> 16;
385 +                   a = cols2[3];
386 +               }
387 +               r = cols2[0];
388 +               g = cols2[1];
389 +               b = cols2[2];
390 +               if (a != 255) {
391 +                   i = *picp;
392 +                   r = ((i >> 8 & 0xf8) * (255 - a) + r * a) / 255;
393 +                   g = ((i >> 3 & 0xfc) * (255 - a) + g * a) / 255;
394 +                   b = ((i << 3 & 0xf8) * (255 - a) + b * a) / 255;
395 +               }
396 +  #define CLAMP(x) ((x) >= 256 ? 255 : (x))
397 +               i = ((CLAMP(r + add*2+1) & 0xf8) <<  8) |
398 +                   ((CLAMP(g + add    ) & 0xfc) <<  3) |
399 +                   ((CLAMP(b + add*2+1)       ) >>  3);
400 +               *picp++ = i;
401 +               add ^= 3;
402 +           }
403 +       }
404 +    }
405 +}
406 +
407 +static int splash_check_jpeg(unsigned char *jpeg, int width, int height, int depth)
408 +{
409 +    int size, err;
410 +    unsigned char *mem;
411 +
412 +    size = ((width + 15) & ~15) * ((height + 15) & ~15) * (depth >> 3);
413 +    mem = vmalloc(size);
414 +    if (!mem) {
415 +       printk(KERN_INFO "bootsplash: no memory for decoded picture.\n");
416 +       return -1;
417 +    }
418 +    if (!decdata)
419 +       decdata = vmalloc(sizeof(*decdata));
420 +    if ((err = jpeg_decode(jpeg, mem, ((width + 15) & ~15), ((height + 15) & ~15), depth, decdata)))
421 +         printk(KERN_INFO "bootsplash: error while decompressing picture: %s (%d)\n",jpg_errors[err - 1], err);
422 +    vfree(mem);
423 +    return err ? -1 : 0;
424 +}
425 +
426 +static void splash_free(struct vc_data *vc, struct fb_info *info)
427 +{
428 +    if (!vc->vc_splash_data)
429 +       return;
430 +    if (info->silent_screen_base)
431 +           info->screen_base = info->silent_screen_base;
432 +    info->silent_screen_base = 0;
433 +    if (vc->vc_splash_data->splash_silentjpeg)
434 +           vfree(vc->vc_splash_data->splash_sboxes);
435 +    vfree(vc->vc_splash_data);
436 +    vc->vc_splash_data = 0;
437 +    info->splash_data = 0;
438 +}
439 +
440 +static int splash_mkpenguin(struct splash_data *data, int pxo, int pyo, int pwi, int phe, int pr, int pg, int pb)
441 +{
442 +    unsigned char *buf;
443 +    int i;
444 +
445 +    if (pwi ==0 || phe == 0)
446 +       return 0;
447 +    buf = (unsigned char *)data + sizeof(*data);
448 +    pwi += pxo - 1;
449 +    phe += pyo - 1;
450 +    *buf++ = pxo;
451 +    *buf++ = pxo >> 8;
452 +    *buf++ = pyo;
453 +    *buf++ = pyo >> 8;
454 +    *buf++ = pwi;
455 +    *buf++ = pwi >> 8;
456 +    *buf++ = phe;
457 +    *buf++ = phe >> 8;
458 +    *buf++ = pr;
459 +    *buf++ = pg;
460 +    *buf++ = pb;
461 +    *buf++ = 0;
462 +    for (i = 0; i < 12; i++, buf++)
463 +       *buf = buf[-12];
464 +    buf[-24] ^= 0xff;
465 +    buf[-23] ^= 0xff;
466 +    buf[-1] = 0xff;
467 +    return 2;
468 +}
469 +
470 +static const int splash_offsets[3][16] = {
471 +    /* len, unit, size, state, fgcol, col, xo, yo, wi, he
472 +       boxcnt, ssize, sboxcnt, percent, overok, palcnt */
473 +    /* V1 */
474 +    {   20,   -1,   16,    -1,    -1,  -1,  8, 10, 12, 14,
475 +           -1,    -1,      -1,      -1,     -1,     -1 },
476 +    /* V2 */
477 +    {   35,    8,   12,     9,    10,  11, 16, 18, 20, 22,
478 +           -1,    -1,      -1,      -1,     -1,     -1 },
479 +    /* V3 */
480 +    {   38,    8,   12,     9,    10,  11, 16, 18, 20, 22,
481 +           24,    28,      32,      34,     36,     37 },
482 +};
483 +
484 +#define SPLASH_OFF_LEN     offsets[0]
485 +#define SPLASH_OFF_UNIT    offsets[1]
486 +#define SPLASH_OFF_SIZE    offsets[2]
487 +#define SPLASH_OFF_STATE   offsets[3]
488 +#define SPLASH_OFF_FGCOL   offsets[4]
489 +#define SPLASH_OFF_COL     offsets[5]
490 +#define SPLASH_OFF_XO      offsets[6]
491 +#define SPLASH_OFF_YO      offsets[7]
492 +#define SPLASH_OFF_WI      offsets[8]
493 +#define SPLASH_OFF_HE      offsets[9]
494 +#define SPLASH_OFF_BOXCNT  offsets[10]
495 +#define SPLASH_OFF_SSIZE   offsets[11]
496 +#define SPLASH_OFF_SBOXCNT offsets[12]
497 +#define SPLASH_OFF_PERCENT offsets[13]
498 +#define SPLASH_OFF_OVEROK  offsets[14]
499 +#define SPLASH_OFF_PALCNT  offsets[15]
500 +
501 +static inline int splash_getb(unsigned char *pos, int off)
502 +{
503 +    return off == -1 ? 0 : pos[off];
504 +}
505 +
506 +static inline int splash_gets(unsigned char *pos, int off)
507 +{
508 +    return off == -1 ? 0 : pos[off] | pos[off + 1] << 8;
509 +}
510 +
511 +static inline int splash_geti(unsigned char *pos, int off)
512 +{
513 +    return off == -1 ? 0 :
514 +           pos[off] | pos[off + 1] << 8 | pos[off + 2] << 16 | pos[off + 3] << 24;
515 +}
516 +
517 +static int splash_getraw(unsigned char *start, unsigned char *end, int *update)
518 +{
519 +    unsigned char *ndata;
520 +    int version;
521 +    int splash_size;
522 +    int unit;
523 +    int width, height;
524 +    int silentsize;
525 +    int boxcnt;
526 +    int sboxcnt;
527 +    int palcnt;
528 +    int i, len;
529 +    const int *offsets;
530 +    struct vc_data *vc;
531 +    struct fb_info *info;
532 +    struct splash_data *sd;
533 +
534 +    if (update)
535 +       *update = -1;
536 +
537 +    if (!update || start[7] < '2' || start[7] > '3' || splash_geti(start, 12) != (int)0xffffffff)
538 +       printk(KERN_INFO "bootsplash %s: looking for picture...", SPLASH_VERSION);
539 +
540 +    for (ndata = start; ndata < end; ndata++) {
541 +       if (ndata[0] != 'B' || ndata[1] != 'O' || ndata[2] != 'O' || ndata[3] != 'T')
542 +           continue;
543 +       if (ndata[4] != 'S' || ndata[5] != 'P' || ndata[6] != 'L' || ndata[7] < '1' || ndata[7] > '3')
544 +           continue;
545 +       version = ndata[7] - '0';
546 +       offsets = splash_offsets[version - 1];
547 +       len = SPLASH_OFF_LEN;
548 +       unit = splash_getb(ndata, SPLASH_OFF_UNIT);
549 +       if (unit >= MAX_NR_CONSOLES)
550 +           continue;
551 +       if (unit) {
552 +               vc_allocate(unit);
553 +       }
554 +       vc = vc_cons[unit].d;
555 +       info = registered_fb[(int)con2fb_map[unit]];
556 +       width = info->var.xres;
557 +       height = info->var.yres;
558 +       splash_size = splash_geti(ndata, SPLASH_OFF_SIZE);
559 +       if (splash_size == (int)0xffffffff && version > 1) {
560 +           if ((sd = vc->vc_splash_data) != 0) {
561 +               int up = 0;
562 +               i = splash_getb(ndata, SPLASH_OFF_STATE);
563 +               if (i != 255) {
564 +                   sd->splash_state = i;
565 +                   up = -1;
566 +               }
567 +               i = splash_getb(ndata, SPLASH_OFF_FGCOL);
568 +               if (i != 255) {
569 +                   sd->splash_fg_color = i;
570 +                   up = -1;
571 +               }
572 +               i = splash_getb(ndata, SPLASH_OFF_COL);
573 +               if (i != 255) {
574 +                   sd->splash_color = i;
575 +                   up = -1;
576 +               }
577 +               boxcnt = sboxcnt = 0;
578 +               if (ndata + len <= end) {
579 +                   boxcnt = splash_gets(ndata, SPLASH_OFF_BOXCNT);
580 +                   sboxcnt = splash_gets(ndata, SPLASH_OFF_SBOXCNT);
581 +               }
582 +               if (boxcnt) {
583 +                   i = splash_gets(ndata, len);
584 +                   if (boxcnt + i <= sd->splash_boxcount && ndata + len + 2 + boxcnt * 12 <= end) {
585 +
586 +                       if (splash_geti(ndata, len + 2) != 0x7ffd7fff || !memcmp(ndata + len + 2, sd->splash_boxes + i * 12, 8)) {
587 +
588 +                           memcpy(sd->splash_boxes + i * 12, ndata + len + 2, boxcnt * 12);
589 +                           up |= 1;
590 +                       }
591 +                   }
592 +                   len += boxcnt * 12 + 2;
593 +               }
594 +               if (sboxcnt) {
595 +                   i = splash_gets(ndata, len);
596 +                   if (sboxcnt + i <= sd->splash_sboxcount && ndata + len + 2 + sboxcnt * 12 <= end) {
597 +                       if (splash_geti(ndata, len + 2) != 0x7ffd7fff || !memcmp(ndata + len + 2, sd->splash_sboxes + i * 12, 8)) {
598 +                           memcpy(sd->splash_sboxes + i * 12, ndata + len + 2, sboxcnt * 12);
599 +                           up |= 2;
600 +                       }
601 +                   }
602 +               }
603 +               if (update)
604 +                   *update = up;
605 +           }
606 +           return unit;
607 +       }
608 +       if (splash_size == 0) {
609 +           printk(KERN_INFO"...found, freeing memory.\n");
610 +           if (vc->vc_splash_data)
611 +               splash_free(vc, info);
612 +           return unit;
613 +       }
614 +       boxcnt = splash_gets(ndata, SPLASH_OFF_BOXCNT);
615 +       palcnt = 3 * splash_getb(ndata, SPLASH_OFF_PALCNT);
616 +       if (ndata + len + splash_size > end) {
617 +           printk(KERN_INFO "...found, but truncated!\n");
618 +           return -1;
619 +       }
620 +       if (!jpeg_check_size(ndata + len + boxcnt * 12 + palcnt, width, height)) {
621 +           ndata += len + splash_size - 1;
622 +           continue;
623 +       }
624 +       if (splash_check_jpeg(ndata + len + boxcnt * 12 + palcnt, width, height, info->var.bits_per_pixel))
625 +           return -1;
626 +       silentsize = splash_geti(ndata, SPLASH_OFF_SSIZE);
627 +       if (silentsize)
628 +           printk(KERN_INFO" silentjpeg size %d bytes,", silentsize);
629 +       if (silentsize >= splash_size) {
630 +           printk(KERN_INFO " bigger than splashsize!\n");
631 +           return -1;
632 +       }
633 +       splash_size -= silentsize;
634 +       if (!splash_usesilent)
635 +           silentsize = 0;
636 +       else if (height * 2 * info->fix.line_length > info->fix.smem_len) {
637 +           printk(KERN_INFO " does not fit into framebuffer.\n");
638 +           silentsize = 0;
639 +       }
640 +       sboxcnt = splash_gets(ndata, SPLASH_OFF_SBOXCNT);
641 +       if (silentsize) {
642 +           unsigned char *simage = ndata + len + splash_size + 12 * sboxcnt;
643 +           if (!jpeg_check_size(simage, width, height) ||
644 +               splash_check_jpeg(simage, width, height, info->var.bits_per_pixel)) {
645 +                   printk(KERN_INFO " error in silent jpeg.\n");
646 +                   silentsize = 0;
647 +               }
648 +       }
649 +       if (vc->vc_splash_data)
650 +           splash_free(vc, info);
651 +       vc->vc_splash_data = sd = vmalloc(sizeof(*sd) + splash_size + (version < 3 ? 2 * 12 : 0));
652 +       if (!sd)
653 +           break;
654 +       sd->splash_silentjpeg = 0;
655 +       sd->splash_sboxes = 0;
656 +       sd->splash_sboxcount = 0;
657 +       if (silentsize) {
658 +           sd->splash_silentjpeg = vmalloc(silentsize);
659 +           if (sd->splash_silentjpeg) {
660 +               memcpy(sd->splash_silentjpeg, ndata + len + splash_size, silentsize);
661 +               sd->splash_sboxes = vc->vc_splash_data->splash_silentjpeg;
662 +               sd->splash_silentjpeg += 12 * sboxcnt;
663 +               sd->splash_sboxcount = sboxcnt;
664 +           }
665 +       }
666 +       sd->splash_state = splash_getb(ndata, SPLASH_OFF_STATE);
667 +       sd->splash_fg_color = splash_getb(ndata, SPLASH_OFF_FGCOL);
668 +       sd->splash_color = splash_getb(ndata, SPLASH_OFF_COL);
669 +       sd->splash_overpaintok = splash_getb(ndata, SPLASH_OFF_OVEROK);
670 +       sd->splash_text_xo = splash_gets(ndata, SPLASH_OFF_XO);
671 +       sd->splash_text_yo = splash_gets(ndata, SPLASH_OFF_YO);
672 +       sd->splash_text_wi = splash_gets(ndata, SPLASH_OFF_WI);
673 +       sd->splash_text_he = splash_gets(ndata, SPLASH_OFF_HE);
674 +       sd->splash_percent = splash_gets(ndata, SPLASH_OFF_PERCENT);
675 +       if (version == 1) {
676 +           sd->splash_text_xo *= 8;
677 +           sd->splash_text_wi *= 8;
678 +           sd->splash_text_yo *= 16;
679 +           sd->splash_text_he *= 16;
680 +           sd->splash_color    = (splash_default >> 8) & 0x0f;
681 +           sd->splash_fg_color = (splash_default >> 4) & 0x0f;
682 +           sd->splash_state    = splash_default & 1;
683 +       }
684 +       if (sd->splash_text_xo + sd->splash_text_wi > width || sd->splash_text_yo + sd->splash_text_he > height) {
685 +           splash_free(vc, info);
686 +           printk(KERN_INFO " found, but has oversized text area!\n");
687 +           return -1;
688 +       }
689 +/*     if (!vc_cons[unit].d || info->fbops != &vesafb_ops) {
690 +           splash_free(vc, info);
691 +           printk(KERN_INFO " found, but framebuffer can't handle it!\n");
692 +           return -1;
693 +       } */
694 +       printk(KERN_INFO "...found (%dx%d, %d bytes, v%d).\n", width, height, splash_size, version);
695 +       if (version == 1) {
696 +           printk(KERN_WARNING "bootsplash: Using deprecated v1 header. Updating your splash utility recommended.\n");
697 +           printk(KERN_INFO    "bootsplash: Find the latest version at http://www.bootsplash.org/\n");
698 +       }
699 +
700 +       /* fake penguin box for older formats */
701 +       if (version == 1)
702 +           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);
703 +       else if (version == 2)
704 +           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));
705 +
706 +       memcpy((char *)sd + sizeof(*sd) + (version < 3 ? boxcnt * 12 : 0), ndata + len, splash_size);
707 +       sd->splash_boxcount = boxcnt;
708 +       sd->splash_boxes = (unsigned char *)sd + sizeof(*sd);
709 +       sd->splash_palette = sd->splash_boxes + boxcnt * 12;
710 +       sd->splash_jpeg = sd->splash_palette + palcnt;
711 +       sd->splash_palcnt = palcnt / 3;
712 +       sd->splash_dosilent = sd->splash_silentjpeg != 0;
713 +       return unit;
714 +    }
715 +    printk(KERN_INFO "...no good signature found.\n");
716 +    return -1;
717 +}
718 +
719 +int splash_verbose(void) 
720 +{
721 +    struct vc_data *vc;
722 +    struct fb_info *info;
723 +
724 +    if (!splash_usesilent)
725 +        return 0;
726 +
727 +    vc = vc_cons[0].d;
728 +
729 +    if (!vc || !vc->vc_splash_data || !vc->vc_splash_data->splash_state)
730 +       return 0;
731 +    if (fg_console != vc->vc_num)
732 +       return 0;
733 +    if (!vc->vc_splash_data->splash_silentjpeg || !vc->vc_splash_data->splash_dosilent)
734 +       return 0;
735 +    vc->vc_splash_data->splash_dosilent = 0;
736 +    info = registered_fb[(int)con2fb_map[0]];
737 +    if (!info->silent_screen_base)
738 +       return 0;
739 +    splashcopy(info->silent_screen_base, info->screen_base, info->var.yres, info->var.xres, info->fix.line_length, info->fix.line_length);
740 +    info->screen_base = info->silent_screen_base;
741 +    info->silent_screen_base = 0;
742 +    return 1;
743 +}
744 +
745 +static void splash_off(struct fb_info *info)
746 +{
747 +       if (info->silent_screen_base)
748 +               info->screen_base = info->silent_screen_base;
749 +       info->silent_screen_base = 0;
750 +       info->splash_data = 0;
751 +       if (info->splash_pic)
752 +               vfree(info->splash_pic);
753 +       info->splash_pic = 0;
754 +       info->splash_pic_size = 0;
755 +}
756 +
757 +int splash_prepare(struct vc_data *vc, struct fb_info *info)
758 +{
759 +       int err;
760 +        int width, height, depth, size, sbytes;
761 +
762 +       if (!vc->vc_splash_data || !vc->vc_splash_data->splash_state) {
763 +               if (decdata)
764 +                       vfree(decdata);
765 +               decdata = 0;
766 +               splash_off(info);
767 +               return -1;
768 +       }
769 +
770 +        width = info->var.xres;
771 +        height = info->var.yres;
772 +        depth = info->var.bits_per_pixel;
773 +       if (depth != 16) {      /* Other targets might need fixing */
774 +               splash_off(info);
775 +               return -2;
776 +       }
777 +
778 +       sbytes = ((width + 15) & ~15) * (depth >> 3);
779 +       size = sbytes * ((height + 15) & ~15);
780 +       if (size != info->splash_pic_size)
781 +               splash_off(info);
782 +       if (!info->splash_pic)
783 +               info->splash_pic = vmalloc(size);
784 +
785 +       if (!info->splash_pic) {
786 +               printk(KERN_INFO "bootsplash: not enough memory.\n");
787 +               splash_off(info);
788 +               return -3;
789 +       }
790 +
791 +       if (!decdata)
792 +               decdata = vmalloc(sizeof(*decdata));
793 +
794 +       if (vc->vc_splash_data->splash_silentjpeg && vc->vc_splash_data->splash_dosilent) {
795 +               /* fill area after framebuffer with other jpeg */
796 +               if ((err = jpeg_decode(vc->vc_splash_data->splash_silentjpeg, info->splash_pic, 
797 +                        ((width + 15) & ~15), ((height + 15) & ~15), depth, decdata))) {
798 +                       printk(KERN_INFO "bootsplash: error while decompressing silent picture: %s (%d)\n", jpg_errors[err - 1], err);
799 +                       if (info->silent_screen_base)
800 +                               info->screen_base = info->silent_screen_base;
801 +                       vc->vc_splash_data->splash_dosilent = 0;
802 +               } else {
803 +                       if (vc->vc_splash_data->splash_sboxcount)
804 +                               boxit(info->splash_pic, sbytes, vc->vc_splash_data->splash_sboxes, 
805 +                                       vc->vc_splash_data->splash_sboxcount, vc->vc_splash_data->splash_percent, 0);
806 +
807 +                       if (!info->silent_screen_base)
808 +                               info->silent_screen_base = info->screen_base;
809 +                       splashcopy(info->silent_screen_base, info->splash_pic, info->var.yres, info->var.xres, info->fix.line_length, sbytes);
810 +                       info->screen_base = info->silent_screen_base + info->fix.line_length * info->var.yres;
811 +               }
812 +       } else if (info->silent_screen_base)
813 +               info->screen_base = info->silent_screen_base;
814 +
815 +       if ((err = jpeg_decode(vc->vc_splash_data->splash_jpeg, info->splash_pic, 
816 +                ((width + 15) & ~15), ((height + 15) & ~15), depth, decdata))) {
817 +               printk(KERN_INFO "bootsplash: error while decompressing picture: %s (%d) .\n", jpg_errors[err - 1], err);
818 +               splash_off(info);
819 +               return -4;
820 +       }
821 +       info->splash_pic_size = size;
822 +       info->splash_bytes = sbytes;
823 +       if (vc->vc_splash_data->splash_boxcount)
824 +               boxit(info->splash_pic, sbytes, vc->vc_splash_data->splash_boxes, vc->vc_splash_data->splash_boxcount, vc->vc_splash_data->splash_percent, 0);
825 +       if (vc->vc_splash_data->splash_state)
826 +               info->splash_data = vc->vc_splash_data;
827 +       else
828 +               splash_off(info);
829 +       return 0;
830 +}
831 +
832 +
833 +#ifdef CONFIG_PROC_FS
834 +
835 +#include <linux/proc_fs.h>
836 +
837 +static int splash_read_proc(char *buffer, char **start, off_t offset, int size,
838 +                       int *eof, void *data);
839 +static int splash_write_proc(struct file *file, const char *buffer,
840 +                       unsigned long count, void *data);
841 +static int splash_status(struct vc_data *vc);
842 +static int splash_recolor(struct vc_data *vc);
843 +static int splash_proc_register(void);
844 +
845 +static struct proc_dir_entry *proc_splash;
846 +
847 +static int splash_recolor(struct vc_data *vc)
848 +{
849 +       if (!vc->vc_splash_data)
850 +           return -1;
851 +       if (!vc->vc_splash_data->splash_state)
852 +           return 0;
853 +       con_remap_def_color(vc, vc->vc_splash_data->splash_color << 4 | vc->vc_splash_data->splash_fg_color);
854 +       if (fg_console == vc->vc_num) {
855 +               update_region(vc, vc->vc_origin + vc->vc_size_row * vc->vc_top,
856 +                             vc->vc_size_row * (vc->vc_bottom - vc->vc_top) / 2);
857 +       }
858 +       return 0;
859 +}
860 +
861 +static int splash_status(struct vc_data *vc)
862 +{
863 +       struct fb_info *info;
864 +       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");
865 +
866 +       info = registered_fb[(int) con2fb_map[vc->vc_num]];
867 +       if (fg_console == vc->vc_num)
868 +               splash_prepare(vc, info);
869 +       if (vc->vc_splash_data && vc->vc_splash_data->splash_state) {
870 +               con_remap_def_color(vc, vc->vc_splash_data->splash_color << 4 | vc->vc_splash_data->splash_fg_color);
871 +               /* vc_resize also calls con_switch which resets yscroll */
872 +               vc_resize(vc, vc->vc_splash_data->splash_text_wi / vc->vc_font.width, vc->vc_splash_data->splash_text_he / vc->vc_font.height);
873 +               if (fg_console == vc->vc_num) {
874 +                       update_region(vc, vc->vc_origin + vc->vc_size_row * vc->vc_top,
875 +                                     vc->vc_size_row * (vc->vc_bottom - vc->vc_top) / 2);
876 +                       splash_clear_margins(vc->vc_splash_data, vc, info, 0);
877 +               }
878 +       } else {
879 +               /* Switch bootsplash off */
880 +               con_remap_def_color(vc, 0x07);
881 +               vc_resize(vc, info->var.xres / vc->vc_font.width, info->var.yres / vc->vc_font.height);
882 +       }
883 +       return 0;
884 +}
885 +
886 +static int splash_read_proc(char *buffer, char **start, off_t offset, int size,
887 +                       int *eof, void *data)
888 +{
889 +       int len = 0;
890 +       off_t begin = 0;
891 +       struct vc_data *vc = vc_cons[0].d;
892 +       struct fb_info *info = registered_fb[(int)con2fb_map[0]];
893 +       int color = vc->vc_splash_data ? vc->vc_splash_data->splash_color << 4 |
894 +                       vc->vc_splash_data->splash_fg_color : splash_default >> 4;
895 +       int status = vc->vc_splash_data ? vc->vc_splash_data->splash_state & 1 : 0;
896 +       len += sprintf(buffer + len, "Splash screen v%s (0x%02x, %dx%d%s): %s\n",
897 +                       SPLASH_VERSION, color, info->var.xres, info->var.yres,
898 +                       (vc->vc_splash_data ?  vc->vc_splash_data->splash_dosilent : 0)? ", silent" : "",
899 +                                       status ? "on" : "off");
900 +       if (offset >= begin + len)
901 +               return 0;
902 +
903 +       *start = buffer + (begin - offset);
904 +
905 +       return (size < begin + len - offset ? size : begin + len - offset);
906 +}
907 +
908 +static int splash_write_proc(struct file *file, const char *buffer,
909 +                     unsigned long count, void *data)
910 +{
911 +        int new, unit;
912 +       struct vc_data *vc;
913 +       
914 +       if (!buffer || !splash_default)
915 +               return count;
916 +
917 +       acquire_console_sem();
918 +       if (!strncmp(buffer, "show", 4) || !strncmp(buffer, "hide", 4)) {
919 +               int pe, oldpe;
920 +
921 +               vc = vc_cons[0].d;
922 +               if (buffer[4] == ' ' && buffer[5] == 'p')
923 +                       pe = 0;
924 +               else if (buffer[4] == '\n')
925 +                       pe = 65535;
926 +               else
927 +                       pe = simple_strtoul(buffer + 5, NULL, 0);
928 +               if (pe < 0)
929 +                       pe = 0;
930 +               if (pe > 65535)
931 +                       pe = 65535;
932 +               if (*buffer == 'h')
933 +                       pe = 65535 - pe;
934 +               pe += pe > 32767;
935 +               if (vc->vc_splash_data && vc->vc_splash_data->splash_percent != pe) {
936 +                       struct fb_info *info;
937 +                       struct fbcon_ops *ops;
938 +
939 +                       oldpe = vc->vc_splash_data->splash_percent;
940 +                       vc->vc_splash_data->splash_percent = pe;
941 +                       if (fg_console != 0 || !vc->vc_splash_data->splash_state) {
942 +                               release_console_sem();
943 +                               return count;
944 +                       }
945 +                       info = registered_fb[(int) con2fb_map[vc->vc_num]];
946 +                       ops = info->fbcon_par;
947 +                       if (ops->blank_state) {
948 +                               release_console_sem();
949 +                               return count;
950 +                       }
951 +                       if (!vc->vc_splash_data->splash_overpaintok || pe == 65536 || pe < oldpe) {
952 +                               if (splash_hasinter(vc->vc_splash_data->splash_boxes, vc->vc_splash_data->splash_boxcount))
953 +                                       splash_status(vc);
954 +                               else
955 +                                       splash_prepare(vc, info);
956 +                       } else {
957 +                               if (vc->vc_splash_data->splash_silentjpeg && vc->vc_splash_data->splash_dosilent && info->silent_screen_base)
958 +                                       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);
959 +                               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);
960 +                       }
961 +               }
962 +               release_console_sem();
963 +               return count;
964 +       }
965 +       if (!strncmp(buffer,"silent\n",7) || !strncmp(buffer,"verbose\n",8)) {
966 +               vc = vc_cons[0].d;
967 +               if (vc->vc_splash_data && vc->vc_splash_data->splash_silentjpeg) {
968 +                   if (vc->vc_splash_data->splash_dosilent != (buffer[0] == 's')) {
969 +                       vc->vc_splash_data->splash_dosilent = buffer[0] == 's';
970 +                       splash_status(vc);
971 +                   }
972 +               }
973 +               release_console_sem();
974 +               return count;
975 +       }
976 +       if (!strncmp(buffer,"freesilent\n",11)) {
977 +               vc = vc_cons[0].d;
978 +               if (vc->vc_splash_data && vc->vc_splash_data->splash_silentjpeg) {
979 +                   printk(KERN_INFO "bootsplash: freeing silent jpeg\n");
980 +                   vc->vc_splash_data->splash_silentjpeg = 0;
981 +                   vfree(vc->vc_splash_data->splash_sboxes);
982 +                   vc->vc_splash_data->splash_sboxes = 0;
983 +                   vc->vc_splash_data->splash_sboxcount = 0;
984 +                   if (vc->vc_splash_data->splash_dosilent)
985 +                       splash_status(vc);
986 +                   vc->vc_splash_data->splash_dosilent = 0;
987 +               }
988 +               release_console_sem();
989 +               return count;
990 +       }
991 +
992 +       if (!strncmp(buffer, "BOOTSPL", 7)) {
993 +           int up = -1;
994 +           unit = splash_getraw((unsigned char *)buffer, (unsigned char *)buffer + count, &up);
995 +           if (unit >= 0) {
996 +               vc = vc_cons[unit].d;
997 +               if (up == -1)
998 +                   splash_status(vc);
999 +               else {
1000 +                   struct fb_info *info = registered_fb[(int) con2fb_map[vc->vc_num]];
1001 +                   struct fbcon_ops *ops = info->fbcon_par;
1002 +                   if (ops->blank_state)
1003 +                       up = 0;
1004 +                   if ((up & 2) != 0 && vc->vc_splash_data->splash_silentjpeg && vc->vc_splash_data->splash_dosilent && info->silent_screen_base)
1005 +                       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);
1006 +                   if ((up & 1) != 0)
1007 +                           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);
1008 +               }
1009 +           }
1010 +           release_console_sem();
1011 +           return count;
1012 +       }
1013 +       vc = vc_cons[0].d;
1014 +       if (!vc->vc_splash_data) {
1015 +               release_console_sem();
1016 +               return count;
1017 +       }
1018 +       if (buffer[0] == 't') {
1019 +               vc->vc_splash_data->splash_state ^= 1;
1020 +               splash_status(vc);
1021 +               release_console_sem();
1022 +               return count;
1023 +       }
1024 +       new = simple_strtoul(buffer, NULL, 0);
1025 +       if (new > 1) {
1026 +               /* expert user */
1027 +               vc->vc_splash_data->splash_color    = new >> 8 & 0xff;
1028 +               vc->vc_splash_data->splash_fg_color = new >> 4 & 0x0f;
1029 +       }
1030 +       if ((new & 1) == vc->vc_splash_data->splash_state)
1031 +               splash_recolor(vc);
1032 +       else {
1033 +               vc->vc_splash_data->splash_state = new & 1;
1034 +               splash_status(vc);
1035 +       }
1036 +       release_console_sem();
1037 +       return count;
1038 +}
1039 +
1040 +static int splash_proc_register(void)
1041 +{
1042 +       if ((proc_splash = create_proc_entry("splash", 0, 0))) {
1043 +               proc_splash->read_proc = splash_read_proc;
1044 +               proc_splash->write_proc = splash_write_proc;
1045 +               return 0;
1046 +       }
1047 +       return 1;
1048 +}
1049 +
1050 +# if 0
1051 +static int splash_proc_unregister(void)
1052 +{
1053 +       if (proc_splash)
1054 +               remove_proc_entry("splash", 0);
1055 +       return 0;
1056 +}
1057 +# endif
1058 +#endif /* CONFIG_PROC_FS */
1059 +
1060 +void splash_init(void)
1061 +{
1062 +       struct fb_info *info;
1063 +       struct vc_data *vc;
1064 +       int isramfs = 1;
1065 +       int fd;
1066 +       int len;
1067 +       int max_len = 1024*1024*2;
1068 +       char *mem;
1069 +
1070 +       if (splash_registered)
1071 +               return;
1072 +       vc = vc_cons[0].d;
1073 +       info = registered_fb[0];
1074 +       if (!vc || !info || info->var.bits_per_pixel != 16)
1075 +               return;
1076 +#ifdef CONFIG_PROC_FS
1077 +       splash_proc_register();
1078 +#endif
1079 +       splash_registered = 1;
1080 +       if (vc->vc_splash_data)
1081 +               return;
1082 +       if ((fd = sys_open("/bootsplash", O_RDONLY, 0)) < 0) {
1083 +               isramfs = 0;
1084 +               fd = sys_open("/initrd.image", O_RDONLY, 0);
1085 +       }
1086 +       if (fd < 0)
1087 +               return;
1088 +       if ((len = (int)sys_lseek(fd, (off_t)0, 2)) <= 0) {
1089 +               sys_close(fd);
1090 +               return;
1091 +       }
1092 +       /* Don't look for more than the last 2MB */
1093 +       if (len > max_len) {
1094 +               printk( KERN_INFO "bootsplash: scanning last %dMB of initrd for signature\n",
1095 +                               max_len>>20);
1096 +               sys_lseek(fd, (off_t)(len - max_len), 0);
1097 +               len = max_len;
1098 +       } else {
1099 +               sys_lseek(fd, (off_t)0, 0);
1100 +       }
1101 +
1102 +       mem = vmalloc(len);
1103 +       if (mem) {
1104 +               acquire_console_sem();
1105 +               if ((int)sys_read(fd, mem, len) == len && splash_getraw((unsigned char *)mem, (unsigned char *)mem + len, (int *)0) == 0 && vc->vc_splash_data)
1106 +                       vc->vc_splash_data->splash_state = splash_default & 1;
1107 +               release_console_sem();
1108 +               vfree(mem);
1109 +       }
1110 +       sys_close(fd);
1111 +       if (isramfs)
1112 +               sys_unlink("/bootsplash");
1113 +       return;
1114 +}
1115 +
1116 diff -ruNp -X linux-2.6.15/Documentation/dontdiff linux-2.6.15/drivers/video/bootsplash/bootsplash.h linux-2.6.15-VinX/drivers/video/bootsplash/bootsplash.h
1117 --- linux-2.6.15/drivers/video/bootsplash/bootsplash.h  1970-01-01 01:00:00.000000000 +0100
1118 +++ linux-2.6.15-VinX/drivers/video/bootsplash/bootsplash.h     2006-01-05 01:17:11.000000000 +0100
1119 @@ -0,0 +1,44 @@
1120 +/* 
1121 + *    linux/drivers/video/bootsplash/bootsplash.h - splash screen definition.
1122 + *     
1123 + *     (w) 2001-2003 by Volker Poplawski, <volker@poplawski.de>
1124 + *                 Stefan Reinauer, <stepan@suse.de>
1125 + *                 
1126 + *                 
1127 + *     idea and SuSE screen work by Ken Wimer, <wimer@suse.de>
1128 + */
1129 +
1130 +#ifndef __BOOTSPLASH_H
1131 +#define __BOOTSPLASH_H
1132 +
1133 +struct fb_info;
1134 +
1135 +/* splash.c */
1136 +extern int splash_prepare(struct vc_data *, struct fb_info *);
1137 +extern void splash_init(void);
1138 +
1139 +/* splash_render.c */
1140 +extern void splash_putcs(struct splash_data *sd, struct vc_data *vc, struct fb_info *info,
1141 +                       const unsigned short *s, int count, int ypos, int xpos);
1142 +extern void splash_putc(struct splash_data *sd, struct vc_data *vc, struct fb_info *info,
1143 +                       int c, int ypos, int xpos);
1144 +extern void splashcopy(u8 *dst, u8 *src, int height, int width, int dstbytes, int srcbytes);
1145 +extern void splash_clear(struct splash_data *sd, struct vc_data *vc, struct fb_info *info, int sy,
1146 +                       int sx, int height, int width);
1147 +extern void splash_bmove(struct splash_data *sd, struct vc_data *vc, struct fb_info *info, int sy, 
1148 +                       int sx, int dy, int dx, int height, int width);
1149 +extern void splash_clear_margins(struct splash_data *sd, struct vc_data *vc, struct fb_info *info,
1150 +                       int bottom_only);
1151 +extern int splash_cursor(struct splash_data *sd, struct fb_info *info, struct fb_cursor *cursor);
1152 +extern void splash_bmove_redraw(struct splash_data *sd, struct vc_data *vc, struct fb_info *info,
1153 +                       int y, int sx, int dx, int width);
1154 +extern void splash_blank(struct splash_data *sd, struct vc_data *vc, struct fb_info *info,
1155 +                       int blank);
1156 +
1157 +/* vt.c */
1158 +extern void con_remap_def_color(struct vc_data *, int new_color);
1159 +
1160 +extern void acquire_console_sem(void);
1161 +extern void release_console_sem(void);
1162 +
1163 +#endif
1164 diff -ruNp -X linux-2.6.15/Documentation/dontdiff linux-2.6.15/drivers/video/bootsplash/decode-jpg.c linux-2.6.15-VinX/drivers/video/bootsplash/decode-jpg.c
1165 --- linux-2.6.15/drivers/video/bootsplash/decode-jpg.c  1970-01-01 01:00:00.000000000 +0100
1166 +++ linux-2.6.15-VinX/drivers/video/bootsplash/decode-jpg.c     2006-01-05 01:17:11.000000000 +0100
1167 @@ -0,0 +1,958 @@
1168 +/* 
1169 + *    linux/drivers/video/bootsplash/decode-jpg.c - a tiny jpeg decoder.
1170 + *      
1171 + *      (w) August 2001 by Michael Schroeder, <mls@suse.de>
1172 + *                  
1173 + */
1174 +
1175 +
1176 +#include <linux/string.h>
1177 +#include <asm/byteorder.h>
1178 +
1179 +#include "decode-jpg.h"
1180 +
1181 +#define ISHIFT 11
1182 +
1183 +#define IFIX(a) ((int)((a) * (1 << ISHIFT) + .5))
1184 +#define IMULT(a, b) (((a) * (b)) >> ISHIFT)
1185 +#define ITOINT(a) ((a) >> ISHIFT)
1186 +
1187 +#ifndef __P
1188 +# define __P(x) x
1189 +#endif
1190 +
1191 +/* special markers */
1192 +#define M_BADHUFF      -1
1193 +#define M_EOF          0x80
1194 +
1195 +struct in {
1196 +       unsigned char *p;
1197 +       unsigned int bits;
1198 +       int left;
1199 +       int marker;
1200 +
1201 +       int (*func) __P((void *));
1202 +       void *data;
1203 +};
1204 +
1205 +/*********************************/
1206 +struct dec_hufftbl;
1207 +struct enc_hufftbl;
1208 +
1209 +union hufftblp {
1210 +       struct dec_hufftbl *dhuff;
1211 +       struct enc_hufftbl *ehuff;
1212 +};
1213 +
1214 +struct scan {
1215 +       int dc;                 /* old dc value */
1216 +
1217 +       union hufftblp hudc;
1218 +       union hufftblp huac;
1219 +       int next;               /* when to switch to next scan */
1220 +
1221 +       int cid;                /* component id */
1222 +       int hv;                 /* horiz/vert, copied from comp */
1223 +       int tq;                 /* quant tbl, copied from comp */
1224 +};
1225 +
1226 +/*********************************/
1227 +
1228 +#define DECBITS 10             /* seems to be the optimum */
1229 +
1230 +struct dec_hufftbl {
1231 +       int maxcode[17];
1232 +       int valptr[16];
1233 +       unsigned char vals[256];
1234 +       unsigned int llvals[1 << DECBITS];
1235 +};
1236 +
1237 +static void decode_mcus __P((struct in *, int *, int, struct scan *, int *));
1238 +static int dec_readmarker __P((struct in *));
1239 +static void dec_makehuff __P((struct dec_hufftbl *, int *, unsigned char *));
1240 +
1241 +static void setinput __P((struct in *, unsigned char *));
1242 +/*********************************/
1243 +
1244 +#undef PREC
1245 +#define PREC int
1246 +
1247 +static void idctqtab __P((unsigned char *, PREC *));
1248 +static void idct __P((int *, int *, PREC *, PREC, int));
1249 +static void scaleidctqtab __P((PREC *, PREC));
1250 +
1251 +/*********************************/
1252 +
1253 +static void initcol __P((PREC[][64]));
1254 +
1255 +static void col221111 __P((int *, unsigned char *, int));
1256 +static void col221111_16 __P((int *, unsigned char *, int));
1257 +
1258 +/*********************************/
1259 +
1260 +#define M_SOI  0xd8
1261 +#define M_APP0 0xe0
1262 +#define M_DQT  0xdb
1263 +#define M_SOF0 0xc0
1264 +#define M_DHT   0xc4
1265 +#define M_DRI  0xdd
1266 +#define M_SOS  0xda
1267 +#define M_RST0 0xd0
1268 +#define M_EOI  0xd9
1269 +#define M_COM  0xfe
1270 +
1271 +static unsigned char *datap;
1272 +
1273 +static int getbyte(void)
1274 +{
1275 +       return *datap++;
1276 +}
1277 +
1278 +static int getword(void)
1279 +{
1280 +       int c1, c2;
1281 +       c1 = *datap++;
1282 +       c2 = *datap++;
1283 +       return c1 << 8 | c2;
1284 +}
1285 +
1286 +struct comp {
1287 +       int cid;
1288 +       int hv;
1289 +       int tq;
1290 +};
1291 +
1292 +#define MAXCOMP 4
1293 +struct jpginfo {
1294 +       int nc;                 /* number of components */
1295 +       int ns;                 /* number of scans */
1296 +       int dri;                /* restart interval */
1297 +       int nm;                 /* mcus til next marker */
1298 +       int rm;                 /* next restart marker */
1299 +};
1300 +
1301 +static struct jpginfo info;
1302 +static struct comp comps[MAXCOMP];
1303 +
1304 +static struct scan dscans[MAXCOMP];
1305 +
1306 +static unsigned char quant[4][64];
1307 +
1308 +static struct dec_hufftbl dhuff[4];
1309 +
1310 +#define dec_huffdc (dhuff + 0)
1311 +#define dec_huffac (dhuff + 2)
1312 +
1313 +static struct in in;
1314 +
1315 +static int readtables(int till)
1316 +{
1317 +       int m, l, i, j, lq, pq, tq;
1318 +       int tc, th, tt;
1319 +
1320 +       for (;;) {
1321 +               if (getbyte() != 0xff)
1322 +                       return -1;
1323 +               if ((m = getbyte()) == till)
1324 +                       break;
1325 +
1326 +               switch (m) {
1327 +               case 0xc2:
1328 +                       return 0;
1329 +
1330 +               case M_DQT:
1331 +                       lq = getword();
1332 +                       while (lq > 2) {
1333 +                               pq = getbyte();
1334 +                               tq = pq & 15;
1335 +                               if (tq > 3)
1336 +                                       return -1;
1337 +                               pq >>= 4;
1338 +                               if (pq != 0)
1339 +                                       return -1;
1340 +                               for (i = 0; i < 64; i++)
1341 +                                       quant[tq][i] = getbyte();
1342 +                               lq -= 64 + 1;
1343 +                       }
1344 +                       break;
1345 +
1346 +               case M_DHT:
1347 +                       l = getword();
1348 +                       while (l > 2) {
1349 +                               int hufflen[16], k;
1350 +                               unsigned char huffvals[256];
1351 +
1352 +                               tc = getbyte();
1353 +                               th = tc & 15;
1354 +                               tc >>= 4;
1355 +                               tt = tc * 2 + th;
1356 +                               if (tc > 1 || th > 1)
1357 +                                       return -1;
1358 +                               for (i = 0; i < 16; i++)
1359 +                                       hufflen[i] = getbyte();
1360 +                               l -= 1 + 16;
1361 +                               k = 0;
1362 +                               for (i = 0; i < 16; i++) {
1363 +                                       for (j = 0; j < hufflen[i]; j++)
1364 +                                               huffvals[k++] = getbyte();
1365 +                                       l -= hufflen[i];
1366 +                               }
1367 +                               dec_makehuff(dhuff + tt, hufflen,
1368 +                                            huffvals);
1369 +                       }
1370 +                       break;
1371 +
1372 +               case M_DRI:
1373 +                       l = getword();
1374 +                       info.dri = getword();
1375 +                       break;
1376 +
1377 +               default:
1378 +                       l = getword();
1379 +                       while (l-- > 2)
1380 +                               getbyte();
1381 +                       break;
1382 +               }
1383 +       }
1384 +       return 0;
1385 +}
1386 +
1387 +static void dec_initscans(void)
1388 +{
1389 +       int i;
1390 +
1391 +       info.nm = info.dri + 1;
1392 +       info.rm = M_RST0;
1393 +       for (i = 0; i < info.ns; i++)
1394 +               dscans[i].dc = 0;
1395 +}
1396 +
1397 +static int dec_checkmarker(void)
1398 +{
1399 +       int i;
1400 +
1401 +       if (dec_readmarker(&in) != info.rm)
1402 +               return -1;
1403 +       info.nm = info.dri;
1404 +       info.rm = (info.rm + 1) & ~0x08;
1405 +       for (i = 0; i < info.ns; i++)
1406 +               dscans[i].dc = 0;
1407 +       return 0;
1408 +}
1409 +
1410 +int jpeg_check_size(unsigned char *buf, int width, int height)
1411 +{
1412 +       datap = buf;
1413 +       getbyte(); 
1414 +       getbyte(); 
1415 +       readtables(M_SOF0);
1416 +       getword();
1417 +       getbyte();
1418 +        if (height != getword() || width != getword())
1419 +               return 0;
1420 +        return 1;
1421 +}
1422 +
1423 +int jpeg_decode(buf, pic, width, height, depth, decdata)
1424 +unsigned char *buf, *pic;
1425 +int width, height, depth;
1426 +struct jpeg_decdata *decdata;
1427 +{
1428 +       int i, j, m, tac, tdc;
1429 +       int mcusx, mcusy, mx, my;
1430 +       int max[6];
1431 +
1432 +       if (!decdata || !buf || !pic)
1433 +               return -1;
1434 +       datap = buf;
1435 +       if (getbyte() != 0xff)
1436 +               return ERR_NO_SOI;
1437 +       if (getbyte() != M_SOI)
1438 +               return ERR_NO_SOI;
1439 +       if (readtables(M_SOF0))
1440 +               return ERR_BAD_TABLES;
1441 +       getword();
1442 +       i = getbyte();
1443 +       if (i != 8)
1444 +               return ERR_NOT_8BIT;
1445 +       if (((getword() + 15) & ~15) != height)
1446 +               return ERR_HEIGHT_MISMATCH;
1447 +       if (((getword() + 15) & ~15) != width)
1448 +               return ERR_WIDTH_MISMATCH;
1449 +       if ((height & 15) || (width & 15))
1450 +               return ERR_BAD_WIDTH_OR_HEIGHT;
1451 +       info.nc = getbyte();
1452 +       if (info.nc > MAXCOMP)
1453 +               return ERR_TOO_MANY_COMPPS;
1454 +       for (i = 0; i < info.nc; i++) {
1455 +               int h, v;
1456 +               comps[i].cid = getbyte();
1457 +               comps[i].hv = getbyte();
1458 +               v = comps[i].hv & 15;
1459 +               h = comps[i].hv >> 4;
1460 +               comps[i].tq = getbyte();
1461 +               if (h > 3 || v > 3)
1462 +                       return ERR_ILLEGAL_HV;
1463 +               if (comps[i].tq > 3)
1464 +                       return ERR_QUANT_TABLE_SELECTOR;
1465 +       }
1466 +       if (readtables(M_SOS))
1467 +               return ERR_BAD_TABLES;
1468 +       getword();
1469 +       info.ns = getbyte();
1470 +       if (info.ns != 3)
1471 +               return ERR_NOT_YCBCR_221111;
1472 +       for (i = 0; i < 3; i++) {
1473 +               dscans[i].cid = getbyte();
1474 +               tdc = getbyte();
1475 +               tac = tdc & 15;
1476 +               tdc >>= 4;
1477 +               if (tdc > 1 || tac > 1)
1478 +                       return ERR_QUANT_TABLE_SELECTOR;
1479 +               for (j = 0; j < info.nc; j++)
1480 +                       if (comps[j].cid == dscans[i].cid)
1481 +                               break;
1482 +               if (j == info.nc)
1483 +                       return ERR_UNKNOWN_CID_IN_SCAN;
1484 +               dscans[i].hv = comps[j].hv;
1485 +               dscans[i].tq = comps[j].tq;
1486 +               dscans[i].hudc.dhuff = dec_huffdc + tdc;
1487 +               dscans[i].huac.dhuff = dec_huffac + tac;
1488 +       }
1489 +       
1490 +       i = getbyte();
1491 +       j = getbyte();
1492 +       m = getbyte();
1493 +       
1494 +       if (i != 0 || j != 63 || m != 0)
1495 +               return ERR_NOT_SEQUENTIAL_DCT;
1496 +       
1497 +       if (dscans[0].cid != 1 || dscans[1].cid != 2 || dscans[2].cid != 3)
1498 +               return ERR_NOT_YCBCR_221111;
1499 +
1500 +       if (dscans[0].hv != 0x22 || dscans[1].hv != 0x11 || dscans[2].hv != 0x11)
1501 +               return ERR_NOT_YCBCR_221111;
1502 +
1503 +       mcusx = width >> 4;
1504 +       mcusy = height >> 4;
1505 +
1506 +
1507 +       idctqtab(quant[dscans[0].tq], decdata->dquant[0]);
1508 +       idctqtab(quant[dscans[1].tq], decdata->dquant[1]);
1509 +       idctqtab(quant[dscans[2].tq], decdata->dquant[2]);
1510 +       initcol(decdata->dquant);
1511 +       setinput(&in, datap);
1512 +
1513 +#if 0
1514 +       /* landing zone */
1515 +       img[len] = 0;
1516 +       img[len + 1] = 0xff;
1517 +       img[len + 2] = M_EOF;
1518 +#endif
1519 +
1520 +       dec_initscans();
1521 +
1522 +       dscans[0].next = 6 - 4;
1523 +       dscans[1].next = 6 - 4 - 1;
1524 +       dscans[2].next = 6 - 4 - 1 - 1; /* 411 encoding */
1525 +       for (my = 0; my < mcusy; my++) {
1526 +               for (mx = 0; mx < mcusx; mx++) {
1527 +                       if (info.dri && !--info.nm)
1528 +                               if (dec_checkmarker())
1529 +                                       return ERR_WRONG_MARKER;
1530 +                       
1531 +                       decode_mcus(&in, decdata->dcts, 6, dscans, max);
1532 +                       idct(decdata->dcts, decdata->out, decdata->dquant[0], IFIX(128.5), max[0]);
1533 +                       idct(decdata->dcts + 64, decdata->out + 64, decdata->dquant[0], IFIX(128.5), max[1]);
1534 +                       idct(decdata->dcts + 128, decdata->out + 128, decdata->dquant[0], IFIX(128.5), max[2]);
1535 +                       idct(decdata->dcts + 192, decdata->out + 192, decdata->dquant[0], IFIX(128.5), max[3]);
1536 +                       idct(decdata->dcts + 256, decdata->out + 256, decdata->dquant[1], IFIX(0.5), max[4]);
1537 +                       idct(decdata->dcts + 320, decdata->out + 320, decdata->dquant[2], IFIX(0.5), max[5]);
1538 +
1539 +                       switch (depth) {
1540 +                       case 24:
1541 +                               col221111(decdata->out, pic + (my * 16 * mcusx + mx) * 16 * 3, mcusx * 16 * 3);
1542 +                               break;
1543 +                       case 16:
1544 +                               col221111_16(decdata->out, pic + (my * 16 * mcusx + mx) * (16 * 2), mcusx * (16 * 2));
1545 +                               break;
1546 +                       default:
1547 +                               return ERR_DEPTH_MISMATCH;
1548 +                               break;
1549 +                       }
1550 +               }
1551 +       }
1552 +       
1553 +       m = dec_readmarker(&in);
1554 +       if (m != M_EOI)
1555 +               return ERR_NO_EOI;
1556 +
1557 +       return 0;
1558 +}
1559 +
1560 +/****************************************************************/
1561 +/**************       huffman decoder             ***************/
1562 +/****************************************************************/
1563 +
1564 +static int fillbits __P((struct in *, int, unsigned int));
1565 +static int dec_rec2
1566 +__P((struct in *, struct dec_hufftbl *, int *, int, int));
1567 +
1568 +static void setinput(in, p)
1569 +struct in *in;
1570 +unsigned char *p;
1571 +{
1572 +       in->p = p;
1573 +       in->left = 0;
1574 +       in->bits = 0;
1575 +       in->marker = 0;
1576 +}
1577 +
1578 +static int fillbits(in, le, bi)
1579 +struct in *in;
1580 +int le;
1581 +unsigned int bi;
1582 +{
1583 +       int b, m;
1584 +
1585 +       if (in->marker) {
1586 +               if (le <= 16)
1587 +                       in->bits = bi << 16, le += 16;
1588 +               return le;
1589 +       }
1590 +       while (le <= 24) {
1591 +               b = *in->p++;
1592 +               if (b == 0xff && (m = *in->p++) != 0) {
1593 +                       if (m == M_EOF) {
1594 +                               if (in->func && (m = in->func(in->data)) == 0)
1595 +                                       continue;
1596 +                       }
1597 +                       in->marker = m;
1598 +                       if (le <= 16)
1599 +                               bi = bi << 16, le += 16;
1600 +                       break;
1601 +               }
1602 +               bi = bi << 8 | b;
1603 +               le += 8;
1604 +       }
1605 +       in->bits = bi;          /* tmp... 2 return values needed */
1606 +       return le;
1607 +}
1608 +
1609 +static int dec_readmarker(in)
1610 +struct in *in;
1611 +{
1612 +       int m;
1613 +
1614 +       in->left = fillbits(in, in->left, in->bits);
1615 +       if ((m = in->marker) == 0)
1616 +               return 0;
1617 +       in->left = 0;
1618 +       in->marker = 0;
1619 +       return m;
1620 +}
1621 +
1622 +#define LEBI_DCL       int le, bi
1623 +#define LEBI_GET(in)   (le = in->left, bi = in->bits)
1624 +#define LEBI_PUT(in)   (in->left = le, in->bits = bi)
1625 +
1626 +#define GETBITS(in, n) (                                       \
1627 +  (le < (n) ? le = fillbits(in, le, bi), bi = in->bits : 0),   \
1628 +  (le -= (n)),                                                 \
1629 +  bi >> le & ((1 << (n)) - 1)                                  \
1630 +)
1631 +
1632 +#define UNGETBITS(in, n) (     \
1633 +  le += (n)                    \
1634 +)
1635 +
1636 +
1637 +static int dec_rec2(in, hu, runp, c, i)
1638 +struct in *in;
1639 +struct dec_hufftbl *hu;
1640 +int *runp;
1641 +int c, i;
1642 +{
1643 +       LEBI_DCL;
1644 +
1645 +       LEBI_GET(in);
1646 +       if (i) {
1647 +               UNGETBITS(in, i & 127);
1648 +               *runp = i >> 8 & 15;
1649 +               i >>= 16;
1650 +       } else {
1651 +               for (i = DECBITS; (c = ((c << 1) | GETBITS(in, 1))) >= (hu->maxcode[i]); i++);
1652 +               if (i >= 16) {
1653 +                       in->marker = M_BADHUFF;
1654 +                       return 0;
1655 +               }
1656 +               i = hu->vals[hu->valptr[i] + c - hu->maxcode[i - 1] * 2];
1657 +               *runp = i >> 4;
1658 +               i &= 15;
1659 +       }
1660 +       if (i == 0) {           /* sigh, 0xf0 is 11 bit */
1661 +               LEBI_PUT(in);
1662 +               return 0;
1663 +       }
1664 +       /* receive part */
1665 +       c = GETBITS(in, i);
1666 +       if (c < (1 << (i - 1)))
1667 +               c += (-1 << i) + 1;
1668 +       LEBI_PUT(in);
1669 +       return c;
1670 +}
1671 +
1672 +#define DEC_REC(in, hu, r, i)   (      \
1673 +  r = GETBITS(in, DECBITS),            \
1674 +  i = hu->llvals[r],                   \
1675 +  i & 128 ?                            \
1676 +    (                                  \
1677 +      UNGETBITS(in, i & 127),          \
1678 +      r = i >> 8 & 15,                 \
1679 +      i >> 16                          \
1680 +    )                                  \
1681 +  :                                    \
1682 +    (                                  \
1683 +      LEBI_PUT(in),                    \
1684 +      i = dec_rec2(in, hu, &r, r, i),  \
1685 +      LEBI_GET(in),                    \
1686 +      i                                        \
1687 +    )                                  \
1688 +)
1689 +
1690 +static void decode_mcus(in, dct, n, sc, maxp)
1691 +struct in *in;
1692 +int *dct;
1693 +int n;
1694 +struct scan *sc;
1695 +int *maxp;
1696 +{
1697 +       struct dec_hufftbl *hu;
1698 +       int i, r, t;
1699 +       LEBI_DCL;
1700 +
1701 +       memset(dct, 0, n * 64 * sizeof(*dct));
1702 +       LEBI_GET(in);
1703 +       while (n-- > 0) {
1704 +               hu = sc->hudc.dhuff;
1705 +               *dct++ = (sc->dc += DEC_REC(in, hu, r, t));
1706 +
1707 +               hu = sc->huac.dhuff;
1708 +               i = 63;
1709 +               while (i > 0) {
1710 +                       t = DEC_REC(in, hu, r, t);
1711 +                       if (t == 0 && r == 0) {
1712 +                               dct += i;
1713 +                               break;
1714 +                       }
1715 +                       dct += r;
1716 +                       *dct++ = t;
1717 +                       i -= r + 1;
1718 +               }
1719 +               *maxp++ = 64 - i;
1720 +               if (n == sc->next)
1721 +                       sc++;
1722 +       }
1723 +       LEBI_PUT(in);
1724 +}
1725 +
1726 +static void dec_makehuff(hu, hufflen, huffvals)
1727 +struct dec_hufftbl *hu;
1728 +int *hufflen;
1729 +unsigned char *huffvals;
1730 +{
1731 +       int code, k, i, j, d, x, c, v;
1732 +       for (i = 0; i < (1 << DECBITS); i++)
1733 +               hu->llvals[i] = 0;
1734 +
1735 +/*
1736 + * llvals layout:
1737 + *
1738 + * value v already known, run r, backup u bits:
1739 + *  vvvvvvvvvvvvvvvv 0000 rrrr 1 uuuuuuu
1740 + * value unknown, size b bits, run r, backup u bits:
1741 + *  000000000000bbbb 0000 rrrr 0 uuuuuuu
1742 + * value and size unknown:
1743 + *  0000000000000000 0000 0000 0 0000000
1744 + */
1745 +       code = 0;
1746 +       k = 0;
1747 +       for (i = 0; i < 16; i++, code <<= 1) {  /* sizes */
1748 +               hu->valptr[i] = k;
1749 +               for (j = 0; j < hufflen[i]; j++) {
1750 +                       hu->vals[k] = *huffvals++;
1751 +                       if (i < DECBITS) {
1752 +                               c = code << (DECBITS - 1 - i);
1753 +                               v = hu->vals[k] & 0x0f; /* size */
1754 +                               for (d = 1 << (DECBITS - 1 - i); --d >= 0;) {
1755 +                                       if (v + i < DECBITS) {  /* both fit in table */
1756 +                                               x = d >> (DECBITS - 1 - v -
1757 +                                                         i);
1758 +                                               if (v && x < (1 << (v - 1)))
1759 +                                                       x += (-1 << v) + 1;
1760 +                                               x = x << 16 | (hu-> vals[k] & 0xf0) << 4 |
1761 +                                                       (DECBITS - (i + 1 + v)) | 128;
1762 +                                       } else
1763 +                                               x = v << 16 | (hu-> vals[k] & 0xf0) << 4 |
1764 +                                                       (DECBITS - (i + 1));
1765 +                                       hu->llvals[c | d] = x;
1766 +                               }
1767 +                       }
1768 +                       code++;
1769 +                       k++;
1770 +               }
1771 +               hu->maxcode[i] = code;
1772 +       }
1773 +       hu->maxcode[16] = 0x20000;      /* always terminate decode */
1774 +}
1775 +
1776 +/****************************************************************/
1777 +/**************             idct                  ***************/
1778 +/****************************************************************/
1779 +
1780 +#define ONE ((PREC)IFIX(1.))
1781 +#define S2  ((PREC)IFIX(0.382683432))
1782 +#define C2  ((PREC)IFIX(0.923879532))
1783 +#define C4  ((PREC)IFIX(0.707106781))
1784 +
1785 +#define S22 ((PREC)IFIX(2 * 0.382683432))
1786 +#define C22 ((PREC)IFIX(2 * 0.923879532))
1787 +#define IC4 ((PREC)IFIX(1 / 0.707106781))
1788 +
1789 +#define C3IC1 ((PREC)IFIX(0.847759065))        /* c3/c1 */
1790 +#define C5IC1 ((PREC)IFIX(0.566454497))        /* c5/c1 */
1791 +#define C7IC1 ((PREC)IFIX(0.198912367))        /* c7/c1 */
1792 +
1793 +#define XPP(a,b) (t = a + b, b = a - b, a = t)
1794 +#define XMP(a,b) (t = a - b, b = a + b, a = t)
1795 +#define XPM(a,b) (t = a + b, b = b - a, a = t)
1796 +
1797 +#define ROT(a,b,s,c) ( t = IMULT(a + b, s),    \
1798 +                       a = IMULT(a, c - s) + t,        \
1799 +                       b = IMULT(b, c + s) - t)
1800 +
1801 +#define IDCT           \
1802 +(                      \
1803 +  XPP(t0, t1),         \
1804 +  XMP(t2, t3),         \
1805 +  t2 = IMULT(t2, IC4) - t3,    \
1806 +  XPP(t0, t3),         \
1807 +  XPP(t1, t2),         \
1808 +  XMP(t4, t7),         \
1809 +  XPP(t5, t6),         \
1810 +  XMP(t5, t7),         \
1811 +  t5 = IMULT(t5, IC4), \
1812 +  ROT(t4, t6, S22, C22),\
1813 +  t6 -= t7,            \
1814 +  t5 -= t6,            \
1815 +  t4 -= t5,            \
1816 +  XPP(t0, t7),         \
1817 +  XPP(t1, t6),         \
1818 +  XPP(t2, t5),         \
1819 +  XPP(t3, t4)          \
1820 +)
1821 +
1822 +static unsigned char zig2[64] = {
1823 +       0, 2, 3, 9, 10, 20, 21, 35,
1824 +       14, 16, 25, 31, 39, 46, 50, 57,
1825 +       5, 7, 12, 18, 23, 33, 37, 48,
1826 +       27, 29, 41, 44, 52, 55, 59, 62,
1827 +       15, 26, 30, 40, 45, 51, 56, 58,
1828 +       1, 4, 8, 11, 19, 22, 34, 36,
1829 +       28, 42, 43, 53, 54, 60, 61, 63,
1830 +       6, 13, 17, 24, 32, 38, 47, 49
1831 +};
1832 +
1833 +void idct(in, out, quant, off, max)
1834 +int *in;
1835 +int *out;
1836 +PREC *quant;
1837 +PREC off;
1838 +int max;
1839 +{
1840 +       PREC t0, t1, t2, t3, t4, t5, t6, t7, t;
1841 +       PREC tmp[64], *tmpp;
1842 +       int i, j;
1843 +       unsigned char *zig2p;
1844 +
1845 +       t0 = off;
1846 +       if (max == 1) {
1847 +               t0 += in[0] * quant[0];
1848 +               for (i = 0; i < 64; i++)
1849 +                       out[i] = ITOINT(t0);
1850 +               return;
1851 +       }
1852 +       zig2p = zig2;
1853 +       tmpp = tmp;
1854 +       for (i = 0; i < 8; i++) {
1855 +               j = *zig2p++;
1856 +               t0 += in[j] * quant[j];
1857 +               j = *zig2p++;
1858 +               t5 = in[j] * quant[j];
1859 +               j = *zig2p++;
1860 +               t2 = in[j] * quant[j];
1861 +               j = *zig2p++;
1862 +               t7 = in[j] * quant[j];
1863 +               j = *zig2p++;
1864 +               t1 = in[j] * quant[j];
1865 +               j = *zig2p++;
1866 +               t4 = in[j] * quant[j];
1867 +               j = *zig2p++;
1868 +               t3 = in[j] * quant[j];
1869 +               j = *zig2p++;
1870 +               t6 = in[j] * quant[j];
1871 +               IDCT;
1872 +               tmpp[0 * 8] = t0;
1873 +               tmpp[1 * 8] = t1;
1874 +               tmpp[2 * 8] = t2;
1875 +               tmpp[3 * 8] = t3;
1876 +               tmpp[4 * 8] = t4;
1877 +               tmpp[5 * 8] = t5;
1878 +               tmpp[6 * 8] = t6;
1879 +               tmpp[7 * 8] = t7;
1880 +               tmpp++;
1881 +               t0 = 0;
1882 +       }
1883 +       for (i = 0; i < 8; i++) {
1884 +               t0 = tmp[8 * i + 0];
1885 +               t1 = tmp[8 * i + 1];
1886 +               t2 = tmp[8 * i + 2];
1887 +               t3 = tmp[8 * i + 3];
1888 +               t4 = tmp[8 * i + 4];
1889 +               t5 = tmp[8 * i + 5];
1890 +               t6 = tmp[8 * i + 6];
1891 +               t7 = tmp[8 * i + 7];
1892 +               IDCT;
1893 +               out[8 * i + 0] = ITOINT(t0);
1894 +               out[8 * i + 1] = ITOINT(t1);
1895 +               out[8 * i + 2] = ITOINT(t2);
1896 +               out[8 * i + 3] = ITOINT(t3);
1897 +               out[8 * i + 4] = ITOINT(t4);
1898 +               out[8 * i + 5] = ITOINT(t5);
1899 +               out[8 * i + 6] = ITOINT(t6);
1900 +               out[8 * i + 7] = ITOINT(t7);
1901 +       }
1902 +}
1903 +
1904 +static unsigned char zig[64] = {
1905 +       0, 1, 5, 6, 14, 15, 27, 28,
1906 +       2, 4, 7, 13, 16, 26, 29, 42,
1907 +       3, 8, 12, 17, 25, 30, 41, 43,
1908 +       9, 11, 18, 24, 31, 40, 44, 53,
1909 +       10, 19, 23, 32, 39, 45, 52, 54,
1910 +       20, 22, 33, 38, 46, 51, 55, 60,
1911 +       21, 34, 37, 47, 50, 56, 59, 61,
1912 +       35, 36, 48, 49, 57, 58, 62, 63
1913 +};
1914 +
1915 +static PREC aaidct[8] = {
1916 +       IFIX(0.3535533906), IFIX(0.4903926402),
1917 +       IFIX(0.4619397663), IFIX(0.4157348062),
1918 +       IFIX(0.3535533906), IFIX(0.2777851165),
1919 +       IFIX(0.1913417162), IFIX(0.0975451610)
1920 +};
1921 +
1922 +
1923 +static void idctqtab(qin, qout)
1924 +unsigned char *qin;
1925 +PREC *qout;
1926 +{
1927 +       int i, j;
1928 +
1929 +       for (i = 0; i < 8; i++)
1930 +               for (j = 0; j < 8; j++)
1931 +                       qout[zig[i * 8 + j]] = qin[zig[i * 8 + j]] * 
1932 +                                               IMULT(aaidct[i], aaidct[j]);
1933 +}
1934 +
1935 +static void scaleidctqtab(q, sc)
1936 +PREC *q;
1937 +PREC sc;
1938 +{
1939 +       int i;
1940 +
1941 +       for (i = 0; i < 64; i++)
1942 +               q[i] = IMULT(q[i], sc);
1943 +}
1944 +
1945 +/****************************************************************/
1946 +/**************          color decoder            ***************/
1947 +/****************************************************************/
1948 +
1949 +#define ROUND
1950 +
1951 +/*
1952 + * YCbCr Color transformation:
1953 + *
1954 + * y:0..255   Cb:-128..127   Cr:-128..127
1955 + *
1956 + *      R = Y                + 1.40200 * Cr
1957 + *      G = Y - 0.34414 * Cb - 0.71414 * Cr
1958 + *      B = Y + 1.77200 * Cb
1959 + *
1960 + * =>
1961 + *      Cr *= 1.40200;
1962 + *      Cb *= 1.77200;
1963 + *      Cg = 0.19421 * Cb + .50937 * Cr;
1964 + *      R = Y + Cr;
1965 + *      G = Y - Cg;
1966 + *      B = Y + Cb;
1967 + *
1968 + * =>
1969 + *      Cg = (50 * Cb + 130 * Cr + 128) >> 8;
1970 + */
1971 +
1972 +static void initcol(q)
1973 +PREC q[][64];
1974 +{
1975 +       scaleidctqtab(q[1], IFIX(1.77200));
1976 +       scaleidctqtab(q[2], IFIX(1.40200));
1977 +}
1978 +
1979 +/* This is optimized for the stupid sun SUNWspro compiler. */
1980 +#define STORECLAMP(a,x)                                \
1981 +(                                              \
1982 +  (a) = (x),                                   \
1983 +  (unsigned int)(x) >= 256 ?                   \
1984 +    ((a) = (x) < 0 ? 0 : 255)                  \
1985 +  :                                            \
1986 +    0                                          \
1987 +)
1988 +
1989 +#define CLAMP(x) ((unsigned int)(x) >= 256 ? ((x) < 0 ? 0 : 255) : (x))
1990 +
1991 +#ifdef ROUND
1992 +
1993 +#define CBCRCG(yin, xin)                       \
1994 +(                                              \
1995 +  cb = outc[0 +yin*8+xin],                     \
1996 +  cr = outc[64+yin*8+xin],                     \
1997 +  cg = (50 * cb + 130 * cr + 128) >> 8         \
1998 +)
1999 +
2000 +#else
2001 +
2002 +#define CBCRCG(yin, xin)                       \
2003 +(                                              \
2004 +  cb = outc[0 +yin*8+xin],                     \
2005 +  cr = outc[64+yin*8+xin],                     \
2006 +  cg = (3 * cb + 8 * cr) >> 4                  \
2007 +)
2008 +
2009 +#endif
2010 +
2011 +#define PIC(yin, xin, p, xout)                 \
2012 +(                                              \
2013 +  y = outy[(yin) * 8 + xin],                   \
2014 +  STORECLAMP(p[(xout) * 3 + 0], y + cr),       \
2015 +  STORECLAMP(p[(xout) * 3 + 1], y - cg),       \
2016 +  STORECLAMP(p[(xout) * 3 + 2], y + cb)                \
2017 +)
2018 +
2019 +#ifdef __LITTLE_ENDIAN
2020 +#define PIC_16(yin, xin, p, xout, add)          \
2021 +(                                                \
2022 +  y = outy[(yin) * 8 + xin],                     \
2023 +  y = ((CLAMP(y + cr + add*2+1) & 0xf8) <<  8) | \
2024 +      ((CLAMP(y - cg + add    ) & 0xfc) <<  3) | \
2025 +      ((CLAMP(y + cb + add*2+1)       ) >>  3),  \
2026 +  p[(xout) * 2 + 0] = y & 0xff,                  \
2027 +  p[(xout) * 2 + 1] = y >> 8                     \
2028 +)
2029 +#else
2030 +#ifdef CONFIG_PPC
2031 +#define PIC_16(yin, xin, p, xout, add)          \
2032 +(                                                \
2033 +  y = outy[(yin) * 8 + xin],                     \
2034 +  y = ((CLAMP(y + cr + add*2+1) & 0xf8) <<  7) | \
2035 +      ((CLAMP(y - cg + add*2+1) & 0xf8) <<  2) | \
2036 +      ((CLAMP(y + cb + add*2+1)       ) >>  3),  \
2037 +  p[(xout) * 2 + 0] = y >> 8,                    \
2038 +  p[(xout) * 2 + 1] = y & 0xff                   \
2039 +)
2040 +#else
2041 +#define PIC_16(yin, xin, p, xout, add)          \
2042 +(                                                \
2043 +  y = outy[(yin) * 8 + xin],                     \
2044 +  y = ((CLAMP(y + cr + add*2+1) & 0xf8) <<  8) | \
2045 +      ((CLAMP(y - cg + add    ) & 0xfc) <<  3) | \
2046 +      ((CLAMP(y + cb + add*2+1)       ) >>  3),  \
2047 +  p[(xout) * 2 + 0] = y >> 8,                    \
2048 +  p[(xout) * 2 + 1] = y & 0xff                   \
2049 +)
2050 +#endif
2051 +#endif
2052 +
2053 +#define PIC221111(xin)                                         \
2054 +(                                                              \
2055 +  CBCRCG(0, xin),                                              \
2056 +  PIC(xin / 4 * 8 + 0, (xin & 3) * 2 + 0, pic0, xin * 2 + 0),  \
2057 +  PIC(xin / 4 * 8 + 0, (xin & 3) * 2 + 1, pic0, xin * 2 + 1),  \
2058 +  PIC(xin / 4 * 8 + 1, (xin & 3) * 2 + 0, pic1, xin * 2 + 0),  \
2059 +  PIC(xin / 4 * 8 + 1, (xin & 3) * 2 + 1, pic1, xin * 2 + 1)   \
2060 +)
2061 +
2062 +#define PIC221111_16(xin)                                               \
2063 +(                                                                      \
2064 +  CBCRCG(0, xin),                                                      \
2065 +  PIC_16(xin / 4 * 8 + 0, (xin & 3) * 2 + 0, pic0, xin * 2 + 0, 3),     \
2066 +  PIC_16(xin / 4 * 8 + 0, (xin & 3) * 2 + 1, pic0, xin * 2 + 1, 0),     \
2067 +  PIC_16(xin / 4 * 8 + 1, (xin & 3) * 2 + 0, pic1, xin * 2 + 0, 1),     \
2068 +  PIC_16(xin / 4 * 8 + 1, (xin & 3) * 2 + 1, pic1, xin * 2 + 1, 2)      \
2069 +)
2070 +
2071 +static void col221111(out, pic, width)
2072 +int *out;
2073 +unsigned char *pic;
2074 +int width;
2075 +{
2076 +       int i, j, k;
2077 +       unsigned char *pic0, *pic1;
2078 +       int *outy, *outc;
2079 +       int cr, cg, cb, y;
2080 +
2081 +       pic0 = pic;
2082 +       pic1 = pic + width;
2083 +       outy = out;
2084 +       outc = out + 64 * 4;
2085 +       for (i = 2; i > 0; i--) {
2086 +               for (j = 4; j > 0; j--) {
2087 +                       for (k = 0; k < 8; k++) {
2088 +                               PIC221111(k);
2089 +                       }
2090 +                       outc += 8;
2091 +                       outy += 16;
2092 +                       pic0 += 2 * width;
2093 +                       pic1 += 2 * width;
2094 +               }
2095 +               outy += 64 * 2 - 16 * 4;
2096 +       }
2097 +}
2098 +
2099 +static void col221111_16(out, pic, width)
2100 +int *out;
2101 +unsigned char *pic;
2102 +int width;
2103 +{
2104 +       int i, j, k;
2105 +       unsigned char *pic0, *pic1;
2106 +       int *outy, *outc;
2107 +       int cr, cg, cb, y;
2108 +
2109 +       pic0 = pic;
2110 +       pic1 = pic + width;
2111 +       outy = out;
2112 +       outc = out + 64 * 4;
2113 +       for (i = 2; i > 0; i--) {
2114 +               for (j = 4; j > 0; j--) {
2115 +                       for (k = 0; k < 8; k++) {
2116 +                           PIC221111_16(k);
2117 +                       }
2118 +                       outc += 8;
2119 +                       outy += 16;
2120 +                       pic0 += 2 * width;
2121 +                       pic1 += 2 * width;
2122 +               }
2123 +               outy += 64 * 2 - 16 * 4;
2124 +       }
2125 +}
2126 diff -ruNp -X linux-2.6.15/Documentation/dontdiff linux-2.6.15/drivers/video/bootsplash/decode-jpg.h linux-2.6.15-VinX/drivers/video/bootsplash/decode-jpg.h
2127 --- linux-2.6.15/drivers/video/bootsplash/decode-jpg.h  1970-01-01 01:00:00.000000000 +0100
2128 +++ linux-2.6.15-VinX/drivers/video/bootsplash/decode-jpg.h     2006-01-05 01:17:11.000000000 +0100
2129 @@ -0,0 +1,35 @@
2130 +/*
2131 + *    linux/drivers/video/bootsplash/decode-jpg.h - a tiny jpeg decoder.
2132 + *
2133 + *      (w) August 2001 by Michael Schroeder, <mls@suse.de>
2134 + */
2135 +
2136 +#ifndef __DECODE_JPG_H
2137 +#define __DECODE_JPG_H
2138 +
2139 +#define ERR_NO_SOI 1
2140 +#define ERR_NOT_8BIT 2
2141 +#define ERR_HEIGHT_MISMATCH 3
2142 +#define ERR_WIDTH_MISMATCH 4
2143 +#define ERR_BAD_WIDTH_OR_HEIGHT 5
2144 +#define ERR_TOO_MANY_COMPPS 6
2145 +#define ERR_ILLEGAL_HV 7
2146 +#define ERR_QUANT_TABLE_SELECTOR 8
2147 +#define ERR_NOT_YCBCR_221111 9
2148 +#define ERR_UNKNOWN_CID_IN_SCAN 10
2149 +#define ERR_NOT_SEQUENTIAL_DCT 11
2150 +#define ERR_WRONG_MARKER 12
2151 +#define ERR_NO_EOI 13
2152 +#define ERR_BAD_TABLES 14
2153 +#define ERR_DEPTH_MISMATCH 15
2154 +
2155 +struct jpeg_decdata {
2156 +       int dcts[6 * 64 + 16];
2157 +       int out[64 * 6];
2158 +       int dquant[3][64];
2159 +};
2160 +
2161 +extern int jpeg_decode(unsigned char *, unsigned char *, int, int, int, struct jpeg_decdata *);
2162 +extern int jpeg_check_size(unsigned char *, int, int);
2163 +
2164 +#endif
2165 diff -ruNp -X linux-2.6.15/Documentation/dontdiff linux-2.6.15/drivers/video/bootsplash/render.c linux-2.6.15-VinX/drivers/video/bootsplash/render.c
2166 --- linux-2.6.15/drivers/video/bootsplash/render.c      1970-01-01 01:00:00.000000000 +0100
2167 +++ linux-2.6.15-VinX/drivers/video/bootsplash/render.c 2006-01-05 01:17:11.000000000 +0100
2168 @@ -0,0 +1,316 @@
2169 +/* 
2170 + *    linux/drivers/video/bootsplash/render.c - splash screen render functions.
2171 + */
2172 +
2173 +
2174 +#include <linux/module.h>
2175 +#include <linux/types.h>
2176 +#include <linux/fb.h>
2177 +#include <linux/vt_kern.h>
2178 +#include <asm/irq.h>
2179 +#include <asm/system.h>
2180 +
2181 +#include "../console/fbcon.h"
2182 +#include "bootsplash.h"
2183 +
2184 +void splash_putcs(struct splash_data *sd, struct vc_data *vc, struct fb_info *info,
2185 +                       const unsigned short *s, int count, int ypos, int xpos)
2186 +{
2187 +       unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff;
2188 +       int bgshift = (vc->vc_hi_font_mask) ? 13 : 12;
2189 +       int fgshift = (vc->vc_hi_font_mask) ? 9 : 8;
2190 +       u8 *src;
2191 +        u8 *dst, *splashsrc;
2192 +       unsigned int d, x, y;
2193 +       u32 dd, fgx, bgx;
2194 +       u16 c = scr_readw(s);
2195 +
2196 +       int fg_color, bg_color, transparent;
2197 +        fg_color = attr_fgcol(fgshift, c);
2198 +        bg_color = attr_bgcol(bgshift, c);
2199 +       transparent = sd->splash_color == bg_color;
2200 +       xpos = xpos * vc->vc_font.width + sd->splash_text_xo;
2201 +       ypos = ypos * vc->vc_font.height + sd->splash_text_yo;
2202 +        splashsrc = (u8 *)(info->splash_pic + ypos * info->splash_bytes + xpos * 2);
2203 +        dst = (u8 *)(info->screen_base + ypos * info->fix.line_length + xpos * 2);
2204 +
2205 +       fgx = ((u32 *)info->pseudo_palette)[fg_color];
2206 +       if (transparent && sd->splash_color == 15) {
2207 +           if (fgx == 0xffea)
2208 +               fgx = 0xfe4a;
2209 +           else if (fgx == 0x57ea)
2210 +               fgx = 0x0540;
2211 +           else if (fgx == 0xffff)
2212 +               fgx = 0x52aa;
2213 +       }
2214 +       bgx = ((u32 *)info->pseudo_palette)[bg_color];
2215 +       d = 0;
2216 +
2217 +       while (count--) {
2218 +           c = scr_readw(s++);
2219 +           src = vc->vc_font.data + (c & charmask) * vc->vc_font.height * ((vc->vc_font.width + 7) >> 3);
2220 +
2221 +           for (y = 0; y < vc->vc_font.height; y++) {
2222 +               for (x = 0; x < vc->vc_font.width; x += 2) {
2223 +                   if ((x & 7) == 0)
2224 +                       d = *src++;
2225 +                   if (d & 0x80)
2226 +                       dd = fgx;
2227 +                   else
2228 +                       dd = transparent ? *(u16 *)splashsrc : bgx;
2229 +                   splashsrc += 2;
2230 +                   if (d & 0x40)
2231 +                       dd |= fgx << 16;
2232 +                   else
2233 +                       dd |= (transparent ? *(u16 *)splashsrc : bgx) << 16;
2234 +                   splashsrc += 2;
2235 +                   d <<= 2;
2236 +                   fb_writel(dd, dst);
2237 +                   dst += 4;
2238 +               }
2239 +               dst += info->fix.line_length - vc->vc_font.width * 2;
2240 +               splashsrc += info->splash_bytes - vc->vc_font.width * 2;
2241 +           }
2242 +           dst -= info->fix.line_length * vc->vc_font.height - vc->vc_font.width * 2;
2243 +           splashsrc -= info->splash_bytes * vc->vc_font.height - vc->vc_font.width * 2;
2244 +       }
2245 +}
2246 +
2247 +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)
2248 +{
2249 +       int transparent = sd->splash_color == bg_color;
2250 +       u32 dd, fgx, bgx;
2251 +       u8 *dst, *splashsrc;
2252 +       unsigned int d, x, y;
2253 +
2254 +       splashsrc = (u8 *)(info->splash_pic + ypos * info->splash_bytes + xpos * 2);
2255 +       dst = (u8 *)(info->screen_base + ypos * info->fix.line_length + xpos * 2);
2256 +       fgx = ((u32 *)info->pseudo_palette)[fg_color];
2257 +       if (transparent && sd->splash_color == 15) {
2258 +           if (fgx == 0xffea)
2259 +               fgx = 0xfe4a;
2260 +           else if (fgx == 0x57ea)
2261 +               fgx = 0x0540;
2262 +           else if (fgx == 0xffff)
2263 +               fgx = 0x52aa;
2264 +       }
2265 +       bgx = ((u32 *)info->pseudo_palette)[bg_color];
2266 +       d = 0;
2267 +       for (y = 0; y < height; y++) {
2268 +           for (x = 0; x < width; x += 2) {
2269 +               if ((x & 7) == 0)
2270 +                   d = *src++;
2271 +               if (d & 0x80)
2272 +                   dd = fgx;
2273 +               else
2274 +                   dd = transparent ? *(u16 *)splashsrc : bgx;
2275 +               splashsrc += 2;
2276 +               if (d & 0x40)
2277 +                   dd |= fgx << 16;
2278 +               else
2279 +                   dd |= (transparent ? *(u16 *)splashsrc : bgx) << 16;
2280 +               splashsrc += 2;
2281 +               d <<= 2;
2282 +               fb_writel(dd, dst);
2283 +               dst += 4;
2284 +           }
2285 +           dst += info->fix.line_length - width * 2;
2286 +           splashsrc += info->splash_bytes - width * 2;
2287 +       }
2288 +}
2289 +
2290 +void splash_putc(struct splash_data *sd, struct vc_data *vc, struct fb_info *info,
2291 +                      int c, int ypos, int xpos)
2292 +{
2293 +       unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff;
2294 +       int bgshift = (vc->vc_hi_font_mask) ? 13 : 12;
2295 +       int fgshift = (vc->vc_hi_font_mask) ? 9 : 8;
2296 +       u8 *src = vc->vc_font.data + (c & charmask) * vc->vc_font.height * ((vc->vc_font.width + 7) >> 3);
2297 +       xpos = xpos * vc->vc_font.width + sd->splash_text_xo;
2298 +       ypos = ypos * vc->vc_font.height + sd->splash_text_yo;
2299 +       splash_renderc(sd, info, attr_fgcol(fgshift, c), attr_bgcol(bgshift, c), src, ypos, xpos, vc->vc_font.height, vc->vc_font.width);
2300 +}
2301 +
2302 +void splashcopy(u8 *dst, u8 *src, int height, int width, int dstbytes, int srcbytes)
2303 +{
2304 +       int i;
2305 +
2306 +       while (height-- > 0) {
2307 +           u32 *p = (u32 *)dst;
2308 +           u32 *q = (u32 *)src;
2309 +           for (i=0; i < width/4; i++) {
2310 +               fb_writel(*q++,p++);
2311 +               fb_writel(*q++,p++);
2312 +           }
2313 +           if (width & 2)
2314 +               fb_writel(*q++,p++);
2315 +           if (width & 1)
2316 +               fb_writew(*(u16*)q,(u16*)p);
2317 +           dst += dstbytes;
2318 +           src += srcbytes;
2319 +       }
2320 +}
2321 +
2322 +static void splashset(u8 *dst, int height, int width, int dstbytes, u32 bgx) {
2323 +       int i;
2324 +
2325 +       bgx |= bgx << 16;
2326 +       while (height-- > 0) {
2327 +           u32 *p = (u32 *)dst;
2328 +           for (i=0; i < width/4; i++) {
2329 +               fb_writel(bgx,p++);
2330 +               fb_writel(bgx,p++);
2331 +           }
2332 +           if (width & 2)
2333 +               fb_writel(bgx,p++);
2334 +           if (width & 1)
2335 +               fb_writew(bgx,(u16*)p);
2336 +           dst += dstbytes;
2337 +       }
2338 +}
2339 +
2340 +static void splashfill(struct fb_info *info, int sy, int sx, int height, int width) {
2341 +       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);
2342 +}
2343 +
2344 +void splash_clear(struct splash_data *sd, struct vc_data *vc, struct fb_info *info, int sy,
2345 +                       int sx, int height, int width)
2346 +{
2347 +       int bgshift = (vc->vc_hi_font_mask) ? 13 : 12;
2348 +       int bg_color = attr_bgcol_ec(bgshift, vc);
2349 +       int transparent = sd->splash_color == bg_color;
2350 +       u32 bgx;
2351 +       u8 *dst;
2352 +
2353 +       sy = sy * vc->vc_font.height + sd->splash_text_yo;
2354 +       sx = sx * vc->vc_font.width + sd->splash_text_xo;
2355 +       height *= vc->vc_font.height;
2356 +       width *= vc->vc_font.width;
2357 +       if (transparent) {
2358 +               splashfill(info, sy, sx, height, width);
2359 +               return;
2360 +       }
2361 +        dst = (u8 *)(info->screen_base + sy * info->fix.line_length + sx * 2);
2362 +       bgx = ((u32 *)info->pseudo_palette)[bg_color];
2363 +       splashset(dst, height, width, info->fix.line_length, bgx);
2364 +}
2365 +
2366 +void splash_bmove(struct splash_data *sd, struct vc_data *vc, struct fb_info *info, int sy, 
2367 +               int sx, int dy, int dx, int height, int width)
2368 +{
2369 +       struct fb_copyarea area;
2370 +
2371 +       area.sx = sx * vc->vc_font.width;
2372 +       area.sy = sy * vc->vc_font.height;
2373 +       area.dx = dx * vc->vc_font.width;
2374 +       area.dy = dy * vc->vc_font.height;
2375 +       area.sx += sd->splash_text_xo;
2376 +       area.sy += sd->splash_text_yo;
2377 +       area.dx += sd->splash_text_xo;
2378 +       area.dy += sd->splash_text_yo;
2379 +       area.height = height * vc->vc_font.height;
2380 +       area.width = width * vc->vc_font.width;
2381 +
2382 +       info->fbops->fb_copyarea(info, &area);
2383 +}
2384 +
2385 +void splash_clear_margins(struct splash_data *sd, struct vc_data *vc, struct fb_info *info,
2386 +                               int bottom_only)
2387 +{
2388 +       unsigned int tw = vc->vc_cols*vc->vc_font.width;
2389 +       unsigned int th = vc->vc_rows*vc->vc_font.height;
2390 +       
2391 +       if (!bottom_only) {
2392 +               /* top margin */
2393 +               splashfill(info, 0, 0, sd->splash_text_yo, info->var.xres);
2394 +               /* left margin */
2395 +               splashfill(info, sd->splash_text_yo, 0, th, sd->splash_text_xo);
2396 +               /* right margin */
2397 +               splashfill(info, sd->splash_text_yo, sd->splash_text_xo + tw, th, info->var.xres - sd->splash_text_xo - tw);
2398 +
2399 +       }
2400 +       splashfill(info, sd->splash_text_yo + th, 0, info->var.yres - sd->splash_text_yo - th, info->var.xres);
2401 +}
2402 +
2403 +int splash_cursor(struct splash_data *sd, struct fb_info *info, struct fb_cursor *cursor)
2404 +{
2405 +       int i;
2406 +       unsigned int dsize, s_pitch;
2407 +
2408 +       if (info->state != FBINFO_STATE_RUNNING)
2409 +               return 0;
2410 +       
2411 +       s_pitch = (cursor->image.width + 7) >> 3;
2412 +        dsize = s_pitch * cursor->image.height;
2413 +        if (cursor->enable) {
2414 +                switch (cursor->rop) {
2415 +                case ROP_XOR:
2416 +                        for (i = 0; i < dsize; i++)
2417 +                                info->fb_cursordata[i] = cursor->image.data[i] ^ cursor->mask[i];
2418 +                        break;
2419 +                case ROP_COPY:
2420 +                default:
2421 +                        for (i = 0; i < dsize; i++)
2422 +                                info->fb_cursordata[i] = cursor->image.data[i] & cursor->mask[i];
2423 +                        break;
2424 +                }
2425 +        } else if (info->fb_cursordata != cursor->image.data)
2426 +                memcpy(info->fb_cursordata, cursor->image.data, dsize);
2427 +       cursor->image.data = info->fb_cursordata;
2428 +       splash_renderc(sd, info, cursor->image.fg_color, cursor->image.bg_color, (u8 *)info->fb_cursordata, cursor->image.dy + sd->splash_text_yo, cursor->image.dx + sd->splash_text_xo, cursor->image.height, cursor->image.width);
2429 +       return 0;
2430 +}
2431 +
2432 +void splash_bmove_redraw(struct splash_data *sd, struct vc_data *vc, struct fb_info *info, int y, int sx, int dx, int width)
2433 +{
2434 +       unsigned short *d = (unsigned short *) (vc->vc_origin + vc->vc_size_row * y + dx * 2);
2435 +       unsigned short *s = d + (dx - sx);
2436 +       unsigned short *start = d;
2437 +       unsigned short *ls = d;
2438 +       unsigned short *le = d + width;
2439 +       unsigned short c;
2440 +       int x = dx;
2441 +       unsigned short attr = 1;
2442 +
2443 +       do {
2444 +               c = scr_readw(d);
2445 +               if (attr != (c & 0xff00)) {
2446 +                       attr = c & 0xff00;
2447 +                       if (d > start) {
2448 +                               splash_putcs(sd, vc, info, start, d - start, y, x);
2449 +                               x += d - start;
2450 +                               start = d;
2451 +                       }
2452 +               }
2453 +               if (s >= ls && s < le && c == scr_readw(s)) {
2454 +                       if (d > start) {
2455 +                               splash_putcs(sd, vc, info, start, d - start, y, x);
2456 +                               x += d - start + 1;
2457 +                               start = d + 1;
2458 +                       } else {
2459 +                               x++;
2460 +                               start++;
2461 +                       }
2462 +               }
2463 +               s++;
2464 +               d++;
2465 +       } while (d < le);
2466 +       if (d > start)
2467 +               splash_putcs(sd, vc, info, start, d - start, y, x);
2468 +}
2469 +
2470 +void splash_blank(struct splash_data *sd, struct vc_data *vc, struct fb_info *info, int blank)
2471 +{
2472 +       if (blank) {
2473 +               if (info->silent_screen_base)
2474 +                   splashset((u8 *)info->silent_screen_base, info->var.yres, info->var.xres, info->fix.line_length, 0);
2475 +               splashset((u8 *)info->screen_base, info->var.yres, info->var.xres, info->fix.line_length, 0);
2476 +       } else {
2477 +               if (info->silent_screen_base)
2478 +                       splash_prepare(vc, info);
2479 +               splash_clear_margins(vc->vc_splash_data, vc, info, 0);
2480 +               /* no longer needed, done in fbcon_blank */
2481 +               /* update_screen(vc->vc_num); */
2482 +       }
2483 +}
2484 +
2485 diff -ruNp -X linux-2.6.15/Documentation/dontdiff linux-2.6.15/drivers/video/console/bitblit.c linux-2.6.15-VinX/drivers/video/console/bitblit.c
2486 --- linux-2.6.15/drivers/video/console/bitblit.c        2006-01-03 04:21:10.000000000 +0100
2487 +++ linux-2.6.15-VinX/drivers/video/console/bitblit.c   2006-01-05 01:22:17.000000000 +0100
2488 @@ -18,6 +18,9 @@
2489  #include <linux/console.h>
2490  #include <asm/types.h>
2491  #include "fbcon.h"
2492 +#ifdef CONFIG_BOOTSPLASH
2493 +#include "../bootsplash/bootsplash.h"
2494 +#endif
2495  
2496  /*
2497   * Accelerated handlers.
2498 @@ -48,6 +51,13 @@ static void bit_bmove(struct vc_data *vc
2499  {
2500         struct fb_copyarea area;
2501  
2502 +#ifdef CONFIG_BOOTSPLASH
2503 +       if (info->splash_data) {
2504 +               splash_bmove(info->splash_data, vc, info,
2505 +                       sy, sx, dy, dx, height, width);
2506 +               return;
2507 +       }
2508 +#endif
2509         area.sx = sx * vc->vc_font.width;
2510         area.sy = sy * vc->vc_font.height;
2511         area.dx = dx * vc->vc_font.width;
2512 @@ -64,6 +74,13 @@ static void bit_clear(struct vc_data *vc
2513         int bgshift = (vc->vc_hi_font_mask) ? 13 : 12;
2514         struct fb_fillrect region;
2515  
2516 +#ifdef CONFIG_BOOTSPLASH
2517 +       if (info->splash_data) {
2518 +               splash_clear(info->splash_data, vc, info,
2519 +                                               sy, sx, height, width);
2520 +               return;
2521 +       }
2522 +#endif
2523         region.color = attr_bgcol_ec(bgshift, vc);
2524         region.dx = sx * vc->vc_font.width;
2525         region.dy = sy * vc->vc_font.height;
2526 @@ -161,6 +178,13 @@ static void bit_putcs(struct vc_data *vc
2527         image.height = vc->vc_font.height;
2528         image.depth = 1;
2529  
2530 +#ifdef CONFIG_BOOTSPLASH
2531 +       if (info->splash_data) {
2532 +               splash_putcs(info->splash_data, vc, info, s, count, yy, xx);
2533 +               return;
2534 +       }
2535 +#endif
2536 +
2537         if (attribute) {
2538                 buf = kmalloc(cellsize, GFP_KERNEL);
2539                 if (!buf)
2540 @@ -214,6 +238,13 @@ static void bit_clear_margins(struct vc_
2541         unsigned int bs = info->var.yres - bh;
2542         struct fb_fillrect region;
2543  
2544 +#ifdef CONFIG_BOOTSPLASH
2545 +       if (info->splash_data) {
2546 +               splash_clear_margins(info->splash_data, vc, info, bottom_only);
2547 +               return;
2548 +       }
2549 +#endif
2550 +
2551         region.color = 0;
2552         region.rop = ROP_COPY;
2553  
2554 @@ -380,6 +411,14 @@ static void bit_cursor(struct vc_data *v
2555         cursor.image.depth = 1;
2556         cursor.rop = ROP_XOR;
2557  
2558 +#ifdef CONFIG_BOOTSPLASH
2559 +       if (info->splash_data) {
2560 +               splash_cursor(info->splash_data, info, &cursor);
2561 +               ops->cursor_reset = 0;
2562 +               return;
2563 +       }
2564 +#endif
2565 +
2566         if (info->fbops->fb_cursor)
2567                 err = info->fbops->fb_cursor(info, &cursor);
2568  
2569 diff -ruNp -X linux-2.6.15/Documentation/dontdiff linux-2.6.15/drivers/video/console/fbcon.c linux-2.6.15-VinX/drivers/video/console/fbcon.c
2570 --- linux-2.6.15/drivers/video/console/fbcon.c  2006-01-03 04:21:10.000000000 +0100
2571 +++ linux-2.6.15-VinX/drivers/video/console/fbcon.c     2006-01-05 01:31:49.000000000 +0100
2572 @@ -94,6 +94,10 @@
2573  
2574  #include "fbcon.h"
2575  
2576 +#ifdef CONFIG_BOOTSPLASH
2577 +#include "../bootsplash/bootsplash.h"
2578 +#endif
2579 +
2580  #ifdef FBCONDEBUG
2581  #  define DPRINTK(fmt, args...) printk(KERN_DEBUG "%s: " fmt, __FUNCTION__ , ## args)
2582  #else
2583 @@ -107,8 +111,7 @@ enum {
2584  };
2585  
2586  static struct display fb_display[MAX_NR_CONSOLES];
2587 -
2588 -static signed char con2fb_map[MAX_NR_CONSOLES];
2589 +signed char con2fb_map[MAX_NR_CONSOLES];
2590  static signed char con2fb_map_boot[MAX_NR_CONSOLES];
2591  static int logo_height;
2592  static int logo_lines;
2593 @@ -559,6 +562,10 @@ static int fbcon_takeover(int show_logo)
2594         for (i = first_fb_vc; i <= last_fb_vc; i++)
2595                 con2fb_map[i] = info_idx;
2596  
2597 +#ifdef CONFIG_BOOTSPLASH
2598 +       splash_init();
2599 +#endif
2600 +
2601         err = take_over_console(&fb_con, first_fb_vc, last_fb_vc,
2602                                 fbcon_is_default);
2603         if (err) {
2604 @@ -1101,6 +1108,16 @@ static void fbcon_init(struct vc_data *v
2605         new_rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres);
2606         new_cols /= vc->vc_font.width;
2607         new_rows /= vc->vc_font.height;
2608 +
2609 +#ifdef CONFIG_BOOTSPLASH
2610 +       if (vc->vc_splash_data && vc->vc_splash_data->splash_state) {
2611 +               new_cols = vc->vc_splash_data->splash_text_wi / vc->vc_font.width;
2612 +               new_rows = vc->vc_splash_data->splash_text_he / vc->vc_font.height;
2613 +               logo = 0;
2614 +               con_remap_def_color(vc, vc->vc_splash_data->splash_color << 4 | vc->vc_splash_data->splash_fg_color);
2615 +       }
2616 +#endif
2617 +                               
2618         vc_resize(vc, new_cols, new_rows);
2619  
2620         /*
2621 @@ -1718,6 +1735,10 @@ static int fbcon_scroll(struct vc_data *
2622                         fbcon_softback_note(vc, t, count);
2623                 if (logo_shown >= 0)
2624                         goto redraw_up;
2625 +#ifdef CONFIG_BOOTSPLASH
2626 +               if (info->splash_data)
2627 +                       goto redraw_up;
2628 +#endif
2629                 switch (p->scrollmode) {
2630                 case SCROLL_MOVE:
2631                         ops->bmove(vc, info, t + count, 0, t, 0,
2632 @@ -1802,6 +1823,10 @@ static int fbcon_scroll(struct vc_data *
2633         case SM_DOWN:
2634                 if (count > vc->vc_rows)        /* Maximum realistic size */
2635                         count = vc->vc_rows;
2636 +#ifdef CONFIG_BOOTSPLASH
2637 +               if (info->splash_data)
2638 +                       goto redraw_down;
2639 +#endif
2640                 if (logo_shown >= 0)
2641                         goto redraw_down;
2642                 switch (p->scrollmode) {
2643 @@ -1946,6 +1971,14 @@ static void fbcon_bmove_rec(struct vc_da
2644                 }
2645                 return;
2646         }
2647 +
2648 +#ifdef CONFIG_BOOTSPLASH
2649 +       if (info->splash_data && sy == dy && height == 1) {
2650 +               /* must use slower redraw bmove to keep background pic intact */
2651 +               splash_bmove_redraw(info->splash_data, vc, info, sy, sx, dx, width);
2652 +               return;
2653 +       }
2654 +#endif
2655         ops->bmove(vc, info, real_y(p, sy), sx, real_y(p, dy), dx,
2656                    height, width);
2657  }
2658 @@ -2053,6 +2086,10 @@ static int fbcon_switch(struct vc_data *
2659         info = registered_fb[con2fb_map[vc->vc_num]];
2660         ops = info->fbcon_par;
2661  
2662 +#ifdef CONFIG_BOOTSPLASH
2663 +       splash_prepare(vc, info);
2664 +#endif
2665 +
2666         if (softback_top) {
2667                 if (softback_lines)
2668                         fbcon_set_origin(vc);
2669 @@ -2173,6 +2210,12 @@ static int fbcon_switch(struct vc_data *
2670  static void fbcon_generic_blank(struct vc_data *vc, struct fb_info *info,
2671                                 int blank)
2672  {
2673 +#ifdef CONFIG_BOOTSPLASH
2674 +       if (info->splash_data) {
2675 +               splash_blank(info->splash_data, vc, info, blank);
2676 +               return;
2677 +       }
2678 +#endif
2679         if (blank) {
2680                 unsigned short charmask = vc->vc_hi_font_mask ?
2681                         0x1ff : 0xff;
2682 @@ -2373,10 +2416,19 @@ static int fbcon_do_set_font(struct vc_d
2683         if (resize) {
2684                 int cols, rows;
2685  
2686 +               u32 xres = info->var.xres, yres = info->var.yres;
2687                 cols = FBCON_SWAP(ops->rotate, info->var.xres, info->var.yres);
2688                 rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres);
2689                 cols /= w;
2690                 rows /= h;
2691 +
2692 +#ifdef CONFIG_BOOTSPLASH
2693 +               if (info->splash_data) {
2694 +                       xres = info->splash_data->splash_text_wi;
2695 +                       yres = info->splash_data->splash_text_he;
2696 +               }
2697 +#endif
2698 +                                       
2699                 vc_resize(vc, cols, rows);
2700                 if (CON_IS_VISIBLE(vc) && softback_buf)
2701                         fbcon_update_softback(vc);
2702 diff -ruNp -X linux-2.6.15/Documentation/dontdiff linux-2.6.15/drivers/video/console/fbcon.h linux-2.6.15-VinX/drivers/video/console/fbcon.h
2703 --- linux-2.6.15/drivers/video/console/fbcon.h  2006-01-03 04:21:10.000000000 +0100
2704 +++ linux-2.6.15-VinX/drivers/video/console/fbcon.h     2006-01-05 01:17:11.000000000 +0100
2705 @@ -26,6 +26,34 @@
2706      *    low-level frame buffer device
2707      */
2708  
2709 +#ifdef CONFIG_BOOTSPLASH
2710 +struct splash_data {
2711 +    int splash_state;                  /* show splash? */
2712 +    int splash_color;                  /* transparent color */
2713 +    int splash_fg_color;               /* foreground color */
2714 +    int splash_width;                  /* width of image */
2715 +    int splash_height;                 /* height of image */
2716 +    int splash_text_xo;                        /* text area origin */
2717 +    int splash_text_yo;
2718 +    int splash_text_wi;                        /* text area size */ 
2719 +    int splash_text_he;
2720 +    int splash_showtext;               /* silent/verbose mode */
2721 +    int splash_boxcount;
2722 +    int splash_percent;
2723 +    int splash_overpaintok;            /* is it ok to overpaint boxes */
2724 +    int splash_palcnt;
2725 +    char *oldscreen_base;              /* pointer to top of virtual screen */
2726 +    unsigned char *splash_boxes;
2727 +    unsigned char *splash_jpeg;                /* jpeg */
2728 +    unsigned char *splash_palette;     /* palette for 8-bit */
2729 +
2730 +    int splash_dosilent;               /* show silent jpeg */
2731 +    unsigned char *splash_silentjpeg;
2732 +    unsigned char *splash_sboxes;
2733 +    int splash_sboxcount;
2734 +};
2735 +#endif
2736 +
2737  struct display {
2738      /* Filled in by the low-level console driver */
2739      const u_char *fontdata;
2740 diff -ruNp -X linux-2.6.15/Documentation/dontdiff linux-2.6.15/drivers/video/vesafb.c linux-2.6.15-VinX/drivers/video/vesafb.c
2741 --- linux-2.6.15/drivers/video/vesafb.c 2006-01-03 04:21:10.000000000 +0100
2742 +++ linux-2.6.15-VinX/drivers/video/vesafb.c    2006-01-05 01:37:18.000000000 +0100
2743 @@ -201,7 +201,10 @@ static int vesafb_setcolreg(unsigned reg
2744         return 0;
2745  }
2746  
2747 -static struct fb_ops vesafb_ops = {
2748 +#ifndef CONFIG_BOOTSPLASH
2749 +static
2750 +#endif
2751 +struct fb_ops vesafb_ops = {
2752         .owner          = THIS_MODULE,
2753         .fb_setcolreg   = vesafb_setcolreg,
2754         .fb_pan_display = vesafb_pan_display,
2755 @@ -285,6 +288,11 @@ static int __init vesafb_probe(struct pl
2756          *                 option to simply use size_total as that
2757          *                 wastes plenty of kernel address space. */
2758         size_remap  = size_vmode * 2;
2759 +       
2760 +#ifdef CONFIG_BOOTSPLASH
2761 +       size_remap *= 2;        /* some more for the images */
2762 +#endif
2763 +
2764         if (vram_remap)
2765                 size_remap = vram_remap * 1024 * 1024;
2766         if (size_remap < size_vmode)
2767 diff -ruNp -X linux-2.6.15/Documentation/dontdiff linux-2.6.15/include/linux/console_struct.h linux-2.6.15-VinX/include/linux/console_struct.h
2768 --- linux-2.6.15/include/linux/console_struct.h 2006-01-03 04:21:10.000000000 +0100
2769 +++ linux-2.6.15-VinX/include/linux/console_struct.h    2006-01-05 01:38:58.000000000 +0100
2770 @@ -97,6 +97,11 @@ struct vc_data {
2771         struct vc_data **vc_display_fg;         /* [!] Ptr to var holding fg console for this display */
2772         unsigned long   vc_uni_pagedir;
2773         unsigned long   *vc_uni_pagedir_loc;  /* [!] Location of uni_pagedir variable for this console */
2774 +       
2775 +#ifdef CONFIG_BOOTSPLASH
2776 +        struct splash_data *vc_splash_data;
2777 +#endif
2778 +
2779         /* additional information is in vt_kern.h */
2780  };
2781  
2782 diff -ruNp -X linux-2.6.15/Documentation/dontdiff linux-2.6.15/include/linux/fb.h linux-2.6.15-VinX/include/linux/fb.h
2783 --- linux-2.6.15/include/linux/fb.h     2006-01-03 04:21:10.000000000 +0100
2784 +++ linux-2.6.15-VinX/include/linux/fb.h        2006-01-05 01:17:11.000000000 +0100
2785 @@ -771,6 +771,14 @@ struct fb_info {
2786         void *fbcon_par;                /* fbcon use-only private area */
2787         /* From here on everything is device dependent */
2788         void *par;      
2789 +#ifdef CONFIG_BOOTSPLASH
2790 +       struct splash_data *splash_data;
2791 +       unsigned char *splash_pic;
2792 +       int splash_pic_size;
2793 +       int splash_bytes;
2794 +       char *silent_screen_base;       /* real screen base */
2795 +       char fb_cursordata[64];
2796 +#endif
2797  };
2798  
2799  #ifdef MODULE
This page took 0.243648 seconds and 3 git commands to generate.