Lines Matching refs:vc

164 #define advance_row(p, delta) (unsigned short *)((unsigned long)(p) + (delta) * vc->vc_size_row)
175 static void fbcon_init(struct vc_data *vc, int init);
176 static void fbcon_deinit(struct vc_data *vc);
177 static void fbcon_clear(struct vc_data *vc, int sy, int sx, int height,
179 static void fbcon_putc(struct vc_data *vc, int c, int ypos, int xpos);
180 static void fbcon_putcs(struct vc_data *vc, const unsigned short *s,
182 static void fbcon_clear_margins(struct vc_data *vc, int bottom_only);
183 static void fbcon_cursor(struct vc_data *vc, int mode);
184 static void fbcon_bmove(struct vc_data *vc, int sy, int sx, int dy, int dx,
186 static int fbcon_switch(struct vc_data *vc);
187 static int fbcon_blank(struct vc_data *vc, int blank, int mode_switch);
188 static void fbcon_set_palette(struct vc_data *vc, const unsigned char *table);
193 static __inline__ void ywrap_up(struct vc_data *vc, int count);
194 static __inline__ void ywrap_down(struct vc_data *vc, int count);
195 static __inline__ void ypan_up(struct vc_data *vc, int count);
196 static __inline__ void ypan_down(struct vc_data *vc, int count);
197 static void fbcon_bmove_rec(struct vc_data *vc, struct fbcon_display *p, int sy, int sx,
201 static void fbcon_redraw_move(struct vc_data *vc, struct fbcon_display *p,
246 struct vc_data *vc; in fbcon_rotate_all() local
254 vc = vc_cons[i].d; in fbcon_rotate_all()
255 if (!vc || vc->vc_mode != KD_TEXT || in fbcon_rotate_all()
259 p = &fb_display[vc->vc_num]; in fbcon_rotate_all()
291 static inline int fbcon_is_inactive(struct vc_data *vc, struct fb_info *info) in fbcon_is_inactive() argument
296 vc->vc_mode != KD_TEXT || ops->graphics); in fbcon_is_inactive()
299 static int get_color(struct vc_data *vc, struct fb_info *info, in get_color() argument
306 unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff; in get_color()
308 c = vc->vc_video_erase_char & charmask; in get_color()
312 color = (is_fg) ? attr_fgcol((vc->vc_hi_font_mask) ? 9 : 8, c) in get_color()
313 : attr_bgcol((vc->vc_hi_font_mask) ? 13 : 12, c); in get_color()
370 struct vc_data *vc = NULL; in fb_flashcursor() local
383 vc = vc_cons[ops->currcon].d; in fb_flashcursor()
385 if (!vc || !con_is_visible(vc) || in fb_flashcursor()
386 registered_fb[con2fb_map[vc->vc_num]] != info || in fb_flashcursor()
387 vc->vc_deccm != 1) { in fb_flashcursor()
392 c = scr_readw((u16 *) vc->vc_pos); in fb_flashcursor()
395 ops->cursor(vc, info, mode, get_color(vc, info, c, 1), in fb_flashcursor()
396 get_color(vc, info, c, 0)); in fb_flashcursor()
575 static void fbcon_prepare_logo(struct vc_data *vc, struct fb_info *info, in fbcon_prepare_logo() argument
581 static void fbcon_prepare_logo(struct vc_data *vc, struct fb_info *info, in fbcon_prepare_logo() argument
586 int cnt, erase = vc->vc_video_erase_char, step; in fbcon_prepare_logo()
602 logo_lines = DIV_ROUND_UP(logo_height, vc->vc_font.height); in fbcon_prepare_logo()
603 q = (unsigned short *) (vc->vc_origin + in fbcon_prepare_logo()
604 vc->vc_size_row * rows); in fbcon_prepare_logo()
607 if (scr_readw(r) != vc->vc_video_erase_char) in fbcon_prepare_logo()
625 scr_memcpyw(r + step, r, vc->vc_size_row); in fbcon_prepare_logo()
630 if (vc->state.y + logo_lines >= rows) in fbcon_prepare_logo()
631 lines = rows - vc->state.y - 1; in fbcon_prepare_logo()
634 vc->state.y += lines; in fbcon_prepare_logo()
635 vc->vc_pos += lines * vc->vc_size_row; in fbcon_prepare_logo()
638 scr_memsetw((unsigned short *) vc->vc_origin, in fbcon_prepare_logo()
640 vc->vc_size_row * logo_lines); in fbcon_prepare_logo()
642 if (con_is_visible(vc) && vc->vc_mode == KD_TEXT) { in fbcon_prepare_logo()
643 fbcon_clear_margins(vc, 0); in fbcon_prepare_logo()
644 update_screen(vc); in fbcon_prepare_logo()
648 q = (unsigned short *) (vc->vc_origin + in fbcon_prepare_logo()
649 vc->vc_size_row * in fbcon_prepare_logo()
652 vc->state.y += logo_lines; in fbcon_prepare_logo()
653 vc->vc_pos += logo_lines * vc->vc_size_row; in fbcon_prepare_logo()
660 if (logo_lines > vc->vc_bottom) { in fbcon_prepare_logo()
666 vc->vc_top = logo_lines; in fbcon_prepare_logo()
672 static void set_blitting_type(struct vc_data *vc, struct fb_info *info) in set_blitting_type() argument
676 ops->p = &fb_display[vc->vc_num]; in set_blitting_type()
679 fbcon_set_tileops(vc, info); in set_blitting_type()
697 static void set_blitting_type(struct vc_data *vc, struct fb_info *info) in set_blitting_type() argument
702 ops->p = &fb_display[vc->vc_num]; in set_blitting_type()
715 static int con2fb_acquire_newinfo(struct vc_data *vc, struct fb_info *info, in con2fb_acquire_newinfo() argument
739 if (vc) in con2fb_acquire_newinfo()
740 set_blitting_type(vc, info); in con2fb_acquire_newinfo()
751 static int con2fb_release_oldinfo(struct vc_data *vc, struct fb_info *oldinfo, in con2fb_release_oldinfo() argument
797 static void con2fb_init_display(struct vc_data *vc, struct fb_info *info, in con2fb_init_display() argument
844 struct vc_data *vc = vc_cons[unit].d; in set_con2fb_map() local
870 err = con2fb_acquire_newinfo(vc, info, unit, oldidx); in set_con2fb_map()
877 err = con2fb_release_oldinfo(vc, oldinfo, info, unit, oldidx, in set_con2fb_map()
887 con2fb_init_display(vc, info, unit, show_logo); in set_con2fb_map()
947 struct vc_data *vc = vc_cons[fg_console].d; in fbcon_startup() local
995 set_blitting_type(vc, info); in fbcon_startup()
998 if (!p->fontdata && !vc->vc_font.data) { in fbcon_startup()
1004 vc->vc_font.width = font->width; in fbcon_startup()
1005 vc->vc_font.height = font->height; in fbcon_startup()
1006 vc->vc_font.data = (void *)(p->fontdata = font->data); in fbcon_startup()
1007 vc->vc_font.charcount = 256; /* FIXME Need to support more fonts */ in fbcon_startup()
1009 p->fontdata = vc->vc_font.data; in fbcon_startup()
1014 cols /= vc->vc_font.width; in fbcon_startup()
1015 rows /= vc->vc_font.height; in fbcon_startup()
1016 vc_resize(vc, cols, rows); in fbcon_startup()
1028 static void fbcon_init(struct vc_data *vc, int init) in fbcon_init() argument
1032 struct vc_data **default_mode = vc->vc_display_fg; in fbcon_init()
1034 struct fbcon_display *t, *p = &fb_display[vc->vc_num]; in fbcon_init()
1041 if (con2fb_map[vc->vc_num] == -1) in fbcon_init()
1042 con2fb_map[vc->vc_num] = info_idx; in fbcon_init()
1044 info = registered_fb[con2fb_map[vc->vc_num]]; in fbcon_init()
1050 if (vc != svc || logo_shown == FBCON_LOGO_DONTSHOW || in fbcon_init()
1058 con2fb_acquire_newinfo(vc, info, vc->vc_num, -1); in fbcon_init()
1067 vc->vc_font.data = (void *)(p->fontdata = in fbcon_init()
1069 vc->vc_font.width = fvc->vc_font.width; in fbcon_init()
1070 vc->vc_font.height = fvc->vc_font.height; in fbcon_init()
1083 vc->vc_font.width = font->width; in fbcon_init()
1084 vc->vc_font.height = font->height; in fbcon_init()
1085 vc->vc_font.data = (void *)(p->fontdata = font->data); in fbcon_init()
1086 vc->vc_font.charcount = 256; /* FIXME Need to in fbcon_init()
1094 vc->vc_can_do_color = (fb_get_color_depth(&info->var, &info->fix)!=1); in fbcon_init()
1095 vc->vc_complement_mask = vc->vc_can_do_color ? 0x7700 : 0x0800; in fbcon_init()
1097 vc->vc_hi_font_mask = 0; in fbcon_init()
1099 vc->vc_hi_font_mask = 0x100; in fbcon_init()
1100 if (vc->vc_can_do_color) in fbcon_init()
1101 vc->vc_complement_mask <<= 1; in fbcon_init()
1106 if (!*vc->vc_uni_pagedir_loc) in fbcon_init()
1107 con_copy_unimap(vc, svc); in fbcon_init()
1110 ops->cur_blink_jiffies = msecs_to_jiffies(vc->vc_cur_blink_ms); in fbcon_init()
1118 set_blitting_type(vc, info); in fbcon_init()
1120 cols = vc->vc_cols; in fbcon_init()
1121 rows = vc->vc_rows; in fbcon_init()
1124 new_cols /= vc->vc_font.width; in fbcon_init()
1125 new_rows /= vc->vc_font.height; in fbcon_init()
1134 if (con_is_visible(vc) && vc->vc_mode == KD_TEXT) { in fbcon_init()
1162 vc->vc_cols = new_cols; in fbcon_init()
1163 vc->vc_rows = new_rows; in fbcon_init()
1165 vc_resize(vc, new_cols, new_rows); in fbcon_init()
1168 fbcon_prepare_logo(vc, info, cols, rows, new_cols, new_rows); in fbcon_init()
1170 if (ops->rotate_font && ops->rotate_font(info, vc)) { in fbcon_init()
1172 set_blitting_type(vc, info); in fbcon_init()
1186 static void set_vc_hi_font(struct vc_data *vc, bool set);
1188 static void fbcon_deinit(struct vc_data *vc) in fbcon_deinit() argument
1190 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_deinit()
1196 idx = con2fb_map[vc->vc_num]; in fbcon_deinit()
1213 if (con_is_visible(vc)) in fbcon_deinit()
1221 vc->vc_font.data = NULL; in fbcon_deinit()
1223 if (vc->vc_hi_font_mask && vc->vc_screenbuf) in fbcon_deinit()
1224 set_vc_hi_font(vc, false); in fbcon_deinit()
1229 if (vc->vc_num == logo_shown) in fbcon_deinit()
1260 static void fbcon_clear(struct vc_data *vc, int sy, int sx, int height, in fbcon_clear() argument
1263 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; in fbcon_clear()
1266 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_clear()
1269 if (fbcon_is_inactive(vc, info)) in fbcon_clear()
1275 if (sy < vc->vc_top && vc->vc_top == logo_lines) { in fbcon_clear()
1276 vc->vc_top = 0; in fbcon_clear()
1283 fbcon_clear_margins(vc, 0); in fbcon_clear()
1291 ops->clear(vc, info, real_y(p, sy), sx, b, width); in fbcon_clear()
1292 ops->clear(vc, info, real_y(p, sy + b), sx, height - b, in fbcon_clear()
1295 ops->clear(vc, info, real_y(p, sy), sx, height, width); in fbcon_clear()
1298 static void fbcon_putcs(struct vc_data *vc, const unsigned short *s, in fbcon_putcs() argument
1301 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; in fbcon_putcs()
1302 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_putcs()
1305 if (!fbcon_is_inactive(vc, info)) in fbcon_putcs()
1306 ops->putcs(vc, info, s, count, real_y(p, ypos), xpos, in fbcon_putcs()
1307 get_color(vc, info, scr_readw(s), 1), in fbcon_putcs()
1308 get_color(vc, info, scr_readw(s), 0)); in fbcon_putcs()
1311 static void fbcon_putc(struct vc_data *vc, int c, int ypos, int xpos) in fbcon_putc() argument
1316 fbcon_putcs(vc, &chr, 1, ypos, xpos); in fbcon_putc()
1319 static void fbcon_clear_margins(struct vc_data *vc, int bottom_only) in fbcon_clear_margins() argument
1321 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; in fbcon_clear_margins()
1324 if (!fbcon_is_inactive(vc, info)) in fbcon_clear_margins()
1325 ops->clear_margins(vc, info, margin_color, bottom_only); in fbcon_clear_margins()
1328 static void fbcon_cursor(struct vc_data *vc, int mode) in fbcon_cursor() argument
1330 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; in fbcon_cursor()
1332 int c = scr_readw((u16 *) vc->vc_pos); in fbcon_cursor()
1334 ops->cur_blink_jiffies = msecs_to_jiffies(vc->vc_cur_blink_ms); in fbcon_cursor()
1336 if (fbcon_is_inactive(vc, info) || vc->vc_deccm != 1) in fbcon_cursor()
1339 if (vc->vc_cursor_type & CUR_SW) in fbcon_cursor()
1346 ops->cursor(vc, info, mode, get_color(vc, info, c, 1), in fbcon_cursor()
1347 get_color(vc, info, c, 0)); in fbcon_cursor()
1358 struct vc_data **default_mode, *vc; in fbcon_set_disp() local
1368 vc = vc_cons[unit].d; in fbcon_set_disp()
1370 if (!vc) in fbcon_set_disp()
1373 default_mode = vc->vc_display_fg; in fbcon_set_disp()
1377 if (!vc->vc_font.data) { in fbcon_set_disp()
1378 vc->vc_font.data = (void *)(p->fontdata = t->fontdata); in fbcon_set_disp()
1379 vc->vc_font.width = (*default_mode)->vc_font.width; in fbcon_set_disp()
1380 vc->vc_font.height = (*default_mode)->vc_font.height; in fbcon_set_disp()
1394 vc->vc_can_do_color = (fb_get_color_depth(&info->var, &info->fix)!=1); in fbcon_set_disp()
1395 vc->vc_complement_mask = vc->vc_can_do_color ? 0x7700 : 0x0800; in fbcon_set_disp()
1397 vc->vc_hi_font_mask = 0; in fbcon_set_disp()
1399 vc->vc_hi_font_mask = 0x100; in fbcon_set_disp()
1400 if (vc->vc_can_do_color) in fbcon_set_disp()
1401 vc->vc_complement_mask <<= 1; in fbcon_set_disp()
1406 if (!*vc->vc_uni_pagedir_loc) in fbcon_set_disp()
1407 con_copy_unimap(vc, svc); in fbcon_set_disp()
1411 cols /= vc->vc_font.width; in fbcon_set_disp()
1412 rows /= vc->vc_font.height; in fbcon_set_disp()
1413 vc_resize(vc, cols, rows); in fbcon_set_disp()
1415 if (con_is_visible(vc)) { in fbcon_set_disp()
1416 update_screen(vc); in fbcon_set_disp()
1420 static __inline__ void ywrap_up(struct vc_data *vc, int count) in ywrap_up() argument
1422 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; in ywrap_up()
1424 struct fbcon_display *p = &fb_display[vc->vc_num]; in ywrap_up()
1430 ops->var.yoffset = p->yscroll * vc->vc_font.height; in ywrap_up()
1439 static __inline__ void ywrap_down(struct vc_data *vc, int count) in ywrap_down() argument
1441 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; in ywrap_down()
1443 struct fbcon_display *p = &fb_display[vc->vc_num]; in ywrap_down()
1449 ops->var.yoffset = p->yscroll * vc->vc_font.height; in ywrap_down()
1458 static __inline__ void ypan_up(struct vc_data *vc, int count) in ypan_up() argument
1460 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; in ypan_up()
1461 struct fbcon_display *p = &fb_display[vc->vc_num]; in ypan_up()
1465 if (p->yscroll > p->vrows - vc->vc_rows) { in ypan_up()
1466 ops->bmove(vc, info, p->vrows - vc->vc_rows, in ypan_up()
1467 0, 0, 0, vc->vc_rows, vc->vc_cols); in ypan_up()
1468 p->yscroll -= p->vrows - vc->vc_rows; in ypan_up()
1472 ops->var.yoffset = p->yscroll * vc->vc_font.height; in ypan_up()
1475 fbcon_clear_margins(vc, 1); in ypan_up()
1482 static __inline__ void ypan_up_redraw(struct vc_data *vc, int t, int count) in ypan_up_redraw() argument
1484 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; in ypan_up_redraw()
1486 struct fbcon_display *p = &fb_display[vc->vc_num]; in ypan_up_redraw()
1490 if (p->yscroll > p->vrows - vc->vc_rows) { in ypan_up_redraw()
1491 p->yscroll -= p->vrows - vc->vc_rows; in ypan_up_redraw()
1492 fbcon_redraw_move(vc, p, t + count, vc->vc_rows - count, t); in ypan_up_redraw()
1496 ops->var.yoffset = p->yscroll * vc->vc_font.height; in ypan_up_redraw()
1499 fbcon_clear_margins(vc, 1); in ypan_up_redraw()
1506 static __inline__ void ypan_down(struct vc_data *vc, int count) in ypan_down() argument
1508 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; in ypan_down()
1509 struct fbcon_display *p = &fb_display[vc->vc_num]; in ypan_down()
1514 ops->bmove(vc, info, 0, 0, p->vrows - vc->vc_rows, in ypan_down()
1515 0, vc->vc_rows, vc->vc_cols); in ypan_down()
1516 p->yscroll += p->vrows - vc->vc_rows; in ypan_down()
1520 ops->var.yoffset = p->yscroll * vc->vc_font.height; in ypan_down()
1523 fbcon_clear_margins(vc, 1); in ypan_down()
1530 static __inline__ void ypan_down_redraw(struct vc_data *vc, int t, int count) in ypan_down_redraw() argument
1532 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; in ypan_down_redraw()
1534 struct fbcon_display *p = &fb_display[vc->vc_num]; in ypan_down_redraw()
1539 p->yscroll += p->vrows - vc->vc_rows; in ypan_down_redraw()
1540 fbcon_redraw_move(vc, p, t, vc->vc_rows - count, t + count); in ypan_down_redraw()
1544 ops->var.yoffset = p->yscroll * vc->vc_font.height; in ypan_down_redraw()
1547 fbcon_clear_margins(vc, 1); in ypan_down_redraw()
1554 static void fbcon_redraw_move(struct vc_data *vc, struct fbcon_display *p, in fbcon_redraw_move() argument
1558 (vc->vc_origin + vc->vc_size_row * line); in fbcon_redraw_move()
1572 fbcon_putcs(vc, start, s - start, in fbcon_redraw_move()
1582 fbcon_putcs(vc, start, s - start, dy, x); in fbcon_redraw_move()
1588 static void fbcon_redraw_blit(struct vc_data *vc, struct fb_info *info, in fbcon_redraw_blit() argument
1591 int offset = ycount * vc->vc_cols; in fbcon_redraw_blit()
1593 (vc->vc_origin + vc->vc_size_row * line); in fbcon_redraw_blit()
1608 ops->bmove(vc, info, line + ycount, x, in fbcon_redraw_blit()
1624 ops->bmove(vc, info, line + ycount, x, line, x, 1, in fbcon_redraw_blit()
1632 s -= vc->vc_size_row; in fbcon_redraw_blit()
1633 d -= vc->vc_size_row; in fbcon_redraw_blit()
1638 static void fbcon_redraw(struct vc_data *vc, struct fbcon_display *p, in fbcon_redraw() argument
1642 (vc->vc_origin + vc->vc_size_row * line); in fbcon_redraw()
1657 fbcon_putcs(vc, start, s - start, in fbcon_redraw()
1665 fbcon_putcs(vc, start, s - start, in fbcon_redraw()
1680 fbcon_putcs(vc, start, s - start, line, x); in fbcon_redraw()
1687 s -= vc->vc_size_row; in fbcon_redraw()
1688 d -= vc->vc_size_row; in fbcon_redraw()
1693 static bool fbcon_scroll(struct vc_data *vc, unsigned int t, unsigned int b, in fbcon_scroll() argument
1696 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; in fbcon_scroll()
1697 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_scroll()
1700 if (fbcon_is_inactive(vc, info)) in fbcon_scroll()
1703 fbcon_cursor(vc, CM_ERASE); in fbcon_scroll()
1713 if (count > vc->vc_rows) /* Maximum realistic size */ in fbcon_scroll()
1714 count = vc->vc_rows; in fbcon_scroll()
1719 fbcon_redraw_blit(vc, info, p, t, b - t - count, in fbcon_scroll()
1721 fbcon_clear(vc, b - count, 0, count, vc->vc_cols); in fbcon_scroll()
1722 scr_memsetw((unsigned short *) (vc->vc_origin + in fbcon_scroll()
1723 vc->vc_size_row * in fbcon_scroll()
1725 vc->vc_video_erase_char, in fbcon_scroll()
1726 vc->vc_size_row * count); in fbcon_scroll()
1730 if (b - t - count > 3 * vc->vc_rows >> 2) { in fbcon_scroll()
1732 fbcon_bmove(vc, 0, 0, count, 0, t, in fbcon_scroll()
1733 vc->vc_cols); in fbcon_scroll()
1734 ywrap_up(vc, count); in fbcon_scroll()
1735 if (vc->vc_rows - b > 0) in fbcon_scroll()
1736 fbcon_bmove(vc, b - count, 0, b, 0, in fbcon_scroll()
1737 vc->vc_rows - b, in fbcon_scroll()
1738 vc->vc_cols); in fbcon_scroll()
1740 fbcon_bmove(vc, t + count, 0, t, 0, in fbcon_scroll()
1741 b - t - count, vc->vc_cols); in fbcon_scroll()
1744 fbcon_clear(vc, b - count, 0, count, vc->vc_cols); in fbcon_scroll()
1749 2 * (p->vrows - vc->vc_rows)) in fbcon_scroll()
1750 && ((!scroll_partial && (b - t == vc->vc_rows)) in fbcon_scroll()
1753 3 * vc->vc_rows >> 2)))) { in fbcon_scroll()
1755 fbcon_redraw_move(vc, p, 0, t, count); in fbcon_scroll()
1756 ypan_up_redraw(vc, t, count); in fbcon_scroll()
1757 if (vc->vc_rows - b > 0) in fbcon_scroll()
1758 fbcon_redraw_move(vc, p, b, in fbcon_scroll()
1759 vc->vc_rows - b, b); in fbcon_scroll()
1761 fbcon_redraw_move(vc, p, t + count, b - t - count, t); in fbcon_scroll()
1762 fbcon_clear(vc, b - count, 0, count, vc->vc_cols); in fbcon_scroll()
1767 2 * (p->vrows - vc->vc_rows)) in fbcon_scroll()
1768 && ((!scroll_partial && (b - t == vc->vc_rows)) in fbcon_scroll()
1771 3 * vc->vc_rows >> 2)))) { in fbcon_scroll()
1773 fbcon_bmove(vc, 0, 0, count, 0, t, in fbcon_scroll()
1774 vc->vc_cols); in fbcon_scroll()
1775 ypan_up(vc, count); in fbcon_scroll()
1776 if (vc->vc_rows - b > 0) in fbcon_scroll()
1777 fbcon_bmove(vc, b - count, 0, b, 0, in fbcon_scroll()
1778 vc->vc_rows - b, in fbcon_scroll()
1779 vc->vc_cols); in fbcon_scroll()
1781 fbcon_bmove(vc, t + count, 0, t, 0, in fbcon_scroll()
1782 b - t - count, vc->vc_cols); in fbcon_scroll()
1785 fbcon_clear(vc, b - count, 0, count, vc->vc_cols); in fbcon_scroll()
1790 fbcon_redraw(vc, p, t, b - t - count, in fbcon_scroll()
1791 count * vc->vc_cols); in fbcon_scroll()
1792 fbcon_clear(vc, b - count, 0, count, vc->vc_cols); in fbcon_scroll()
1793 scr_memsetw((unsigned short *) (vc->vc_origin + in fbcon_scroll()
1794 vc->vc_size_row * in fbcon_scroll()
1796 vc->vc_video_erase_char, in fbcon_scroll()
1797 vc->vc_size_row * count); in fbcon_scroll()
1803 if (count > vc->vc_rows) /* Maximum realistic size */ in fbcon_scroll()
1804 count = vc->vc_rows; in fbcon_scroll()
1809 fbcon_redraw_blit(vc, info, p, b - 1, b - t - count, in fbcon_scroll()
1811 fbcon_clear(vc, t, 0, count, vc->vc_cols); in fbcon_scroll()
1812 scr_memsetw((unsigned short *) (vc->vc_origin + in fbcon_scroll()
1813 vc->vc_size_row * in fbcon_scroll()
1815 vc->vc_video_erase_char, in fbcon_scroll()
1816 vc->vc_size_row * count); in fbcon_scroll()
1820 if (b - t - count > 3 * vc->vc_rows >> 2) { in fbcon_scroll()
1821 if (vc->vc_rows - b > 0) in fbcon_scroll()
1822 fbcon_bmove(vc, b, 0, b - count, 0, in fbcon_scroll()
1823 vc->vc_rows - b, in fbcon_scroll()
1824 vc->vc_cols); in fbcon_scroll()
1825 ywrap_down(vc, count); in fbcon_scroll()
1827 fbcon_bmove(vc, count, 0, 0, 0, t, in fbcon_scroll()
1828 vc->vc_cols); in fbcon_scroll()
1830 fbcon_bmove(vc, t, 0, t + count, 0, in fbcon_scroll()
1831 b - t - count, vc->vc_cols); in fbcon_scroll()
1834 fbcon_clear(vc, t, 0, count, vc->vc_cols); in fbcon_scroll()
1838 if ((count - p->yscroll <= p->vrows - vc->vc_rows) in fbcon_scroll()
1839 && ((!scroll_partial && (b - t == vc->vc_rows)) in fbcon_scroll()
1842 3 * vc->vc_rows >> 2)))) { in fbcon_scroll()
1843 if (vc->vc_rows - b > 0) in fbcon_scroll()
1844 fbcon_bmove(vc, b, 0, b - count, 0, in fbcon_scroll()
1845 vc->vc_rows - b, in fbcon_scroll()
1846 vc->vc_cols); in fbcon_scroll()
1847 ypan_down(vc, count); in fbcon_scroll()
1849 fbcon_bmove(vc, count, 0, 0, 0, t, in fbcon_scroll()
1850 vc->vc_cols); in fbcon_scroll()
1852 fbcon_bmove(vc, t, 0, t + count, 0, in fbcon_scroll()
1853 b - t - count, vc->vc_cols); in fbcon_scroll()
1856 fbcon_clear(vc, t, 0, count, vc->vc_cols); in fbcon_scroll()
1860 if ((count - p->yscroll <= p->vrows - vc->vc_rows) in fbcon_scroll()
1861 && ((!scroll_partial && (b - t == vc->vc_rows)) in fbcon_scroll()
1864 3 * vc->vc_rows >> 2)))) { in fbcon_scroll()
1865 if (vc->vc_rows - b > 0) in fbcon_scroll()
1866 fbcon_redraw_move(vc, p, b, vc->vc_rows - b, in fbcon_scroll()
1868 ypan_down_redraw(vc, t, count); in fbcon_scroll()
1870 fbcon_redraw_move(vc, p, count, t, 0); in fbcon_scroll()
1872 fbcon_redraw_move(vc, p, t, b - t - count, t + count); in fbcon_scroll()
1873 fbcon_clear(vc, t, 0, count, vc->vc_cols); in fbcon_scroll()
1878 fbcon_redraw(vc, p, b - 1, b - t - count, in fbcon_scroll()
1879 -count * vc->vc_cols); in fbcon_scroll()
1880 fbcon_clear(vc, t, 0, count, vc->vc_cols); in fbcon_scroll()
1881 scr_memsetw((unsigned short *) (vc->vc_origin + in fbcon_scroll()
1882 vc->vc_size_row * in fbcon_scroll()
1884 vc->vc_video_erase_char, in fbcon_scroll()
1885 vc->vc_size_row * count); in fbcon_scroll()
1893 static void fbcon_bmove(struct vc_data *vc, int sy, int sx, int dy, int dx, in fbcon_bmove() argument
1896 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; in fbcon_bmove()
1897 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_bmove()
1899 if (fbcon_is_inactive(vc, info)) in fbcon_bmove()
1912 fbcon_bmove_rec(vc, p, sy, sx, dy, dx, height, width, in fbcon_bmove()
1916 static void fbcon_bmove_rec(struct vc_data *vc, struct fbcon_display *p, int sy, int sx, in fbcon_bmove_rec() argument
1919 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; in fbcon_bmove_rec()
1926 fbcon_bmove_rec(vc, p, sy, sx, dy, dx, b, width, in fbcon_bmove_rec()
1928 fbcon_bmove_rec(vc, p, sy + b, sx, dy + b, dx, in fbcon_bmove_rec()
1931 fbcon_bmove_rec(vc, p, sy + b, sx, dy + b, dx, in fbcon_bmove_rec()
1933 fbcon_bmove_rec(vc, p, sy, sx, dy, dx, b, width, in fbcon_bmove_rec()
1942 fbcon_bmove_rec(vc, p, sy, sx, dy, dx, b, width, in fbcon_bmove_rec()
1944 fbcon_bmove_rec(vc, p, sy + b, sx, dy + b, dx, in fbcon_bmove_rec()
1947 fbcon_bmove_rec(vc, p, sy + b, sx, dy + b, dx, in fbcon_bmove_rec()
1949 fbcon_bmove_rec(vc, p, sy, sx, dy, dx, b, width, in fbcon_bmove_rec()
1954 ops->bmove(vc, info, real_y(p, sy), sx, real_y(p, dy), dx, in fbcon_bmove_rec()
1960 struct vc_data *vc) in updatescrollmode() argument
1963 int fh = vc->vc_font.height; in updatescrollmode()
1973 divides(ypan, vc->vc_font.height) && vyres > yres; in updatescrollmode()
1975 divides(ywrap, vc->vc_font.height) && in updatescrollmode()
1976 divides(vc->vc_font.height, vyres) && in updatescrollmode()
1977 divides(vc->vc_font.height, yres); in updatescrollmode()
1985 if (yres > (fh * (vc->vc_rows + 1))) in updatescrollmode()
1986 p->vrows -= (yres - (fh * vc->vc_rows)) / fh; in updatescrollmode()
2008 static int fbcon_resize(struct vc_data *vc, unsigned int width, in fbcon_resize() argument
2011 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; in fbcon_resize()
2013 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_resize()
2017 if (p->userfont && FNTSIZE(vc->vc_font.data)) { in fbcon_resize()
2019 int pitch = PITCH(vc->vc_font.width); in fbcon_resize()
2030 size = CALC_FONTSZ(vc->vc_font.height, pitch, FNTCHARCNT(vc->vc_font.data)); in fbcon_resize()
2031 if (size > FNTSIZE(vc->vc_font.data)) in fbcon_resize()
2037 virt_fw = FBCON_SWAP(ops->rotate, vc->vc_font.width, in fbcon_resize()
2038 vc->vc_font.height); in fbcon_resize()
2039 virt_fh = FBCON_SWAP(ops->rotate, vc->vc_font.height, in fbcon_resize()
2040 vc->vc_font.width); in fbcon_resize()
2060 if (con_is_visible(vc)) { in fbcon_resize()
2068 updatescrollmode(p, info, vc); in fbcon_resize()
2072 static int fbcon_switch(struct vc_data *vc) in fbcon_switch() argument
2076 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_switch()
2080 info = registered_fb[con2fb_map[vc->vc_num]]; in fbcon_switch()
2107 o->currcon = vc->vc_num; in fbcon_switch()
2138 if (fbcon_is_inactive(vc, info) || in fbcon_switch()
2144 set_blitting_type(vc, info); in fbcon_switch()
2147 if (ops->rotate_font && ops->rotate_font(info, vc)) { in fbcon_switch()
2149 set_blitting_type(vc, info); in fbcon_switch()
2152 vc->vc_can_do_color = (fb_get_color_depth(&info->var, &info->fix)!=1); in fbcon_switch()
2153 vc->vc_complement_mask = vc->vc_can_do_color ? 0x7700 : 0x0800; in fbcon_switch()
2156 charcnt = FNTCHARCNT(vc->vc_font.data); in fbcon_switch()
2159 vc->vc_complement_mask <<= 1; in fbcon_switch()
2161 updatescrollmode(p, info, vc); in fbcon_switch()
2165 scrollback_phys_max = p->vrows - vc->vc_rows; in fbcon_switch()
2169 scrollback_phys_max = p->vrows - 2 * vc->vc_rows; in fbcon_switch()
2181 if (!fbcon_is_inactive(vc, info)) { in fbcon_switch()
2186 fbcon_set_palette(vc, color_table); in fbcon_switch()
2187 fbcon_clear_margins(vc, 0); in fbcon_switch()
2194 update_region(vc, in fbcon_switch()
2195 vc->vc_origin + vc->vc_size_row * vc->vc_top, in fbcon_switch()
2196 vc->vc_size_row * (vc->vc_bottom - in fbcon_switch()
2197 vc->vc_top) / 2); in fbcon_switch()
2203 static void fbcon_generic_blank(struct vc_data *vc, struct fb_info *info, in fbcon_generic_blank() argument
2207 unsigned short charmask = vc->vc_hi_font_mask ? in fbcon_generic_blank()
2211 oldc = vc->vc_video_erase_char; in fbcon_generic_blank()
2212 vc->vc_video_erase_char &= charmask; in fbcon_generic_blank()
2213 fbcon_clear(vc, 0, 0, vc->vc_rows, vc->vc_cols); in fbcon_generic_blank()
2214 vc->vc_video_erase_char = oldc; in fbcon_generic_blank()
2218 static int fbcon_blank(struct vc_data *vc, int blank, int mode_switch) in fbcon_blank() argument
2220 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; in fbcon_blank()
2237 if (!fbcon_is_inactive(vc, info)) { in fbcon_blank()
2240 fbcon_cursor(vc, blank ? CM_ERASE : CM_DRAW); in fbcon_blank()
2244 fbcon_generic_blank(vc, info, blank); in fbcon_blank()
2248 update_screen(vc); in fbcon_blank()
2251 if (mode_switch || fbcon_is_inactive(vc, info) || in fbcon_blank()
2260 static int fbcon_debug_enter(struct vc_data *vc) in fbcon_debug_enter() argument
2262 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; in fbcon_debug_enter()
2269 fbcon_set_palette(vc, color_table); in fbcon_debug_enter()
2273 static int fbcon_debug_leave(struct vc_data *vc) in fbcon_debug_leave() argument
2275 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; in fbcon_debug_leave()
2284 static int fbcon_get_font(struct vc_data *vc, struct console_font *font) in fbcon_get_font() argument
2286 u8 *fontdata = vc->vc_font.data; in fbcon_get_font()
2290 font->width = vc->vc_font.width; in fbcon_get_font()
2291 font->height = vc->vc_font.height; in fbcon_get_font()
2292 font->charcount = vc->vc_hi_font_mask ? 512 : 256; in fbcon_get_font()
2297 j = vc->vc_font.height; in fbcon_get_font()
2308 j = vc->vc_font.height * 2; in fbcon_get_font()
2319 if (font->charcount * (vc->vc_font.height * sizeof(u32)) > FNTSIZE(fontdata)) in fbcon_get_font()
2323 for (j = 0; j < vc->vc_font.height; j++) { in fbcon_get_font()
2333 j = vc->vc_font.height * 4; in fbcon_get_font()
2348 static void set_vc_hi_font(struct vc_data *vc, bool set) in set_vc_hi_font() argument
2351 vc->vc_hi_font_mask = 0; in set_vc_hi_font()
2352 if (vc->vc_can_do_color) { in set_vc_hi_font()
2353 vc->vc_complement_mask >>= 1; in set_vc_hi_font()
2354 vc->vc_s_complement_mask >>= 1; in set_vc_hi_font()
2358 if (vc->vc_can_do_color) { in set_vc_hi_font()
2360 (unsigned short *) vc->vc_origin; in set_vc_hi_font()
2361 int count = vc->vc_screenbuf_size / 2; in set_vc_hi_font()
2368 c = vc->vc_video_erase_char; in set_vc_hi_font()
2369 vc->vc_video_erase_char = in set_vc_hi_font()
2371 vc->vc_attr >>= 1; in set_vc_hi_font()
2374 vc->vc_hi_font_mask = 0x100; in set_vc_hi_font()
2375 if (vc->vc_can_do_color) { in set_vc_hi_font()
2376 vc->vc_complement_mask <<= 1; in set_vc_hi_font()
2377 vc->vc_s_complement_mask <<= 1; in set_vc_hi_font()
2383 (unsigned short *) vc->vc_origin; in set_vc_hi_font()
2384 int count = vc->vc_screenbuf_size / 2; in set_vc_hi_font()
2389 if (vc->vc_can_do_color) in set_vc_hi_font()
2397 c = vc->vc_video_erase_char; in set_vc_hi_font()
2398 if (vc->vc_can_do_color) { in set_vc_hi_font()
2399 vc->vc_video_erase_char = in set_vc_hi_font()
2401 vc->vc_attr <<= 1; in set_vc_hi_font()
2403 vc->vc_video_erase_char = c & ~0x100; in set_vc_hi_font()
2408 static int fbcon_do_set_font(struct vc_data *vc, int w, int h, in fbcon_do_set_font() argument
2411 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; in fbcon_do_set_font()
2413 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_do_set_font()
2418 resize = (w != vc->vc_font.width) || (h != vc->vc_font.height); in fbcon_do_set_font()
2420 old_data = vc->vc_font.data; in fbcon_do_set_font()
2425 vc->vc_font.data = (void *)(p->fontdata = data); in fbcon_do_set_font()
2428 vc->vc_font.width = w; in fbcon_do_set_font()
2429 vc->vc_font.height = h; in fbcon_do_set_font()
2430 if (vc->vc_hi_font_mask && cnt == 256) in fbcon_do_set_font()
2431 set_vc_hi_font(vc, false); in fbcon_do_set_font()
2432 else if (!vc->vc_hi_font_mask && cnt == 512) in fbcon_do_set_font()
2433 set_vc_hi_font(vc, true); in fbcon_do_set_font()
2442 vc_resize(vc, cols, rows); in fbcon_do_set_font()
2443 } else if (con_is_visible(vc) in fbcon_do_set_font()
2444 && vc->vc_mode == KD_TEXT) { in fbcon_do_set_font()
2445 fbcon_clear_margins(vc, 0); in fbcon_do_set_font()
2446 update_screen(vc); in fbcon_do_set_font()
2454 static int fbcon_copy_font(struct vc_data *vc, int con) in fbcon_copy_font() argument
2457 struct console_font *f = &vc->vc_font; in fbcon_copy_font()
2461 return fbcon_do_set_font(vc, f->width, f->height, od->fontdata, od->userfont); in fbcon_copy_font()
2476 static int fbcon_set_font(struct vc_data *vc, struct console_font *font, in fbcon_set_font() argument
2479 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; in fbcon_set_font()
2537 return fbcon_do_set_font(vc, font->width, font->height, new_data, 1); in fbcon_set_font()
2540 static int fbcon_set_def_font(struct vc_data *vc, struct console_font *font, char *name) in fbcon_set_def_font() argument
2542 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; in fbcon_set_def_font()
2553 return fbcon_do_set_font(vc, f->width, f->height, f->data, 0); in fbcon_set_def_font()
2564 static void fbcon_set_palette(struct vc_data *vc, const unsigned char *table) in fbcon_set_palette() argument
2566 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; in fbcon_set_palette()
2570 if (fbcon_is_inactive(vc, info)) in fbcon_set_palette()
2573 if (!con_is_visible(vc)) in fbcon_set_palette()
2580 val = vc->vc_palette[j++]; in fbcon_set_palette()
2582 val = vc->vc_palette[j++]; in fbcon_set_palette()
2584 val = vc->vc_palette[j++]; in fbcon_set_palette()
2599 static u16 *fbcon_screen_pos(const struct vc_data *vc, int offset) in fbcon_screen_pos() argument
2601 return (u16 *) (vc->vc_origin + offset); in fbcon_screen_pos()
2604 static unsigned long fbcon_getxy(struct vc_data *vc, unsigned long pos, in fbcon_getxy() argument
2610 if (pos >= vc->vc_origin && pos < vc->vc_scr_end) { in fbcon_getxy()
2611 unsigned long offset = (pos - vc->vc_origin) / 2; in fbcon_getxy()
2613 x = offset % vc->vc_cols; in fbcon_getxy()
2614 y = offset / vc->vc_cols; in fbcon_getxy()
2615 ret = pos + (vc->vc_cols - x) * 2; in fbcon_getxy()
2619 ret = vc->vc_origin; in fbcon_getxy()
2630 static void fbcon_invert_region(struct vc_data *vc, u16 * p, int cnt) in fbcon_invert_region() argument
2634 if (!vc->vc_can_do_color) in fbcon_invert_region()
2636 else if (vc->vc_hi_font_mask == 0x100) in fbcon_invert_region()
2648 struct vc_data *vc = NULL; in fbcon_suspended() local
2653 vc = vc_cons[ops->currcon].d; in fbcon_suspended()
2656 fbcon_cursor(vc, CM_ERASE); in fbcon_suspended()
2661 struct vc_data *vc; in fbcon_resumed() local
2666 vc = vc_cons[ops->currcon].d; in fbcon_resumed()
2668 update_screen(vc); in fbcon_resumed()
2674 struct vc_data *vc; in fbcon_modechanged() local
2680 vc = vc_cons[ops->currcon].d; in fbcon_modechanged()
2681 if (vc->vc_mode != KD_TEXT || in fbcon_modechanged()
2685 p = &fb_display[vc->vc_num]; in fbcon_modechanged()
2686 set_blitting_type(vc, info); in fbcon_modechanged()
2688 if (con_is_visible(vc)) { in fbcon_modechanged()
2692 cols /= vc->vc_font.width; in fbcon_modechanged()
2693 rows /= vc->vc_font.height; in fbcon_modechanged()
2694 vc_resize(vc, cols, rows); in fbcon_modechanged()
2695 updatescrollmode(p, info, vc); in fbcon_modechanged()
2699 if (!fbcon_is_inactive(vc, info)) { in fbcon_modechanged()
2704 fbcon_set_palette(vc, color_table); in fbcon_modechanged()
2705 update_screen(vc); in fbcon_modechanged()
2712 struct vc_data *vc; in fbcon_set_all_vcs() local
2720 vc = vc_cons[i].d; in fbcon_set_all_vcs()
2721 if (!vc || vc->vc_mode != KD_TEXT || in fbcon_set_all_vcs()
2725 if (con_is_visible(vc)) { in fbcon_set_all_vcs()
2730 p = &fb_display[vc->vc_num]; in fbcon_set_all_vcs()
2731 set_blitting_type(vc, info); in fbcon_set_all_vcs()
2735 cols /= vc->vc_font.width; in fbcon_set_all_vcs()
2736 rows /= vc->vc_font.height; in fbcon_set_all_vcs()
2737 vc_resize(vc, cols, rows); in fbcon_set_all_vcs()
2978 struct vc_data *vc; in fbcon_fb_blanked() local
2983 vc = vc_cons[ops->currcon].d; in fbcon_fb_blanked()
2984 if (vc->vc_mode != KD_TEXT || in fbcon_fb_blanked()
2988 if (con_is_visible(vc)) { in fbcon_fb_blanked()
3000 struct vc_data *vc; in fbcon_new_modelist() local
3009 vc = vc_cons[i].d; in fbcon_new_modelist()
3014 fbcon_set_disp(info, &var, vc->vc_num); in fbcon_new_modelist()
3021 struct vc_data *vc; in fbcon_get_requirement() local
3028 vc = vc_cons[i].d; in fbcon_get_requirement()
3029 if (vc && vc->vc_mode == KD_TEXT && in fbcon_get_requirement()
3032 caps->x |= 1 << (vc->vc_font.width - 1); in fbcon_get_requirement()
3033 caps->y |= 1 << (vc->vc_font.height - 1); in fbcon_get_requirement()
3041 vc = vc_cons[fg_console].d; in fbcon_get_requirement()
3043 if (vc && vc->vc_mode == KD_TEXT && in fbcon_get_requirement()
3046 caps->x = 1 << (vc->vc_font.width - 1); in fbcon_get_requirement()
3047 caps->y = 1 << (vc->vc_font.height - 1); in fbcon_get_requirement()