Lines Matching refs:vc

171 #define advance_row(p, delta) (unsigned short *)((unsigned long)(p) + (delta) * vc->vc_size_row)
181 static void fbcon_clear_margins(struct vc_data *vc, int bottom_only);
182 static void fbcon_set_palette(struct vc_data *vc, const unsigned char *table);
189 static void fbcon_redraw_move(struct vc_data *vc, struct fbcon_display *p,
233 struct vc_data *vc; in fbcon_rotate_all() local
241 vc = vc_cons[i].d; in fbcon_rotate_all()
242 if (!vc || vc->vc_mode != KD_TEXT || in fbcon_rotate_all()
246 p = &fb_display[vc->vc_num]; in fbcon_rotate_all()
278 static inline int fbcon_is_inactive(struct vc_data *vc, struct fb_info *info) in fbcon_is_inactive() argument
283 vc->vc_mode != KD_TEXT || ops->graphics); in fbcon_is_inactive()
286 static int get_color(struct vc_data *vc, struct fb_info *info, in get_color() argument
293 unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff; in get_color()
295 c = vc->vc_video_erase_char & charmask; in get_color()
299 color = (is_fg) ? attr_fgcol((vc->vc_hi_font_mask) ? 9 : 8, c) in get_color()
300 : attr_bgcol((vc->vc_hi_font_mask) ? 13 : 12, c); in get_color()
357 struct vc_data *vc = NULL; in fb_flashcursor() local
373 vc = vc_cons[ops->currcon].d; in fb_flashcursor()
375 if (!vc || !con_is_visible(vc) || in fb_flashcursor()
376 fbcon_info_from_console(vc->vc_num) != info || in fb_flashcursor()
377 vc->vc_deccm != 1) { in fb_flashcursor()
382 c = scr_readw((u16 *) vc->vc_pos); in fb_flashcursor()
385 ops->cursor(vc, info, mode, get_color(vc, info, c, 1), in fb_flashcursor()
386 get_color(vc, info, c, 0)); in fb_flashcursor()
550 static void fbcon_prepare_logo(struct vc_data *vc, struct fb_info *info, in fbcon_prepare_logo() argument
556 static void fbcon_prepare_logo(struct vc_data *vc, struct fb_info *info, in fbcon_prepare_logo() argument
561 int cnt, erase = vc->vc_video_erase_char, step; in fbcon_prepare_logo()
577 logo_lines = DIV_ROUND_UP(logo_height, vc->vc_font.height); in fbcon_prepare_logo()
578 q = (unsigned short *) (vc->vc_origin + in fbcon_prepare_logo()
579 vc->vc_size_row * rows); in fbcon_prepare_logo()
582 if (scr_readw(r) != vc->vc_video_erase_char) in fbcon_prepare_logo()
600 scr_memcpyw(r + step, r, vc->vc_size_row); in fbcon_prepare_logo()
605 if (vc->state.y + logo_lines >= rows) in fbcon_prepare_logo()
606 lines = rows - vc->state.y - 1; in fbcon_prepare_logo()
609 vc->state.y += lines; in fbcon_prepare_logo()
610 vc->vc_pos += lines * vc->vc_size_row; in fbcon_prepare_logo()
613 scr_memsetw((unsigned short *) vc->vc_origin, in fbcon_prepare_logo()
615 vc->vc_size_row * logo_lines); in fbcon_prepare_logo()
617 if (con_is_visible(vc) && vc->vc_mode == KD_TEXT) { in fbcon_prepare_logo()
618 fbcon_clear_margins(vc, 0); in fbcon_prepare_logo()
619 update_screen(vc); in fbcon_prepare_logo()
623 q = (unsigned short *) (vc->vc_origin + in fbcon_prepare_logo()
624 vc->vc_size_row * in fbcon_prepare_logo()
627 vc->state.y += logo_lines; in fbcon_prepare_logo()
628 vc->vc_pos += logo_lines * vc->vc_size_row; in fbcon_prepare_logo()
635 if (logo_lines > vc->vc_bottom) { in fbcon_prepare_logo()
641 vc->vc_top = logo_lines; in fbcon_prepare_logo()
647 static void set_blitting_type(struct vc_data *vc, struct fb_info *info) in set_blitting_type() argument
651 ops->p = &fb_display[vc->vc_num]; in set_blitting_type()
654 fbcon_set_tileops(vc, info); in set_blitting_type()
672 static void set_blitting_type(struct vc_data *vc, struct fb_info *info) in set_blitting_type() argument
677 ops->p = &fb_display[vc->vc_num]; in set_blitting_type()
741 static int con2fb_acquire_newinfo(struct vc_data *vc, struct fb_info *info, in con2fb_acquire_newinfo() argument
750 if (vc) in con2fb_acquire_newinfo()
751 set_blitting_type(vc, info); in con2fb_acquire_newinfo()
756 static void con2fb_release_oldinfo(struct vc_data *vc, struct fb_info *oldinfo, in con2fb_release_oldinfo() argument
780 static void con2fb_init_display(struct vc_data *vc, struct fb_info *info, in con2fb_init_display() argument
827 struct vc_data *vc = vc_cons[unit].d; in set_con2fb_map() local
850 err = con2fb_acquire_newinfo(vc, info, unit); in set_con2fb_map()
855 } else if (vc) { in set_con2fb_map()
856 set_blitting_type(vc, info); in set_con2fb_map()
866 con2fb_release_oldinfo(vc, oldinfo, info); in set_con2fb_map()
872 con2fb_init_display(vc, info, unit, show_logo); in set_con2fb_map()
931 struct vc_data *vc = vc_cons[fg_console].d; in fbcon_startup() local
965 set_blitting_type(vc, info); in fbcon_startup()
974 vc->vc_font.width = font->width; in fbcon_startup()
975 vc->vc_font.height = font->height; in fbcon_startup()
976 vc->vc_font.data = (void *)(p->fontdata = font->data); in fbcon_startup()
977 vc->vc_font.charcount = font->charcount; in fbcon_startup()
982 cols /= vc->vc_font.width; in fbcon_startup()
983 rows /= vc->vc_font.height; in fbcon_startup()
984 vc_resize(vc, cols, rows); in fbcon_startup()
996 static void fbcon_init(struct vc_data *vc, int init) in fbcon_init() argument
1000 struct vc_data **default_mode = vc->vc_display_fg; in fbcon_init()
1002 struct fbcon_display *t, *p = &fb_display[vc->vc_num]; in fbcon_init()
1009 if (con2fb_map[vc->vc_num] == -1) in fbcon_init()
1010 con2fb_map[vc->vc_num] = info_idx; in fbcon_init()
1012 info = fbcon_info_from_console(vc->vc_num); in fbcon_init()
1017 if (vc != svc || logo_shown == FBCON_LOGO_DONTSHOW || in fbcon_init()
1025 con2fb_acquire_newinfo(vc, info, vc->vc_num); in fbcon_init()
1034 vc->vc_font.data = (void *)(p->fontdata = in fbcon_init()
1036 vc->vc_font.width = fvc->vc_font.width; in fbcon_init()
1037 vc->vc_font.height = fvc->vc_font.height; in fbcon_init()
1038 vc->vc_font.charcount = fvc->vc_font.charcount; in fbcon_init()
1051 vc->vc_font.width = font->width; in fbcon_init()
1052 vc->vc_font.height = font->height; in fbcon_init()
1053 vc->vc_font.data = (void *)(p->fontdata = font->data); in fbcon_init()
1054 vc->vc_font.charcount = font->charcount; in fbcon_init()
1058 vc->vc_can_do_color = (fb_get_color_depth(&info->var, &info->fix)!=1); in fbcon_init()
1059 vc->vc_complement_mask = vc->vc_can_do_color ? 0x7700 : 0x0800; in fbcon_init()
1060 if (vc->vc_font.charcount == 256) { in fbcon_init()
1061 vc->vc_hi_font_mask = 0; in fbcon_init()
1063 vc->vc_hi_font_mask = 0x100; in fbcon_init()
1064 if (vc->vc_can_do_color) in fbcon_init()
1065 vc->vc_complement_mask <<= 1; in fbcon_init()
1070 if (!*vc->uni_pagedict_loc) in fbcon_init()
1071 con_copy_unimap(vc, svc); in fbcon_init()
1074 ops->cur_blink_jiffies = msecs_to_jiffies(vc->vc_cur_blink_ms); in fbcon_init()
1082 set_blitting_type(vc, info); in fbcon_init()
1084 cols = vc->vc_cols; in fbcon_init()
1085 rows = vc->vc_rows; in fbcon_init()
1088 new_cols /= vc->vc_font.width; in fbcon_init()
1089 new_rows /= vc->vc_font.height; in fbcon_init()
1098 if (con_is_visible(vc) && vc->vc_mode == KD_TEXT) { in fbcon_init()
1127 vc->vc_cols = new_cols; in fbcon_init()
1128 vc->vc_rows = new_rows; in fbcon_init()
1130 vc_resize(vc, new_cols, new_rows); in fbcon_init()
1133 fbcon_prepare_logo(vc, info, cols, rows, new_cols, new_rows); in fbcon_init()
1135 if (ops->rotate_font && ops->rotate_font(info, vc)) { in fbcon_init()
1137 set_blitting_type(vc, info); in fbcon_init()
1151 static void set_vc_hi_font(struct vc_data *vc, bool set);
1174 static void fbcon_deinit(struct vc_data *vc) in fbcon_deinit() argument
1176 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_deinit()
1182 idx = con2fb_map[vc->vc_num]; in fbcon_deinit()
1197 if (con_is_visible(vc)) in fbcon_deinit()
1204 vc->vc_font.data = NULL; in fbcon_deinit()
1206 if (vc->vc_hi_font_mask && vc->vc_screenbuf) in fbcon_deinit()
1207 set_vc_hi_font(vc, false); in fbcon_deinit()
1212 if (vc->vc_num == logo_shown) in fbcon_deinit()
1243 static void fbcon_clear(struct vc_data *vc, int sy, int sx, int height, in fbcon_clear() argument
1246 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_clear()
1249 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_clear()
1252 if (fbcon_is_inactive(vc, info)) in fbcon_clear()
1258 if (sy < vc->vc_top && vc->vc_top == logo_lines) { in fbcon_clear()
1259 vc->vc_top = 0; in fbcon_clear()
1266 fbcon_clear_margins(vc, 0); in fbcon_clear()
1269 fg = get_color(vc, info, vc->vc_video_erase_char, 1); in fbcon_clear()
1270 bg = get_color(vc, info, vc->vc_video_erase_char, 0); in fbcon_clear()
1276 ops->clear(vc, info, real_y(p, sy), sx, b, width, fg, bg); in fbcon_clear()
1277 ops->clear(vc, info, real_y(p, sy + b), sx, height - b, in fbcon_clear()
1280 ops->clear(vc, info, real_y(p, sy), sx, height, width, fg, bg); in fbcon_clear()
1283 static void fbcon_putcs(struct vc_data *vc, const unsigned short *s, in fbcon_putcs() argument
1286 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_putcs()
1287 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_putcs()
1290 if (!fbcon_is_inactive(vc, info)) in fbcon_putcs()
1291 ops->putcs(vc, info, s, count, real_y(p, ypos), xpos, in fbcon_putcs()
1292 get_color(vc, info, scr_readw(s), 1), in fbcon_putcs()
1293 get_color(vc, info, scr_readw(s), 0)); in fbcon_putcs()
1296 static void fbcon_putc(struct vc_data *vc, int c, int ypos, int xpos) in fbcon_putc() argument
1301 fbcon_putcs(vc, &chr, 1, ypos, xpos); in fbcon_putc()
1304 static void fbcon_clear_margins(struct vc_data *vc, int bottom_only) in fbcon_clear_margins() argument
1306 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_clear_margins()
1309 if (!fbcon_is_inactive(vc, info)) in fbcon_clear_margins()
1310 ops->clear_margins(vc, info, margin_color, bottom_only); in fbcon_clear_margins()
1313 static void fbcon_cursor(struct vc_data *vc, int mode) in fbcon_cursor() argument
1315 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_cursor()
1317 int c = scr_readw((u16 *) vc->vc_pos); in fbcon_cursor()
1319 ops->cur_blink_jiffies = msecs_to_jiffies(vc->vc_cur_blink_ms); in fbcon_cursor()
1321 if (fbcon_is_inactive(vc, info) || vc->vc_deccm != 1) in fbcon_cursor()
1324 if (vc->vc_cursor_type & CUR_SW) in fbcon_cursor()
1334 ops->cursor(vc, info, mode, get_color(vc, info, c, 1), in fbcon_cursor()
1335 get_color(vc, info, c, 0)); in fbcon_cursor()
1346 struct vc_data **default_mode, *vc; in fbcon_set_disp() local
1356 vc = vc_cons[unit].d; in fbcon_set_disp()
1358 if (!vc) in fbcon_set_disp()
1361 default_mode = vc->vc_display_fg; in fbcon_set_disp()
1365 if (!vc->vc_font.data) { in fbcon_set_disp()
1366 vc->vc_font.data = (void *)(p->fontdata = t->fontdata); in fbcon_set_disp()
1367 vc->vc_font.width = (*default_mode)->vc_font.width; in fbcon_set_disp()
1368 vc->vc_font.height = (*default_mode)->vc_font.height; in fbcon_set_disp()
1369 vc->vc_font.charcount = (*default_mode)->vc_font.charcount; in fbcon_set_disp()
1381 vc->vc_can_do_color = (fb_get_color_depth(&info->var, &info->fix)!=1); in fbcon_set_disp()
1382 vc->vc_complement_mask = vc->vc_can_do_color ? 0x7700 : 0x0800; in fbcon_set_disp()
1383 if (vc->vc_font.charcount == 256) { in fbcon_set_disp()
1384 vc->vc_hi_font_mask = 0; in fbcon_set_disp()
1386 vc->vc_hi_font_mask = 0x100; in fbcon_set_disp()
1387 if (vc->vc_can_do_color) in fbcon_set_disp()
1388 vc->vc_complement_mask <<= 1; in fbcon_set_disp()
1393 if (!*vc->uni_pagedict_loc) in fbcon_set_disp()
1394 con_copy_unimap(vc, svc); in fbcon_set_disp()
1398 cols /= vc->vc_font.width; in fbcon_set_disp()
1399 rows /= vc->vc_font.height; in fbcon_set_disp()
1400 vc_resize(vc, cols, rows); in fbcon_set_disp()
1402 if (con_is_visible(vc)) { in fbcon_set_disp()
1403 update_screen(vc); in fbcon_set_disp()
1407 static __inline__ void ywrap_up(struct vc_data *vc, int count) in ywrap_up() argument
1409 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in ywrap_up()
1411 struct fbcon_display *p = &fb_display[vc->vc_num]; in ywrap_up()
1417 ops->var.yoffset = p->yscroll * vc->vc_font.height; in ywrap_up()
1426 static __inline__ void ywrap_down(struct vc_data *vc, int count) in ywrap_down() argument
1428 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in ywrap_down()
1430 struct fbcon_display *p = &fb_display[vc->vc_num]; in ywrap_down()
1436 ops->var.yoffset = p->yscroll * vc->vc_font.height; in ywrap_down()
1445 static __inline__ void ypan_up(struct vc_data *vc, int count) in ypan_up() argument
1447 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in ypan_up()
1448 struct fbcon_display *p = &fb_display[vc->vc_num]; in ypan_up()
1452 if (p->yscroll > p->vrows - vc->vc_rows) { in ypan_up()
1453 ops->bmove(vc, info, p->vrows - vc->vc_rows, in ypan_up()
1454 0, 0, 0, vc->vc_rows, vc->vc_cols); in ypan_up()
1455 p->yscroll -= p->vrows - vc->vc_rows; in ypan_up()
1459 ops->var.yoffset = p->yscroll * vc->vc_font.height; in ypan_up()
1462 fbcon_clear_margins(vc, 1); in ypan_up()
1469 static __inline__ void ypan_up_redraw(struct vc_data *vc, int t, int count) in ypan_up_redraw() argument
1471 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in ypan_up_redraw()
1473 struct fbcon_display *p = &fb_display[vc->vc_num]; in ypan_up_redraw()
1477 if (p->yscroll > p->vrows - vc->vc_rows) { in ypan_up_redraw()
1478 p->yscroll -= p->vrows - vc->vc_rows; in ypan_up_redraw()
1479 fbcon_redraw_move(vc, p, t + count, vc->vc_rows - count, t); in ypan_up_redraw()
1483 ops->var.yoffset = p->yscroll * vc->vc_font.height; in ypan_up_redraw()
1486 fbcon_clear_margins(vc, 1); in ypan_up_redraw()
1493 static __inline__ void ypan_down(struct vc_data *vc, int count) in ypan_down() argument
1495 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in ypan_down()
1496 struct fbcon_display *p = &fb_display[vc->vc_num]; in ypan_down()
1501 ops->bmove(vc, info, 0, 0, p->vrows - vc->vc_rows, in ypan_down()
1502 0, vc->vc_rows, vc->vc_cols); in ypan_down()
1503 p->yscroll += p->vrows - vc->vc_rows; in ypan_down()
1507 ops->var.yoffset = p->yscroll * vc->vc_font.height; in ypan_down()
1510 fbcon_clear_margins(vc, 1); in ypan_down()
1517 static __inline__ void ypan_down_redraw(struct vc_data *vc, int t, int count) in ypan_down_redraw() argument
1519 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in ypan_down_redraw()
1521 struct fbcon_display *p = &fb_display[vc->vc_num]; in ypan_down_redraw()
1526 p->yscroll += p->vrows - vc->vc_rows; in ypan_down_redraw()
1527 fbcon_redraw_move(vc, p, t, vc->vc_rows - count, t + count); in ypan_down_redraw()
1531 ops->var.yoffset = p->yscroll * vc->vc_font.height; in ypan_down_redraw()
1534 fbcon_clear_margins(vc, 1); in ypan_down_redraw()
1541 static void fbcon_redraw_move(struct vc_data *vc, struct fbcon_display *p, in fbcon_redraw_move() argument
1545 (vc->vc_origin + vc->vc_size_row * line); in fbcon_redraw_move()
1559 fbcon_putcs(vc, start, s - start, in fbcon_redraw_move()
1569 fbcon_putcs(vc, start, s - start, dy, x); in fbcon_redraw_move()
1575 static void fbcon_redraw_blit(struct vc_data *vc, struct fb_info *info, in fbcon_redraw_blit() argument
1578 int offset = ycount * vc->vc_cols; in fbcon_redraw_blit()
1580 (vc->vc_origin + vc->vc_size_row * line); in fbcon_redraw_blit()
1595 ops->bmove(vc, info, line + ycount, x, in fbcon_redraw_blit()
1611 ops->bmove(vc, info, line + ycount, x, line, x, 1, in fbcon_redraw_blit()
1619 s -= vc->vc_size_row; in fbcon_redraw_blit()
1620 d -= vc->vc_size_row; in fbcon_redraw_blit()
1625 static void fbcon_redraw(struct vc_data *vc, int line, int count, int offset) in fbcon_redraw() argument
1628 (vc->vc_origin + vc->vc_size_row * line); in fbcon_redraw()
1643 fbcon_putcs(vc, start, s - start, in fbcon_redraw()
1651 fbcon_putcs(vc, start, s - start, in fbcon_redraw()
1666 fbcon_putcs(vc, start, s - start, line, x); in fbcon_redraw()
1673 s -= vc->vc_size_row; in fbcon_redraw()
1674 d -= vc->vc_size_row; in fbcon_redraw()
1679 static void fbcon_bmove_rec(struct vc_data *vc, struct fbcon_display *p, int sy, int sx, in fbcon_bmove_rec() argument
1682 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_bmove_rec()
1689 fbcon_bmove_rec(vc, p, sy, sx, dy, dx, b, width, in fbcon_bmove_rec()
1691 fbcon_bmove_rec(vc, p, sy + b, sx, dy + b, dx, in fbcon_bmove_rec()
1694 fbcon_bmove_rec(vc, p, sy + b, sx, dy + b, dx, in fbcon_bmove_rec()
1696 fbcon_bmove_rec(vc, p, sy, sx, dy, dx, b, width, in fbcon_bmove_rec()
1705 fbcon_bmove_rec(vc, p, sy, sx, dy, dx, b, width, in fbcon_bmove_rec()
1707 fbcon_bmove_rec(vc, p, sy + b, sx, dy + b, dx, in fbcon_bmove_rec()
1710 fbcon_bmove_rec(vc, p, sy + b, sx, dy + b, dx, in fbcon_bmove_rec()
1712 fbcon_bmove_rec(vc, p, sy, sx, dy, dx, b, width, in fbcon_bmove_rec()
1717 ops->bmove(vc, info, real_y(p, sy), sx, real_y(p, dy), dx, in fbcon_bmove_rec()
1721 static void fbcon_bmove(struct vc_data *vc, int sy, int sx, int dy, int dx, in fbcon_bmove() argument
1724 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_bmove()
1725 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_bmove()
1727 if (fbcon_is_inactive(vc, info)) in fbcon_bmove()
1740 fbcon_bmove_rec(vc, p, sy, sx, dy, dx, height, width, in fbcon_bmove()
1744 static bool fbcon_scroll(struct vc_data *vc, unsigned int t, unsigned int b, in fbcon_scroll() argument
1747 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_scroll()
1748 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_scroll()
1751 if (fbcon_is_inactive(vc, info)) in fbcon_scroll()
1754 fbcon_cursor(vc, CM_ERASE); in fbcon_scroll()
1764 if (count > vc->vc_rows) /* Maximum realistic size */ in fbcon_scroll()
1765 count = vc->vc_rows; in fbcon_scroll()
1768 fbcon_redraw_blit(vc, info, p, t, b - t - count, in fbcon_scroll()
1770 fbcon_clear(vc, b - count, 0, count, vc->vc_cols); in fbcon_scroll()
1771 scr_memsetw((unsigned short *) (vc->vc_origin + in fbcon_scroll()
1772 vc->vc_size_row * in fbcon_scroll()
1774 vc->vc_video_erase_char, in fbcon_scroll()
1775 vc->vc_size_row * count); in fbcon_scroll()
1779 if (b - t - count > 3 * vc->vc_rows >> 2) { in fbcon_scroll()
1781 fbcon_bmove(vc, 0, 0, count, 0, t, in fbcon_scroll()
1782 vc->vc_cols); in fbcon_scroll()
1783 ywrap_up(vc, count); in fbcon_scroll()
1784 if (vc->vc_rows - b > 0) in fbcon_scroll()
1785 fbcon_bmove(vc, b - count, 0, b, 0, in fbcon_scroll()
1786 vc->vc_rows - b, in fbcon_scroll()
1787 vc->vc_cols); in fbcon_scroll()
1789 fbcon_bmove(vc, t + count, 0, t, 0, in fbcon_scroll()
1790 b - t - count, vc->vc_cols); in fbcon_scroll()
1793 fbcon_clear(vc, b - count, 0, count, vc->vc_cols); in fbcon_scroll()
1798 2 * (p->vrows - vc->vc_rows)) in fbcon_scroll()
1799 && ((!scroll_partial && (b - t == vc->vc_rows)) in fbcon_scroll()
1802 3 * vc->vc_rows >> 2)))) { in fbcon_scroll()
1804 fbcon_redraw_move(vc, p, 0, t, count); in fbcon_scroll()
1805 ypan_up_redraw(vc, t, count); in fbcon_scroll()
1806 if (vc->vc_rows - b > 0) in fbcon_scroll()
1807 fbcon_redraw_move(vc, p, b, in fbcon_scroll()
1808 vc->vc_rows - b, b); in fbcon_scroll()
1810 fbcon_redraw_move(vc, p, t + count, b - t - count, t); in fbcon_scroll()
1811 fbcon_clear(vc, b - count, 0, count, vc->vc_cols); in fbcon_scroll()
1816 2 * (p->vrows - vc->vc_rows)) in fbcon_scroll()
1817 && ((!scroll_partial && (b - t == vc->vc_rows)) in fbcon_scroll()
1820 3 * vc->vc_rows >> 2)))) { in fbcon_scroll()
1822 fbcon_bmove(vc, 0, 0, count, 0, t, in fbcon_scroll()
1823 vc->vc_cols); in fbcon_scroll()
1824 ypan_up(vc, count); in fbcon_scroll()
1825 if (vc->vc_rows - b > 0) in fbcon_scroll()
1826 fbcon_bmove(vc, b - count, 0, b, 0, in fbcon_scroll()
1827 vc->vc_rows - b, in fbcon_scroll()
1828 vc->vc_cols); in fbcon_scroll()
1830 fbcon_bmove(vc, t + count, 0, t, 0, in fbcon_scroll()
1831 b - t - count, vc->vc_cols); in fbcon_scroll()
1834 fbcon_clear(vc, b - count, 0, count, vc->vc_cols); in fbcon_scroll()
1839 fbcon_redraw(vc, t, b - t - count, in fbcon_scroll()
1840 count * vc->vc_cols); in fbcon_scroll()
1841 fbcon_clear(vc, b - count, 0, count, vc->vc_cols); in fbcon_scroll()
1842 scr_memsetw((unsigned short *) (vc->vc_origin + in fbcon_scroll()
1843 vc->vc_size_row * in fbcon_scroll()
1845 vc->vc_video_erase_char, in fbcon_scroll()
1846 vc->vc_size_row * count); in fbcon_scroll()
1852 if (count > vc->vc_rows) /* Maximum realistic size */ in fbcon_scroll()
1853 count = vc->vc_rows; in fbcon_scroll()
1856 fbcon_redraw_blit(vc, info, p, b - 1, b - t - count, in fbcon_scroll()
1858 fbcon_clear(vc, t, 0, count, vc->vc_cols); in fbcon_scroll()
1859 scr_memsetw((unsigned short *) (vc->vc_origin + in fbcon_scroll()
1860 vc->vc_size_row * in fbcon_scroll()
1862 vc->vc_video_erase_char, in fbcon_scroll()
1863 vc->vc_size_row * count); in fbcon_scroll()
1867 if (b - t - count > 3 * vc->vc_rows >> 2) { in fbcon_scroll()
1868 if (vc->vc_rows - b > 0) in fbcon_scroll()
1869 fbcon_bmove(vc, b, 0, b - count, 0, in fbcon_scroll()
1870 vc->vc_rows - b, in fbcon_scroll()
1871 vc->vc_cols); in fbcon_scroll()
1872 ywrap_down(vc, count); in fbcon_scroll()
1874 fbcon_bmove(vc, count, 0, 0, 0, t, in fbcon_scroll()
1875 vc->vc_cols); in fbcon_scroll()
1877 fbcon_bmove(vc, t, 0, t + count, 0, in fbcon_scroll()
1878 b - t - count, vc->vc_cols); in fbcon_scroll()
1881 fbcon_clear(vc, t, 0, count, vc->vc_cols); in fbcon_scroll()
1885 if ((count - p->yscroll <= p->vrows - vc->vc_rows) in fbcon_scroll()
1886 && ((!scroll_partial && (b - t == vc->vc_rows)) in fbcon_scroll()
1889 3 * vc->vc_rows >> 2)))) { in fbcon_scroll()
1890 if (vc->vc_rows - b > 0) in fbcon_scroll()
1891 fbcon_bmove(vc, b, 0, b - count, 0, in fbcon_scroll()
1892 vc->vc_rows - b, in fbcon_scroll()
1893 vc->vc_cols); in fbcon_scroll()
1894 ypan_down(vc, count); in fbcon_scroll()
1896 fbcon_bmove(vc, count, 0, 0, 0, t, in fbcon_scroll()
1897 vc->vc_cols); in fbcon_scroll()
1899 fbcon_bmove(vc, t, 0, t + count, 0, in fbcon_scroll()
1900 b - t - count, vc->vc_cols); in fbcon_scroll()
1903 fbcon_clear(vc, t, 0, count, vc->vc_cols); in fbcon_scroll()
1907 if ((count - p->yscroll <= p->vrows - vc->vc_rows) in fbcon_scroll()
1908 && ((!scroll_partial && (b - t == vc->vc_rows)) in fbcon_scroll()
1911 3 * vc->vc_rows >> 2)))) { in fbcon_scroll()
1912 if (vc->vc_rows - b > 0) in fbcon_scroll()
1913 fbcon_redraw_move(vc, p, b, vc->vc_rows - b, in fbcon_scroll()
1915 ypan_down_redraw(vc, t, count); in fbcon_scroll()
1917 fbcon_redraw_move(vc, p, count, t, 0); in fbcon_scroll()
1919 fbcon_redraw_move(vc, p, t, b - t - count, t + count); in fbcon_scroll()
1920 fbcon_clear(vc, t, 0, count, vc->vc_cols); in fbcon_scroll()
1925 fbcon_redraw(vc, b - 1, b - t - count, in fbcon_scroll()
1926 -count * vc->vc_cols); in fbcon_scroll()
1927 fbcon_clear(vc, t, 0, count, vc->vc_cols); in fbcon_scroll()
1928 scr_memsetw((unsigned short *) (vc->vc_origin + in fbcon_scroll()
1929 vc->vc_size_row * in fbcon_scroll()
1931 vc->vc_video_erase_char, in fbcon_scroll()
1932 vc->vc_size_row * count); in fbcon_scroll()
1942 struct vc_data *vc) in updatescrollmode_accel() argument
1955 divides(ypan, vc->vc_font.height) && vyres > yres; in updatescrollmode_accel()
1957 divides(ywrap, vc->vc_font.height) && in updatescrollmode_accel()
1958 divides(vc->vc_font.height, vyres) && in updatescrollmode_accel()
1959 divides(vc->vc_font.height, yres); in updatescrollmode_accel()
1984 struct vc_data *vc) in updatescrollmode() argument
1987 int fh = vc->vc_font.height; in updatescrollmode()
1993 if (yres > (fh * (vc->vc_rows + 1))) in updatescrollmode()
1994 p->vrows -= (yres - (fh * vc->vc_rows)) / fh; in updatescrollmode()
1999 updatescrollmode_accel(p, info, vc); in updatescrollmode()
2005 static int fbcon_resize(struct vc_data *vc, unsigned int width, in fbcon_resize() argument
2008 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_resize()
2010 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_resize()
2014 if (p->userfont && FNTSIZE(vc->vc_font.data)) { in fbcon_resize()
2016 int pitch = PITCH(vc->vc_font.width); in fbcon_resize()
2027 size = CALC_FONTSZ(vc->vc_font.height, pitch, vc->vc_font.charcount); in fbcon_resize()
2028 if (size > FNTSIZE(vc->vc_font.data)) in fbcon_resize()
2034 virt_fw = FBCON_SWAP(ops->rotate, vc->vc_font.width, in fbcon_resize()
2035 vc->vc_font.height); in fbcon_resize()
2036 virt_fh = FBCON_SWAP(ops->rotate, vc->vc_font.height, in fbcon_resize()
2037 vc->vc_font.width); in fbcon_resize()
2057 if (con_is_visible(vc) && vc->vc_mode == KD_TEXT) { in fbcon_resize()
2065 updatescrollmode(p, info, vc); in fbcon_resize()
2069 static int fbcon_switch(struct vc_data *vc) in fbcon_switch() argument
2073 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_switch()
2077 info = fbcon_info_from_console(vc->vc_num); in fbcon_switch()
2104 o->currcon = vc->vc_num; in fbcon_switch()
2135 if (fbcon_is_inactive(vc, info) || in fbcon_switch()
2141 set_blitting_type(vc, info); in fbcon_switch()
2144 if (ops->rotate_font && ops->rotate_font(info, vc)) { in fbcon_switch()
2146 set_blitting_type(vc, info); in fbcon_switch()
2149 vc->vc_can_do_color = (fb_get_color_depth(&info->var, &info->fix)!=1); in fbcon_switch()
2150 vc->vc_complement_mask = vc->vc_can_do_color ? 0x7700 : 0x0800; in fbcon_switch()
2152 if (vc->vc_font.charcount > 256) in fbcon_switch()
2153 vc->vc_complement_mask <<= 1; in fbcon_switch()
2155 updatescrollmode(p, info, vc); in fbcon_switch()
2159 scrollback_phys_max = p->vrows - vc->vc_rows; in fbcon_switch()
2163 scrollback_phys_max = p->vrows - 2 * vc->vc_rows; in fbcon_switch()
2175 if (!fbcon_is_inactive(vc, info)) { in fbcon_switch()
2180 fbcon_set_palette(vc, color_table); in fbcon_switch()
2181 fbcon_clear_margins(vc, 0); in fbcon_switch()
2187 update_region(vc, in fbcon_switch()
2188 vc->vc_origin + vc->vc_size_row * vc->vc_top, in fbcon_switch()
2189 vc->vc_size_row * (vc->vc_bottom - in fbcon_switch()
2190 vc->vc_top) / 2); in fbcon_switch()
2196 static void fbcon_generic_blank(struct vc_data *vc, struct fb_info *info, in fbcon_generic_blank() argument
2200 unsigned short charmask = vc->vc_hi_font_mask ? in fbcon_generic_blank()
2204 oldc = vc->vc_video_erase_char; in fbcon_generic_blank()
2205 vc->vc_video_erase_char &= charmask; in fbcon_generic_blank()
2206 fbcon_clear(vc, 0, 0, vc->vc_rows, vc->vc_cols); in fbcon_generic_blank()
2207 vc->vc_video_erase_char = oldc; in fbcon_generic_blank()
2211 static int fbcon_blank(struct vc_data *vc, int blank, int mode_switch) in fbcon_blank() argument
2213 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_blank()
2230 if (!fbcon_is_inactive(vc, info)) { in fbcon_blank()
2233 fbcon_cursor(vc, blank ? CM_ERASE : CM_DRAW); in fbcon_blank()
2237 fbcon_generic_blank(vc, info, blank); in fbcon_blank()
2241 update_screen(vc); in fbcon_blank()
2244 if (mode_switch || fbcon_is_inactive(vc, info) || in fbcon_blank()
2253 static int fbcon_debug_enter(struct vc_data *vc) in fbcon_debug_enter() argument
2255 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_debug_enter()
2262 fbcon_set_palette(vc, color_table); in fbcon_debug_enter()
2266 static int fbcon_debug_leave(struct vc_data *vc) in fbcon_debug_leave() argument
2268 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_debug_leave()
2277 static int fbcon_get_font(struct vc_data *vc, struct console_font *font, unsigned int vpitch) in fbcon_get_font() argument
2279 u8 *fontdata = vc->vc_font.data; in fbcon_get_font()
2283 font->width = vc->vc_font.width; in fbcon_get_font()
2284 font->height = vc->vc_font.height; in fbcon_get_font()
2287 font->charcount = vc->vc_hi_font_mask ? 512 : 256; in fbcon_get_font()
2292 j = vc->vc_font.height; in fbcon_get_font()
2303 j = vc->vc_font.height * 2; in fbcon_get_font()
2314 if (font->charcount * (vc->vc_font.height * sizeof(u32)) > FNTSIZE(fontdata)) in fbcon_get_font()
2318 for (j = 0; j < vc->vc_font.height; j++) { in fbcon_get_font()
2328 j = vc->vc_font.height * 4; in fbcon_get_font()
2343 static void set_vc_hi_font(struct vc_data *vc, bool set) in set_vc_hi_font() argument
2346 vc->vc_hi_font_mask = 0; in set_vc_hi_font()
2347 if (vc->vc_can_do_color) { in set_vc_hi_font()
2348 vc->vc_complement_mask >>= 1; in set_vc_hi_font()
2349 vc->vc_s_complement_mask >>= 1; in set_vc_hi_font()
2353 if (vc->vc_can_do_color) { in set_vc_hi_font()
2355 (unsigned short *) vc->vc_origin; in set_vc_hi_font()
2356 int count = vc->vc_screenbuf_size / 2; in set_vc_hi_font()
2363 c = vc->vc_video_erase_char; in set_vc_hi_font()
2364 vc->vc_video_erase_char = in set_vc_hi_font()
2366 vc->vc_attr >>= 1; in set_vc_hi_font()
2369 vc->vc_hi_font_mask = 0x100; in set_vc_hi_font()
2370 if (vc->vc_can_do_color) { in set_vc_hi_font()
2371 vc->vc_complement_mask <<= 1; in set_vc_hi_font()
2372 vc->vc_s_complement_mask <<= 1; in set_vc_hi_font()
2378 (unsigned short *) vc->vc_origin; in set_vc_hi_font()
2379 int count = vc->vc_screenbuf_size / 2; in set_vc_hi_font()
2384 if (vc->vc_can_do_color) in set_vc_hi_font()
2392 c = vc->vc_video_erase_char; in set_vc_hi_font()
2393 if (vc->vc_can_do_color) { in set_vc_hi_font()
2394 vc->vc_video_erase_char = in set_vc_hi_font()
2396 vc->vc_attr <<= 1; in set_vc_hi_font()
2398 vc->vc_video_erase_char = c & ~0x100; in set_vc_hi_font()
2403 static int fbcon_do_set_font(struct vc_data *vc, int w, int h, int charcount, in fbcon_do_set_font() argument
2406 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_do_set_font()
2408 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_do_set_font()
2410 u8 *old_data = vc->vc_font.data; in fbcon_do_set_font()
2412 resize = (w != vc->vc_font.width) || (h != vc->vc_font.height); in fbcon_do_set_font()
2413 vc->vc_font.data = (void *)(p->fontdata = data); in fbcon_do_set_font()
2418 old_width = vc->vc_font.width; in fbcon_do_set_font()
2419 old_height = vc->vc_font.height; in fbcon_do_set_font()
2420 old_charcount = vc->vc_font.charcount; in fbcon_do_set_font()
2422 vc->vc_font.width = w; in fbcon_do_set_font()
2423 vc->vc_font.height = h; in fbcon_do_set_font()
2424 vc->vc_font.charcount = charcount; in fbcon_do_set_font()
2425 if (vc->vc_hi_font_mask && charcount == 256) in fbcon_do_set_font()
2426 set_vc_hi_font(vc, false); in fbcon_do_set_font()
2427 else if (!vc->vc_hi_font_mask && charcount == 512) in fbcon_do_set_font()
2428 set_vc_hi_font(vc, true); in fbcon_do_set_font()
2437 ret = vc_resize(vc, cols, rows); in fbcon_do_set_font()
2440 } else if (con_is_visible(vc) in fbcon_do_set_font()
2441 && vc->vc_mode == KD_TEXT) { in fbcon_do_set_font()
2442 fbcon_clear_margins(vc, 0); in fbcon_do_set_font()
2443 update_screen(vc); in fbcon_do_set_font()
2452 vc->vc_font.data = old_data; in fbcon_do_set_font()
2460 vc->vc_font.width = old_width; in fbcon_do_set_font()
2461 vc->vc_font.height = old_height; in fbcon_do_set_font()
2462 vc->vc_font.charcount = old_charcount; in fbcon_do_set_font()
2472 static int fbcon_set_font(struct vc_data *vc, struct console_font *font, in fbcon_set_font() argument
2475 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_set_font()
2542 return fbcon_do_set_font(vc, font->width, font->height, charcount, new_data, 1); in fbcon_set_font()
2545 static int fbcon_set_def_font(struct vc_data *vc, struct console_font *font, char *name) in fbcon_set_def_font() argument
2547 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_set_def_font()
2558 return fbcon_do_set_font(vc, f->width, f->height, f->charcount, f->data, 0); in fbcon_set_def_font()
2569 static void fbcon_set_palette(struct vc_data *vc, const unsigned char *table) in fbcon_set_palette() argument
2571 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_set_palette()
2575 if (fbcon_is_inactive(vc, info)) in fbcon_set_palette()
2578 if (!con_is_visible(vc)) in fbcon_set_palette()
2585 val = vc->vc_palette[j++]; in fbcon_set_palette()
2587 val = vc->vc_palette[j++]; in fbcon_set_palette()
2589 val = vc->vc_palette[j++]; in fbcon_set_palette()
2604 static u16 *fbcon_screen_pos(const struct vc_data *vc, int offset) in fbcon_screen_pos() argument
2606 return (u16 *) (vc->vc_origin + offset); in fbcon_screen_pos()
2609 static unsigned long fbcon_getxy(struct vc_data *vc, unsigned long pos, in fbcon_getxy() argument
2615 if (pos >= vc->vc_origin && pos < vc->vc_scr_end) { in fbcon_getxy()
2616 unsigned long offset = (pos - vc->vc_origin) / 2; in fbcon_getxy()
2618 x = offset % vc->vc_cols; in fbcon_getxy()
2619 y = offset / vc->vc_cols; in fbcon_getxy()
2620 ret = pos + (vc->vc_cols - x) * 2; in fbcon_getxy()
2624 ret = vc->vc_origin; in fbcon_getxy()
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, CM_ERASE); 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_inactive(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 caps->x |= 1 << (vc->vc_font.width - 1); in fbcon_get_requirement()
3094 caps->y |= 1 << (vc->vc_font.height - 1); 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()
3105 caps->x = 1 << (vc->vc_font.width - 1); in fbcon_get_requirement()
3106 caps->y = 1 << (vc->vc_font.height - 1); in fbcon_get_requirement()
3107 caps->len = vc->vc_font.charcount; in fbcon_get_requirement()