Lines 80-85
Link Here
|
80 |
#include <asm/irq.h> |
80 |
#include <asm/irq.h> |
81 |
|
81 |
|
82 |
#include "fbcon.h" |
82 |
#include "fbcon.h" |
|
|
83 |
#include "../../console/fbcondecor.h" |
83 |
|
84 |
|
84 |
#ifdef FBCONDEBUG |
85 |
#ifdef FBCONDEBUG |
85 |
# define DPRINTK(fmt, args...) printk(KERN_DEBUG "%s: " fmt, __func__ , ## args) |
86 |
# define DPRINTK(fmt, args...) printk(KERN_DEBUG "%s: " fmt, __func__ , ## args) |
Lines 95-101
enum {
Link Here
|
95 |
|
96 |
|
96 |
static struct display fb_display[MAX_NR_CONSOLES]; |
97 |
static struct display fb_display[MAX_NR_CONSOLES]; |
97 |
|
98 |
|
98 |
static signed char con2fb_map[MAX_NR_CONSOLES]; |
99 |
signed char con2fb_map[MAX_NR_CONSOLES]; |
99 |
static signed char con2fb_map_boot[MAX_NR_CONSOLES]; |
100 |
static signed char con2fb_map_boot[MAX_NR_CONSOLES]; |
100 |
|
101 |
|
101 |
static int logo_lines; |
102 |
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 551-556
static int do_fbcon_takeover(int show_logo)
Link Here
|
551 |
info_idx = -1; |
552 |
info_idx = -1; |
552 |
} else { |
553 |
} else { |
553 |
fbcon_has_console_bind = 1; |
554 |
fbcon_has_console_bind = 1; |
|
|
555 |
#ifdef CONFIG_FB_CON_DECOR |
556 |
fbcon_decor_init(); |
557 |
#endif |
554 |
} |
558 |
} |
555 |
|
559 |
|
556 |
return err; |
560 |
return err; |
Lines 1013-1018
static const char *fbcon_startup(void)
Link Here
|
1013 |
rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres); |
1017 |
rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres); |
1014 |
cols /= vc->vc_font.width; |
1018 |
cols /= vc->vc_font.width; |
1015 |
rows /= vc->vc_font.height; |
1019 |
rows /= vc->vc_font.height; |
|
|
1020 |
|
1021 |
if (fbcon_decor_active(info, vc)) { |
1022 |
cols = vc->vc_decor.twidth / vc->vc_font.width; |
1023 |
rows = vc->vc_decor.theight / vc->vc_font.height; |
1024 |
} |
1025 |
|
1016 |
vc_resize(vc, cols, rows); |
1026 |
vc_resize(vc, cols, rows); |
1017 |
|
1027 |
|
1018 |
DPRINTK("mode: %s\n", info->fix.id); |
1028 |
DPRINTK("mode: %s\n", info->fix.id); |
Lines 1042-1048
static void fbcon_init(struct vc_data *vc, int init)
Link Here
|
1042 |
cap = info->flags; |
1052 |
cap = info->flags; |
1043 |
|
1053 |
|
1044 |
if (vc != svc || logo_shown == FBCON_LOGO_DONTSHOW || |
1054 |
if (vc != svc || logo_shown == FBCON_LOGO_DONTSHOW || |
1045 |
(info->fix.type == FB_TYPE_TEXT)) |
1055 |
(info->fix.type == FB_TYPE_TEXT) || fbcon_decor_active(info, vc)) |
1046 |
logo = 0; |
1056 |
logo = 0; |
1047 |
|
1057 |
|
1048 |
if (var_to_display(p, &info->var, info)) |
1058 |
if (var_to_display(p, &info->var, info)) |
Lines 1275-1280
static void fbcon_clear(struct vc_data *vc, int sy, int sx, int height,
Link Here
|
1275 |
fbcon_clear_margins(vc, 0); |
1285 |
fbcon_clear_margins(vc, 0); |
1276 |
} |
1286 |
} |
1277 |
|
1287 |
|
|
|
1288 |
if (fbcon_decor_active(info, vc)) { |
1289 |
fbcon_decor_clear(vc, info, sy, sx, height, width); |
1290 |
return; |
1291 |
} |
1292 |
|
1278 |
/* Split blits that cross physical y_wrap boundary */ |
1293 |
/* Split blits that cross physical y_wrap boundary */ |
1279 |
|
1294 |
|
1280 |
y_break = p->vrows - p->yscroll; |
1295 |
y_break = p->vrows - p->yscroll; |
Lines 1294-1303
static void fbcon_putcs(struct vc_data *vc, const unsigned short *s,
Link Here
|
1294 |
struct display *p = &fb_display[vc->vc_num]; |
1309 |
struct display *p = &fb_display[vc->vc_num]; |
1295 |
struct fbcon_ops *ops = info->fbcon_par; |
1310 |
struct fbcon_ops *ops = info->fbcon_par; |
1296 |
|
1311 |
|
1297 |
if (!fbcon_is_inactive(vc, info)) |
1312 |
if (!fbcon_is_inactive(vc, info)) { |
1298 |
ops->putcs(vc, info, s, count, real_y(p, ypos), xpos, |
1313 |
|
1299 |
get_color(vc, info, scr_readw(s), 1), |
1314 |
if (fbcon_decor_active(info, vc)) |
1300 |
get_color(vc, info, scr_readw(s), 0)); |
1315 |
fbcon_decor_putcs(vc, info, s, count, ypos, xpos); |
|
|
1316 |
else |
1317 |
ops->putcs(vc, info, s, count, real_y(p, ypos), xpos, |
1318 |
get_color(vc, info, scr_readw(s), 1), |
1319 |
get_color(vc, info, scr_readw(s), 0)); |
1320 |
} |
1301 |
} |
1321 |
} |
1302 |
|
1322 |
|
1303 |
static void fbcon_putc(struct vc_data *vc, int c, int ypos, int xpos) |
1323 |
static void fbcon_putc(struct vc_data *vc, int c, int ypos, int xpos) |
Lines 1313-1320
static void fbcon_clear_margins(struct vc_data *vc, int bottom_only)
Link Here
|
1313 |
struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; |
1333 |
struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; |
1314 |
struct fbcon_ops *ops = info->fbcon_par; |
1334 |
struct fbcon_ops *ops = info->fbcon_par; |
1315 |
|
1335 |
|
1316 |
if (!fbcon_is_inactive(vc, info)) |
1336 |
if (!fbcon_is_inactive(vc, info)) { |
1317 |
ops->clear_margins(vc, info, margin_color, bottom_only); |
1337 |
if (fbcon_decor_active(info, vc)) |
|
|
1338 |
fbcon_decor_clear_margins(vc, info, bottom_only); |
1339 |
else |
1340 |
ops->clear_margins(vc, info, margin_color, bottom_only); |
1341 |
} |
1318 |
} |
1342 |
} |
1319 |
|
1343 |
|
1320 |
static void fbcon_cursor(struct vc_data *vc, int mode) |
1344 |
static void fbcon_cursor(struct vc_data *vc, int mode) |
Lines 1835-1841
static bool fbcon_scroll(struct vc_data *vc, unsigned int t, unsigned int b,
Link Here
|
1835 |
count = vc->vc_rows; |
1859 |
count = vc->vc_rows; |
1836 |
if (softback_top) |
1860 |
if (softback_top) |
1837 |
fbcon_softback_note(vc, t, count); |
1861 |
fbcon_softback_note(vc, t, count); |
1838 |
if (logo_shown >= 0) |
1862 |
if (logo_shown >= 0 || fbcon_decor_active(info, vc)) |
1839 |
goto redraw_up; |
1863 |
goto redraw_up; |
1840 |
switch (p->scrollmode) { |
1864 |
switch (p->scrollmode) { |
1841 |
case SCROLL_MOVE: |
1865 |
case SCROLL_MOVE: |
Lines 1928-1933
static bool fbcon_scroll(struct vc_data *vc, unsigned int t, unsigned int b,
Link Here
|
1928 |
count = vc->vc_rows; |
1952 |
count = vc->vc_rows; |
1929 |
if (logo_shown >= 0) |
1953 |
if (logo_shown >= 0) |
1930 |
goto redraw_down; |
1954 |
goto redraw_down; |
|
|
1955 |
if (fbcon_decor_active(info, vc)) |
1956 |
goto redraw_down; |
1931 |
switch (p->scrollmode) { |
1957 |
switch (p->scrollmode) { |
1932 |
case SCROLL_MOVE: |
1958 |
case SCROLL_MOVE: |
1933 |
fbcon_redraw_blit(vc, info, p, b - 1, b - t - count, |
1959 |
fbcon_redraw_blit(vc, info, p, b - 1, b - t - count, |
Lines 2076-2081
static void fbcon_bmove_rec(struct vc_data *vc, struct display *p, int sy, int s
Link Here
|
2076 |
} |
2102 |
} |
2077 |
return; |
2103 |
return; |
2078 |
} |
2104 |
} |
|
|
2105 |
|
2106 |
if (fbcon_decor_active(info, vc) && sy == dy && height == 1) { |
2107 |
/* must use slower redraw bmove to keep background pic intact */ |
2108 |
fbcon_decor_bmove_redraw(vc, info, sy, sx, dx, width); |
2109 |
return; |
2110 |
} |
2111 |
|
2079 |
ops->bmove(vc, info, real_y(p, sy), sx, real_y(p, dy), dx, |
2112 |
ops->bmove(vc, info, real_y(p, sy), sx, real_y(p, dy), dx, |
2080 |
height, width); |
2113 |
height, width); |
2081 |
} |
2114 |
} |
Lines 2146-2153
static int fbcon_resize(struct vc_data *vc, unsigned int width,
Link Here
|
2146 |
var.yres = virt_h * virt_fh; |
2179 |
var.yres = virt_h * virt_fh; |
2147 |
x_diff = info->var.xres - var.xres; |
2180 |
x_diff = info->var.xres - var.xres; |
2148 |
y_diff = info->var.yres - var.yres; |
2181 |
y_diff = info->var.yres - var.yres; |
2149 |
if (x_diff < 0 || x_diff > virt_fw || |
2182 |
if ((x_diff < 0 || x_diff > virt_fw || |
2150 |
y_diff < 0 || y_diff > virt_fh) { |
2183 |
y_diff < 0 || y_diff > virt_fh) && !vc->vc_decor.state) { |
2151 |
const struct fb_videomode *mode; |
2184 |
const struct fb_videomode *mode; |
2152 |
|
2185 |
|
2153 |
DPRINTK("attempting resize %ix%i\n", var.xres, var.yres); |
2186 |
DPRINTK("attempting resize %ix%i\n", var.xres, var.yres); |
Lines 2183-2188
static int fbcon_switch(struct vc_data *vc)
Link Here
|
2183 |
|
2216 |
|
2184 |
info = registered_fb[con2fb_map[vc->vc_num]]; |
2217 |
info = registered_fb[con2fb_map[vc->vc_num]]; |
2185 |
ops = info->fbcon_par; |
2218 |
ops = info->fbcon_par; |
|
|
2219 |
prev_console = ops->currcon; |
2220 |
if (prev_console != -1) |
2221 |
old_info = registered_fb[con2fb_map[prev_console]]; |
2222 |
|
2223 |
#ifdef CONFIG_FB_CON_DECOR |
2224 |
if (!fbcon_decor_active_vc(vc) && info->fix.visual == FB_VISUAL_DIRECTCOLOR) { |
2225 |
struct vc_data *vc_curr = vc_cons[prev_console].d; |
2226 |
|
2227 |
if (vc_curr && fbcon_decor_active_vc(vc_curr)) { |
2228 |
// Clear the screen to avoid displaying funky colors |
2229 |
// during palette updates. |
2230 |
memset((u8 *)info->screen_base + info->fix.line_length * info->var.yoffset, |
2231 |
0, info->var.yres * info->fix.line_length); |
2232 |
} |
2233 |
} |
2234 |
#endif |
2186 |
|
2235 |
|
2187 |
if (softback_top) { |
2236 |
if (softback_top) { |
2188 |
if (softback_lines) |
2237 |
if (softback_lines) |
Lines 2201-2209
static int fbcon_switch(struct vc_data *vc)
Link Here
|
2201 |
logo_shown = FBCON_LOGO_CANSHOW; |
2250 |
logo_shown = FBCON_LOGO_CANSHOW; |
2202 |
} |
2251 |
} |
2203 |
|
2252 |
|
2204 |
prev_console = ops->currcon; |
|
|
2205 |
if (prev_console != -1) |
2206 |
old_info = registered_fb[con2fb_map[prev_console]]; |
2207 |
/* |
2253 |
/* |
2208 |
* FIXME: If we have multiple fbdev's loaded, we need to |
2254 |
* FIXME: If we have multiple fbdev's loaded, we need to |
2209 |
* update all info->currcon. Perhaps, we can place this |
2255 |
* update all info->currcon. Perhaps, we can place this |
Lines 2247-2252
static int fbcon_switch(struct vc_data *vc)
Link Here
|
2247 |
fbcon_del_cursor_timer(old_info); |
2293 |
fbcon_del_cursor_timer(old_info); |
2248 |
} |
2294 |
} |
2249 |
|
2295 |
|
|
|
2296 |
if (fbcon_decor_active_vc(vc)) { |
2297 |
struct vc_data *vc_curr = vc_cons[prev_console].d; |
2298 |
|
2299 |
if (!vc_curr->vc_decor.theme || |
2300 |
strcmp(vc->vc_decor.theme, vc_curr->vc_decor.theme) || |
2301 |
(fbcon_decor_active_nores(info, vc_curr) && |
2302 |
!fbcon_decor_active(info, vc_curr))) { |
2303 |
fbcon_decor_disable(vc, 0); |
2304 |
fbcon_decor_call_helper("modechange", vc->vc_num); |
2305 |
} |
2306 |
} |
2307 |
|
2250 |
if (fbcon_is_inactive(vc, info) || |
2308 |
if (fbcon_is_inactive(vc, info) || |
2251 |
ops->blank_state != FB_BLANK_UNBLANK) |
2309 |
ops->blank_state != FB_BLANK_UNBLANK) |
2252 |
fbcon_del_cursor_timer(info); |
2310 |
fbcon_del_cursor_timer(info); |
Lines 2355-2369
static int fbcon_blank(struct vc_data *vc, int blank, int mode_switch)
Link Here
|
2355 |
} |
2413 |
} |
2356 |
} |
2414 |
} |
2357 |
|
2415 |
|
2358 |
if (!fbcon_is_inactive(vc, info)) { |
2416 |
if (!fbcon_is_inactive(vc, info)) { |
2359 |
if (ops->blank_state != blank) { |
2417 |
if (ops->blank_state != blank) { |
2360 |
ops->blank_state = blank; |
2418 |
ops->blank_state = blank; |
2361 |
fbcon_cursor(vc, blank ? CM_ERASE : CM_DRAW); |
2419 |
fbcon_cursor(vc, blank ? CM_ERASE : CM_DRAW); |
2362 |
ops->cursor_flash = (!blank); |
2420 |
ops->cursor_flash = (!blank); |
2363 |
|
2421 |
|
2364 |
if (!(info->flags & FBINFO_MISC_USEREVENT)) |
2422 |
if (!(info->flags & FBINFO_MISC_USEREVENT)) { |
2365 |
if (fb_blank(info, blank)) |
2423 |
if (fb_blank(info, blank)) { |
2366 |
fbcon_generic_blank(vc, info, blank); |
2424 |
if (fbcon_decor_active(info, vc)) |
|
|
2425 |
fbcon_decor_blank(vc, info, blank); |
2426 |
else |
2427 |
fbcon_generic_blank(vc, info, blank); |
2428 |
} |
2429 |
} |
2367 |
} |
2430 |
} |
2368 |
|
2431 |
|
2369 |
if (!blank) |
2432 |
if (!blank) |
Lines 2546-2558
static int fbcon_do_set_font(struct vc_data *vc, int w, int h,
Link Here
|
2546 |
set_vc_hi_font(vc, true); |
2609 |
set_vc_hi_font(vc, true); |
2547 |
|
2610 |
|
2548 |
if (resize) { |
2611 |
if (resize) { |
|
|
2612 |
/* reset wrap/pan */ |
2549 |
int cols, rows; |
2613 |
int cols, rows; |
2550 |
|
2614 |
|
2551 |
cols = FBCON_SWAP(ops->rotate, info->var.xres, info->var.yres); |
2615 |
cols = FBCON_SWAP(ops->rotate, info->var.xres, info->var.yres); |
2552 |
rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres); |
2616 |
rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres); |
|
|
2617 |
|
2618 |
if (fbcon_decor_active(info, vc)) { |
2619 |
info->var.xoffset = info->var.yoffset = p->yscroll = 0; |
2620 |
cols = vc->vc_decor.twidth; |
2621 |
rows = vc->vc_decor.theight; |
2622 |
} |
2553 |
cols /= w; |
2623 |
cols /= w; |
2554 |
rows /= h; |
2624 |
rows /= h; |
|
|
2625 |
|
2555 |
vc_resize(vc, cols, rows); |
2626 |
vc_resize(vc, cols, rows); |
|
|
2627 |
|
2556 |
if (con_is_visible(vc) && softback_buf) |
2628 |
if (con_is_visible(vc) && softback_buf) |
2557 |
fbcon_update_softback(vc); |
2629 |
fbcon_update_softback(vc); |
2558 |
} else if (con_is_visible(vc) |
2630 |
} else if (con_is_visible(vc) |
Lines 2681-2687
static void fbcon_set_palette(struct vc_data *vc, const unsigned char *table)
Link Here
|
2681 |
int i, j, k, depth; |
2753 |
int i, j, k, depth; |
2682 |
u8 val; |
2754 |
u8 val; |
2683 |
|
2755 |
|
2684 |
if (fbcon_is_inactive(vc, info)) |
2756 |
if (fbcon_is_inactive(vc, info) |
|
|
2757 |
#ifdef CONFIG_FB_CON_DECOR |
2758 |
|| vc->vc_num != fg_console |
2759 |
#endif |
2760 |
) |
2685 |
return; |
2761 |
return; |
2686 |
|
2762 |
|
2687 |
if (!con_is_visible(vc)) |
2763 |
if (!con_is_visible(vc)) |
Lines 2707-2713
static void fbcon_set_palette(struct vc_data *vc, const unsigned char *table)
Link Here
|
2707 |
} else |
2783 |
} else |
2708 |
fb_copy_cmap(fb_default_cmap(1 << depth), &palette_cmap); |
2784 |
fb_copy_cmap(fb_default_cmap(1 << depth), &palette_cmap); |
2709 |
|
2785 |
|
2710 |
fb_set_cmap(&palette_cmap, info); |
2786 |
if (fbcon_decor_active(info, vc_cons[fg_console].d) && |
|
|
2787 |
info->fix.visual == FB_VISUAL_DIRECTCOLOR) { |
2788 |
|
2789 |
u16 *red, *green, *blue; |
2790 |
int minlen = min(min(info->var.red.length, info->var.green.length), |
2791 |
info->var.blue.length); |
2792 |
|
2793 |
struct fb_cmap cmap = { |
2794 |
.start = 0, |
2795 |
.len = (1 << minlen), |
2796 |
.red = NULL, |
2797 |
.green = NULL, |
2798 |
.blue = NULL, |
2799 |
.transp = NULL |
2800 |
}; |
2801 |
|
2802 |
red = kmalloc(256 * sizeof(u16) * 3, GFP_KERNEL); |
2803 |
|
2804 |
if (!red) |
2805 |
goto out; |
2806 |
|
2807 |
green = red + 256; |
2808 |
blue = green + 256; |
2809 |
cmap.red = red; |
2810 |
cmap.green = green; |
2811 |
cmap.blue = blue; |
2812 |
|
2813 |
for (i = 0; i < cmap.len; i++) |
2814 |
red[i] = green[i] = blue[i] = (0xffff * i)/(cmap.len-1); |
2815 |
|
2816 |
fb_set_cmap(&cmap, info); |
2817 |
fbcon_decor_fix_pseudo_pal(info, vc_cons[fg_console].d); |
2818 |
kfree(red); |
2819 |
|
2820 |
return; |
2821 |
|
2822 |
} else if (fbcon_decor_active(info, vc_cons[fg_console].d) && |
2823 |
info->var.bits_per_pixel == 8 && info->bgdecor.cmap.red != NULL) |
2824 |
fb_set_cmap(&info->bgdecor.cmap, info); |
2825 |
|
2826 |
out: fb_set_cmap(&palette_cmap, info); |
2711 |
} |
2827 |
} |
2712 |
|
2828 |
|
2713 |
static u16 *fbcon_screen_pos(struct vc_data *vc, int offset) |
2829 |
static u16 *fbcon_screen_pos(struct vc_data *vc, int offset) |
Lines 2932-2938
static void fbcon_modechanged(struct fb_info *info)
Link Here
|
2932 |
rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres); |
3048 |
rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres); |
2933 |
cols /= vc->vc_font.width; |
3049 |
cols /= vc->vc_font.width; |
2934 |
rows /= vc->vc_font.height; |
3050 |
rows /= vc->vc_font.height; |
2935 |
vc_resize(vc, cols, rows); |
3051 |
|
|
|
3052 |
if (!fbcon_decor_active_nores(info, vc)) { |
3053 |
vc_resize(vc, cols, rows); |
3054 |
} else { |
3055 |
fbcon_decor_disable(vc, 0); |
3056 |
fbcon_decor_call_helper("modechange", vc->vc_num); |
3057 |
} |
3058 |
|
2936 |
updatescrollmode(p, info, vc); |
3059 |
updatescrollmode(p, info, vc); |
2937 |
scrollback_max = 0; |
3060 |
scrollback_max = 0; |
2938 |
scrollback_current = 0; |
3061 |
scrollback_current = 0; |
Lines 2977-2983
static void fbcon_set_all_vcs(struct fb_info *info)
Link Here
|
2977 |
rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres); |
3100 |
rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres); |
2978 |
cols /= vc->vc_font.width; |
3101 |
cols /= vc->vc_font.width; |
2979 |
rows /= vc->vc_font.height; |
3102 |
rows /= vc->vc_font.height; |
2980 |
vc_resize(vc, cols, rows); |
3103 |
if (!fbcon_decor_active_nores(info, vc)) |
|
|
3104 |
vc_resize(vc, cols, rows); |
2981 |
} |
3105 |
} |
2982 |
|
3106 |
|
2983 |
if (fg != -1) |
3107 |
if (fg != -1) |
Lines 3618-3623
static void fbcon_exit(void)
Link Here
|
3618 |
} |
3742 |
} |
3619 |
} |
3743 |
} |
3620 |
|
3744 |
|
|
|
3745 |
fbcon_decor_exit(); |
3621 |
fbcon_has_exited = 1; |
3746 |
fbcon_has_exited = 1; |
3622 |
} |
3747 |
} |
3623 |
|
3748 |
|