Lines Matching refs:vc
167 #define advance_row(p, delta) (unsigned short *)((unsigned long)(p) + (delta) * vc->vc_size_row)
177 static void fbcon_clear_margins(struct vc_data *vc, int bottom_only);
178 static void fbcon_set_palette(struct vc_data *vc, const unsigned char *table);
185 static void fbcon_redraw_move(struct vc_data *vc, struct fbcon_display *p,
229 struct vc_data *vc; in fbcon_rotate_all() local
237 vc = vc_cons[i].d; in fbcon_rotate_all()
238 if (!vc || vc->vc_mode != KD_TEXT || in fbcon_rotate_all()
242 p = &fb_display[vc->vc_num]; in fbcon_rotate_all()
286 static inline int fbcon_is_inactive(struct vc_data *vc, struct fb_info *info) in fbcon_is_inactive() argument
291 vc->vc_mode != KD_TEXT || ops->graphics || fbcon_skip_panic(info)); in fbcon_is_inactive()
294 static int get_color(struct vc_data *vc, struct fb_info *info, in get_color() argument
301 unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff; in get_color()
303 c = vc->vc_video_erase_char & charmask; in get_color()
307 color = (is_fg) ? attr_fgcol((vc->vc_hi_font_mask) ? 9 : 8, c) in get_color()
308 : attr_bgcol((vc->vc_hi_font_mask) ? 13 : 12, c); in get_color()
365 struct vc_data *vc = NULL; in fb_flashcursor() local
381 vc = vc_cons[ops->currcon].d; in fb_flashcursor()
383 if (!vc || !con_is_visible(vc) || in fb_flashcursor()
384 fbcon_info_from_console(vc->vc_num) != info || in fb_flashcursor()
385 vc->vc_deccm != 1) { in fb_flashcursor()
390 c = scr_readw((u16 *) vc->vc_pos); in fb_flashcursor()
392 ops->cursor(vc, info, enable, get_color(vc, info, c, 1), in fb_flashcursor()
393 get_color(vc, info, c, 0)); in fb_flashcursor()
563 static void fbcon_prepare_logo(struct vc_data *vc, struct fb_info *info, in fbcon_prepare_logo() argument
569 static void fbcon_prepare_logo(struct vc_data *vc, struct fb_info *info, in fbcon_prepare_logo() argument
574 int cnt, erase = vc->vc_video_erase_char, step; in fbcon_prepare_logo()
590 logo_lines = DIV_ROUND_UP(logo_height, vc->vc_font.height); in fbcon_prepare_logo()
591 q = (unsigned short *) (vc->vc_origin + in fbcon_prepare_logo()
592 vc->vc_size_row * rows); in fbcon_prepare_logo()
595 if (scr_readw(r) != vc->vc_video_erase_char) in fbcon_prepare_logo()
613 scr_memcpyw(r + step, r, vc->vc_size_row); in fbcon_prepare_logo()
618 if (vc->state.y + logo_lines >= rows) in fbcon_prepare_logo()
619 lines = rows - vc->state.y - 1; in fbcon_prepare_logo()
622 vc->state.y += lines; in fbcon_prepare_logo()
623 vc->vc_pos += lines * vc->vc_size_row; in fbcon_prepare_logo()
626 scr_memsetw((unsigned short *) vc->vc_origin, in fbcon_prepare_logo()
628 vc->vc_size_row * logo_lines); in fbcon_prepare_logo()
630 if (con_is_visible(vc) && vc->vc_mode == KD_TEXT) { in fbcon_prepare_logo()
631 fbcon_clear_margins(vc, 0); in fbcon_prepare_logo()
632 update_screen(vc); in fbcon_prepare_logo()
636 q = (unsigned short *) (vc->vc_origin + in fbcon_prepare_logo()
637 vc->vc_size_row * in fbcon_prepare_logo()
640 vc->state.y += logo_lines; in fbcon_prepare_logo()
641 vc->vc_pos += logo_lines * vc->vc_size_row; in fbcon_prepare_logo()
648 if (logo_lines > vc->vc_bottom) { in fbcon_prepare_logo()
653 vc->vc_top = logo_lines; in fbcon_prepare_logo()
659 static void set_blitting_type(struct vc_data *vc, struct fb_info *info) in set_blitting_type() argument
663 ops->p = &fb_display[vc->vc_num]; in set_blitting_type()
666 fbcon_set_tileops(vc, info); in set_blitting_type()
684 static void set_blitting_type(struct vc_data *vc, struct fb_info *info) in set_blitting_type() argument
689 ops->p = &fb_display[vc->vc_num]; in set_blitting_type()
753 static int con2fb_acquire_newinfo(struct vc_data *vc, struct fb_info *info, in con2fb_acquire_newinfo() argument
762 if (vc) in con2fb_acquire_newinfo()
763 set_blitting_type(vc, info); in con2fb_acquire_newinfo()
768 static void con2fb_release_oldinfo(struct vc_data *vc, struct fb_info *oldinfo, in con2fb_release_oldinfo() argument
792 static void con2fb_init_display(struct vc_data *vc, struct fb_info *info, in con2fb_init_display() argument
839 struct vc_data *vc = vc_cons[unit].d; in set_con2fb_map() local
862 err = con2fb_acquire_newinfo(vc, info, unit); in set_con2fb_map()
867 } else if (vc) { in set_con2fb_map()
868 set_blitting_type(vc, info); in set_con2fb_map()
878 con2fb_release_oldinfo(vc, oldinfo, info); in set_con2fb_map()
884 con2fb_init_display(vc, info, unit, show_logo); in set_con2fb_map()
943 struct vc_data *vc = vc_cons[fg_console].d; in fbcon_startup() local
977 set_blitting_type(vc, info); in fbcon_startup()
986 vc->vc_font.width = font->width; in fbcon_startup()
987 vc->vc_font.height = font->height; in fbcon_startup()
988 vc->vc_font.data = (void *)(p->fontdata = font->data); in fbcon_startup()
989 vc->vc_font.charcount = font->charcount; in fbcon_startup()
994 cols /= vc->vc_font.width; in fbcon_startup()
995 rows /= vc->vc_font.height; in fbcon_startup()
996 vc_resize(vc, cols, rows); in fbcon_startup()
1008 static void fbcon_init(struct vc_data *vc, bool init) in fbcon_init() argument
1012 struct vc_data **default_mode = vc->vc_display_fg; in fbcon_init()
1014 struct fbcon_display *t, *p = &fb_display[vc->vc_num]; in fbcon_init()
1021 if (con2fb_map[vc->vc_num] == -1) in fbcon_init()
1022 con2fb_map[vc->vc_num] = info_idx; in fbcon_init()
1024 info = fbcon_info_from_console(vc->vc_num); in fbcon_init()
1029 if (vc != svc || logo_shown == FBCON_LOGO_DONTSHOW || in fbcon_init()
1037 con2fb_acquire_newinfo(vc, info, vc->vc_num); in fbcon_init()
1046 vc->vc_font.data = (void *)(p->fontdata = in fbcon_init()
1048 vc->vc_font.width = fvc->vc_font.width; in fbcon_init()
1049 vc->vc_font.height = fvc->vc_font.height; in fbcon_init()
1050 vc->vc_font.charcount = fvc->vc_font.charcount; in fbcon_init()
1063 vc->vc_font.width = font->width; in fbcon_init()
1064 vc->vc_font.height = font->height; in fbcon_init()
1065 vc->vc_font.data = (void *)(p->fontdata = font->data); in fbcon_init()
1066 vc->vc_font.charcount = font->charcount; in fbcon_init()
1070 vc->vc_can_do_color = (fb_get_color_depth(&info->var, &info->fix)!=1); in fbcon_init()
1071 vc->vc_complement_mask = vc->vc_can_do_color ? 0x7700 : 0x0800; in fbcon_init()
1072 if (vc->vc_font.charcount == 256) { in fbcon_init()
1073 vc->vc_hi_font_mask = 0; in fbcon_init()
1075 vc->vc_hi_font_mask = 0x100; in fbcon_init()
1076 if (vc->vc_can_do_color) in fbcon_init()
1077 vc->vc_complement_mask <<= 1; in fbcon_init()
1082 if (!*vc->uni_pagedict_loc) in fbcon_init()
1083 con_copy_unimap(vc, svc); in fbcon_init()
1086 ops->cur_blink_jiffies = msecs_to_jiffies(vc->vc_cur_blink_ms); in fbcon_init()
1094 set_blitting_type(vc, info); in fbcon_init()
1096 cols = vc->vc_cols; in fbcon_init()
1097 rows = vc->vc_rows; in fbcon_init()
1100 new_cols /= vc->vc_font.width; in fbcon_init()
1101 new_rows /= vc->vc_font.height; in fbcon_init()
1110 if (con_is_visible(vc) && vc->vc_mode == KD_TEXT) { in fbcon_init()
1139 vc->vc_cols = new_cols; in fbcon_init()
1140 vc->vc_rows = new_rows; in fbcon_init()
1142 vc_resize(vc, new_cols, new_rows); in fbcon_init()
1145 fbcon_prepare_logo(vc, info, cols, rows, new_cols, new_rows); in fbcon_init()
1147 if (ops->rotate_font && ops->rotate_font(info, vc)) { in fbcon_init()
1149 set_blitting_type(vc, info); in fbcon_init()
1163 static void set_vc_hi_font(struct vc_data *vc, bool set);
1186 static void fbcon_deinit(struct vc_data *vc) in fbcon_deinit() argument
1188 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_deinit()
1194 idx = con2fb_map[vc->vc_num]; in fbcon_deinit()
1209 if (con_is_visible(vc)) in fbcon_deinit()
1216 vc->vc_font.data = NULL; in fbcon_deinit()
1218 if (vc->vc_hi_font_mask && vc->vc_screenbuf) in fbcon_deinit()
1219 set_vc_hi_font(vc, false); in fbcon_deinit()
1224 if (vc->vc_num == logo_shown) in fbcon_deinit()
1255 static void __fbcon_clear(struct vc_data *vc, unsigned int sy, unsigned int sx, in __fbcon_clear() argument
1258 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in __fbcon_clear()
1261 struct fbcon_display *p = &fb_display[vc->vc_num]; in __fbcon_clear()
1264 if (fbcon_is_inactive(vc, info)) in __fbcon_clear()
1270 if (sy < vc->vc_top && vc->vc_top == logo_lines) { in __fbcon_clear()
1271 vc->vc_top = 0; in __fbcon_clear()
1278 fbcon_clear_margins(vc, 0); in __fbcon_clear()
1281 fg = get_color(vc, info, vc->vc_video_erase_char, 1); in __fbcon_clear()
1282 bg = get_color(vc, info, vc->vc_video_erase_char, 0); in __fbcon_clear()
1288 ops->clear(vc, info, real_y(p, sy), sx, b, width, fg, bg); in __fbcon_clear()
1289 ops->clear(vc, info, real_y(p, sy + b), sx, height - b, in __fbcon_clear()
1292 ops->clear(vc, info, real_y(p, sy), sx, height, width, fg, bg); in __fbcon_clear()
1295 static void fbcon_clear(struct vc_data *vc, unsigned int sy, unsigned int sx, in fbcon_clear() argument
1298 __fbcon_clear(vc, sy, sx, 1, width); in fbcon_clear()
1301 static void fbcon_putcs(struct vc_data *vc, const u16 *s, unsigned int count, in fbcon_putcs() argument
1304 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_putcs()
1305 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_putcs()
1308 if (!fbcon_is_inactive(vc, info)) in fbcon_putcs()
1309 ops->putcs(vc, info, s, count, real_y(p, ypos), xpos, in fbcon_putcs()
1310 get_color(vc, info, scr_readw(s), 1), in fbcon_putcs()
1311 get_color(vc, info, scr_readw(s), 0)); in fbcon_putcs()
1314 static void fbcon_clear_margins(struct vc_data *vc, int bottom_only) in fbcon_clear_margins() argument
1316 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_clear_margins()
1319 if (!fbcon_is_inactive(vc, info)) in fbcon_clear_margins()
1320 ops->clear_margins(vc, info, margin_color, bottom_only); in fbcon_clear_margins()
1323 static void fbcon_cursor(struct vc_data *vc, bool enable) in fbcon_cursor() argument
1325 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_cursor()
1327 int c = scr_readw((u16 *) vc->vc_pos); in fbcon_cursor()
1329 ops->cur_blink_jiffies = msecs_to_jiffies(vc->vc_cur_blink_ms); in fbcon_cursor()
1331 if (fbcon_is_inactive(vc, info) || vc->vc_deccm != 1) in fbcon_cursor()
1334 if (vc->vc_cursor_type & CUR_SW) in fbcon_cursor()
1344 ops->cursor(vc, info, enable, get_color(vc, info, c, 1), in fbcon_cursor()
1345 get_color(vc, info, c, 0)); in fbcon_cursor()
1356 struct vc_data **default_mode, *vc; in fbcon_set_disp() local
1366 vc = vc_cons[unit].d; in fbcon_set_disp()
1368 if (!vc) in fbcon_set_disp()
1371 default_mode = vc->vc_display_fg; in fbcon_set_disp()
1375 if (!vc->vc_font.data) { in fbcon_set_disp()
1376 vc->vc_font.data = (void *)(p->fontdata = t->fontdata); in fbcon_set_disp()
1377 vc->vc_font.width = (*default_mode)->vc_font.width; in fbcon_set_disp()
1378 vc->vc_font.height = (*default_mode)->vc_font.height; in fbcon_set_disp()
1379 vc->vc_font.charcount = (*default_mode)->vc_font.charcount; in fbcon_set_disp()
1391 vc->vc_can_do_color = (fb_get_color_depth(&info->var, &info->fix)!=1); in fbcon_set_disp()
1392 vc->vc_complement_mask = vc->vc_can_do_color ? 0x7700 : 0x0800; in fbcon_set_disp()
1393 if (vc->vc_font.charcount == 256) { in fbcon_set_disp()
1394 vc->vc_hi_font_mask = 0; in fbcon_set_disp()
1396 vc->vc_hi_font_mask = 0x100; in fbcon_set_disp()
1397 if (vc->vc_can_do_color) in fbcon_set_disp()
1398 vc->vc_complement_mask <<= 1; in fbcon_set_disp()
1403 if (!*vc->uni_pagedict_loc) in fbcon_set_disp()
1404 con_copy_unimap(vc, svc); in fbcon_set_disp()
1408 cols /= vc->vc_font.width; in fbcon_set_disp()
1409 rows /= vc->vc_font.height; in fbcon_set_disp()
1410 vc_resize(vc, cols, rows); in fbcon_set_disp()
1412 if (con_is_visible(vc)) { in fbcon_set_disp()
1413 update_screen(vc); in fbcon_set_disp()
1417 static __inline__ void ywrap_up(struct vc_data *vc, int count) in ywrap_up() argument
1419 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in ywrap_up()
1421 struct fbcon_display *p = &fb_display[vc->vc_num]; in ywrap_up()
1427 ops->var.yoffset = p->yscroll * vc->vc_font.height; in ywrap_up()
1436 static __inline__ void ywrap_down(struct vc_data *vc, int count) in ywrap_down() argument
1438 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in ywrap_down()
1440 struct fbcon_display *p = &fb_display[vc->vc_num]; in ywrap_down()
1446 ops->var.yoffset = p->yscroll * vc->vc_font.height; in ywrap_down()
1455 static __inline__ void ypan_up(struct vc_data *vc, int count) in ypan_up() argument
1457 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in ypan_up()
1458 struct fbcon_display *p = &fb_display[vc->vc_num]; in ypan_up()
1462 if (p->yscroll > p->vrows - vc->vc_rows) { in ypan_up()
1463 ops->bmove(vc, info, p->vrows - vc->vc_rows, in ypan_up()
1464 0, 0, 0, vc->vc_rows, vc->vc_cols); in ypan_up()
1465 p->yscroll -= p->vrows - vc->vc_rows; in ypan_up()
1469 ops->var.yoffset = p->yscroll * vc->vc_font.height; in ypan_up()
1472 fbcon_clear_margins(vc, 1); in ypan_up()
1479 static __inline__ void ypan_up_redraw(struct vc_data *vc, int t, int count) in ypan_up_redraw() argument
1481 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in ypan_up_redraw()
1483 struct fbcon_display *p = &fb_display[vc->vc_num]; in ypan_up_redraw()
1487 if (p->yscroll > p->vrows - vc->vc_rows) { in ypan_up_redraw()
1488 p->yscroll -= p->vrows - vc->vc_rows; in ypan_up_redraw()
1489 fbcon_redraw_move(vc, p, t + count, vc->vc_rows - count, t); in ypan_up_redraw()
1493 ops->var.yoffset = p->yscroll * vc->vc_font.height; in ypan_up_redraw()
1496 fbcon_clear_margins(vc, 1); in ypan_up_redraw()
1503 static __inline__ void ypan_down(struct vc_data *vc, int count) in ypan_down() argument
1505 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in ypan_down()
1506 struct fbcon_display *p = &fb_display[vc->vc_num]; in ypan_down()
1511 ops->bmove(vc, info, 0, 0, p->vrows - vc->vc_rows, in ypan_down()
1512 0, vc->vc_rows, vc->vc_cols); in ypan_down()
1513 p->yscroll += p->vrows - vc->vc_rows; in ypan_down()
1517 ops->var.yoffset = p->yscroll * vc->vc_font.height; in ypan_down()
1520 fbcon_clear_margins(vc, 1); in ypan_down()
1527 static __inline__ void ypan_down_redraw(struct vc_data *vc, int t, int count) in ypan_down_redraw() argument
1529 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in ypan_down_redraw()
1531 struct fbcon_display *p = &fb_display[vc->vc_num]; in ypan_down_redraw()
1536 p->yscroll += p->vrows - vc->vc_rows; in ypan_down_redraw()
1537 fbcon_redraw_move(vc, p, t, vc->vc_rows - count, t + count); in ypan_down_redraw()
1541 ops->var.yoffset = p->yscroll * vc->vc_font.height; in ypan_down_redraw()
1544 fbcon_clear_margins(vc, 1); in ypan_down_redraw()
1551 static void fbcon_redraw_move(struct vc_data *vc, struct fbcon_display *p, in fbcon_redraw_move() argument
1555 (vc->vc_origin + vc->vc_size_row * line); in fbcon_redraw_move()
1569 fbcon_putcs(vc, start, s - start, in fbcon_redraw_move()
1579 fbcon_putcs(vc, start, s - start, dy, x); in fbcon_redraw_move()
1585 static void fbcon_redraw_blit(struct vc_data *vc, struct fb_info *info, in fbcon_redraw_blit() argument
1588 int offset = ycount * vc->vc_cols; in fbcon_redraw_blit()
1590 (vc->vc_origin + vc->vc_size_row * line); in fbcon_redraw_blit()
1605 ops->bmove(vc, info, line + ycount, x, in fbcon_redraw_blit()
1621 ops->bmove(vc, info, line + ycount, x, line, x, 1, in fbcon_redraw_blit()
1629 s -= vc->vc_size_row; in fbcon_redraw_blit()
1630 d -= vc->vc_size_row; in fbcon_redraw_blit()
1635 static void fbcon_redraw(struct vc_data *vc, int line, int count, int offset) in fbcon_redraw() argument
1638 (vc->vc_origin + vc->vc_size_row * line); in fbcon_redraw()
1653 fbcon_putcs(vc, start, s - start, in fbcon_redraw()
1661 fbcon_putcs(vc, start, s - start, in fbcon_redraw()
1676 fbcon_putcs(vc, start, s - start, line, x); in fbcon_redraw()
1683 s -= vc->vc_size_row; in fbcon_redraw()
1684 d -= vc->vc_size_row; in fbcon_redraw()
1689 static void fbcon_bmove_rec(struct vc_data *vc, struct fbcon_display *p, int sy, int sx, in fbcon_bmove_rec() argument
1692 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_bmove_rec()
1699 fbcon_bmove_rec(vc, p, sy, sx, dy, dx, b, width, in fbcon_bmove_rec()
1701 fbcon_bmove_rec(vc, p, sy + b, sx, dy + b, dx, in fbcon_bmove_rec()
1704 fbcon_bmove_rec(vc, p, sy + b, sx, dy + b, dx, in fbcon_bmove_rec()
1706 fbcon_bmove_rec(vc, p, sy, sx, dy, dx, b, width, in fbcon_bmove_rec()
1715 fbcon_bmove_rec(vc, p, sy, sx, dy, dx, b, width, in fbcon_bmove_rec()
1717 fbcon_bmove_rec(vc, p, sy + b, sx, dy + b, dx, in fbcon_bmove_rec()
1720 fbcon_bmove_rec(vc, p, sy + b, sx, dy + b, dx, in fbcon_bmove_rec()
1722 fbcon_bmove_rec(vc, p, sy, sx, dy, dx, b, width, in fbcon_bmove_rec()
1727 ops->bmove(vc, info, real_y(p, sy), sx, real_y(p, dy), dx, in fbcon_bmove_rec()
1731 static void fbcon_bmove(struct vc_data *vc, int sy, int sx, int dy, int dx, in fbcon_bmove() argument
1734 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_bmove()
1735 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_bmove()
1737 if (fbcon_is_inactive(vc, info)) in fbcon_bmove()
1750 fbcon_bmove_rec(vc, p, sy, sx, dy, dx, height, width, in fbcon_bmove()
1754 static bool fbcon_scroll(struct vc_data *vc, unsigned int t, unsigned int b, in fbcon_scroll() argument
1757 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_scroll()
1758 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_scroll()
1761 if (fbcon_is_inactive(vc, info)) in fbcon_scroll()
1764 fbcon_cursor(vc, false); in fbcon_scroll()
1774 if (count > vc->vc_rows) /* Maximum realistic size */ in fbcon_scroll()
1775 count = vc->vc_rows; in fbcon_scroll()
1778 fbcon_redraw_blit(vc, info, p, t, b - t - count, in fbcon_scroll()
1780 __fbcon_clear(vc, b - count, 0, count, vc->vc_cols); in fbcon_scroll()
1781 scr_memsetw((unsigned short *) (vc->vc_origin + in fbcon_scroll()
1782 vc->vc_size_row * in fbcon_scroll()
1784 vc->vc_video_erase_char, in fbcon_scroll()
1785 vc->vc_size_row * count); in fbcon_scroll()
1789 if (b - t - count > 3 * vc->vc_rows >> 2) { in fbcon_scroll()
1791 fbcon_bmove(vc, 0, 0, count, 0, t, in fbcon_scroll()
1792 vc->vc_cols); in fbcon_scroll()
1793 ywrap_up(vc, count); in fbcon_scroll()
1794 if (vc->vc_rows - b > 0) in fbcon_scroll()
1795 fbcon_bmove(vc, b - count, 0, b, 0, in fbcon_scroll()
1796 vc->vc_rows - b, in fbcon_scroll()
1797 vc->vc_cols); in fbcon_scroll()
1799 fbcon_bmove(vc, t + count, 0, t, 0, in fbcon_scroll()
1800 b - t - count, vc->vc_cols); in fbcon_scroll()
1803 __fbcon_clear(vc, b - count, 0, count, vc->vc_cols); in fbcon_scroll()
1808 2 * (p->vrows - vc->vc_rows)) in fbcon_scroll()
1809 && ((!scroll_partial && (b - t == vc->vc_rows)) in fbcon_scroll()
1812 3 * vc->vc_rows >> 2)))) { in fbcon_scroll()
1814 fbcon_redraw_move(vc, p, 0, t, count); in fbcon_scroll()
1815 ypan_up_redraw(vc, t, count); in fbcon_scroll()
1816 if (vc->vc_rows - b > 0) in fbcon_scroll()
1817 fbcon_redraw_move(vc, p, b, in fbcon_scroll()
1818 vc->vc_rows - b, b); in fbcon_scroll()
1820 fbcon_redraw_move(vc, p, t + count, b - t - count, t); in fbcon_scroll()
1821 __fbcon_clear(vc, b - count, 0, count, vc->vc_cols); in fbcon_scroll()
1826 2 * (p->vrows - vc->vc_rows)) in fbcon_scroll()
1827 && ((!scroll_partial && (b - t == vc->vc_rows)) in fbcon_scroll()
1830 3 * vc->vc_rows >> 2)))) { in fbcon_scroll()
1832 fbcon_bmove(vc, 0, 0, count, 0, t, in fbcon_scroll()
1833 vc->vc_cols); in fbcon_scroll()
1834 ypan_up(vc, count); in fbcon_scroll()
1835 if (vc->vc_rows - b > 0) in fbcon_scroll()
1836 fbcon_bmove(vc, b - count, 0, b, 0, in fbcon_scroll()
1837 vc->vc_rows - b, in fbcon_scroll()
1838 vc->vc_cols); in fbcon_scroll()
1840 fbcon_bmove(vc, t + count, 0, t, 0, in fbcon_scroll()
1841 b - t - count, vc->vc_cols); in fbcon_scroll()
1844 __fbcon_clear(vc, b - count, 0, count, vc->vc_cols); in fbcon_scroll()
1849 fbcon_redraw(vc, t, b - t - count, in fbcon_scroll()
1850 count * vc->vc_cols); in fbcon_scroll()
1851 __fbcon_clear(vc, b - count, 0, count, vc->vc_cols); in fbcon_scroll()
1852 scr_memsetw((unsigned short *) (vc->vc_origin + in fbcon_scroll()
1853 vc->vc_size_row * in fbcon_scroll()
1855 vc->vc_video_erase_char, in fbcon_scroll()
1856 vc->vc_size_row * count); in fbcon_scroll()
1862 if (count > vc->vc_rows) /* Maximum realistic size */ in fbcon_scroll()
1863 count = vc->vc_rows; in fbcon_scroll()
1866 fbcon_redraw_blit(vc, info, p, b - 1, b - t - count, in fbcon_scroll()
1868 __fbcon_clear(vc, t, 0, count, vc->vc_cols); in fbcon_scroll()
1869 scr_memsetw((unsigned short *) (vc->vc_origin + in fbcon_scroll()
1870 vc->vc_size_row * in fbcon_scroll()
1872 vc->vc_video_erase_char, in fbcon_scroll()
1873 vc->vc_size_row * count); in fbcon_scroll()
1877 if (b - t - count > 3 * vc->vc_rows >> 2) { in fbcon_scroll()
1878 if (vc->vc_rows - b > 0) in fbcon_scroll()
1879 fbcon_bmove(vc, b, 0, b - count, 0, in fbcon_scroll()
1880 vc->vc_rows - b, in fbcon_scroll()
1881 vc->vc_cols); in fbcon_scroll()
1882 ywrap_down(vc, count); in fbcon_scroll()
1884 fbcon_bmove(vc, count, 0, 0, 0, t, in fbcon_scroll()
1885 vc->vc_cols); in fbcon_scroll()
1887 fbcon_bmove(vc, t, 0, t + count, 0, in fbcon_scroll()
1888 b - t - count, vc->vc_cols); in fbcon_scroll()
1891 __fbcon_clear(vc, t, 0, count, vc->vc_cols); in fbcon_scroll()
1895 if ((count - p->yscroll <= p->vrows - vc->vc_rows) in fbcon_scroll()
1896 && ((!scroll_partial && (b - t == vc->vc_rows)) in fbcon_scroll()
1899 3 * vc->vc_rows >> 2)))) { in fbcon_scroll()
1900 if (vc->vc_rows - b > 0) in fbcon_scroll()
1901 fbcon_bmove(vc, b, 0, b - count, 0, in fbcon_scroll()
1902 vc->vc_rows - b, in fbcon_scroll()
1903 vc->vc_cols); in fbcon_scroll()
1904 ypan_down(vc, count); in fbcon_scroll()
1906 fbcon_bmove(vc, count, 0, 0, 0, t, in fbcon_scroll()
1907 vc->vc_cols); in fbcon_scroll()
1909 fbcon_bmove(vc, t, 0, t + count, 0, in fbcon_scroll()
1910 b - t - count, vc->vc_cols); in fbcon_scroll()
1913 __fbcon_clear(vc, t, 0, count, vc->vc_cols); in fbcon_scroll()
1917 if ((count - p->yscroll <= p->vrows - vc->vc_rows) in fbcon_scroll()
1918 && ((!scroll_partial && (b - t == vc->vc_rows)) in fbcon_scroll()
1921 3 * vc->vc_rows >> 2)))) { in fbcon_scroll()
1922 if (vc->vc_rows - b > 0) in fbcon_scroll()
1923 fbcon_redraw_move(vc, p, b, vc->vc_rows - b, in fbcon_scroll()
1925 ypan_down_redraw(vc, t, count); in fbcon_scroll()
1927 fbcon_redraw_move(vc, p, count, t, 0); in fbcon_scroll()
1929 fbcon_redraw_move(vc, p, t, b - t - count, t + count); in fbcon_scroll()
1930 __fbcon_clear(vc, t, 0, count, vc->vc_cols); in fbcon_scroll()
1935 fbcon_redraw(vc, b - 1, b - t - count, in fbcon_scroll()
1936 -count * vc->vc_cols); in fbcon_scroll()
1937 __fbcon_clear(vc, t, 0, count, vc->vc_cols); in fbcon_scroll()
1938 scr_memsetw((unsigned short *) (vc->vc_origin + in fbcon_scroll()
1939 vc->vc_size_row * in fbcon_scroll()
1941 vc->vc_video_erase_char, in fbcon_scroll()
1942 vc->vc_size_row * count); in fbcon_scroll()
1952 struct vc_data *vc) in updatescrollmode_accel() argument
1965 divides(ypan, vc->vc_font.height) && vyres > yres; in updatescrollmode_accel()
1967 divides(ywrap, vc->vc_font.height) && in updatescrollmode_accel()
1968 divides(vc->vc_font.height, vyres) && in updatescrollmode_accel()
1969 divides(vc->vc_font.height, yres); in updatescrollmode_accel()
1994 struct vc_data *vc) in updatescrollmode() argument
1997 int fh = vc->vc_font.height; in updatescrollmode()
2003 if (yres > (fh * (vc->vc_rows + 1))) in updatescrollmode()
2004 p->vrows -= (yres - (fh * vc->vc_rows)) / fh; in updatescrollmode()
2009 updatescrollmode_accel(p, info, vc); in updatescrollmode()
2015 static int fbcon_resize(struct vc_data *vc, unsigned int width, in fbcon_resize() argument
2018 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_resize()
2020 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_resize()
2024 if (p->userfont && FNTSIZE(vc->vc_font.data)) { in fbcon_resize()
2026 int pitch = PITCH(vc->vc_font.width); in fbcon_resize()
2037 size = CALC_FONTSZ(vc->vc_font.height, pitch, vc->vc_font.charcount); in fbcon_resize()
2038 if (size > FNTSIZE(vc->vc_font.data)) in fbcon_resize()
2044 virt_fw = FBCON_SWAP(ops->rotate, vc->vc_font.width, in fbcon_resize()
2045 vc->vc_font.height); in fbcon_resize()
2046 virt_fh = FBCON_SWAP(ops->rotate, vc->vc_font.height, in fbcon_resize()
2047 vc->vc_font.width); in fbcon_resize()
2067 if (con_is_visible(vc) && vc->vc_mode == KD_TEXT) { in fbcon_resize()
2075 updatescrollmode(p, info, vc); in fbcon_resize()
2079 static bool fbcon_switch(struct vc_data *vc) in fbcon_switch() argument
2083 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_switch()
2087 info = fbcon_info_from_console(vc->vc_num); in fbcon_switch()
2114 o->currcon = vc->vc_num; in fbcon_switch()
2145 if (fbcon_is_inactive(vc, info) || in fbcon_switch()
2151 set_blitting_type(vc, info); in fbcon_switch()
2154 if (ops->rotate_font && ops->rotate_font(info, vc)) { in fbcon_switch()
2156 set_blitting_type(vc, info); in fbcon_switch()
2159 vc->vc_can_do_color = (fb_get_color_depth(&info->var, &info->fix)!=1); in fbcon_switch()
2160 vc->vc_complement_mask = vc->vc_can_do_color ? 0x7700 : 0x0800; in fbcon_switch()
2162 if (vc->vc_font.charcount > 256) in fbcon_switch()
2163 vc->vc_complement_mask <<= 1; in fbcon_switch()
2165 updatescrollmode(p, info, vc); in fbcon_switch()
2169 scrollback_phys_max = p->vrows - vc->vc_rows; in fbcon_switch()
2173 scrollback_phys_max = p->vrows - 2 * vc->vc_rows; in fbcon_switch()
2185 if (!fbcon_is_inactive(vc, info)) { in fbcon_switch()
2190 fbcon_set_palette(vc, color_table); in fbcon_switch()
2191 fbcon_clear_margins(vc, 0); in fbcon_switch()
2197 update_region(vc, in fbcon_switch()
2198 vc->vc_origin + vc->vc_size_row * vc->vc_top, in fbcon_switch()
2199 vc->vc_size_row * (vc->vc_bottom - in fbcon_switch()
2200 vc->vc_top) / 2); in fbcon_switch()
2206 static void fbcon_generic_blank(struct vc_data *vc, struct fb_info *info, in fbcon_generic_blank() argument
2210 unsigned short charmask = vc->vc_hi_font_mask ? in fbcon_generic_blank()
2214 oldc = vc->vc_video_erase_char; in fbcon_generic_blank()
2215 vc->vc_video_erase_char &= charmask; in fbcon_generic_blank()
2216 __fbcon_clear(vc, 0, 0, vc->vc_rows, vc->vc_cols); in fbcon_generic_blank()
2217 vc->vc_video_erase_char = oldc; in fbcon_generic_blank()
2221 static bool fbcon_blank(struct vc_data *vc, enum vesa_blank_mode blank, in fbcon_blank() argument
2224 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_blank()
2241 if (!fbcon_is_inactive(vc, info)) { in fbcon_blank()
2244 fbcon_cursor(vc, !blank); in fbcon_blank()
2248 fbcon_generic_blank(vc, info, blank); in fbcon_blank()
2252 update_screen(vc); in fbcon_blank()
2255 if (mode_switch || fbcon_is_inactive(vc, info) || in fbcon_blank()
2264 static void fbcon_debug_enter(struct vc_data *vc) in fbcon_debug_enter() argument
2266 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_debug_enter()
2273 fbcon_set_palette(vc, color_table); in fbcon_debug_enter()
2276 static void fbcon_debug_leave(struct vc_data *vc) in fbcon_debug_leave() argument
2278 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_debug_leave()
2286 static int fbcon_get_font(struct vc_data *vc, struct console_font *font, unsigned int vpitch) in fbcon_get_font() argument
2288 u8 *fontdata = vc->vc_font.data; in fbcon_get_font()
2292 font->width = vc->vc_font.width; in fbcon_get_font()
2293 font->height = vc->vc_font.height; in fbcon_get_font()
2296 font->charcount = vc->vc_hi_font_mask ? 512 : 256; in fbcon_get_font()
2301 j = vc->vc_font.height; in fbcon_get_font()
2312 j = vc->vc_font.height * 2; in fbcon_get_font()
2323 if (font->charcount * (vc->vc_font.height * sizeof(u32)) > FNTSIZE(fontdata)) in fbcon_get_font()
2327 for (j = 0; j < vc->vc_font.height; j++) { in fbcon_get_font()
2337 j = vc->vc_font.height * 4; in fbcon_get_font()
2352 static void set_vc_hi_font(struct vc_data *vc, bool set) in set_vc_hi_font() argument
2355 vc->vc_hi_font_mask = 0; in set_vc_hi_font()
2356 if (vc->vc_can_do_color) { in set_vc_hi_font()
2357 vc->vc_complement_mask >>= 1; in set_vc_hi_font()
2358 vc->vc_s_complement_mask >>= 1; in set_vc_hi_font()
2362 if (vc->vc_can_do_color) { in set_vc_hi_font()
2364 (unsigned short *) vc->vc_origin; in set_vc_hi_font()
2365 int count = vc->vc_screenbuf_size / 2; in set_vc_hi_font()
2372 c = vc->vc_video_erase_char; in set_vc_hi_font()
2373 vc->vc_video_erase_char = in set_vc_hi_font()
2375 vc->vc_attr >>= 1; in set_vc_hi_font()
2378 vc->vc_hi_font_mask = 0x100; in set_vc_hi_font()
2379 if (vc->vc_can_do_color) { in set_vc_hi_font()
2380 vc->vc_complement_mask <<= 1; in set_vc_hi_font()
2381 vc->vc_s_complement_mask <<= 1; in set_vc_hi_font()
2387 (unsigned short *) vc->vc_origin; in set_vc_hi_font()
2388 int count = vc->vc_screenbuf_size / 2; in set_vc_hi_font()
2393 if (vc->vc_can_do_color) in set_vc_hi_font()
2401 c = vc->vc_video_erase_char; in set_vc_hi_font()
2402 if (vc->vc_can_do_color) { in set_vc_hi_font()
2403 vc->vc_video_erase_char = in set_vc_hi_font()
2405 vc->vc_attr <<= 1; in set_vc_hi_font()
2407 vc->vc_video_erase_char = c & ~0x100; in set_vc_hi_font()
2412 static int fbcon_do_set_font(struct vc_data *vc, int w, int h, int charcount, in fbcon_do_set_font() argument
2415 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_do_set_font()
2417 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_do_set_font()
2419 u8 *old_data = vc->vc_font.data; in fbcon_do_set_font()
2421 resize = (w != vc->vc_font.width) || (h != vc->vc_font.height); in fbcon_do_set_font()
2422 vc->vc_font.data = (void *)(p->fontdata = data); in fbcon_do_set_font()
2427 old_width = vc->vc_font.width; in fbcon_do_set_font()
2428 old_height = vc->vc_font.height; in fbcon_do_set_font()
2429 old_charcount = vc->vc_font.charcount; in fbcon_do_set_font()
2431 vc->vc_font.width = w; in fbcon_do_set_font()
2432 vc->vc_font.height = h; in fbcon_do_set_font()
2433 vc->vc_font.charcount = charcount; in fbcon_do_set_font()
2434 if (vc->vc_hi_font_mask && charcount == 256) in fbcon_do_set_font()
2435 set_vc_hi_font(vc, false); in fbcon_do_set_font()
2436 else if (!vc->vc_hi_font_mask && charcount == 512) in fbcon_do_set_font()
2437 set_vc_hi_font(vc, true); in fbcon_do_set_font()
2446 ret = vc_resize(vc, cols, rows); in fbcon_do_set_font()
2449 } else if (con_is_visible(vc) in fbcon_do_set_font()
2450 && vc->vc_mode == KD_TEXT) { in fbcon_do_set_font()
2451 fbcon_clear_margins(vc, 0); in fbcon_do_set_font()
2452 update_screen(vc); in fbcon_do_set_font()
2461 vc->vc_font.data = old_data; in fbcon_do_set_font()
2469 vc->vc_font.width = old_width; in fbcon_do_set_font()
2470 vc->vc_font.height = old_height; in fbcon_do_set_font()
2471 vc->vc_font.charcount = old_charcount; in fbcon_do_set_font()
2481 static int fbcon_set_font(struct vc_data *vc, const struct console_font *font, in fbcon_set_font() argument
2484 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_set_font()
2551 return fbcon_do_set_font(vc, font->width, font->height, charcount, new_data, 1); in fbcon_set_font()
2554 static int fbcon_set_def_font(struct vc_data *vc, struct console_font *font, in fbcon_set_def_font() argument
2557 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_set_def_font()
2568 return fbcon_do_set_font(vc, f->width, f->height, f->charcount, f->data, 0); in fbcon_set_def_font()
2579 static void fbcon_set_palette(struct vc_data *vc, const unsigned char *table) in fbcon_set_palette() argument
2581 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_set_palette()
2585 if (fbcon_is_inactive(vc, info)) in fbcon_set_palette()
2588 if (!con_is_visible(vc)) in fbcon_set_palette()
2595 val = vc->vc_palette[j++]; in fbcon_set_palette()
2597 val = vc->vc_palette[j++]; in fbcon_set_palette()
2599 val = vc->vc_palette[j++]; in fbcon_set_palette()
2616 static void fbcon_invert_region(struct vc_data *vc, u16 * p, int cnt) in fbcon_invert_region() argument
2620 if (!vc->vc_can_do_color) in fbcon_invert_region()
2622 else if (vc->vc_hi_font_mask == 0x100) in fbcon_invert_region()
2634 struct vc_data *vc = NULL; in fbcon_suspended() local
2639 vc = vc_cons[ops->currcon].d; in fbcon_suspended()
2642 fbcon_cursor(vc, false); in fbcon_suspended()
2647 struct vc_data *vc; in fbcon_resumed() local
2652 vc = vc_cons[ops->currcon].d; in fbcon_resumed()
2654 update_screen(vc); in fbcon_resumed()
2660 struct vc_data *vc; in fbcon_modechanged() local
2666 vc = vc_cons[ops->currcon].d; in fbcon_modechanged()
2667 if (vc->vc_mode != KD_TEXT || in fbcon_modechanged()
2671 p = &fb_display[vc->vc_num]; in fbcon_modechanged()
2672 set_blitting_type(vc, info); in fbcon_modechanged()
2674 if (con_is_visible(vc)) { in fbcon_modechanged()
2678 cols /= vc->vc_font.width; in fbcon_modechanged()
2679 rows /= vc->vc_font.height; in fbcon_modechanged()
2680 vc_resize(vc, cols, rows); in fbcon_modechanged()
2681 updatescrollmode(p, info, vc); in fbcon_modechanged()
2685 if (!fbcon_is_inactive(vc, info)) { in fbcon_modechanged()
2690 fbcon_set_palette(vc, color_table); in fbcon_modechanged()
2691 update_screen(vc); in fbcon_modechanged()
2698 struct vc_data *vc; in fbcon_set_all_vcs() local
2706 vc = vc_cons[i].d; in fbcon_set_all_vcs()
2707 if (!vc || vc->vc_mode != KD_TEXT || in fbcon_set_all_vcs()
2711 if (con_is_visible(vc)) { in fbcon_set_all_vcs()
2716 p = &fb_display[vc->vc_num]; in fbcon_set_all_vcs()
2717 set_blitting_type(vc, info); in fbcon_set_all_vcs()
2721 cols /= vc->vc_font.width; in fbcon_set_all_vcs()
2722 rows /= vc->vc_font.height; in fbcon_set_all_vcs()
2723 vc_resize(vc, cols, rows); in fbcon_set_all_vcs()
2744 struct vc_data *vc; in fbcon_modechange_possible() local
2754 vc = vc_cons[i].d; in fbcon_modechange_possible()
2755 if (!vc || vc->vc_mode != KD_TEXT || in fbcon_modechange_possible()
2759 if (vc->vc_font.width > FBCON_SWAP(var->rotate, var->xres, var->yres) || in fbcon_modechange_possible()
2760 vc->vc_font.height > FBCON_SWAP(var->rotate, var->yres, var->xres)) in fbcon_modechange_possible()
3022 struct vc_data *vc; in fbcon_fb_blanked() local
3027 vc = vc_cons[ops->currcon].d; in fbcon_fb_blanked()
3028 if (vc->vc_mode != KD_TEXT || in fbcon_fb_blanked()
3032 if (con_is_visible(vc)) { in fbcon_fb_blanked()
3044 struct vc_data *vc; in fbcon_new_modelist() local
3053 vc = vc_cons[i].d; in fbcon_new_modelist()
3058 fbcon_set_disp(info, &var, vc->vc_num); in fbcon_new_modelist()
3065 struct vc_data *vc; in fbcon_get_requirement() local
3071 vc = vc_cons[i].d; in fbcon_get_requirement()
3072 if (vc && vc->vc_mode == KD_TEXT && in fbcon_get_requirement()
3074 set_bit(vc->vc_font.width - 1, caps->x); in fbcon_get_requirement()
3075 set_bit(vc->vc_font.height - 1, caps->y); in fbcon_get_requirement()
3076 charcnt = vc->vc_font.charcount; in fbcon_get_requirement()
3082 vc = vc_cons[fg_console].d; in fbcon_get_requirement()
3084 if (vc && vc->vc_mode == KD_TEXT && in fbcon_get_requirement()
3087 set_bit(vc->vc_font.width - 1, caps->x); in fbcon_get_requirement()
3089 set_bit(vc->vc_font.height - 1, caps->y); in fbcon_get_requirement()
3090 caps->len = vc->vc_font.charcount; in fbcon_get_requirement()