Lines Matching full:vc

168 #define advance_row(p, delta) (unsigned short *)((unsigned long)(p) + (delta) * vc->vc_size_row)
178 static void fbcon_clear_margins(struct vc_data *vc, int bottom_only);
179 static void fbcon_set_palette(struct vc_data *vc, const unsigned char *table);
186 static void fbcon_redraw_move(struct vc_data *vc, struct fbcon_display *p,
230 struct vc_data *vc; in fbcon_rotate_all() local
238 vc = vc_cons[i].d; in fbcon_rotate_all()
239 if (!vc || vc->vc_mode != KD_TEXT || in fbcon_rotate_all()
243 p = &fb_display[vc->vc_num]; in fbcon_rotate_all()
287 static inline int fbcon_is_inactive(struct vc_data *vc, struct fb_info *info) in fbcon_is_inactive() argument
292 vc->vc_mode != KD_TEXT || ops->graphics || fbcon_skip_panic(info)); in fbcon_is_inactive()
295 static int get_color(struct vc_data *vc, struct fb_info *info, in get_color() argument
302 unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff; in get_color()
304 c = vc->vc_video_erase_char & charmask; in get_color()
308 color = (is_fg) ? attr_fgcol((vc->vc_hi_font_mask) ? 9 : 8, c) in get_color()
309 : attr_bgcol((vc->vc_hi_font_mask) ? 13 : 12, c); in get_color()
366 struct vc_data *vc = NULL; in fb_flashcursor() local
382 vc = vc_cons[ops->currcon].d; in fb_flashcursor()
384 if (!vc || !con_is_visible(vc) || in fb_flashcursor()
385 fbcon_info_from_console(vc->vc_num) != info || in fb_flashcursor()
386 vc->vc_deccm != 1) { in fb_flashcursor()
391 c = scr_readw((u16 *) vc->vc_pos); in fb_flashcursor()
393 ops->cursor(vc, info, enable, get_color(vc, info, c, 1), in fb_flashcursor()
394 get_color(vc, info, c, 0)); in fb_flashcursor()
452 if (!strncmp(options, "vc:", 3)) { in fb_console_setup()
564 static void fbcon_prepare_logo(struct vc_data *vc, struct fb_info *info, in fbcon_prepare_logo() argument
570 static void fbcon_prepare_logo(struct vc_data *vc, struct fb_info *info, in fbcon_prepare_logo() argument
575 int cnt, erase = vc->vc_video_erase_char, step; in fbcon_prepare_logo()
591 logo_lines = DIV_ROUND_UP(logo_height, vc->vc_font.height); in fbcon_prepare_logo()
592 q = (unsigned short *) (vc->vc_origin + in fbcon_prepare_logo()
593 vc->vc_size_row * rows); in fbcon_prepare_logo()
596 if (scr_readw(r) != vc->vc_video_erase_char) in fbcon_prepare_logo()
614 scr_memcpyw(r + step, r, vc->vc_size_row); in fbcon_prepare_logo()
619 if (vc->state.y + logo_lines >= rows) in fbcon_prepare_logo()
620 lines = rows - vc->state.y - 1; in fbcon_prepare_logo()
623 vc->state.y += lines; in fbcon_prepare_logo()
624 vc->vc_pos += lines * vc->vc_size_row; in fbcon_prepare_logo()
627 scr_memsetw((unsigned short *) vc->vc_origin, in fbcon_prepare_logo()
629 vc->vc_size_row * logo_lines); in fbcon_prepare_logo()
631 if (con_is_visible(vc) && vc->vc_mode == KD_TEXT) { in fbcon_prepare_logo()
632 fbcon_clear_margins(vc, 0); in fbcon_prepare_logo()
633 update_screen(vc); in fbcon_prepare_logo()
637 q = (unsigned short *) (vc->vc_origin + in fbcon_prepare_logo()
638 vc->vc_size_row * in fbcon_prepare_logo()
641 vc->state.y += logo_lines; in fbcon_prepare_logo()
642 vc->vc_pos += logo_lines * vc->vc_size_row; in fbcon_prepare_logo()
649 if (logo_lines > vc->vc_bottom) { in fbcon_prepare_logo()
654 vc->vc_top = logo_lines; in fbcon_prepare_logo()
660 static void set_blitting_type(struct vc_data *vc, struct fb_info *info) in set_blitting_type() argument
664 ops->p = &fb_display[vc->vc_num]; in set_blitting_type()
667 fbcon_set_tileops(vc, info); in set_blitting_type()
685 static void set_blitting_type(struct vc_data *vc, struct fb_info *info) in set_blitting_type() argument
690 ops->p = &fb_display[vc->vc_num]; in set_blitting_type()
754 static int con2fb_acquire_newinfo(struct vc_data *vc, struct fb_info *info, in con2fb_acquire_newinfo() argument
763 if (vc) in con2fb_acquire_newinfo()
764 set_blitting_type(vc, info); in con2fb_acquire_newinfo()
769 static void con2fb_release_oldinfo(struct vc_data *vc, struct fb_info *oldinfo, in con2fb_release_oldinfo() argument
793 static void con2fb_init_display(struct vc_data *vc, struct fb_info *info, in con2fb_init_display() argument
840 struct vc_data *vc = vc_cons[unit].d; in set_con2fb_map() local
863 err = con2fb_acquire_newinfo(vc, info, unit); in set_con2fb_map()
868 } else if (vc) { in set_con2fb_map()
869 set_blitting_type(vc, info); in set_con2fb_map()
879 con2fb_release_oldinfo(vc, oldinfo, info); in set_con2fb_map()
885 con2fb_init_display(vc, info, unit, show_logo); in set_con2fb_map()
944 struct vc_data *vc = vc_cons[fg_console].d; in fbcon_startup() local
978 set_blitting_type(vc, info); in fbcon_startup()
987 vc->vc_font.width = font->width; in fbcon_startup()
988 vc->vc_font.height = font->height; in fbcon_startup()
989 vc->vc_font.data = (void *)(p->fontdata = font->data); in fbcon_startup()
990 vc->vc_font.charcount = font->charcount; in fbcon_startup()
995 cols /= vc->vc_font.width; in fbcon_startup()
996 rows /= vc->vc_font.height; in fbcon_startup()
997 vc_resize(vc, cols, rows); in fbcon_startup()
1009 static void fbcon_init(struct vc_data *vc, bool init) in fbcon_init() argument
1013 struct vc_data **default_mode = vc->vc_display_fg; in fbcon_init()
1015 struct fbcon_display *t, *p = &fb_display[vc->vc_num]; in fbcon_init()
1022 if (con2fb_map[vc->vc_num] == -1) in fbcon_init()
1023 con2fb_map[vc->vc_num] = info_idx; in fbcon_init()
1025 info = fbcon_info_from_console(vc->vc_num); in fbcon_init()
1030 if (vc != svc || logo_shown == FBCON_LOGO_DONTSHOW || in fbcon_init()
1038 con2fb_acquire_newinfo(vc, info, vc->vc_num); in fbcon_init()
1047 vc->vc_font.data = (void *)(p->fontdata = in fbcon_init()
1049 vc->vc_font.width = fvc->vc_font.width; in fbcon_init()
1050 vc->vc_font.height = fvc->vc_font.height; in fbcon_init()
1051 vc->vc_font.charcount = fvc->vc_font.charcount; in fbcon_init()
1064 vc->vc_font.width = font->width; in fbcon_init()
1065 vc->vc_font.height = font->height; in fbcon_init()
1066 vc->vc_font.data = (void *)(p->fontdata = font->data); in fbcon_init()
1067 vc->vc_font.charcount = font->charcount; in fbcon_init()
1071 vc->vc_can_do_color = (fb_get_color_depth(&info->var, &info->fix)!=1); in fbcon_init()
1072 vc->vc_complement_mask = vc->vc_can_do_color ? 0x7700 : 0x0800; in fbcon_init()
1073 if (vc->vc_font.charcount == 256) { in fbcon_init()
1074 vc->vc_hi_font_mask = 0; in fbcon_init()
1076 vc->vc_hi_font_mask = 0x100; in fbcon_init()
1077 if (vc->vc_can_do_color) in fbcon_init()
1078 vc->vc_complement_mask <<= 1; in fbcon_init()
1083 if (!*vc->uni_pagedict_loc) in fbcon_init()
1084 con_copy_unimap(vc, svc); in fbcon_init()
1087 ops->cur_blink_jiffies = msecs_to_jiffies(vc->vc_cur_blink_ms); in fbcon_init()
1095 set_blitting_type(vc, info); in fbcon_init()
1097 cols = vc->vc_cols; in fbcon_init()
1098 rows = vc->vc_rows; in fbcon_init()
1101 new_cols /= vc->vc_font.width; in fbcon_init()
1102 new_rows /= vc->vc_font.height; in fbcon_init()
1111 if (con_is_visible(vc) && vc->vc_mode == KD_TEXT) { in fbcon_init()
1140 vc->vc_cols = new_cols; in fbcon_init()
1141 vc->vc_rows = new_rows; in fbcon_init()
1143 vc_resize(vc, new_cols, new_rows); in fbcon_init()
1146 fbcon_prepare_logo(vc, info, cols, rows, new_cols, new_rows); in fbcon_init()
1148 if (ops->rotate_font && ops->rotate_font(info, vc)) { in fbcon_init()
1150 set_blitting_type(vc, info); in fbcon_init()
1164 static void set_vc_hi_font(struct vc_data *vc, bool set);
1187 static void fbcon_deinit(struct vc_data *vc) in fbcon_deinit() argument
1189 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_deinit()
1195 idx = con2fb_map[vc->vc_num]; in fbcon_deinit()
1210 if (con_is_visible(vc)) in fbcon_deinit()
1217 vc->vc_font.data = NULL; in fbcon_deinit()
1219 if (vc->vc_hi_font_mask && vc->vc_screenbuf) in fbcon_deinit()
1220 set_vc_hi_font(vc, false); in fbcon_deinit()
1225 if (vc->vc_num == logo_shown) in fbcon_deinit()
1256 static void __fbcon_clear(struct vc_data *vc, unsigned int sy, unsigned int sx, in __fbcon_clear() argument
1259 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in __fbcon_clear()
1262 struct fbcon_display *p = &fb_display[vc->vc_num]; in __fbcon_clear()
1265 if (fbcon_is_inactive(vc, info)) in __fbcon_clear()
1271 if (sy < vc->vc_top && vc->vc_top == logo_lines) { in __fbcon_clear()
1272 vc->vc_top = 0; in __fbcon_clear()
1279 fbcon_clear_margins(vc, 0); in __fbcon_clear()
1287 ops->clear(vc, info, real_y(p, sy), sx, b, width); in __fbcon_clear()
1288 ops->clear(vc, info, real_y(p, sy + b), sx, height - b, in __fbcon_clear()
1291 ops->clear(vc, info, real_y(p, sy), sx, height, width); in __fbcon_clear()
1294 static void fbcon_clear(struct vc_data *vc, unsigned int sy, unsigned int sx, in fbcon_clear() argument
1297 __fbcon_clear(vc, sy, sx, 1, width); in fbcon_clear()
1300 static void fbcon_putcs(struct vc_data *vc, const u16 *s, unsigned int count, in fbcon_putcs() argument
1303 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_putcs()
1304 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_putcs()
1307 if (!fbcon_is_inactive(vc, info)) in fbcon_putcs()
1308 ops->putcs(vc, info, s, count, real_y(p, ypos), xpos, in fbcon_putcs()
1309 get_color(vc, info, scr_readw(s), 1), in fbcon_putcs()
1310 get_color(vc, info, scr_readw(s), 0)); in fbcon_putcs()
1313 static void fbcon_clear_margins(struct vc_data *vc, int bottom_only) in fbcon_clear_margins() argument
1315 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_clear_margins()
1318 if (!fbcon_is_inactive(vc, info)) in fbcon_clear_margins()
1319 ops->clear_margins(vc, info, margin_color, bottom_only); in fbcon_clear_margins()
1322 static void fbcon_cursor(struct vc_data *vc, bool enable) in fbcon_cursor() argument
1324 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_cursor()
1326 int c = scr_readw((u16 *) vc->vc_pos); in fbcon_cursor()
1328 ops->cur_blink_jiffies = msecs_to_jiffies(vc->vc_cur_blink_ms); in fbcon_cursor()
1330 if (fbcon_is_inactive(vc, info) || vc->vc_deccm != 1) in fbcon_cursor()
1333 if (vc->vc_cursor_type & CUR_SW) in fbcon_cursor()
1343 ops->cursor(vc, info, enable, get_color(vc, info, c, 1), in fbcon_cursor()
1344 get_color(vc, info, c, 0)); in fbcon_cursor()
1355 struct vc_data **default_mode, *vc; in fbcon_set_disp() local
1365 vc = vc_cons[unit].d; in fbcon_set_disp()
1367 if (!vc) in fbcon_set_disp()
1370 default_mode = vc->vc_display_fg; in fbcon_set_disp()
1374 if (!vc->vc_font.data) { in fbcon_set_disp()
1375 vc->vc_font.data = (void *)(p->fontdata = t->fontdata); in fbcon_set_disp()
1376 vc->vc_font.width = (*default_mode)->vc_font.width; in fbcon_set_disp()
1377 vc->vc_font.height = (*default_mode)->vc_font.height; in fbcon_set_disp()
1378 vc->vc_font.charcount = (*default_mode)->vc_font.charcount; in fbcon_set_disp()
1390 vc->vc_can_do_color = (fb_get_color_depth(&info->var, &info->fix)!=1); in fbcon_set_disp()
1391 vc->vc_complement_mask = vc->vc_can_do_color ? 0x7700 : 0x0800; in fbcon_set_disp()
1392 if (vc->vc_font.charcount == 256) { in fbcon_set_disp()
1393 vc->vc_hi_font_mask = 0; in fbcon_set_disp()
1395 vc->vc_hi_font_mask = 0x100; in fbcon_set_disp()
1396 if (vc->vc_can_do_color) in fbcon_set_disp()
1397 vc->vc_complement_mask <<= 1; in fbcon_set_disp()
1402 if (!*vc->uni_pagedict_loc) in fbcon_set_disp()
1403 con_copy_unimap(vc, svc); in fbcon_set_disp()
1407 cols /= vc->vc_font.width; in fbcon_set_disp()
1408 rows /= vc->vc_font.height; in fbcon_set_disp()
1409 vc_resize(vc, cols, rows); in fbcon_set_disp()
1411 if (con_is_visible(vc)) { in fbcon_set_disp()
1412 update_screen(vc); in fbcon_set_disp()
1416 static __inline__ void ywrap_up(struct vc_data *vc, int count) in ywrap_up() argument
1418 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in ywrap_up()
1420 struct fbcon_display *p = &fb_display[vc->vc_num]; in ywrap_up()
1426 ops->var.yoffset = p->yscroll * vc->vc_font.height; in ywrap_up()
1435 static __inline__ void ywrap_down(struct vc_data *vc, int count) in ywrap_down() argument
1437 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in ywrap_down()
1439 struct fbcon_display *p = &fb_display[vc->vc_num]; in ywrap_down()
1445 ops->var.yoffset = p->yscroll * vc->vc_font.height; in ywrap_down()
1454 static __inline__ void ypan_up(struct vc_data *vc, int count) in ypan_up() argument
1456 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in ypan_up()
1457 struct fbcon_display *p = &fb_display[vc->vc_num]; in ypan_up()
1461 if (p->yscroll > p->vrows - vc->vc_rows) { in ypan_up()
1462 ops->bmove(vc, info, p->vrows - vc->vc_rows, in ypan_up()
1463 0, 0, 0, vc->vc_rows, vc->vc_cols); in ypan_up()
1464 p->yscroll -= p->vrows - vc->vc_rows; in ypan_up()
1468 ops->var.yoffset = p->yscroll * vc->vc_font.height; in ypan_up()
1471 fbcon_clear_margins(vc, 1); in ypan_up()
1478 static __inline__ void ypan_up_redraw(struct vc_data *vc, int t, int count) in ypan_up_redraw() argument
1480 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in ypan_up_redraw()
1482 struct fbcon_display *p = &fb_display[vc->vc_num]; in ypan_up_redraw()
1486 if (p->yscroll > p->vrows - vc->vc_rows) { in ypan_up_redraw()
1487 p->yscroll -= p->vrows - vc->vc_rows; in ypan_up_redraw()
1488 fbcon_redraw_move(vc, p, t + count, vc->vc_rows - count, t); in ypan_up_redraw()
1492 ops->var.yoffset = p->yscroll * vc->vc_font.height; in ypan_up_redraw()
1495 fbcon_clear_margins(vc, 1); in ypan_up_redraw()
1502 static __inline__ void ypan_down(struct vc_data *vc, int count) in ypan_down() argument
1504 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in ypan_down()
1505 struct fbcon_display *p = &fb_display[vc->vc_num]; in ypan_down()
1510 ops->bmove(vc, info, 0, 0, p->vrows - vc->vc_rows, in ypan_down()
1511 0, vc->vc_rows, vc->vc_cols); in ypan_down()
1512 p->yscroll += p->vrows - vc->vc_rows; in ypan_down()
1516 ops->var.yoffset = p->yscroll * vc->vc_font.height; in ypan_down()
1519 fbcon_clear_margins(vc, 1); in ypan_down()
1526 static __inline__ void ypan_down_redraw(struct vc_data *vc, int t, int count) in ypan_down_redraw() argument
1528 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in ypan_down_redraw()
1530 struct fbcon_display *p = &fb_display[vc->vc_num]; in ypan_down_redraw()
1535 p->yscroll += p->vrows - vc->vc_rows; in ypan_down_redraw()
1536 fbcon_redraw_move(vc, p, t, vc->vc_rows - count, t + count); in ypan_down_redraw()
1540 ops->var.yoffset = p->yscroll * vc->vc_font.height; in ypan_down_redraw()
1543 fbcon_clear_margins(vc, 1); in ypan_down_redraw()
1550 static void fbcon_redraw_move(struct vc_data *vc, struct fbcon_display *p, in fbcon_redraw_move() argument
1554 (vc->vc_origin + vc->vc_size_row * line); in fbcon_redraw_move()
1568 fbcon_putcs(vc, start, s - start, in fbcon_redraw_move()
1578 fbcon_putcs(vc, start, s - start, dy, x); in fbcon_redraw_move()
1584 static void fbcon_redraw_blit(struct vc_data *vc, struct fb_info *info, in fbcon_redraw_blit() argument
1587 int offset = ycount * vc->vc_cols; in fbcon_redraw_blit()
1589 (vc->vc_origin + vc->vc_size_row * line); in fbcon_redraw_blit()
1604 ops->bmove(vc, info, line + ycount, x, in fbcon_redraw_blit()
1620 ops->bmove(vc, info, line + ycount, x, line, x, 1, in fbcon_redraw_blit()
1628 s -= vc->vc_size_row; in fbcon_redraw_blit()
1629 d -= vc->vc_size_row; in fbcon_redraw_blit()
1634 static void fbcon_redraw(struct vc_data *vc, int line, int count, int offset) in fbcon_redraw() argument
1637 (vc->vc_origin + vc->vc_size_row * line); in fbcon_redraw()
1652 fbcon_putcs(vc, start, s - start, in fbcon_redraw()
1660 fbcon_putcs(vc, start, s - start, in fbcon_redraw()
1675 fbcon_putcs(vc, start, s - start, line, x); in fbcon_redraw()
1682 s -= vc->vc_size_row; in fbcon_redraw()
1683 d -= vc->vc_size_row; in fbcon_redraw()
1688 static void fbcon_bmove_rec(struct vc_data *vc, struct fbcon_display *p, int sy, int sx, in fbcon_bmove_rec() argument
1691 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_bmove_rec()
1698 fbcon_bmove_rec(vc, p, sy, sx, dy, dx, b, width, in fbcon_bmove_rec()
1700 fbcon_bmove_rec(vc, p, sy + b, sx, dy + b, dx, in fbcon_bmove_rec()
1703 fbcon_bmove_rec(vc, p, sy + b, sx, dy + b, dx, in fbcon_bmove_rec()
1705 fbcon_bmove_rec(vc, p, sy, sx, dy, dx, b, width, in fbcon_bmove_rec()
1714 fbcon_bmove_rec(vc, p, sy, sx, dy, dx, b, width, in fbcon_bmove_rec()
1716 fbcon_bmove_rec(vc, p, sy + b, sx, dy + b, dx, in fbcon_bmove_rec()
1719 fbcon_bmove_rec(vc, p, sy + b, sx, dy + b, dx, in fbcon_bmove_rec()
1721 fbcon_bmove_rec(vc, p, sy, sx, dy, dx, b, width, in fbcon_bmove_rec()
1726 ops->bmove(vc, info, real_y(p, sy), sx, real_y(p, dy), dx, in fbcon_bmove_rec()
1730 static void fbcon_bmove(struct vc_data *vc, int sy, int sx, int dy, int dx, in fbcon_bmove() argument
1733 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_bmove()
1734 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_bmove()
1736 if (fbcon_is_inactive(vc, info)) in fbcon_bmove()
1749 fbcon_bmove_rec(vc, p, sy, sx, dy, dx, height, width, in fbcon_bmove()
1753 static bool fbcon_scroll(struct vc_data *vc, unsigned int t, unsigned int b, in fbcon_scroll() argument
1756 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_scroll()
1757 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_scroll()
1760 if (fbcon_is_inactive(vc, info)) in fbcon_scroll()
1763 fbcon_cursor(vc, false); in fbcon_scroll()
1773 if (count > vc->vc_rows) /* Maximum realistic size */ in fbcon_scroll()
1774 count = vc->vc_rows; in fbcon_scroll()
1777 fbcon_redraw_blit(vc, info, p, t, b - t - count, in fbcon_scroll()
1779 __fbcon_clear(vc, b - count, 0, count, vc->vc_cols); in fbcon_scroll()
1780 scr_memsetw((unsigned short *) (vc->vc_origin + in fbcon_scroll()
1781 vc->vc_size_row * in fbcon_scroll()
1783 vc->vc_video_erase_char, in fbcon_scroll()
1784 vc->vc_size_row * count); in fbcon_scroll()
1788 if (b - t - count > 3 * vc->vc_rows >> 2) { in fbcon_scroll()
1790 fbcon_bmove(vc, 0, 0, count, 0, t, in fbcon_scroll()
1791 vc->vc_cols); in fbcon_scroll()
1792 ywrap_up(vc, count); in fbcon_scroll()
1793 if (vc->vc_rows - b > 0) in fbcon_scroll()
1794 fbcon_bmove(vc, b - count, 0, b, 0, in fbcon_scroll()
1795 vc->vc_rows - b, in fbcon_scroll()
1796 vc->vc_cols); in fbcon_scroll()
1798 fbcon_bmove(vc, t + count, 0, t, 0, in fbcon_scroll()
1799 b - t - count, vc->vc_cols); in fbcon_scroll()
1802 __fbcon_clear(vc, b - count, 0, count, vc->vc_cols); in fbcon_scroll()
1807 2 * (p->vrows - vc->vc_rows)) in fbcon_scroll()
1808 && ((!scroll_partial && (b - t == vc->vc_rows)) in fbcon_scroll()
1811 3 * vc->vc_rows >> 2)))) { in fbcon_scroll()
1813 fbcon_redraw_move(vc, p, 0, t, count); in fbcon_scroll()
1814 ypan_up_redraw(vc, t, count); in fbcon_scroll()
1815 if (vc->vc_rows - b > 0) in fbcon_scroll()
1816 fbcon_redraw_move(vc, p, b, in fbcon_scroll()
1817 vc->vc_rows - b, b); in fbcon_scroll()
1819 fbcon_redraw_move(vc, p, t + count, b - t - count, t); in fbcon_scroll()
1820 __fbcon_clear(vc, b - count, 0, count, vc->vc_cols); in fbcon_scroll()
1825 2 * (p->vrows - vc->vc_rows)) in fbcon_scroll()
1826 && ((!scroll_partial && (b - t == vc->vc_rows)) in fbcon_scroll()
1829 3 * vc->vc_rows >> 2)))) { in fbcon_scroll()
1831 fbcon_bmove(vc, 0, 0, count, 0, t, in fbcon_scroll()
1832 vc->vc_cols); in fbcon_scroll()
1833 ypan_up(vc, count); in fbcon_scroll()
1834 if (vc->vc_rows - b > 0) in fbcon_scroll()
1835 fbcon_bmove(vc, b - count, 0, b, 0, in fbcon_scroll()
1836 vc->vc_rows - b, in fbcon_scroll()
1837 vc->vc_cols); in fbcon_scroll()
1839 fbcon_bmove(vc, t + count, 0, t, 0, in fbcon_scroll()
1840 b - t - count, vc->vc_cols); in fbcon_scroll()
1843 __fbcon_clear(vc, b - count, 0, count, vc->vc_cols); in fbcon_scroll()
1848 fbcon_redraw(vc, t, b - t - count, in fbcon_scroll()
1849 count * vc->vc_cols); in fbcon_scroll()
1850 __fbcon_clear(vc, b - count, 0, count, vc->vc_cols); in fbcon_scroll()
1851 scr_memsetw((unsigned short *) (vc->vc_origin + in fbcon_scroll()
1852 vc->vc_size_row * in fbcon_scroll()
1854 vc->vc_video_erase_char, in fbcon_scroll()
1855 vc->vc_size_row * count); in fbcon_scroll()
1861 if (count > vc->vc_rows) /* Maximum realistic size */ in fbcon_scroll()
1862 count = vc->vc_rows; in fbcon_scroll()
1865 fbcon_redraw_blit(vc, info, p, b - 1, b - t - count, in fbcon_scroll()
1867 __fbcon_clear(vc, t, 0, count, vc->vc_cols); in fbcon_scroll()
1868 scr_memsetw((unsigned short *) (vc->vc_origin + in fbcon_scroll()
1869 vc->vc_size_row * in fbcon_scroll()
1871 vc->vc_video_erase_char, in fbcon_scroll()
1872 vc->vc_size_row * count); in fbcon_scroll()
1876 if (b - t - count > 3 * vc->vc_rows >> 2) { in fbcon_scroll()
1877 if (vc->vc_rows - b > 0) in fbcon_scroll()
1878 fbcon_bmove(vc, b, 0, b - count, 0, in fbcon_scroll()
1879 vc->vc_rows - b, in fbcon_scroll()
1880 vc->vc_cols); in fbcon_scroll()
1881 ywrap_down(vc, count); in fbcon_scroll()
1883 fbcon_bmove(vc, count, 0, 0, 0, t, in fbcon_scroll()
1884 vc->vc_cols); in fbcon_scroll()
1886 fbcon_bmove(vc, t, 0, t + count, 0, in fbcon_scroll()
1887 b - t - count, vc->vc_cols); in fbcon_scroll()
1890 __fbcon_clear(vc, t, 0, count, vc->vc_cols); in fbcon_scroll()
1894 if ((count - p->yscroll <= p->vrows - vc->vc_rows) in fbcon_scroll()
1895 && ((!scroll_partial && (b - t == vc->vc_rows)) in fbcon_scroll()
1898 3 * vc->vc_rows >> 2)))) { in fbcon_scroll()
1899 if (vc->vc_rows - b > 0) in fbcon_scroll()
1900 fbcon_bmove(vc, b, 0, b - count, 0, in fbcon_scroll()
1901 vc->vc_rows - b, in fbcon_scroll()
1902 vc->vc_cols); in fbcon_scroll()
1903 ypan_down(vc, count); in fbcon_scroll()
1905 fbcon_bmove(vc, count, 0, 0, 0, t, in fbcon_scroll()
1906 vc->vc_cols); in fbcon_scroll()
1908 fbcon_bmove(vc, t, 0, t + count, 0, in fbcon_scroll()
1909 b - t - count, vc->vc_cols); in fbcon_scroll()
1912 __fbcon_clear(vc, t, 0, count, vc->vc_cols); in fbcon_scroll()
1916 if ((count - p->yscroll <= p->vrows - vc->vc_rows) in fbcon_scroll()
1917 && ((!scroll_partial && (b - t == vc->vc_rows)) in fbcon_scroll()
1920 3 * vc->vc_rows >> 2)))) { in fbcon_scroll()
1921 if (vc->vc_rows - b > 0) in fbcon_scroll()
1922 fbcon_redraw_move(vc, p, b, vc->vc_rows - b, in fbcon_scroll()
1924 ypan_down_redraw(vc, t, count); in fbcon_scroll()
1926 fbcon_redraw_move(vc, p, count, t, 0); in fbcon_scroll()
1928 fbcon_redraw_move(vc, p, t, b - t - count, t + count); in fbcon_scroll()
1929 __fbcon_clear(vc, t, 0, count, vc->vc_cols); in fbcon_scroll()
1934 fbcon_redraw(vc, b - 1, b - t - count, in fbcon_scroll()
1935 -count * vc->vc_cols); in fbcon_scroll()
1936 __fbcon_clear(vc, t, 0, count, vc->vc_cols); in fbcon_scroll()
1937 scr_memsetw((unsigned short *) (vc->vc_origin + in fbcon_scroll()
1938 vc->vc_size_row * in fbcon_scroll()
1940 vc->vc_video_erase_char, in fbcon_scroll()
1941 vc->vc_size_row * count); in fbcon_scroll()
1951 struct vc_data *vc) in updatescrollmode_accel() argument
1964 divides(ypan, vc->vc_font.height) && vyres > yres; in updatescrollmode_accel()
1966 divides(ywrap, vc->vc_font.height) && in updatescrollmode_accel()
1967 divides(vc->vc_font.height, vyres) && in updatescrollmode_accel()
1968 divides(vc->vc_font.height, yres); in updatescrollmode_accel()
1993 struct vc_data *vc) in updatescrollmode() argument
1996 int fh = vc->vc_font.height; in updatescrollmode()
2002 if (yres > (fh * (vc->vc_rows + 1))) in updatescrollmode()
2003 p->vrows -= (yres - (fh * vc->vc_rows)) / fh; in updatescrollmode()
2008 updatescrollmode_accel(p, info, vc); in updatescrollmode()
2014 static int fbcon_resize(struct vc_data *vc, unsigned int width, in fbcon_resize() argument
2017 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_resize()
2019 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_resize()
2023 if (p->userfont && FNTSIZE(vc->vc_font.data)) { in fbcon_resize()
2025 int pitch = PITCH(vc->vc_font.width); in fbcon_resize()
2036 size = CALC_FONTSZ(vc->vc_font.height, pitch, vc->vc_font.charcount); in fbcon_resize()
2037 if (size > FNTSIZE(vc->vc_font.data)) in fbcon_resize()
2043 virt_fw = FBCON_SWAP(ops->rotate, vc->vc_font.width, in fbcon_resize()
2044 vc->vc_font.height); in fbcon_resize()
2045 virt_fh = FBCON_SWAP(ops->rotate, vc->vc_font.height, in fbcon_resize()
2046 vc->vc_font.width); in fbcon_resize()
2066 if (con_is_visible(vc) && vc->vc_mode == KD_TEXT) { in fbcon_resize()
2074 updatescrollmode(p, info, vc); in fbcon_resize()
2078 static bool fbcon_switch(struct vc_data *vc) in fbcon_switch() argument
2082 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_switch()
2086 info = fbcon_info_from_console(vc->vc_num); in fbcon_switch()
2107 * info->currcon = vc->vc_num; in fbcon_switch()
2113 o->currcon = vc->vc_num; in fbcon_switch()
2144 if (fbcon_is_inactive(vc, info) || in fbcon_switch()
2150 set_blitting_type(vc, info); in fbcon_switch()
2153 if (ops->rotate_font && ops->rotate_font(info, vc)) { in fbcon_switch()
2155 set_blitting_type(vc, info); in fbcon_switch()
2158 vc->vc_can_do_color = (fb_get_color_depth(&info->var, &info->fix)!=1); in fbcon_switch()
2159 vc->vc_complement_mask = vc->vc_can_do_color ? 0x7700 : 0x0800; in fbcon_switch()
2161 if (vc->vc_font.charcount > 256) in fbcon_switch()
2162 vc->vc_complement_mask <<= 1; in fbcon_switch()
2164 updatescrollmode(p, info, vc); in fbcon_switch()
2168 scrollback_phys_max = p->vrows - vc->vc_rows; in fbcon_switch()
2172 scrollback_phys_max = p->vrows - 2 * vc->vc_rows; in fbcon_switch()
2184 if (!fbcon_is_inactive(vc, info)) { in fbcon_switch()
2189 fbcon_set_palette(vc, color_table); in fbcon_switch()
2190 fbcon_clear_margins(vc, 0); in fbcon_switch()
2196 update_region(vc, in fbcon_switch()
2197 vc->vc_origin + vc->vc_size_row * vc->vc_top, in fbcon_switch()
2198 vc->vc_size_row * (vc->vc_bottom - in fbcon_switch()
2199 vc->vc_top) / 2); in fbcon_switch()
2205 static void fbcon_generic_blank(struct vc_data *vc, struct fb_info *info, in fbcon_generic_blank() argument
2209 unsigned short charmask = vc->vc_hi_font_mask ? in fbcon_generic_blank()
2213 oldc = vc->vc_video_erase_char; in fbcon_generic_blank()
2214 vc->vc_video_erase_char &= charmask; in fbcon_generic_blank()
2215 __fbcon_clear(vc, 0, 0, vc->vc_rows, vc->vc_cols); in fbcon_generic_blank()
2216 vc->vc_video_erase_char = oldc; in fbcon_generic_blank()
2220 static bool fbcon_blank(struct vc_data *vc, enum vesa_blank_mode blank, in fbcon_blank() argument
2223 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_blank()
2240 if (!fbcon_is_inactive(vc, info)) { in fbcon_blank()
2243 fbcon_cursor(vc, !blank); in fbcon_blank()
2247 fbcon_generic_blank(vc, info, blank); in fbcon_blank()
2251 update_screen(vc); in fbcon_blank()
2254 if (mode_switch || fbcon_is_inactive(vc, info) || in fbcon_blank()
2263 static void fbcon_debug_enter(struct vc_data *vc) in fbcon_debug_enter() argument
2265 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_debug_enter()
2272 fbcon_set_palette(vc, color_table); in fbcon_debug_enter()
2275 static void fbcon_debug_leave(struct vc_data *vc) in fbcon_debug_leave() argument
2277 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_debug_leave()
2285 static int fbcon_get_font(struct vc_data *vc, struct console_font *font, unsigned int vpitch) in fbcon_get_font() argument
2287 u8 *fontdata = vc->vc_font.data; in fbcon_get_font()
2291 font->width = vc->vc_font.width; in fbcon_get_font()
2292 font->height = vc->vc_font.height; in fbcon_get_font()
2295 font->charcount = vc->vc_hi_font_mask ? 512 : 256; in fbcon_get_font()
2300 j = vc->vc_font.height; in fbcon_get_font()
2311 j = vc->vc_font.height * 2; in fbcon_get_font()
2322 if (font->charcount * (vc->vc_font.height * sizeof(u32)) > FNTSIZE(fontdata)) in fbcon_get_font()
2326 for (j = 0; j < vc->vc_font.height; j++) { in fbcon_get_font()
2336 j = vc->vc_font.height * 4; in fbcon_get_font()
2350 /* set/clear vc_hi_font_mask and update vc attrs accordingly */
2351 static void set_vc_hi_font(struct vc_data *vc, bool set) in set_vc_hi_font() argument
2354 vc->vc_hi_font_mask = 0; in set_vc_hi_font()
2355 if (vc->vc_can_do_color) { in set_vc_hi_font()
2356 vc->vc_complement_mask >>= 1; in set_vc_hi_font()
2357 vc->vc_s_complement_mask >>= 1; in set_vc_hi_font()
2361 if (vc->vc_can_do_color) { in set_vc_hi_font()
2363 (unsigned short *) vc->vc_origin; in set_vc_hi_font()
2364 int count = vc->vc_screenbuf_size / 2; in set_vc_hi_font()
2371 c = vc->vc_video_erase_char; in set_vc_hi_font()
2372 vc->vc_video_erase_char = in set_vc_hi_font()
2374 vc->vc_attr >>= 1; in set_vc_hi_font()
2377 vc->vc_hi_font_mask = 0x100; in set_vc_hi_font()
2378 if (vc->vc_can_do_color) { in set_vc_hi_font()
2379 vc->vc_complement_mask <<= 1; in set_vc_hi_font()
2380 vc->vc_s_complement_mask <<= 1; in set_vc_hi_font()
2386 (unsigned short *) vc->vc_origin; in set_vc_hi_font()
2387 int count = vc->vc_screenbuf_size / 2; in set_vc_hi_font()
2392 if (vc->vc_can_do_color) in set_vc_hi_font()
2400 c = vc->vc_video_erase_char; in set_vc_hi_font()
2401 if (vc->vc_can_do_color) { in set_vc_hi_font()
2402 vc->vc_video_erase_char = in set_vc_hi_font()
2404 vc->vc_attr <<= 1; in set_vc_hi_font()
2406 vc->vc_video_erase_char = c & ~0x100; in set_vc_hi_font()
2411 static int fbcon_do_set_font(struct vc_data *vc, int w, int h, int charcount, in fbcon_do_set_font() argument
2414 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_do_set_font()
2416 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_do_set_font()
2418 u8 *old_data = vc->vc_font.data; in fbcon_do_set_font()
2420 resize = (w != vc->vc_font.width) || (h != vc->vc_font.height); in fbcon_do_set_font()
2421 vc->vc_font.data = (void *)(p->fontdata = data); in fbcon_do_set_font()
2426 old_width = vc->vc_font.width; in fbcon_do_set_font()
2427 old_height = vc->vc_font.height; in fbcon_do_set_font()
2428 old_charcount = vc->vc_font.charcount; in fbcon_do_set_font()
2430 vc->vc_font.width = w; in fbcon_do_set_font()
2431 vc->vc_font.height = h; in fbcon_do_set_font()
2432 vc->vc_font.charcount = charcount; in fbcon_do_set_font()
2433 if (vc->vc_hi_font_mask && charcount == 256) in fbcon_do_set_font()
2434 set_vc_hi_font(vc, false); in fbcon_do_set_font()
2435 else if (!vc->vc_hi_font_mask && charcount == 512) in fbcon_do_set_font()
2436 set_vc_hi_font(vc, true); in fbcon_do_set_font()
2445 ret = vc_resize(vc, cols, rows); in fbcon_do_set_font()
2448 } else if (con_is_visible(vc) in fbcon_do_set_font()
2449 && vc->vc_mode == KD_TEXT) { in fbcon_do_set_font()
2450 fbcon_clear_margins(vc, 0); in fbcon_do_set_font()
2451 update_screen(vc); in fbcon_do_set_font()
2460 vc->vc_font.data = old_data; in fbcon_do_set_font()
2468 vc->vc_font.width = old_width; in fbcon_do_set_font()
2469 vc->vc_font.height = old_height; in fbcon_do_set_font()
2470 vc->vc_font.charcount = old_charcount; in fbcon_do_set_font()
2480 static int fbcon_set_font(struct vc_data *vc, const struct console_font *font, in fbcon_set_font() argument
2483 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_set_font()
2550 return fbcon_do_set_font(vc, font->width, font->height, charcount, new_data, 1); in fbcon_set_font()
2553 static int fbcon_set_def_font(struct vc_data *vc, struct console_font *font, in fbcon_set_def_font() argument
2556 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_set_def_font()
2567 return fbcon_do_set_font(vc, f->width, f->height, f->charcount, f->data, 0); in fbcon_set_def_font()
2578 static void fbcon_set_palette(struct vc_data *vc, const unsigned char *table) in fbcon_set_palette() argument
2580 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_set_palette()
2584 if (fbcon_is_inactive(vc, info)) in fbcon_set_palette()
2587 if (!con_is_visible(vc)) in fbcon_set_palette()
2594 val = vc->vc_palette[j++]; in fbcon_set_palette()
2596 val = vc->vc_palette[j++]; in fbcon_set_palette()
2598 val = vc->vc_palette[j++]; in fbcon_set_palette()
2615 static void fbcon_invert_region(struct vc_data *vc, u16 * p, int cnt) in fbcon_invert_region() argument
2619 if (!vc->vc_can_do_color) in fbcon_invert_region()
2621 else if (vc->vc_hi_font_mask == 0x100) in fbcon_invert_region()
2633 struct vc_data *vc = NULL; in fbcon_suspended() local
2638 vc = vc_cons[ops->currcon].d; in fbcon_suspended()
2641 fbcon_cursor(vc, false); in fbcon_suspended()
2646 struct vc_data *vc; in fbcon_resumed() local
2651 vc = vc_cons[ops->currcon].d; in fbcon_resumed()
2653 update_screen(vc); in fbcon_resumed()
2659 struct vc_data *vc; in fbcon_modechanged() local
2665 vc = vc_cons[ops->currcon].d; in fbcon_modechanged()
2666 if (vc->vc_mode != KD_TEXT || in fbcon_modechanged()
2670 p = &fb_display[vc->vc_num]; in fbcon_modechanged()
2671 set_blitting_type(vc, info); in fbcon_modechanged()
2673 if (con_is_visible(vc)) { in fbcon_modechanged()
2677 cols /= vc->vc_font.width; in fbcon_modechanged()
2678 rows /= vc->vc_font.height; in fbcon_modechanged()
2679 vc_resize(vc, cols, rows); in fbcon_modechanged()
2680 updatescrollmode(p, info, vc); in fbcon_modechanged()
2684 if (!fbcon_is_inactive(vc, info)) { in fbcon_modechanged()
2689 fbcon_set_palette(vc, color_table); in fbcon_modechanged()
2690 update_screen(vc); in fbcon_modechanged()
2697 struct vc_data *vc; in fbcon_set_all_vcs() local
2705 vc = vc_cons[i].d; in fbcon_set_all_vcs()
2706 if (!vc || vc->vc_mode != KD_TEXT || in fbcon_set_all_vcs()
2710 if (con_is_visible(vc)) { in fbcon_set_all_vcs()
2715 p = &fb_display[vc->vc_num]; in fbcon_set_all_vcs()
2716 set_blitting_type(vc, info); in fbcon_set_all_vcs()
2720 cols /= vc->vc_font.width; in fbcon_set_all_vcs()
2721 rows /= vc->vc_font.height; in fbcon_set_all_vcs()
2722 vc_resize(vc, cols, rows); in fbcon_set_all_vcs()
2743 struct vc_data *vc; in fbcon_modechange_possible() local
2753 vc = vc_cons[i].d; in fbcon_modechange_possible()
2754 if (!vc || vc->vc_mode != KD_TEXT || in fbcon_modechange_possible()
2758 if (vc->vc_font.width > FBCON_SWAP(var->rotate, var->xres, var->yres) || in fbcon_modechange_possible()
2759 vc->vc_font.height > FBCON_SWAP(var->rotate, var->yres, var->xres)) in fbcon_modechange_possible()
3021 struct vc_data *vc; in fbcon_fb_blanked() local
3026 vc = vc_cons[ops->currcon].d; in fbcon_fb_blanked()
3027 if (vc->vc_mode != KD_TEXT || in fbcon_fb_blanked()
3031 if (con_is_visible(vc)) { in fbcon_fb_blanked()
3043 struct vc_data *vc; in fbcon_new_modelist() local
3052 vc = vc_cons[i].d; in fbcon_new_modelist()
3057 fbcon_set_disp(info, &var, vc->vc_num); in fbcon_new_modelist()
3064 struct vc_data *vc; in fbcon_get_requirement() local
3070 vc = vc_cons[i].d; in fbcon_get_requirement()
3071 if (vc && vc->vc_mode == KD_TEXT && in fbcon_get_requirement()
3073 set_bit(vc->vc_font.width - 1, caps->x); in fbcon_get_requirement()
3074 set_bit(vc->vc_font.height - 1, caps->y); in fbcon_get_requirement()
3075 charcnt = vc->vc_font.charcount; in fbcon_get_requirement()
3081 vc = vc_cons[fg_console].d; in fbcon_get_requirement()
3083 if (vc && vc->vc_mode == KD_TEXT && in fbcon_get_requirement()
3086 set_bit(vc->vc_font.width - 1, caps->x); in fbcon_get_requirement()
3088 set_bit(vc->vc_font.height - 1, caps->y); in fbcon_get_requirement()
3089 caps->len = vc->vc_font.charcount; in fbcon_get_requirement()