Lines Matching refs: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()
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
845 err = con2fb_acquire_newinfo(vc, info, unit); in set_con2fb_map()
859 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()
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()
975 cols /= vc->vc_font.width; in fbcon_startup()
976 rows /= vc->vc_font.height; in fbcon_startup()
977 vc_resize(vc, cols, rows); in fbcon_startup()
989 static void fbcon_init(struct vc_data *vc, int init) in fbcon_init() argument
993 struct vc_data **default_mode = vc->vc_display_fg; in fbcon_init()
995 struct fbcon_display *t, *p = &fb_display[vc->vc_num]; in fbcon_init()
1002 if (con2fb_map[vc->vc_num] == -1) in fbcon_init()
1003 con2fb_map[vc->vc_num] = info_idx; in fbcon_init()
1005 info = fbcon_info_from_console(vc->vc_num); in fbcon_init()
1010 if (vc != svc || logo_shown == FBCON_LOGO_DONTSHOW || in fbcon_init()
1018 con2fb_acquire_newinfo(vc, info, vc->vc_num); in fbcon_init()
1027 vc->vc_font.data = (void *)(p->fontdata = in fbcon_init()
1029 vc->vc_font.width = fvc->vc_font.width; in fbcon_init()
1030 vc->vc_font.height = fvc->vc_font.height; in fbcon_init()
1031 vc->vc_font.charcount = fvc->vc_font.charcount; in fbcon_init()
1044 vc->vc_font.width = font->width; in fbcon_init()
1045 vc->vc_font.height = font->height; in fbcon_init()
1046 vc->vc_font.data = (void *)(p->fontdata = font->data); in fbcon_init()
1047 vc->vc_font.charcount = font->charcount; in fbcon_init()
1051 vc->vc_can_do_color = (fb_get_color_depth(&info->var, &info->fix)!=1); in fbcon_init()
1052 vc->vc_complement_mask = vc->vc_can_do_color ? 0x7700 : 0x0800; in fbcon_init()
1053 if (vc->vc_font.charcount == 256) { in fbcon_init()
1054 vc->vc_hi_font_mask = 0; in fbcon_init()
1056 vc->vc_hi_font_mask = 0x100; in fbcon_init()
1057 if (vc->vc_can_do_color) in fbcon_init()
1058 vc->vc_complement_mask <<= 1; in fbcon_init()
1063 if (!*vc->uni_pagedict_loc) in fbcon_init()
1064 con_copy_unimap(vc, svc); in fbcon_init()
1067 ops->cur_blink_jiffies = msecs_to_jiffies(vc->vc_cur_blink_ms); in fbcon_init()
1075 set_blitting_type(vc, info); in fbcon_init()
1077 cols = vc->vc_cols; in fbcon_init()
1078 rows = vc->vc_rows; in fbcon_init()
1081 new_cols /= vc->vc_font.width; in fbcon_init()
1082 new_rows /= vc->vc_font.height; in fbcon_init()
1091 if (con_is_visible(vc) && vc->vc_mode == KD_TEXT) { in fbcon_init()
1120 vc->vc_cols = new_cols; in fbcon_init()
1121 vc->vc_rows = new_rows; in fbcon_init()
1123 vc_resize(vc, new_cols, new_rows); in fbcon_init()
1126 fbcon_prepare_logo(vc, info, cols, rows, new_cols, new_rows); in fbcon_init()
1128 if (ops->rotate_font && ops->rotate_font(info, vc)) { in fbcon_init()
1130 set_blitting_type(vc, info); in fbcon_init()
1144 static void set_vc_hi_font(struct vc_data *vc, bool set);
1167 static void fbcon_deinit(struct vc_data *vc) in fbcon_deinit() argument
1169 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_deinit()
1175 idx = con2fb_map[vc->vc_num]; in fbcon_deinit()
1190 if (con_is_visible(vc)) in fbcon_deinit()
1197 vc->vc_font.data = NULL; in fbcon_deinit()
1199 if (vc->vc_hi_font_mask && vc->vc_screenbuf) in fbcon_deinit()
1200 set_vc_hi_font(vc, false); in fbcon_deinit()
1205 if (vc->vc_num == logo_shown) in fbcon_deinit()
1236 static void fbcon_clear(struct vc_data *vc, int sy, int sx, int height, in fbcon_clear() argument
1239 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_clear()
1242 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_clear()
1245 if (fbcon_is_inactive(vc, info)) in fbcon_clear()
1251 if (sy < vc->vc_top && vc->vc_top == logo_lines) { in fbcon_clear()
1252 vc->vc_top = 0; in fbcon_clear()
1259 fbcon_clear_margins(vc, 0); in fbcon_clear()
1267 ops->clear(vc, info, real_y(p, sy), sx, b, width); in fbcon_clear()
1268 ops->clear(vc, info, real_y(p, sy + b), sx, height - b, in fbcon_clear()
1271 ops->clear(vc, info, real_y(p, sy), sx, height, width); in fbcon_clear()
1274 static void fbcon_putcs(struct vc_data *vc, const unsigned short *s, in fbcon_putcs() argument
1277 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_putcs()
1278 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_putcs()
1281 if (!fbcon_is_inactive(vc, info)) in fbcon_putcs()
1282 ops->putcs(vc, info, s, count, real_y(p, ypos), xpos, in fbcon_putcs()
1283 get_color(vc, info, scr_readw(s), 1), in fbcon_putcs()
1284 get_color(vc, info, scr_readw(s), 0)); in fbcon_putcs()
1287 static void fbcon_putc(struct vc_data *vc, int c, int ypos, int xpos) in fbcon_putc() argument
1292 fbcon_putcs(vc, &chr, 1, ypos, xpos); in fbcon_putc()
1295 static void fbcon_clear_margins(struct vc_data *vc, int bottom_only) in fbcon_clear_margins() argument
1297 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_clear_margins()
1300 if (!fbcon_is_inactive(vc, info)) in fbcon_clear_margins()
1301 ops->clear_margins(vc, info, margin_color, bottom_only); in fbcon_clear_margins()
1304 static void fbcon_cursor(struct vc_data *vc, int mode) in fbcon_cursor() argument
1306 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_cursor()
1308 int c = scr_readw((u16 *) vc->vc_pos); in fbcon_cursor()
1310 ops->cur_blink_jiffies = msecs_to_jiffies(vc->vc_cur_blink_ms); in fbcon_cursor()
1312 if (fbcon_is_inactive(vc, info) || vc->vc_deccm != 1) in fbcon_cursor()
1315 if (vc->vc_cursor_type & CUR_SW) in fbcon_cursor()
1325 ops->cursor(vc, info, mode, get_color(vc, info, c, 1), in fbcon_cursor()
1326 get_color(vc, info, c, 0)); in fbcon_cursor()
1337 struct vc_data **default_mode, *vc; in fbcon_set_disp() local
1347 vc = vc_cons[unit].d; in fbcon_set_disp()
1349 if (!vc) in fbcon_set_disp()
1352 default_mode = vc->vc_display_fg; in fbcon_set_disp()
1356 if (!vc->vc_font.data) { in fbcon_set_disp()
1357 vc->vc_font.data = (void *)(p->fontdata = t->fontdata); in fbcon_set_disp()
1358 vc->vc_font.width = (*default_mode)->vc_font.width; in fbcon_set_disp()
1359 vc->vc_font.height = (*default_mode)->vc_font.height; in fbcon_set_disp()
1360 vc->vc_font.charcount = (*default_mode)->vc_font.charcount; in fbcon_set_disp()
1372 vc->vc_can_do_color = (fb_get_color_depth(&info->var, &info->fix)!=1); in fbcon_set_disp()
1373 vc->vc_complement_mask = vc->vc_can_do_color ? 0x7700 : 0x0800; in fbcon_set_disp()
1374 if (vc->vc_font.charcount == 256) { in fbcon_set_disp()
1375 vc->vc_hi_font_mask = 0; in fbcon_set_disp()
1377 vc->vc_hi_font_mask = 0x100; in fbcon_set_disp()
1378 if (vc->vc_can_do_color) in fbcon_set_disp()
1379 vc->vc_complement_mask <<= 1; in fbcon_set_disp()
1384 if (!*vc->uni_pagedict_loc) in fbcon_set_disp()
1385 con_copy_unimap(vc, svc); in fbcon_set_disp()
1389 cols /= vc->vc_font.width; in fbcon_set_disp()
1390 rows /= vc->vc_font.height; in fbcon_set_disp()
1391 vc_resize(vc, cols, rows); in fbcon_set_disp()
1393 if (con_is_visible(vc)) { in fbcon_set_disp()
1394 update_screen(vc); in fbcon_set_disp()
1398 static __inline__ void ywrap_up(struct vc_data *vc, int count) in ywrap_up() argument
1400 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in ywrap_up()
1402 struct fbcon_display *p = &fb_display[vc->vc_num]; in ywrap_up()
1408 ops->var.yoffset = p->yscroll * vc->vc_font.height; in ywrap_up()
1417 static __inline__ void ywrap_down(struct vc_data *vc, int count) in ywrap_down() argument
1419 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in ywrap_down()
1421 struct fbcon_display *p = &fb_display[vc->vc_num]; in ywrap_down()
1427 ops->var.yoffset = p->yscroll * vc->vc_font.height; in ywrap_down()
1436 static __inline__ void ypan_up(struct vc_data *vc, int count) in ypan_up() argument
1438 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in ypan_up()
1439 struct fbcon_display *p = &fb_display[vc->vc_num]; in ypan_up()
1443 if (p->yscroll > p->vrows - vc->vc_rows) { in ypan_up()
1444 ops->bmove(vc, info, p->vrows - vc->vc_rows, in ypan_up()
1445 0, 0, 0, vc->vc_rows, vc->vc_cols); in ypan_up()
1446 p->yscroll -= p->vrows - vc->vc_rows; in ypan_up()
1450 ops->var.yoffset = p->yscroll * vc->vc_font.height; in ypan_up()
1453 fbcon_clear_margins(vc, 1); in ypan_up()
1460 static __inline__ void ypan_up_redraw(struct vc_data *vc, int t, int count) in ypan_up_redraw() argument
1462 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in ypan_up_redraw()
1464 struct fbcon_display *p = &fb_display[vc->vc_num]; in ypan_up_redraw()
1468 if (p->yscroll > p->vrows - vc->vc_rows) { in ypan_up_redraw()
1469 p->yscroll -= p->vrows - vc->vc_rows; in ypan_up_redraw()
1470 fbcon_redraw_move(vc, p, t + count, vc->vc_rows - count, t); in ypan_up_redraw()
1474 ops->var.yoffset = p->yscroll * vc->vc_font.height; in ypan_up_redraw()
1477 fbcon_clear_margins(vc, 1); in ypan_up_redraw()
1484 static __inline__ void ypan_down(struct vc_data *vc, int count) in ypan_down() argument
1486 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in ypan_down()
1487 struct fbcon_display *p = &fb_display[vc->vc_num]; in ypan_down()
1492 ops->bmove(vc, info, 0, 0, p->vrows - vc->vc_rows, in ypan_down()
1493 0, vc->vc_rows, vc->vc_cols); in ypan_down()
1494 p->yscroll += p->vrows - vc->vc_rows; in ypan_down()
1498 ops->var.yoffset = p->yscroll * vc->vc_font.height; in ypan_down()
1501 fbcon_clear_margins(vc, 1); in ypan_down()
1508 static __inline__ void ypan_down_redraw(struct vc_data *vc, int t, int count) in ypan_down_redraw() argument
1510 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in ypan_down_redraw()
1512 struct fbcon_display *p = &fb_display[vc->vc_num]; in ypan_down_redraw()
1517 p->yscroll += p->vrows - vc->vc_rows; in ypan_down_redraw()
1518 fbcon_redraw_move(vc, p, t, vc->vc_rows - count, t + count); in ypan_down_redraw()
1522 ops->var.yoffset = p->yscroll * vc->vc_font.height; in ypan_down_redraw()
1525 fbcon_clear_margins(vc, 1); in ypan_down_redraw()
1532 static void fbcon_redraw_move(struct vc_data *vc, struct fbcon_display *p, in fbcon_redraw_move() argument
1536 (vc->vc_origin + vc->vc_size_row * line); in fbcon_redraw_move()
1550 fbcon_putcs(vc, start, s - start, in fbcon_redraw_move()
1560 fbcon_putcs(vc, start, s - start, dy, x); in fbcon_redraw_move()
1566 static void fbcon_redraw_blit(struct vc_data *vc, struct fb_info *info, in fbcon_redraw_blit() argument
1569 int offset = ycount * vc->vc_cols; in fbcon_redraw_blit()
1571 (vc->vc_origin + vc->vc_size_row * line); in fbcon_redraw_blit()
1586 ops->bmove(vc, info, line + ycount, x, in fbcon_redraw_blit()
1602 ops->bmove(vc, info, line + ycount, x, line, x, 1, in fbcon_redraw_blit()
1610 s -= vc->vc_size_row; in fbcon_redraw_blit()
1611 d -= vc->vc_size_row; in fbcon_redraw_blit()
1616 static void fbcon_redraw(struct vc_data *vc, int line, int count, int offset) in fbcon_redraw() argument
1619 (vc->vc_origin + vc->vc_size_row * line); in fbcon_redraw()
1634 fbcon_putcs(vc, start, s - start, in fbcon_redraw()
1642 fbcon_putcs(vc, start, s - start, in fbcon_redraw()
1657 fbcon_putcs(vc, start, s - start, line, x); in fbcon_redraw()
1664 s -= vc->vc_size_row; in fbcon_redraw()
1665 d -= vc->vc_size_row; in fbcon_redraw()
1670 static void fbcon_bmove_rec(struct vc_data *vc, struct fbcon_display *p, int sy, int sx, in fbcon_bmove_rec() argument
1673 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_bmove_rec()
1680 fbcon_bmove_rec(vc, p, sy, sx, dy, dx, b, width, in fbcon_bmove_rec()
1682 fbcon_bmove_rec(vc, p, sy + b, sx, dy + b, dx, in fbcon_bmove_rec()
1685 fbcon_bmove_rec(vc, p, sy + b, sx, dy + b, dx, in fbcon_bmove_rec()
1687 fbcon_bmove_rec(vc, p, sy, sx, dy, dx, b, width, in fbcon_bmove_rec()
1696 fbcon_bmove_rec(vc, p, sy, sx, dy, dx, b, width, in fbcon_bmove_rec()
1698 fbcon_bmove_rec(vc, p, sy + b, sx, dy + b, dx, in fbcon_bmove_rec()
1701 fbcon_bmove_rec(vc, p, sy + b, sx, dy + b, dx, in fbcon_bmove_rec()
1703 fbcon_bmove_rec(vc, p, sy, sx, dy, dx, b, width, in fbcon_bmove_rec()
1708 ops->bmove(vc, info, real_y(p, sy), sx, real_y(p, dy), dx, in fbcon_bmove_rec()
1712 static void fbcon_bmove(struct vc_data *vc, int sy, int sx, int dy, int dx, in fbcon_bmove() argument
1715 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_bmove()
1716 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_bmove()
1718 if (fbcon_is_inactive(vc, info)) in fbcon_bmove()
1731 fbcon_bmove_rec(vc, p, sy, sx, dy, dx, height, width, in fbcon_bmove()
1735 static bool fbcon_scroll(struct vc_data *vc, unsigned int t, unsigned int b, in fbcon_scroll() argument
1738 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_scroll()
1739 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_scroll()
1742 if (fbcon_is_inactive(vc, info)) in fbcon_scroll()
1745 fbcon_cursor(vc, CM_ERASE); in fbcon_scroll()
1755 if (count > vc->vc_rows) /* Maximum realistic size */ in fbcon_scroll()
1756 count = vc->vc_rows; in fbcon_scroll()
1759 fbcon_redraw_blit(vc, info, p, t, b - t - count, in fbcon_scroll()
1761 fbcon_clear(vc, b - count, 0, count, vc->vc_cols); in fbcon_scroll()
1762 scr_memsetw((unsigned short *) (vc->vc_origin + in fbcon_scroll()
1763 vc->vc_size_row * in fbcon_scroll()
1765 vc->vc_video_erase_char, in fbcon_scroll()
1766 vc->vc_size_row * count); in fbcon_scroll()
1770 if (b - t - count > 3 * vc->vc_rows >> 2) { in fbcon_scroll()
1772 fbcon_bmove(vc, 0, 0, count, 0, t, in fbcon_scroll()
1773 vc->vc_cols); in fbcon_scroll()
1774 ywrap_up(vc, count); in fbcon_scroll()
1775 if (vc->vc_rows - b > 0) in fbcon_scroll()
1776 fbcon_bmove(vc, b - count, 0, b, 0, in fbcon_scroll()
1777 vc->vc_rows - b, in fbcon_scroll()
1778 vc->vc_cols); in fbcon_scroll()
1780 fbcon_bmove(vc, t + count, 0, t, 0, in fbcon_scroll()
1781 b - t - count, vc->vc_cols); in fbcon_scroll()
1784 fbcon_clear(vc, b - count, 0, count, vc->vc_cols); in fbcon_scroll()
1789 2 * (p->vrows - vc->vc_rows)) in fbcon_scroll()
1790 && ((!scroll_partial && (b - t == vc->vc_rows)) in fbcon_scroll()
1793 3 * vc->vc_rows >> 2)))) { in fbcon_scroll()
1795 fbcon_redraw_move(vc, p, 0, t, count); in fbcon_scroll()
1796 ypan_up_redraw(vc, t, count); in fbcon_scroll()
1797 if (vc->vc_rows - b > 0) in fbcon_scroll()
1798 fbcon_redraw_move(vc, p, b, in fbcon_scroll()
1799 vc->vc_rows - b, b); in fbcon_scroll()
1801 fbcon_redraw_move(vc, p, t + count, b - t - count, t); in fbcon_scroll()
1802 fbcon_clear(vc, b - count, 0, count, vc->vc_cols); in fbcon_scroll()
1807 2 * (p->vrows - vc->vc_rows)) in fbcon_scroll()
1808 && ((!scroll_partial && (b - t == vc->vc_rows)) in fbcon_scroll()
1811 3 * vc->vc_rows >> 2)))) { in fbcon_scroll()
1813 fbcon_bmove(vc, 0, 0, count, 0, t, in fbcon_scroll()
1814 vc->vc_cols); in fbcon_scroll()
1815 ypan_up(vc, count); in fbcon_scroll()
1816 if (vc->vc_rows - b > 0) in fbcon_scroll()
1817 fbcon_bmove(vc, b - count, 0, b, 0, in fbcon_scroll()
1818 vc->vc_rows - b, in fbcon_scroll()
1819 vc->vc_cols); in fbcon_scroll()
1821 fbcon_bmove(vc, t + count, 0, t, 0, in fbcon_scroll()
1822 b - t - count, vc->vc_cols); in fbcon_scroll()
1825 fbcon_clear(vc, b - count, 0, count, vc->vc_cols); in fbcon_scroll()
1830 fbcon_redraw(vc, t, b - t - count, in fbcon_scroll()
1831 count * vc->vc_cols); in fbcon_scroll()
1832 fbcon_clear(vc, b - count, 0, count, vc->vc_cols); in fbcon_scroll()
1833 scr_memsetw((unsigned short *) (vc->vc_origin + in fbcon_scroll()
1834 vc->vc_size_row * in fbcon_scroll()
1836 vc->vc_video_erase_char, in fbcon_scroll()
1837 vc->vc_size_row * count); in fbcon_scroll()
1843 if (count > vc->vc_rows) /* Maximum realistic size */ in fbcon_scroll()
1844 count = vc->vc_rows; in fbcon_scroll()
1847 fbcon_redraw_blit(vc, info, p, b - 1, b - t - count, in fbcon_scroll()
1849 fbcon_clear(vc, t, 0, count, vc->vc_cols); in fbcon_scroll()
1850 scr_memsetw((unsigned short *) (vc->vc_origin + in fbcon_scroll()
1851 vc->vc_size_row * in fbcon_scroll()
1853 vc->vc_video_erase_char, in fbcon_scroll()
1854 vc->vc_size_row * count); in fbcon_scroll()
1858 if (b - t - count > 3 * vc->vc_rows >> 2) { in fbcon_scroll()
1859 if (vc->vc_rows - b > 0) in fbcon_scroll()
1860 fbcon_bmove(vc, b, 0, b - count, 0, in fbcon_scroll()
1861 vc->vc_rows - b, in fbcon_scroll()
1862 vc->vc_cols); in fbcon_scroll()
1863 ywrap_down(vc, count); in fbcon_scroll()
1865 fbcon_bmove(vc, count, 0, 0, 0, t, in fbcon_scroll()
1866 vc->vc_cols); in fbcon_scroll()
1868 fbcon_bmove(vc, t, 0, t + count, 0, in fbcon_scroll()
1869 b - t - count, vc->vc_cols); in fbcon_scroll()
1872 fbcon_clear(vc, t, 0, count, vc->vc_cols); in fbcon_scroll()
1876 if ((count - p->yscroll <= p->vrows - vc->vc_rows) in fbcon_scroll()
1877 && ((!scroll_partial && (b - t == vc->vc_rows)) in fbcon_scroll()
1880 3 * vc->vc_rows >> 2)))) { in fbcon_scroll()
1881 if (vc->vc_rows - b > 0) in fbcon_scroll()
1882 fbcon_bmove(vc, b, 0, b - count, 0, in fbcon_scroll()
1883 vc->vc_rows - b, in fbcon_scroll()
1884 vc->vc_cols); in fbcon_scroll()
1885 ypan_down(vc, count); in fbcon_scroll()
1887 fbcon_bmove(vc, count, 0, 0, 0, t, in fbcon_scroll()
1888 vc->vc_cols); in fbcon_scroll()
1890 fbcon_bmove(vc, t, 0, t + count, 0, in fbcon_scroll()
1891 b - t - count, vc->vc_cols); in fbcon_scroll()
1894 fbcon_clear(vc, t, 0, count, vc->vc_cols); in fbcon_scroll()
1898 if ((count - p->yscroll <= p->vrows - vc->vc_rows) in fbcon_scroll()
1899 && ((!scroll_partial && (b - t == vc->vc_rows)) in fbcon_scroll()
1902 3 * vc->vc_rows >> 2)))) { in fbcon_scroll()
1903 if (vc->vc_rows - b > 0) in fbcon_scroll()
1904 fbcon_redraw_move(vc, p, b, vc->vc_rows - b, in fbcon_scroll()
1906 ypan_down_redraw(vc, t, count); in fbcon_scroll()
1908 fbcon_redraw_move(vc, p, count, t, 0); in fbcon_scroll()
1910 fbcon_redraw_move(vc, p, t, b - t - count, t + count); in fbcon_scroll()
1911 fbcon_clear(vc, t, 0, count, vc->vc_cols); in fbcon_scroll()
1916 fbcon_redraw(vc, b - 1, b - t - count, in fbcon_scroll()
1917 -count * vc->vc_cols); in fbcon_scroll()
1918 fbcon_clear(vc, t, 0, count, vc->vc_cols); in fbcon_scroll()
1919 scr_memsetw((unsigned short *) (vc->vc_origin + in fbcon_scroll()
1920 vc->vc_size_row * in fbcon_scroll()
1922 vc->vc_video_erase_char, in fbcon_scroll()
1923 vc->vc_size_row * count); in fbcon_scroll()
1933 struct vc_data *vc) in updatescrollmode_accel() argument
1946 divides(ypan, vc->vc_font.height) && vyres > yres; in updatescrollmode_accel()
1948 divides(ywrap, vc->vc_font.height) && in updatescrollmode_accel()
1949 divides(vc->vc_font.height, vyres) && in updatescrollmode_accel()
1950 divides(vc->vc_font.height, yres); in updatescrollmode_accel()
1975 struct vc_data *vc) in updatescrollmode() argument
1978 int fh = vc->vc_font.height; in updatescrollmode()
1984 if (yres > (fh * (vc->vc_rows + 1))) in updatescrollmode()
1985 p->vrows -= (yres - (fh * vc->vc_rows)) / fh; in updatescrollmode()
1990 updatescrollmode_accel(p, info, vc); in updatescrollmode()
1996 static int fbcon_resize(struct vc_data *vc, unsigned int width, in fbcon_resize() argument
1999 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_resize()
2001 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_resize()
2005 if (p->userfont && FNTSIZE(vc->vc_font.data)) { in fbcon_resize()
2007 int pitch = PITCH(vc->vc_font.width); in fbcon_resize()
2018 size = CALC_FONTSZ(vc->vc_font.height, pitch, vc->vc_font.charcount); in fbcon_resize()
2019 if (size > FNTSIZE(vc->vc_font.data)) in fbcon_resize()
2025 virt_fw = FBCON_SWAP(ops->rotate, vc->vc_font.width, in fbcon_resize()
2026 vc->vc_font.height); in fbcon_resize()
2027 virt_fh = FBCON_SWAP(ops->rotate, vc->vc_font.height, in fbcon_resize()
2028 vc->vc_font.width); in fbcon_resize()
2048 if (con_is_visible(vc) && vc->vc_mode == KD_TEXT) { in fbcon_resize()
2056 updatescrollmode(p, info, vc); in fbcon_resize()
2060 static int fbcon_switch(struct vc_data *vc) in fbcon_switch() argument
2064 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_switch()
2068 info = fbcon_info_from_console(vc->vc_num); in fbcon_switch()
2095 o->currcon = vc->vc_num; in fbcon_switch()
2126 if (fbcon_is_inactive(vc, info) || in fbcon_switch()
2132 set_blitting_type(vc, info); in fbcon_switch()
2135 if (ops->rotate_font && ops->rotate_font(info, vc)) { in fbcon_switch()
2137 set_blitting_type(vc, info); in fbcon_switch()
2140 vc->vc_can_do_color = (fb_get_color_depth(&info->var, &info->fix)!=1); in fbcon_switch()
2141 vc->vc_complement_mask = vc->vc_can_do_color ? 0x7700 : 0x0800; in fbcon_switch()
2143 if (vc->vc_font.charcount > 256) in fbcon_switch()
2144 vc->vc_complement_mask <<= 1; in fbcon_switch()
2146 updatescrollmode(p, info, vc); in fbcon_switch()
2150 scrollback_phys_max = p->vrows - vc->vc_rows; in fbcon_switch()
2154 scrollback_phys_max = p->vrows - 2 * vc->vc_rows; in fbcon_switch()
2166 if (!fbcon_is_inactive(vc, info)) { in fbcon_switch()
2171 fbcon_set_palette(vc, color_table); in fbcon_switch()
2172 fbcon_clear_margins(vc, 0); in fbcon_switch()
2178 update_region(vc, in fbcon_switch()
2179 vc->vc_origin + vc->vc_size_row * vc->vc_top, in fbcon_switch()
2180 vc->vc_size_row * (vc->vc_bottom - in fbcon_switch()
2181 vc->vc_top) / 2); in fbcon_switch()
2187 static void fbcon_generic_blank(struct vc_data *vc, struct fb_info *info, in fbcon_generic_blank() argument
2191 unsigned short charmask = vc->vc_hi_font_mask ? in fbcon_generic_blank()
2195 oldc = vc->vc_video_erase_char; in fbcon_generic_blank()
2196 vc->vc_video_erase_char &= charmask; in fbcon_generic_blank()
2197 fbcon_clear(vc, 0, 0, vc->vc_rows, vc->vc_cols); in fbcon_generic_blank()
2198 vc->vc_video_erase_char = oldc; in fbcon_generic_blank()
2202 static int fbcon_blank(struct vc_data *vc, int blank, int mode_switch) in fbcon_blank() argument
2204 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_blank()
2221 if (!fbcon_is_inactive(vc, info)) { in fbcon_blank()
2224 fbcon_cursor(vc, blank ? CM_ERASE : CM_DRAW); in fbcon_blank()
2228 fbcon_generic_blank(vc, info, blank); in fbcon_blank()
2232 update_screen(vc); in fbcon_blank()
2235 if (mode_switch || fbcon_is_inactive(vc, info) || in fbcon_blank()
2244 static int fbcon_debug_enter(struct vc_data *vc) in fbcon_debug_enter() argument
2246 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_debug_enter()
2253 fbcon_set_palette(vc, color_table); in fbcon_debug_enter()
2257 static int fbcon_debug_leave(struct vc_data *vc) in fbcon_debug_leave() argument
2259 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_debug_leave()
2268 static int fbcon_get_font(struct vc_data *vc, struct console_font *font, unsigned int vpitch) in fbcon_get_font() argument
2270 u8 *fontdata = vc->vc_font.data; in fbcon_get_font()
2274 font->width = vc->vc_font.width; in fbcon_get_font()
2275 font->height = vc->vc_font.height; in fbcon_get_font()
2278 font->charcount = vc->vc_hi_font_mask ? 512 : 256; in fbcon_get_font()
2283 j = vc->vc_font.height; in fbcon_get_font()
2294 j = vc->vc_font.height * 2; in fbcon_get_font()
2305 if (font->charcount * (vc->vc_font.height * sizeof(u32)) > FNTSIZE(fontdata)) in fbcon_get_font()
2309 for (j = 0; j < vc->vc_font.height; j++) { in fbcon_get_font()
2319 j = vc->vc_font.height * 4; in fbcon_get_font()
2334 static void set_vc_hi_font(struct vc_data *vc, bool set) in set_vc_hi_font() argument
2337 vc->vc_hi_font_mask = 0; in set_vc_hi_font()
2338 if (vc->vc_can_do_color) { in set_vc_hi_font()
2339 vc->vc_complement_mask >>= 1; in set_vc_hi_font()
2340 vc->vc_s_complement_mask >>= 1; in set_vc_hi_font()
2344 if (vc->vc_can_do_color) { in set_vc_hi_font()
2346 (unsigned short *) vc->vc_origin; in set_vc_hi_font()
2347 int count = vc->vc_screenbuf_size / 2; in set_vc_hi_font()
2354 c = vc->vc_video_erase_char; in set_vc_hi_font()
2355 vc->vc_video_erase_char = in set_vc_hi_font()
2357 vc->vc_attr >>= 1; in set_vc_hi_font()
2360 vc->vc_hi_font_mask = 0x100; in set_vc_hi_font()
2361 if (vc->vc_can_do_color) { in set_vc_hi_font()
2362 vc->vc_complement_mask <<= 1; in set_vc_hi_font()
2363 vc->vc_s_complement_mask <<= 1; in set_vc_hi_font()
2369 (unsigned short *) vc->vc_origin; in set_vc_hi_font()
2370 int count = vc->vc_screenbuf_size / 2; in set_vc_hi_font()
2375 if (vc->vc_can_do_color) in set_vc_hi_font()
2383 c = vc->vc_video_erase_char; in set_vc_hi_font()
2384 if (vc->vc_can_do_color) { in set_vc_hi_font()
2385 vc->vc_video_erase_char = in set_vc_hi_font()
2387 vc->vc_attr <<= 1; in set_vc_hi_font()
2389 vc->vc_video_erase_char = c & ~0x100; in set_vc_hi_font()
2394 static int fbcon_do_set_font(struct vc_data *vc, int w, int h, int charcount, in fbcon_do_set_font() argument
2397 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_do_set_font()
2399 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_do_set_font()
2403 resize = (w != vc->vc_font.width) || (h != vc->vc_font.height); in fbcon_do_set_font()
2405 old_data = vc->vc_font.data; in fbcon_do_set_font()
2406 vc->vc_font.data = (void *)(p->fontdata = data); in fbcon_do_set_font()
2411 old_width = vc->vc_font.width; in fbcon_do_set_font()
2412 old_height = vc->vc_font.height; in fbcon_do_set_font()
2413 old_charcount = vc->vc_font.charcount; in fbcon_do_set_font()
2415 vc->vc_font.width = w; in fbcon_do_set_font()
2416 vc->vc_font.height = h; in fbcon_do_set_font()
2417 vc->vc_font.charcount = charcount; in fbcon_do_set_font()
2418 if (vc->vc_hi_font_mask && charcount == 256) in fbcon_do_set_font()
2419 set_vc_hi_font(vc, false); in fbcon_do_set_font()
2420 else if (!vc->vc_hi_font_mask && charcount == 512) in fbcon_do_set_font()
2421 set_vc_hi_font(vc, true); in fbcon_do_set_font()
2430 ret = vc_resize(vc, cols, rows); in fbcon_do_set_font()
2433 } else if (con_is_visible(vc) in fbcon_do_set_font()
2434 && vc->vc_mode == KD_TEXT) { in fbcon_do_set_font()
2435 fbcon_clear_margins(vc, 0); in fbcon_do_set_font()
2436 update_screen(vc); in fbcon_do_set_font()
2445 vc->vc_font.data = (void *)old_data; in fbcon_do_set_font()
2453 vc->vc_font.width = old_width; in fbcon_do_set_font()
2454 vc->vc_font.height = old_height; in fbcon_do_set_font()
2455 vc->vc_font.charcount = old_charcount; in fbcon_do_set_font()
2465 static int fbcon_set_font(struct vc_data *vc, struct console_font *font, in fbcon_set_font() argument
2468 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_set_font()
2535 return fbcon_do_set_font(vc, font->width, font->height, charcount, new_data, 1); in fbcon_set_font()
2538 static int fbcon_set_def_font(struct vc_data *vc, struct console_font *font, char *name) in fbcon_set_def_font() argument
2540 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_set_def_font()
2551 return fbcon_do_set_font(vc, f->width, f->height, f->charcount, f->data, 0); in fbcon_set_def_font()
2562 static void fbcon_set_palette(struct vc_data *vc, const unsigned char *table) in fbcon_set_palette() argument
2564 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_set_palette()
2568 if (fbcon_is_inactive(vc, info)) in fbcon_set_palette()
2571 if (!con_is_visible(vc)) in fbcon_set_palette()
2578 val = vc->vc_palette[j++]; in fbcon_set_palette()
2580 val = vc->vc_palette[j++]; in fbcon_set_palette()
2582 val = vc->vc_palette[j++]; in fbcon_set_palette()
2597 static u16 *fbcon_screen_pos(const struct vc_data *vc, int offset) in fbcon_screen_pos() argument
2599 return (u16 *) (vc->vc_origin + offset); in fbcon_screen_pos()
2602 static unsigned long fbcon_getxy(struct vc_data *vc, unsigned long pos, in fbcon_getxy() argument
2608 if (pos >= vc->vc_origin && pos < vc->vc_scr_end) { in fbcon_getxy()
2609 unsigned long offset = (pos - vc->vc_origin) / 2; in fbcon_getxy()
2611 x = offset % vc->vc_cols; in fbcon_getxy()
2612 y = offset / vc->vc_cols; in fbcon_getxy()
2613 ret = pos + (vc->vc_cols - x) * 2; in fbcon_getxy()
2617 ret = vc->vc_origin; in fbcon_getxy()
2628 static void fbcon_invert_region(struct vc_data *vc, u16 * p, int cnt) in fbcon_invert_region() argument
2632 if (!vc->vc_can_do_color) in fbcon_invert_region()
2634 else if (vc->vc_hi_font_mask == 0x100) in fbcon_invert_region()
2646 struct vc_data *vc = NULL; in fbcon_suspended() local
2651 vc = vc_cons[ops->currcon].d; in fbcon_suspended()
2654 fbcon_cursor(vc, CM_ERASE); in fbcon_suspended()
2659 struct vc_data *vc; in fbcon_resumed() local
2664 vc = vc_cons[ops->currcon].d; in fbcon_resumed()
2666 update_screen(vc); in fbcon_resumed()
2672 struct vc_data *vc; in fbcon_modechanged() local
2678 vc = vc_cons[ops->currcon].d; in fbcon_modechanged()
2679 if (vc->vc_mode != KD_TEXT || in fbcon_modechanged()
2683 p = &fb_display[vc->vc_num]; in fbcon_modechanged()
2684 set_blitting_type(vc, info); in fbcon_modechanged()
2686 if (con_is_visible(vc)) { in fbcon_modechanged()
2690 cols /= vc->vc_font.width; in fbcon_modechanged()
2691 rows /= vc->vc_font.height; in fbcon_modechanged()
2692 vc_resize(vc, cols, rows); in fbcon_modechanged()
2693 updatescrollmode(p, info, vc); in fbcon_modechanged()
2697 if (!fbcon_is_inactive(vc, info)) { in fbcon_modechanged()
2702 fbcon_set_palette(vc, color_table); in fbcon_modechanged()
2703 update_screen(vc); in fbcon_modechanged()
2710 struct vc_data *vc; in fbcon_set_all_vcs() local
2718 vc = vc_cons[i].d; in fbcon_set_all_vcs()
2719 if (!vc || vc->vc_mode != KD_TEXT || in fbcon_set_all_vcs()
2723 if (con_is_visible(vc)) { in fbcon_set_all_vcs()
2728 p = &fb_display[vc->vc_num]; in fbcon_set_all_vcs()
2729 set_blitting_type(vc, info); in fbcon_set_all_vcs()
2733 cols /= vc->vc_font.width; in fbcon_set_all_vcs()
2734 rows /= vc->vc_font.height; in fbcon_set_all_vcs()
2735 vc_resize(vc, cols, rows); in fbcon_set_all_vcs()
2756 struct vc_data *vc; in fbcon_modechange_possible() local
2766 vc = vc_cons[i].d; in fbcon_modechange_possible()
2767 if (!vc || vc->vc_mode != KD_TEXT || in fbcon_modechange_possible()
2771 if (vc->vc_font.width > FBCON_SWAP(var->rotate, var->xres, var->yres) || in fbcon_modechange_possible()
2772 vc->vc_font.height > FBCON_SWAP(var->rotate, var->yres, var->xres)) in fbcon_modechange_possible()
3034 struct vc_data *vc; in fbcon_fb_blanked() local
3039 vc = vc_cons[ops->currcon].d; in fbcon_fb_blanked()
3040 if (vc->vc_mode != KD_TEXT || in fbcon_fb_blanked()
3044 if (con_is_visible(vc)) { in fbcon_fb_blanked()
3056 struct vc_data *vc; in fbcon_new_modelist() local
3065 vc = vc_cons[i].d; in fbcon_new_modelist()
3070 fbcon_set_disp(info, &var, vc->vc_num); in fbcon_new_modelist()
3077 struct vc_data *vc; in fbcon_get_requirement() local
3083 vc = vc_cons[i].d; in fbcon_get_requirement()
3084 if (vc && vc->vc_mode == KD_TEXT && in fbcon_get_requirement()
3086 caps->x |= 1 << (vc->vc_font.width - 1); in fbcon_get_requirement()
3087 caps->y |= 1 << (vc->vc_font.height - 1); in fbcon_get_requirement()
3088 charcnt = vc->vc_font.charcount; in fbcon_get_requirement()
3094 vc = vc_cons[fg_console].d; in fbcon_get_requirement()
3096 if (vc && vc->vc_mode == KD_TEXT && in fbcon_get_requirement()
3098 caps->x = 1 << (vc->vc_font.width - 1); in fbcon_get_requirement()
3099 caps->y = 1 << (vc->vc_font.height - 1); in fbcon_get_requirement()
3100 caps->len = vc->vc_font.charcount; in fbcon_get_requirement()