Lines 79-84
Link Here
|
79 |
#include <asm/irq.h> |
79 |
#include <asm/irq.h> |
80 |
|
80 |
|
81 |
#include "fbcon.h" |
81 |
#include "fbcon.h" |
|
|
82 |
#include "../console/fbcondecor.h" |
82 |
|
83 |
|
83 |
#ifdef FBCONDEBUG |
84 |
#ifdef FBCONDEBUG |
84 |
# define DPRINTK(fmt, args...) printk(KERN_DEBUG "%s: " fmt, __func__ , ## args) |
85 |
# define DPRINTK(fmt, args...) printk(KERN_DEBUG "%s: " fmt, __func__ , ## args) |
Lines 94-100
enum {
Link Here
|
94 |
|
95 |
|
95 |
static struct display fb_display[MAX_NR_CONSOLES]; |
96 |
static struct display fb_display[MAX_NR_CONSOLES]; |
96 |
|
97 |
|
97 |
static signed char con2fb_map[MAX_NR_CONSOLES]; |
98 |
signed char con2fb_map[MAX_NR_CONSOLES]; |
98 |
static signed char con2fb_map_boot[MAX_NR_CONSOLES]; |
99 |
static signed char con2fb_map_boot[MAX_NR_CONSOLES]; |
99 |
|
100 |
|
100 |
static int logo_lines; |
101 |
static int logo_lines; |
Lines 282-288
static inline int fbcon_is_inactive(struct vc_data *vc, struct fb_info *info)
Link Here
|
282 |
!vt_force_oops_output(vc); |
283 |
!vt_force_oops_output(vc); |
283 |
} |
284 |
} |
284 |
|
285 |
|
285 |
static int get_color(struct vc_data *vc, struct fb_info *info, |
286 |
int get_color(struct vc_data *vc, struct fb_info *info, |
286 |
u16 c, int is_fg) |
287 |
u16 c, int is_fg) |
287 |
{ |
288 |
{ |
288 |
int depth = fb_get_color_depth(&info->var, &info->fix); |
289 |
int depth = fb_get_color_depth(&info->var, &info->fix); |
Lines 546-551
static int do_fbcon_takeover(int show_logo)
Link Here
|
546 |
info_idx = -1; |
547 |
info_idx = -1; |
547 |
} else { |
548 |
} else { |
548 |
fbcon_has_console_bind = 1; |
549 |
fbcon_has_console_bind = 1; |
|
|
550 |
#ifdef CONFIG_FB_CON_DECOR |
551 |
fbcon_decor_init(); |
552 |
#endif |
549 |
} |
553 |
} |
550 |
|
554 |
|
551 |
return err; |
555 |
return err; |
Lines 1005-1010
static const char *fbcon_startup(void)
Link Here
|
1005 |
rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres); |
1009 |
rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres); |
1006 |
cols /= vc->vc_font.width; |
1010 |
cols /= vc->vc_font.width; |
1007 |
rows /= vc->vc_font.height; |
1011 |
rows /= vc->vc_font.height; |
|
|
1012 |
|
1013 |
if (fbcon_decor_active(info, vc)) { |
1014 |
cols = vc->vc_decor.twidth / vc->vc_font.width; |
1015 |
rows = vc->vc_decor.theight / vc->vc_font.height; |
1016 |
} |
1017 |
|
1008 |
vc_resize(vc, cols, rows); |
1018 |
vc_resize(vc, cols, rows); |
1009 |
|
1019 |
|
1010 |
DPRINTK("mode: %s\n", info->fix.id); |
1020 |
DPRINTK("mode: %s\n", info->fix.id); |
Lines 1034-1040
static void fbcon_init(struct vc_data *vc, int init)
Link Here
|
1034 |
cap = info->flags; |
1044 |
cap = info->flags; |
1035 |
|
1045 |
|
1036 |
if (vc != svc || logo_shown == FBCON_LOGO_DONTSHOW || |
1046 |
if (vc != svc || logo_shown == FBCON_LOGO_DONTSHOW || |
1037 |
(info->fix.type == FB_TYPE_TEXT)) |
1047 |
(info->fix.type == FB_TYPE_TEXT) || fbcon_decor_active(info, vc)) |
1038 |
logo = 0; |
1048 |
logo = 0; |
1039 |
|
1049 |
|
1040 |
if (var_to_display(p, &info->var, info)) |
1050 |
if (var_to_display(p, &info->var, info)) |
Lines 1259-1264
static void fbcon_clear(struct vc_data *vc, int sy, int sx, int height,
Link Here
|
1259 |
fbcon_clear_margins(vc, 0); |
1269 |
fbcon_clear_margins(vc, 0); |
1260 |
} |
1270 |
} |
1261 |
|
1271 |
|
|
|
1272 |
if (fbcon_decor_active(info, vc)) { |
1273 |
fbcon_decor_clear(vc, info, sy, sx, height, width); |
1274 |
return; |
1275 |
} |
1276 |
|
1262 |
/* Split blits that cross physical y_wrap boundary */ |
1277 |
/* Split blits that cross physical y_wrap boundary */ |
1263 |
|
1278 |
|
1264 |
y_break = p->vrows - p->yscroll; |
1279 |
y_break = p->vrows - p->yscroll; |
Lines 1278-1287
static void fbcon_putcs(struct vc_data *vc, const unsigned short *s,
Link Here
|
1278 |
struct display *p = &fb_display[vc->vc_num]; |
1293 |
struct display *p = &fb_display[vc->vc_num]; |
1279 |
struct fbcon_ops *ops = info->fbcon_par; |
1294 |
struct fbcon_ops *ops = info->fbcon_par; |
1280 |
|
1295 |
|
1281 |
if (!fbcon_is_inactive(vc, info)) |
1296 |
if (!fbcon_is_inactive(vc, info)) { |
1282 |
ops->putcs(vc, info, s, count, real_y(p, ypos), xpos, |
1297 |
|
1283 |
get_color(vc, info, scr_readw(s), 1), |
1298 |
if (fbcon_decor_active(info, vc)) |
1284 |
get_color(vc, info, scr_readw(s), 0)); |
1299 |
fbcon_decor_putcs(vc, info, s, count, ypos, xpos); |
|
|
1300 |
else |
1301 |
ops->putcs(vc, info, s, count, real_y(p, ypos), xpos, |
1302 |
get_color(vc, info, scr_readw(s), 1), |
1303 |
get_color(vc, info, scr_readw(s), 0)); |
1304 |
} |
1285 |
} |
1305 |
} |
1286 |
|
1306 |
|
1287 |
static void fbcon_putc(struct vc_data *vc, int c, int ypos, int xpos) |
1307 |
static void fbcon_putc(struct vc_data *vc, int c, int ypos, int xpos) |
Lines 1297-1304
static void fbcon_clear_margins(struct vc_data *vc, int bottom_only)
Link Here
|
1297 |
struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; |
1317 |
struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; |
1298 |
struct fbcon_ops *ops = info->fbcon_par; |
1318 |
struct fbcon_ops *ops = info->fbcon_par; |
1299 |
|
1319 |
|
1300 |
if (!fbcon_is_inactive(vc, info)) |
1320 |
if (!fbcon_is_inactive(vc, info)) { |
1301 |
ops->clear_margins(vc, info, bottom_only); |
1321 |
if (fbcon_decor_active(info, vc)) |
|
|
1322 |
fbcon_decor_clear_margins(vc, info, bottom_only); |
1323 |
else |
1324 |
ops->clear_margins(vc, info, bottom_only); |
1325 |
} |
1302 |
} |
1326 |
} |
1303 |
|
1327 |
|
1304 |
static void fbcon_cursor(struct vc_data *vc, int mode) |
1328 |
static void fbcon_cursor(struct vc_data *vc, int mode) |
Lines 1819-1825
static int fbcon_scroll(struct vc_data *vc, int t, int b, int dir,
Link Here
|
1819 |
count = vc->vc_rows; |
1843 |
count = vc->vc_rows; |
1820 |
if (softback_top) |
1844 |
if (softback_top) |
1821 |
fbcon_softback_note(vc, t, count); |
1845 |
fbcon_softback_note(vc, t, count); |
1822 |
if (logo_shown >= 0) |
1846 |
if (logo_shown >= 0 || fbcon_decor_active(info, vc)) |
1823 |
goto redraw_up; |
1847 |
goto redraw_up; |
1824 |
switch (p->scrollmode) { |
1848 |
switch (p->scrollmode) { |
1825 |
case SCROLL_MOVE: |
1849 |
case SCROLL_MOVE: |
Lines 1912-1917
static int fbcon_scroll(struct vc_data *vc, int t, int b, int dir,
Link Here
|
1912 |
count = vc->vc_rows; |
1936 |
count = vc->vc_rows; |
1913 |
if (logo_shown >= 0) |
1937 |
if (logo_shown >= 0) |
1914 |
goto redraw_down; |
1938 |
goto redraw_down; |
|
|
1939 |
if (fbcon_decor_active(info, vc)) |
1940 |
goto redraw_down; |
1915 |
switch (p->scrollmode) { |
1941 |
switch (p->scrollmode) { |
1916 |
case SCROLL_MOVE: |
1942 |
case SCROLL_MOVE: |
1917 |
fbcon_redraw_blit(vc, info, p, b - 1, b - t - count, |
1943 |
fbcon_redraw_blit(vc, info, p, b - 1, b - t - count, |
Lines 2060-2065
static void fbcon_bmove_rec(struct vc_data *vc, struct display *p, int sy, int s
Link Here
|
2060 |
} |
2086 |
} |
2061 |
return; |
2087 |
return; |
2062 |
} |
2088 |
} |
|
|
2089 |
|
2090 |
if (fbcon_decor_active(info, vc) && sy == dy && height == 1) { |
2091 |
/* must use slower redraw bmove to keep background pic intact */ |
2092 |
fbcon_decor_bmove_redraw(vc, info, sy, sx, dx, width); |
2093 |
return; |
2094 |
} |
2095 |
|
2063 |
ops->bmove(vc, info, real_y(p, sy), sx, real_y(p, dy), dx, |
2096 |
ops->bmove(vc, info, real_y(p, sy), sx, real_y(p, dy), dx, |
2064 |
height, width); |
2097 |
height, width); |
2065 |
} |
2098 |
} |
Lines 2130-2137
static int fbcon_resize(struct vc_data *vc, unsigned int width,
Link Here
|
2130 |
var.yres = virt_h * virt_fh; |
2163 |
var.yres = virt_h * virt_fh; |
2131 |
x_diff = info->var.xres - var.xres; |
2164 |
x_diff = info->var.xres - var.xres; |
2132 |
y_diff = info->var.yres - var.yres; |
2165 |
y_diff = info->var.yres - var.yres; |
2133 |
if (x_diff < 0 || x_diff > virt_fw || |
2166 |
if ((x_diff < 0 || x_diff > virt_fw || |
2134 |
y_diff < 0 || y_diff > virt_fh) { |
2167 |
y_diff < 0 || y_diff > virt_fh) && !vc->vc_decor.state) { |
2135 |
const struct fb_videomode *mode; |
2168 |
const struct fb_videomode *mode; |
2136 |
|
2169 |
|
2137 |
DPRINTK("attempting resize %ix%i\n", var.xres, var.yres); |
2170 |
DPRINTK("attempting resize %ix%i\n", var.xres, var.yres); |
Lines 2167-2172
static int fbcon_switch(struct vc_data *vc)
Link Here
|
2167 |
|
2200 |
|
2168 |
info = registered_fb[con2fb_map[vc->vc_num]]; |
2201 |
info = registered_fb[con2fb_map[vc->vc_num]]; |
2169 |
ops = info->fbcon_par; |
2202 |
ops = info->fbcon_par; |
|
|
2203 |
prev_console = ops->currcon; |
2204 |
if (prev_console != -1) |
2205 |
old_info = registered_fb[con2fb_map[prev_console]]; |
2206 |
|
2207 |
#ifdef CONFIG_FB_CON_DECOR |
2208 |
if (!fbcon_decor_active_vc(vc) && info->fix.visual == FB_VISUAL_DIRECTCOLOR) { |
2209 |
struct vc_data *vc_curr = vc_cons[prev_console].d; |
2210 |
|
2211 |
if (vc_curr && fbcon_decor_active_vc(vc_curr)) { |
2212 |
// Clear the screen to avoid displaying funky colors |
2213 |
// during palette updates. |
2214 |
memset((u8 *)info->screen_base + info->fix.line_length * info->var.yoffset, |
2215 |
0, info->var.yres * info->fix.line_length); |
2216 |
} |
2217 |
} |
2218 |
#endif |
2170 |
|
2219 |
|
2171 |
if (softback_top) { |
2220 |
if (softback_top) { |
2172 |
if (softback_lines) |
2221 |
if (softback_lines) |
Lines 2185-2193
static int fbcon_switch(struct vc_data *vc)
Link Here
|
2185 |
logo_shown = FBCON_LOGO_CANSHOW; |
2234 |
logo_shown = FBCON_LOGO_CANSHOW; |
2186 |
} |
2235 |
} |
2187 |
|
2236 |
|
2188 |
prev_console = ops->currcon; |
|
|
2189 |
if (prev_console != -1) |
2190 |
old_info = registered_fb[con2fb_map[prev_console]]; |
2191 |
/* |
2237 |
/* |
2192 |
* FIXME: If we have multiple fbdev's loaded, we need to |
2238 |
* FIXME: If we have multiple fbdev's loaded, we need to |
2193 |
* update all info->currcon. Perhaps, we can place this |
2239 |
* update all info->currcon. Perhaps, we can place this |
Lines 2231-2236
static int fbcon_switch(struct vc_data *vc)
Link Here
|
2231 |
fbcon_del_cursor_timer(old_info); |
2277 |
fbcon_del_cursor_timer(old_info); |
2232 |
} |
2278 |
} |
2233 |
|
2279 |
|
|
|
2280 |
if (fbcon_decor_active_vc(vc)) { |
2281 |
struct vc_data *vc_curr = vc_cons[prev_console].d; |
2282 |
|
2283 |
if (!vc_curr->vc_decor.theme || |
2284 |
strcmp(vc->vc_decor.theme, vc_curr->vc_decor.theme) || |
2285 |
(fbcon_decor_active_nores(info, vc_curr) && |
2286 |
!fbcon_decor_active(info, vc_curr))) { |
2287 |
fbcon_decor_disable(vc, 0); |
2288 |
fbcon_decor_call_helper("modechange", vc->vc_num); |
2289 |
} |
2290 |
} |
2291 |
|
2234 |
if (fbcon_is_inactive(vc, info) || |
2292 |
if (fbcon_is_inactive(vc, info) || |
2235 |
ops->blank_state != FB_BLANK_UNBLANK) |
2293 |
ops->blank_state != FB_BLANK_UNBLANK) |
2236 |
fbcon_del_cursor_timer(info); |
2294 |
fbcon_del_cursor_timer(info); |
Lines 2339-2353
static int fbcon_blank(struct vc_data *vc, int blank, int mode_switch)
Link Here
|
2339 |
} |
2397 |
} |
2340 |
} |
2398 |
} |
2341 |
|
2399 |
|
2342 |
if (!fbcon_is_inactive(vc, info)) { |
2400 |
if (!fbcon_is_inactive(vc, info)) { |
2343 |
if (ops->blank_state != blank) { |
2401 |
if (ops->blank_state != blank) { |
2344 |
ops->blank_state = blank; |
2402 |
ops->blank_state = blank; |
2345 |
fbcon_cursor(vc, blank ? CM_ERASE : CM_DRAW); |
2403 |
fbcon_cursor(vc, blank ? CM_ERASE : CM_DRAW); |
2346 |
ops->cursor_flash = (!blank); |
2404 |
ops->cursor_flash = (!blank); |
2347 |
|
2405 |
|
2348 |
if (!(info->flags & FBINFO_MISC_USEREVENT)) |
2406 |
if (!(info->flags & FBINFO_MISC_USEREVENT)) { |
2349 |
if (fb_blank(info, blank)) |
2407 |
if (fb_blank(info, blank)) { |
2350 |
fbcon_generic_blank(vc, info, blank); |
2408 |
if (fbcon_decor_active(info, vc)) |
|
|
2409 |
fbcon_decor_blank(vc, info, blank); |
2410 |
else |
2411 |
fbcon_generic_blank(vc, info, blank); |
2412 |
} |
2413 |
} |
2351 |
} |
2414 |
} |
2352 |
|
2415 |
|
2353 |
if (!blank) |
2416 |
if (!blank) |
Lines 2522-2534
static int fbcon_do_set_font(struct vc_data *vc, int w, int h,
Link Here
|
2522 |
} |
2585 |
} |
2523 |
|
2586 |
|
2524 |
if (resize) { |
2587 |
if (resize) { |
|
|
2588 |
/* reset wrap/pan */ |
2525 |
int cols, rows; |
2589 |
int cols, rows; |
2526 |
|
2590 |
|
2527 |
cols = FBCON_SWAP(ops->rotate, info->var.xres, info->var.yres); |
2591 |
cols = FBCON_SWAP(ops->rotate, info->var.xres, info->var.yres); |
2528 |
rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres); |
2592 |
rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres); |
|
|
2593 |
|
2594 |
if (fbcon_decor_active(info, vc)) { |
2595 |
info->var.xoffset = info->var.yoffset = p->yscroll = 0; |
2596 |
cols = vc->vc_decor.twidth; |
2597 |
rows = vc->vc_decor.theight; |
2598 |
} |
2529 |
cols /= w; |
2599 |
cols /= w; |
2530 |
rows /= h; |
2600 |
rows /= h; |
|
|
2601 |
|
2531 |
vc_resize(vc, cols, rows); |
2602 |
vc_resize(vc, cols, rows); |
|
|
2603 |
|
2532 |
if (con_is_visible(vc) && softback_buf) |
2604 |
if (con_is_visible(vc) && softback_buf) |
2533 |
fbcon_update_softback(vc); |
2605 |
fbcon_update_softback(vc); |
2534 |
} else if (con_is_visible(vc) |
2606 |
} else if (con_is_visible(vc) |
Lines 2657-2663
static void fbcon_set_palette(struct vc_data *vc, const unsigned char *table)
Link Here
|
2657 |
int i, j, k, depth; |
2729 |
int i, j, k, depth; |
2658 |
u8 val; |
2730 |
u8 val; |
2659 |
|
2731 |
|
2660 |
if (fbcon_is_inactive(vc, info)) |
2732 |
if (fbcon_is_inactive(vc, info) |
|
|
2733 |
#ifdef CONFIG_FB_CON_DECOR |
2734 |
|| vc->vc_num != fg_console |
2735 |
#endif |
2736 |
) |
2661 |
return; |
2737 |
return; |
2662 |
|
2738 |
|
2663 |
if (!con_is_visible(vc)) |
2739 |
if (!con_is_visible(vc)) |
Lines 2683-2689
static void fbcon_set_palette(struct vc_data *vc, const unsigned char *table)
Link Here
|
2683 |
} else |
2759 |
} else |
2684 |
fb_copy_cmap(fb_default_cmap(1 << depth), &palette_cmap); |
2760 |
fb_copy_cmap(fb_default_cmap(1 << depth), &palette_cmap); |
2685 |
|
2761 |
|
2686 |
fb_set_cmap(&palette_cmap, info); |
2762 |
if (fbcon_decor_active(info, vc_cons[fg_console].d) && |
|
|
2763 |
info->fix.visual == FB_VISUAL_DIRECTCOLOR) { |
2764 |
|
2765 |
u16 *red, *green, *blue; |
2766 |
int minlen = min(min(info->var.red.length, info->var.green.length), |
2767 |
info->var.blue.length); |
2768 |
|
2769 |
struct fb_cmap cmap = { |
2770 |
.start = 0, |
2771 |
.len = (1 << minlen), |
2772 |
.red = NULL, |
2773 |
.green = NULL, |
2774 |
.blue = NULL, |
2775 |
.transp = NULL |
2776 |
}; |
2777 |
|
2778 |
red = kmalloc(256 * sizeof(u16) * 3, GFP_KERNEL); |
2779 |
|
2780 |
if (!red) |
2781 |
goto out; |
2782 |
|
2783 |
green = red + 256; |
2784 |
blue = green + 256; |
2785 |
cmap.red = red; |
2786 |
cmap.green = green; |
2787 |
cmap.blue = blue; |
2788 |
|
2789 |
for (i = 0; i < cmap.len; i++) |
2790 |
red[i] = green[i] = blue[i] = (0xffff * i)/(cmap.len-1); |
2791 |
|
2792 |
fb_set_cmap(&cmap, info); |
2793 |
fbcon_decor_fix_pseudo_pal(info, vc_cons[fg_console].d); |
2794 |
kfree(red); |
2795 |
|
2796 |
return; |
2797 |
|
2798 |
} else if (fbcon_decor_active(info, vc_cons[fg_console].d) && |
2799 |
info->var.bits_per_pixel == 8 && info->bgdecor.cmap.red != NULL) |
2800 |
fb_set_cmap(&info->bgdecor.cmap, info); |
2801 |
|
2802 |
out: fb_set_cmap(&palette_cmap, info); |
2687 |
} |
2803 |
} |
2688 |
|
2804 |
|
2689 |
static u16 *fbcon_screen_pos(struct vc_data *vc, int offset) |
2805 |
static u16 *fbcon_screen_pos(struct vc_data *vc, int offset) |
Lines 2908-2914
static void fbcon_modechanged(struct fb_info *info)
Link Here
|
2908 |
rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres); |
3024 |
rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres); |
2909 |
cols /= vc->vc_font.width; |
3025 |
cols /= vc->vc_font.width; |
2910 |
rows /= vc->vc_font.height; |
3026 |
rows /= vc->vc_font.height; |
2911 |
vc_resize(vc, cols, rows); |
3027 |
|
|
|
3028 |
if (!fbcon_decor_active_nores(info, vc)) { |
3029 |
vc_resize(vc, cols, rows); |
3030 |
} else { |
3031 |
fbcon_decor_disable(vc, 0); |
3032 |
fbcon_decor_call_helper("modechange", vc->vc_num); |
3033 |
} |
3034 |
|
2912 |
updatescrollmode(p, info, vc); |
3035 |
updatescrollmode(p, info, vc); |
2913 |
scrollback_max = 0; |
3036 |
scrollback_max = 0; |
2914 |
scrollback_current = 0; |
3037 |
scrollback_current = 0; |
Lines 2953-2959
static void fbcon_set_all_vcs(struct fb_info *info)
Link Here
|
2953 |
rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres); |
3076 |
rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres); |
2954 |
cols /= vc->vc_font.width; |
3077 |
cols /= vc->vc_font.width; |
2955 |
rows /= vc->vc_font.height; |
3078 |
rows /= vc->vc_font.height; |
2956 |
vc_resize(vc, cols, rows); |
3079 |
if (!fbcon_decor_active_nores(info, vc)) |
|
|
3080 |
vc_resize(vc, cols, rows); |
2957 |
} |
3081 |
} |
2958 |
|
3082 |
|
2959 |
if (fg != -1) |
3083 |
if (fg != -1) |
Lines 3594-3599
static void fbcon_exit(void)
Link Here
|
3594 |
} |
3718 |
} |
3595 |
} |
3719 |
} |
3596 |
|
3720 |
|
|
|
3721 |
fbcon_decor_exit(); |
3597 |
fbcon_has_exited = 1; |
3722 |
fbcon_has_exited = 1; |
3598 |
} |
3723 |
} |
3599 |
|
3724 |
|