--- fbcon.c.orig 2004-07-18 22:21:26.777703784 +0200 +++ fbcon.c 2004-07-18 22:21:26.751707736 +0200 @@ -93,6 +93,9 @@ #endif #include "fbcon.h" +#ifdef CONFIG_BOOTSPLASH +#include "../bootsplash/bootsplash.h" +#endif #ifdef FBCONDEBUG # define DPRINTK(fmt, args...) printk(KERN_DEBUG "%s: " fmt, __FUNCTION__ , ## args) @@ -209,8 +212,16 @@ info->cursor.rop == ROP_COPY || !vc || !CON_IS_VISIBLE(vc) || registered_fb[(int) con2fb_map[vc->vc_num]] != info) return; + acquire_console_sem(); info->cursor.enable ^= 1; +#ifdef CONFIG_BOOTSPLASH + if (info->splash_data) { + splash_cursor(info->splash_data, info, &info->cursor); + release_console_sem(); + return; + } +#endif info->fbops->fb_cursor(info, &info->cursor); release_console_sem(); } @@ -409,6 +420,14 @@ { struct fb_copyarea area; +#ifdef CONFIG_BOOTSPLASH + if (info->splash_data) { + splash_bmove(info->splash_data, vc, info, + sy, sx, dy, dx, height, width); + return; + } +#endif + area.sx = sx * vc->vc_font.width; area.sy = sy * vc->vc_font.height; area.dx = dx * vc->vc_font.width; @@ -425,6 +444,13 @@ int bgshift = (vc->vc_hi_font_mask) ? 13 : 12; struct fb_fillrect region; +#ifdef CONFIG_BOOTSPLASH + if (info->splash_data) { + splash_clear(info->splash_data, vc, info, + sy, sx, height, width); + return; + } +#endif region.color = attr_bgcol_ec(bgshift, vc); region.dx = sx * vc->vc_font.width; region.dy = sy * vc->vc_font.height; @@ -457,6 +483,12 @@ struct fb_image image; u8 *src, *dst; +#ifdef CONFIG_BOOTSPLASH + if (info->splash_data) { + splash_putcs(info->splash_data, vc, info, s, count, yy, xx); + return; + } +#endif image.fg_color = attr_fgcol((vc->vc_hi_font_mask) ? 9 : 8, scr_readw(s)); image.bg_color = attr_bgcol((vc->vc_hi_font_mask) ? 13 : 12, @@ -525,6 +557,13 @@ unsigned int bs = info->var.yres - bh; struct fb_fillrect region; +#ifdef CONFIG_BOOTSPLASH + if (info->splash_data) { + splash_clear_margins(info->splash_data, vc, info, bottom_only); + return; + } +#endif + region.color = attr_bgcol_ec(bgshift, vc); region.rop = ROP_COPY; @@ -621,6 +660,7 @@ cols = info->var.xres / vc->vc_font.width; rows = info->var.yres / vc->vc_font.height; + vc_resize(vc->vc_num, cols, rows); DPRINTK("mode: %s\n", info->fix.id); @@ -749,6 +789,14 @@ rows = vc->vc_rows; new_cols = info->var.xres / vc->vc_font.width; new_rows = info->var.yres / vc->vc_font.height; + +#ifdef CONFIG_BOOTSPLASH + if (vc->vc_splash_data && vc->vc_splash_data->splash_state) { + cols = vc->vc_splash_data->splash_text_wi / vc->vc_font.width; + rows = vc->vc_splash_data->splash_text_he / vc->vc_font.height; + logo = 0; + } +#endif vc_resize(vc->vc_num, new_cols, new_rows); /* * We must always set the mode. The mode of the previous console @@ -842,6 +890,12 @@ } } +#ifdef CONFIG_BOOTSPLASH + if(vc->vc_splash_data && vc->vc_splash_data->splash_state) { + con_remap_def_color(vc->vc_num, vc->vc_splash_data->splash_color << 4 | vc->vc_splash_data->splash_fg_color); + } +#endif + if (vc->vc_num == display_fg && softback_buf) { int l = fbcon_softback_size / vc->vc_size_row; if (l > 5) @@ -947,6 +1001,13 @@ if (vt_cons[vc->vc_num]->vc_mode != KD_TEXT) return; +#ifdef CONFIG_BOOTSPLASH + if (info->splash_data) { + splash_putc(info->splash_data, vc, info, c, ypos, xpos); + return; + } +#endif + image.dx = xpos * vc->vc_font.width; image.dy = real_y(p, ypos) * vc->vc_font.height; image.width = vc->vc_font.width; @@ -1024,6 +1085,12 @@ if (info->cursor.rop == ROP_XOR) { info->cursor.enable = 0; info->cursor.rop = ROP_COPY; +#ifdef CONFIG_BOOTSPLASH + if (info->splash_data) { + splash_cursor(info->splash_data, info, &cursor); + break; + } +#endif info->fbops->fb_cursor(info, &cursor); } break; @@ -1100,6 +1167,13 @@ mask[i++] = 0xff; } info->cursor.rop = ROP_XOR; +#ifdef CONFIG_BOOTSPLASH + if (info->splash_data) { + splash_cursor(info->splash_data, info, &cursor); + vbl_cursor_cnt = CURSOR_DRAW_DELAY; + break; + } +#endif info->fbops->fb_cursor(info, &cursor); vbl_cursor_cnt = CURSOR_DRAW_DELAY; break; @@ -1454,6 +1528,10 @@ fbcon_softback_note(vc, t, count); if (logo_shown >= 0) goto redraw_up; +#ifdef CONFIG_BOOTSPLASH + if (info->splash_data) + goto redraw_up; +#endif switch (p->scrollmode) { case SCROLL_ACCEL: accel_bmove(vc, info, t + count, 0, t, 0, @@ -1521,6 +1599,10 @@ case SM_DOWN: if (count > vc->vc_rows) /* Maximum realistic size */ count = vc->vc_rows; +#ifdef CONFIG_BOOTSPLASH + if (info->splash_data) + goto redraw_down; +#endif switch (p->scrollmode) { case SCROLL_ACCEL: accel_bmove(vc, info, t, 0, t + count, 0, @@ -1646,6 +1728,15 @@ } return; } + +#ifdef CONFIG_BOOTSPLASH + if (info->splash_data && sy == dy && height == 1) { + /* must use slower redraw bmove to keep background pic intact */ + splash_bmove_redraw(info->splash_data, vc, info, sy, sx, dx, width); + return; + } +#endif + accel_bmove(vc, info, real_y(p, sy), sx, real_y(p, dy), dx, height, width); } @@ -1731,6 +1822,10 @@ struct display *p = &fb_display[vc->vc_num]; int i; +#ifdef CONFIG_BOOTSPLASH + splash_prepare(vc, info); +#endif + if (softback_top) { int l = fbcon_softback_size / vc->vc_size_row; if (softback_lines) @@ -1850,6 +1945,12 @@ fbcon_cursor(vc, blank ? CM_ERASE : CM_DRAW); if (!info->fbops->fb_blank) { +#ifdef CONFIG_BOOTSPLASH + if (info->splash_data) { + splash_blank(info->splash_data, vc, info, blank); + return 0; + } +#endif if (blank) { unsigned short oldc; u_int height; @@ -2026,9 +2127,16 @@ } if (resize) { + u32 xres = info->var.xres, yres = info->var.yres; /* reset wrap/pan */ info->var.xoffset = info->var.yoffset = p->yscroll = 0; - vc_resize(vc->vc_num, info->var.xres / w, info->var.yres / h); +#ifdef CONFIG_BOOTSPLASH + if (info->splash_data) { + xres = info->splash_data->splash_text_wi; + yres = info->splash_data->splash_text_he; + } +#endif + vc_resize(vc->vc_num, xres / w, yres / h); if (CON_IS_VISIBLE(vc) && softback_buf) { int l = fbcon_softback_size / vc->vc_size_row; if (l > 5) @@ -2223,7 +2331,44 @@ else palette_cmap.len = 16; palette_cmap.start = 0; - return fb_set_cmap(&palette_cmap, 1, info); + +#ifdef CONFIG_BOOTSPLASH + if (info->splash_data && info->fix.visual == FB_VISUAL_DIRECTCOLOR) { + + u16 red[256], green[256], blue[256]; + u32 col; + int minlen = min(min(info->var.red.length, info->var.green.length), info->var.blue.length); + int h; + + struct fb_cmap cmap = { + .start = 0, + .len = (1 << minlen), + .red = red, + .green = green, + .blue = blue, + .transp = NULL + }; + + for (i = 0; i < cmap.len; i++) { + red[i] = green[i] = blue[i] = (0xffff * i)/(cmap.len-1); + } + + h = fb_set_cmap(&cmap,1,info); + + for (j = i = 0; i < 16; i++) { + k = table[i]; + + col = ((vc->vc_palette[j++] >> (8-minlen)) << info->var.red.offset); + col |= ((vc->vc_palette[j++] >> (8-minlen)) << info->var.green.offset); + col |= ((vc->vc_palette[j++] >> (8-minlen)) << info->var.blue.offset); + + ((u32 *)info->pseudo_palette)[k] = col; + } + + return h; + } else +#endif + return fb_set_cmap(&palette_cmap, 1, info); } static u16 *fbcon_screen_pos(struct vc_data *vc, int offset) @@ -2527,6 +2672,11 @@ } for (i = first_fb_vc; i <= last_fb_vc; i++) con2fb_map[i] = info_idx; + +#ifdef CONFIG_BOOTSPLASH + splash_init(); +#endif + err = take_over_console(&fb_con, first_fb_vc, last_fb_vc, fbcon_is_default); if (err) {