Lines Matching refs:vc

166 #define advance_row(p, delta) (unsigned short *)((unsigned long)(p) + (delta) * vc->vc_size_row)
176 static void fbcon_clear_margins(struct vc_data *vc, int bottom_only);
177 static void fbcon_set_palette(struct vc_data *vc, const unsigned char *table);
184 static void fbcon_redraw_move(struct vc_data *vc, struct fbcon_display *p,
228 struct vc_data *vc;
236 vc = vc_cons[i].d;
237 if (!vc || vc->vc_mode != KD_TEXT ||
241 p = &fb_display[vc->vc_num];
273 static inline int fbcon_is_inactive(struct vc_data *vc, struct fb_info *info)
278 vc->vc_mode != KD_TEXT || ops->graphics);
281 static int get_color(struct vc_data *vc, struct fb_info *info,
288 unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff;
290 c = vc->vc_video_erase_char & charmask;
294 color = (is_fg) ? attr_fgcol((vc->vc_hi_font_mask) ? 9 : 8, c)
295 : attr_bgcol((vc->vc_hi_font_mask) ? 13 : 12, c);
352 struct vc_data *vc = NULL;
368 vc = vc_cons[ops->currcon].d;
370 if (!vc || !con_is_visible(vc) ||
371 fbcon_info_from_console(vc->vc_num) != info ||
372 vc->vc_deccm != 1) {
377 c = scr_readw((u16 *) vc->vc_pos);
379 ops->cursor(vc, info, enable, get_color(vc, info, c, 1),
380 get_color(vc, info, c, 0));
438 if (!strncmp(options, "vc:", 3)) {
546 static void fbcon_prepare_logo(struct vc_data *vc, struct fb_info *info,
552 static void fbcon_prepare_logo(struct vc_data *vc, struct fb_info *info,
557 int cnt, erase = vc->vc_video_erase_char, step;
573 logo_lines = DIV_ROUND_UP(logo_height, vc->vc_font.height);
574 q = (unsigned short *) (vc->vc_origin +
575 vc->vc_size_row * rows);
578 if (scr_readw(r) != vc->vc_video_erase_char)
596 scr_memcpyw(r + step, r, vc->vc_size_row);
601 if (vc->state.y + logo_lines >= rows)
602 lines = rows - vc->state.y - 1;
605 vc->state.y += lines;
606 vc->vc_pos += lines * vc->vc_size_row;
609 scr_memsetw((unsigned short *) vc->vc_origin,
611 vc->vc_size_row * logo_lines);
613 if (con_is_visible(vc) && vc->vc_mode == KD_TEXT) {
614 fbcon_clear_margins(vc, 0);
615 update_screen(vc);
619 q = (unsigned short *) (vc->vc_origin +
620 vc->vc_size_row *
623 vc->state.y += logo_lines;
624 vc->vc_pos += logo_lines * vc->vc_size_row;
631 if (logo_lines > vc->vc_bottom) {
636 vc->vc_top = logo_lines;
642 static void set_blitting_type(struct vc_data *vc, struct fb_info *info)
646 ops->p = &fb_display[vc->vc_num];
649 fbcon_set_tileops(vc, info);
667 static void set_blitting_type(struct vc_data *vc, struct fb_info *info)
672 ops->p = &fb_display[vc->vc_num];
736 static int con2fb_acquire_newinfo(struct vc_data *vc, struct fb_info *info,
745 if (vc)
746 set_blitting_type(vc, info);
751 static void con2fb_release_oldinfo(struct vc_data *vc, struct fb_info *oldinfo,
775 static void con2fb_init_display(struct vc_data *vc, struct fb_info *info,
822 struct vc_data *vc = vc_cons[unit].d;
845 err = con2fb_acquire_newinfo(vc, info, unit);
859 con2fb_release_oldinfo(vc, oldinfo, info);
865 con2fb_init_display(vc, info, unit, show_logo);
924 struct vc_data *vc = vc_cons[fg_console].d;
958 set_blitting_type(vc, info);
967 vc->vc_font.width = font->width;
968 vc->vc_font.height = font->height;
969 vc->vc_font.data = (void *)(p->fontdata = font->data);
970 vc->vc_font.charcount = font->charcount;
975 cols /= vc->vc_font.width;
976 rows /= vc->vc_font.height;
977 vc_resize(vc, cols, rows);
989 static void fbcon_init(struct vc_data *vc, bool init)
993 struct vc_data **default_mode = vc->vc_display_fg;
995 struct fbcon_display *t, *p = &fb_display[vc->vc_num];
1002 if (con2fb_map[vc->vc_num] == -1)
1003 con2fb_map[vc->vc_num] = info_idx;
1005 info = fbcon_info_from_console(vc->vc_num);
1010 if (vc != svc || logo_shown == FBCON_LOGO_DONTSHOW ||
1018 con2fb_acquire_newinfo(vc, info, vc->vc_num);
1027 vc->vc_font.data = (void *)(p->fontdata =
1029 vc->vc_font.width = fvc->vc_font.width;
1030 vc->vc_font.height = fvc->vc_font.height;
1031 vc->vc_font.charcount = fvc->vc_font.charcount;
1044 vc->vc_font.width = font->width;
1045 vc->vc_font.height = font->height;
1046 vc->vc_font.data = (void *)(p->fontdata = font->data);
1047 vc->vc_font.charcount = font->charcount;
1051 vc->vc_can_do_color = (fb_get_color_depth(&info->var, &info->fix)!=1);
1052 vc->vc_complement_mask = vc->vc_can_do_color ? 0x7700 : 0x0800;
1053 if (vc->vc_font.charcount == 256) {
1054 vc->vc_hi_font_mask = 0;
1056 vc->vc_hi_font_mask = 0x100;
1057 if (vc->vc_can_do_color)
1058 vc->vc_complement_mask <<= 1;
1063 if (!*vc->uni_pagedict_loc)
1064 con_copy_unimap(vc, svc);
1067 ops->cur_blink_jiffies = msecs_to_jiffies(vc->vc_cur_blink_ms);
1075 set_blitting_type(vc, info);
1077 cols = vc->vc_cols;
1078 rows = vc->vc_rows;
1081 new_cols /= vc->vc_font.width;
1082 new_rows /= vc->vc_font.height;
1091 if (con_is_visible(vc) && vc->vc_mode == KD_TEXT) {
1120 vc->vc_cols = new_cols;
1121 vc->vc_rows = new_rows;
1123 vc_resize(vc, new_cols, new_rows);
1126 fbcon_prepare_logo(vc, info, cols, rows, new_cols, new_rows);
1128 if (ops->rotate_font && ops->rotate_font(info, vc)) {
1130 set_blitting_type(vc, info);
1144 static void set_vc_hi_font(struct vc_data *vc, bool set);
1167 static void fbcon_deinit(struct vc_data *vc)
1169 struct fbcon_display *p = &fb_display[vc->vc_num];
1175 idx = con2fb_map[vc->vc_num];
1190 if (con_is_visible(vc))
1197 vc->vc_font.data = NULL;
1199 if (vc->vc_hi_font_mask && vc->vc_screenbuf)
1200 set_vc_hi_font(vc, false);
1205 if (vc->vc_num == logo_shown)
1236 static void __fbcon_clear(struct vc_data *vc, unsigned int sy, unsigned int sx,
1239 struct fb_info *info = fbcon_info_from_console(vc->vc_num);
1242 struct fbcon_display *p = &fb_display[vc->vc_num];
1245 if (fbcon_is_inactive(vc, info))
1251 if (sy < vc->vc_top && vc->vc_top == logo_lines) {
1252 vc->vc_top = 0;
1259 fbcon_clear_margins(vc, 0);
1267 ops->clear(vc, info, real_y(p, sy), sx, b, width);
1268 ops->clear(vc, info, real_y(p, sy + b), sx, height - b,
1271 ops->clear(vc, info, real_y(p, sy), sx, height, width);
1274 static void fbcon_clear(struct vc_data *vc, unsigned int sy, unsigned int sx,
1277 __fbcon_clear(vc, sy, sx, 1, width);
1280 static void fbcon_putcs(struct vc_data *vc, const u16 *s, unsigned int count,
1283 struct fb_info *info = fbcon_info_from_console(vc->vc_num);
1284 struct fbcon_display *p = &fb_display[vc->vc_num];
1287 if (!fbcon_is_inactive(vc, info))
1288 ops->putcs(vc, info, s, count, real_y(p, ypos), xpos,
1289 get_color(vc, info, scr_readw(s), 1),
1290 get_color(vc, info, scr_readw(s), 0));
1293 static void fbcon_clear_margins(struct vc_data *vc, int bottom_only)
1295 struct fb_info *info = fbcon_info_from_console(vc->vc_num);
1298 if (!fbcon_is_inactive(vc, info))
1299 ops->clear_margins(vc, info, margin_color, bottom_only);
1302 static void fbcon_cursor(struct vc_data *vc, bool enable)
1304 struct fb_info *info = fbcon_info_from_console(vc->vc_num);
1306 int c = scr_readw((u16 *) vc->vc_pos);
1308 ops->cur_blink_jiffies = msecs_to_jiffies(vc->vc_cur_blink_ms);
1310 if (fbcon_is_inactive(vc, info) || vc->vc_deccm != 1)
1313 if (vc->vc_cursor_type & CUR_SW)
1323 ops->cursor(vc, info, enable, get_color(vc, info, c, 1),
1324 get_color(vc, info, c, 0));
1335 struct vc_data **default_mode, *vc;
1345 vc = vc_cons[unit].d;
1347 if (!vc)
1350 default_mode = vc->vc_display_fg;
1354 if (!vc->vc_font.data) {
1355 vc->vc_font.data = (void *)(p->fontdata = t->fontdata);
1356 vc->vc_font.width = (*default_mode)->vc_font.width;
1357 vc->vc_font.height = (*default_mode)->vc_font.height;
1358 vc->vc_font.charcount = (*default_mode)->vc_font.charcount;
1370 vc->vc_can_do_color = (fb_get_color_depth(&info->var, &info->fix)!=1);
1371 vc->vc_complement_mask = vc->vc_can_do_color ? 0x7700 : 0x0800;
1372 if (vc->vc_font.charcount == 256) {
1373 vc->vc_hi_font_mask = 0;
1375 vc->vc_hi_font_mask = 0x100;
1376 if (vc->vc_can_do_color)
1377 vc->vc_complement_mask <<= 1;
1382 if (!*vc->uni_pagedict_loc)
1383 con_copy_unimap(vc, svc);
1387 cols /= vc->vc_font.width;
1388 rows /= vc->vc_font.height;
1389 vc_resize(vc, cols, rows);
1391 if (con_is_visible(vc)) {
1392 update_screen(vc);
1396 static __inline__ void ywrap_up(struct vc_data *vc, int count)
1398 struct fb_info *info = fbcon_info_from_console(vc->vc_num);
1400 struct fbcon_display *p = &fb_display[vc->vc_num];
1406 ops->var.yoffset = p->yscroll * vc->vc_font.height;
1415 static __inline__ void ywrap_down(struct vc_data *vc, int count)
1417 struct fb_info *info = fbcon_info_from_console(vc->vc_num);
1419 struct fbcon_display *p = &fb_display[vc->vc_num];
1425 ops->var.yoffset = p->yscroll * vc->vc_font.height;
1434 static __inline__ void ypan_up(struct vc_data *vc, int count)
1436 struct fb_info *info = fbcon_info_from_console(vc->vc_num);
1437 struct fbcon_display *p = &fb_display[vc->vc_num];
1441 if (p->yscroll > p->vrows - vc->vc_rows) {
1442 ops->bmove(vc, info, p->vrows - vc->vc_rows,
1443 0, 0, 0, vc->vc_rows, vc->vc_cols);
1444 p->yscroll -= p->vrows - vc->vc_rows;
1448 ops->var.yoffset = p->yscroll * vc->vc_font.height;
1451 fbcon_clear_margins(vc, 1);
1458 static __inline__ void ypan_up_redraw(struct vc_data *vc, int t, int count)
1460 struct fb_info *info = fbcon_info_from_console(vc->vc_num);
1462 struct fbcon_display *p = &fb_display[vc->vc_num];
1466 if (p->yscroll > p->vrows - vc->vc_rows) {
1467 p->yscroll -= p->vrows - vc->vc_rows;
1468 fbcon_redraw_move(vc, p, t + count, vc->vc_rows - count, t);
1472 ops->var.yoffset = p->yscroll * vc->vc_font.height;
1475 fbcon_clear_margins(vc, 1);
1482 static __inline__ void ypan_down(struct vc_data *vc, int count)
1484 struct fb_info *info = fbcon_info_from_console(vc->vc_num);
1485 struct fbcon_display *p = &fb_display[vc->vc_num];
1490 ops->bmove(vc, info, 0, 0, p->vrows - vc->vc_rows,
1491 0, vc->vc_rows, vc->vc_cols);
1492 p->yscroll += p->vrows - vc->vc_rows;
1496 ops->var.yoffset = p->yscroll * vc->vc_font.height;
1499 fbcon_clear_margins(vc, 1);
1506 static __inline__ void ypan_down_redraw(struct vc_data *vc, int t, int count)
1508 struct fb_info *info = fbcon_info_from_console(vc->vc_num);
1510 struct fbcon_display *p = &fb_display[vc->vc_num];
1515 p->yscroll += p->vrows - vc->vc_rows;
1516 fbcon_redraw_move(vc, p, t, vc->vc_rows - count, t + count);
1520 ops->var.yoffset = p->yscroll * vc->vc_font.height;
1523 fbcon_clear_margins(vc, 1);
1530 static void fbcon_redraw_move(struct vc_data *vc, struct fbcon_display *p,
1534 (vc->vc_origin + vc->vc_size_row * line);
1548 fbcon_putcs(vc, start, s - start,
1558 fbcon_putcs(vc, start, s - start, dy, x);
1564 static void fbcon_redraw_blit(struct vc_data *vc, struct fb_info *info,
1567 int offset = ycount * vc->vc_cols;
1569 (vc->vc_origin + vc->vc_size_row * line);
1584 ops->bmove(vc, info, line + ycount, x,
1600 ops->bmove(vc, info, line + ycount, x, line, x, 1,
1608 s -= vc->vc_size_row;
1609 d -= vc->vc_size_row;
1614 static void fbcon_redraw(struct vc_data *vc, int line, int count, int offset)
1617 (vc->vc_origin + vc->vc_size_row * line);
1632 fbcon_putcs(vc, start, s - start,
1640 fbcon_putcs(vc, start, s - start,
1655 fbcon_putcs(vc, start, s - start, line, x);
1662 s -= vc->vc_size_row;
1663 d -= vc->vc_size_row;
1668 static void fbcon_bmove_rec(struct vc_data *vc, struct fbcon_display *p, int sy, int sx,
1671 struct fb_info *info = fbcon_info_from_console(vc->vc_num);
1678 fbcon_bmove_rec(vc, p, sy, sx, dy, dx, b, width,
1680 fbcon_bmove_rec(vc, p, sy + b, sx, dy + b, dx,
1683 fbcon_bmove_rec(vc, p, sy + b, sx, dy + b, dx,
1685 fbcon_bmove_rec(vc, p, sy, sx, dy, dx, b, width,
1694 fbcon_bmove_rec(vc, p, sy, sx, dy, dx, b, width,
1696 fbcon_bmove_rec(vc, p, sy + b, sx, dy + b, dx,
1699 fbcon_bmove_rec(vc, p, sy + b, sx, dy + b, dx,
1701 fbcon_bmove_rec(vc, p, sy, sx, dy, dx, b, width,
1706 ops->bmove(vc, info, real_y(p, sy), sx, real_y(p, dy), dx,
1710 static void fbcon_bmove(struct vc_data *vc, int sy, int sx, int dy, int dx,
1713 struct fb_info *info = fbcon_info_from_console(vc->vc_num);
1714 struct fbcon_display *p = &fb_display[vc->vc_num];
1716 if (fbcon_is_inactive(vc, info))
1729 fbcon_bmove_rec(vc, p, sy, sx, dy, dx, height, width,
1733 static bool fbcon_scroll(struct vc_data *vc, unsigned int t, unsigned int b,
1736 struct fb_info *info = fbcon_info_from_console(vc->vc_num);
1737 struct fbcon_display *p = &fb_display[vc->vc_num];
1740 if (fbcon_is_inactive(vc, info))
1743 fbcon_cursor(vc, false);
1753 if (count > vc->vc_rows) /* Maximum realistic size */
1754 count = vc->vc_rows;
1757 fbcon_redraw_blit(vc, info, p, t, b - t - count,
1759 __fbcon_clear(vc, b - count, 0, count, vc->vc_cols);
1760 scr_memsetw((unsigned short *) (vc->vc_origin +
1761 vc->vc_size_row *
1763 vc->vc_video_erase_char,
1764 vc->vc_size_row * count);
1768 if (b - t - count > 3 * vc->vc_rows >> 2) {
1770 fbcon_bmove(vc, 0, 0, count, 0, t,
1771 vc->vc_cols);
1772 ywrap_up(vc, count);
1773 if (vc->vc_rows - b > 0)
1774 fbcon_bmove(vc, b - count, 0, b, 0,
1775 vc->vc_rows - b,
1776 vc->vc_cols);
1778 fbcon_bmove(vc, t + count, 0, t, 0,
1779 b - t - count, vc->vc_cols);
1782 __fbcon_clear(vc, b - count, 0, count, vc->vc_cols);
1787 2 * (p->vrows - vc->vc_rows))
1788 && ((!scroll_partial && (b - t == vc->vc_rows))
1791 3 * vc->vc_rows >> 2)))) {
1793 fbcon_redraw_move(vc, p, 0, t, count);
1794 ypan_up_redraw(vc, t, count);
1795 if (vc->vc_rows - b > 0)
1796 fbcon_redraw_move(vc, p, b,
1797 vc->vc_rows - b, b);
1799 fbcon_redraw_move(vc, p, t + count, b - t - count, t);
1800 __fbcon_clear(vc, b - count, 0, count, vc->vc_cols);
1805 2 * (p->vrows - vc->vc_rows))
1806 && ((!scroll_partial && (b - t == vc->vc_rows))
1809 3 * vc->vc_rows >> 2)))) {
1811 fbcon_bmove(vc, 0, 0, count, 0, t,
1812 vc->vc_cols);
1813 ypan_up(vc, count);
1814 if (vc->vc_rows - b > 0)
1815 fbcon_bmove(vc, b - count, 0, b, 0,
1816 vc->vc_rows - b,
1817 vc->vc_cols);
1819 fbcon_bmove(vc, t + count, 0, t, 0,
1820 b - t - count, vc->vc_cols);
1823 __fbcon_clear(vc, b - count, 0, count, vc->vc_cols);
1828 fbcon_redraw(vc, t, b - t - count,
1829 count * vc->vc_cols);
1830 __fbcon_clear(vc, b - count, 0, count, vc->vc_cols);
1831 scr_memsetw((unsigned short *) (vc->vc_origin +
1832 vc->vc_size_row *
1834 vc->vc_video_erase_char,
1835 vc->vc_size_row * count);
1841 if (count > vc->vc_rows) /* Maximum realistic size */
1842 count = vc->vc_rows;
1845 fbcon_redraw_blit(vc, info, p, b - 1, b - t - count,
1847 __fbcon_clear(vc, t, 0, count, vc->vc_cols);
1848 scr_memsetw((unsigned short *) (vc->vc_origin +
1849 vc->vc_size_row *
1851 vc->vc_video_erase_char,
1852 vc->vc_size_row * count);
1856 if (b - t - count > 3 * vc->vc_rows >> 2) {
1857 if (vc->vc_rows - b > 0)
1858 fbcon_bmove(vc, b, 0, b - count, 0,
1859 vc->vc_rows - b,
1860 vc->vc_cols);
1861 ywrap_down(vc, count);
1863 fbcon_bmove(vc, count, 0, 0, 0, t,
1864 vc->vc_cols);
1866 fbcon_bmove(vc, t, 0, t + count, 0,
1867 b - t - count, vc->vc_cols);
1870 __fbcon_clear(vc, t, 0, count, vc->vc_cols);
1874 if ((count - p->yscroll <= p->vrows - vc->vc_rows)
1875 && ((!scroll_partial && (b - t == vc->vc_rows))
1878 3 * vc->vc_rows >> 2)))) {
1879 if (vc->vc_rows - b > 0)
1880 fbcon_bmove(vc, b, 0, b - count, 0,
1881 vc->vc_rows - b,
1882 vc->vc_cols);
1883 ypan_down(vc, count);
1885 fbcon_bmove(vc, count, 0, 0, 0, t,
1886 vc->vc_cols);
1888 fbcon_bmove(vc, t, 0, t + count, 0,
1889 b - t - count, vc->vc_cols);
1892 __fbcon_clear(vc, t, 0, count, vc->vc_cols);
1896 if ((count - p->yscroll <= p->vrows - vc->vc_rows)
1897 && ((!scroll_partial && (b - t == vc->vc_rows))
1900 3 * vc->vc_rows >> 2)))) {
1901 if (vc->vc_rows - b > 0)
1902 fbcon_redraw_move(vc, p, b, vc->vc_rows - b,
1904 ypan_down_redraw(vc, t, count);
1906 fbcon_redraw_move(vc, p, count, t, 0);
1908 fbcon_redraw_move(vc, p, t, b - t - count, t + count);
1909 __fbcon_clear(vc, t, 0, count, vc->vc_cols);
1914 fbcon_redraw(vc, b - 1, b - t - count,
1915 -count * vc->vc_cols);
1916 __fbcon_clear(vc, t, 0, count, vc->vc_cols);
1917 scr_memsetw((unsigned short *) (vc->vc_origin +
1918 vc->vc_size_row *
1920 vc->vc_video_erase_char,
1921 vc->vc_size_row * count);
1931 struct vc_data *vc)
1944 divides(ypan, vc->vc_font.height) && vyres > yres;
1946 divides(ywrap, vc->vc_font.height) &&
1947 divides(vc->vc_font.height, vyres) &&
1948 divides(vc->vc_font.height, yres);
1973 struct vc_data *vc)
1976 int fh = vc->vc_font.height;
1982 if (yres > (fh * (vc->vc_rows + 1)))
1983 p->vrows -= (yres - (fh * vc->vc_rows)) / fh;
1988 updatescrollmode_accel(p, info, vc);
1994 static int fbcon_resize(struct vc_data *vc, unsigned int width,
1997 struct fb_info *info = fbcon_info_from_console(vc->vc_num);
1999 struct fbcon_display *p = &fb_display[vc->vc_num];
2003 if (p->userfont && FNTSIZE(vc->vc_font.data)) {
2005 int pitch = PITCH(vc->vc_font.width);
2016 size = CALC_FONTSZ(vc->vc_font.height, pitch, vc->vc_font.charcount);
2017 if (size > FNTSIZE(vc->vc_font.data))
2023 virt_fw = FBCON_SWAP(ops->rotate, vc->vc_font.width,
2024 vc->vc_font.height);
2025 virt_fh = FBCON_SWAP(ops->rotate, vc->vc_font.height,
2026 vc->vc_font.width);
2046 if (con_is_visible(vc) && vc->vc_mode == KD_TEXT) {
2054 updatescrollmode(p, info, vc);
2058 static bool fbcon_switch(struct vc_data *vc)
2062 struct fbcon_display *p = &fb_display[vc->vc_num];
2066 info = fbcon_info_from_console(vc->vc_num);
2087 * info->currcon = vc->vc_num;
2093 o->currcon = vc->vc_num;
2124 if (fbcon_is_inactive(vc, info) ||
2130 set_blitting_type(vc, info);
2133 if (ops->rotate_font && ops->rotate_font(info, vc)) {
2135 set_blitting_type(vc, info);
2138 vc->vc_can_do_color = (fb_get_color_depth(&info->var, &info->fix)!=1);
2139 vc->vc_complement_mask = vc->vc_can_do_color ? 0x7700 : 0x0800;
2141 if (vc->vc_font.charcount > 256)
2142 vc->vc_complement_mask <<= 1;
2144 updatescrollmode(p, info, vc);
2148 scrollback_phys_max = p->vrows - vc->vc_rows;
2152 scrollback_phys_max = p->vrows - 2 * vc->vc_rows;
2164 if (!fbcon_is_inactive(vc, info)) {
2169 fbcon_set_palette(vc, color_table);
2170 fbcon_clear_margins(vc, 0);
2176 update_region(vc,
2177 vc->vc_origin + vc->vc_size_row * vc->vc_top,
2178 vc->vc_size_row * (vc->vc_bottom -
2179 vc->vc_top) / 2);
2185 static void fbcon_generic_blank(struct vc_data *vc, struct fb_info *info,
2189 unsigned short charmask = vc->vc_hi_font_mask ?
2193 oldc = vc->vc_video_erase_char;
2194 vc->vc_video_erase_char &= charmask;
2195 __fbcon_clear(vc, 0, 0, vc->vc_rows, vc->vc_cols);
2196 vc->vc_video_erase_char = oldc;
2200 static bool fbcon_blank(struct vc_data *vc, enum vesa_blank_mode blank,
2203 struct fb_info *info = fbcon_info_from_console(vc->vc_num);
2220 if (!fbcon_is_inactive(vc, info)) {
2223 fbcon_cursor(vc, !blank);
2227 fbcon_generic_blank(vc, info, blank);
2231 update_screen(vc);
2234 if (mode_switch || fbcon_is_inactive(vc, info) ||
2243 static void fbcon_debug_enter(struct vc_data *vc)
2245 struct fb_info *info = fbcon_info_from_console(vc->vc_num);
2252 fbcon_set_palette(vc, color_table);
2255 static void fbcon_debug_leave(struct vc_data *vc)
2257 struct fb_info *info = fbcon_info_from_console(vc->vc_num);
2265 static int fbcon_get_font(struct vc_data *vc, struct console_font *font, unsigned int vpitch)
2267 u8 *fontdata = vc->vc_font.data;
2271 font->width = vc->vc_font.width;
2272 font->height = vc->vc_font.height;
2275 font->charcount = vc->vc_hi_font_mask ? 512 : 256;
2280 j = vc->vc_font.height;
2291 j = vc->vc_font.height * 2;
2302 if (font->charcount * (vc->vc_font.height * sizeof(u32)) > FNTSIZE(fontdata))
2306 for (j = 0; j < vc->vc_font.height; j++) {
2316 j = vc->vc_font.height * 4;
2330 /* set/clear vc_hi_font_mask and update vc attrs accordingly */
2331 static void set_vc_hi_font(struct vc_data *vc, bool set)
2334 vc->vc_hi_font_mask = 0;
2335 if (vc->vc_can_do_color) {
2336 vc->vc_complement_mask >>= 1;
2337 vc->vc_s_complement_mask >>= 1;
2341 if (vc->vc_can_do_color) {
2343 (unsigned short *) vc->vc_origin;
2344 int count = vc->vc_screenbuf_size / 2;
2351 c = vc->vc_video_erase_char;
2352 vc->vc_video_erase_char =
2354 vc->vc_attr >>= 1;
2357 vc->vc_hi_font_mask = 0x100;
2358 if (vc->vc_can_do_color) {
2359 vc->vc_complement_mask <<= 1;
2360 vc->vc_s_complement_mask <<= 1;
2366 (unsigned short *) vc->vc_origin;
2367 int count = vc->vc_screenbuf_size / 2;
2372 if (vc->vc_can_do_color)
2380 c = vc->vc_video_erase_char;
2381 if (vc->vc_can_do_color) {
2382 vc->vc_video_erase_char =
2384 vc->vc_attr <<= 1;
2386 vc->vc_video_erase_char = c & ~0x100;
2391 static int fbcon_do_set_font(struct vc_data *vc, int w, int h, int charcount,
2394 struct fb_info *info = fbcon_info_from_console(vc->vc_num);
2396 struct fbcon_display *p = &fb_display[vc->vc_num];
2398 u8 *old_data = vc->vc_font.data;
2400 resize = (w != vc->vc_font.width) || (h != vc->vc_font.height);
2401 vc->vc_font.data = (void *)(p->fontdata = data);
2406 old_width = vc->vc_font.width;
2407 old_height = vc->vc_font.height;
2408 old_charcount = vc->vc_font.charcount;
2410 vc->vc_font.width = w;
2411 vc->vc_font.height = h;
2412 vc->vc_font.charcount = charcount;
2413 if (vc->vc_hi_font_mask && charcount == 256)
2414 set_vc_hi_font(vc, false);
2415 else if (!vc->vc_hi_font_mask && charcount == 512)
2416 set_vc_hi_font(vc, true);
2425 ret = vc_resize(vc, cols, rows);
2428 } else if (con_is_visible(vc)
2429 && vc->vc_mode == KD_TEXT) {
2430 fbcon_clear_margins(vc, 0);
2431 update_screen(vc);
2440 vc->vc_font.data = old_data;
2448 vc->vc_font.width = old_width;
2449 vc->vc_font.height = old_height;
2450 vc->vc_font.charcount = old_charcount;
2460 static int fbcon_set_font(struct vc_data *vc, const struct console_font *font,
2463 struct fb_info *info = fbcon_info_from_console(vc->vc_num);
2530 return fbcon_do_set_font(vc, font->width, font->height, charcount, new_data, 1);
2533 static int fbcon_set_def_font(struct vc_data *vc, struct console_font *font,
2536 struct fb_info *info = fbcon_info_from_console(vc->vc_num);
2547 return fbcon_do_set_font(vc, f->width, f->height, f->charcount, f->data, 0);
2558 static void fbcon_set_palette(struct vc_data *vc, const unsigned char *table)
2560 struct fb_info *info = fbcon_info_from_console(vc->vc_num);
2564 if (fbcon_is_inactive(vc, info))
2567 if (!con_is_visible(vc))
2574 val = vc->vc_palette[j++];
2576 val = vc->vc_palette[j++];
2578 val = vc->vc_palette[j++];
2595 static void fbcon_invert_region(struct vc_data *vc, u16 * p, int cnt)
2599 if (!vc->vc_can_do_color)
2601 else if (vc->vc_hi_font_mask == 0x100)
2613 struct vc_data *vc = NULL;
2618 vc = vc_cons[ops->currcon].d;
2621 fbcon_cursor(vc, false);
2626 struct vc_data *vc;
2631 vc = vc_cons[ops->currcon].d;
2633 update_screen(vc);
2639 struct vc_data *vc;
2645 vc = vc_cons[ops->currcon].d;
2646 if (vc->vc_mode != KD_TEXT ||
2650 p = &fb_display[vc->vc_num];
2651 set_blitting_type(vc, info);
2653 if (con_is_visible(vc)) {
2657 cols /= vc->vc_font.width;
2658 rows /= vc->vc_font.height;
2659 vc_resize(vc, cols, rows);
2660 updatescrollmode(p, info, vc);
2664 if (!fbcon_is_inactive(vc, info)) {
2669 fbcon_set_palette(vc, color_table);
2670 update_screen(vc);
2677 struct vc_data *vc;
2685 vc = vc_cons[i].d;
2686 if (!vc || vc->vc_mode != KD_TEXT ||
2690 if (con_is_visible(vc)) {
2695 p = &fb_display[vc->vc_num];
2696 set_blitting_type(vc, info);
2700 cols /= vc->vc_font.width;
2701 rows /= vc->vc_font.height;
2702 vc_resize(vc, cols, rows);
2723 struct vc_data *vc;
2733 vc = vc_cons[i].d;
2734 if (!vc || vc->vc_mode != KD_TEXT ||
2738 if (vc->vc_font.width > FBCON_SWAP(var->rotate, var->xres, var->yres) ||
2739 vc->vc_font.height > FBCON_SWAP(var->rotate, var->yres, var->xres))
3001 struct vc_data *vc;
3006 vc = vc_cons[ops->currcon].d;
3007 if (vc->vc_mode != KD_TEXT ||
3011 if (con_is_visible(vc)) {
3023 struct vc_data *vc;
3032 vc = vc_cons[i].d;
3037 fbcon_set_disp(info, &var, vc->vc_num);
3044 struct vc_data *vc;
3050 vc = vc_cons[i].d;
3051 if (vc && vc->vc_mode == KD_TEXT &&
3053 set_bit(vc->vc_font.width - 1, caps->x);
3054 set_bit(vc->vc_font.height - 1, caps->y);
3055 charcnt = vc->vc_font.charcount;
3061 vc = vc_cons[fg_console].d;
3063 if (vc && vc->vc_mode == KD_TEXT &&
3066 set_bit(vc->vc_font.width - 1, caps->x);
3068 set_bit(vc->vc_font.height - 1, caps->y);
3069 caps->len = vc->vc_font.charcount;