Lines Matching refs:vc
156 #define advance_row(p, delta) (unsigned short *)((unsigned long)(p) + (delta) * vc->vc_size_row)
167 static void fbcon_init(struct vc_data *vc, int init);
168 static void fbcon_deinit(struct vc_data *vc);
169 static void fbcon_clear(struct vc_data *vc, int sy, int sx, int height,
171 static void fbcon_putc(struct vc_data *vc, int c, int ypos, int xpos);
172 static void fbcon_putcs(struct vc_data *vc, const unsigned short *s,
174 static void fbcon_clear_margins(struct vc_data *vc, int bottom_only);
175 static void fbcon_cursor(struct vc_data *vc, int mode);
176 static void fbcon_bmove(struct vc_data *vc, int sy, int sx, int dy, int dx,
178 static int fbcon_switch(struct vc_data *vc);
179 static int fbcon_blank(struct vc_data *vc, int blank, int mode_switch);
180 static void fbcon_set_palette(struct vc_data *vc, const unsigned char *table);
185 static __inline__ void ywrap_up(struct vc_data *vc, int count);
186 static __inline__ void ywrap_down(struct vc_data *vc, int count);
187 static __inline__ void ypan_up(struct vc_data *vc, int count);
188 static __inline__ void ypan_down(struct vc_data *vc, int count);
189 static void fbcon_bmove_rec(struct vc_data *vc, struct fbcon_display *p, int sy, int sx,
193 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()
283 static inline int fbcon_is_inactive(struct vc_data *vc, struct fb_info *info) in fbcon_is_inactive() argument
288 vc->vc_mode != KD_TEXT || ops->graphics); in fbcon_is_inactive()
291 static int get_color(struct vc_data *vc, struct fb_info *info, in get_color() argument
298 unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff; in get_color()
300 c = vc->vc_video_erase_char & charmask; in get_color()
304 color = (is_fg) ? attr_fgcol((vc->vc_hi_font_mask) ? 9 : 8, c) in get_color()
305 : attr_bgcol((vc->vc_hi_font_mask) ? 13 : 12, c); in get_color()
362 struct vc_data *vc = NULL; in fb_flashcursor() local
375 vc = vc_cons[ops->currcon].d; in fb_flashcursor()
377 if (!vc || !con_is_visible(vc) || in fb_flashcursor()
378 registered_fb[con2fb_map[vc->vc_num]] != info || in fb_flashcursor()
379 vc->vc_deccm != 1) { in fb_flashcursor()
384 c = scr_readw((u16 *) vc->vc_pos); in fb_flashcursor()
387 ops->cursor(vc, info, mode, get_color(vc, info, c, 1), in fb_flashcursor()
388 get_color(vc, info, c, 0)); in fb_flashcursor()
567 static void fbcon_prepare_logo(struct vc_data *vc, struct fb_info *info, in fbcon_prepare_logo() argument
573 static void fbcon_prepare_logo(struct vc_data *vc, struct fb_info *info, in fbcon_prepare_logo() argument
578 int cnt, erase = vc->vc_video_erase_char, step; in fbcon_prepare_logo()
594 logo_lines = DIV_ROUND_UP(logo_height, vc->vc_font.height); in fbcon_prepare_logo()
595 q = (unsigned short *) (vc->vc_origin + in fbcon_prepare_logo()
596 vc->vc_size_row * rows); in fbcon_prepare_logo()
599 if (scr_readw(r) != vc->vc_video_erase_char) in fbcon_prepare_logo()
617 scr_memcpyw(r + step, r, vc->vc_size_row); in fbcon_prepare_logo()
622 if (vc->state.y + logo_lines >= rows) in fbcon_prepare_logo()
623 lines = rows - vc->state.y - 1; in fbcon_prepare_logo()
626 vc->state.y += lines; in fbcon_prepare_logo()
627 vc->vc_pos += lines * vc->vc_size_row; in fbcon_prepare_logo()
630 scr_memsetw((unsigned short *) vc->vc_origin, in fbcon_prepare_logo()
632 vc->vc_size_row * logo_lines); in fbcon_prepare_logo()
634 if (con_is_visible(vc) && vc->vc_mode == KD_TEXT) { in fbcon_prepare_logo()
635 fbcon_clear_margins(vc, 0); in fbcon_prepare_logo()
636 update_screen(vc); in fbcon_prepare_logo()
640 q = (unsigned short *) (vc->vc_origin + in fbcon_prepare_logo()
641 vc->vc_size_row * in fbcon_prepare_logo()
644 vc->state.y += logo_lines; in fbcon_prepare_logo()
645 vc->vc_pos += logo_lines * vc->vc_size_row; in fbcon_prepare_logo()
652 if (logo_lines > vc->vc_bottom) { in fbcon_prepare_logo()
658 vc->vc_top = logo_lines; in fbcon_prepare_logo()
664 static void set_blitting_type(struct vc_data *vc, struct fb_info *info) in set_blitting_type() argument
668 ops->p = &fb_display[vc->vc_num]; in set_blitting_type()
671 fbcon_set_tileops(vc, info); in set_blitting_type()
689 static void set_blitting_type(struct vc_data *vc, struct fb_info *info) in set_blitting_type() argument
694 ops->p = &fb_display[vc->vc_num]; in set_blitting_type()
707 static int con2fb_acquire_newinfo(struct vc_data *vc, struct fb_info *info, in con2fb_acquire_newinfo() argument
731 if (vc) in con2fb_acquire_newinfo()
732 set_blitting_type(vc, info); in con2fb_acquire_newinfo()
743 static int con2fb_release_oldinfo(struct vc_data *vc, struct fb_info *oldinfo, in con2fb_release_oldinfo() argument
789 static void con2fb_init_display(struct vc_data *vc, struct fb_info *info, in con2fb_init_display() argument
836 struct vc_data *vc = vc_cons[unit].d; in set_con2fb_map() local
862 err = con2fb_acquire_newinfo(vc, info, unit, oldidx); in set_con2fb_map()
869 err = con2fb_release_oldinfo(vc, oldinfo, info, unit, oldidx, in set_con2fb_map()
879 con2fb_init_display(vc, info, unit, show_logo); in set_con2fb_map()
939 struct vc_data *vc = vc_cons[fg_console].d; in fbcon_startup() local
987 set_blitting_type(vc, info); in fbcon_startup()
990 if (!p->fontdata && !vc->vc_font.data) { in fbcon_startup()
996 vc->vc_font.width = font->width; in fbcon_startup()
997 vc->vc_font.height = font->height; in fbcon_startup()
998 vc->vc_font.data = (void *)(p->fontdata = font->data); in fbcon_startup()
999 vc->vc_font.charcount = font->charcount; in fbcon_startup()
1001 p->fontdata = vc->vc_font.data; in fbcon_startup()
1006 cols /= vc->vc_font.width; in fbcon_startup()
1007 rows /= vc->vc_font.height; in fbcon_startup()
1008 vc_resize(vc, cols, rows); in fbcon_startup()
1020 static void fbcon_init(struct vc_data *vc, int init) in fbcon_init() argument
1024 struct vc_data **default_mode = vc->vc_display_fg; in fbcon_init()
1026 struct fbcon_display *t, *p = &fb_display[vc->vc_num]; in fbcon_init()
1033 if (con2fb_map[vc->vc_num] == -1) in fbcon_init()
1034 con2fb_map[vc->vc_num] = info_idx; in fbcon_init()
1036 info = registered_fb[con2fb_map[vc->vc_num]]; in fbcon_init()
1041 if (vc != svc || logo_shown == FBCON_LOGO_DONTSHOW || in fbcon_init()
1049 con2fb_acquire_newinfo(vc, info, vc->vc_num, -1); in fbcon_init()
1058 vc->vc_font.data = (void *)(p->fontdata = in fbcon_init()
1060 vc->vc_font.width = fvc->vc_font.width; in fbcon_init()
1061 vc->vc_font.height = fvc->vc_font.height; in fbcon_init()
1062 vc->vc_font.charcount = fvc->vc_font.charcount; in fbcon_init()
1075 vc->vc_font.width = font->width; in fbcon_init()
1076 vc->vc_font.height = font->height; in fbcon_init()
1077 vc->vc_font.data = (void *)(p->fontdata = font->data); in fbcon_init()
1078 vc->vc_font.charcount = font->charcount; in fbcon_init()
1082 vc->vc_can_do_color = (fb_get_color_depth(&info->var, &info->fix)!=1); in fbcon_init()
1083 vc->vc_complement_mask = vc->vc_can_do_color ? 0x7700 : 0x0800; in fbcon_init()
1084 if (vc->vc_font.charcount == 256) { in fbcon_init()
1085 vc->vc_hi_font_mask = 0; in fbcon_init()
1087 vc->vc_hi_font_mask = 0x100; in fbcon_init()
1088 if (vc->vc_can_do_color) in fbcon_init()
1089 vc->vc_complement_mask <<= 1; in fbcon_init()
1094 if (!*vc->vc_uni_pagedir_loc) in fbcon_init()
1095 con_copy_unimap(vc, svc); in fbcon_init()
1098 ops->cur_blink_jiffies = msecs_to_jiffies(vc->vc_cur_blink_ms); in fbcon_init()
1106 set_blitting_type(vc, info); in fbcon_init()
1108 cols = vc->vc_cols; in fbcon_init()
1109 rows = vc->vc_rows; in fbcon_init()
1112 new_cols /= vc->vc_font.width; in fbcon_init()
1113 new_rows /= vc->vc_font.height; in fbcon_init()
1122 if (con_is_visible(vc) && vc->vc_mode == KD_TEXT) { in fbcon_init()
1152 vc->vc_cols = new_cols; in fbcon_init()
1153 vc->vc_rows = new_rows; in fbcon_init()
1155 vc_resize(vc, new_cols, new_rows); in fbcon_init()
1158 fbcon_prepare_logo(vc, info, cols, rows, new_cols, new_rows); in fbcon_init()
1160 if (ops->rotate_font && ops->rotate_font(info, vc)) { in fbcon_init()
1162 set_blitting_type(vc, info); in fbcon_init()
1176 static void set_vc_hi_font(struct vc_data *vc, bool set);
1178 static void fbcon_deinit(struct vc_data *vc) in fbcon_deinit() argument
1180 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_deinit()
1186 idx = con2fb_map[vc->vc_num]; in fbcon_deinit()
1203 if (con_is_visible(vc)) in fbcon_deinit()
1211 vc->vc_font.data = NULL; in fbcon_deinit()
1213 if (vc->vc_hi_font_mask && vc->vc_screenbuf) in fbcon_deinit()
1214 set_vc_hi_font(vc, false); in fbcon_deinit()
1219 if (vc->vc_num == logo_shown) in fbcon_deinit()
1250 static void fbcon_clear(struct vc_data *vc, int sy, int sx, int height, in fbcon_clear() argument
1253 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; in fbcon_clear()
1256 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_clear()
1259 if (fbcon_is_inactive(vc, info)) in fbcon_clear()
1265 if (sy < vc->vc_top && vc->vc_top == logo_lines) { in fbcon_clear()
1266 vc->vc_top = 0; in fbcon_clear()
1273 fbcon_clear_margins(vc, 0); in fbcon_clear()
1281 ops->clear(vc, info, real_y(p, sy), sx, b, width); in fbcon_clear()
1282 ops->clear(vc, info, real_y(p, sy + b), sx, height - b, in fbcon_clear()
1285 ops->clear(vc, info, real_y(p, sy), sx, height, width); in fbcon_clear()
1288 static void fbcon_putcs(struct vc_data *vc, const unsigned short *s, in fbcon_putcs() argument
1291 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; in fbcon_putcs()
1292 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_putcs()
1295 if (!fbcon_is_inactive(vc, info)) in fbcon_putcs()
1296 ops->putcs(vc, info, s, count, real_y(p, ypos), xpos, in fbcon_putcs()
1297 get_color(vc, info, scr_readw(s), 1), in fbcon_putcs()
1298 get_color(vc, info, scr_readw(s), 0)); in fbcon_putcs()
1301 static void fbcon_putc(struct vc_data *vc, int c, int ypos, int xpos) in fbcon_putc() argument
1306 fbcon_putcs(vc, &chr, 1, ypos, xpos); in fbcon_putc()
1309 static void fbcon_clear_margins(struct vc_data *vc, int bottom_only) in fbcon_clear_margins() argument
1311 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; in fbcon_clear_margins()
1314 if (!fbcon_is_inactive(vc, info)) in fbcon_clear_margins()
1315 ops->clear_margins(vc, info, margin_color, bottom_only); in fbcon_clear_margins()
1318 static void fbcon_cursor(struct vc_data *vc, int mode) in fbcon_cursor() argument
1320 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; in fbcon_cursor()
1322 int c = scr_readw((u16 *) vc->vc_pos); in fbcon_cursor()
1324 ops->cur_blink_jiffies = msecs_to_jiffies(vc->vc_cur_blink_ms); in fbcon_cursor()
1326 if (fbcon_is_inactive(vc, info) || vc->vc_deccm != 1) in fbcon_cursor()
1329 if (vc->vc_cursor_type & CUR_SW) in fbcon_cursor()
1339 ops->cursor(vc, info, mode, get_color(vc, info, c, 1), in fbcon_cursor()
1340 get_color(vc, info, c, 0)); in fbcon_cursor()
1351 struct vc_data **default_mode, *vc; in fbcon_set_disp() local
1361 vc = vc_cons[unit].d; in fbcon_set_disp()
1363 if (!vc) in fbcon_set_disp()
1366 default_mode = vc->vc_display_fg; in fbcon_set_disp()
1370 if (!vc->vc_font.data) { in fbcon_set_disp()
1371 vc->vc_font.data = (void *)(p->fontdata = t->fontdata); in fbcon_set_disp()
1372 vc->vc_font.width = (*default_mode)->vc_font.width; in fbcon_set_disp()
1373 vc->vc_font.height = (*default_mode)->vc_font.height; in fbcon_set_disp()
1374 vc->vc_font.charcount = (*default_mode)->vc_font.charcount; in fbcon_set_disp()
1386 vc->vc_can_do_color = (fb_get_color_depth(&info->var, &info->fix)!=1); in fbcon_set_disp()
1387 vc->vc_complement_mask = vc->vc_can_do_color ? 0x7700 : 0x0800; in fbcon_set_disp()
1388 if (vc->vc_font.charcount == 256) { in fbcon_set_disp()
1389 vc->vc_hi_font_mask = 0; in fbcon_set_disp()
1391 vc->vc_hi_font_mask = 0x100; in fbcon_set_disp()
1392 if (vc->vc_can_do_color) in fbcon_set_disp()
1393 vc->vc_complement_mask <<= 1; in fbcon_set_disp()
1398 if (!*vc->vc_uni_pagedir_loc) in fbcon_set_disp()
1399 con_copy_unimap(vc, svc); in fbcon_set_disp()
1403 cols /= vc->vc_font.width; in fbcon_set_disp()
1404 rows /= vc->vc_font.height; in fbcon_set_disp()
1405 vc_resize(vc, cols, rows); in fbcon_set_disp()
1407 if (con_is_visible(vc)) { in fbcon_set_disp()
1408 update_screen(vc); in fbcon_set_disp()
1412 static __inline__ void ywrap_up(struct vc_data *vc, int count) in ywrap_up() argument
1414 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; in ywrap_up()
1416 struct fbcon_display *p = &fb_display[vc->vc_num]; in ywrap_up()
1422 ops->var.yoffset = p->yscroll * vc->vc_font.height; in ywrap_up()
1431 static __inline__ void ywrap_down(struct vc_data *vc, int count) in ywrap_down() argument
1433 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; in ywrap_down()
1435 struct fbcon_display *p = &fb_display[vc->vc_num]; in ywrap_down()
1441 ops->var.yoffset = p->yscroll * vc->vc_font.height; in ywrap_down()
1450 static __inline__ void ypan_up(struct vc_data *vc, int count) in ypan_up() argument
1452 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; in ypan_up()
1453 struct fbcon_display *p = &fb_display[vc->vc_num]; in ypan_up()
1457 if (p->yscroll > p->vrows - vc->vc_rows) { in ypan_up()
1458 ops->bmove(vc, info, p->vrows - vc->vc_rows, in ypan_up()
1459 0, 0, 0, vc->vc_rows, vc->vc_cols); in ypan_up()
1460 p->yscroll -= p->vrows - vc->vc_rows; in ypan_up()
1464 ops->var.yoffset = p->yscroll * vc->vc_font.height; in ypan_up()
1467 fbcon_clear_margins(vc, 1); in ypan_up()
1474 static __inline__ void ypan_up_redraw(struct vc_data *vc, int t, int count) in ypan_up_redraw() argument
1476 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; in ypan_up_redraw()
1478 struct fbcon_display *p = &fb_display[vc->vc_num]; in ypan_up_redraw()
1482 if (p->yscroll > p->vrows - vc->vc_rows) { in ypan_up_redraw()
1483 p->yscroll -= p->vrows - vc->vc_rows; in ypan_up_redraw()
1484 fbcon_redraw_move(vc, p, t + count, vc->vc_rows - count, t); in ypan_up_redraw()
1488 ops->var.yoffset = p->yscroll * vc->vc_font.height; in ypan_up_redraw()
1491 fbcon_clear_margins(vc, 1); in ypan_up_redraw()
1498 static __inline__ void ypan_down(struct vc_data *vc, int count) in ypan_down() argument
1500 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; in ypan_down()
1501 struct fbcon_display *p = &fb_display[vc->vc_num]; in ypan_down()
1506 ops->bmove(vc, info, 0, 0, p->vrows - vc->vc_rows, in ypan_down()
1507 0, vc->vc_rows, vc->vc_cols); in ypan_down()
1508 p->yscroll += p->vrows - vc->vc_rows; in ypan_down()
1512 ops->var.yoffset = p->yscroll * vc->vc_font.height; in ypan_down()
1515 fbcon_clear_margins(vc, 1); in ypan_down()
1522 static __inline__ void ypan_down_redraw(struct vc_data *vc, int t, int count) in ypan_down_redraw() argument
1524 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; in ypan_down_redraw()
1526 struct fbcon_display *p = &fb_display[vc->vc_num]; in ypan_down_redraw()
1531 p->yscroll += p->vrows - vc->vc_rows; in ypan_down_redraw()
1532 fbcon_redraw_move(vc, p, t, vc->vc_rows - count, t + count); in ypan_down_redraw()
1536 ops->var.yoffset = p->yscroll * vc->vc_font.height; in ypan_down_redraw()
1539 fbcon_clear_margins(vc, 1); in ypan_down_redraw()
1546 static void fbcon_redraw_move(struct vc_data *vc, struct fbcon_display *p, in fbcon_redraw_move() argument
1550 (vc->vc_origin + vc->vc_size_row * line); in fbcon_redraw_move()
1564 fbcon_putcs(vc, start, s - start, in fbcon_redraw_move()
1574 fbcon_putcs(vc, start, s - start, dy, x); in fbcon_redraw_move()
1580 static void fbcon_redraw_blit(struct vc_data *vc, struct fb_info *info, in fbcon_redraw_blit() argument
1583 int offset = ycount * vc->vc_cols; in fbcon_redraw_blit()
1585 (vc->vc_origin + vc->vc_size_row * line); in fbcon_redraw_blit()
1600 ops->bmove(vc, info, line + ycount, x, in fbcon_redraw_blit()
1616 ops->bmove(vc, info, line + ycount, x, line, x, 1, in fbcon_redraw_blit()
1624 s -= vc->vc_size_row; in fbcon_redraw_blit()
1625 d -= vc->vc_size_row; in fbcon_redraw_blit()
1630 static void fbcon_redraw(struct vc_data *vc, struct fbcon_display *p, in fbcon_redraw() argument
1634 (vc->vc_origin + vc->vc_size_row * line); in fbcon_redraw()
1649 fbcon_putcs(vc, start, s - start, in fbcon_redraw()
1657 fbcon_putcs(vc, start, s - start, in fbcon_redraw()
1672 fbcon_putcs(vc, start, s - start, line, x); in fbcon_redraw()
1679 s -= vc->vc_size_row; in fbcon_redraw()
1680 d -= vc->vc_size_row; in fbcon_redraw()
1685 static bool fbcon_scroll(struct vc_data *vc, unsigned int t, unsigned int b, in fbcon_scroll() argument
1688 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; in fbcon_scroll()
1689 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_scroll()
1692 if (fbcon_is_inactive(vc, info)) in fbcon_scroll()
1695 fbcon_cursor(vc, CM_ERASE); in fbcon_scroll()
1705 if (count > vc->vc_rows) /* Maximum realistic size */ in fbcon_scroll()
1706 count = vc->vc_rows; in fbcon_scroll()
1711 fbcon_redraw_blit(vc, info, p, t, b - t - count, in fbcon_scroll()
1713 fbcon_clear(vc, b - count, 0, count, vc->vc_cols); in fbcon_scroll()
1714 scr_memsetw((unsigned short *) (vc->vc_origin + in fbcon_scroll()
1715 vc->vc_size_row * in fbcon_scroll()
1717 vc->vc_video_erase_char, in fbcon_scroll()
1718 vc->vc_size_row * count); in fbcon_scroll()
1722 if (b - t - count > 3 * vc->vc_rows >> 2) { in fbcon_scroll()
1724 fbcon_bmove(vc, 0, 0, count, 0, t, in fbcon_scroll()
1725 vc->vc_cols); in fbcon_scroll()
1726 ywrap_up(vc, count); in fbcon_scroll()
1727 if (vc->vc_rows - b > 0) in fbcon_scroll()
1728 fbcon_bmove(vc, b - count, 0, b, 0, in fbcon_scroll()
1729 vc->vc_rows - b, in fbcon_scroll()
1730 vc->vc_cols); in fbcon_scroll()
1732 fbcon_bmove(vc, t + count, 0, t, 0, in fbcon_scroll()
1733 b - t - count, vc->vc_cols); in fbcon_scroll()
1736 fbcon_clear(vc, b - count, 0, count, vc->vc_cols); in fbcon_scroll()
1741 2 * (p->vrows - vc->vc_rows)) in fbcon_scroll()
1742 && ((!scroll_partial && (b - t == vc->vc_rows)) in fbcon_scroll()
1745 3 * vc->vc_rows >> 2)))) { in fbcon_scroll()
1747 fbcon_redraw_move(vc, p, 0, t, count); in fbcon_scroll()
1748 ypan_up_redraw(vc, t, count); in fbcon_scroll()
1749 if (vc->vc_rows - b > 0) in fbcon_scroll()
1750 fbcon_redraw_move(vc, p, b, in fbcon_scroll()
1751 vc->vc_rows - b, b); in fbcon_scroll()
1753 fbcon_redraw_move(vc, p, t + count, b - t - count, t); in fbcon_scroll()
1754 fbcon_clear(vc, b - count, 0, count, vc->vc_cols); in fbcon_scroll()
1759 2 * (p->vrows - vc->vc_rows)) in fbcon_scroll()
1760 && ((!scroll_partial && (b - t == vc->vc_rows)) in fbcon_scroll()
1763 3 * vc->vc_rows >> 2)))) { in fbcon_scroll()
1765 fbcon_bmove(vc, 0, 0, count, 0, t, in fbcon_scroll()
1766 vc->vc_cols); in fbcon_scroll()
1767 ypan_up(vc, count); in fbcon_scroll()
1768 if (vc->vc_rows - b > 0) in fbcon_scroll()
1769 fbcon_bmove(vc, b - count, 0, b, 0, in fbcon_scroll()
1770 vc->vc_rows - b, in fbcon_scroll()
1771 vc->vc_cols); in fbcon_scroll()
1773 fbcon_bmove(vc, t + count, 0, t, 0, in fbcon_scroll()
1774 b - t - count, vc->vc_cols); in fbcon_scroll()
1777 fbcon_clear(vc, b - count, 0, count, vc->vc_cols); in fbcon_scroll()
1782 fbcon_redraw(vc, p, t, b - t - count, in fbcon_scroll()
1783 count * vc->vc_cols); in fbcon_scroll()
1784 fbcon_clear(vc, b - count, 0, count, vc->vc_cols); in fbcon_scroll()
1785 scr_memsetw((unsigned short *) (vc->vc_origin + in fbcon_scroll()
1786 vc->vc_size_row * in fbcon_scroll()
1788 vc->vc_video_erase_char, in fbcon_scroll()
1789 vc->vc_size_row * count); in fbcon_scroll()
1795 if (count > vc->vc_rows) /* Maximum realistic size */ in fbcon_scroll()
1796 count = vc->vc_rows; in fbcon_scroll()
1801 fbcon_redraw_blit(vc, info, p, b - 1, b - t - count, in fbcon_scroll()
1803 fbcon_clear(vc, t, 0, count, vc->vc_cols); in fbcon_scroll()
1804 scr_memsetw((unsigned short *) (vc->vc_origin + in fbcon_scroll()
1805 vc->vc_size_row * in fbcon_scroll()
1807 vc->vc_video_erase_char, in fbcon_scroll()
1808 vc->vc_size_row * count); in fbcon_scroll()
1812 if (b - t - count > 3 * vc->vc_rows >> 2) { in fbcon_scroll()
1813 if (vc->vc_rows - b > 0) in fbcon_scroll()
1814 fbcon_bmove(vc, b, 0, b - count, 0, in fbcon_scroll()
1815 vc->vc_rows - b, in fbcon_scroll()
1816 vc->vc_cols); in fbcon_scroll()
1817 ywrap_down(vc, count); in fbcon_scroll()
1819 fbcon_bmove(vc, count, 0, 0, 0, t, in fbcon_scroll()
1820 vc->vc_cols); in fbcon_scroll()
1822 fbcon_bmove(vc, t, 0, t + count, 0, in fbcon_scroll()
1823 b - t - count, vc->vc_cols); in fbcon_scroll()
1826 fbcon_clear(vc, t, 0, count, vc->vc_cols); in fbcon_scroll()
1830 if ((count - p->yscroll <= p->vrows - vc->vc_rows) in fbcon_scroll()
1831 && ((!scroll_partial && (b - t == vc->vc_rows)) in fbcon_scroll()
1834 3 * vc->vc_rows >> 2)))) { in fbcon_scroll()
1835 if (vc->vc_rows - b > 0) in fbcon_scroll()
1836 fbcon_bmove(vc, b, 0, b - count, 0, in fbcon_scroll()
1837 vc->vc_rows - b, in fbcon_scroll()
1838 vc->vc_cols); in fbcon_scroll()
1839 ypan_down(vc, count); in fbcon_scroll()
1841 fbcon_bmove(vc, count, 0, 0, 0, t, in fbcon_scroll()
1842 vc->vc_cols); in fbcon_scroll()
1844 fbcon_bmove(vc, t, 0, t + count, 0, in fbcon_scroll()
1845 b - t - count, vc->vc_cols); in fbcon_scroll()
1848 fbcon_clear(vc, t, 0, count, vc->vc_cols); in fbcon_scroll()
1852 if ((count - p->yscroll <= p->vrows - vc->vc_rows) in fbcon_scroll()
1853 && ((!scroll_partial && (b - t == vc->vc_rows)) in fbcon_scroll()
1856 3 * vc->vc_rows >> 2)))) { in fbcon_scroll()
1857 if (vc->vc_rows - b > 0) in fbcon_scroll()
1858 fbcon_redraw_move(vc, p, b, vc->vc_rows - b, in fbcon_scroll()
1860 ypan_down_redraw(vc, t, count); in fbcon_scroll()
1862 fbcon_redraw_move(vc, p, count, t, 0); in fbcon_scroll()
1864 fbcon_redraw_move(vc, p, t, b - t - count, t + count); in fbcon_scroll()
1865 fbcon_clear(vc, t, 0, count, vc->vc_cols); in fbcon_scroll()
1870 fbcon_redraw(vc, p, b - 1, b - t - count, in fbcon_scroll()
1871 -count * vc->vc_cols); in fbcon_scroll()
1872 fbcon_clear(vc, t, 0, count, vc->vc_cols); in fbcon_scroll()
1873 scr_memsetw((unsigned short *) (vc->vc_origin + in fbcon_scroll()
1874 vc->vc_size_row * in fbcon_scroll()
1876 vc->vc_video_erase_char, in fbcon_scroll()
1877 vc->vc_size_row * count); in fbcon_scroll()
1885 static void fbcon_bmove(struct vc_data *vc, int sy, int sx, int dy, int dx, in fbcon_bmove() argument
1888 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; in fbcon_bmove()
1889 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_bmove()
1891 if (fbcon_is_inactive(vc, info)) in fbcon_bmove()
1904 fbcon_bmove_rec(vc, p, sy, sx, dy, dx, height, width, in fbcon_bmove()
1908 static void fbcon_bmove_rec(struct vc_data *vc, struct fbcon_display *p, int sy, int sx, in fbcon_bmove_rec() argument
1911 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; in fbcon_bmove_rec()
1918 fbcon_bmove_rec(vc, p, sy, sx, dy, dx, b, width, in fbcon_bmove_rec()
1920 fbcon_bmove_rec(vc, p, sy + b, sx, dy + b, dx, in fbcon_bmove_rec()
1923 fbcon_bmove_rec(vc, p, sy + b, sx, dy + b, dx, in fbcon_bmove_rec()
1925 fbcon_bmove_rec(vc, p, sy, sx, dy, dx, b, width, in fbcon_bmove_rec()
1934 fbcon_bmove_rec(vc, p, sy, sx, dy, dx, b, width, in fbcon_bmove_rec()
1936 fbcon_bmove_rec(vc, p, sy + b, sx, dy + b, dx, in fbcon_bmove_rec()
1939 fbcon_bmove_rec(vc, p, sy + b, sx, dy + b, dx, in fbcon_bmove_rec()
1941 fbcon_bmove_rec(vc, p, sy, sx, dy, dx, b, width, in fbcon_bmove_rec()
1946 ops->bmove(vc, info, real_y(p, sy), sx, real_y(p, dy), dx, in fbcon_bmove_rec()
1952 struct vc_data *vc) in updatescrollmode() argument
1955 int fh = vc->vc_font.height; in updatescrollmode()
1961 if (yres > (fh * (vc->vc_rows + 1))) in updatescrollmode()
1962 p->vrows -= (yres - (fh * vc->vc_rows)) / fh; in updatescrollmode()
1970 static int fbcon_resize(struct vc_data *vc, unsigned int width, in fbcon_resize() argument
1973 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; in fbcon_resize()
1975 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_resize()
1979 if (p->userfont && FNTSIZE(vc->vc_font.data)) { in fbcon_resize()
1981 int pitch = PITCH(vc->vc_font.width); in fbcon_resize()
1992 size = CALC_FONTSZ(vc->vc_font.height, pitch, vc->vc_font.charcount); in fbcon_resize()
1993 if (size > FNTSIZE(vc->vc_font.data)) in fbcon_resize()
1999 virt_fw = FBCON_SWAP(ops->rotate, vc->vc_font.width, in fbcon_resize()
2000 vc->vc_font.height); in fbcon_resize()
2001 virt_fh = FBCON_SWAP(ops->rotate, vc->vc_font.height, in fbcon_resize()
2002 vc->vc_font.width); in fbcon_resize()
2022 if (con_is_visible(vc) && vc->vc_mode == KD_TEXT) { in fbcon_resize()
2030 updatescrollmode(p, info, vc); in fbcon_resize()
2034 static int fbcon_switch(struct vc_data *vc) in fbcon_switch() argument
2038 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_switch()
2042 info = registered_fb[con2fb_map[vc->vc_num]]; in fbcon_switch()
2069 o->currcon = vc->vc_num; in fbcon_switch()
2100 if (fbcon_is_inactive(vc, info) || in fbcon_switch()
2106 set_blitting_type(vc, info); in fbcon_switch()
2109 if (ops->rotate_font && ops->rotate_font(info, vc)) { in fbcon_switch()
2111 set_blitting_type(vc, info); in fbcon_switch()
2114 vc->vc_can_do_color = (fb_get_color_depth(&info->var, &info->fix)!=1); in fbcon_switch()
2115 vc->vc_complement_mask = vc->vc_can_do_color ? 0x7700 : 0x0800; in fbcon_switch()
2117 if (vc->vc_font.charcount > 256) in fbcon_switch()
2118 vc->vc_complement_mask <<= 1; in fbcon_switch()
2120 updatescrollmode(p, info, vc); in fbcon_switch()
2124 scrollback_phys_max = p->vrows - vc->vc_rows; in fbcon_switch()
2128 scrollback_phys_max = p->vrows - 2 * vc->vc_rows; in fbcon_switch()
2140 if (!fbcon_is_inactive(vc, info)) { in fbcon_switch()
2145 fbcon_set_palette(vc, color_table); in fbcon_switch()
2146 fbcon_clear_margins(vc, 0); in fbcon_switch()
2153 update_region(vc, in fbcon_switch()
2154 vc->vc_origin + vc->vc_size_row * vc->vc_top, in fbcon_switch()
2155 vc->vc_size_row * (vc->vc_bottom - in fbcon_switch()
2156 vc->vc_top) / 2); in fbcon_switch()
2162 static void fbcon_generic_blank(struct vc_data *vc, struct fb_info *info, in fbcon_generic_blank() argument
2166 unsigned short charmask = vc->vc_hi_font_mask ? in fbcon_generic_blank()
2170 oldc = vc->vc_video_erase_char; in fbcon_generic_blank()
2171 vc->vc_video_erase_char &= charmask; in fbcon_generic_blank()
2172 fbcon_clear(vc, 0, 0, vc->vc_rows, vc->vc_cols); in fbcon_generic_blank()
2173 vc->vc_video_erase_char = oldc; in fbcon_generic_blank()
2177 static int fbcon_blank(struct vc_data *vc, int blank, int mode_switch) in fbcon_blank() argument
2179 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; in fbcon_blank()
2196 if (!fbcon_is_inactive(vc, info)) { in fbcon_blank()
2199 fbcon_cursor(vc, blank ? CM_ERASE : CM_DRAW); in fbcon_blank()
2203 fbcon_generic_blank(vc, info, blank); in fbcon_blank()
2207 update_screen(vc); in fbcon_blank()
2210 if (mode_switch || fbcon_is_inactive(vc, info) || in fbcon_blank()
2219 static int fbcon_debug_enter(struct vc_data *vc) in fbcon_debug_enter() argument
2221 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; in fbcon_debug_enter()
2228 fbcon_set_palette(vc, color_table); in fbcon_debug_enter()
2232 static int fbcon_debug_leave(struct vc_data *vc) in fbcon_debug_leave() argument
2234 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; in fbcon_debug_leave()
2243 static int fbcon_get_font(struct vc_data *vc, struct console_font *font) in fbcon_get_font() argument
2245 u8 *fontdata = vc->vc_font.data; in fbcon_get_font()
2249 font->width = vc->vc_font.width; in fbcon_get_font()
2250 font->height = vc->vc_font.height; in fbcon_get_font()
2251 font->charcount = vc->vc_hi_font_mask ? 512 : 256; in fbcon_get_font()
2256 j = vc->vc_font.height; in fbcon_get_font()
2267 j = vc->vc_font.height * 2; in fbcon_get_font()
2278 if (font->charcount * (vc->vc_font.height * sizeof(u32)) > FNTSIZE(fontdata)) in fbcon_get_font()
2282 for (j = 0; j < vc->vc_font.height; j++) { in fbcon_get_font()
2292 j = vc->vc_font.height * 4; in fbcon_get_font()
2307 static void set_vc_hi_font(struct vc_data *vc, bool set) in set_vc_hi_font() argument
2310 vc->vc_hi_font_mask = 0; in set_vc_hi_font()
2311 if (vc->vc_can_do_color) { in set_vc_hi_font()
2312 vc->vc_complement_mask >>= 1; in set_vc_hi_font()
2313 vc->vc_s_complement_mask >>= 1; in set_vc_hi_font()
2317 if (vc->vc_can_do_color) { in set_vc_hi_font()
2319 (unsigned short *) vc->vc_origin; in set_vc_hi_font()
2320 int count = vc->vc_screenbuf_size / 2; in set_vc_hi_font()
2327 c = vc->vc_video_erase_char; in set_vc_hi_font()
2328 vc->vc_video_erase_char = in set_vc_hi_font()
2330 vc->vc_attr >>= 1; in set_vc_hi_font()
2333 vc->vc_hi_font_mask = 0x100; in set_vc_hi_font()
2334 if (vc->vc_can_do_color) { in set_vc_hi_font()
2335 vc->vc_complement_mask <<= 1; in set_vc_hi_font()
2336 vc->vc_s_complement_mask <<= 1; in set_vc_hi_font()
2342 (unsigned short *) vc->vc_origin; in set_vc_hi_font()
2343 int count = vc->vc_screenbuf_size / 2; in set_vc_hi_font()
2348 if (vc->vc_can_do_color) in set_vc_hi_font()
2356 c = vc->vc_video_erase_char; in set_vc_hi_font()
2357 if (vc->vc_can_do_color) { in set_vc_hi_font()
2358 vc->vc_video_erase_char = in set_vc_hi_font()
2360 vc->vc_attr <<= 1; in set_vc_hi_font()
2362 vc->vc_video_erase_char = c & ~0x100; in set_vc_hi_font()
2367 static int fbcon_do_set_font(struct vc_data *vc, int w, int h, int charcount, in fbcon_do_set_font() argument
2370 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; in fbcon_do_set_font()
2372 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_do_set_font()
2376 resize = (w != vc->vc_font.width) || (h != vc->vc_font.height); in fbcon_do_set_font()
2378 old_data = vc->vc_font.data; in fbcon_do_set_font()
2379 vc->vc_font.data = (void *)(p->fontdata = data); in fbcon_do_set_font()
2382 vc->vc_font.width = w; in fbcon_do_set_font()
2383 vc->vc_font.height = h; in fbcon_do_set_font()
2384 vc->vc_font.charcount = charcount; in fbcon_do_set_font()
2385 if (vc->vc_hi_font_mask && charcount == 256) in fbcon_do_set_font()
2386 set_vc_hi_font(vc, false); in fbcon_do_set_font()
2387 else if (!vc->vc_hi_font_mask && charcount == 512) in fbcon_do_set_font()
2388 set_vc_hi_font(vc, true); in fbcon_do_set_font()
2397 vc_resize(vc, cols, rows); in fbcon_do_set_font()
2398 } else if (con_is_visible(vc) in fbcon_do_set_font()
2399 && vc->vc_mode == KD_TEXT) { in fbcon_do_set_font()
2400 fbcon_clear_margins(vc, 0); in fbcon_do_set_font()
2401 update_screen(vc); in fbcon_do_set_font()
2421 static int fbcon_set_font(struct vc_data *vc, struct console_font *font, in fbcon_set_font() argument
2424 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; in fbcon_set_font()
2483 return fbcon_do_set_font(vc, font->width, font->height, charcount, new_data, 1); in fbcon_set_font()
2486 static int fbcon_set_def_font(struct vc_data *vc, struct console_font *font, char *name) in fbcon_set_def_font() argument
2488 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; in fbcon_set_def_font()
2499 return fbcon_do_set_font(vc, f->width, f->height, f->charcount, f->data, 0); in fbcon_set_def_font()
2510 static void fbcon_set_palette(struct vc_data *vc, const unsigned char *table) in fbcon_set_palette() argument
2512 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; in fbcon_set_palette()
2516 if (fbcon_is_inactive(vc, info)) in fbcon_set_palette()
2519 if (!con_is_visible(vc)) in fbcon_set_palette()
2526 val = vc->vc_palette[j++]; in fbcon_set_palette()
2528 val = vc->vc_palette[j++]; in fbcon_set_palette()
2530 val = vc->vc_palette[j++]; in fbcon_set_palette()
2545 static u16 *fbcon_screen_pos(const struct vc_data *vc, int offset) in fbcon_screen_pos() argument
2547 return (u16 *) (vc->vc_origin + offset); in fbcon_screen_pos()
2550 static unsigned long fbcon_getxy(struct vc_data *vc, unsigned long pos, in fbcon_getxy() argument
2556 if (pos >= vc->vc_origin && pos < vc->vc_scr_end) { in fbcon_getxy()
2557 unsigned long offset = (pos - vc->vc_origin) / 2; in fbcon_getxy()
2559 x = offset % vc->vc_cols; in fbcon_getxy()
2560 y = offset / vc->vc_cols; in fbcon_getxy()
2561 ret = pos + (vc->vc_cols - x) * 2; in fbcon_getxy()
2565 ret = vc->vc_origin; in fbcon_getxy()
2576 static void fbcon_invert_region(struct vc_data *vc, u16 * p, int cnt) in fbcon_invert_region() argument
2580 if (!vc->vc_can_do_color) in fbcon_invert_region()
2582 else if (vc->vc_hi_font_mask == 0x100) in fbcon_invert_region()
2594 struct vc_data *vc = NULL; in fbcon_suspended() local
2599 vc = vc_cons[ops->currcon].d; in fbcon_suspended()
2602 fbcon_cursor(vc, CM_ERASE); in fbcon_suspended()
2607 struct vc_data *vc; in fbcon_resumed() local
2612 vc = vc_cons[ops->currcon].d; in fbcon_resumed()
2614 update_screen(vc); in fbcon_resumed()
2620 struct vc_data *vc; in fbcon_modechanged() local
2626 vc = vc_cons[ops->currcon].d; in fbcon_modechanged()
2627 if (vc->vc_mode != KD_TEXT || in fbcon_modechanged()
2631 p = &fb_display[vc->vc_num]; in fbcon_modechanged()
2632 set_blitting_type(vc, info); in fbcon_modechanged()
2634 if (con_is_visible(vc)) { in fbcon_modechanged()
2638 cols /= vc->vc_font.width; in fbcon_modechanged()
2639 rows /= vc->vc_font.height; in fbcon_modechanged()
2640 vc_resize(vc, cols, rows); in fbcon_modechanged()
2641 updatescrollmode(p, info, vc); in fbcon_modechanged()
2645 if (!fbcon_is_inactive(vc, info)) { in fbcon_modechanged()
2650 fbcon_set_palette(vc, color_table); in fbcon_modechanged()
2651 update_screen(vc); in fbcon_modechanged()
2658 struct vc_data *vc; in fbcon_set_all_vcs() local
2666 vc = vc_cons[i].d; in fbcon_set_all_vcs()
2667 if (!vc || vc->vc_mode != KD_TEXT || in fbcon_set_all_vcs()
2671 if (con_is_visible(vc)) { in fbcon_set_all_vcs()
2676 p = &fb_display[vc->vc_num]; in fbcon_set_all_vcs()
2677 set_blitting_type(vc, info); in fbcon_set_all_vcs()
2681 cols /= vc->vc_font.width; in fbcon_set_all_vcs()
2682 rows /= vc->vc_font.height; in fbcon_set_all_vcs()
2683 vc_resize(vc, cols, rows); in fbcon_set_all_vcs()
2924 struct vc_data *vc; in fbcon_fb_blanked() local
2929 vc = vc_cons[ops->currcon].d; in fbcon_fb_blanked()
2930 if (vc->vc_mode != KD_TEXT || in fbcon_fb_blanked()
2934 if (con_is_visible(vc)) { in fbcon_fb_blanked()
2946 struct vc_data *vc; in fbcon_new_modelist() local
2955 vc = vc_cons[i].d; in fbcon_new_modelist()
2960 fbcon_set_disp(info, &var, vc->vc_num); in fbcon_new_modelist()
2967 struct vc_data *vc; in fbcon_get_requirement() local
2973 vc = vc_cons[i].d; in fbcon_get_requirement()
2974 if (vc && vc->vc_mode == KD_TEXT && in fbcon_get_requirement()
2976 caps->x |= 1 << (vc->vc_font.width - 1); in fbcon_get_requirement()
2977 caps->y |= 1 << (vc->vc_font.height - 1); in fbcon_get_requirement()
2978 charcnt = vc->vc_font.charcount; in fbcon_get_requirement()
2984 vc = vc_cons[fg_console].d; in fbcon_get_requirement()
2986 if (vc && vc->vc_mode == KD_TEXT && in fbcon_get_requirement()
2988 caps->x = 1 << (vc->vc_font.width - 1); in fbcon_get_requirement()
2989 caps->y = 1 << (vc->vc_font.height - 1); in fbcon_get_requirement()
2990 caps->len = vc->vc_font.charcount; in fbcon_get_requirement()