Lines Matching refs:vc

176 #define advance_row(p, delta) (unsigned short *)((unsigned long)(p) + (delta) * vc->vc_size_row)
186 static void fbcon_clear_margins(struct vc_data *vc, int bottom_only);
187 static void fbcon_set_palette(struct vc_data *vc, const unsigned char *table);
194 static void fbcon_redraw_move(struct vc_data *vc, struct fbcon_display *p,
238 struct vc_data *vc; in fbcon_rotate_all() local
246 vc = vc_cons[i].d; in fbcon_rotate_all()
247 if (!vc || vc->vc_mode != KD_TEXT || in fbcon_rotate_all()
251 p = &fb_display[vc->vc_num]; in fbcon_rotate_all()
308 static inline bool fbcon_is_active(struct vc_data *vc, struct fb_info *info) in fbcon_is_active() argument
313 vc->vc_mode == KD_TEXT && !par->graphics && !fbcon_skip_panic(info); in fbcon_is_active()
316 static int get_color(struct vc_data *vc, struct fb_info *info, in get_color() argument
323 unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff; in get_color()
325 c = vc->vc_video_erase_char & charmask; in get_color()
329 color = (is_fg) ? attr_fgcol((vc->vc_hi_font_mask) ? 9 : 8, c) in get_color()
330 : attr_bgcol((vc->vc_hi_font_mask) ? 13 : 12, c); in get_color()
383 static int get_fg_color(struct vc_data *vc, struct fb_info *info, u16 c) in get_fg_color() argument
385 return get_color(vc, info, c, true); in get_fg_color()
388 static int get_bg_color(struct vc_data *vc, struct fb_info *info, u16 c) in get_bg_color() argument
390 return get_color(vc, info, c, false); in get_bg_color()
397 struct vc_data *vc = NULL; in fb_flashcursor() local
413 vc = vc_cons[par->currcon].d; in fb_flashcursor()
415 if (!vc || !con_is_visible(vc) || in fb_flashcursor()
416 fbcon_info_from_console(vc->vc_num) != info || in fb_flashcursor()
417 vc->vc_deccm != 1) { in fb_flashcursor()
422 c = scr_readw((u16 *) vc->vc_pos); in fb_flashcursor()
424 par->bitops->cursor(vc, info, enable, in fb_flashcursor()
425 get_fg_color(vc, info, c), in fb_flashcursor()
426 get_bg_color(vc, info, c)); in fb_flashcursor()
596 static void fbcon_prepare_logo(struct vc_data *vc, struct fb_info *info, in fbcon_prepare_logo() argument
602 static void fbcon_prepare_logo(struct vc_data *vc, struct fb_info *info, in fbcon_prepare_logo() argument
607 int cnt, erase = vc->vc_video_erase_char, step; in fbcon_prepare_logo()
623 logo_lines = DIV_ROUND_UP(logo_height, vc->vc_font.height); in fbcon_prepare_logo()
624 q = (unsigned short *) (vc->vc_origin + in fbcon_prepare_logo()
625 vc->vc_size_row * rows); in fbcon_prepare_logo()
628 if (scr_readw(r) != vc->vc_video_erase_char) in fbcon_prepare_logo()
646 scr_memcpyw(r + step, r, vc->vc_size_row); in fbcon_prepare_logo()
651 if (vc->state.y + logo_lines >= rows) in fbcon_prepare_logo()
652 lines = rows - vc->state.y - 1; in fbcon_prepare_logo()
655 vc->state.y += lines; in fbcon_prepare_logo()
656 vc->vc_pos += lines * vc->vc_size_row; in fbcon_prepare_logo()
659 scr_memsetw((unsigned short *) vc->vc_origin, in fbcon_prepare_logo()
661 vc->vc_size_row * logo_lines); in fbcon_prepare_logo()
663 if (con_is_visible(vc) && vc->vc_mode == KD_TEXT) { in fbcon_prepare_logo()
664 fbcon_clear_margins(vc, 0); in fbcon_prepare_logo()
665 update_screen(vc); in fbcon_prepare_logo()
669 q = (unsigned short *) (vc->vc_origin + in fbcon_prepare_logo()
670 vc->vc_size_row * in fbcon_prepare_logo()
673 vc->state.y += logo_lines; in fbcon_prepare_logo()
674 vc->vc_pos += logo_lines * vc->vc_size_row; in fbcon_prepare_logo()
681 if (logo_lines > vc->vc_bottom) { in fbcon_prepare_logo()
686 vc->vc_top = logo_lines; in fbcon_prepare_logo()
692 static void set_blitting_type(struct vc_data *vc, struct fb_info *info) in set_blitting_type() argument
696 par->p = &fb_display[vc->vc_num]; in set_blitting_type()
699 fbcon_set_tileops(vc, info); in set_blitting_type()
717 static void set_blitting_type(struct vc_data *vc, struct fb_info *info) in set_blitting_type() argument
722 par->p = &fb_display[vc->vc_num]; in set_blitting_type()
786 static int con2fb_acquire_newinfo(struct vc_data *vc, struct fb_info *info, in con2fb_acquire_newinfo() argument
795 if (vc) in con2fb_acquire_newinfo()
796 set_blitting_type(vc, info); in con2fb_acquire_newinfo()
801 static void con2fb_release_oldinfo(struct vc_data *vc, struct fb_info *oldinfo, in con2fb_release_oldinfo() argument
825 static void con2fb_init_display(struct vc_data *vc, struct fb_info *info, in con2fb_init_display() argument
873 struct vc_data *vc = vc_cons[unit].d; in set_con2fb_map() local
896 err = con2fb_acquire_newinfo(vc, info, unit); in set_con2fb_map()
901 } else if (vc) { in set_con2fb_map()
902 set_blitting_type(vc, info); in set_con2fb_map()
912 con2fb_release_oldinfo(vc, oldinfo, info); in set_con2fb_map()
918 con2fb_init_display(vc, info, unit, show_logo); in set_con2fb_map()
977 struct vc_data *vc = vc_cons[fg_console].d; in fbcon_startup() local
1011 set_blitting_type(vc, info); in fbcon_startup()
1020 vc->vc_font.width = font->width; in fbcon_startup()
1021 vc->vc_font.height = font->height; in fbcon_startup()
1022 vc->vc_font.data = (void *)(p->fontdata = font->data); in fbcon_startup()
1023 vc->vc_font.charcount = font->charcount; in fbcon_startup()
1028 cols /= vc->vc_font.width; in fbcon_startup()
1029 rows /= vc->vc_font.height; in fbcon_startup()
1030 vc_resize(vc, cols, rows); in fbcon_startup()
1042 static void fbcon_init(struct vc_data *vc, bool init) in fbcon_init() argument
1046 struct vc_data **default_mode = vc->vc_display_fg; in fbcon_init()
1048 struct fbcon_display *t, *p = &fb_display[vc->vc_num]; in fbcon_init()
1055 if (con2fb_map[vc->vc_num] == -1) in fbcon_init()
1056 con2fb_map[vc->vc_num] = info_idx; in fbcon_init()
1058 info = fbcon_info_from_console(vc->vc_num); in fbcon_init()
1063 if (vc != svc || logo_shown == FBCON_LOGO_DONTSHOW || in fbcon_init()
1071 con2fb_acquire_newinfo(vc, info, vc->vc_num); in fbcon_init()
1080 vc->vc_font.data = (void *)(p->fontdata = in fbcon_init()
1082 vc->vc_font.width = fvc->vc_font.width; in fbcon_init()
1083 vc->vc_font.height = fvc->vc_font.height; in fbcon_init()
1084 vc->vc_font.charcount = fvc->vc_font.charcount; in fbcon_init()
1097 vc->vc_font.width = font->width; in fbcon_init()
1098 vc->vc_font.height = font->height; in fbcon_init()
1099 vc->vc_font.data = (void *)(p->fontdata = font->data); in fbcon_init()
1100 vc->vc_font.charcount = font->charcount; in fbcon_init()
1104 vc->vc_can_do_color = (fb_get_color_depth(&info->var, &info->fix)!=1); in fbcon_init()
1105 vc->vc_complement_mask = vc->vc_can_do_color ? 0x7700 : 0x0800; in fbcon_init()
1106 if (vc->vc_font.charcount == 256) { in fbcon_init()
1107 vc->vc_hi_font_mask = 0; in fbcon_init()
1109 vc->vc_hi_font_mask = 0x100; in fbcon_init()
1110 if (vc->vc_can_do_color) in fbcon_init()
1111 vc->vc_complement_mask <<= 1; in fbcon_init()
1116 if (!*vc->uni_pagedict_loc) in fbcon_init()
1117 con_copy_unimap(vc, svc); in fbcon_init()
1120 par->cur_blink_jiffies = msecs_to_jiffies(vc->vc_cur_blink_ms); in fbcon_init()
1128 set_blitting_type(vc, info); in fbcon_init()
1130 cols = vc->vc_cols; in fbcon_init()
1131 rows = vc->vc_rows; in fbcon_init()
1134 new_cols /= vc->vc_font.width; in fbcon_init()
1135 new_rows /= vc->vc_font.height; in fbcon_init()
1144 if (con_is_visible(vc) && vc->vc_mode == KD_TEXT) { in fbcon_init()
1173 vc->vc_cols = new_cols; in fbcon_init()
1174 vc->vc_rows = new_rows; in fbcon_init()
1176 vc_resize(vc, new_cols, new_rows); in fbcon_init()
1179 fbcon_prepare_logo(vc, info, cols, rows, new_cols, new_rows); in fbcon_init()
1181 if (par->bitops->rotate_font && par->bitops->rotate_font(info, vc)) { in fbcon_init()
1183 set_blitting_type(vc, info); in fbcon_init()
1197 static void set_vc_hi_font(struct vc_data *vc, bool set);
1220 static void fbcon_deinit(struct vc_data *vc) in fbcon_deinit() argument
1222 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_deinit()
1228 idx = con2fb_map[vc->vc_num]; in fbcon_deinit()
1243 if (con_is_visible(vc)) in fbcon_deinit()
1250 vc->vc_font.data = NULL; in fbcon_deinit()
1252 if (vc->vc_hi_font_mask && vc->vc_screenbuf) in fbcon_deinit()
1253 set_vc_hi_font(vc, false); in fbcon_deinit()
1258 if (vc->vc_num == logo_shown) in fbcon_deinit()
1289 static void __fbcon_clear(struct vc_data *vc, unsigned int sy, unsigned int sx, in __fbcon_clear() argument
1292 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in __fbcon_clear()
1295 struct fbcon_display *p = &fb_display[vc->vc_num]; in __fbcon_clear()
1298 if (!fbcon_is_active(vc, info)) in __fbcon_clear()
1304 if (sy < vc->vc_top && vc->vc_top == logo_lines) { in __fbcon_clear()
1305 vc->vc_top = 0; in __fbcon_clear()
1312 fbcon_clear_margins(vc, 0); in __fbcon_clear()
1315 fg = get_color(vc, info, vc->vc_video_erase_char, 1); in __fbcon_clear()
1316 bg = get_color(vc, info, vc->vc_video_erase_char, 0); in __fbcon_clear()
1322 par->bitops->clear(vc, info, real_y(p, sy), sx, b, width, fg, bg); in __fbcon_clear()
1323 par->bitops->clear(vc, info, real_y(p, sy + b), sx, height - b, in __fbcon_clear()
1326 par->bitops->clear(vc, info, real_y(p, sy), sx, height, width, fg, bg); in __fbcon_clear()
1329 static void fbcon_clear(struct vc_data *vc, unsigned int sy, unsigned int sx, in fbcon_clear() argument
1332 __fbcon_clear(vc, sy, sx, 1, width); in fbcon_clear()
1335 static void fbcon_putcs(struct vc_data *vc, const u16 *s, unsigned int count, in fbcon_putcs() argument
1338 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_putcs()
1339 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_putcs()
1342 if (fbcon_is_active(vc, info)) in fbcon_putcs()
1343 par->bitops->putcs(vc, info, s, count, real_y(p, ypos), xpos, in fbcon_putcs()
1344 get_fg_color(vc, info, scr_readw(s)), in fbcon_putcs()
1345 get_bg_color(vc, info, scr_readw(s))); in fbcon_putcs()
1348 static void fbcon_clear_margins(struct vc_data *vc, int bottom_only) in fbcon_clear_margins() argument
1350 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_clear_margins()
1353 if (fbcon_is_active(vc, info)) in fbcon_clear_margins()
1354 par->bitops->clear_margins(vc, info, margin_color, bottom_only); in fbcon_clear_margins()
1357 static void fbcon_cursor(struct vc_data *vc, bool enable) in fbcon_cursor() argument
1359 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_cursor()
1361 int c = scr_readw((u16 *) vc->vc_pos); in fbcon_cursor()
1363 par->cur_blink_jiffies = msecs_to_jiffies(vc->vc_cur_blink_ms); in fbcon_cursor()
1365 if (!fbcon_is_active(vc, info) || vc->vc_deccm != 1) in fbcon_cursor()
1368 if (vc->vc_cursor_type & CUR_SW) in fbcon_cursor()
1378 par->bitops->cursor(vc, info, enable, in fbcon_cursor()
1379 get_fg_color(vc, info, c), in fbcon_cursor()
1380 get_bg_color(vc, info, c)); in fbcon_cursor()
1391 struct vc_data **default_mode, *vc; in fbcon_set_disp() local
1402 vc = vc_cons[unit].d; in fbcon_set_disp()
1404 if (!vc) in fbcon_set_disp()
1407 default_mode = vc->vc_display_fg; in fbcon_set_disp()
1411 if (!vc->vc_font.data) { in fbcon_set_disp()
1412 vc->vc_font.data = (void *)(p->fontdata = t->fontdata); in fbcon_set_disp()
1413 vc->vc_font.width = (*default_mode)->vc_font.width; in fbcon_set_disp()
1414 vc->vc_font.height = (*default_mode)->vc_font.height; in fbcon_set_disp()
1415 vc->vc_font.charcount = (*default_mode)->vc_font.charcount; in fbcon_set_disp()
1427 vc->vc_can_do_color = (fb_get_color_depth(&info->var, &info->fix)!=1); in fbcon_set_disp()
1428 vc->vc_complement_mask = vc->vc_can_do_color ? 0x7700 : 0x0800; in fbcon_set_disp()
1429 if (vc->vc_font.charcount == 256) { in fbcon_set_disp()
1430 vc->vc_hi_font_mask = 0; in fbcon_set_disp()
1432 vc->vc_hi_font_mask = 0x100; in fbcon_set_disp()
1433 if (vc->vc_can_do_color) in fbcon_set_disp()
1434 vc->vc_complement_mask <<= 1; in fbcon_set_disp()
1439 if (!*vc->uni_pagedict_loc) in fbcon_set_disp()
1440 con_copy_unimap(vc, svc); in fbcon_set_disp()
1444 cols /= vc->vc_font.width; in fbcon_set_disp()
1445 rows /= vc->vc_font.height; in fbcon_set_disp()
1446 ret = vc_resize(vc, cols, rows); in fbcon_set_disp()
1448 if (con_is_visible(vc) && !ret) in fbcon_set_disp()
1449 update_screen(vc); in fbcon_set_disp()
1452 static __inline__ void ywrap_up(struct vc_data *vc, int count) in ywrap_up() argument
1454 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in ywrap_up()
1456 struct fbcon_display *p = &fb_display[vc->vc_num]; in ywrap_up()
1462 par->var.yoffset = p->yscroll * vc->vc_font.height; in ywrap_up()
1471 static __inline__ void ywrap_down(struct vc_data *vc, int count) in ywrap_down() argument
1473 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in ywrap_down()
1475 struct fbcon_display *p = &fb_display[vc->vc_num]; in ywrap_down()
1481 par->var.yoffset = p->yscroll * vc->vc_font.height; in ywrap_down()
1490 static __inline__ void ypan_up(struct vc_data *vc, int count) in ypan_up() argument
1492 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in ypan_up()
1493 struct fbcon_display *p = &fb_display[vc->vc_num]; in ypan_up()
1497 if (p->yscroll > p->vrows - vc->vc_rows) { in ypan_up()
1498 par->bitops->bmove(vc, info, p->vrows - vc->vc_rows, in ypan_up()
1499 0, 0, 0, vc->vc_rows, vc->vc_cols); in ypan_up()
1500 p->yscroll -= p->vrows - vc->vc_rows; in ypan_up()
1504 par->var.yoffset = p->yscroll * vc->vc_font.height; in ypan_up()
1507 fbcon_clear_margins(vc, 1); in ypan_up()
1514 static __inline__ void ypan_up_redraw(struct vc_data *vc, int t, int count) in ypan_up_redraw() argument
1516 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in ypan_up_redraw()
1518 struct fbcon_display *p = &fb_display[vc->vc_num]; in ypan_up_redraw()
1522 if (p->yscroll > p->vrows - vc->vc_rows) { in ypan_up_redraw()
1523 p->yscroll -= p->vrows - vc->vc_rows; in ypan_up_redraw()
1524 fbcon_redraw_move(vc, p, t + count, vc->vc_rows - count, t); in ypan_up_redraw()
1528 par->var.yoffset = p->yscroll * vc->vc_font.height; in ypan_up_redraw()
1531 fbcon_clear_margins(vc, 1); in ypan_up_redraw()
1538 static __inline__ void ypan_down(struct vc_data *vc, int count) in ypan_down() argument
1540 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in ypan_down()
1541 struct fbcon_display *p = &fb_display[vc->vc_num]; in ypan_down()
1546 par->bitops->bmove(vc, info, 0, 0, p->vrows - vc->vc_rows, in ypan_down()
1547 0, vc->vc_rows, vc->vc_cols); in ypan_down()
1548 p->yscroll += p->vrows - vc->vc_rows; in ypan_down()
1552 par->var.yoffset = p->yscroll * vc->vc_font.height; in ypan_down()
1555 fbcon_clear_margins(vc, 1); in ypan_down()
1562 static __inline__ void ypan_down_redraw(struct vc_data *vc, int t, int count) in ypan_down_redraw() argument
1564 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in ypan_down_redraw()
1566 struct fbcon_display *p = &fb_display[vc->vc_num]; in ypan_down_redraw()
1571 p->yscroll += p->vrows - vc->vc_rows; in ypan_down_redraw()
1572 fbcon_redraw_move(vc, p, t, vc->vc_rows - count, t + count); in ypan_down_redraw()
1576 par->var.yoffset = p->yscroll * vc->vc_font.height; in ypan_down_redraw()
1579 fbcon_clear_margins(vc, 1); in ypan_down_redraw()
1586 static void fbcon_redraw_move(struct vc_data *vc, struct fbcon_display *p, in fbcon_redraw_move() argument
1590 (vc->vc_origin + vc->vc_size_row * line); in fbcon_redraw_move()
1604 fbcon_putcs(vc, start, s - start, in fbcon_redraw_move()
1614 fbcon_putcs(vc, start, s - start, dy, x); in fbcon_redraw_move()
1620 static void fbcon_redraw_blit(struct vc_data *vc, struct fb_info *info, in fbcon_redraw_blit() argument
1623 int offset = ycount * vc->vc_cols; in fbcon_redraw_blit()
1625 (vc->vc_origin + vc->vc_size_row * line); in fbcon_redraw_blit()
1640 par->bitops->bmove(vc, info, line + ycount, x, in fbcon_redraw_blit()
1656 par->bitops->bmove(vc, info, line + ycount, x, line, x, 1, in fbcon_redraw_blit()
1664 s -= vc->vc_size_row; in fbcon_redraw_blit()
1665 d -= vc->vc_size_row; in fbcon_redraw_blit()
1670 static void fbcon_redraw(struct vc_data *vc, int line, int count, int offset) in fbcon_redraw() argument
1673 (vc->vc_origin + vc->vc_size_row * line); in fbcon_redraw()
1688 fbcon_putcs(vc, start, s - start, in fbcon_redraw()
1696 fbcon_putcs(vc, start, s - start, in fbcon_redraw()
1711 fbcon_putcs(vc, start, s - start, line, x); in fbcon_redraw()
1718 s -= vc->vc_size_row; in fbcon_redraw()
1719 d -= vc->vc_size_row; in fbcon_redraw()
1724 static void fbcon_bmove_rec(struct vc_data *vc, struct fbcon_display *p, int sy, int sx, in fbcon_bmove_rec() argument
1727 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_bmove_rec()
1734 fbcon_bmove_rec(vc, p, sy, sx, dy, dx, b, width, in fbcon_bmove_rec()
1736 fbcon_bmove_rec(vc, p, sy + b, sx, dy + b, dx, in fbcon_bmove_rec()
1739 fbcon_bmove_rec(vc, p, sy + b, sx, dy + b, dx, in fbcon_bmove_rec()
1741 fbcon_bmove_rec(vc, p, sy, sx, dy, dx, b, width, in fbcon_bmove_rec()
1750 fbcon_bmove_rec(vc, p, sy, sx, dy, dx, b, width, in fbcon_bmove_rec()
1752 fbcon_bmove_rec(vc, p, sy + b, sx, dy + b, dx, in fbcon_bmove_rec()
1755 fbcon_bmove_rec(vc, p, sy + b, sx, dy + b, dx, in fbcon_bmove_rec()
1757 fbcon_bmove_rec(vc, p, sy, sx, dy, dx, b, width, in fbcon_bmove_rec()
1762 par->bitops->bmove(vc, info, real_y(p, sy), sx, real_y(p, dy), dx, in fbcon_bmove_rec()
1766 static void fbcon_bmove(struct vc_data *vc, int sy, int sx, int dy, int dx, in fbcon_bmove() argument
1769 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_bmove()
1770 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_bmove()
1772 if (!fbcon_is_active(vc, info)) in fbcon_bmove()
1785 fbcon_bmove_rec(vc, p, sy, sx, dy, dx, height, width, in fbcon_bmove()
1789 static bool fbcon_scroll(struct vc_data *vc, unsigned int t, unsigned int b, in fbcon_scroll() argument
1792 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_scroll()
1793 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_scroll()
1796 if (!fbcon_is_active(vc, info)) in fbcon_scroll()
1799 fbcon_cursor(vc, false); in fbcon_scroll()
1809 if (count > vc->vc_rows) /* Maximum realistic size */ in fbcon_scroll()
1810 count = vc->vc_rows; in fbcon_scroll()
1813 fbcon_redraw_blit(vc, info, p, t, b - t - count, in fbcon_scroll()
1815 __fbcon_clear(vc, b - count, 0, count, vc->vc_cols); in fbcon_scroll()
1816 scr_memsetw((unsigned short *) (vc->vc_origin + in fbcon_scroll()
1817 vc->vc_size_row * in fbcon_scroll()
1819 vc->vc_video_erase_char, in fbcon_scroll()
1820 vc->vc_size_row * count); in fbcon_scroll()
1824 if (b - t - count > 3 * vc->vc_rows >> 2) { in fbcon_scroll()
1826 fbcon_bmove(vc, 0, 0, count, 0, t, in fbcon_scroll()
1827 vc->vc_cols); in fbcon_scroll()
1828 ywrap_up(vc, count); in fbcon_scroll()
1829 if (vc->vc_rows - b > 0) in fbcon_scroll()
1830 fbcon_bmove(vc, b - count, 0, b, 0, in fbcon_scroll()
1831 vc->vc_rows - b, in fbcon_scroll()
1832 vc->vc_cols); in fbcon_scroll()
1834 fbcon_bmove(vc, t + count, 0, t, 0, in fbcon_scroll()
1835 b - t - count, vc->vc_cols); in fbcon_scroll()
1838 __fbcon_clear(vc, b - count, 0, count, vc->vc_cols); in fbcon_scroll()
1843 2 * (p->vrows - vc->vc_rows)) in fbcon_scroll()
1844 && ((!scroll_partial && (b - t == vc->vc_rows)) in fbcon_scroll()
1847 3 * vc->vc_rows >> 2)))) { in fbcon_scroll()
1849 fbcon_redraw_move(vc, p, 0, t, count); in fbcon_scroll()
1850 ypan_up_redraw(vc, t, count); in fbcon_scroll()
1851 if (vc->vc_rows - b > 0) in fbcon_scroll()
1852 fbcon_redraw_move(vc, p, b, in fbcon_scroll()
1853 vc->vc_rows - b, b); in fbcon_scroll()
1855 fbcon_redraw_move(vc, p, t + count, b - t - count, t); in fbcon_scroll()
1856 __fbcon_clear(vc, b - count, 0, count, vc->vc_cols); in fbcon_scroll()
1861 2 * (p->vrows - vc->vc_rows)) in fbcon_scroll()
1862 && ((!scroll_partial && (b - t == vc->vc_rows)) in fbcon_scroll()
1865 3 * vc->vc_rows >> 2)))) { in fbcon_scroll()
1867 fbcon_bmove(vc, 0, 0, count, 0, t, in fbcon_scroll()
1868 vc->vc_cols); in fbcon_scroll()
1869 ypan_up(vc, count); in fbcon_scroll()
1870 if (vc->vc_rows - b > 0) in fbcon_scroll()
1871 fbcon_bmove(vc, b - count, 0, b, 0, in fbcon_scroll()
1872 vc->vc_rows - b, in fbcon_scroll()
1873 vc->vc_cols); in fbcon_scroll()
1875 fbcon_bmove(vc, t + count, 0, t, 0, in fbcon_scroll()
1876 b - t - count, vc->vc_cols); in fbcon_scroll()
1879 __fbcon_clear(vc, b - count, 0, count, vc->vc_cols); in fbcon_scroll()
1884 fbcon_redraw(vc, t, b - t - count, in fbcon_scroll()
1885 count * vc->vc_cols); in fbcon_scroll()
1886 __fbcon_clear(vc, b - count, 0, count, vc->vc_cols); in fbcon_scroll()
1887 scr_memsetw((unsigned short *) (vc->vc_origin + in fbcon_scroll()
1888 vc->vc_size_row * in fbcon_scroll()
1890 vc->vc_video_erase_char, in fbcon_scroll()
1891 vc->vc_size_row * count); in fbcon_scroll()
1897 if (count > vc->vc_rows) /* Maximum realistic size */ in fbcon_scroll()
1898 count = vc->vc_rows; in fbcon_scroll()
1901 fbcon_redraw_blit(vc, info, p, b - 1, b - t - count, in fbcon_scroll()
1903 __fbcon_clear(vc, t, 0, count, vc->vc_cols); in fbcon_scroll()
1904 scr_memsetw((unsigned short *) (vc->vc_origin + in fbcon_scroll()
1905 vc->vc_size_row * in fbcon_scroll()
1907 vc->vc_video_erase_char, in fbcon_scroll()
1908 vc->vc_size_row * count); in fbcon_scroll()
1912 if (b - t - count > 3 * vc->vc_rows >> 2) { in fbcon_scroll()
1913 if (vc->vc_rows - b > 0) in fbcon_scroll()
1914 fbcon_bmove(vc, b, 0, b - count, 0, in fbcon_scroll()
1915 vc->vc_rows - b, in fbcon_scroll()
1916 vc->vc_cols); in fbcon_scroll()
1917 ywrap_down(vc, count); in fbcon_scroll()
1919 fbcon_bmove(vc, count, 0, 0, 0, t, in fbcon_scroll()
1920 vc->vc_cols); in fbcon_scroll()
1922 fbcon_bmove(vc, t, 0, t + count, 0, in fbcon_scroll()
1923 b - t - count, vc->vc_cols); in fbcon_scroll()
1926 __fbcon_clear(vc, t, 0, count, vc->vc_cols); in fbcon_scroll()
1930 if ((count - p->yscroll <= p->vrows - vc->vc_rows) in fbcon_scroll()
1931 && ((!scroll_partial && (b - t == vc->vc_rows)) in fbcon_scroll()
1934 3 * vc->vc_rows >> 2)))) { in fbcon_scroll()
1935 if (vc->vc_rows - b > 0) in fbcon_scroll()
1936 fbcon_bmove(vc, b, 0, b - count, 0, in fbcon_scroll()
1937 vc->vc_rows - b, in fbcon_scroll()
1938 vc->vc_cols); in fbcon_scroll()
1939 ypan_down(vc, count); in fbcon_scroll()
1941 fbcon_bmove(vc, count, 0, 0, 0, t, in fbcon_scroll()
1942 vc->vc_cols); in fbcon_scroll()
1944 fbcon_bmove(vc, t, 0, t + count, 0, in fbcon_scroll()
1945 b - t - count, vc->vc_cols); in fbcon_scroll()
1948 __fbcon_clear(vc, t, 0, count, vc->vc_cols); in fbcon_scroll()
1952 if ((count - p->yscroll <= p->vrows - vc->vc_rows) in fbcon_scroll()
1953 && ((!scroll_partial && (b - t == vc->vc_rows)) in fbcon_scroll()
1956 3 * vc->vc_rows >> 2)))) { in fbcon_scroll()
1957 if (vc->vc_rows - b > 0) in fbcon_scroll()
1958 fbcon_redraw_move(vc, p, b, vc->vc_rows - b, in fbcon_scroll()
1960 ypan_down_redraw(vc, t, count); in fbcon_scroll()
1962 fbcon_redraw_move(vc, p, count, t, 0); in fbcon_scroll()
1964 fbcon_redraw_move(vc, p, t, b - t - count, t + count); in fbcon_scroll()
1965 __fbcon_clear(vc, t, 0, count, vc->vc_cols); in fbcon_scroll()
1970 fbcon_redraw(vc, b - 1, b - t - count, in fbcon_scroll()
1971 -count * vc->vc_cols); in fbcon_scroll()
1972 __fbcon_clear(vc, t, 0, count, vc->vc_cols); in fbcon_scroll()
1973 scr_memsetw((unsigned short *) (vc->vc_origin + in fbcon_scroll()
1974 vc->vc_size_row * in fbcon_scroll()
1976 vc->vc_video_erase_char, in fbcon_scroll()
1977 vc->vc_size_row * count); in fbcon_scroll()
1987 struct vc_data *vc) in updatescrollmode_accel() argument
1998 divides(ypan, vc->vc_font.height) && vyres > yres; in updatescrollmode_accel()
2000 divides(ywrap, vc->vc_font.height) && in updatescrollmode_accel()
2001 divides(vc->vc_font.height, vyres) && in updatescrollmode_accel()
2002 divides(vc->vc_font.height, yres); in updatescrollmode_accel()
2027 struct vc_data *vc) in updatescrollmode() argument
2030 int fh = vc->vc_font.height; in updatescrollmode()
2035 if (yres > (fh * (vc->vc_rows + 1))) in updatescrollmode()
2036 p->vrows -= (yres - (fh * vc->vc_rows)) / fh; in updatescrollmode()
2041 updatescrollmode_accel(p, info, vc); in updatescrollmode()
2047 static int fbcon_resize(struct vc_data *vc, unsigned int width, in fbcon_resize() argument
2050 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_resize()
2052 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_resize()
2056 if (p->userfont && FNTSIZE(vc->vc_font.data)) { in fbcon_resize()
2058 int pitch = PITCH(vc->vc_font.width); in fbcon_resize()
2069 size = CALC_FONTSZ(vc->vc_font.height, pitch, vc->vc_font.charcount); in fbcon_resize()
2070 if (size > FNTSIZE(vc->vc_font.data)) in fbcon_resize()
2076 virt_fw = FBCON_SWAP(par->rotate, vc->vc_font.width, vc->vc_font.height); in fbcon_resize()
2077 virt_fh = FBCON_SWAP(par->rotate, vc->vc_font.height, vc->vc_font.width); in fbcon_resize()
2097 if (con_is_visible(vc) && vc->vc_mode == KD_TEXT) { in fbcon_resize()
2105 updatescrollmode(p, info, vc); in fbcon_resize()
2109 static bool fbcon_switch(struct vc_data *vc) in fbcon_switch() argument
2113 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_switch()
2117 info = fbcon_info_from_console(vc->vc_num); in fbcon_switch()
2144 par->currcon = vc->vc_num; in fbcon_switch()
2175 if (!fbcon_is_active(vc, info) || par->blank_state != FB_BLANK_UNBLANK) in fbcon_switch()
2180 set_blitting_type(vc, info); in fbcon_switch()
2183 if (par->bitops->rotate_font && par->bitops->rotate_font(info, vc)) { in fbcon_switch()
2185 set_blitting_type(vc, info); in fbcon_switch()
2188 vc->vc_can_do_color = (fb_get_color_depth(&info->var, &info->fix)!=1); in fbcon_switch()
2189 vc->vc_complement_mask = vc->vc_can_do_color ? 0x7700 : 0x0800; in fbcon_switch()
2191 if (vc->vc_font.charcount > 256) in fbcon_switch()
2192 vc->vc_complement_mask <<= 1; in fbcon_switch()
2194 updatescrollmode(p, info, vc); in fbcon_switch()
2198 scrollback_phys_max = p->vrows - vc->vc_rows; in fbcon_switch()
2202 scrollback_phys_max = p->vrows - 2 * vc->vc_rows; in fbcon_switch()
2214 if (fbcon_is_active(vc, info)) { in fbcon_switch()
2219 fbcon_set_palette(vc, color_table); in fbcon_switch()
2220 fbcon_clear_margins(vc, 0); in fbcon_switch()
2226 update_region(vc, in fbcon_switch()
2227 vc->vc_origin + vc->vc_size_row * vc->vc_top, in fbcon_switch()
2228 vc->vc_size_row * (vc->vc_bottom - in fbcon_switch()
2229 vc->vc_top) / 2); in fbcon_switch()
2235 static void fbcon_generic_blank(struct vc_data *vc, struct fb_info *info, in fbcon_generic_blank() argument
2239 unsigned short charmask = vc->vc_hi_font_mask ? in fbcon_generic_blank()
2243 oldc = vc->vc_video_erase_char; in fbcon_generic_blank()
2244 vc->vc_video_erase_char &= charmask; in fbcon_generic_blank()
2245 __fbcon_clear(vc, 0, 0, vc->vc_rows, vc->vc_cols); in fbcon_generic_blank()
2246 vc->vc_video_erase_char = oldc; in fbcon_generic_blank()
2250 static bool fbcon_blank(struct vc_data *vc, enum vesa_blank_mode blank, in fbcon_blank() argument
2253 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_blank()
2270 if (fbcon_is_active(vc, info)) { in fbcon_blank()
2273 fbcon_cursor(vc, !blank); in fbcon_blank()
2277 fbcon_generic_blank(vc, info, blank); in fbcon_blank()
2281 update_screen(vc); in fbcon_blank()
2284 if (mode_switch || !fbcon_is_active(vc, info) || par->blank_state != FB_BLANK_UNBLANK) in fbcon_blank()
2292 static void fbcon_debug_enter(struct vc_data *vc) in fbcon_debug_enter() argument
2294 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_debug_enter()
2301 fbcon_set_palette(vc, color_table); in fbcon_debug_enter()
2304 static void fbcon_debug_leave(struct vc_data *vc) in fbcon_debug_leave() argument
2306 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_debug_leave()
2314 static int fbcon_get_font(struct vc_data *vc, struct console_font *font, unsigned int vpitch) in fbcon_get_font() argument
2316 u8 *fontdata = vc->vc_font.data; in fbcon_get_font()
2320 font->width = vc->vc_font.width; in fbcon_get_font()
2321 font->height = vc->vc_font.height; in fbcon_get_font()
2324 font->charcount = vc->vc_hi_font_mask ? 512 : 256; in fbcon_get_font()
2329 j = vc->vc_font.height; in fbcon_get_font()
2340 j = vc->vc_font.height * 2; in fbcon_get_font()
2351 if (font->charcount * (vc->vc_font.height * sizeof(u32)) > FNTSIZE(fontdata)) in fbcon_get_font()
2355 for (j = 0; j < vc->vc_font.height; j++) { in fbcon_get_font()
2365 j = vc->vc_font.height * 4; in fbcon_get_font()
2380 static void set_vc_hi_font(struct vc_data *vc, bool set) in set_vc_hi_font() argument
2383 vc->vc_hi_font_mask = 0; in set_vc_hi_font()
2384 if (vc->vc_can_do_color) { in set_vc_hi_font()
2385 vc->vc_complement_mask >>= 1; in set_vc_hi_font()
2386 vc->vc_s_complement_mask >>= 1; in set_vc_hi_font()
2390 if (vc->vc_can_do_color) { in set_vc_hi_font()
2392 (unsigned short *) vc->vc_origin; in set_vc_hi_font()
2393 int count = vc->vc_screenbuf_size / 2; in set_vc_hi_font()
2400 c = vc->vc_video_erase_char; in set_vc_hi_font()
2401 vc->vc_video_erase_char = in set_vc_hi_font()
2403 vc->vc_attr >>= 1; in set_vc_hi_font()
2406 vc->vc_hi_font_mask = 0x100; in set_vc_hi_font()
2407 if (vc->vc_can_do_color) { in set_vc_hi_font()
2408 vc->vc_complement_mask <<= 1; in set_vc_hi_font()
2409 vc->vc_s_complement_mask <<= 1; in set_vc_hi_font()
2415 (unsigned short *) vc->vc_origin; in set_vc_hi_font()
2416 int count = vc->vc_screenbuf_size / 2; in set_vc_hi_font()
2421 if (vc->vc_can_do_color) in set_vc_hi_font()
2429 c = vc->vc_video_erase_char; in set_vc_hi_font()
2430 if (vc->vc_can_do_color) { in set_vc_hi_font()
2431 vc->vc_video_erase_char = in set_vc_hi_font()
2433 vc->vc_attr <<= 1; in set_vc_hi_font()
2435 vc->vc_video_erase_char = c & ~0x100; in set_vc_hi_font()
2440 static int fbcon_do_set_font(struct vc_data *vc, int w, int h, int charcount, in fbcon_do_set_font() argument
2443 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_do_set_font()
2445 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_do_set_font()
2447 u8 *old_data = vc->vc_font.data; in fbcon_do_set_font()
2449 resize = (w != vc->vc_font.width) || (h != vc->vc_font.height); in fbcon_do_set_font()
2450 vc->vc_font.data = (void *)(p->fontdata = data); in fbcon_do_set_font()
2455 old_width = vc->vc_font.width; in fbcon_do_set_font()
2456 old_height = vc->vc_font.height; in fbcon_do_set_font()
2457 old_charcount = vc->vc_font.charcount; in fbcon_do_set_font()
2459 vc->vc_font.width = w; in fbcon_do_set_font()
2460 vc->vc_font.height = h; in fbcon_do_set_font()
2461 vc->vc_font.charcount = charcount; in fbcon_do_set_font()
2462 if (vc->vc_hi_font_mask && charcount == 256) in fbcon_do_set_font()
2463 set_vc_hi_font(vc, false); in fbcon_do_set_font()
2464 else if (!vc->vc_hi_font_mask && charcount == 512) in fbcon_do_set_font()
2465 set_vc_hi_font(vc, true); in fbcon_do_set_font()
2474 ret = vc_resize(vc, cols, rows); in fbcon_do_set_font()
2477 } else if (con_is_visible(vc) in fbcon_do_set_font()
2478 && vc->vc_mode == KD_TEXT) { in fbcon_do_set_font()
2479 fbcon_clear_margins(vc, 0); in fbcon_do_set_font()
2480 update_screen(vc); in fbcon_do_set_font()
2489 vc->vc_font.data = old_data; in fbcon_do_set_font()
2497 vc->vc_font.width = old_width; in fbcon_do_set_font()
2498 vc->vc_font.height = old_height; in fbcon_do_set_font()
2499 vc->vc_font.charcount = old_charcount; in fbcon_do_set_font()
2509 static int fbcon_set_font(struct vc_data *vc, const struct console_font *font, in fbcon_set_font() argument
2512 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_set_font()
2586 return fbcon_do_set_font(vc, font->width, font->height, charcount, new_data, 1); in fbcon_set_font()
2589 static int fbcon_set_def_font(struct vc_data *vc, struct console_font *font, in fbcon_set_def_font() argument
2592 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_set_def_font()
2603 return fbcon_do_set_font(vc, f->width, f->height, f->charcount, f->data, 0); in fbcon_set_def_font()
2614 static void fbcon_set_palette(struct vc_data *vc, const unsigned char *table) in fbcon_set_palette() argument
2616 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_set_palette()
2620 if (!fbcon_is_active(vc, info)) in fbcon_set_palette()
2623 if (!con_is_visible(vc)) in fbcon_set_palette()
2630 val = vc->vc_palette[j++]; in fbcon_set_palette()
2632 val = vc->vc_palette[j++]; in fbcon_set_palette()
2634 val = vc->vc_palette[j++]; in fbcon_set_palette()
2651 static void fbcon_invert_region(struct vc_data *vc, u16 * p, int cnt) in fbcon_invert_region() argument
2655 if (!vc->vc_can_do_color) in fbcon_invert_region()
2657 else if (vc->vc_hi_font_mask == 0x100) in fbcon_invert_region()
2669 struct vc_data *vc = NULL; in fbcon_suspended() local
2674 vc = vc_cons[par->currcon].d; in fbcon_suspended()
2677 fbcon_cursor(vc, false); in fbcon_suspended()
2682 struct vc_data *vc; in fbcon_resumed() local
2687 vc = vc_cons[par->currcon].d; in fbcon_resumed()
2689 update_screen(vc); in fbcon_resumed()
2695 struct vc_data *vc; in fbcon_modechanged() local
2701 vc = vc_cons[par->currcon].d; in fbcon_modechanged()
2702 if (vc->vc_mode != KD_TEXT || in fbcon_modechanged()
2706 p = &fb_display[vc->vc_num]; in fbcon_modechanged()
2707 set_blitting_type(vc, info); in fbcon_modechanged()
2709 if (con_is_visible(vc)) { in fbcon_modechanged()
2713 cols /= vc->vc_font.width; in fbcon_modechanged()
2714 rows /= vc->vc_font.height; in fbcon_modechanged()
2715 vc_resize(vc, cols, rows); in fbcon_modechanged()
2716 updatescrollmode(p, info, vc); in fbcon_modechanged()
2720 if (fbcon_is_active(vc, info)) { in fbcon_modechanged()
2725 fbcon_set_palette(vc, color_table); in fbcon_modechanged()
2726 update_screen(vc); in fbcon_modechanged()
2733 struct vc_data *vc; in fbcon_set_all_vcs() local
2741 vc = vc_cons[i].d; in fbcon_set_all_vcs()
2742 if (!vc || vc->vc_mode != KD_TEXT || in fbcon_set_all_vcs()
2746 if (con_is_visible(vc)) { in fbcon_set_all_vcs()
2751 p = &fb_display[vc->vc_num]; in fbcon_set_all_vcs()
2752 set_blitting_type(vc, info); in fbcon_set_all_vcs()
2756 cols /= vc->vc_font.width; in fbcon_set_all_vcs()
2757 rows /= vc->vc_font.height; in fbcon_set_all_vcs()
2758 vc_resize(vc, cols, rows); in fbcon_set_all_vcs()
2779 struct vc_data *vc; in fbcon_modechange_possible() local
2789 vc = vc_cons[i].d; in fbcon_modechange_possible()
2790 if (!vc || vc->vc_mode != KD_TEXT || in fbcon_modechange_possible()
2794 if (vc->vc_font.width > FBCON_SWAP(var->rotate, var->xres, var->yres) || in fbcon_modechange_possible()
2795 vc->vc_font.height > FBCON_SWAP(var->rotate, var->yres, var->xres)) in fbcon_modechange_possible()
3083 struct vc_data *vc; in fbcon_fb_blanked() local
3088 vc = vc_cons[par->currcon].d; in fbcon_fb_blanked()
3089 if (vc->vc_mode != KD_TEXT || fbcon_info_from_console(par->currcon) != info) in fbcon_fb_blanked()
3092 if (con_is_visible(vc)) { in fbcon_fb_blanked()
3104 struct vc_data *vc; in fbcon_new_modelist() local
3113 vc = vc_cons[i].d; in fbcon_new_modelist()
3118 fbcon_set_disp(info, &var, vc->vc_num); in fbcon_new_modelist()
3125 struct vc_data *vc; in fbcon_get_requirement() local
3131 vc = vc_cons[i].d; in fbcon_get_requirement()
3132 if (vc && vc->vc_mode == KD_TEXT && in fbcon_get_requirement()
3134 set_bit(vc->vc_font.width - 1, caps->x); in fbcon_get_requirement()
3135 set_bit(vc->vc_font.height - 1, caps->y); in fbcon_get_requirement()
3136 charcnt = vc->vc_font.charcount; in fbcon_get_requirement()
3142 vc = vc_cons[fg_console].d; in fbcon_get_requirement()
3144 if (vc && vc->vc_mode == KD_TEXT && in fbcon_get_requirement()
3147 set_bit(vc->vc_font.width - 1, caps->x); in fbcon_get_requirement()
3149 set_bit(vc->vc_font.height - 1, caps->y); in fbcon_get_requirement()
3150 caps->len = vc->vc_font.charcount; in fbcon_get_requirement()