Lines Matching full:vc

166 #define advance_row(p, delta) (unsigned short *)((unsigned long)(p) + (delta) * vc->vc_size_row)
176 static void fbcon_clear_margins(struct vc_data *vc, int bottom_only);
177 static void fbcon_set_palette(struct vc_data *vc, const unsigned char *table);
184 static void fbcon_redraw_move(struct vc_data *vc, struct fbcon_display *p,
228 struct vc_data *vc; in fbcon_rotate_all() local
236 vc = vc_cons[i].d; in fbcon_rotate_all()
237 if (!vc || vc->vc_mode != KD_TEXT || in fbcon_rotate_all()
241 p = &fb_display[vc->vc_num]; in fbcon_rotate_all()
273 static inline int fbcon_is_inactive(struct vc_data *vc, struct fb_info *info) in fbcon_is_inactive() argument
278 vc->vc_mode != KD_TEXT || ops->graphics); in fbcon_is_inactive()
281 static int get_color(struct vc_data *vc, struct fb_info *info, in get_color() argument
288 unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff; in get_color()
290 c = vc->vc_video_erase_char & charmask; in get_color()
294 color = (is_fg) ? attr_fgcol((vc->vc_hi_font_mask) ? 9 : 8, c) in get_color()
295 : attr_bgcol((vc->vc_hi_font_mask) ? 13 : 12, c); in get_color()
352 struct vc_data *vc = NULL; in fb_flashcursor() local
368 vc = vc_cons[ops->currcon].d; in fb_flashcursor()
370 if (!vc || !con_is_visible(vc) || in fb_flashcursor()
371 fbcon_info_from_console(vc->vc_num) != info || in fb_flashcursor()
372 vc->vc_deccm != 1) { in fb_flashcursor()
377 c = scr_readw((u16 *) vc->vc_pos); in fb_flashcursor()
380 ops->cursor(vc, info, mode, get_color(vc, info, c, 1), in fb_flashcursor()
381 get_color(vc, info, c, 0)); in fb_flashcursor()
439 if (!strncmp(options, "vc:", 3)) { in fb_console_setup()
545 static void fbcon_prepare_logo(struct vc_data *vc, struct fb_info *info, in fbcon_prepare_logo() argument
551 static void fbcon_prepare_logo(struct vc_data *vc, struct fb_info *info, in fbcon_prepare_logo() argument
556 int cnt, erase = vc->vc_video_erase_char, step; in fbcon_prepare_logo()
572 logo_lines = DIV_ROUND_UP(logo_height, vc->vc_font.height); in fbcon_prepare_logo()
573 q = (unsigned short *) (vc->vc_origin + in fbcon_prepare_logo()
574 vc->vc_size_row * rows); in fbcon_prepare_logo()
577 if (scr_readw(r) != vc->vc_video_erase_char) in fbcon_prepare_logo()
595 scr_memcpyw(r + step, r, vc->vc_size_row); in fbcon_prepare_logo()
600 if (vc->state.y + logo_lines >= rows) in fbcon_prepare_logo()
601 lines = rows - vc->state.y - 1; in fbcon_prepare_logo()
604 vc->state.y += lines; in fbcon_prepare_logo()
605 vc->vc_pos += lines * vc->vc_size_row; in fbcon_prepare_logo()
608 scr_memsetw((unsigned short *) vc->vc_origin, in fbcon_prepare_logo()
610 vc->vc_size_row * logo_lines); in fbcon_prepare_logo()
612 if (con_is_visible(vc) && vc->vc_mode == KD_TEXT) { in fbcon_prepare_logo()
613 fbcon_clear_margins(vc, 0); in fbcon_prepare_logo()
614 update_screen(vc); in fbcon_prepare_logo()
618 q = (unsigned short *) (vc->vc_origin + in fbcon_prepare_logo()
619 vc->vc_size_row * in fbcon_prepare_logo()
622 vc->state.y += logo_lines; in fbcon_prepare_logo()
623 vc->vc_pos += logo_lines * vc->vc_size_row; in fbcon_prepare_logo()
630 if (logo_lines > vc->vc_bottom) { in fbcon_prepare_logo()
636 vc->vc_top = logo_lines; in fbcon_prepare_logo()
642 static void set_blitting_type(struct vc_data *vc, struct fb_info *info) in set_blitting_type() argument
646 ops->p = &fb_display[vc->vc_num]; in set_blitting_type()
649 fbcon_set_tileops(vc, info); in set_blitting_type()
667 static void set_blitting_type(struct vc_data *vc, struct fb_info *info) in set_blitting_type() argument
672 ops->p = &fb_display[vc->vc_num]; in set_blitting_type()
736 static int con2fb_acquire_newinfo(struct vc_data *vc, struct fb_info *info, in con2fb_acquire_newinfo() argument
745 if (vc) in con2fb_acquire_newinfo()
746 set_blitting_type(vc, info); in con2fb_acquire_newinfo()
751 static void con2fb_release_oldinfo(struct vc_data *vc, struct fb_info *oldinfo, in con2fb_release_oldinfo() argument
775 static void con2fb_init_display(struct vc_data *vc, struct fb_info *info, in con2fb_init_display() argument
822 struct vc_data *vc = vc_cons[unit].d; in set_con2fb_map() local
847 err = con2fb_acquire_newinfo(vc, info, unit); in set_con2fb_map()
857 con2fb_release_oldinfo(vc, oldinfo, info); in set_con2fb_map()
865 con2fb_init_display(vc, info, unit, show_logo); in set_con2fb_map()
924 struct vc_data *vc = vc_cons[fg_console].d; in fbcon_startup() local
958 set_blitting_type(vc, info); in fbcon_startup()
961 if (!p->fontdata && !vc->vc_font.data) { in fbcon_startup()
967 vc->vc_font.width = font->width; in fbcon_startup()
968 vc->vc_font.height = font->height; in fbcon_startup()
969 vc->vc_font.data = (void *)(p->fontdata = font->data); in fbcon_startup()
970 vc->vc_font.charcount = font->charcount; in fbcon_startup()
972 p->fontdata = vc->vc_font.data; in fbcon_startup()
977 cols /= vc->vc_font.width; in fbcon_startup()
978 rows /= vc->vc_font.height; in fbcon_startup()
979 vc_resize(vc, cols, rows); in fbcon_startup()
991 static void fbcon_init(struct vc_data *vc, int init) in fbcon_init() argument
995 struct vc_data **default_mode = vc->vc_display_fg; in fbcon_init()
997 struct fbcon_display *t, *p = &fb_display[vc->vc_num]; in fbcon_init()
1004 if (con2fb_map[vc->vc_num] == -1) in fbcon_init()
1005 con2fb_map[vc->vc_num] = info_idx; in fbcon_init()
1007 info = fbcon_info_from_console(vc->vc_num); in fbcon_init()
1012 if (vc != svc || logo_shown == FBCON_LOGO_DONTSHOW || in fbcon_init()
1020 con2fb_acquire_newinfo(vc, info, vc->vc_num); in fbcon_init()
1029 vc->vc_font.data = (void *)(p->fontdata = in fbcon_init()
1031 vc->vc_font.width = fvc->vc_font.width; in fbcon_init()
1032 vc->vc_font.height = fvc->vc_font.height; in fbcon_init()
1033 vc->vc_font.charcount = fvc->vc_font.charcount; in fbcon_init()
1046 vc->vc_font.width = font->width; in fbcon_init()
1047 vc->vc_font.height = font->height; in fbcon_init()
1048 vc->vc_font.data = (void *)(p->fontdata = font->data); in fbcon_init()
1049 vc->vc_font.charcount = font->charcount; in fbcon_init()
1053 vc->vc_can_do_color = (fb_get_color_depth(&info->var, &info->fix)!=1); in fbcon_init()
1054 vc->vc_complement_mask = vc->vc_can_do_color ? 0x7700 : 0x0800; in fbcon_init()
1055 if (vc->vc_font.charcount == 256) { in fbcon_init()
1056 vc->vc_hi_font_mask = 0; in fbcon_init()
1058 vc->vc_hi_font_mask = 0x100; in fbcon_init()
1059 if (vc->vc_can_do_color) in fbcon_init()
1060 vc->vc_complement_mask <<= 1; in fbcon_init()
1065 if (!*vc->uni_pagedict_loc) in fbcon_init()
1066 con_copy_unimap(vc, svc); in fbcon_init()
1069 ops->cur_blink_jiffies = msecs_to_jiffies(vc->vc_cur_blink_ms); in fbcon_init()
1077 set_blitting_type(vc, info); in fbcon_init()
1079 cols = vc->vc_cols; in fbcon_init()
1080 rows = vc->vc_rows; in fbcon_init()
1083 new_cols /= vc->vc_font.width; in fbcon_init()
1084 new_rows /= vc->vc_font.height; in fbcon_init()
1093 if (con_is_visible(vc) && vc->vc_mode == KD_TEXT) { in fbcon_init()
1122 vc->vc_cols = new_cols; in fbcon_init()
1123 vc->vc_rows = new_rows; in fbcon_init()
1125 vc_resize(vc, new_cols, new_rows); in fbcon_init()
1128 fbcon_prepare_logo(vc, info, cols, rows, new_cols, new_rows); in fbcon_init()
1130 if (ops->rotate_font && ops->rotate_font(info, vc)) { in fbcon_init()
1132 set_blitting_type(vc, info); in fbcon_init()
1146 static void set_vc_hi_font(struct vc_data *vc, bool set);
1169 static void fbcon_deinit(struct vc_data *vc) in fbcon_deinit() argument
1171 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_deinit()
1177 idx = con2fb_map[vc->vc_num]; in fbcon_deinit()
1194 if (con_is_visible(vc)) in fbcon_deinit()
1202 vc->vc_font.data = NULL; in fbcon_deinit()
1204 if (vc->vc_hi_font_mask && vc->vc_screenbuf) in fbcon_deinit()
1205 set_vc_hi_font(vc, false); in fbcon_deinit()
1210 if (vc->vc_num == logo_shown) in fbcon_deinit()
1241 static void fbcon_clear(struct vc_data *vc, int sy, int sx, int height, in fbcon_clear() argument
1244 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_clear()
1247 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_clear()
1250 if (fbcon_is_inactive(vc, info)) in fbcon_clear()
1256 if (sy < vc->vc_top && vc->vc_top == logo_lines) { in fbcon_clear()
1257 vc->vc_top = 0; in fbcon_clear()
1264 fbcon_clear_margins(vc, 0); in fbcon_clear()
1272 ops->clear(vc, info, real_y(p, sy), sx, b, width); in fbcon_clear()
1273 ops->clear(vc, info, real_y(p, sy + b), sx, height - b, in fbcon_clear()
1276 ops->clear(vc, info, real_y(p, sy), sx, height, width); in fbcon_clear()
1279 static void fbcon_putcs(struct vc_data *vc, const unsigned short *s, in fbcon_putcs() argument
1282 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_putcs()
1283 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_putcs()
1286 if (!fbcon_is_inactive(vc, info)) in fbcon_putcs()
1287 ops->putcs(vc, info, s, count, real_y(p, ypos), xpos, in fbcon_putcs()
1288 get_color(vc, info, scr_readw(s), 1), in fbcon_putcs()
1289 get_color(vc, info, scr_readw(s), 0)); in fbcon_putcs()
1292 static void fbcon_putc(struct vc_data *vc, int c, int ypos, int xpos) in fbcon_putc() argument
1297 fbcon_putcs(vc, &chr, 1, ypos, xpos); in fbcon_putc()
1300 static void fbcon_clear_margins(struct vc_data *vc, int bottom_only) in fbcon_clear_margins() argument
1302 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_clear_margins()
1305 if (!fbcon_is_inactive(vc, info)) in fbcon_clear_margins()
1306 ops->clear_margins(vc, info, margin_color, bottom_only); in fbcon_clear_margins()
1309 static void fbcon_cursor(struct vc_data *vc, int mode) in fbcon_cursor() argument
1311 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_cursor()
1313 int c = scr_readw((u16 *) vc->vc_pos); in fbcon_cursor()
1315 ops->cur_blink_jiffies = msecs_to_jiffies(vc->vc_cur_blink_ms); in fbcon_cursor()
1317 if (fbcon_is_inactive(vc, info) || vc->vc_deccm != 1) in fbcon_cursor()
1320 if (vc->vc_cursor_type & CUR_SW) in fbcon_cursor()
1330 ops->cursor(vc, info, mode, get_color(vc, info, c, 1), in fbcon_cursor()
1331 get_color(vc, info, c, 0)); in fbcon_cursor()
1342 struct vc_data **default_mode, *vc; in fbcon_set_disp() local
1352 vc = vc_cons[unit].d; in fbcon_set_disp()
1354 if (!vc) in fbcon_set_disp()
1357 default_mode = vc->vc_display_fg; in fbcon_set_disp()
1361 if (!vc->vc_font.data) { in fbcon_set_disp()
1362 vc->vc_font.data = (void *)(p->fontdata = t->fontdata); in fbcon_set_disp()
1363 vc->vc_font.width = (*default_mode)->vc_font.width; in fbcon_set_disp()
1364 vc->vc_font.height = (*default_mode)->vc_font.height; in fbcon_set_disp()
1365 vc->vc_font.charcount = (*default_mode)->vc_font.charcount; in fbcon_set_disp()
1377 vc->vc_can_do_color = (fb_get_color_depth(&info->var, &info->fix)!=1); in fbcon_set_disp()
1378 vc->vc_complement_mask = vc->vc_can_do_color ? 0x7700 : 0x0800; in fbcon_set_disp()
1379 if (vc->vc_font.charcount == 256) { in fbcon_set_disp()
1380 vc->vc_hi_font_mask = 0; in fbcon_set_disp()
1382 vc->vc_hi_font_mask = 0x100; in fbcon_set_disp()
1383 if (vc->vc_can_do_color) in fbcon_set_disp()
1384 vc->vc_complement_mask <<= 1; in fbcon_set_disp()
1389 if (!*vc->uni_pagedict_loc) in fbcon_set_disp()
1390 con_copy_unimap(vc, svc); in fbcon_set_disp()
1394 cols /= vc->vc_font.width; in fbcon_set_disp()
1395 rows /= vc->vc_font.height; in fbcon_set_disp()
1396 vc_resize(vc, cols, rows); in fbcon_set_disp()
1398 if (con_is_visible(vc)) { in fbcon_set_disp()
1399 update_screen(vc); in fbcon_set_disp()
1403 static __inline__ void ywrap_up(struct vc_data *vc, int count) in ywrap_up() argument
1405 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in ywrap_up()
1407 struct fbcon_display *p = &fb_display[vc->vc_num]; in ywrap_up()
1413 ops->var.yoffset = p->yscroll * vc->vc_font.height; in ywrap_up()
1422 static __inline__ void ywrap_down(struct vc_data *vc, int count) in ywrap_down() argument
1424 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in ywrap_down()
1426 struct fbcon_display *p = &fb_display[vc->vc_num]; in ywrap_down()
1432 ops->var.yoffset = p->yscroll * vc->vc_font.height; in ywrap_down()
1441 static __inline__ void ypan_up(struct vc_data *vc, int count) in ypan_up() argument
1443 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in ypan_up()
1444 struct fbcon_display *p = &fb_display[vc->vc_num]; in ypan_up()
1448 if (p->yscroll > p->vrows - vc->vc_rows) { in ypan_up()
1449 ops->bmove(vc, info, p->vrows - vc->vc_rows, in ypan_up()
1450 0, 0, 0, vc->vc_rows, vc->vc_cols); in ypan_up()
1451 p->yscroll -= p->vrows - vc->vc_rows; in ypan_up()
1455 ops->var.yoffset = p->yscroll * vc->vc_font.height; in ypan_up()
1458 fbcon_clear_margins(vc, 1); in ypan_up()
1465 static __inline__ void ypan_up_redraw(struct vc_data *vc, int t, int count) in ypan_up_redraw() argument
1467 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in ypan_up_redraw()
1469 struct fbcon_display *p = &fb_display[vc->vc_num]; in ypan_up_redraw()
1473 if (p->yscroll > p->vrows - vc->vc_rows) { in ypan_up_redraw()
1474 p->yscroll -= p->vrows - vc->vc_rows; in ypan_up_redraw()
1475 fbcon_redraw_move(vc, p, t + count, vc->vc_rows - count, t); in ypan_up_redraw()
1479 ops->var.yoffset = p->yscroll * vc->vc_font.height; in ypan_up_redraw()
1482 fbcon_clear_margins(vc, 1); in ypan_up_redraw()
1489 static __inline__ void ypan_down(struct vc_data *vc, int count) in ypan_down() argument
1491 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in ypan_down()
1492 struct fbcon_display *p = &fb_display[vc->vc_num]; in ypan_down()
1497 ops->bmove(vc, info, 0, 0, p->vrows - vc->vc_rows, in ypan_down()
1498 0, vc->vc_rows, vc->vc_cols); in ypan_down()
1499 p->yscroll += p->vrows - vc->vc_rows; in ypan_down()
1503 ops->var.yoffset = p->yscroll * vc->vc_font.height; in ypan_down()
1506 fbcon_clear_margins(vc, 1); in ypan_down()
1513 static __inline__ void ypan_down_redraw(struct vc_data *vc, int t, int count) in ypan_down_redraw() argument
1515 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in ypan_down_redraw()
1517 struct fbcon_display *p = &fb_display[vc->vc_num]; in ypan_down_redraw()
1522 p->yscroll += p->vrows - vc->vc_rows; in ypan_down_redraw()
1523 fbcon_redraw_move(vc, p, t, vc->vc_rows - count, t + count); in ypan_down_redraw()
1527 ops->var.yoffset = p->yscroll * vc->vc_font.height; in ypan_down_redraw()
1530 fbcon_clear_margins(vc, 1); in ypan_down_redraw()
1537 static void fbcon_redraw_move(struct vc_data *vc, struct fbcon_display *p, in fbcon_redraw_move() argument
1541 (vc->vc_origin + vc->vc_size_row * line); in fbcon_redraw_move()
1555 fbcon_putcs(vc, start, s - start, in fbcon_redraw_move()
1565 fbcon_putcs(vc, start, s - start, dy, x); in fbcon_redraw_move()
1571 static void fbcon_redraw_blit(struct vc_data *vc, struct fb_info *info, in fbcon_redraw_blit() argument
1574 int offset = ycount * vc->vc_cols; in fbcon_redraw_blit()
1576 (vc->vc_origin + vc->vc_size_row * line); in fbcon_redraw_blit()
1591 ops->bmove(vc, info, line + ycount, x, in fbcon_redraw_blit()
1607 ops->bmove(vc, info, line + ycount, x, line, x, 1, in fbcon_redraw_blit()
1615 s -= vc->vc_size_row; in fbcon_redraw_blit()
1616 d -= vc->vc_size_row; in fbcon_redraw_blit()
1621 static void fbcon_redraw(struct vc_data *vc, struct fbcon_display *p, in fbcon_redraw() argument
1625 (vc->vc_origin + vc->vc_size_row * line); in fbcon_redraw()
1640 fbcon_putcs(vc, start, s - start, in fbcon_redraw()
1648 fbcon_putcs(vc, start, s - start, in fbcon_redraw()
1663 fbcon_putcs(vc, start, s - start, line, x); in fbcon_redraw()
1670 s -= vc->vc_size_row; in fbcon_redraw()
1671 d -= vc->vc_size_row; in fbcon_redraw()
1676 static void fbcon_bmove_rec(struct vc_data *vc, struct fbcon_display *p, int sy, int sx, in fbcon_bmove_rec() argument
1679 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_bmove_rec()
1686 fbcon_bmove_rec(vc, p, sy, sx, dy, dx, b, width, in fbcon_bmove_rec()
1688 fbcon_bmove_rec(vc, p, sy + b, sx, dy + b, dx, in fbcon_bmove_rec()
1691 fbcon_bmove_rec(vc, p, sy + b, sx, dy + b, dx, in fbcon_bmove_rec()
1693 fbcon_bmove_rec(vc, p, sy, sx, dy, dx, b, width, in fbcon_bmove_rec()
1702 fbcon_bmove_rec(vc, p, sy, sx, dy, dx, b, width, in fbcon_bmove_rec()
1704 fbcon_bmove_rec(vc, p, sy + b, sx, dy + b, dx, in fbcon_bmove_rec()
1707 fbcon_bmove_rec(vc, p, sy + b, sx, dy + b, dx, in fbcon_bmove_rec()
1709 fbcon_bmove_rec(vc, p, sy, sx, dy, dx, b, width, in fbcon_bmove_rec()
1714 ops->bmove(vc, info, real_y(p, sy), sx, real_y(p, dy), dx, in fbcon_bmove_rec()
1718 static void fbcon_bmove(struct vc_data *vc, int sy, int sx, int dy, int dx, in fbcon_bmove() argument
1721 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_bmove()
1722 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_bmove()
1724 if (fbcon_is_inactive(vc, info)) in fbcon_bmove()
1737 fbcon_bmove_rec(vc, p, sy, sx, dy, dx, height, width, in fbcon_bmove()
1741 static bool fbcon_scroll(struct vc_data *vc, unsigned int t, unsigned int b, in fbcon_scroll() argument
1744 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_scroll()
1745 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_scroll()
1748 if (fbcon_is_inactive(vc, info)) in fbcon_scroll()
1751 fbcon_cursor(vc, CM_ERASE); in fbcon_scroll()
1761 if (count > vc->vc_rows) /* Maximum realistic size */ in fbcon_scroll()
1762 count = vc->vc_rows; in fbcon_scroll()
1765 fbcon_redraw_blit(vc, info, p, t, b - t - count, in fbcon_scroll()
1767 fbcon_clear(vc, b - count, 0, count, vc->vc_cols); in fbcon_scroll()
1768 scr_memsetw((unsigned short *) (vc->vc_origin + in fbcon_scroll()
1769 vc->vc_size_row * in fbcon_scroll()
1771 vc->vc_video_erase_char, in fbcon_scroll()
1772 vc->vc_size_row * count); in fbcon_scroll()
1776 if (b - t - count > 3 * vc->vc_rows >> 2) { in fbcon_scroll()
1778 fbcon_bmove(vc, 0, 0, count, 0, t, in fbcon_scroll()
1779 vc->vc_cols); in fbcon_scroll()
1780 ywrap_up(vc, count); in fbcon_scroll()
1781 if (vc->vc_rows - b > 0) in fbcon_scroll()
1782 fbcon_bmove(vc, b - count, 0, b, 0, in fbcon_scroll()
1783 vc->vc_rows - b, in fbcon_scroll()
1784 vc->vc_cols); in fbcon_scroll()
1786 fbcon_bmove(vc, t + count, 0, t, 0, in fbcon_scroll()
1787 b - t - count, vc->vc_cols); in fbcon_scroll()
1790 fbcon_clear(vc, b - count, 0, count, vc->vc_cols); in fbcon_scroll()
1795 2 * (p->vrows - vc->vc_rows)) in fbcon_scroll()
1796 && ((!scroll_partial && (b - t == vc->vc_rows)) in fbcon_scroll()
1799 3 * vc->vc_rows >> 2)))) { in fbcon_scroll()
1801 fbcon_redraw_move(vc, p, 0, t, count); in fbcon_scroll()
1802 ypan_up_redraw(vc, t, count); in fbcon_scroll()
1803 if (vc->vc_rows - b > 0) in fbcon_scroll()
1804 fbcon_redraw_move(vc, p, b, in fbcon_scroll()
1805 vc->vc_rows - b, b); in fbcon_scroll()
1807 fbcon_redraw_move(vc, p, t + count, b - t - count, t); in fbcon_scroll()
1808 fbcon_clear(vc, b - count, 0, count, vc->vc_cols); in fbcon_scroll()
1813 2 * (p->vrows - vc->vc_rows)) in fbcon_scroll()
1814 && ((!scroll_partial && (b - t == vc->vc_rows)) in fbcon_scroll()
1817 3 * vc->vc_rows >> 2)))) { in fbcon_scroll()
1819 fbcon_bmove(vc, 0, 0, count, 0, t, in fbcon_scroll()
1820 vc->vc_cols); in fbcon_scroll()
1821 ypan_up(vc, count); in fbcon_scroll()
1822 if (vc->vc_rows - b > 0) in fbcon_scroll()
1823 fbcon_bmove(vc, b - count, 0, b, 0, in fbcon_scroll()
1824 vc->vc_rows - b, in fbcon_scroll()
1825 vc->vc_cols); in fbcon_scroll()
1827 fbcon_bmove(vc, t + count, 0, t, 0, in fbcon_scroll()
1828 b - t - count, vc->vc_cols); in fbcon_scroll()
1831 fbcon_clear(vc, b - count, 0, count, vc->vc_cols); in fbcon_scroll()
1836 fbcon_redraw(vc, p, t, b - t - count, in fbcon_scroll()
1837 count * vc->vc_cols); in fbcon_scroll()
1838 fbcon_clear(vc, b - count, 0, count, vc->vc_cols); in fbcon_scroll()
1839 scr_memsetw((unsigned short *) (vc->vc_origin + in fbcon_scroll()
1840 vc->vc_size_row * in fbcon_scroll()
1842 vc->vc_video_erase_char, in fbcon_scroll()
1843 vc->vc_size_row * count); in fbcon_scroll()
1849 if (count > vc->vc_rows) /* Maximum realistic size */ in fbcon_scroll()
1850 count = vc->vc_rows; in fbcon_scroll()
1853 fbcon_redraw_blit(vc, info, p, b - 1, b - t - count, in fbcon_scroll()
1855 fbcon_clear(vc, t, 0, count, vc->vc_cols); in fbcon_scroll()
1856 scr_memsetw((unsigned short *) (vc->vc_origin + in fbcon_scroll()
1857 vc->vc_size_row * in fbcon_scroll()
1859 vc->vc_video_erase_char, in fbcon_scroll()
1860 vc->vc_size_row * count); in fbcon_scroll()
1864 if (b - t - count > 3 * vc->vc_rows >> 2) { in fbcon_scroll()
1865 if (vc->vc_rows - b > 0) in fbcon_scroll()
1866 fbcon_bmove(vc, b, 0, b - count, 0, in fbcon_scroll()
1867 vc->vc_rows - b, in fbcon_scroll()
1868 vc->vc_cols); in fbcon_scroll()
1869 ywrap_down(vc, count); in fbcon_scroll()
1871 fbcon_bmove(vc, count, 0, 0, 0, t, in fbcon_scroll()
1872 vc->vc_cols); in fbcon_scroll()
1874 fbcon_bmove(vc, t, 0, t + count, 0, in fbcon_scroll()
1875 b - t - count, vc->vc_cols); in fbcon_scroll()
1878 fbcon_clear(vc, t, 0, count, vc->vc_cols); in fbcon_scroll()
1882 if ((count - p->yscroll <= p->vrows - vc->vc_rows) in fbcon_scroll()
1883 && ((!scroll_partial && (b - t == vc->vc_rows)) in fbcon_scroll()
1886 3 * vc->vc_rows >> 2)))) { in fbcon_scroll()
1887 if (vc->vc_rows - b > 0) in fbcon_scroll()
1888 fbcon_bmove(vc, b, 0, b - count, 0, in fbcon_scroll()
1889 vc->vc_rows - b, in fbcon_scroll()
1890 vc->vc_cols); in fbcon_scroll()
1891 ypan_down(vc, count); in fbcon_scroll()
1893 fbcon_bmove(vc, count, 0, 0, 0, t, in fbcon_scroll()
1894 vc->vc_cols); in fbcon_scroll()
1896 fbcon_bmove(vc, t, 0, t + count, 0, in fbcon_scroll()
1897 b - t - count, vc->vc_cols); in fbcon_scroll()
1900 fbcon_clear(vc, t, 0, count, vc->vc_cols); in fbcon_scroll()
1904 if ((count - p->yscroll <= p->vrows - vc->vc_rows) in fbcon_scroll()
1905 && ((!scroll_partial && (b - t == vc->vc_rows)) in fbcon_scroll()
1908 3 * vc->vc_rows >> 2)))) { in fbcon_scroll()
1909 if (vc->vc_rows - b > 0) in fbcon_scroll()
1910 fbcon_redraw_move(vc, p, b, vc->vc_rows - b, in fbcon_scroll()
1912 ypan_down_redraw(vc, t, count); in fbcon_scroll()
1914 fbcon_redraw_move(vc, p, count, t, 0); in fbcon_scroll()
1916 fbcon_redraw_move(vc, p, t, b - t - count, t + count); in fbcon_scroll()
1917 fbcon_clear(vc, t, 0, count, vc->vc_cols); in fbcon_scroll()
1922 fbcon_redraw(vc, p, b - 1, b - t - count, in fbcon_scroll()
1923 -count * vc->vc_cols); in fbcon_scroll()
1924 fbcon_clear(vc, t, 0, count, vc->vc_cols); in fbcon_scroll()
1925 scr_memsetw((unsigned short *) (vc->vc_origin + in fbcon_scroll()
1926 vc->vc_size_row * in fbcon_scroll()
1928 vc->vc_video_erase_char, in fbcon_scroll()
1929 vc->vc_size_row * count); in fbcon_scroll()
1939 struct vc_data *vc) in updatescrollmode_accel() argument
1952 divides(ypan, vc->vc_font.height) && vyres > yres; in updatescrollmode_accel()
1954 divides(ywrap, vc->vc_font.height) && in updatescrollmode_accel()
1955 divides(vc->vc_font.height, vyres) && in updatescrollmode_accel()
1956 divides(vc->vc_font.height, yres); in updatescrollmode_accel()
1981 struct vc_data *vc) in updatescrollmode() argument
1984 int fh = vc->vc_font.height; in updatescrollmode()
1990 if (yres > (fh * (vc->vc_rows + 1))) in updatescrollmode()
1991 p->vrows -= (yres - (fh * vc->vc_rows)) / fh; in updatescrollmode()
1996 updatescrollmode_accel(p, info, vc); in updatescrollmode()
2002 static int fbcon_resize(struct vc_data *vc, unsigned int width, in fbcon_resize() argument
2005 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_resize()
2007 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_resize()
2011 if (p->userfont && FNTSIZE(vc->vc_font.data)) { in fbcon_resize()
2013 int pitch = PITCH(vc->vc_font.width); in fbcon_resize()
2024 size = CALC_FONTSZ(vc->vc_font.height, pitch, vc->vc_font.charcount); in fbcon_resize()
2025 if (size > FNTSIZE(vc->vc_font.data)) in fbcon_resize()
2031 virt_fw = FBCON_SWAP(ops->rotate, vc->vc_font.width, in fbcon_resize()
2032 vc->vc_font.height); in fbcon_resize()
2033 virt_fh = FBCON_SWAP(ops->rotate, vc->vc_font.height, in fbcon_resize()
2034 vc->vc_font.width); in fbcon_resize()
2054 if (con_is_visible(vc) && vc->vc_mode == KD_TEXT) { in fbcon_resize()
2062 updatescrollmode(p, info, vc); in fbcon_resize()
2066 static int fbcon_switch(struct vc_data *vc) in fbcon_switch() argument
2070 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_switch()
2074 info = fbcon_info_from_console(vc->vc_num); in fbcon_switch()
2095 * info->currcon = vc->vc_num; in fbcon_switch()
2101 o->currcon = vc->vc_num; in fbcon_switch()
2132 if (fbcon_is_inactive(vc, info) || in fbcon_switch()
2138 set_blitting_type(vc, info); in fbcon_switch()
2141 if (ops->rotate_font && ops->rotate_font(info, vc)) { in fbcon_switch()
2143 set_blitting_type(vc, info); in fbcon_switch()
2146 vc->vc_can_do_color = (fb_get_color_depth(&info->var, &info->fix)!=1); in fbcon_switch()
2147 vc->vc_complement_mask = vc->vc_can_do_color ? 0x7700 : 0x0800; in fbcon_switch()
2149 if (vc->vc_font.charcount > 256) in fbcon_switch()
2150 vc->vc_complement_mask <<= 1; in fbcon_switch()
2152 updatescrollmode(p, info, vc); in fbcon_switch()
2156 scrollback_phys_max = p->vrows - vc->vc_rows; in fbcon_switch()
2160 scrollback_phys_max = p->vrows - 2 * vc->vc_rows; in fbcon_switch()
2172 if (!fbcon_is_inactive(vc, info)) { in fbcon_switch()
2177 fbcon_set_palette(vc, color_table); in fbcon_switch()
2178 fbcon_clear_margins(vc, 0); in fbcon_switch()
2184 update_region(vc, in fbcon_switch()
2185 vc->vc_origin + vc->vc_size_row * vc->vc_top, in fbcon_switch()
2186 vc->vc_size_row * (vc->vc_bottom - in fbcon_switch()
2187 vc->vc_top) / 2); in fbcon_switch()
2193 static void fbcon_generic_blank(struct vc_data *vc, struct fb_info *info, in fbcon_generic_blank() argument
2197 unsigned short charmask = vc->vc_hi_font_mask ? in fbcon_generic_blank()
2201 oldc = vc->vc_video_erase_char; in fbcon_generic_blank()
2202 vc->vc_video_erase_char &= charmask; in fbcon_generic_blank()
2203 fbcon_clear(vc, 0, 0, vc->vc_rows, vc->vc_cols); in fbcon_generic_blank()
2204 vc->vc_video_erase_char = oldc; in fbcon_generic_blank()
2208 static int fbcon_blank(struct vc_data *vc, int blank, int mode_switch) in fbcon_blank() argument
2210 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_blank()
2227 if (!fbcon_is_inactive(vc, info)) { in fbcon_blank()
2230 fbcon_cursor(vc, blank ? CM_ERASE : CM_DRAW); in fbcon_blank()
2234 fbcon_generic_blank(vc, info, blank); in fbcon_blank()
2238 update_screen(vc); in fbcon_blank()
2241 if (mode_switch || fbcon_is_inactive(vc, info) || in fbcon_blank()
2250 static int fbcon_debug_enter(struct vc_data *vc) in fbcon_debug_enter() argument
2252 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_debug_enter()
2259 fbcon_set_palette(vc, color_table); in fbcon_debug_enter()
2263 static int fbcon_debug_leave(struct vc_data *vc) in fbcon_debug_leave() argument
2265 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_debug_leave()
2274 static int fbcon_get_font(struct vc_data *vc, struct console_font *font) in fbcon_get_font() argument
2276 u8 *fontdata = vc->vc_font.data; in fbcon_get_font()
2280 font->width = vc->vc_font.width; in fbcon_get_font()
2281 font->height = vc->vc_font.height; in fbcon_get_font()
2282 font->charcount = vc->vc_hi_font_mask ? 512 : 256; in fbcon_get_font()
2287 j = vc->vc_font.height; in fbcon_get_font()
2298 j = vc->vc_font.height * 2; in fbcon_get_font()
2309 if (font->charcount * (vc->vc_font.height * sizeof(u32)) > FNTSIZE(fontdata)) in fbcon_get_font()
2313 for (j = 0; j < vc->vc_font.height; j++) { in fbcon_get_font()
2323 j = vc->vc_font.height * 4; in fbcon_get_font()
2337 /* set/clear vc_hi_font_mask and update vc attrs accordingly */
2338 static void set_vc_hi_font(struct vc_data *vc, bool set) in set_vc_hi_font() argument
2341 vc->vc_hi_font_mask = 0; in set_vc_hi_font()
2342 if (vc->vc_can_do_color) { in set_vc_hi_font()
2343 vc->vc_complement_mask >>= 1; in set_vc_hi_font()
2344 vc->vc_s_complement_mask >>= 1; in set_vc_hi_font()
2348 if (vc->vc_can_do_color) { in set_vc_hi_font()
2350 (unsigned short *) vc->vc_origin; in set_vc_hi_font()
2351 int count = vc->vc_screenbuf_size / 2; in set_vc_hi_font()
2358 c = vc->vc_video_erase_char; in set_vc_hi_font()
2359 vc->vc_video_erase_char = in set_vc_hi_font()
2361 vc->vc_attr >>= 1; in set_vc_hi_font()
2364 vc->vc_hi_font_mask = 0x100; in set_vc_hi_font()
2365 if (vc->vc_can_do_color) { in set_vc_hi_font()
2366 vc->vc_complement_mask <<= 1; in set_vc_hi_font()
2367 vc->vc_s_complement_mask <<= 1; in set_vc_hi_font()
2373 (unsigned short *) vc->vc_origin; in set_vc_hi_font()
2374 int count = vc->vc_screenbuf_size / 2; in set_vc_hi_font()
2379 if (vc->vc_can_do_color) in set_vc_hi_font()
2387 c = vc->vc_video_erase_char; in set_vc_hi_font()
2388 if (vc->vc_can_do_color) { in set_vc_hi_font()
2389 vc->vc_video_erase_char = in set_vc_hi_font()
2391 vc->vc_attr <<= 1; in set_vc_hi_font()
2393 vc->vc_video_erase_char = c & ~0x100; in set_vc_hi_font()
2398 static int fbcon_do_set_font(struct vc_data *vc, int w, int h, int charcount, in fbcon_do_set_font() argument
2401 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_do_set_font()
2403 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_do_set_font()
2407 resize = (w != vc->vc_font.width) || (h != vc->vc_font.height); in fbcon_do_set_font()
2409 old_data = vc->vc_font.data; in fbcon_do_set_font()
2410 vc->vc_font.data = (void *)(p->fontdata = data); in fbcon_do_set_font()
2415 old_width = vc->vc_font.width; in fbcon_do_set_font()
2416 old_height = vc->vc_font.height; in fbcon_do_set_font()
2417 old_charcount = vc->vc_font.charcount; in fbcon_do_set_font()
2419 vc->vc_font.width = w; in fbcon_do_set_font()
2420 vc->vc_font.height = h; in fbcon_do_set_font()
2421 vc->vc_font.charcount = charcount; in fbcon_do_set_font()
2422 if (vc->vc_hi_font_mask && charcount == 256) in fbcon_do_set_font()
2423 set_vc_hi_font(vc, false); in fbcon_do_set_font()
2424 else if (!vc->vc_hi_font_mask && charcount == 512) in fbcon_do_set_font()
2425 set_vc_hi_font(vc, true); in fbcon_do_set_font()
2434 ret = vc_resize(vc, cols, rows); in fbcon_do_set_font()
2437 } else if (con_is_visible(vc) in fbcon_do_set_font()
2438 && vc->vc_mode == KD_TEXT) { in fbcon_do_set_font()
2439 fbcon_clear_margins(vc, 0); in fbcon_do_set_font()
2440 update_screen(vc); in fbcon_do_set_font()
2449 vc->vc_font.data = (void *)old_data; in fbcon_do_set_font()
2456 vc->vc_font.width = old_width; in fbcon_do_set_font()
2457 vc->vc_font.height = old_height; in fbcon_do_set_font()
2458 vc->vc_font.charcount = old_charcount; in fbcon_do_set_font()
2475 static int fbcon_set_font(struct vc_data *vc, struct console_font *font, in fbcon_set_font() argument
2478 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()