Lines Matching refs: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()
292 static inline bool fbcon_is_active(struct vc_data *vc, struct fb_info *info) in fbcon_is_active() argument
297 vc->vc_mode == KD_TEXT && !ops->graphics && !fbcon_skip_panic(info); in fbcon_is_active()
300 static int get_color(struct vc_data *vc, struct fb_info *info, in get_color() argument
307 unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff; in get_color()
309 c = vc->vc_video_erase_char & charmask; in get_color()
313 color = (is_fg) ? attr_fgcol((vc->vc_hi_font_mask) ? 9 : 8, c) in get_color()
314 : attr_bgcol((vc->vc_hi_font_mask) ? 13 : 12, c); in get_color()
367 static int get_fg_color(struct vc_data *vc, struct fb_info *info, u16 c) in get_fg_color() argument
369 return get_color(vc, info, c, true); in get_fg_color()
372 static int get_bg_color(struct vc_data *vc, struct fb_info *info, u16 c) in get_bg_color() argument
374 return get_color(vc, info, c, false); in get_bg_color()
381 struct vc_data *vc = NULL; in fb_flashcursor() local
397 vc = vc_cons[ops->currcon].d; in fb_flashcursor()
399 if (!vc || !con_is_visible(vc) || in fb_flashcursor()
400 fbcon_info_from_console(vc->vc_num) != info || in fb_flashcursor()
401 vc->vc_deccm != 1) { in fb_flashcursor()
406 c = scr_readw((u16 *) vc->vc_pos); in fb_flashcursor()
408 ops->cursor(vc, info, enable, in fb_flashcursor()
409 get_fg_color(vc, info, c), in fb_flashcursor()
410 get_bg_color(vc, info, c)); in fb_flashcursor()
580 static void fbcon_prepare_logo(struct vc_data *vc, struct fb_info *info, in fbcon_prepare_logo() argument
586 static void fbcon_prepare_logo(struct vc_data *vc, struct fb_info *info, in fbcon_prepare_logo() argument
591 int cnt, erase = vc->vc_video_erase_char, step; in fbcon_prepare_logo()
607 logo_lines = DIV_ROUND_UP(logo_height, vc->vc_font.height); in fbcon_prepare_logo()
608 q = (unsigned short *) (vc->vc_origin + in fbcon_prepare_logo()
609 vc->vc_size_row * rows); in fbcon_prepare_logo()
612 if (scr_readw(r) != vc->vc_video_erase_char) in fbcon_prepare_logo()
630 scr_memcpyw(r + step, r, vc->vc_size_row); in fbcon_prepare_logo()
635 if (vc->state.y + logo_lines >= rows) in fbcon_prepare_logo()
636 lines = rows - vc->state.y - 1; in fbcon_prepare_logo()
639 vc->state.y += lines; in fbcon_prepare_logo()
640 vc->vc_pos += lines * vc->vc_size_row; in fbcon_prepare_logo()
643 scr_memsetw((unsigned short *) vc->vc_origin, in fbcon_prepare_logo()
645 vc->vc_size_row * logo_lines); in fbcon_prepare_logo()
647 if (con_is_visible(vc) && vc->vc_mode == KD_TEXT) { in fbcon_prepare_logo()
648 fbcon_clear_margins(vc, 0); in fbcon_prepare_logo()
649 update_screen(vc); in fbcon_prepare_logo()
653 q = (unsigned short *) (vc->vc_origin + in fbcon_prepare_logo()
654 vc->vc_size_row * in fbcon_prepare_logo()
657 vc->state.y += logo_lines; in fbcon_prepare_logo()
658 vc->vc_pos += logo_lines * vc->vc_size_row; in fbcon_prepare_logo()
665 if (logo_lines > vc->vc_bottom) { in fbcon_prepare_logo()
670 vc->vc_top = logo_lines; in fbcon_prepare_logo()
676 static void set_blitting_type(struct vc_data *vc, struct fb_info *info) in set_blitting_type() argument
680 ops->p = &fb_display[vc->vc_num]; in set_blitting_type()
683 fbcon_set_tileops(vc, info); in set_blitting_type()
701 static void set_blitting_type(struct vc_data *vc, struct fb_info *info) in set_blitting_type() argument
706 ops->p = &fb_display[vc->vc_num]; in set_blitting_type()
770 static int con2fb_acquire_newinfo(struct vc_data *vc, struct fb_info *info, in con2fb_acquire_newinfo() argument
779 if (vc) in con2fb_acquire_newinfo()
780 set_blitting_type(vc, info); in con2fb_acquire_newinfo()
785 static void con2fb_release_oldinfo(struct vc_data *vc, struct fb_info *oldinfo, in con2fb_release_oldinfo() argument
809 static void con2fb_init_display(struct vc_data *vc, struct fb_info *info, in con2fb_init_display() argument
857 struct vc_data *vc = vc_cons[unit].d; in set_con2fb_map() local
880 err = con2fb_acquire_newinfo(vc, info, unit); in set_con2fb_map()
885 } else if (vc) { in set_con2fb_map()
886 set_blitting_type(vc, info); in set_con2fb_map()
896 con2fb_release_oldinfo(vc, oldinfo, info); in set_con2fb_map()
902 con2fb_init_display(vc, info, unit, show_logo); in set_con2fb_map()
961 struct vc_data *vc = vc_cons[fg_console].d; in fbcon_startup() local
995 set_blitting_type(vc, info); in fbcon_startup()
1004 vc->vc_font.width = font->width; in fbcon_startup()
1005 vc->vc_font.height = font->height; in fbcon_startup()
1006 vc->vc_font.data = (void *)(p->fontdata = font->data); in fbcon_startup()
1007 vc->vc_font.charcount = font->charcount; in fbcon_startup()
1012 cols /= vc->vc_font.width; in fbcon_startup()
1013 rows /= vc->vc_font.height; in fbcon_startup()
1014 vc_resize(vc, cols, rows); in fbcon_startup()
1026 static void fbcon_init(struct vc_data *vc, bool init) in fbcon_init() argument
1030 struct vc_data **default_mode = vc->vc_display_fg; in fbcon_init()
1032 struct fbcon_display *t, *p = &fb_display[vc->vc_num]; in fbcon_init()
1039 if (con2fb_map[vc->vc_num] == -1) in fbcon_init()
1040 con2fb_map[vc->vc_num] = info_idx; in fbcon_init()
1042 info = fbcon_info_from_console(vc->vc_num); in fbcon_init()
1047 if (vc != svc || logo_shown == FBCON_LOGO_DONTSHOW || in fbcon_init()
1055 con2fb_acquire_newinfo(vc, info, vc->vc_num); in fbcon_init()
1064 vc->vc_font.data = (void *)(p->fontdata = in fbcon_init()
1066 vc->vc_font.width = fvc->vc_font.width; in fbcon_init()
1067 vc->vc_font.height = fvc->vc_font.height; in fbcon_init()
1068 vc->vc_font.charcount = fvc->vc_font.charcount; in fbcon_init()
1081 vc->vc_font.width = font->width; in fbcon_init()
1082 vc->vc_font.height = font->height; in fbcon_init()
1083 vc->vc_font.data = (void *)(p->fontdata = font->data); in fbcon_init()
1084 vc->vc_font.charcount = font->charcount; in fbcon_init()
1088 vc->vc_can_do_color = (fb_get_color_depth(&info->var, &info->fix)!=1); in fbcon_init()
1089 vc->vc_complement_mask = vc->vc_can_do_color ? 0x7700 : 0x0800; in fbcon_init()
1090 if (vc->vc_font.charcount == 256) { in fbcon_init()
1091 vc->vc_hi_font_mask = 0; in fbcon_init()
1093 vc->vc_hi_font_mask = 0x100; in fbcon_init()
1094 if (vc->vc_can_do_color) in fbcon_init()
1095 vc->vc_complement_mask <<= 1; in fbcon_init()
1100 if (!*vc->uni_pagedict_loc) in fbcon_init()
1101 con_copy_unimap(vc, svc); in fbcon_init()
1104 ops->cur_blink_jiffies = msecs_to_jiffies(vc->vc_cur_blink_ms); in fbcon_init()
1112 set_blitting_type(vc, info); in fbcon_init()
1114 cols = vc->vc_cols; in fbcon_init()
1115 rows = vc->vc_rows; in fbcon_init()
1118 new_cols /= vc->vc_font.width; in fbcon_init()
1119 new_rows /= vc->vc_font.height; in fbcon_init()
1128 if (con_is_visible(vc) && vc->vc_mode == KD_TEXT) { in fbcon_init()
1157 vc->vc_cols = new_cols; in fbcon_init()
1158 vc->vc_rows = new_rows; in fbcon_init()
1160 vc_resize(vc, new_cols, new_rows); in fbcon_init()
1163 fbcon_prepare_logo(vc, info, cols, rows, new_cols, new_rows); in fbcon_init()
1165 if (ops->rotate_font && ops->rotate_font(info, vc)) { in fbcon_init()
1167 set_blitting_type(vc, info); in fbcon_init()
1181 static void set_vc_hi_font(struct vc_data *vc, bool set);
1204 static void fbcon_deinit(struct vc_data *vc) in fbcon_deinit() argument
1206 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_deinit()
1212 idx = con2fb_map[vc->vc_num]; in fbcon_deinit()
1227 if (con_is_visible(vc)) in fbcon_deinit()
1234 vc->vc_font.data = NULL; in fbcon_deinit()
1236 if (vc->vc_hi_font_mask && vc->vc_screenbuf) in fbcon_deinit()
1237 set_vc_hi_font(vc, false); in fbcon_deinit()
1242 if (vc->vc_num == logo_shown) in fbcon_deinit()
1273 static void __fbcon_clear(struct vc_data *vc, unsigned int sy, unsigned int sx, in __fbcon_clear() argument
1276 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in __fbcon_clear()
1279 struct fbcon_display *p = &fb_display[vc->vc_num]; in __fbcon_clear()
1282 if (!fbcon_is_active(vc, info)) in __fbcon_clear()
1288 if (sy < vc->vc_top && vc->vc_top == logo_lines) { in __fbcon_clear()
1289 vc->vc_top = 0; in __fbcon_clear()
1296 fbcon_clear_margins(vc, 0); in __fbcon_clear()
1299 fg = get_color(vc, info, vc->vc_video_erase_char, 1); in __fbcon_clear()
1300 bg = get_color(vc, info, vc->vc_video_erase_char, 0); in __fbcon_clear()
1306 ops->clear(vc, info, real_y(p, sy), sx, b, width, fg, bg); in __fbcon_clear()
1307 ops->clear(vc, info, real_y(p, sy + b), sx, height - b, in __fbcon_clear()
1310 ops->clear(vc, info, real_y(p, sy), sx, height, width, fg, bg); in __fbcon_clear()
1313 static void fbcon_clear(struct vc_data *vc, unsigned int sy, unsigned int sx, in fbcon_clear() argument
1316 __fbcon_clear(vc, sy, sx, 1, width); in fbcon_clear()
1319 static void fbcon_putcs(struct vc_data *vc, const u16 *s, unsigned int count, in fbcon_putcs() argument
1322 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_putcs()
1323 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_putcs()
1326 if (fbcon_is_active(vc, info)) in fbcon_putcs()
1327 ops->putcs(vc, info, s, count, real_y(p, ypos), xpos, in fbcon_putcs()
1328 get_fg_color(vc, info, scr_readw(s)), in fbcon_putcs()
1329 get_bg_color(vc, info, scr_readw(s))); in fbcon_putcs()
1332 static void fbcon_clear_margins(struct vc_data *vc, int bottom_only) in fbcon_clear_margins() argument
1334 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_clear_margins()
1337 if (fbcon_is_active(vc, info)) in fbcon_clear_margins()
1338 ops->clear_margins(vc, info, margin_color, bottom_only); in fbcon_clear_margins()
1341 static void fbcon_cursor(struct vc_data *vc, bool enable) in fbcon_cursor() argument
1343 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_cursor()
1345 int c = scr_readw((u16 *) vc->vc_pos); in fbcon_cursor()
1347 ops->cur_blink_jiffies = msecs_to_jiffies(vc->vc_cur_blink_ms); in fbcon_cursor()
1349 if (!fbcon_is_active(vc, info) || vc->vc_deccm != 1) in fbcon_cursor()
1352 if (vc->vc_cursor_type & CUR_SW) in fbcon_cursor()
1362 ops->cursor(vc, info, enable, in fbcon_cursor()
1363 get_fg_color(vc, info, c), in fbcon_cursor()
1364 get_bg_color(vc, info, c)); in fbcon_cursor()
1375 struct vc_data **default_mode, *vc; in fbcon_set_disp() local
1386 vc = vc_cons[unit].d; in fbcon_set_disp()
1388 if (!vc) in fbcon_set_disp()
1391 default_mode = vc->vc_display_fg; in fbcon_set_disp()
1395 if (!vc->vc_font.data) { in fbcon_set_disp()
1396 vc->vc_font.data = (void *)(p->fontdata = t->fontdata); in fbcon_set_disp()
1397 vc->vc_font.width = (*default_mode)->vc_font.width; in fbcon_set_disp()
1398 vc->vc_font.height = (*default_mode)->vc_font.height; in fbcon_set_disp()
1399 vc->vc_font.charcount = (*default_mode)->vc_font.charcount; in fbcon_set_disp()
1411 vc->vc_can_do_color = (fb_get_color_depth(&info->var, &info->fix)!=1); in fbcon_set_disp()
1412 vc->vc_complement_mask = vc->vc_can_do_color ? 0x7700 : 0x0800; in fbcon_set_disp()
1413 if (vc->vc_font.charcount == 256) { in fbcon_set_disp()
1414 vc->vc_hi_font_mask = 0; in fbcon_set_disp()
1416 vc->vc_hi_font_mask = 0x100; in fbcon_set_disp()
1417 if (vc->vc_can_do_color) in fbcon_set_disp()
1418 vc->vc_complement_mask <<= 1; in fbcon_set_disp()
1423 if (!*vc->uni_pagedict_loc) in fbcon_set_disp()
1424 con_copy_unimap(vc, svc); in fbcon_set_disp()
1428 cols /= vc->vc_font.width; in fbcon_set_disp()
1429 rows /= vc->vc_font.height; in fbcon_set_disp()
1430 ret = vc_resize(vc, cols, rows); in fbcon_set_disp()
1432 if (con_is_visible(vc) && !ret) in fbcon_set_disp()
1433 update_screen(vc); in fbcon_set_disp()
1436 static __inline__ void ywrap_up(struct vc_data *vc, int count) in ywrap_up() argument
1438 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in ywrap_up()
1440 struct fbcon_display *p = &fb_display[vc->vc_num]; in ywrap_up()
1446 ops->var.yoffset = p->yscroll * vc->vc_font.height; in ywrap_up()
1455 static __inline__ void ywrap_down(struct vc_data *vc, int count) in ywrap_down() argument
1457 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in ywrap_down()
1459 struct fbcon_display *p = &fb_display[vc->vc_num]; in ywrap_down()
1465 ops->var.yoffset = p->yscroll * vc->vc_font.height; in ywrap_down()
1474 static __inline__ void ypan_up(struct vc_data *vc, int count) in ypan_up() argument
1476 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in ypan_up()
1477 struct fbcon_display *p = &fb_display[vc->vc_num]; in ypan_up()
1481 if (p->yscroll > p->vrows - vc->vc_rows) { in ypan_up()
1482 ops->bmove(vc, info, p->vrows - vc->vc_rows, in ypan_up()
1483 0, 0, 0, vc->vc_rows, vc->vc_cols); in ypan_up()
1484 p->yscroll -= p->vrows - vc->vc_rows; in ypan_up()
1488 ops->var.yoffset = p->yscroll * vc->vc_font.height; in ypan_up()
1491 fbcon_clear_margins(vc, 1); in ypan_up()
1498 static __inline__ void ypan_up_redraw(struct vc_data *vc, int t, int count) in ypan_up_redraw() argument
1500 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in ypan_up_redraw()
1502 struct fbcon_display *p = &fb_display[vc->vc_num]; in ypan_up_redraw()
1506 if (p->yscroll > p->vrows - vc->vc_rows) { in ypan_up_redraw()
1507 p->yscroll -= p->vrows - vc->vc_rows; in ypan_up_redraw()
1508 fbcon_redraw_move(vc, p, t + count, vc->vc_rows - count, t); in ypan_up_redraw()
1512 ops->var.yoffset = p->yscroll * vc->vc_font.height; in ypan_up_redraw()
1515 fbcon_clear_margins(vc, 1); in ypan_up_redraw()
1522 static __inline__ void ypan_down(struct vc_data *vc, int count) in ypan_down() argument
1524 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in ypan_down()
1525 struct fbcon_display *p = &fb_display[vc->vc_num]; in ypan_down()
1530 ops->bmove(vc, info, 0, 0, p->vrows - vc->vc_rows, in ypan_down()
1531 0, vc->vc_rows, vc->vc_cols); in ypan_down()
1532 p->yscroll += p->vrows - vc->vc_rows; in ypan_down()
1536 ops->var.yoffset = p->yscroll * vc->vc_font.height; in ypan_down()
1539 fbcon_clear_margins(vc, 1); in ypan_down()
1546 static __inline__ void ypan_down_redraw(struct vc_data *vc, int t, int count) in ypan_down_redraw() argument
1548 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in ypan_down_redraw()
1550 struct fbcon_display *p = &fb_display[vc->vc_num]; in ypan_down_redraw()
1555 p->yscroll += p->vrows - vc->vc_rows; in ypan_down_redraw()
1556 fbcon_redraw_move(vc, p, t, vc->vc_rows - count, t + count); in ypan_down_redraw()
1560 ops->var.yoffset = p->yscroll * vc->vc_font.height; in ypan_down_redraw()
1563 fbcon_clear_margins(vc, 1); in ypan_down_redraw()
1570 static void fbcon_redraw_move(struct vc_data *vc, struct fbcon_display *p, in fbcon_redraw_move() argument
1574 (vc->vc_origin + vc->vc_size_row * line); in fbcon_redraw_move()
1588 fbcon_putcs(vc, start, s - start, in fbcon_redraw_move()
1598 fbcon_putcs(vc, start, s - start, dy, x); in fbcon_redraw_move()
1604 static void fbcon_redraw_blit(struct vc_data *vc, struct fb_info *info, in fbcon_redraw_blit() argument
1607 int offset = ycount * vc->vc_cols; in fbcon_redraw_blit()
1609 (vc->vc_origin + vc->vc_size_row * line); in fbcon_redraw_blit()
1624 ops->bmove(vc, info, line + ycount, x, in fbcon_redraw_blit()
1640 ops->bmove(vc, info, line + ycount, x, line, x, 1, in fbcon_redraw_blit()
1648 s -= vc->vc_size_row; in fbcon_redraw_blit()
1649 d -= vc->vc_size_row; in fbcon_redraw_blit()
1654 static void fbcon_redraw(struct vc_data *vc, int line, int count, int offset) in fbcon_redraw() argument
1657 (vc->vc_origin + vc->vc_size_row * line); in fbcon_redraw()
1672 fbcon_putcs(vc, start, s - start, in fbcon_redraw()
1680 fbcon_putcs(vc, start, s - start, in fbcon_redraw()
1695 fbcon_putcs(vc, start, s - start, line, x); in fbcon_redraw()
1702 s -= vc->vc_size_row; in fbcon_redraw()
1703 d -= vc->vc_size_row; in fbcon_redraw()
1708 static void fbcon_bmove_rec(struct vc_data *vc, struct fbcon_display *p, int sy, int sx, in fbcon_bmove_rec() argument
1711 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_bmove_rec()
1718 fbcon_bmove_rec(vc, p, sy, sx, dy, dx, b, width, in fbcon_bmove_rec()
1720 fbcon_bmove_rec(vc, p, sy + b, sx, dy + b, dx, in fbcon_bmove_rec()
1723 fbcon_bmove_rec(vc, p, sy + b, sx, dy + b, dx, in fbcon_bmove_rec()
1725 fbcon_bmove_rec(vc, p, sy, sx, dy, dx, b, width, in fbcon_bmove_rec()
1734 fbcon_bmove_rec(vc, p, sy, sx, dy, dx, b, width, in fbcon_bmove_rec()
1736 fbcon_bmove_rec(vc, p, sy + b, sx, dy + b, dx, in fbcon_bmove_rec()
1739 fbcon_bmove_rec(vc, p, sy + b, sx, dy + b, dx, in fbcon_bmove_rec()
1741 fbcon_bmove_rec(vc, p, sy, sx, dy, dx, b, width, in fbcon_bmove_rec()
1746 ops->bmove(vc, info, real_y(p, sy), sx, real_y(p, dy), dx, in fbcon_bmove_rec()
1750 static void fbcon_bmove(struct vc_data *vc, int sy, int sx, int dy, int dx, in fbcon_bmove() argument
1753 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_bmove()
1754 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_bmove()
1756 if (!fbcon_is_active(vc, info)) in fbcon_bmove()
1769 fbcon_bmove_rec(vc, p, sy, sx, dy, dx, height, width, in fbcon_bmove()
1773 static bool fbcon_scroll(struct vc_data *vc, unsigned int t, unsigned int b, in fbcon_scroll() argument
1776 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_scroll()
1777 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_scroll()
1780 if (!fbcon_is_active(vc, info)) in fbcon_scroll()
1783 fbcon_cursor(vc, false); in fbcon_scroll()
1793 if (count > vc->vc_rows) /* Maximum realistic size */ in fbcon_scroll()
1794 count = vc->vc_rows; in fbcon_scroll()
1797 fbcon_redraw_blit(vc, info, p, t, b - t - count, in fbcon_scroll()
1799 __fbcon_clear(vc, b - count, 0, count, vc->vc_cols); in fbcon_scroll()
1800 scr_memsetw((unsigned short *) (vc->vc_origin + in fbcon_scroll()
1801 vc->vc_size_row * in fbcon_scroll()
1803 vc->vc_video_erase_char, in fbcon_scroll()
1804 vc->vc_size_row * count); in fbcon_scroll()
1808 if (b - t - count > 3 * vc->vc_rows >> 2) { in fbcon_scroll()
1810 fbcon_bmove(vc, 0, 0, count, 0, t, in fbcon_scroll()
1811 vc->vc_cols); in fbcon_scroll()
1812 ywrap_up(vc, count); in fbcon_scroll()
1813 if (vc->vc_rows - b > 0) in fbcon_scroll()
1814 fbcon_bmove(vc, b - count, 0, b, 0, in fbcon_scroll()
1815 vc->vc_rows - b, in fbcon_scroll()
1816 vc->vc_cols); in fbcon_scroll()
1818 fbcon_bmove(vc, t + count, 0, t, 0, in fbcon_scroll()
1819 b - t - count, vc->vc_cols); in fbcon_scroll()
1822 __fbcon_clear(vc, b - count, 0, count, vc->vc_cols); in fbcon_scroll()
1827 2 * (p->vrows - vc->vc_rows)) in fbcon_scroll()
1828 && ((!scroll_partial && (b - t == vc->vc_rows)) in fbcon_scroll()
1831 3 * vc->vc_rows >> 2)))) { in fbcon_scroll()
1833 fbcon_redraw_move(vc, p, 0, t, count); in fbcon_scroll()
1834 ypan_up_redraw(vc, t, count); in fbcon_scroll()
1835 if (vc->vc_rows - b > 0) in fbcon_scroll()
1836 fbcon_redraw_move(vc, p, b, in fbcon_scroll()
1837 vc->vc_rows - b, b); in fbcon_scroll()
1839 fbcon_redraw_move(vc, p, t + count, b - t - count, t); in fbcon_scroll()
1840 __fbcon_clear(vc, b - count, 0, count, vc->vc_cols); in fbcon_scroll()
1845 2 * (p->vrows - vc->vc_rows)) in fbcon_scroll()
1846 && ((!scroll_partial && (b - t == vc->vc_rows)) in fbcon_scroll()
1849 3 * vc->vc_rows >> 2)))) { in fbcon_scroll()
1851 fbcon_bmove(vc, 0, 0, count, 0, t, in fbcon_scroll()
1852 vc->vc_cols); in fbcon_scroll()
1853 ypan_up(vc, count); in fbcon_scroll()
1854 if (vc->vc_rows - b > 0) in fbcon_scroll()
1855 fbcon_bmove(vc, b - count, 0, b, 0, in fbcon_scroll()
1856 vc->vc_rows - b, in fbcon_scroll()
1857 vc->vc_cols); in fbcon_scroll()
1859 fbcon_bmove(vc, t + count, 0, t, 0, in fbcon_scroll()
1860 b - t - count, vc->vc_cols); in fbcon_scroll()
1863 __fbcon_clear(vc, b - count, 0, count, vc->vc_cols); in fbcon_scroll()
1868 fbcon_redraw(vc, t, b - t - count, in fbcon_scroll()
1869 count * vc->vc_cols); in fbcon_scroll()
1870 __fbcon_clear(vc, b - count, 0, count, vc->vc_cols); in fbcon_scroll()
1871 scr_memsetw((unsigned short *) (vc->vc_origin + in fbcon_scroll()
1872 vc->vc_size_row * in fbcon_scroll()
1874 vc->vc_video_erase_char, in fbcon_scroll()
1875 vc->vc_size_row * count); in fbcon_scroll()
1881 if (count > vc->vc_rows) /* Maximum realistic size */ in fbcon_scroll()
1882 count = vc->vc_rows; in fbcon_scroll()
1885 fbcon_redraw_blit(vc, info, p, b - 1, b - t - count, in fbcon_scroll()
1887 __fbcon_clear(vc, t, 0, count, vc->vc_cols); in fbcon_scroll()
1888 scr_memsetw((unsigned short *) (vc->vc_origin + in fbcon_scroll()
1889 vc->vc_size_row * in fbcon_scroll()
1891 vc->vc_video_erase_char, in fbcon_scroll()
1892 vc->vc_size_row * count); in fbcon_scroll()
1896 if (b - t - count > 3 * vc->vc_rows >> 2) { in fbcon_scroll()
1897 if (vc->vc_rows - b > 0) in fbcon_scroll()
1898 fbcon_bmove(vc, b, 0, b - count, 0, in fbcon_scroll()
1899 vc->vc_rows - b, in fbcon_scroll()
1900 vc->vc_cols); in fbcon_scroll()
1901 ywrap_down(vc, count); in fbcon_scroll()
1903 fbcon_bmove(vc, count, 0, 0, 0, t, in fbcon_scroll()
1904 vc->vc_cols); in fbcon_scroll()
1906 fbcon_bmove(vc, t, 0, t + count, 0, in fbcon_scroll()
1907 b - t - count, vc->vc_cols); in fbcon_scroll()
1910 __fbcon_clear(vc, t, 0, count, vc->vc_cols); in fbcon_scroll()
1914 if ((count - p->yscroll <= p->vrows - vc->vc_rows) in fbcon_scroll()
1915 && ((!scroll_partial && (b - t == vc->vc_rows)) in fbcon_scroll()
1918 3 * vc->vc_rows >> 2)))) { in fbcon_scroll()
1919 if (vc->vc_rows - b > 0) in fbcon_scroll()
1920 fbcon_bmove(vc, b, 0, b - count, 0, in fbcon_scroll()
1921 vc->vc_rows - b, in fbcon_scroll()
1922 vc->vc_cols); in fbcon_scroll()
1923 ypan_down(vc, count); in fbcon_scroll()
1925 fbcon_bmove(vc, count, 0, 0, 0, t, in fbcon_scroll()
1926 vc->vc_cols); in fbcon_scroll()
1928 fbcon_bmove(vc, t, 0, t + count, 0, in fbcon_scroll()
1929 b - t - count, vc->vc_cols); in fbcon_scroll()
1932 __fbcon_clear(vc, t, 0, count, vc->vc_cols); in fbcon_scroll()
1936 if ((count - p->yscroll <= p->vrows - vc->vc_rows) in fbcon_scroll()
1937 && ((!scroll_partial && (b - t == vc->vc_rows)) in fbcon_scroll()
1940 3 * vc->vc_rows >> 2)))) { in fbcon_scroll()
1941 if (vc->vc_rows - b > 0) in fbcon_scroll()
1942 fbcon_redraw_move(vc, p, b, vc->vc_rows - b, in fbcon_scroll()
1944 ypan_down_redraw(vc, t, count); in fbcon_scroll()
1946 fbcon_redraw_move(vc, p, count, t, 0); in fbcon_scroll()
1948 fbcon_redraw_move(vc, p, t, b - t - count, t + count); in fbcon_scroll()
1949 __fbcon_clear(vc, t, 0, count, vc->vc_cols); in fbcon_scroll()
1954 fbcon_redraw(vc, b - 1, b - t - count, in fbcon_scroll()
1955 -count * vc->vc_cols); in fbcon_scroll()
1956 __fbcon_clear(vc, t, 0, count, vc->vc_cols); in fbcon_scroll()
1957 scr_memsetw((unsigned short *) (vc->vc_origin + in fbcon_scroll()
1958 vc->vc_size_row * in fbcon_scroll()
1960 vc->vc_video_erase_char, in fbcon_scroll()
1961 vc->vc_size_row * count); in fbcon_scroll()
1971 struct vc_data *vc) in updatescrollmode_accel() argument
1984 divides(ypan, vc->vc_font.height) && vyres > yres; in updatescrollmode_accel()
1986 divides(ywrap, vc->vc_font.height) && in updatescrollmode_accel()
1987 divides(vc->vc_font.height, vyres) && in updatescrollmode_accel()
1988 divides(vc->vc_font.height, yres); in updatescrollmode_accel()
2013 struct vc_data *vc) in updatescrollmode() argument
2016 int fh = vc->vc_font.height; in updatescrollmode()
2022 if (yres > (fh * (vc->vc_rows + 1))) in updatescrollmode()
2023 p->vrows -= (yres - (fh * vc->vc_rows)) / fh; in updatescrollmode()
2028 updatescrollmode_accel(p, info, vc); in updatescrollmode()
2034 static int fbcon_resize(struct vc_data *vc, unsigned int width, in fbcon_resize() argument
2037 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_resize()
2039 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_resize()
2043 if (p->userfont && FNTSIZE(vc->vc_font.data)) { in fbcon_resize()
2045 int pitch = PITCH(vc->vc_font.width); in fbcon_resize()
2056 size = CALC_FONTSZ(vc->vc_font.height, pitch, vc->vc_font.charcount); in fbcon_resize()
2057 if (size > FNTSIZE(vc->vc_font.data)) in fbcon_resize()
2063 virt_fw = FBCON_SWAP(ops->rotate, vc->vc_font.width, in fbcon_resize()
2064 vc->vc_font.height); in fbcon_resize()
2065 virt_fh = FBCON_SWAP(ops->rotate, vc->vc_font.height, in fbcon_resize()
2066 vc->vc_font.width); in fbcon_resize()
2086 if (con_is_visible(vc) && vc->vc_mode == KD_TEXT) { in fbcon_resize()
2094 updatescrollmode(p, info, vc); in fbcon_resize()
2098 static bool fbcon_switch(struct vc_data *vc) in fbcon_switch() argument
2102 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_switch()
2106 info = fbcon_info_from_console(vc->vc_num); in fbcon_switch()
2133 o->currcon = vc->vc_num; in fbcon_switch()
2164 if (!fbcon_is_active(vc, info) || in fbcon_switch()
2170 set_blitting_type(vc, info); in fbcon_switch()
2173 if (ops->rotate_font && ops->rotate_font(info, vc)) { in fbcon_switch()
2175 set_blitting_type(vc, info); in fbcon_switch()
2178 vc->vc_can_do_color = (fb_get_color_depth(&info->var, &info->fix)!=1); in fbcon_switch()
2179 vc->vc_complement_mask = vc->vc_can_do_color ? 0x7700 : 0x0800; in fbcon_switch()
2181 if (vc->vc_font.charcount > 256) in fbcon_switch()
2182 vc->vc_complement_mask <<= 1; in fbcon_switch()
2184 updatescrollmode(p, info, vc); in fbcon_switch()
2188 scrollback_phys_max = p->vrows - vc->vc_rows; in fbcon_switch()
2192 scrollback_phys_max = p->vrows - 2 * vc->vc_rows; in fbcon_switch()
2204 if (fbcon_is_active(vc, info)) { in fbcon_switch()
2209 fbcon_set_palette(vc, color_table); in fbcon_switch()
2210 fbcon_clear_margins(vc, 0); in fbcon_switch()
2216 update_region(vc, in fbcon_switch()
2217 vc->vc_origin + vc->vc_size_row * vc->vc_top, in fbcon_switch()
2218 vc->vc_size_row * (vc->vc_bottom - in fbcon_switch()
2219 vc->vc_top) / 2); in fbcon_switch()
2225 static void fbcon_generic_blank(struct vc_data *vc, struct fb_info *info, in fbcon_generic_blank() argument
2229 unsigned short charmask = vc->vc_hi_font_mask ? in fbcon_generic_blank()
2233 oldc = vc->vc_video_erase_char; in fbcon_generic_blank()
2234 vc->vc_video_erase_char &= charmask; in fbcon_generic_blank()
2235 __fbcon_clear(vc, 0, 0, vc->vc_rows, vc->vc_cols); in fbcon_generic_blank()
2236 vc->vc_video_erase_char = oldc; in fbcon_generic_blank()
2240 static bool fbcon_blank(struct vc_data *vc, enum vesa_blank_mode blank, in fbcon_blank() argument
2243 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_blank()
2260 if (fbcon_is_active(vc, info)) { in fbcon_blank()
2263 fbcon_cursor(vc, !blank); in fbcon_blank()
2267 fbcon_generic_blank(vc, info, blank); in fbcon_blank()
2271 update_screen(vc); in fbcon_blank()
2274 if (mode_switch || !fbcon_is_active(vc, info) || in fbcon_blank()
2283 static void fbcon_debug_enter(struct vc_data *vc) in fbcon_debug_enter() argument
2285 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_debug_enter()
2292 fbcon_set_palette(vc, color_table); in fbcon_debug_enter()
2295 static void fbcon_debug_leave(struct vc_data *vc) in fbcon_debug_leave() argument
2297 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_debug_leave()
2305 static int fbcon_get_font(struct vc_data *vc, struct console_font *font, unsigned int vpitch) in fbcon_get_font() argument
2307 u8 *fontdata = vc->vc_font.data; in fbcon_get_font()
2311 font->width = vc->vc_font.width; in fbcon_get_font()
2312 font->height = vc->vc_font.height; in fbcon_get_font()
2315 font->charcount = vc->vc_hi_font_mask ? 512 : 256; in fbcon_get_font()
2320 j = vc->vc_font.height; in fbcon_get_font()
2331 j = vc->vc_font.height * 2; in fbcon_get_font()
2342 if (font->charcount * (vc->vc_font.height * sizeof(u32)) > FNTSIZE(fontdata)) in fbcon_get_font()
2346 for (j = 0; j < vc->vc_font.height; j++) { in fbcon_get_font()
2356 j = vc->vc_font.height * 4; in fbcon_get_font()
2371 static void set_vc_hi_font(struct vc_data *vc, bool set) in set_vc_hi_font() argument
2374 vc->vc_hi_font_mask = 0; in set_vc_hi_font()
2375 if (vc->vc_can_do_color) { in set_vc_hi_font()
2376 vc->vc_complement_mask >>= 1; in set_vc_hi_font()
2377 vc->vc_s_complement_mask >>= 1; in set_vc_hi_font()
2381 if (vc->vc_can_do_color) { in set_vc_hi_font()
2383 (unsigned short *) vc->vc_origin; in set_vc_hi_font()
2384 int count = vc->vc_screenbuf_size / 2; in set_vc_hi_font()
2391 c = vc->vc_video_erase_char; in set_vc_hi_font()
2392 vc->vc_video_erase_char = in set_vc_hi_font()
2394 vc->vc_attr >>= 1; in set_vc_hi_font()
2397 vc->vc_hi_font_mask = 0x100; in set_vc_hi_font()
2398 if (vc->vc_can_do_color) { in set_vc_hi_font()
2399 vc->vc_complement_mask <<= 1; in set_vc_hi_font()
2400 vc->vc_s_complement_mask <<= 1; in set_vc_hi_font()
2406 (unsigned short *) vc->vc_origin; in set_vc_hi_font()
2407 int count = vc->vc_screenbuf_size / 2; in set_vc_hi_font()
2412 if (vc->vc_can_do_color) in set_vc_hi_font()
2420 c = vc->vc_video_erase_char; in set_vc_hi_font()
2421 if (vc->vc_can_do_color) { in set_vc_hi_font()
2422 vc->vc_video_erase_char = in set_vc_hi_font()
2424 vc->vc_attr <<= 1; in set_vc_hi_font()
2426 vc->vc_video_erase_char = c & ~0x100; in set_vc_hi_font()
2431 static int fbcon_do_set_font(struct vc_data *vc, int w, int h, int charcount, in fbcon_do_set_font() argument
2434 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_do_set_font()
2436 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_do_set_font()
2438 u8 *old_data = vc->vc_font.data; in fbcon_do_set_font()
2440 resize = (w != vc->vc_font.width) || (h != vc->vc_font.height); in fbcon_do_set_font()
2441 vc->vc_font.data = (void *)(p->fontdata = data); in fbcon_do_set_font()
2446 old_width = vc->vc_font.width; in fbcon_do_set_font()
2447 old_height = vc->vc_font.height; in fbcon_do_set_font()
2448 old_charcount = vc->vc_font.charcount; in fbcon_do_set_font()
2450 vc->vc_font.width = w; in fbcon_do_set_font()
2451 vc->vc_font.height = h; in fbcon_do_set_font()
2452 vc->vc_font.charcount = charcount; in fbcon_do_set_font()
2453 if (vc->vc_hi_font_mask && charcount == 256) in fbcon_do_set_font()
2454 set_vc_hi_font(vc, false); in fbcon_do_set_font()
2455 else if (!vc->vc_hi_font_mask && charcount == 512) in fbcon_do_set_font()
2456 set_vc_hi_font(vc, true); in fbcon_do_set_font()
2465 ret = vc_resize(vc, cols, rows); in fbcon_do_set_font()
2468 } else if (con_is_visible(vc) in fbcon_do_set_font()
2469 && vc->vc_mode == KD_TEXT) { in fbcon_do_set_font()
2470 fbcon_clear_margins(vc, 0); in fbcon_do_set_font()
2471 update_screen(vc); in fbcon_do_set_font()
2480 vc->vc_font.data = old_data; in fbcon_do_set_font()
2488 vc->vc_font.width = old_width; in fbcon_do_set_font()
2489 vc->vc_font.height = old_height; in fbcon_do_set_font()
2490 vc->vc_font.charcount = old_charcount; in fbcon_do_set_font()
2500 static int fbcon_set_font(struct vc_data *vc, const struct console_font *font, in fbcon_set_font() argument
2503 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()