Lines Matching full:vc
173 #define advance_row(p, delta) (unsigned short *)((unsigned long)(p) + (delta) * vc->vc_size_row)
183 static void fbcon_clear_margins(struct vc_data *vc, int bottom_only);
184 static void fbcon_set_palette(struct vc_data *vc, const unsigned char *table);
191 static void fbcon_redraw_move(struct vc_data *vc, struct fbcon_display *p,
235 struct vc_data *vc; in fbcon_rotate_all() local
243 vc = vc_cons[i].d; in fbcon_rotate_all()
244 if (!vc || vc->vc_mode != KD_TEXT || in fbcon_rotate_all()
248 p = &fb_display[vc->vc_num]; in fbcon_rotate_all()
285 static inline bool fbcon_is_active(struct vc_data *vc, struct fb_info *info) in fbcon_is_active() argument
290 vc->vc_mode == KD_TEXT && !ops->graphics && !fbcon_skip_panic(info); in fbcon_is_active()
293 static int get_color(struct vc_data *vc, struct fb_info *info, in get_color() argument
300 unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff; in get_color()
302 c = vc->vc_video_erase_char & charmask; in get_color()
306 color = (is_fg) ? attr_fgcol((vc->vc_hi_font_mask) ? 9 : 8, c) in get_color()
307 : attr_bgcol((vc->vc_hi_font_mask) ? 13 : 12, c); in get_color()
360 static int get_fg_color(struct vc_data *vc, struct fb_info *info, u16 c) in get_fg_color() argument
362 return get_color(vc, info, c, true); in get_fg_color()
365 static int get_bg_color(struct vc_data *vc, struct fb_info *info, u16 c) in get_bg_color() argument
367 return get_color(vc, info, c, false); in get_bg_color()
374 struct vc_data *vc = NULL; in fb_flashcursor() local
390 vc = vc_cons[ops->currcon].d; in fb_flashcursor()
392 if (!vc || !con_is_visible(vc) || in fb_flashcursor()
393 fbcon_info_from_console(vc->vc_num) != info || in fb_flashcursor()
394 vc->vc_deccm != 1) { in fb_flashcursor()
399 c = scr_readw((u16 *) vc->vc_pos); in fb_flashcursor()
401 ops->cursor(vc, info, enable, in fb_flashcursor()
402 get_fg_color(vc, info, c), in fb_flashcursor()
403 get_bg_color(vc, info, c)); in fb_flashcursor()
461 if (!strncmp(options, "vc:", 3)) { in fb_console_setup()
573 static void fbcon_prepare_logo(struct vc_data *vc, struct fb_info *info, in fbcon_prepare_logo() argument
579 static void fbcon_prepare_logo(struct vc_data *vc, struct fb_info *info, in fbcon_prepare_logo() argument
584 int cnt, erase = vc->vc_video_erase_char, step; in fbcon_prepare_logo()
600 logo_lines = DIV_ROUND_UP(logo_height, vc->vc_font.height); in fbcon_prepare_logo()
601 q = (unsigned short *) (vc->vc_origin + in fbcon_prepare_logo()
602 vc->vc_size_row * rows); in fbcon_prepare_logo()
605 if (scr_readw(r) != vc->vc_video_erase_char) in fbcon_prepare_logo()
623 scr_memcpyw(r + step, r, vc->vc_size_row); in fbcon_prepare_logo()
628 if (vc->state.y + logo_lines >= rows) in fbcon_prepare_logo()
629 lines = rows - vc->state.y - 1; in fbcon_prepare_logo()
632 vc->state.y += lines; in fbcon_prepare_logo()
633 vc->vc_pos += lines * vc->vc_size_row; in fbcon_prepare_logo()
636 scr_memsetw((unsigned short *) vc->vc_origin, in fbcon_prepare_logo()
638 vc->vc_size_row * logo_lines); in fbcon_prepare_logo()
640 if (con_is_visible(vc) && vc->vc_mode == KD_TEXT) { in fbcon_prepare_logo()
641 fbcon_clear_margins(vc, 0); in fbcon_prepare_logo()
642 update_screen(vc); in fbcon_prepare_logo()
646 q = (unsigned short *) (vc->vc_origin + in fbcon_prepare_logo()
647 vc->vc_size_row * in fbcon_prepare_logo()
650 vc->state.y += logo_lines; in fbcon_prepare_logo()
651 vc->vc_pos += logo_lines * vc->vc_size_row; in fbcon_prepare_logo()
658 if (logo_lines > vc->vc_bottom) { in fbcon_prepare_logo()
663 vc->vc_top = logo_lines; in fbcon_prepare_logo()
669 static void set_blitting_type(struct vc_data *vc, struct fb_info *info) in set_blitting_type() argument
673 ops->p = &fb_display[vc->vc_num]; in set_blitting_type()
676 fbcon_set_tileops(vc, info); in set_blitting_type()
694 static void set_blitting_type(struct vc_data *vc, struct fb_info *info) in set_blitting_type() argument
699 ops->p = &fb_display[vc->vc_num]; in set_blitting_type()
763 static int con2fb_acquire_newinfo(struct vc_data *vc, struct fb_info *info, in con2fb_acquire_newinfo() argument
772 if (vc) in con2fb_acquire_newinfo()
773 set_blitting_type(vc, info); in con2fb_acquire_newinfo()
778 static void con2fb_release_oldinfo(struct vc_data *vc, struct fb_info *oldinfo, in con2fb_release_oldinfo() argument
802 static void con2fb_init_display(struct vc_data *vc, struct fb_info *info, in con2fb_init_display() argument
850 struct vc_data *vc = vc_cons[unit].d; in set_con2fb_map() local
873 err = con2fb_acquire_newinfo(vc, info, unit); in set_con2fb_map()
878 } else if (vc) { in set_con2fb_map()
879 set_blitting_type(vc, info); in set_con2fb_map()
889 con2fb_release_oldinfo(vc, oldinfo, info); in set_con2fb_map()
895 con2fb_init_display(vc, info, unit, show_logo); in set_con2fb_map()
954 struct vc_data *vc = vc_cons[fg_console].d; in fbcon_startup() local
988 set_blitting_type(vc, info); in fbcon_startup()
997 vc->vc_font.width = font->width; in fbcon_startup()
998 vc->vc_font.height = font->height; in fbcon_startup()
999 vc->vc_font.data = (void *)(p->fontdata = font->data); in fbcon_startup()
1000 vc->vc_font.charcount = font->charcount; in fbcon_startup()
1005 cols /= vc->vc_font.width; in fbcon_startup()
1006 rows /= vc->vc_font.height; in fbcon_startup()
1007 vc_resize(vc, cols, rows); in fbcon_startup()
1019 static void fbcon_init(struct vc_data *vc, bool init) in fbcon_init() argument
1023 struct vc_data **default_mode = vc->vc_display_fg; in fbcon_init()
1025 struct fbcon_display *t, *p = &fb_display[vc->vc_num]; in fbcon_init()
1032 if (con2fb_map[vc->vc_num] == -1) in fbcon_init()
1033 con2fb_map[vc->vc_num] = info_idx; in fbcon_init()
1035 info = fbcon_info_from_console(vc->vc_num); in fbcon_init()
1040 if (vc != svc || logo_shown == FBCON_LOGO_DONTSHOW || in fbcon_init()
1048 con2fb_acquire_newinfo(vc, info, vc->vc_num); in fbcon_init()
1057 vc->vc_font.data = (void *)(p->fontdata = in fbcon_init()
1059 vc->vc_font.width = fvc->vc_font.width; in fbcon_init()
1060 vc->vc_font.height = fvc->vc_font.height; in fbcon_init()
1061 vc->vc_font.charcount = fvc->vc_font.charcount; in fbcon_init()
1074 vc->vc_font.width = font->width; in fbcon_init()
1075 vc->vc_font.height = font->height; in fbcon_init()
1076 vc->vc_font.data = (void *)(p->fontdata = font->data); in fbcon_init()
1077 vc->vc_font.charcount = font->charcount; in fbcon_init()
1081 vc->vc_can_do_color = (fb_get_color_depth(&info->var, &info->fix)!=1); in fbcon_init()
1082 vc->vc_complement_mask = vc->vc_can_do_color ? 0x7700 : 0x0800; in fbcon_init()
1083 if (vc->vc_font.charcount == 256) { in fbcon_init()
1084 vc->vc_hi_font_mask = 0; in fbcon_init()
1086 vc->vc_hi_font_mask = 0x100; in fbcon_init()
1087 if (vc->vc_can_do_color) in fbcon_init()
1088 vc->vc_complement_mask <<= 1; in fbcon_init()
1093 if (!*vc->uni_pagedict_loc) in fbcon_init()
1094 con_copy_unimap(vc, svc); in fbcon_init()
1097 ops->cur_blink_jiffies = msecs_to_jiffies(vc->vc_cur_blink_ms); in fbcon_init()
1105 set_blitting_type(vc, info); in fbcon_init()
1107 cols = vc->vc_cols; in fbcon_init()
1108 rows = vc->vc_rows; in fbcon_init()
1111 new_cols /= vc->vc_font.width; in fbcon_init()
1112 new_rows /= vc->vc_font.height; in fbcon_init()
1121 if (con_is_visible(vc) && vc->vc_mode == KD_TEXT) { in fbcon_init()
1150 vc->vc_cols = new_cols; in fbcon_init()
1151 vc->vc_rows = new_rows; in fbcon_init()
1153 vc_resize(vc, new_cols, new_rows); in fbcon_init()
1156 fbcon_prepare_logo(vc, info, cols, rows, new_cols, new_rows); in fbcon_init()
1158 if (ops->rotate_font && ops->rotate_font(info, vc)) { in fbcon_init()
1160 set_blitting_type(vc, info); in fbcon_init()
1174 static void set_vc_hi_font(struct vc_data *vc, bool set);
1197 static void fbcon_deinit(struct vc_data *vc) in fbcon_deinit() argument
1199 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_deinit()
1205 idx = con2fb_map[vc->vc_num]; in fbcon_deinit()
1220 if (con_is_visible(vc)) in fbcon_deinit()
1227 vc->vc_font.data = NULL; in fbcon_deinit()
1229 if (vc->vc_hi_font_mask && vc->vc_screenbuf) in fbcon_deinit()
1230 set_vc_hi_font(vc, false); in fbcon_deinit()
1235 if (vc->vc_num == logo_shown) in fbcon_deinit()
1266 static void __fbcon_clear(struct vc_data *vc, unsigned int sy, unsigned int sx, in __fbcon_clear() argument
1269 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in __fbcon_clear()
1272 struct fbcon_display *p = &fb_display[vc->vc_num]; in __fbcon_clear()
1275 if (!fbcon_is_active(vc, info)) in __fbcon_clear()
1281 if (sy < vc->vc_top && vc->vc_top == logo_lines) { in __fbcon_clear()
1282 vc->vc_top = 0; in __fbcon_clear()
1289 fbcon_clear_margins(vc, 0); in __fbcon_clear()
1292 fg = get_color(vc, info, vc->vc_video_erase_char, 1); in __fbcon_clear()
1293 bg = get_color(vc, info, vc->vc_video_erase_char, 0); in __fbcon_clear()
1299 ops->clear(vc, info, real_y(p, sy), sx, b, width, fg, bg); in __fbcon_clear()
1300 ops->clear(vc, info, real_y(p, sy + b), sx, height - b, in __fbcon_clear()
1303 ops->clear(vc, info, real_y(p, sy), sx, height, width, fg, bg); in __fbcon_clear()
1306 static void fbcon_clear(struct vc_data *vc, unsigned int sy, unsigned int sx, in fbcon_clear() argument
1309 __fbcon_clear(vc, sy, sx, 1, width); in fbcon_clear()
1312 static void fbcon_putcs(struct vc_data *vc, const u16 *s, unsigned int count, in fbcon_putcs() argument
1315 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_putcs()
1316 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_putcs()
1319 if (fbcon_is_active(vc, info)) in fbcon_putcs()
1320 ops->putcs(vc, info, s, count, real_y(p, ypos), xpos, in fbcon_putcs()
1321 get_fg_color(vc, info, scr_readw(s)), in fbcon_putcs()
1322 get_bg_color(vc, info, scr_readw(s))); in fbcon_putcs()
1325 static void fbcon_clear_margins(struct vc_data *vc, int bottom_only) in fbcon_clear_margins() argument
1327 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_clear_margins()
1330 if (fbcon_is_active(vc, info)) in fbcon_clear_margins()
1331 ops->clear_margins(vc, info, margin_color, bottom_only); in fbcon_clear_margins()
1334 static void fbcon_cursor(struct vc_data *vc, bool enable) in fbcon_cursor() argument
1336 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_cursor()
1338 int c = scr_readw((u16 *) vc->vc_pos); in fbcon_cursor()
1340 ops->cur_blink_jiffies = msecs_to_jiffies(vc->vc_cur_blink_ms); in fbcon_cursor()
1342 if (!fbcon_is_active(vc, info) || vc->vc_deccm != 1) in fbcon_cursor()
1345 if (vc->vc_cursor_type & CUR_SW) in fbcon_cursor()
1355 ops->cursor(vc, info, enable, in fbcon_cursor()
1356 get_fg_color(vc, info, c), in fbcon_cursor()
1357 get_bg_color(vc, info, c)); in fbcon_cursor()
1368 struct vc_data **default_mode, *vc; in fbcon_set_disp() local
1379 vc = vc_cons[unit].d; in fbcon_set_disp()
1381 if (!vc) in fbcon_set_disp()
1384 default_mode = vc->vc_display_fg; in fbcon_set_disp()
1388 if (!vc->vc_font.data) { in fbcon_set_disp()
1389 vc->vc_font.data = (void *)(p->fontdata = t->fontdata); in fbcon_set_disp()
1390 vc->vc_font.width = (*default_mode)->vc_font.width; in fbcon_set_disp()
1391 vc->vc_font.height = (*default_mode)->vc_font.height; in fbcon_set_disp()
1392 vc->vc_font.charcount = (*default_mode)->vc_font.charcount; in fbcon_set_disp()
1404 vc->vc_can_do_color = (fb_get_color_depth(&info->var, &info->fix)!=1); in fbcon_set_disp()
1405 vc->vc_complement_mask = vc->vc_can_do_color ? 0x7700 : 0x0800; in fbcon_set_disp()
1406 if (vc->vc_font.charcount == 256) { in fbcon_set_disp()
1407 vc->vc_hi_font_mask = 0; in fbcon_set_disp()
1409 vc->vc_hi_font_mask = 0x100; in fbcon_set_disp()
1410 if (vc->vc_can_do_color) in fbcon_set_disp()
1411 vc->vc_complement_mask <<= 1; in fbcon_set_disp()
1416 if (!*vc->uni_pagedict_loc) in fbcon_set_disp()
1417 con_copy_unimap(vc, svc); in fbcon_set_disp()
1421 cols /= vc->vc_font.width; in fbcon_set_disp()
1422 rows /= vc->vc_font.height; in fbcon_set_disp()
1423 ret = vc_resize(vc, cols, rows); in fbcon_set_disp()
1425 if (con_is_visible(vc) && !ret) in fbcon_set_disp()
1426 update_screen(vc); in fbcon_set_disp()
1429 static __inline__ void ywrap_up(struct vc_data *vc, int count) in ywrap_up() argument
1431 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in ywrap_up()
1433 struct fbcon_display *p = &fb_display[vc->vc_num]; in ywrap_up()
1439 ops->var.yoffset = p->yscroll * vc->vc_font.height; in ywrap_up()
1448 static __inline__ void ywrap_down(struct vc_data *vc, int count) in ywrap_down() argument
1450 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in ywrap_down()
1452 struct fbcon_display *p = &fb_display[vc->vc_num]; in ywrap_down()
1458 ops->var.yoffset = p->yscroll * vc->vc_font.height; in ywrap_down()
1467 static __inline__ void ypan_up(struct vc_data *vc, int count) in ypan_up() argument
1469 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in ypan_up()
1470 struct fbcon_display *p = &fb_display[vc->vc_num]; in ypan_up()
1474 if (p->yscroll > p->vrows - vc->vc_rows) { in ypan_up()
1475 ops->bmove(vc, info, p->vrows - vc->vc_rows, in ypan_up()
1476 0, 0, 0, vc->vc_rows, vc->vc_cols); in ypan_up()
1477 p->yscroll -= p->vrows - vc->vc_rows; in ypan_up()
1481 ops->var.yoffset = p->yscroll * vc->vc_font.height; in ypan_up()
1484 fbcon_clear_margins(vc, 1); in ypan_up()
1491 static __inline__ void ypan_up_redraw(struct vc_data *vc, int t, int count) in ypan_up_redraw() argument
1493 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in ypan_up_redraw()
1495 struct fbcon_display *p = &fb_display[vc->vc_num]; in ypan_up_redraw()
1499 if (p->yscroll > p->vrows - vc->vc_rows) { in ypan_up_redraw()
1500 p->yscroll -= p->vrows - vc->vc_rows; in ypan_up_redraw()
1501 fbcon_redraw_move(vc, p, t + count, vc->vc_rows - count, t); in ypan_up_redraw()
1505 ops->var.yoffset = p->yscroll * vc->vc_font.height; in ypan_up_redraw()
1508 fbcon_clear_margins(vc, 1); in ypan_up_redraw()
1515 static __inline__ void ypan_down(struct vc_data *vc, int count) in ypan_down() argument
1517 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in ypan_down()
1518 struct fbcon_display *p = &fb_display[vc->vc_num]; in ypan_down()
1523 ops->bmove(vc, info, 0, 0, p->vrows - vc->vc_rows, in ypan_down()
1524 0, vc->vc_rows, vc->vc_cols); in ypan_down()
1525 p->yscroll += p->vrows - vc->vc_rows; in ypan_down()
1529 ops->var.yoffset = p->yscroll * vc->vc_font.height; in ypan_down()
1532 fbcon_clear_margins(vc, 1); in ypan_down()
1539 static __inline__ void ypan_down_redraw(struct vc_data *vc, int t, int count) in ypan_down_redraw() argument
1541 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in ypan_down_redraw()
1543 struct fbcon_display *p = &fb_display[vc->vc_num]; in ypan_down_redraw()
1548 p->yscroll += p->vrows - vc->vc_rows; in ypan_down_redraw()
1549 fbcon_redraw_move(vc, p, t, vc->vc_rows - count, t + count); in ypan_down_redraw()
1553 ops->var.yoffset = p->yscroll * vc->vc_font.height; in ypan_down_redraw()
1556 fbcon_clear_margins(vc, 1); in ypan_down_redraw()
1563 static void fbcon_redraw_move(struct vc_data *vc, struct fbcon_display *p, in fbcon_redraw_move() argument
1567 (vc->vc_origin + vc->vc_size_row * line); in fbcon_redraw_move()
1581 fbcon_putcs(vc, start, s - start, in fbcon_redraw_move()
1591 fbcon_putcs(vc, start, s - start, dy, x); in fbcon_redraw_move()
1597 static void fbcon_redraw_blit(struct vc_data *vc, struct fb_info *info, in fbcon_redraw_blit() argument
1600 int offset = ycount * vc->vc_cols; in fbcon_redraw_blit()
1602 (vc->vc_origin + vc->vc_size_row * line); in fbcon_redraw_blit()
1617 ops->bmove(vc, info, line + ycount, x, in fbcon_redraw_blit()
1633 ops->bmove(vc, info, line + ycount, x, line, x, 1, in fbcon_redraw_blit()
1641 s -= vc->vc_size_row; in fbcon_redraw_blit()
1642 d -= vc->vc_size_row; in fbcon_redraw_blit()
1647 static void fbcon_redraw(struct vc_data *vc, int line, int count, int offset) in fbcon_redraw() argument
1650 (vc->vc_origin + vc->vc_size_row * line); in fbcon_redraw()
1665 fbcon_putcs(vc, start, s - start, in fbcon_redraw()
1673 fbcon_putcs(vc, start, s - start, in fbcon_redraw()
1688 fbcon_putcs(vc, start, s - start, line, x); in fbcon_redraw()
1695 s -= vc->vc_size_row; in fbcon_redraw()
1696 d -= vc->vc_size_row; in fbcon_redraw()
1701 static void fbcon_bmove_rec(struct vc_data *vc, struct fbcon_display *p, int sy, int sx, in fbcon_bmove_rec() argument
1704 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_bmove_rec()
1711 fbcon_bmove_rec(vc, p, sy, sx, dy, dx, b, width, in fbcon_bmove_rec()
1713 fbcon_bmove_rec(vc, p, sy + b, sx, dy + b, dx, in fbcon_bmove_rec()
1716 fbcon_bmove_rec(vc, p, sy + b, sx, dy + b, dx, in fbcon_bmove_rec()
1718 fbcon_bmove_rec(vc, p, sy, sx, dy, dx, b, width, in fbcon_bmove_rec()
1727 fbcon_bmove_rec(vc, p, sy, sx, dy, dx, b, width, in fbcon_bmove_rec()
1729 fbcon_bmove_rec(vc, p, sy + b, sx, dy + b, dx, in fbcon_bmove_rec()
1732 fbcon_bmove_rec(vc, p, sy + b, sx, dy + b, dx, in fbcon_bmove_rec()
1734 fbcon_bmove_rec(vc, p, sy, sx, dy, dx, b, width, in fbcon_bmove_rec()
1739 ops->bmove(vc, info, real_y(p, sy), sx, real_y(p, dy), dx, in fbcon_bmove_rec()
1743 static void fbcon_bmove(struct vc_data *vc, int sy, int sx, int dy, int dx, in fbcon_bmove() argument
1746 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_bmove()
1747 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_bmove()
1749 if (!fbcon_is_active(vc, info)) in fbcon_bmove()
1762 fbcon_bmove_rec(vc, p, sy, sx, dy, dx, height, width, in fbcon_bmove()
1766 static bool fbcon_scroll(struct vc_data *vc, unsigned int t, unsigned int b, in fbcon_scroll() argument
1769 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_scroll()
1770 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_scroll()
1773 if (!fbcon_is_active(vc, info)) in fbcon_scroll()
1776 fbcon_cursor(vc, false); in fbcon_scroll()
1786 if (count > vc->vc_rows) /* Maximum realistic size */ in fbcon_scroll()
1787 count = vc->vc_rows; in fbcon_scroll()
1790 fbcon_redraw_blit(vc, info, p, t, b - t - count, in fbcon_scroll()
1792 __fbcon_clear(vc, b - count, 0, count, vc->vc_cols); in fbcon_scroll()
1793 scr_memsetw((unsigned short *) (vc->vc_origin + in fbcon_scroll()
1794 vc->vc_size_row * in fbcon_scroll()
1796 vc->vc_video_erase_char, in fbcon_scroll()
1797 vc->vc_size_row * count); in fbcon_scroll()
1801 if (b - t - count > 3 * vc->vc_rows >> 2) { in fbcon_scroll()
1803 fbcon_bmove(vc, 0, 0, count, 0, t, in fbcon_scroll()
1804 vc->vc_cols); in fbcon_scroll()
1805 ywrap_up(vc, count); in fbcon_scroll()
1806 if (vc->vc_rows - b > 0) in fbcon_scroll()
1807 fbcon_bmove(vc, b - count, 0, b, 0, in fbcon_scroll()
1808 vc->vc_rows - b, in fbcon_scroll()
1809 vc->vc_cols); in fbcon_scroll()
1811 fbcon_bmove(vc, t + count, 0, t, 0, in fbcon_scroll()
1812 b - t - count, vc->vc_cols); in fbcon_scroll()
1815 __fbcon_clear(vc, b - count, 0, count, vc->vc_cols); in fbcon_scroll()
1820 2 * (p->vrows - vc->vc_rows)) in fbcon_scroll()
1821 && ((!scroll_partial && (b - t == vc->vc_rows)) in fbcon_scroll()
1824 3 * vc->vc_rows >> 2)))) { in fbcon_scroll()
1826 fbcon_redraw_move(vc, p, 0, t, count); in fbcon_scroll()
1827 ypan_up_redraw(vc, t, count); in fbcon_scroll()
1828 if (vc->vc_rows - b > 0) in fbcon_scroll()
1829 fbcon_redraw_move(vc, p, b, in fbcon_scroll()
1830 vc->vc_rows - b, b); in fbcon_scroll()
1832 fbcon_redraw_move(vc, p, t + count, b - t - count, t); in fbcon_scroll()
1833 __fbcon_clear(vc, b - count, 0, count, vc->vc_cols); in fbcon_scroll()
1838 2 * (p->vrows - vc->vc_rows)) in fbcon_scroll()
1839 && ((!scroll_partial && (b - t == vc->vc_rows)) in fbcon_scroll()
1842 3 * vc->vc_rows >> 2)))) { in fbcon_scroll()
1844 fbcon_bmove(vc, 0, 0, count, 0, t, in fbcon_scroll()
1845 vc->vc_cols); in fbcon_scroll()
1846 ypan_up(vc, count); in fbcon_scroll()
1847 if (vc->vc_rows - b > 0) in fbcon_scroll()
1848 fbcon_bmove(vc, b - count, 0, b, 0, in fbcon_scroll()
1849 vc->vc_rows - b, in fbcon_scroll()
1850 vc->vc_cols); in fbcon_scroll()
1852 fbcon_bmove(vc, t + count, 0, t, 0, in fbcon_scroll()
1853 b - t - count, vc->vc_cols); in fbcon_scroll()
1856 __fbcon_clear(vc, b - count, 0, count, vc->vc_cols); in fbcon_scroll()
1861 fbcon_redraw(vc, t, b - t - count, in fbcon_scroll()
1862 count * vc->vc_cols); in fbcon_scroll()
1863 __fbcon_clear(vc, b - count, 0, count, vc->vc_cols); in fbcon_scroll()
1864 scr_memsetw((unsigned short *) (vc->vc_origin + in fbcon_scroll()
1865 vc->vc_size_row * in fbcon_scroll()
1867 vc->vc_video_erase_char, in fbcon_scroll()
1868 vc->vc_size_row * count); in fbcon_scroll()
1874 if (count > vc->vc_rows) /* Maximum realistic size */ in fbcon_scroll()
1875 count = vc->vc_rows; in fbcon_scroll()
1878 fbcon_redraw_blit(vc, info, p, b - 1, b - t - count, in fbcon_scroll()
1880 __fbcon_clear(vc, t, 0, count, vc->vc_cols); in fbcon_scroll()
1881 scr_memsetw((unsigned short *) (vc->vc_origin + in fbcon_scroll()
1882 vc->vc_size_row * in fbcon_scroll()
1884 vc->vc_video_erase_char, in fbcon_scroll()
1885 vc->vc_size_row * count); in fbcon_scroll()
1889 if (b - t - count > 3 * vc->vc_rows >> 2) { in fbcon_scroll()
1890 if (vc->vc_rows - b > 0) in fbcon_scroll()
1891 fbcon_bmove(vc, b, 0, b - count, 0, in fbcon_scroll()
1892 vc->vc_rows - b, in fbcon_scroll()
1893 vc->vc_cols); in fbcon_scroll()
1894 ywrap_down(vc, count); in fbcon_scroll()
1896 fbcon_bmove(vc, count, 0, 0, 0, t, in fbcon_scroll()
1897 vc->vc_cols); in fbcon_scroll()
1899 fbcon_bmove(vc, t, 0, t + count, 0, in fbcon_scroll()
1900 b - t - count, vc->vc_cols); in fbcon_scroll()
1903 __fbcon_clear(vc, t, 0, count, vc->vc_cols); in fbcon_scroll()
1907 if ((count - p->yscroll <= p->vrows - vc->vc_rows) in fbcon_scroll()
1908 && ((!scroll_partial && (b - t == vc->vc_rows)) in fbcon_scroll()
1911 3 * vc->vc_rows >> 2)))) { in fbcon_scroll()
1912 if (vc->vc_rows - b > 0) in fbcon_scroll()
1913 fbcon_bmove(vc, b, 0, b - count, 0, in fbcon_scroll()
1914 vc->vc_rows - b, in fbcon_scroll()
1915 vc->vc_cols); in fbcon_scroll()
1916 ypan_down(vc, count); in fbcon_scroll()
1918 fbcon_bmove(vc, count, 0, 0, 0, t, in fbcon_scroll()
1919 vc->vc_cols); in fbcon_scroll()
1921 fbcon_bmove(vc, t, 0, t + count, 0, in fbcon_scroll()
1922 b - t - count, vc->vc_cols); in fbcon_scroll()
1925 __fbcon_clear(vc, t, 0, count, vc->vc_cols); in fbcon_scroll()
1929 if ((count - p->yscroll <= p->vrows - vc->vc_rows) in fbcon_scroll()
1930 && ((!scroll_partial && (b - t == vc->vc_rows)) in fbcon_scroll()
1933 3 * vc->vc_rows >> 2)))) { in fbcon_scroll()
1934 if (vc->vc_rows - b > 0) in fbcon_scroll()
1935 fbcon_redraw_move(vc, p, b, vc->vc_rows - b, in fbcon_scroll()
1937 ypan_down_redraw(vc, t, count); in fbcon_scroll()
1939 fbcon_redraw_move(vc, p, count, t, 0); in fbcon_scroll()
1941 fbcon_redraw_move(vc, p, t, b - t - count, t + count); in fbcon_scroll()
1942 __fbcon_clear(vc, t, 0, count, vc->vc_cols); in fbcon_scroll()
1947 fbcon_redraw(vc, b - 1, b - t - count, in fbcon_scroll()
1948 -count * vc->vc_cols); in fbcon_scroll()
1949 __fbcon_clear(vc, t, 0, count, vc->vc_cols); in fbcon_scroll()
1950 scr_memsetw((unsigned short *) (vc->vc_origin + in fbcon_scroll()
1951 vc->vc_size_row * in fbcon_scroll()
1953 vc->vc_video_erase_char, in fbcon_scroll()
1954 vc->vc_size_row * count); in fbcon_scroll()
1964 struct vc_data *vc) in updatescrollmode_accel() argument
1977 divides(ypan, vc->vc_font.height) && vyres > yres; in updatescrollmode_accel()
1979 divides(ywrap, vc->vc_font.height) && in updatescrollmode_accel()
1980 divides(vc->vc_font.height, vyres) && in updatescrollmode_accel()
1981 divides(vc->vc_font.height, yres); in updatescrollmode_accel()
2006 struct vc_data *vc) in updatescrollmode() argument
2009 int fh = vc->vc_font.height; in updatescrollmode()
2015 if (yres > (fh * (vc->vc_rows + 1))) in updatescrollmode()
2016 p->vrows -= (yres - (fh * vc->vc_rows)) / fh; in updatescrollmode()
2021 updatescrollmode_accel(p, info, vc); in updatescrollmode()
2027 static int fbcon_resize(struct vc_data *vc, unsigned int width, in fbcon_resize() argument
2030 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_resize()
2032 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_resize()
2036 if (p->userfont && FNTSIZE(vc->vc_font.data)) { in fbcon_resize()
2038 int pitch = PITCH(vc->vc_font.width); in fbcon_resize()
2049 size = CALC_FONTSZ(vc->vc_font.height, pitch, vc->vc_font.charcount); in fbcon_resize()
2050 if (size > FNTSIZE(vc->vc_font.data)) in fbcon_resize()
2056 virt_fw = FBCON_SWAP(ops->rotate, vc->vc_font.width, in fbcon_resize()
2057 vc->vc_font.height); in fbcon_resize()
2058 virt_fh = FBCON_SWAP(ops->rotate, vc->vc_font.height, in fbcon_resize()
2059 vc->vc_font.width); in fbcon_resize()
2079 if (con_is_visible(vc) && vc->vc_mode == KD_TEXT) { in fbcon_resize()
2087 updatescrollmode(p, info, vc); in fbcon_resize()
2091 static bool fbcon_switch(struct vc_data *vc) in fbcon_switch() argument
2095 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_switch()
2099 info = fbcon_info_from_console(vc->vc_num); in fbcon_switch()
2120 * info->currcon = vc->vc_num; in fbcon_switch()
2126 o->currcon = vc->vc_num; in fbcon_switch()
2157 if (!fbcon_is_active(vc, info) || in fbcon_switch()
2163 set_blitting_type(vc, info); in fbcon_switch()
2166 if (ops->rotate_font && ops->rotate_font(info, vc)) { in fbcon_switch()
2168 set_blitting_type(vc, info); in fbcon_switch()
2171 vc->vc_can_do_color = (fb_get_color_depth(&info->var, &info->fix)!=1); in fbcon_switch()
2172 vc->vc_complement_mask = vc->vc_can_do_color ? 0x7700 : 0x0800; in fbcon_switch()
2174 if (vc->vc_font.charcount > 256) in fbcon_switch()
2175 vc->vc_complement_mask <<= 1; in fbcon_switch()
2177 updatescrollmode(p, info, vc); in fbcon_switch()
2181 scrollback_phys_max = p->vrows - vc->vc_rows; in fbcon_switch()
2185 scrollback_phys_max = p->vrows - 2 * vc->vc_rows; in fbcon_switch()
2197 if (fbcon_is_active(vc, info)) { in fbcon_switch()
2202 fbcon_set_palette(vc, color_table); in fbcon_switch()
2203 fbcon_clear_margins(vc, 0); in fbcon_switch()
2209 update_region(vc, in fbcon_switch()
2210 vc->vc_origin + vc->vc_size_row * vc->vc_top, in fbcon_switch()
2211 vc->vc_size_row * (vc->vc_bottom - in fbcon_switch()
2212 vc->vc_top) / 2); in fbcon_switch()
2218 static void fbcon_generic_blank(struct vc_data *vc, struct fb_info *info, in fbcon_generic_blank() argument
2222 unsigned short charmask = vc->vc_hi_font_mask ? in fbcon_generic_blank()
2226 oldc = vc->vc_video_erase_char; in fbcon_generic_blank()
2227 vc->vc_video_erase_char &= charmask; in fbcon_generic_blank()
2228 __fbcon_clear(vc, 0, 0, vc->vc_rows, vc->vc_cols); in fbcon_generic_blank()
2229 vc->vc_video_erase_char = oldc; in fbcon_generic_blank()
2233 static bool fbcon_blank(struct vc_data *vc, enum vesa_blank_mode blank, in fbcon_blank() argument
2236 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_blank()
2253 if (fbcon_is_active(vc, info)) { in fbcon_blank()
2256 fbcon_cursor(vc, !blank); in fbcon_blank()
2260 fbcon_generic_blank(vc, info, blank); in fbcon_blank()
2264 update_screen(vc); in fbcon_blank()
2267 if (mode_switch || !fbcon_is_active(vc, info) || in fbcon_blank()
2276 static void fbcon_debug_enter(struct vc_data *vc) in fbcon_debug_enter() argument
2278 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_debug_enter()
2285 fbcon_set_palette(vc, color_table); in fbcon_debug_enter()
2288 static void fbcon_debug_leave(struct vc_data *vc) in fbcon_debug_leave() argument
2290 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_debug_leave()
2298 static int fbcon_get_font(struct vc_data *vc, struct console_font *font, unsigned int vpitch) in fbcon_get_font() argument
2300 u8 *fontdata = vc->vc_font.data; in fbcon_get_font()
2304 font->width = vc->vc_font.width; in fbcon_get_font()
2305 font->height = vc->vc_font.height; in fbcon_get_font()
2308 font->charcount = vc->vc_hi_font_mask ? 512 : 256; in fbcon_get_font()
2313 j = vc->vc_font.height; in fbcon_get_font()
2324 j = vc->vc_font.height * 2; in fbcon_get_font()
2335 if (font->charcount * (vc->vc_font.height * sizeof(u32)) > FNTSIZE(fontdata)) in fbcon_get_font()
2339 for (j = 0; j < vc->vc_font.height; j++) { in fbcon_get_font()
2349 j = vc->vc_font.height * 4; in fbcon_get_font()
2363 /* set/clear vc_hi_font_mask and update vc attrs accordingly */
2364 static void set_vc_hi_font(struct vc_data *vc, bool set) in set_vc_hi_font() argument
2367 vc->vc_hi_font_mask = 0; in set_vc_hi_font()
2368 if (vc->vc_can_do_color) { in set_vc_hi_font()
2369 vc->vc_complement_mask >>= 1; in set_vc_hi_font()
2370 vc->vc_s_complement_mask >>= 1; in set_vc_hi_font()
2374 if (vc->vc_can_do_color) { in set_vc_hi_font()
2376 (unsigned short *) vc->vc_origin; in set_vc_hi_font()
2377 int count = vc->vc_screenbuf_size / 2; in set_vc_hi_font()
2384 c = vc->vc_video_erase_char; in set_vc_hi_font()
2385 vc->vc_video_erase_char = in set_vc_hi_font()
2387 vc->vc_attr >>= 1; in set_vc_hi_font()
2390 vc->vc_hi_font_mask = 0x100; in set_vc_hi_font()
2391 if (vc->vc_can_do_color) { in set_vc_hi_font()
2392 vc->vc_complement_mask <<= 1; in set_vc_hi_font()
2393 vc->vc_s_complement_mask <<= 1; in set_vc_hi_font()
2399 (unsigned short *) vc->vc_origin; in set_vc_hi_font()
2400 int count = vc->vc_screenbuf_size / 2; in set_vc_hi_font()
2405 if (vc->vc_can_do_color) in set_vc_hi_font()
2413 c = vc->vc_video_erase_char; in set_vc_hi_font()
2414 if (vc->vc_can_do_color) { in set_vc_hi_font()
2415 vc->vc_video_erase_char = in set_vc_hi_font()
2417 vc->vc_attr <<= 1; in set_vc_hi_font()
2419 vc->vc_video_erase_char = c & ~0x100; in set_vc_hi_font()
2424 static int fbcon_do_set_font(struct vc_data *vc, int w, int h, int charcount, in fbcon_do_set_font() argument
2427 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_do_set_font()
2429 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_do_set_font()
2431 u8 *old_data = vc->vc_font.data; in fbcon_do_set_font()
2433 resize = (w != vc->vc_font.width) || (h != vc->vc_font.height); in fbcon_do_set_font()
2434 vc->vc_font.data = (void *)(p->fontdata = data); in fbcon_do_set_font()
2439 old_width = vc->vc_font.width; in fbcon_do_set_font()
2440 old_height = vc->vc_font.height; in fbcon_do_set_font()
2441 old_charcount = vc->vc_font.charcount; in fbcon_do_set_font()
2443 vc->vc_font.width = w; in fbcon_do_set_font()
2444 vc->vc_font.height = h; in fbcon_do_set_font()
2445 vc->vc_font.charcount = charcount; in fbcon_do_set_font()
2446 if (vc->vc_hi_font_mask && charcount == 256) in fbcon_do_set_font()
2447 set_vc_hi_font(vc, false); in fbcon_do_set_font()
2448 else if (!vc->vc_hi_font_mask && charcount == 512) in fbcon_do_set_font()
2449 set_vc_hi_font(vc, true); in fbcon_do_set_font()
2458 ret = vc_resize(vc, cols, rows); in fbcon_do_set_font()
2461 } else if (con_is_visible(vc) in fbcon_do_set_font()
2462 && vc->vc_mode == KD_TEXT) { in fbcon_do_set_font()
2463 fbcon_clear_margins(vc, 0); in fbcon_do_set_font()
2464 update_screen(vc); in fbcon_do_set_font()
2473 vc->vc_font.data = old_data; in fbcon_do_set_font()
2481 vc->vc_font.width = old_width; in fbcon_do_set_font()
2482 vc->vc_font.height = old_height; in fbcon_do_set_font()
2483 vc->vc_font.charcount = old_charcount; in fbcon_do_set_font()
2493 static int fbcon_set_font(struct vc_data *vc, const struct console_font *font, in fbcon_set_font() argument
2496 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_set_font()
2570 return fbcon_do_set_font(vc, font->width, font->height, charcount, new_data, 1); in fbcon_set_font()
2573 static int fbcon_set_def_font(struct vc_data *vc, struct console_font *font, in fbcon_set_def_font() argument
2576 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_set_def_font()
2587 return fbcon_do_set_font(vc, f->width, f->height, f->charcount, f->data, 0); in fbcon_set_def_font()
2598 static void fbcon_set_palette(struct vc_data *vc, const unsigned char *table) in fbcon_set_palette() argument
2600 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_set_palette()
2604 if (!fbcon_is_active(vc, info)) in fbcon_set_palette()
2607 if (!con_is_visible(vc)) in fbcon_set_palette()
2614 val = vc->vc_palette[j++]; in fbcon_set_palette()
2616 val = vc->vc_palette[j++]; in fbcon_set_palette()
2618 val = vc->vc_palette[j++]; in fbcon_set_palette()
2635 static void fbcon_invert_region(struct vc_data *vc, u16 * p, int cnt) in fbcon_invert_region() argument
2639 if (!vc->vc_can_do_color) in fbcon_invert_region()
2641 else if (vc->vc_hi_font_mask == 0x100) in fbcon_invert_region()
2653 struct vc_data *vc = NULL; in fbcon_suspended() local
2658 vc = vc_cons[ops->currcon].d; in fbcon_suspended()
2661 fbcon_cursor(vc, false); in fbcon_suspended()
2666 struct vc_data *vc; in fbcon_resumed() local
2671 vc = vc_cons[ops->currcon].d; in fbcon_resumed()
2673 update_screen(vc); in fbcon_resumed()
2679 struct vc_data *vc; in fbcon_modechanged() local
2685 vc = vc_cons[ops->currcon].d; in fbcon_modechanged()
2686 if (vc->vc_mode != KD_TEXT || in fbcon_modechanged()
2690 p = &fb_display[vc->vc_num]; in fbcon_modechanged()
2691 set_blitting_type(vc, info); in fbcon_modechanged()
2693 if (con_is_visible(vc)) { in fbcon_modechanged()
2697 cols /= vc->vc_font.width; in fbcon_modechanged()
2698 rows /= vc->vc_font.height; in fbcon_modechanged()
2699 vc_resize(vc, cols, rows); in fbcon_modechanged()
2700 updatescrollmode(p, info, vc); in fbcon_modechanged()
2704 if (fbcon_is_active(vc, info)) { in fbcon_modechanged()
2709 fbcon_set_palette(vc, color_table); in fbcon_modechanged()
2710 update_screen(vc); in fbcon_modechanged()
2717 struct vc_data *vc; in fbcon_set_all_vcs() local
2725 vc = vc_cons[i].d; in fbcon_set_all_vcs()
2726 if (!vc || vc->vc_mode != KD_TEXT || in fbcon_set_all_vcs()
2730 if (con_is_visible(vc)) { in fbcon_set_all_vcs()
2735 p = &fb_display[vc->vc_num]; in fbcon_set_all_vcs()
2736 set_blitting_type(vc, info); in fbcon_set_all_vcs()
2740 cols /= vc->vc_font.width; in fbcon_set_all_vcs()
2741 rows /= vc->vc_font.height; in fbcon_set_all_vcs()
2742 vc_resize(vc, cols, rows); in fbcon_set_all_vcs()
2763 struct vc_data *vc; in fbcon_modechange_possible() local
2773 vc = vc_cons[i].d; in fbcon_modechange_possible()
2774 if (!vc || vc->vc_mode != KD_TEXT || in fbcon_modechange_possible()
2778 if (vc->vc_font.width > FBCON_SWAP(var->rotate, var->xres, var->yres) || in fbcon_modechange_possible()
2779 vc->vc_font.height > FBCON_SWAP(var->rotate, var->yres, var->xres)) in fbcon_modechange_possible()
3041 struct vc_data *vc; in fbcon_fb_blanked() local
3046 vc = vc_cons[ops->currcon].d; in fbcon_fb_blanked()
3047 if (vc->vc_mode != KD_TEXT || in fbcon_fb_blanked()
3051 if (con_is_visible(vc)) { in fbcon_fb_blanked()
3063 struct vc_data *vc; in fbcon_new_modelist() local
3072 vc = vc_cons[i].d; in fbcon_new_modelist()
3077 fbcon_set_disp(info, &var, vc->vc_num); in fbcon_new_modelist()
3084 struct vc_data *vc; in fbcon_get_requirement() local
3090 vc = vc_cons[i].d; in fbcon_get_requirement()
3091 if (vc && vc->vc_mode == KD_TEXT && in fbcon_get_requirement()
3093 set_bit(vc->vc_font.width - 1, caps->x); in fbcon_get_requirement()
3094 set_bit(vc->vc_font.height - 1, caps->y); in fbcon_get_requirement()
3095 charcnt = vc->vc_font.charcount; in fbcon_get_requirement()
3101 vc = vc_cons[fg_console].d; in fbcon_get_requirement()
3103 if (vc && vc->vc_mode == KD_TEXT && in fbcon_get_requirement()
3106 set_bit(vc->vc_font.width - 1, caps->x); in fbcon_get_requirement()
3108 set_bit(vc->vc_font.height - 1, caps->y); in fbcon_get_requirement()
3109 caps->len = vc->vc_font.charcount; in fbcon_get_requirement()