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()
569 static void fbcon_prepare_logo(struct vc_data *vc, struct fb_info *info, in fbcon_prepare_logo() argument
575 static void fbcon_prepare_logo(struct vc_data *vc, struct fb_info *info, in fbcon_prepare_logo() argument
580 int cnt, erase = vc->vc_video_erase_char, step; in fbcon_prepare_logo()
596 logo_lines = DIV_ROUND_UP(logo_height, vc->vc_font.height); in fbcon_prepare_logo()
597 q = (unsigned short *) (vc->vc_origin + in fbcon_prepare_logo()
598 vc->vc_size_row * rows); in fbcon_prepare_logo()
601 if (scr_readw(r) != vc->vc_video_erase_char) in fbcon_prepare_logo()
619 scr_memcpyw(r + step, r, vc->vc_size_row); in fbcon_prepare_logo()
624 if (vc->state.y + logo_lines >= rows) in fbcon_prepare_logo()
625 lines = rows - vc->state.y - 1; in fbcon_prepare_logo()
628 vc->state.y += lines; in fbcon_prepare_logo()
629 vc->vc_pos += lines * vc->vc_size_row; in fbcon_prepare_logo()
632 scr_memsetw((unsigned short *) vc->vc_origin, in fbcon_prepare_logo()
634 vc->vc_size_row * logo_lines); in fbcon_prepare_logo()
636 if (con_is_visible(vc) && vc->vc_mode == KD_TEXT) { in fbcon_prepare_logo()
637 fbcon_clear_margins(vc, 0); in fbcon_prepare_logo()
638 update_screen(vc); in fbcon_prepare_logo()
642 q = (unsigned short *) (vc->vc_origin + in fbcon_prepare_logo()
643 vc->vc_size_row * in fbcon_prepare_logo()
646 vc->state.y += logo_lines; in fbcon_prepare_logo()
647 vc->vc_pos += logo_lines * vc->vc_size_row; in fbcon_prepare_logo()
654 if (logo_lines > vc->vc_bottom) { in fbcon_prepare_logo()
660 vc->vc_top = logo_lines; in fbcon_prepare_logo()
666 static void set_blitting_type(struct vc_data *vc, struct fb_info *info) in set_blitting_type() argument
670 ops->p = &fb_display[vc->vc_num]; in set_blitting_type()
673 fbcon_set_tileops(vc, info); in set_blitting_type()
691 static void set_blitting_type(struct vc_data *vc, struct fb_info *info) in set_blitting_type() argument
696 ops->p = &fb_display[vc->vc_num]; in set_blitting_type()
709 static int con2fb_acquire_newinfo(struct vc_data *vc, struct fb_info *info, in con2fb_acquire_newinfo() argument
733 if (vc) in con2fb_acquire_newinfo()
734 set_blitting_type(vc, info); in con2fb_acquire_newinfo()
745 static int con2fb_release_oldinfo(struct vc_data *vc, struct fb_info *oldinfo, in con2fb_release_oldinfo() argument
791 static void con2fb_init_display(struct vc_data *vc, struct fb_info *info, in con2fb_init_display() argument
838 struct vc_data *vc = vc_cons[unit].d; in set_con2fb_map() local
864 err = con2fb_acquire_newinfo(vc, info, unit, oldidx); in set_con2fb_map()
871 err = con2fb_release_oldinfo(vc, oldinfo, info, unit, oldidx, in set_con2fb_map()
881 con2fb_init_display(vc, info, unit, show_logo); in set_con2fb_map()
941 struct vc_data *vc = vc_cons[fg_console].d; in fbcon_startup() local
989 set_blitting_type(vc, info); in fbcon_startup()
998 vc->vc_font.width = font->width; in fbcon_startup()
999 vc->vc_font.height = font->height; in fbcon_startup()
1000 vc->vc_font.data = (void *)(p->fontdata = font->data); in fbcon_startup()
1001 vc->vc_font.charcount = font->charcount; 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()
1201 if (con_is_visible(vc)) in fbcon_deinit()
1208 vc->vc_font.data = NULL; in fbcon_deinit()
1210 if (vc->vc_hi_font_mask && vc->vc_screenbuf) in fbcon_deinit()
1211 set_vc_hi_font(vc, false); in fbcon_deinit()
1216 if (vc->vc_num == logo_shown) in fbcon_deinit()
1247 static void fbcon_clear(struct vc_data *vc, int sy, int sx, int height, in fbcon_clear() argument
1250 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; in fbcon_clear()
1253 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_clear()
1256 if (fbcon_is_inactive(vc, info)) in fbcon_clear()
1262 if (sy < vc->vc_top && vc->vc_top == logo_lines) { in fbcon_clear()
1263 vc->vc_top = 0; in fbcon_clear()
1270 fbcon_clear_margins(vc, 0); in fbcon_clear()
1278 ops->clear(vc, info, real_y(p, sy), sx, b, width); in fbcon_clear()
1279 ops->clear(vc, info, real_y(p, sy + b), sx, height - b, in fbcon_clear()
1282 ops->clear(vc, info, real_y(p, sy), sx, height, width); in fbcon_clear()
1285 static void fbcon_putcs(struct vc_data *vc, const unsigned short *s, in fbcon_putcs() argument
1288 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; in fbcon_putcs()
1289 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_putcs()
1292 if (!fbcon_is_inactive(vc, info)) in fbcon_putcs()
1293 ops->putcs(vc, info, s, count, real_y(p, ypos), xpos, in fbcon_putcs()
1294 get_color(vc, info, scr_readw(s), 1), in fbcon_putcs()
1295 get_color(vc, info, scr_readw(s), 0)); in fbcon_putcs()
1298 static void fbcon_putc(struct vc_data *vc, int c, int ypos, int xpos) in fbcon_putc() argument
1303 fbcon_putcs(vc, &chr, 1, ypos, xpos); in fbcon_putc()
1306 static void fbcon_clear_margins(struct vc_data *vc, int bottom_only) in fbcon_clear_margins() argument
1308 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; in fbcon_clear_margins()
1311 if (!fbcon_is_inactive(vc, info)) in fbcon_clear_margins()
1312 ops->clear_margins(vc, info, margin_color, bottom_only); in fbcon_clear_margins()
1315 static void fbcon_cursor(struct vc_data *vc, int mode) in fbcon_cursor() argument
1317 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; in fbcon_cursor()
1319 int c = scr_readw((u16 *) vc->vc_pos); in fbcon_cursor()
1321 ops->cur_blink_jiffies = msecs_to_jiffies(vc->vc_cur_blink_ms); in fbcon_cursor()
1323 if (fbcon_is_inactive(vc, info) || vc->vc_deccm != 1) in fbcon_cursor()
1326 if (vc->vc_cursor_type & CUR_SW) in fbcon_cursor()
1336 ops->cursor(vc, info, mode, get_color(vc, info, c, 1), in fbcon_cursor()
1337 get_color(vc, info, c, 0)); in fbcon_cursor()
1348 struct vc_data **default_mode, *vc; in fbcon_set_disp() local
1358 vc = vc_cons[unit].d; in fbcon_set_disp()
1360 if (!vc) in fbcon_set_disp()
1363 default_mode = vc->vc_display_fg; in fbcon_set_disp()
1367 if (!vc->vc_font.data) { in fbcon_set_disp()
1368 vc->vc_font.data = (void *)(p->fontdata = t->fontdata); in fbcon_set_disp()
1369 vc->vc_font.width = (*default_mode)->vc_font.width; in fbcon_set_disp()
1370 vc->vc_font.height = (*default_mode)->vc_font.height; in fbcon_set_disp()
1371 vc->vc_font.charcount = (*default_mode)->vc_font.charcount; in fbcon_set_disp()
1383 vc->vc_can_do_color = (fb_get_color_depth(&info->var, &info->fix)!=1); in fbcon_set_disp()
1384 vc->vc_complement_mask = vc->vc_can_do_color ? 0x7700 : 0x0800; in fbcon_set_disp()
1385 if (vc->vc_font.charcount == 256) { in fbcon_set_disp()
1386 vc->vc_hi_font_mask = 0; in fbcon_set_disp()
1388 vc->vc_hi_font_mask = 0x100; in fbcon_set_disp()
1389 if (vc->vc_can_do_color) in fbcon_set_disp()
1390 vc->vc_complement_mask <<= 1; in fbcon_set_disp()
1395 if (!*vc->vc_uni_pagedir_loc) in fbcon_set_disp()
1396 con_copy_unimap(vc, svc); in fbcon_set_disp()
1400 cols /= vc->vc_font.width; in fbcon_set_disp()
1401 rows /= vc->vc_font.height; in fbcon_set_disp()
1402 vc_resize(vc, cols, rows); in fbcon_set_disp()
1404 if (con_is_visible(vc)) { in fbcon_set_disp()
1405 update_screen(vc); in fbcon_set_disp()
1409 static __inline__ void ywrap_up(struct vc_data *vc, int count) in ywrap_up() argument
1411 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; in ywrap_up()
1413 struct fbcon_display *p = &fb_display[vc->vc_num]; in ywrap_up()
1419 ops->var.yoffset = p->yscroll * vc->vc_font.height; in ywrap_up()
1428 static __inline__ void ywrap_down(struct vc_data *vc, int count) in ywrap_down() argument
1430 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; in ywrap_down()
1432 struct fbcon_display *p = &fb_display[vc->vc_num]; in ywrap_down()
1438 ops->var.yoffset = p->yscroll * vc->vc_font.height; in ywrap_down()
1447 static __inline__ void ypan_up(struct vc_data *vc, int count) in ypan_up() argument
1449 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; in ypan_up()
1450 struct fbcon_display *p = &fb_display[vc->vc_num]; in ypan_up()
1454 if (p->yscroll > p->vrows - vc->vc_rows) { in ypan_up()
1455 ops->bmove(vc, info, p->vrows - vc->vc_rows, in ypan_up()
1456 0, 0, 0, vc->vc_rows, vc->vc_cols); in ypan_up()
1457 p->yscroll -= p->vrows - vc->vc_rows; in ypan_up()
1461 ops->var.yoffset = p->yscroll * vc->vc_font.height; in ypan_up()
1464 fbcon_clear_margins(vc, 1); in ypan_up()
1471 static __inline__ void ypan_up_redraw(struct vc_data *vc, int t, int count) in ypan_up_redraw() argument
1473 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; in ypan_up_redraw()
1475 struct fbcon_display *p = &fb_display[vc->vc_num]; in ypan_up_redraw()
1479 if (p->yscroll > p->vrows - vc->vc_rows) { in ypan_up_redraw()
1480 p->yscroll -= p->vrows - vc->vc_rows; in ypan_up_redraw()
1481 fbcon_redraw_move(vc, p, t + count, vc->vc_rows - count, t); in ypan_up_redraw()
1485 ops->var.yoffset = p->yscroll * vc->vc_font.height; in ypan_up_redraw()
1488 fbcon_clear_margins(vc, 1); in ypan_up_redraw()
1495 static __inline__ void ypan_down(struct vc_data *vc, int count) in ypan_down() argument
1497 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; in ypan_down()
1498 struct fbcon_display *p = &fb_display[vc->vc_num]; in ypan_down()
1503 ops->bmove(vc, info, 0, 0, p->vrows - vc->vc_rows, in ypan_down()
1504 0, vc->vc_rows, vc->vc_cols); in ypan_down()
1505 p->yscroll += p->vrows - vc->vc_rows; in ypan_down()
1509 ops->var.yoffset = p->yscroll * vc->vc_font.height; in ypan_down()
1512 fbcon_clear_margins(vc, 1); in ypan_down()
1519 static __inline__ void ypan_down_redraw(struct vc_data *vc, int t, int count) in ypan_down_redraw() argument
1521 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; in ypan_down_redraw()
1523 struct fbcon_display *p = &fb_display[vc->vc_num]; in ypan_down_redraw()
1528 p->yscroll += p->vrows - vc->vc_rows; in ypan_down_redraw()
1529 fbcon_redraw_move(vc, p, t, vc->vc_rows - count, t + count); in ypan_down_redraw()
1533 ops->var.yoffset = p->yscroll * vc->vc_font.height; in ypan_down_redraw()
1536 fbcon_clear_margins(vc, 1); in ypan_down_redraw()
1543 static void fbcon_redraw_move(struct vc_data *vc, struct fbcon_display *p, in fbcon_redraw_move() argument
1547 (vc->vc_origin + vc->vc_size_row * line); in fbcon_redraw_move()
1561 fbcon_putcs(vc, start, s - start, in fbcon_redraw_move()
1571 fbcon_putcs(vc, start, s - start, dy, x); in fbcon_redraw_move()
1577 static void fbcon_redraw_blit(struct vc_data *vc, struct fb_info *info, in fbcon_redraw_blit() argument
1580 int offset = ycount * vc->vc_cols; in fbcon_redraw_blit()
1582 (vc->vc_origin + vc->vc_size_row * line); in fbcon_redraw_blit()
1597 ops->bmove(vc, info, line + ycount, x, in fbcon_redraw_blit()
1613 ops->bmove(vc, info, line + ycount, x, line, x, 1, in fbcon_redraw_blit()
1621 s -= vc->vc_size_row; in fbcon_redraw_blit()
1622 d -= vc->vc_size_row; in fbcon_redraw_blit()
1627 static void fbcon_redraw(struct vc_data *vc, struct fbcon_display *p, in fbcon_redraw() argument
1631 (vc->vc_origin + vc->vc_size_row * line); in fbcon_redraw()
1646 fbcon_putcs(vc, start, s - start, in fbcon_redraw()
1654 fbcon_putcs(vc, start, s - start, in fbcon_redraw()
1669 fbcon_putcs(vc, start, s - start, line, x); in fbcon_redraw()
1676 s -= vc->vc_size_row; in fbcon_redraw()
1677 d -= vc->vc_size_row; in fbcon_redraw()
1682 static bool fbcon_scroll(struct vc_data *vc, unsigned int t, unsigned int b, in fbcon_scroll() argument
1685 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; in fbcon_scroll()
1686 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_scroll()
1689 if (fbcon_is_inactive(vc, info)) in fbcon_scroll()
1692 fbcon_cursor(vc, CM_ERASE); in fbcon_scroll()
1702 if (count > vc->vc_rows) /* Maximum realistic size */ in fbcon_scroll()
1703 count = vc->vc_rows; in fbcon_scroll()
1706 fbcon_redraw_blit(vc, info, p, t, b - t - count, in fbcon_scroll()
1708 fbcon_clear(vc, b - count, 0, count, vc->vc_cols); in fbcon_scroll()
1709 scr_memsetw((unsigned short *) (vc->vc_origin + in fbcon_scroll()
1710 vc->vc_size_row * in fbcon_scroll()
1712 vc->vc_video_erase_char, in fbcon_scroll()
1713 vc->vc_size_row * count); in fbcon_scroll()
1717 if (b - t - count > 3 * vc->vc_rows >> 2) { in fbcon_scroll()
1719 fbcon_bmove(vc, 0, 0, count, 0, t, in fbcon_scroll()
1720 vc->vc_cols); in fbcon_scroll()
1721 ywrap_up(vc, count); in fbcon_scroll()
1722 if (vc->vc_rows - b > 0) in fbcon_scroll()
1723 fbcon_bmove(vc, b - count, 0, b, 0, in fbcon_scroll()
1724 vc->vc_rows - b, in fbcon_scroll()
1725 vc->vc_cols); in fbcon_scroll()
1727 fbcon_bmove(vc, t + count, 0, t, 0, in fbcon_scroll()
1728 b - t - count, vc->vc_cols); in fbcon_scroll()
1731 fbcon_clear(vc, b - count, 0, count, vc->vc_cols); in fbcon_scroll()
1736 2 * (p->vrows - vc->vc_rows)) in fbcon_scroll()
1737 && ((!scroll_partial && (b - t == vc->vc_rows)) in fbcon_scroll()
1740 3 * vc->vc_rows >> 2)))) { in fbcon_scroll()
1742 fbcon_redraw_move(vc, p, 0, t, count); in fbcon_scroll()
1743 ypan_up_redraw(vc, t, count); in fbcon_scroll()
1744 if (vc->vc_rows - b > 0) in fbcon_scroll()
1745 fbcon_redraw_move(vc, p, b, in fbcon_scroll()
1746 vc->vc_rows - b, b); in fbcon_scroll()
1748 fbcon_redraw_move(vc, p, t + count, b - t - count, t); in fbcon_scroll()
1749 fbcon_clear(vc, b - count, 0, count, vc->vc_cols); in fbcon_scroll()
1754 2 * (p->vrows - vc->vc_rows)) in fbcon_scroll()
1755 && ((!scroll_partial && (b - t == vc->vc_rows)) in fbcon_scroll()
1758 3 * vc->vc_rows >> 2)))) { in fbcon_scroll()
1760 fbcon_bmove(vc, 0, 0, count, 0, t, in fbcon_scroll()
1761 vc->vc_cols); in fbcon_scroll()
1762 ypan_up(vc, count); in fbcon_scroll()
1763 if (vc->vc_rows - b > 0) in fbcon_scroll()
1764 fbcon_bmove(vc, b - count, 0, b, 0, in fbcon_scroll()
1765 vc->vc_rows - b, in fbcon_scroll()
1766 vc->vc_cols); in fbcon_scroll()
1768 fbcon_bmove(vc, t + count, 0, t, 0, in fbcon_scroll()
1769 b - t - count, vc->vc_cols); in fbcon_scroll()
1772 fbcon_clear(vc, b - count, 0, count, vc->vc_cols); in fbcon_scroll()
1777 fbcon_redraw(vc, p, t, b - t - count, in fbcon_scroll()
1778 count * vc->vc_cols); in fbcon_scroll()
1779 fbcon_clear(vc, b - count, 0, count, vc->vc_cols); in fbcon_scroll()
1780 scr_memsetw((unsigned short *) (vc->vc_origin + in fbcon_scroll()
1781 vc->vc_size_row * in fbcon_scroll()
1783 vc->vc_video_erase_char, in fbcon_scroll()
1784 vc->vc_size_row * count); in fbcon_scroll()
1790 if (count > vc->vc_rows) /* Maximum realistic size */ in fbcon_scroll()
1791 count = vc->vc_rows; in fbcon_scroll()
1794 fbcon_redraw_blit(vc, info, p, b - 1, b - t - count, in fbcon_scroll()
1796 fbcon_clear(vc, t, 0, count, vc->vc_cols); in fbcon_scroll()
1797 scr_memsetw((unsigned short *) (vc->vc_origin + in fbcon_scroll()
1798 vc->vc_size_row * in fbcon_scroll()
1800 vc->vc_video_erase_char, in fbcon_scroll()
1801 vc->vc_size_row * count); in fbcon_scroll()
1805 if (b - t - count > 3 * vc->vc_rows >> 2) { in fbcon_scroll()
1806 if (vc->vc_rows - b > 0) in fbcon_scroll()
1807 fbcon_bmove(vc, b, 0, b - count, 0, in fbcon_scroll()
1808 vc->vc_rows - b, in fbcon_scroll()
1809 vc->vc_cols); in fbcon_scroll()
1810 ywrap_down(vc, count); in fbcon_scroll()
1812 fbcon_bmove(vc, count, 0, 0, 0, t, in fbcon_scroll()
1813 vc->vc_cols); in fbcon_scroll()
1815 fbcon_bmove(vc, t, 0, t + count, 0, in fbcon_scroll()
1816 b - t - count, vc->vc_cols); in fbcon_scroll()
1819 fbcon_clear(vc, t, 0, count, vc->vc_cols); in fbcon_scroll()
1823 if ((count - p->yscroll <= p->vrows - vc->vc_rows) in fbcon_scroll()
1824 && ((!scroll_partial && (b - t == vc->vc_rows)) in fbcon_scroll()
1827 3 * vc->vc_rows >> 2)))) { in fbcon_scroll()
1828 if (vc->vc_rows - b > 0) in fbcon_scroll()
1829 fbcon_bmove(vc, b, 0, b - count, 0, in fbcon_scroll()
1830 vc->vc_rows - b, in fbcon_scroll()
1831 vc->vc_cols); in fbcon_scroll()
1832 ypan_down(vc, count); in fbcon_scroll()
1834 fbcon_bmove(vc, count, 0, 0, 0, t, in fbcon_scroll()
1835 vc->vc_cols); in fbcon_scroll()
1837 fbcon_bmove(vc, t, 0, t + count, 0, in fbcon_scroll()
1838 b - t - count, vc->vc_cols); in fbcon_scroll()
1841 fbcon_clear(vc, t, 0, count, vc->vc_cols); in fbcon_scroll()
1845 if ((count - p->yscroll <= p->vrows - vc->vc_rows) in fbcon_scroll()
1846 && ((!scroll_partial && (b - t == vc->vc_rows)) in fbcon_scroll()
1849 3 * vc->vc_rows >> 2)))) { in fbcon_scroll()
1850 if (vc->vc_rows - b > 0) in fbcon_scroll()
1851 fbcon_redraw_move(vc, p, b, vc->vc_rows - b, in fbcon_scroll()
1853 ypan_down_redraw(vc, t, count); in fbcon_scroll()
1855 fbcon_redraw_move(vc, p, count, t, 0); in fbcon_scroll()
1857 fbcon_redraw_move(vc, p, t, b - t - count, t + count); in fbcon_scroll()
1858 fbcon_clear(vc, t, 0, count, vc->vc_cols); in fbcon_scroll()
1863 fbcon_redraw(vc, p, b - 1, b - t - count, in fbcon_scroll()
1864 -count * vc->vc_cols); in fbcon_scroll()
1865 fbcon_clear(vc, t, 0, count, vc->vc_cols); in fbcon_scroll()
1866 scr_memsetw((unsigned short *) (vc->vc_origin + in fbcon_scroll()
1867 vc->vc_size_row * in fbcon_scroll()
1869 vc->vc_video_erase_char, in fbcon_scroll()
1870 vc->vc_size_row * count); in fbcon_scroll()
1878 static void fbcon_bmove(struct vc_data *vc, int sy, int sx, int dy, int dx, in fbcon_bmove() argument
1881 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; in fbcon_bmove()
1882 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_bmove()
1884 if (fbcon_is_inactive(vc, info)) in fbcon_bmove()
1897 fbcon_bmove_rec(vc, p, sy, sx, dy, dx, height, width, in fbcon_bmove()
1901 static void fbcon_bmove_rec(struct vc_data *vc, struct fbcon_display *p, int sy, int sx, in fbcon_bmove_rec() argument
1904 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; in fbcon_bmove_rec()
1911 fbcon_bmove_rec(vc, p, sy, sx, dy, dx, b, width, in fbcon_bmove_rec()
1913 fbcon_bmove_rec(vc, p, sy + b, sx, dy + b, dx, in fbcon_bmove_rec()
1916 fbcon_bmove_rec(vc, p, sy + b, sx, dy + b, dx, in fbcon_bmove_rec()
1918 fbcon_bmove_rec(vc, p, sy, sx, dy, dx, b, width, in fbcon_bmove_rec()
1927 fbcon_bmove_rec(vc, p, sy, sx, dy, dx, b, width, in fbcon_bmove_rec()
1929 fbcon_bmove_rec(vc, p, sy + b, sx, dy + b, dx, in fbcon_bmove_rec()
1932 fbcon_bmove_rec(vc, p, sy + b, sx, dy + b, dx, in fbcon_bmove_rec()
1934 fbcon_bmove_rec(vc, p, sy, sx, dy, dx, b, width, in fbcon_bmove_rec()
1939 ops->bmove(vc, info, real_y(p, sy), sx, real_y(p, dy), dx, in fbcon_bmove_rec()
1945 struct vc_data *vc) in updatescrollmode_accel() argument
1958 divides(ypan, vc->vc_font.height) && vyres > yres; in updatescrollmode_accel()
1960 divides(ywrap, vc->vc_font.height) && in updatescrollmode_accel()
1961 divides(vc->vc_font.height, vyres) && in updatescrollmode_accel()
1962 divides(vc->vc_font.height, yres); in updatescrollmode_accel()
1987 struct vc_data *vc) in updatescrollmode() argument
1990 int fh = vc->vc_font.height; in updatescrollmode()
1996 if (yres > (fh * (vc->vc_rows + 1))) in updatescrollmode()
1997 p->vrows -= (yres - (fh * vc->vc_rows)) / fh; in updatescrollmode()
2002 updatescrollmode_accel(p, info, vc); 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, vc->vc_font.charcount); 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) && vc->vc_mode == KD_TEXT) { 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()
2155 if (vc->vc_font.charcount > 256) in fbcon_switch()
2156 vc->vc_complement_mask <<= 1; in fbcon_switch()
2158 updatescrollmode(p, info, vc); in fbcon_switch()
2162 scrollback_phys_max = p->vrows - vc->vc_rows; in fbcon_switch()
2166 scrollback_phys_max = p->vrows - 2 * vc->vc_rows; in fbcon_switch()
2178 if (!fbcon_is_inactive(vc, info)) { in fbcon_switch()
2183 fbcon_set_palette(vc, color_table); in fbcon_switch()
2184 fbcon_clear_margins(vc, 0); in fbcon_switch()
2191 update_region(vc, in fbcon_switch()
2192 vc->vc_origin + vc->vc_size_row * vc->vc_top, in fbcon_switch()
2193 vc->vc_size_row * (vc->vc_bottom - in fbcon_switch()
2194 vc->vc_top) / 2); in fbcon_switch()
2200 static void fbcon_generic_blank(struct vc_data *vc, struct fb_info *info, in fbcon_generic_blank() argument
2204 unsigned short charmask = vc->vc_hi_font_mask ? in fbcon_generic_blank()
2208 oldc = vc->vc_video_erase_char; in fbcon_generic_blank()
2209 vc->vc_video_erase_char &= charmask; in fbcon_generic_blank()
2210 fbcon_clear(vc, 0, 0, vc->vc_rows, vc->vc_cols); in fbcon_generic_blank()
2211 vc->vc_video_erase_char = oldc; in fbcon_generic_blank()
2215 static int fbcon_blank(struct vc_data *vc, int blank, int mode_switch) in fbcon_blank() argument
2217 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; in fbcon_blank()
2234 if (!fbcon_is_inactive(vc, info)) { in fbcon_blank()
2237 fbcon_cursor(vc, blank ? CM_ERASE : CM_DRAW); in fbcon_blank()
2241 fbcon_generic_blank(vc, info, blank); in fbcon_blank()
2245 update_screen(vc); in fbcon_blank()
2248 if (mode_switch || fbcon_is_inactive(vc, info) || in fbcon_blank()
2257 static int fbcon_debug_enter(struct vc_data *vc) in fbcon_debug_enter() argument
2259 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; in fbcon_debug_enter()
2266 fbcon_set_palette(vc, color_table); in fbcon_debug_enter()
2270 static int fbcon_debug_leave(struct vc_data *vc) in fbcon_debug_leave() argument
2272 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; in fbcon_debug_leave()
2281 static int fbcon_get_font(struct vc_data *vc, struct console_font *font) in fbcon_get_font() argument
2283 u8 *fontdata = vc->vc_font.data; in fbcon_get_font()
2287 font->width = vc->vc_font.width; in fbcon_get_font()
2288 font->height = vc->vc_font.height; in fbcon_get_font()
2289 font->charcount = vc->vc_hi_font_mask ? 512 : 256; in fbcon_get_font()
2294 j = vc->vc_font.height; in fbcon_get_font()
2305 j = vc->vc_font.height * 2; in fbcon_get_font()
2316 if (font->charcount * (vc->vc_font.height * sizeof(u32)) > FNTSIZE(fontdata)) in fbcon_get_font()
2320 for (j = 0; j < vc->vc_font.height; j++) { in fbcon_get_font()
2330 j = vc->vc_font.height * 4; in fbcon_get_font()
2345 static void set_vc_hi_font(struct vc_data *vc, bool set) in set_vc_hi_font() argument
2348 vc->vc_hi_font_mask = 0; in set_vc_hi_font()
2349 if (vc->vc_can_do_color) { in set_vc_hi_font()
2350 vc->vc_complement_mask >>= 1; in set_vc_hi_font()
2351 vc->vc_s_complement_mask >>= 1; in set_vc_hi_font()
2355 if (vc->vc_can_do_color) { in set_vc_hi_font()
2357 (unsigned short *) vc->vc_origin; in set_vc_hi_font()
2358 int count = vc->vc_screenbuf_size / 2; in set_vc_hi_font()
2365 c = vc->vc_video_erase_char; in set_vc_hi_font()
2366 vc->vc_video_erase_char = in set_vc_hi_font()
2368 vc->vc_attr >>= 1; in set_vc_hi_font()
2371 vc->vc_hi_font_mask = 0x100; in set_vc_hi_font()
2372 if (vc->vc_can_do_color) { in set_vc_hi_font()
2373 vc->vc_complement_mask <<= 1; in set_vc_hi_font()
2374 vc->vc_s_complement_mask <<= 1; in set_vc_hi_font()
2380 (unsigned short *) vc->vc_origin; in set_vc_hi_font()
2381 int count = vc->vc_screenbuf_size / 2; in set_vc_hi_font()
2386 if (vc->vc_can_do_color) in set_vc_hi_font()
2394 c = vc->vc_video_erase_char; in set_vc_hi_font()
2395 if (vc->vc_can_do_color) { in set_vc_hi_font()
2396 vc->vc_video_erase_char = in set_vc_hi_font()
2398 vc->vc_attr <<= 1; in set_vc_hi_font()
2400 vc->vc_video_erase_char = c & ~0x100; in set_vc_hi_font()
2405 static int fbcon_do_set_font(struct vc_data *vc, int w, int h, int charcount, in fbcon_do_set_font() argument
2408 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; in fbcon_do_set_font()
2410 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_do_set_font()
2412 u8 *old_data = vc->vc_font.data; in fbcon_do_set_font()
2414 resize = (w != vc->vc_font.width) || (h != vc->vc_font.height); in fbcon_do_set_font()
2415 vc->vc_font.data = (void *)(p->fontdata = data); in fbcon_do_set_font()
2420 old_width = vc->vc_font.width; in fbcon_do_set_font()
2421 old_height = vc->vc_font.height; in fbcon_do_set_font()
2422 old_charcount = vc->vc_font.charcount; in fbcon_do_set_font()
2424 vc->vc_font.width = w; in fbcon_do_set_font()
2425 vc->vc_font.height = h; in fbcon_do_set_font()
2426 vc->vc_font.charcount = charcount; in fbcon_do_set_font()
2427 if (vc->vc_hi_font_mask && charcount == 256) in fbcon_do_set_font()
2428 set_vc_hi_font(vc, false); in fbcon_do_set_font()
2429 else if (!vc->vc_hi_font_mask && charcount == 512) in fbcon_do_set_font()
2430 set_vc_hi_font(vc, true); in fbcon_do_set_font()
2439 ret = vc_resize(vc, cols, rows); in fbcon_do_set_font()
2442 } else if (con_is_visible(vc) in fbcon_do_set_font()
2443 && vc->vc_mode == KD_TEXT) { in fbcon_do_set_font()
2444 fbcon_clear_margins(vc, 0); in fbcon_do_set_font()
2445 update_screen(vc); in fbcon_do_set_font()
2454 vc->vc_font.data = old_data; in fbcon_do_set_font()
2462 vc->vc_font.width = old_width; in fbcon_do_set_font()
2463 vc->vc_font.height = old_height; in fbcon_do_set_font()
2464 vc->vc_font.charcount = old_charcount; in fbcon_do_set_font()
2481 static int fbcon_set_font(struct vc_data *vc, struct console_font *font, in fbcon_set_font() argument
2484 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; in fbcon_set_font()
2551 return fbcon_do_set_font(vc, font->width, font->height, charcount, new_data, 1); in fbcon_set_font()
2554 static int fbcon_set_def_font(struct vc_data *vc, struct console_font *font, char *name) in fbcon_set_def_font() argument
2556 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; in fbcon_set_def_font()
2567 return fbcon_do_set_font(vc, f->width, f->height, f->charcount, f->data, 0); in fbcon_set_def_font()
2578 static void fbcon_set_palette(struct vc_data *vc, const unsigned char *table) in fbcon_set_palette() argument
2580 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; in fbcon_set_palette()
2584 if (fbcon_is_inactive(vc, info)) in fbcon_set_palette()
2587 if (!con_is_visible(vc)) in fbcon_set_palette()
2594 val = vc->vc_palette[j++]; in fbcon_set_palette()
2596 val = vc->vc_palette[j++]; in fbcon_set_palette()
2598 val = vc->vc_palette[j++]; in fbcon_set_palette()
2613 static u16 *fbcon_screen_pos(const struct vc_data *vc, int offset) in fbcon_screen_pos() argument
2615 return (u16 *) (vc->vc_origin + offset); in fbcon_screen_pos()
2618 static unsigned long fbcon_getxy(struct vc_data *vc, unsigned long pos, in fbcon_getxy() argument
2624 if (pos >= vc->vc_origin && pos < vc->vc_scr_end) { in fbcon_getxy()
2625 unsigned long offset = (pos - vc->vc_origin) / 2; in fbcon_getxy()
2627 x = offset % vc->vc_cols; in fbcon_getxy()
2628 y = offset / vc->vc_cols; in fbcon_getxy()
2629 ret = pos + (vc->vc_cols - x) * 2; in fbcon_getxy()
2633 ret = vc->vc_origin; in fbcon_getxy()
2644 static void fbcon_invert_region(struct vc_data *vc, u16 * p, int cnt) in fbcon_invert_region() argument
2648 if (!vc->vc_can_do_color) in fbcon_invert_region()
2650 else if (vc->vc_hi_font_mask == 0x100) in fbcon_invert_region()
2662 struct vc_data *vc = NULL; in fbcon_suspended() local
2667 vc = vc_cons[ops->currcon].d; in fbcon_suspended()
2670 fbcon_cursor(vc, CM_ERASE); in fbcon_suspended()
2675 struct vc_data *vc; in fbcon_resumed() local
2680 vc = vc_cons[ops->currcon].d; in fbcon_resumed()
2682 update_screen(vc); in fbcon_resumed()
2688 struct vc_data *vc; in fbcon_modechanged() local
2694 vc = vc_cons[ops->currcon].d; in fbcon_modechanged()
2695 if (vc->vc_mode != KD_TEXT || in fbcon_modechanged()
2699 p = &fb_display[vc->vc_num]; in fbcon_modechanged()
2700 set_blitting_type(vc, info); in fbcon_modechanged()
2702 if (con_is_visible(vc)) { in fbcon_modechanged()
2706 cols /= vc->vc_font.width; in fbcon_modechanged()
2707 rows /= vc->vc_font.height; in fbcon_modechanged()
2708 vc_resize(vc, cols, rows); in fbcon_modechanged()
2709 updatescrollmode(p, info, vc); in fbcon_modechanged()
2713 if (!fbcon_is_inactive(vc, info)) { in fbcon_modechanged()
2718 fbcon_set_palette(vc, color_table); in fbcon_modechanged()
2719 update_screen(vc); in fbcon_modechanged()
2726 struct vc_data *vc; in fbcon_set_all_vcs() local
2734 vc = vc_cons[i].d; in fbcon_set_all_vcs()
2735 if (!vc || vc->vc_mode != KD_TEXT || in fbcon_set_all_vcs()
2739 if (con_is_visible(vc)) { in fbcon_set_all_vcs()
2744 p = &fb_display[vc->vc_num]; in fbcon_set_all_vcs()
2745 set_blitting_type(vc, info); in fbcon_set_all_vcs()
2749 cols /= vc->vc_font.width; in fbcon_set_all_vcs()
2750 rows /= vc->vc_font.height; in fbcon_set_all_vcs()
2751 vc_resize(vc, cols, rows); in fbcon_set_all_vcs()
2772 struct vc_data *vc; in fbcon_modechange_possible() local
2782 vc = vc_cons[i].d; in fbcon_modechange_possible()
2783 if (!vc || vc->vc_mode != KD_TEXT || in fbcon_modechange_possible()
2787 if (vc->vc_font.width > FBCON_SWAP(var->rotate, var->xres, var->yres) || in fbcon_modechange_possible()
2788 vc->vc_font.height > FBCON_SWAP(var->rotate, var->yres, var->xres)) in fbcon_modechange_possible()
3020 struct vc_data *vc; in fbcon_fb_blanked() local
3025 vc = vc_cons[ops->currcon].d; in fbcon_fb_blanked()
3026 if (vc->vc_mode != KD_TEXT || in fbcon_fb_blanked()
3030 if (con_is_visible(vc)) { in fbcon_fb_blanked()
3042 struct vc_data *vc; in fbcon_new_modelist() local
3051 vc = vc_cons[i].d; in fbcon_new_modelist()
3056 fbcon_set_disp(info, &var, vc->vc_num); in fbcon_new_modelist()
3063 struct vc_data *vc; in fbcon_get_requirement() local
3069 vc = vc_cons[i].d; in fbcon_get_requirement()
3070 if (vc && vc->vc_mode == KD_TEXT && in fbcon_get_requirement()
3072 caps->x |= 1 << (vc->vc_font.width - 1); in fbcon_get_requirement()
3073 caps->y |= 1 << (vc->vc_font.height - 1); in fbcon_get_requirement()
3074 charcnt = vc->vc_font.charcount; in fbcon_get_requirement()
3080 vc = vc_cons[fg_console].d; in fbcon_get_requirement()
3082 if (vc && vc->vc_mode == KD_TEXT && in fbcon_get_requirement()
3084 caps->x = 1 << (vc->vc_font.width - 1); in fbcon_get_requirement()
3085 caps->y = 1 << (vc->vc_font.height - 1); in fbcon_get_requirement()
3086 caps->len = vc->vc_font.charcount; in fbcon_get_requirement()