Lines Matching +full:current +full:- +full:rotate
2 * linux/drivers/video/fbcon.c -- Low level frame buffer based console driver
27 * Hardware cursor support added by Emmanuel Marty (core@ggi-project.org)
34 * 2001 - Documented with DocBook
35 * - Brad Douglas <brad@neruo.com>
51 * - Implement 16 plane mode (iplan2p16)
88 * - fbcon state itself is protected by the console_lock, and the code does a
91 * - fbcon doesn't bother with fb_lock/unlock at all. This is buggy, since it
101 FBCON_LOGO_CANSHOW = -1, /* the logo can be shown */
102 FBCON_LOGO_DRAW = -2, /* draw the logo to a console */
103 FBCON_LOGO_DONTSHOW = -3 /* do not show the logo */
131 static unsigned int last_fb_vc = MAX_NR_CONSOLES - 1;
133 static int primary_device = -1;
158 /* current fb_info */
159 static int info_idx = -1;
162 static int initial_rotation = -1;
168 #define advance_row(p, delta) (unsigned short *)((unsigned long)(p) + (delta) * vc->vc_size_row)
196 struct fbcon_ops *ops = info->fbcon_par; in fbcon_set_rotation()
198 if (!(info->flags & FBINFO_MISC_TILEBLITTING) && in fbcon_set_rotation()
199 ops->p->con_rotate < 4) in fbcon_set_rotation()
200 ops->rotate = ops->p->con_rotate; in fbcon_set_rotation()
202 ops->rotate = 0; in fbcon_set_rotation()
205 static void fbcon_rotate(struct fb_info *info, u32 rotate) in fbcon_rotate() argument
207 struct fbcon_ops *ops= info->fbcon_par; in fbcon_rotate()
210 if (!ops || ops->currcon == -1) in fbcon_rotate()
213 fb_info = fbcon_info_from_console(ops->currcon); in fbcon_rotate()
216 struct fbcon_display *p = &fb_display[ops->currcon]; in fbcon_rotate()
218 if (rotate < 4) in fbcon_rotate()
219 p->con_rotate = rotate; in fbcon_rotate()
221 p->con_rotate = 0; in fbcon_rotate()
227 static void fbcon_rotate_all(struct fb_info *info, u32 rotate) in fbcon_rotate_all() argument
229 struct fbcon_ops *ops = info->fbcon_par; in fbcon_rotate_all()
234 if (!ops || ops->currcon < 0 || rotate > 3) in fbcon_rotate_all()
239 if (!vc || vc->vc_mode != KD_TEXT || in fbcon_rotate_all()
243 p = &fb_display[vc->vc_num]; in fbcon_rotate_all()
244 p->con_rotate = rotate; in fbcon_rotate_all()
252 struct fbcon_ops *ops = info->fbcon_par; in fbcon_set_rotation()
254 ops->rotate = FB_ROTATE_UR; in fbcon_set_rotation()
257 static void fbcon_rotate(struct fb_info *info, u32 rotate) in fbcon_rotate() argument
262 static void fbcon_rotate_all(struct fb_info *info, u32 rotate) in fbcon_rotate_all() argument
270 struct fbcon_ops *ops = info->fbcon_par; in fbcon_get_rotate()
272 return (ops) ? ops->rotate : 0; in fbcon_get_rotate()
278 * oops_in_progress instead, but non-fatal oops won't be printed. in fbcon_skip_panic()
281 return (info->skip_panic && unlikely(oops_in_progress)); in fbcon_skip_panic()
283 return (info->skip_panic && unlikely(atomic_read(&panic_cpu) != PANIC_CPU_INVALID)); in fbcon_skip_panic()
289 struct fbcon_ops *ops = info->fbcon_par; in fbcon_is_inactive()
291 return (info->state != FBINFO_STATE_RUNNING || in fbcon_is_inactive()
292 vc->vc_mode != KD_TEXT || ops->graphics || fbcon_skip_panic(info)); in fbcon_is_inactive()
298 int depth = fb_get_color_depth(&info->var, &info->fix); in get_color()
302 unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff; in get_color()
304 c = vc->vc_video_erase_char & charmask; in get_color()
308 color = (is_fg) ? attr_fgcol((vc->vc_hi_font_mask) ? 9 : 8, c) in get_color()
309 : attr_bgcol((vc->vc_hi_font_mask) ? 13 : 12, c); in get_color()
316 int fg = (info->fix.visual != FB_VISUAL_MONO01) ? col : 0; in get_color()
317 int bg = (info->fix.visual != FB_VISUAL_MONO01) ? 0 : col; in get_color()
327 * Scale down 16-colors to 4 colors. Default 4-color palette in get_color()
329 * will not work, as colors 1, 2 and 3 will be scaled-down in get_color()
331 * colors to a sane 4-level grayscale. in get_color()
350 * Last 8 entries of default 16-color palette is a more intense in get_color()
379 info = ops->info; in fb_flashcursor()
381 if (ops->currcon != -1) in fb_flashcursor()
382 vc = vc_cons[ops->currcon].d; in fb_flashcursor()
385 fbcon_info_from_console(vc->vc_num) != info || in fb_flashcursor()
386 vc->vc_deccm != 1) { in fb_flashcursor()
391 c = scr_readw((u16 *) vc->vc_pos); in fb_flashcursor()
392 enable = ops->cursor_flash && !ops->cursor_state.enable; in fb_flashcursor()
393 ops->cursor(vc, info, enable, get_color(vc, info, c, 1), in fb_flashcursor()
397 queue_delayed_work(system_power_efficient_wq, &ops->cursor_work, in fb_flashcursor()
398 ops->cur_blink_jiffies); in fb_flashcursor()
403 struct fbcon_ops *ops = info->fbcon_par; in fbcon_add_cursor_work()
406 queue_delayed_work(system_power_efficient_wq, &ops->cursor_work, in fbcon_add_cursor_work()
407 ops->cur_blink_jiffies); in fbcon_add_cursor_work()
412 struct fbcon_ops *ops = info->fbcon_par; in fbcon_del_cursor_work()
414 cancel_delayed_work_sync(&ops->cursor_work); in fbcon_del_cursor_work()
444 (options[j++]-'0') % FB_MAX; in fb_console_setup()
455 first_fb_vc = simple_strtoul(options, &options, 10) - 1; in fb_console_setup()
458 if (*options++ == '-') in fb_console_setup()
459 last_fb_vc = simple_strtoul(options, &options, 10) - 1; in fb_console_setup()
461 last_fb_vc = MAX_NR_CONSOLES - 1; in fb_console_setup()
466 if (!strncmp(options, "rotate:", 7)) { in fb_console_setup()
489 if (!strncmp(options, "logo-pos:", 9)) { in fb_console_setup()
496 if (!strncmp(options, "logo-count:", 11)) { in fb_console_setup()
528 if (con2fb_map[i] != -1) { in search_for_mapped_con()
541 return -ENODEV; in do_fbcon_takeover()
554 con2fb_map[i] = -1; in do_fbcon_takeover()
555 info_idx = -1; in do_fbcon_takeover()
574 struct fbcon_ops *ops = info->fbcon_par; in fbcon_prepare_logo()
575 int cnt, erase = vc->vc_video_erase_char, step; in fbcon_prepare_logo()
579 if (info->fbops->owner) { in fbcon_prepare_logo()
588 if (fb_get_color_depth(&info->var, &info->fix) == 1) in fbcon_prepare_logo()
590 logo_height = fb_prepare_logo(info, ops->rotate); in fbcon_prepare_logo()
591 logo_lines = DIV_ROUND_UP(logo_height, vc->vc_font.height); in fbcon_prepare_logo()
592 q = (unsigned short *) (vc->vc_origin + in fbcon_prepare_logo()
593 vc->vc_size_row * rows); in fbcon_prepare_logo()
595 for (r = q - logo_lines * cols; r < q; r++) in fbcon_prepare_logo()
596 if (scr_readw(r) != vc->vc_video_erase_char) in fbcon_prepare_logo()
604 r = q - step; in fbcon_prepare_logo()
612 r = q - step - cols; in fbcon_prepare_logo()
613 for (cnt = rows - logo_lines; cnt > 0; cnt--) { in fbcon_prepare_logo()
614 scr_memcpyw(r + step, r, vc->vc_size_row); in fbcon_prepare_logo()
615 r -= cols; in fbcon_prepare_logo()
619 if (vc->state.y + logo_lines >= rows) in fbcon_prepare_logo()
620 lines = rows - vc->state.y - 1; in fbcon_prepare_logo()
623 vc->state.y += lines; in fbcon_prepare_logo()
624 vc->vc_pos += lines * vc->vc_size_row; in fbcon_prepare_logo()
627 scr_memsetw((unsigned short *) vc->vc_origin, in fbcon_prepare_logo()
629 vc->vc_size_row * logo_lines); in fbcon_prepare_logo()
631 if (con_is_visible(vc) && vc->vc_mode == KD_TEXT) { in fbcon_prepare_logo()
637 q = (unsigned short *) (vc->vc_origin + in fbcon_prepare_logo()
638 vc->vc_size_row * in fbcon_prepare_logo()
641 vc->state.y += logo_lines; in fbcon_prepare_logo()
642 vc->vc_pos += logo_lines * vc->vc_size_row; in fbcon_prepare_logo()
649 if (logo_lines > vc->vc_bottom) { in fbcon_prepare_logo()
651 pr_info("fbcon: disable boot-logo (boot-logo bigger than screen).\n"); in fbcon_prepare_logo()
654 vc->vc_top = logo_lines; in fbcon_prepare_logo()
662 struct fbcon_ops *ops = info->fbcon_par; in set_blitting_type()
664 ops->p = &fb_display[vc->vc_num]; in set_blitting_type()
666 if ((info->flags & FBINFO_MISC_TILEBLITTING)) in set_blitting_type()
678 if (info->flags & FBINFO_MISC_TILEBLITTING && in fbcon_invalid_charcount()
679 info->tileops->fb_get_tilemax(info) < charcount) in fbcon_invalid_charcount()
687 struct fbcon_ops *ops = info->fbcon_par; in set_blitting_type()
689 info->flags &= ~FBINFO_MISC_TILEBLITTING; in set_blitting_type()
690 ops->p = &fb_display[vc->vc_num]; in set_blitting_type()
705 if (info->fbops->fb_release) in fbcon_release()
706 info->fbops->fb_release(info, 0); in fbcon_release()
709 module_put(info->fbops->owner); in fbcon_release()
711 if (info->fbcon_par) { in fbcon_release()
712 struct fbcon_ops *ops = info->fbcon_par; in fbcon_release()
715 kfree(ops->cursor_state.mask); in fbcon_release()
716 kfree(ops->cursor_data); in fbcon_release()
717 kfree(ops->cursor_src); in fbcon_release()
718 kfree(ops->fontbuffer); in fbcon_release()
719 kfree(info->fbcon_par); in fbcon_release()
720 info->fbcon_par = NULL; in fbcon_release()
728 if (!try_module_get(info->fbops->owner)) in fbcon_open()
729 return -ENODEV; in fbcon_open()
732 if (info->fbops->fb_open && in fbcon_open()
733 info->fbops->fb_open(info, 0)) { in fbcon_open()
735 module_put(info->fbops->owner); in fbcon_open()
736 return -ENODEV; in fbcon_open()
743 return -ENOMEM; in fbcon_open()
746 INIT_DELAYED_WORK(&ops->cursor_work, fb_flashcursor); in fbcon_open()
747 ops->info = info; in fbcon_open()
748 info->fbcon_par = ops; in fbcon_open()
749 ops->cur_blink_jiffies = HZ / 5; in fbcon_open()
783 if (newinfo && newinfo->fbops->fb_set_par) { in con2fb_release_oldinfo()
784 ret = newinfo->fbops->fb_set_par(newinfo); in con2fb_release_oldinfo()
796 struct fbcon_ops *ops = info->fbcon_par; in con2fb_init_display()
799 ops->currcon = fg_console; in con2fb_init_display()
801 if (info->fbops->fb_set_par && !ops->initialized) { in con2fb_init_display()
802 ret = info->fbops->fb_set_par(info); in con2fb_init_display()
810 ops->initialized = true; in con2fb_init_display()
811 ops->graphics = 0; in con2fb_init_display()
812 fbcon_set_disp(info, &info->var, unit); in con2fb_init_display()
819 fbcon_prepare_logo(fg_vc, fg_info, fg_vc->vc_cols, in con2fb_init_display()
820 fg_vc->vc_rows, fg_vc->vc_cols, in con2fb_init_display()
821 fg_vc->vc_rows); in con2fb_init_display()
828 * set_con2fb_map - map console to frame buffer device
852 return -EINVAL; in set_con2fb_map()
859 if (oldidx != -1) in set_con2fb_map()
901 disp->xres_virtual = var->xres_virtual; in var_to_display()
902 disp->yres_virtual = var->yres_virtual; in var_to_display()
903 disp->bits_per_pixel = var->bits_per_pixel; in var_to_display()
904 disp->grayscale = var->grayscale; in var_to_display()
905 disp->nonstd = var->nonstd; in var_to_display()
906 disp->accel_flags = var->accel_flags; in var_to_display()
907 disp->height = var->height; in var_to_display()
908 disp->width = var->width; in var_to_display()
909 disp->red = var->red; in var_to_display()
910 disp->green = var->green; in var_to_display()
911 disp->blue = var->blue; in var_to_display()
912 disp->transp = var->transp; in var_to_display()
913 disp->rotate = var->rotate; in var_to_display()
914 disp->mode = fb_match_mode(var, &info->modelist); in var_to_display()
915 if (disp->mode == NULL) in var_to_display()
917 return -EINVAL; in var_to_display()
924 fb_videomode_to_var(var, disp->mode); in display_to_var()
925 var->xres_virtual = disp->xres_virtual; in display_to_var()
926 var->yres_virtual = disp->yres_virtual; in display_to_var()
927 var->bits_per_pixel = disp->bits_per_pixel; in display_to_var()
928 var->grayscale = disp->grayscale; in display_to_var()
929 var->nonstd = disp->nonstd; in display_to_var()
930 var->accel_flags = disp->accel_flags; in display_to_var()
931 var->height = disp->height; in display_to_var()
932 var->width = disp->width; in display_to_var()
933 var->red = disp->red; in display_to_var()
934 var->green = disp->green; in display_to_var()
935 var->blue = disp->blue; in display_to_var()
936 var->transp = disp->transp; in display_to_var()
937 var->rotate = disp->rotate; in display_to_var()
954 if (!fbcon_num_registered_fb || info_idx == -1) in fbcon_startup()
967 ops = info->fbcon_par; in fbcon_startup()
968 ops->currcon = -1; in fbcon_startup()
969 ops->graphics = 1; in fbcon_startup()
970 ops->cur_rotate = -1; in fbcon_startup()
972 p->con_rotate = initial_rotation; in fbcon_startup()
973 if (p->con_rotate == -1) in fbcon_startup()
974 p->con_rotate = info->fbcon_rotate_hint; in fbcon_startup()
975 if (p->con_rotate == -1) in fbcon_startup()
976 p->con_rotate = FB_ROTATE_UR; in fbcon_startup()
981 if (!p->fontdata) { in fbcon_startup()
983 font = get_default_font(info->var.xres, in fbcon_startup()
984 info->var.yres, in fbcon_startup()
985 info->pixmap.blit_x, in fbcon_startup()
986 info->pixmap.blit_y); in fbcon_startup()
987 vc->vc_font.width = font->width; in fbcon_startup()
988 vc->vc_font.height = font->height; in fbcon_startup()
989 vc->vc_font.data = (void *)(p->fontdata = font->data); in fbcon_startup()
990 vc->vc_font.charcount = font->charcount; in fbcon_startup()
993 cols = FBCON_SWAP(ops->rotate, info->var.xres, info->var.yres); in fbcon_startup()
994 rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres); in fbcon_startup()
995 cols /= vc->vc_font.width; in fbcon_startup()
996 rows /= vc->vc_font.height; in fbcon_startup()
999 pr_debug("mode: %s\n", info->fix.id); in fbcon_startup()
1000 pr_debug("visual: %d\n", info->fix.visual); in fbcon_startup()
1001 pr_debug("res: %dx%d-%d\n", info->var.xres, in fbcon_startup()
1002 info->var.yres, in fbcon_startup()
1003 info->var.bits_per_pixel); in fbcon_startup()
1013 struct vc_data **default_mode = vc->vc_display_fg; in fbcon_init()
1015 struct fbcon_display *t, *p = &fb_display[vc->vc_num]; in fbcon_init()
1019 if (WARN_ON(info_idx == -1)) in fbcon_init()
1022 if (con2fb_map[vc->vc_num] == -1) in fbcon_init()
1023 con2fb_map[vc->vc_num] = info_idx; in fbcon_init()
1025 info = fbcon_info_from_console(vc->vc_num); in fbcon_init()
1031 (info->fix.type == FB_TYPE_TEXT)) in fbcon_init()
1034 if (var_to_display(p, &info->var, info)) in fbcon_init()
1037 if (!info->fbcon_par) in fbcon_init()
1038 con2fb_acquire_newinfo(vc, info, vc->vc_num); in fbcon_init()
1043 if (!p->fontdata) { in fbcon_init()
1044 if (t->fontdata) { in fbcon_init()
1047 vc->vc_font.data = (void *)(p->fontdata = in fbcon_init()
1048 fvc->vc_font.data); in fbcon_init()
1049 vc->vc_font.width = fvc->vc_font.width; in fbcon_init()
1050 vc->vc_font.height = fvc->vc_font.height; in fbcon_init()
1051 vc->vc_font.charcount = fvc->vc_font.charcount; in fbcon_init()
1052 p->userfont = t->userfont; in fbcon_init()
1054 if (p->userfont) in fbcon_init()
1055 REFCOUNT(p->fontdata)++; in fbcon_init()
1060 font = get_default_font(info->var.xres, in fbcon_init()
1061 info->var.yres, in fbcon_init()
1062 info->pixmap.blit_x, in fbcon_init()
1063 info->pixmap.blit_y); in fbcon_init()
1064 vc->vc_font.width = font->width; in fbcon_init()
1065 vc->vc_font.height = font->height; in fbcon_init()
1066 vc->vc_font.data = (void *)(p->fontdata = font->data); in fbcon_init()
1067 vc->vc_font.charcount = font->charcount; in fbcon_init()
1071 vc->vc_can_do_color = (fb_get_color_depth(&info->var, &info->fix)!=1); in fbcon_init()
1072 vc->vc_complement_mask = vc->vc_can_do_color ? 0x7700 : 0x0800; in fbcon_init()
1073 if (vc->vc_font.charcount == 256) { in fbcon_init()
1074 vc->vc_hi_font_mask = 0; in fbcon_init()
1076 vc->vc_hi_font_mask = 0x100; in fbcon_init()
1077 if (vc->vc_can_do_color) in fbcon_init()
1078 vc->vc_complement_mask <<= 1; in fbcon_init()
1081 if (!*svc->uni_pagedict_loc) in fbcon_init()
1083 if (!*vc->uni_pagedict_loc) in fbcon_init()
1086 ops = info->fbcon_par; in fbcon_init()
1087 ops->cur_blink_jiffies = msecs_to_jiffies(vc->vc_cur_blink_ms); in fbcon_init()
1089 p->con_rotate = initial_rotation; in fbcon_init()
1090 if (p->con_rotate == -1) in fbcon_init()
1091 p->con_rotate = info->fbcon_rotate_hint; in fbcon_init()
1092 if (p->con_rotate == -1) in fbcon_init()
1093 p->con_rotate = FB_ROTATE_UR; in fbcon_init()
1097 cols = vc->vc_cols; in fbcon_init()
1098 rows = vc->vc_rows; in fbcon_init()
1099 new_cols = FBCON_SWAP(ops->rotate, info->var.xres, info->var.yres); in fbcon_init()
1100 new_rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres); in fbcon_init()
1101 new_cols /= vc->vc_font.width; in fbcon_init()
1102 new_rows /= vc->vc_font.height; in fbcon_init()
1111 if (con_is_visible(vc) && vc->vc_mode == KD_TEXT) { in fbcon_init()
1112 if (info->fbops->fb_set_par && !ops->initialized) { in fbcon_init()
1113 ret = info->fbops->fb_set_par(info); in fbcon_init()
1121 ops->initialized = true; in fbcon_init()
1124 ops->graphics = 0; in fbcon_init()
1127 if ((info->flags & FBINFO_HWACCEL_COPYAREA) && in fbcon_init()
1128 !(info->flags & FBINFO_HWACCEL_DISABLED)) in fbcon_init()
1129 p->scrollmode = SCROLL_MOVE; in fbcon_init()
1131 p->scrollmode = SCROLL_REDRAW; in fbcon_init()
1140 vc->vc_cols = new_cols; in fbcon_init()
1141 vc->vc_rows = new_rows; in fbcon_init()
1148 if (ops->rotate_font && ops->rotate_font(info, vc)) { in fbcon_init()
1149 ops->rotate = FB_ROTATE_UR; in fbcon_init()
1153 ops->p = &fb_display[fg_console]; in fbcon_init()
1158 if (p->userfont && p->fontdata && (--REFCOUNT(p->fontdata) == 0)) in fbcon_free_font()
1159 kfree(p->fontdata - FONT_EXTRA_WORDS * sizeof(int)); in fbcon_free_font()
1160 p->fontdata = NULL; in fbcon_free_font()
1161 p->userfont = 0; in fbcon_free_font()
1178 con2fb_map[j] = -1; in fbcon_release_all()
1189 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_deinit()
1195 idx = con2fb_map[vc->vc_num]; in fbcon_deinit()
1197 if (idx == -1) in fbcon_deinit()
1205 ops = info->fbcon_par; in fbcon_deinit()
1213 ops->initialized = false; in fbcon_deinit()
1217 vc->vc_font.data = NULL; in fbcon_deinit()
1219 if (vc->vc_hi_font_mask && vc->vc_screenbuf) in fbcon_deinit()
1225 if (vc->vc_num == logo_shown) in fbcon_deinit()
1233 /* fbcon_XXX routines - interface used by the world
1240 * handles y values in range [0, scr_height-1] that correspond to real
1243 * bitmap offsets and deal with the wrap-around case by splitting blits.
1245 * fbcon_bmove_physical_8() -- These functions fast implementations
1246 * fbcon_clear_physical_8() -- of original fbcon_XXX fns.
1247 * fbcon_putc_physical_8() -- (font width != 8) may be added later
1259 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in __fbcon_clear()
1260 struct fbcon_ops *ops = info->fbcon_par; in __fbcon_clear()
1262 struct fbcon_display *p = &fb_display[vc->vc_num]; in __fbcon_clear()
1271 if (sy < vc->vc_top && vc->vc_top == logo_lines) { in __fbcon_clear()
1272 vc->vc_top = 0; in __fbcon_clear()
1275 * dimensions then the ops->clear below won't end up clearing in __fbcon_clear()
1284 y_break = p->vrows - p->yscroll; in __fbcon_clear()
1285 if (sy < y_break && sy + height - 1 >= y_break) { in __fbcon_clear()
1286 u_int b = y_break - sy; in __fbcon_clear()
1287 ops->clear(vc, info, real_y(p, sy), sx, b, width); in __fbcon_clear()
1288 ops->clear(vc, info, real_y(p, sy + b), sx, height - b, in __fbcon_clear()
1291 ops->clear(vc, info, real_y(p, sy), sx, height, width); in __fbcon_clear()
1303 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_putcs()
1304 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_putcs()
1305 struct fbcon_ops *ops = info->fbcon_par; in fbcon_putcs()
1308 ops->putcs(vc, info, s, count, real_y(p, ypos), xpos, in fbcon_putcs()
1315 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_clear_margins()
1316 struct fbcon_ops *ops = info->fbcon_par; in fbcon_clear_margins()
1319 ops->clear_margins(vc, info, margin_color, bottom_only); in fbcon_clear_margins()
1324 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_cursor()
1325 struct fbcon_ops *ops = info->fbcon_par; in fbcon_cursor()
1326 int c = scr_readw((u16 *) vc->vc_pos); in fbcon_cursor()
1328 ops->cur_blink_jiffies = msecs_to_jiffies(vc->vc_cur_blink_ms); in fbcon_cursor()
1330 if (fbcon_is_inactive(vc, info) || vc->vc_deccm != 1) in fbcon_cursor()
1333 if (vc->vc_cursor_type & CUR_SW) in fbcon_cursor()
1338 ops->cursor_flash = enable; in fbcon_cursor()
1340 if (!ops->cursor) in fbcon_cursor()
1343 ops->cursor(vc, info, enable, get_color(vc, info, c, 1), in fbcon_cursor()
1357 struct fbcon_ops *ops = info->fbcon_par; in fbcon_set_disp()
1370 default_mode = vc->vc_display_fg; in fbcon_set_disp()
1372 t = &fb_display[svc->vc_num]; in fbcon_set_disp()
1374 if (!vc->vc_font.data) { in fbcon_set_disp()
1375 vc->vc_font.data = (void *)(p->fontdata = t->fontdata); in fbcon_set_disp()
1376 vc->vc_font.width = (*default_mode)->vc_font.width; in fbcon_set_disp()
1377 vc->vc_font.height = (*default_mode)->vc_font.height; in fbcon_set_disp()
1378 vc->vc_font.charcount = (*default_mode)->vc_font.charcount; in fbcon_set_disp()
1379 p->userfont = t->userfont; in fbcon_set_disp()
1380 if (p->userfont) in fbcon_set_disp()
1381 REFCOUNT(p->fontdata)++; in fbcon_set_disp()
1384 var->activate = FB_ACTIVATE_NOW; in fbcon_set_disp()
1385 info->var.activate = var->activate; in fbcon_set_disp()
1386 var->yoffset = info->var.yoffset; in fbcon_set_disp()
1387 var->xoffset = info->var.xoffset; in fbcon_set_disp()
1389 ops->var = info->var; in fbcon_set_disp()
1390 vc->vc_can_do_color = (fb_get_color_depth(&info->var, &info->fix)!=1); in fbcon_set_disp()
1391 vc->vc_complement_mask = vc->vc_can_do_color ? 0x7700 : 0x0800; in fbcon_set_disp()
1392 if (vc->vc_font.charcount == 256) { in fbcon_set_disp()
1393 vc->vc_hi_font_mask = 0; in fbcon_set_disp()
1395 vc->vc_hi_font_mask = 0x100; in fbcon_set_disp()
1396 if (vc->vc_can_do_color) in fbcon_set_disp()
1397 vc->vc_complement_mask <<= 1; in fbcon_set_disp()
1400 if (!*svc->uni_pagedict_loc) in fbcon_set_disp()
1402 if (!*vc->uni_pagedict_loc) in fbcon_set_disp()
1405 cols = FBCON_SWAP(ops->rotate, info->var.xres, info->var.yres); in fbcon_set_disp()
1406 rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres); in fbcon_set_disp()
1407 cols /= vc->vc_font.width; in fbcon_set_disp()
1408 rows /= vc->vc_font.height; in fbcon_set_disp()
1418 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in ywrap_up()
1419 struct fbcon_ops *ops = info->fbcon_par; in ywrap_up()
1420 struct fbcon_display *p = &fb_display[vc->vc_num]; in ywrap_up()
1422 p->yscroll += count; in ywrap_up()
1423 if (p->yscroll >= p->vrows) /* Deal with wrap */ in ywrap_up()
1424 p->yscroll -= p->vrows; in ywrap_up()
1425 ops->var.xoffset = 0; in ywrap_up()
1426 ops->var.yoffset = p->yscroll * vc->vc_font.height; in ywrap_up()
1427 ops->var.vmode |= FB_VMODE_YWRAP; in ywrap_up()
1428 ops->update_start(info); in ywrap_up()
1437 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in ywrap_down()
1438 struct fbcon_ops *ops = info->fbcon_par; in ywrap_down()
1439 struct fbcon_display *p = &fb_display[vc->vc_num]; in ywrap_down()
1441 p->yscroll -= count; in ywrap_down()
1442 if (p->yscroll < 0) /* Deal with wrap */ in ywrap_down()
1443 p->yscroll += p->vrows; in ywrap_down()
1444 ops->var.xoffset = 0; in ywrap_down()
1445 ops->var.yoffset = p->yscroll * vc->vc_font.height; in ywrap_down()
1446 ops->var.vmode |= FB_VMODE_YWRAP; in ywrap_down()
1447 ops->update_start(info); in ywrap_down()
1448 scrollback_max -= count; in ywrap_down()
1456 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in ypan_up()
1457 struct fbcon_display *p = &fb_display[vc->vc_num]; in ypan_up()
1458 struct fbcon_ops *ops = info->fbcon_par; in ypan_up()
1460 p->yscroll += count; in ypan_up()
1461 if (p->yscroll > p->vrows - vc->vc_rows) { in ypan_up()
1462 ops->bmove(vc, info, p->vrows - vc->vc_rows, in ypan_up()
1463 0, 0, 0, vc->vc_rows, vc->vc_cols); in ypan_up()
1464 p->yscroll -= p->vrows - vc->vc_rows; in ypan_up()
1467 ops->var.xoffset = 0; in ypan_up()
1468 ops->var.yoffset = p->yscroll * vc->vc_font.height; in ypan_up()
1469 ops->var.vmode &= ~FB_VMODE_YWRAP; in ypan_up()
1470 ops->update_start(info); in ypan_up()
1480 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in ypan_up_redraw()
1481 struct fbcon_ops *ops = info->fbcon_par; in ypan_up_redraw()
1482 struct fbcon_display *p = &fb_display[vc->vc_num]; in ypan_up_redraw()
1484 p->yscroll += count; in ypan_up_redraw()
1486 if (p->yscroll > p->vrows - vc->vc_rows) { in ypan_up_redraw()
1487 p->yscroll -= p->vrows - vc->vc_rows; in ypan_up_redraw()
1488 fbcon_redraw_move(vc, p, t + count, vc->vc_rows - count, t); in ypan_up_redraw()
1491 ops->var.xoffset = 0; in ypan_up_redraw()
1492 ops->var.yoffset = p->yscroll * vc->vc_font.height; in ypan_up_redraw()
1493 ops->var.vmode &= ~FB_VMODE_YWRAP; in ypan_up_redraw()
1494 ops->update_start(info); in ypan_up_redraw()
1504 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in ypan_down()
1505 struct fbcon_display *p = &fb_display[vc->vc_num]; in ypan_down()
1506 struct fbcon_ops *ops = info->fbcon_par; in ypan_down()
1508 p->yscroll -= count; in ypan_down()
1509 if (p->yscroll < 0) { in ypan_down()
1510 ops->bmove(vc, info, 0, 0, p->vrows - vc->vc_rows, in ypan_down()
1511 0, vc->vc_rows, vc->vc_cols); in ypan_down()
1512 p->yscroll += p->vrows - vc->vc_rows; in ypan_down()
1515 ops->var.xoffset = 0; in ypan_down()
1516 ops->var.yoffset = p->yscroll * vc->vc_font.height; in ypan_down()
1517 ops->var.vmode &= ~FB_VMODE_YWRAP; in ypan_down()
1518 ops->update_start(info); in ypan_down()
1520 scrollback_max -= count; in ypan_down()
1528 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in ypan_down_redraw()
1529 struct fbcon_ops *ops = info->fbcon_par; in ypan_down_redraw()
1530 struct fbcon_display *p = &fb_display[vc->vc_num]; in ypan_down_redraw()
1532 p->yscroll -= count; in ypan_down_redraw()
1534 if (p->yscroll < 0) { in ypan_down_redraw()
1535 p->yscroll += p->vrows - vc->vc_rows; in ypan_down_redraw()
1536 fbcon_redraw_move(vc, p, t, vc->vc_rows - count, t + count); in ypan_down_redraw()
1539 ops->var.xoffset = 0; in ypan_down_redraw()
1540 ops->var.yoffset = p->yscroll * vc->vc_font.height; in ypan_down_redraw()
1541 ops->var.vmode &= ~FB_VMODE_YWRAP; in ypan_down_redraw()
1542 ops->update_start(info); in ypan_down_redraw()
1544 scrollback_max -= count; in ypan_down_redraw()
1554 (vc->vc_origin + vc->vc_size_row * line); in fbcon_redraw_move()
1556 while (count--) { in fbcon_redraw_move()
1568 fbcon_putcs(vc, start, s - start, in fbcon_redraw_move()
1570 x += s - start; in fbcon_redraw_move()
1578 fbcon_putcs(vc, start, s - start, dy, x); in fbcon_redraw_move()
1587 int offset = ycount * vc->vc_cols; in fbcon_redraw_blit()
1589 (vc->vc_origin + vc->vc_size_row * line); in fbcon_redraw_blit()
1591 struct fbcon_ops *ops = info->fbcon_par; in fbcon_redraw_blit()
1593 while (count--) { in fbcon_redraw_blit()
1604 ops->bmove(vc, info, line + ycount, x, in fbcon_redraw_blit()
1605 line, x, 1, s-start); in fbcon_redraw_blit()
1606 x += s - start + 1; in fbcon_redraw_blit()
1620 ops->bmove(vc, info, line + ycount, x, line, x, 1, in fbcon_redraw_blit()
1621 s-start); in fbcon_redraw_blit()
1626 line--; in fbcon_redraw_blit()
1628 s -= vc->vc_size_row; in fbcon_redraw_blit()
1629 d -= vc->vc_size_row; in fbcon_redraw_blit()
1637 (vc->vc_origin + vc->vc_size_row * line); in fbcon_redraw()
1640 while (count--) { in fbcon_redraw()
1652 fbcon_putcs(vc, start, s - start, in fbcon_redraw()
1654 x += s - start; in fbcon_redraw()
1660 fbcon_putcs(vc, start, s - start, in fbcon_redraw()
1662 x += s - start + 1; in fbcon_redraw()
1675 fbcon_putcs(vc, start, s - start, line, x); in fbcon_redraw()
1680 line--; in fbcon_redraw()
1682 s -= vc->vc_size_row; in fbcon_redraw()
1683 d -= vc->vc_size_row; in fbcon_redraw()
1691 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_bmove_rec()
1692 struct fbcon_ops *ops = info->fbcon_par; in fbcon_bmove_rec()
1696 b = y_break - sy; in fbcon_bmove_rec()
1701 height - b, width, y_break); in fbcon_bmove_rec()
1704 height - b, width, y_break); in fbcon_bmove_rec()
1712 b = y_break - dy; in fbcon_bmove_rec()
1717 height - b, width, y_break); in fbcon_bmove_rec()
1720 height - b, width, y_break); in fbcon_bmove_rec()
1726 ops->bmove(vc, info, real_y(p, sy), sx, real_y(p, dy), dx, in fbcon_bmove_rec()
1733 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_bmove()
1734 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_bmove()
1750 p->vrows - p->yscroll); in fbcon_bmove()
1756 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_scroll()
1757 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_scroll()
1758 int scroll_partial = info->flags & FBINFO_PARTIAL_PAN_OK; in fbcon_scroll()
1773 if (count > vc->vc_rows) /* Maximum realistic size */ in fbcon_scroll()
1774 count = vc->vc_rows; in fbcon_scroll()
1777 fbcon_redraw_blit(vc, info, p, t, b - t - count, 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()
1782 (b - count)), in fbcon_scroll()
1783 vc->vc_video_erase_char, in fbcon_scroll()
1784 vc->vc_size_row * count); in fbcon_scroll()
1788 if (b - t - count > 3 * vc->vc_rows >> 2) { in fbcon_scroll()
1791 vc->vc_cols); in fbcon_scroll()
1793 if (vc->vc_rows - b > 0) in fbcon_scroll()
1794 fbcon_bmove(vc, b - count, 0, b, 0, in fbcon_scroll()
1795 vc->vc_rows - b, in fbcon_scroll()
1796 vc->vc_cols); in fbcon_scroll()
1797 } else if (info->flags & FBINFO_READS_FAST) in fbcon_scroll()
1799 b - t - count, vc->vc_cols); in fbcon_scroll()
1802 __fbcon_clear(vc, b - count, 0, count, vc->vc_cols); in fbcon_scroll()
1806 if ((p->yscroll + count <= in fbcon_scroll()
1807 2 * (p->vrows - vc->vc_rows)) in fbcon_scroll()
1808 && ((!scroll_partial && (b - t == vc->vc_rows)) in fbcon_scroll()
1810 && (b - t - count > in fbcon_scroll()
1811 3 * vc->vc_rows >> 2)))) { in fbcon_scroll()
1815 if (vc->vc_rows - b > 0) in fbcon_scroll()
1817 vc->vc_rows - b, b); in fbcon_scroll()
1819 fbcon_redraw_move(vc, p, t + count, b - t - count, t); in fbcon_scroll()
1820 __fbcon_clear(vc, b - count, 0, count, vc->vc_cols); in fbcon_scroll()
1824 if ((p->yscroll + count <= in fbcon_scroll()
1825 2 * (p->vrows - vc->vc_rows)) in fbcon_scroll()
1826 && ((!scroll_partial && (b - t == vc->vc_rows)) in fbcon_scroll()
1828 && (b - t - count > in fbcon_scroll()
1829 3 * vc->vc_rows >> 2)))) { in fbcon_scroll()
1832 vc->vc_cols); in fbcon_scroll()
1834 if (vc->vc_rows - b > 0) in fbcon_scroll()
1835 fbcon_bmove(vc, b - count, 0, b, 0, in fbcon_scroll()
1836 vc->vc_rows - b, in fbcon_scroll()
1837 vc->vc_cols); in fbcon_scroll()
1838 } else if (info->flags & FBINFO_READS_FAST) in fbcon_scroll()
1840 b - t - count, vc->vc_cols); in fbcon_scroll()
1843 __fbcon_clear(vc, b - count, 0, count, vc->vc_cols); in fbcon_scroll()
1848 fbcon_redraw(vc, t, b - t - count, in fbcon_scroll()
1849 count * vc->vc_cols); in fbcon_scroll()
1850 __fbcon_clear(vc, b - count, 0, count, vc->vc_cols); in fbcon_scroll()
1851 scr_memsetw((unsigned short *) (vc->vc_origin + in fbcon_scroll()
1852 vc->vc_size_row * in fbcon_scroll()
1853 (b - count)), in fbcon_scroll()
1854 vc->vc_video_erase_char, in fbcon_scroll()
1855 vc->vc_size_row * count); in fbcon_scroll()
1861 if (count > vc->vc_rows) /* Maximum realistic size */ in fbcon_scroll()
1862 count = vc->vc_rows; in fbcon_scroll()
1865 fbcon_redraw_blit(vc, info, p, b - 1, b - t - count, in fbcon_scroll()
1866 -count); in fbcon_scroll()
1867 __fbcon_clear(vc, t, 0, count, vc->vc_cols); in fbcon_scroll()
1868 scr_memsetw((unsigned short *) (vc->vc_origin + in fbcon_scroll()
1869 vc->vc_size_row * in fbcon_scroll()
1871 vc->vc_video_erase_char, in fbcon_scroll()
1872 vc->vc_size_row * count); in fbcon_scroll()
1876 if (b - t - count > 3 * vc->vc_rows >> 2) { in fbcon_scroll()
1877 if (vc->vc_rows - b > 0) in fbcon_scroll()
1878 fbcon_bmove(vc, b, 0, b - count, 0, in fbcon_scroll()
1879 vc->vc_rows - b, in fbcon_scroll()
1880 vc->vc_cols); in fbcon_scroll()
1884 vc->vc_cols); in fbcon_scroll()
1885 } else if (info->flags & FBINFO_READS_FAST) in fbcon_scroll()
1887 b - t - count, vc->vc_cols); in fbcon_scroll()
1890 __fbcon_clear(vc, t, 0, count, vc->vc_cols); in fbcon_scroll()
1894 if ((count - p->yscroll <= p->vrows - vc->vc_rows) in fbcon_scroll()
1895 && ((!scroll_partial && (b - t == vc->vc_rows)) in fbcon_scroll()
1897 && (b - t - count > in fbcon_scroll()
1898 3 * vc->vc_rows >> 2)))) { in fbcon_scroll()
1899 if (vc->vc_rows - b > 0) in fbcon_scroll()
1900 fbcon_bmove(vc, b, 0, b - count, 0, in fbcon_scroll()
1901 vc->vc_rows - b, in fbcon_scroll()
1902 vc->vc_cols); in fbcon_scroll()
1906 vc->vc_cols); in fbcon_scroll()
1907 } else if (info->flags & FBINFO_READS_FAST) in fbcon_scroll()
1909 b - t - count, vc->vc_cols); in fbcon_scroll()
1912 __fbcon_clear(vc, t, 0, count, vc->vc_cols); in fbcon_scroll()
1916 if ((count - p->yscroll <= p->vrows - vc->vc_rows) in fbcon_scroll()
1917 && ((!scroll_partial && (b - t == vc->vc_rows)) in fbcon_scroll()
1919 && (b - t - count > in fbcon_scroll()
1920 3 * vc->vc_rows >> 2)))) { in fbcon_scroll()
1921 if (vc->vc_rows - b > 0) in fbcon_scroll()
1922 fbcon_redraw_move(vc, p, b, vc->vc_rows - b, in fbcon_scroll()
1923 b - count); in fbcon_scroll()
1928 fbcon_redraw_move(vc, p, t, b - t - count, t + count); in fbcon_scroll()
1929 __fbcon_clear(vc, t, 0, count, vc->vc_cols); in fbcon_scroll()
1934 fbcon_redraw(vc, b - 1, b - t - count, in fbcon_scroll()
1935 -count * vc->vc_cols); in fbcon_scroll()
1936 __fbcon_clear(vc, t, 0, count, vc->vc_cols); in fbcon_scroll()
1937 scr_memsetw((unsigned short *) (vc->vc_origin + in fbcon_scroll()
1938 vc->vc_size_row * in fbcon_scroll()
1940 vc->vc_video_erase_char, in fbcon_scroll()
1941 vc->vc_size_row * count); in fbcon_scroll()
1954 struct fbcon_ops *ops = info->fbcon_par; in updatescrollmode_accel()
1955 int cap = info->flags; in updatescrollmode_accel()
1957 int ypan = FBCON_SWAP(ops->rotate, info->fix.ypanstep, in updatescrollmode_accel()
1958 info->fix.xpanstep); in updatescrollmode_accel()
1959 int ywrap = FBCON_SWAP(ops->rotate, info->fix.ywrapstep, t); in updatescrollmode_accel()
1960 int yres = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres); in updatescrollmode_accel()
1961 int vyres = FBCON_SWAP(ops->rotate, info->var.yres_virtual, in updatescrollmode_accel()
1962 info->var.xres_virtual); in updatescrollmode_accel()
1964 divides(ypan, vc->vc_font.height) && vyres > yres; in updatescrollmode_accel()
1966 divides(ywrap, vc->vc_font.height) && in updatescrollmode_accel()
1967 divides(vc->vc_font.height, vyres) && in updatescrollmode_accel()
1968 divides(vc->vc_font.height, yres); in updatescrollmode_accel()
1977 p->scrollmode = good_wrap ? in updatescrollmode_accel()
1980 p->scrollmode = good_wrap ? SCROLL_REDRAW : in updatescrollmode_accel()
1984 p->scrollmode = SCROLL_MOVE; in updatescrollmode_accel()
1986 p->scrollmode = SCROLL_REDRAW; in updatescrollmode_accel()
1995 struct fbcon_ops *ops = info->fbcon_par; in updatescrollmode()
1996 int fh = vc->vc_font.height; in updatescrollmode()
1997 int yres = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres); in updatescrollmode()
1998 int vyres = FBCON_SWAP(ops->rotate, info->var.yres_virtual, in updatescrollmode()
1999 info->var.xres_virtual); in updatescrollmode()
2001 p->vrows = vyres/fh; in updatescrollmode()
2002 if (yres > (fh * (vc->vc_rows + 1))) in updatescrollmode()
2003 p->vrows -= (yres - (fh * vc->vc_rows)) / fh; in updatescrollmode()
2005 p->vrows--; in updatescrollmode()
2017 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_resize()
2018 struct fbcon_ops *ops = info->fbcon_par; in fbcon_resize()
2019 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_resize()
2020 struct fb_var_screeninfo var = info->var; in fbcon_resize()
2023 if (p->userfont && FNTSIZE(vc->vc_font.data)) { in fbcon_resize()
2025 int pitch = PITCH(vc->vc_font.width); in fbcon_resize()
2029 * height or width will not allow a font data out-of-bounds access. in fbcon_resize()
2035 return -EINVAL; in fbcon_resize()
2036 size = CALC_FONTSZ(vc->vc_font.height, pitch, vc->vc_font.charcount); in fbcon_resize()
2037 if (size > FNTSIZE(vc->vc_font.data)) in fbcon_resize()
2038 return -EINVAL; in fbcon_resize()
2041 virt_w = FBCON_SWAP(ops->rotate, width, height); in fbcon_resize()
2042 virt_h = FBCON_SWAP(ops->rotate, height, width); in fbcon_resize()
2043 virt_fw = FBCON_SWAP(ops->rotate, vc->vc_font.width, in fbcon_resize()
2044 vc->vc_font.height); in fbcon_resize()
2045 virt_fh = FBCON_SWAP(ops->rotate, vc->vc_font.height, in fbcon_resize()
2046 vc->vc_font.width); in fbcon_resize()
2049 x_diff = info->var.xres - var.xres; in fbcon_resize()
2050 y_diff = info->var.yres - var.yres; in fbcon_resize()
2056 mode = fb_find_best_mode(&var, &info->modelist); in fbcon_resize()
2058 return -EINVAL; in fbcon_resize()
2063 return -EINVAL; in fbcon_resize()
2066 if (con_is_visible(vc) && vc->vc_mode == KD_TEXT) { in fbcon_resize()
2071 var_to_display(p, &info->var, info); in fbcon_resize()
2072 ops->var = info->var; in fbcon_resize()
2082 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_switch()
2086 info = fbcon_info_from_console(vc->vc_num); in fbcon_switch()
2087 ops = info->fbcon_par; in fbcon_switch()
2092 if (conp2->vc_top == logo_lines in fbcon_switch()
2093 && conp2->vc_bottom == conp2->vc_rows) in fbcon_switch()
2094 conp2->vc_top = 0; in fbcon_switch()
2098 prev_console = ops->currcon; in fbcon_switch()
2099 if (prev_console != -1) in fbcon_switch()
2103 * update all info->currcon. Perhaps, we can place this in fbcon_switch()
2107 * info->currcon = vc->vc_num; in fbcon_switch()
2110 if (fbcon_registered_fb[i]->fbcon_par) { in fbcon_switch()
2111 struct fbcon_ops *o = fbcon_registered_fb[i]->fbcon_par; in fbcon_switch()
2113 o->currcon = vc->vc_num; in fbcon_switch()
2124 info->var.activate = var.activate; in fbcon_switch()
2125 var.vmode |= info->var.vmode & ~FB_VMODE_MASK; in fbcon_switch()
2127 ops->var = info->var; in fbcon_switch()
2130 info->flags & FBINFO_MISC_ALWAYS_SETPAR)) { in fbcon_switch()
2131 if (info->fbops->fb_set_par) { in fbcon_switch()
2132 ret = info->fbops->fb_set_par(info); in fbcon_switch()
2145 ops->blank_state != FB_BLANK_UNBLANK) in fbcon_switch()
2151 ops->cursor_reset = 1; in fbcon_switch()
2153 if (ops->rotate_font && ops->rotate_font(info, vc)) { in fbcon_switch()
2154 ops->rotate = FB_ROTATE_UR; in fbcon_switch()
2158 vc->vc_can_do_color = (fb_get_color_depth(&info->var, &info->fix)!=1); in fbcon_switch()
2159 vc->vc_complement_mask = vc->vc_can_do_color ? 0x7700 : 0x0800; in fbcon_switch()
2161 if (vc->vc_font.charcount > 256) in fbcon_switch()
2162 vc->vc_complement_mask <<= 1; in fbcon_switch()
2168 scrollback_phys_max = p->vrows - vc->vc_rows; in fbcon_switch()
2172 scrollback_phys_max = p->vrows - 2 * vc->vc_rows; in fbcon_switch()
2185 ops->var.xoffset = ops->var.yoffset = p->yscroll = 0; in fbcon_switch()
2186 ops->update_start(info); in fbcon_switch()
2195 fb_show_logo(info, ops->rotate); in fbcon_switch()
2197 vc->vc_origin + vc->vc_size_row * vc->vc_top, in fbcon_switch()
2198 vc->vc_size_row * (vc->vc_bottom - in fbcon_switch()
2199 vc->vc_top) / 2); in fbcon_switch()
2209 unsigned short charmask = vc->vc_hi_font_mask ? in fbcon_generic_blank()
2213 oldc = vc->vc_video_erase_char; in fbcon_generic_blank()
2214 vc->vc_video_erase_char &= charmask; in fbcon_generic_blank()
2215 __fbcon_clear(vc, 0, 0, vc->vc_rows, vc->vc_cols); in fbcon_generic_blank()
2216 vc->vc_video_erase_char = oldc; in fbcon_generic_blank()
2223 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_blank()
2224 struct fbcon_ops *ops = info->fbcon_par; in fbcon_blank()
2227 struct fb_var_screeninfo var = info->var; in fbcon_blank()
2229 ops->graphics = 1; in fbcon_blank()
2235 ops->graphics = 0; in fbcon_blank()
2236 ops->var = info->var; in fbcon_blank()
2241 if (ops->blank_state != blank) { in fbcon_blank()
2242 ops->blank_state = blank; in fbcon_blank()
2244 ops->cursor_flash = (!blank); in fbcon_blank()
2255 ops->blank_state != FB_BLANK_UNBLANK) in fbcon_blank()
2265 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_debug_enter()
2266 struct fbcon_ops *ops = info->fbcon_par; in fbcon_debug_enter()
2268 ops->save_graphics = ops->graphics; in fbcon_debug_enter()
2269 ops->graphics = 0; in fbcon_debug_enter()
2270 if (info->fbops->fb_debug_enter) in fbcon_debug_enter()
2271 info->fbops->fb_debug_enter(info); in fbcon_debug_enter()
2277 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_debug_leave()
2278 struct fbcon_ops *ops = info->fbcon_par; in fbcon_debug_leave()
2280 ops->graphics = ops->save_graphics; in fbcon_debug_leave()
2281 if (info->fbops->fb_debug_leave) in fbcon_debug_leave()
2282 info->fbops->fb_debug_leave(info); in fbcon_debug_leave()
2287 u8 *fontdata = vc->vc_font.data; in fbcon_get_font()
2288 u8 *data = font->data; in fbcon_get_font()
2291 font->width = vc->vc_font.width; in fbcon_get_font()
2292 font->height = vc->vc_font.height; in fbcon_get_font()
2293 if (font->height > vpitch) in fbcon_get_font()
2294 return -ENOSPC; in fbcon_get_font()
2295 font->charcount = vc->vc_hi_font_mask ? 512 : 256; in fbcon_get_font()
2296 if (!font->data) in fbcon_get_font()
2299 if (font->width <= 8) { in fbcon_get_font()
2300 j = vc->vc_font.height; in fbcon_get_font()
2301 if (font->charcount * j > FNTSIZE(fontdata)) in fbcon_get_font()
2302 return -EINVAL; in fbcon_get_font()
2304 for (i = 0; i < font->charcount; i++) { in fbcon_get_font()
2306 memset(data + j, 0, vpitch - j); in fbcon_get_font()
2310 } else if (font->width <= 16) { in fbcon_get_font()
2311 j = vc->vc_font.height * 2; in fbcon_get_font()
2312 if (font->charcount * j > FNTSIZE(fontdata)) in fbcon_get_font()
2313 return -EINVAL; in fbcon_get_font()
2315 for (i = 0; i < font->charcount; i++) { in fbcon_get_font()
2317 memset(data + j, 0, 2*vpitch - j); in fbcon_get_font()
2321 } else if (font->width <= 24) { in fbcon_get_font()
2322 if (font->charcount * (vc->vc_font.height * sizeof(u32)) > FNTSIZE(fontdata)) in fbcon_get_font()
2323 return -EINVAL; in fbcon_get_font()
2325 for (i = 0; i < font->charcount; i++) { in fbcon_get_font()
2326 for (j = 0; j < vc->vc_font.height; j++) { in fbcon_get_font()
2332 memset(data, 0, 3 * (vpitch - j)); in fbcon_get_font()
2333 data += 3 * (vpitch - j); in fbcon_get_font()
2336 j = vc->vc_font.height * 4; in fbcon_get_font()
2337 if (font->charcount * j > FNTSIZE(fontdata)) in fbcon_get_font()
2338 return -EINVAL; in fbcon_get_font()
2340 for (i = 0; i < font->charcount; i++) { in fbcon_get_font()
2342 memset(data + j, 0, 4 * vpitch - j); in fbcon_get_font()
2354 vc->vc_hi_font_mask = 0; in set_vc_hi_font()
2355 if (vc->vc_can_do_color) { in set_vc_hi_font()
2356 vc->vc_complement_mask >>= 1; in set_vc_hi_font()
2357 vc->vc_s_complement_mask >>= 1; in set_vc_hi_font()
2361 if (vc->vc_can_do_color) { in set_vc_hi_font()
2363 (unsigned short *) vc->vc_origin; in set_vc_hi_font()
2364 int count = vc->vc_screenbuf_size / 2; in set_vc_hi_font()
2366 for (; count > 0; count--, cp++) { in set_vc_hi_font()
2371 c = vc->vc_video_erase_char; in set_vc_hi_font()
2372 vc->vc_video_erase_char = in set_vc_hi_font()
2374 vc->vc_attr >>= 1; in set_vc_hi_font()
2377 vc->vc_hi_font_mask = 0x100; in set_vc_hi_font()
2378 if (vc->vc_can_do_color) { in set_vc_hi_font()
2379 vc->vc_complement_mask <<= 1; in set_vc_hi_font()
2380 vc->vc_s_complement_mask <<= 1; in set_vc_hi_font()
2386 (unsigned short *) vc->vc_origin; in set_vc_hi_font()
2387 int count = vc->vc_screenbuf_size / 2; in set_vc_hi_font()
2389 for (; count > 0; count--, cp++) { in set_vc_hi_font()
2392 if (vc->vc_can_do_color) in set_vc_hi_font()
2400 c = vc->vc_video_erase_char; in set_vc_hi_font()
2401 if (vc->vc_can_do_color) { in set_vc_hi_font()
2402 vc->vc_video_erase_char = in set_vc_hi_font()
2404 vc->vc_attr <<= 1; in set_vc_hi_font()
2406 vc->vc_video_erase_char = c & ~0x100; in set_vc_hi_font()
2414 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_do_set_font()
2415 struct fbcon_ops *ops = info->fbcon_par; in fbcon_do_set_font()
2416 struct fbcon_display *p = &fb_display[vc->vc_num]; in fbcon_do_set_font()
2418 u8 *old_data = vc->vc_font.data; in fbcon_do_set_font()
2420 resize = (w != vc->vc_font.width) || (h != vc->vc_font.height); in fbcon_do_set_font()
2421 vc->vc_font.data = (void *)(p->fontdata = data); in fbcon_do_set_font()
2422 old_userfont = p->userfont; in fbcon_do_set_font()
2423 if ((p->userfont = userfont)) in fbcon_do_set_font()
2426 old_width = vc->vc_font.width; in fbcon_do_set_font()
2427 old_height = vc->vc_font.height; in fbcon_do_set_font()
2428 old_charcount = vc->vc_font.charcount; in fbcon_do_set_font()
2430 vc->vc_font.width = w; in fbcon_do_set_font()
2431 vc->vc_font.height = h; in fbcon_do_set_font()
2432 vc->vc_font.charcount = charcount; in fbcon_do_set_font()
2433 if (vc->vc_hi_font_mask && charcount == 256) in fbcon_do_set_font()
2435 else if (!vc->vc_hi_font_mask && charcount == 512) in fbcon_do_set_font()
2441 cols = FBCON_SWAP(ops->rotate, info->var.xres, info->var.yres); in fbcon_do_set_font()
2442 rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres); in fbcon_do_set_font()
2449 && vc->vc_mode == KD_TEXT) { in fbcon_do_set_font()
2454 if (old_userfont && (--REFCOUNT(old_data) == 0)) in fbcon_do_set_font()
2455 kfree(old_data - FONT_EXTRA_WORDS * sizeof(int)); in fbcon_do_set_font()
2459 p->fontdata = old_data; in fbcon_do_set_font()
2460 vc->vc_font.data = old_data; in fbcon_do_set_font()
2463 p->userfont = old_userfont; in fbcon_do_set_font()
2464 if (--REFCOUNT(data) == 0) in fbcon_do_set_font()
2465 kfree(data - FONT_EXTRA_WORDS * sizeof(int)); in fbcon_do_set_font()
2468 vc->vc_font.width = old_width; in fbcon_do_set_font()
2469 vc->vc_font.height = old_height; in fbcon_do_set_font()
2470 vc->vc_font.charcount = old_charcount; in fbcon_do_set_font()
2483 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_set_font()
2484 unsigned charcount = font->charcount; in fbcon_set_font()
2485 int w = font->width; in fbcon_set_font()
2486 int h = font->height; in fbcon_set_font()
2489 u8 *new_data, *data = font->data; in fbcon_set_font()
2490 int pitch = PITCH(font->width); in fbcon_set_font()
2495 return -EINVAL; in fbcon_set_font()
2498 if (w > FBCON_SWAP(info->var.rotate, info->var.xres, info->var.yres) || in fbcon_set_font()
2499 h > FBCON_SWAP(info->var.rotate, info->var.yres, info->var.xres)) in fbcon_set_font()
2500 return -EINVAL; in fbcon_set_font()
2502 if (font->width > FB_MAX_BLIT_WIDTH || font->height > FB_MAX_BLIT_HEIGHT) in fbcon_set_font()
2503 return -EINVAL; in fbcon_set_font()
2506 if (!test_bit(font->width - 1, info->pixmap.blit_x) || in fbcon_set_font()
2507 !test_bit(font->height - 1, info->pixmap.blit_y)) in fbcon_set_font()
2508 return -EINVAL; in fbcon_set_font()
2512 return -EINVAL; in fbcon_set_font()
2519 return -ENOMEM; in fbcon_set_font()
2543 tmp->vc_font.width == w && in fbcon_set_font()
2545 kfree(new_data - FONT_EXTRA_WORDS * sizeof(int)); in fbcon_set_font()
2550 return fbcon_do_set_font(vc, font->width, font->height, charcount, new_data, 1); in fbcon_set_font()
2556 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_set_def_font()
2560 f = get_default_font(info->var.xres, info->var.yres, in fbcon_set_def_font()
2561 info->pixmap.blit_x, info->pixmap.blit_y); in fbcon_set_def_font()
2563 return -ENOENT; in fbcon_set_def_font()
2565 font->width = f->width; in fbcon_set_def_font()
2566 font->height = f->height; 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()
2580 struct fb_info *info = fbcon_info_from_console(vc->vc_num); in fbcon_set_palette()
2590 depth = fb_get_color_depth(&info->var, &info->fix); 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 /* As we might be inside of softback, we may work with non-contiguous buffer,
2617 while (cnt--) { in fbcon_invert_region()
2619 if (!vc->vc_can_do_color) in fbcon_invert_region()
2621 else if (vc->vc_hi_font_mask == 0x100) in fbcon_invert_region()
2634 struct fbcon_ops *ops = info->fbcon_par; in fbcon_suspended()
2636 if (!ops || ops->currcon < 0) in fbcon_suspended()
2638 vc = vc_cons[ops->currcon].d; in fbcon_suspended()
2647 struct fbcon_ops *ops = info->fbcon_par; in fbcon_resumed()
2649 if (!ops || ops->currcon < 0) in fbcon_resumed()
2651 vc = vc_cons[ops->currcon].d; in fbcon_resumed()
2658 struct fbcon_ops *ops = info->fbcon_par; in fbcon_modechanged()
2663 if (!ops || ops->currcon < 0) in fbcon_modechanged()
2665 vc = vc_cons[ops->currcon].d; in fbcon_modechanged()
2666 if (vc->vc_mode != KD_TEXT || in fbcon_modechanged()
2667 fbcon_info_from_console(ops->currcon) != info) in fbcon_modechanged()
2670 p = &fb_display[vc->vc_num]; in fbcon_modechanged()
2674 var_to_display(p, &info->var, info); in fbcon_modechanged()
2675 cols = FBCON_SWAP(ops->rotate, info->var.xres, info->var.yres); in fbcon_modechanged()
2676 rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres); in fbcon_modechanged()
2677 cols /= vc->vc_font.width; in fbcon_modechanged()
2678 rows /= vc->vc_font.height; in fbcon_modechanged()
2685 ops->var.xoffset = ops->var.yoffset = p->yscroll = 0; in fbcon_modechanged()
2686 ops->update_start(info); in fbcon_modechanged()
2696 struct fbcon_ops *ops = info->fbcon_par; in fbcon_set_all_vcs()
2699 int i, rows, cols, fg = -1; in fbcon_set_all_vcs()
2701 if (!ops || ops->currcon < 0) in fbcon_set_all_vcs()
2706 if (!vc || vc->vc_mode != KD_TEXT || in fbcon_set_all_vcs()
2715 p = &fb_display[vc->vc_num]; in fbcon_set_all_vcs()
2717 var_to_display(p, &info->var, info); in fbcon_set_all_vcs()
2718 cols = FBCON_SWAP(ops->rotate, info->var.xres, info->var.yres); in fbcon_set_all_vcs()
2719 rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres); in fbcon_set_all_vcs()
2720 cols /= vc->vc_font.width; in fbcon_set_all_vcs()
2721 rows /= vc->vc_font.height; in fbcon_set_all_vcs()
2725 if (fg != -1) in fbcon_set_all_vcs()
2742 struct fbcon_ops *ops = info->fbcon_par; in fbcon_modechange_possible()
2754 if (!vc || vc->vc_mode != KD_TEXT || in fbcon_modechange_possible()
2758 if (vc->vc_font.width > FBCON_SWAP(var->rotate, var->xres, var->yres) || in fbcon_modechange_possible()
2759 vc->vc_font.height > FBCON_SWAP(var->rotate, var->yres, var->xres)) in fbcon_modechange_possible()
2760 return -EINVAL; in fbcon_modechange_possible()
2777 if (j == -1) in fbcon_mode_deleted()
2783 if (!p || !p->mode) in fbcon_mode_deleted()
2785 if (fb_mode_is_equal(p->mode, mode)) { in fbcon_mode_deleted()
2810 int i, new_idx = -1; in fbcon_fb_unbind()
2811 int idx = info->node; in fbcon_fb_unbind()
2822 con2fb_map[i] != -1) { in fbcon_fb_unbind()
2828 if (new_idx != -1) { in fbcon_fb_unbind()
2840 * set_con2fb_map where new_idx is -1 in fbcon_fb_unbind()
2844 con2fb_map[i] = -1; in fbcon_fb_unbind()
2863 fbcon_registered_fb[info->node] = NULL; in fbcon_fb_unregistered()
2864 fbcon_num_registered_fb--; in fbcon_fb_unregistered()
2871 idx = info->node; in fbcon_fb_unregistered()
2874 con2fb_map[i] = -1; in fbcon_fb_unregistered()
2878 info_idx = -1; in fbcon_fb_unregistered()
2886 if (info_idx != -1) { in fbcon_fb_unregistered()
2888 if (con2fb_map[i] == -1) in fbcon_fb_unregistered()
2894 primary_device = -1; in fbcon_fb_unregistered()
2903 int i, idx = info->node; in fbcon_remap_all()
2919 "fb%i, to tty %i-%i\n", idx, in fbcon_remap_all()
2929 if (!map_override && primary_device == -1 && in fbcon_select_primary()
2930 video_is_primary_device(info->device)) { in fbcon_select_primary()
2934 info->fix.id, info->node); in fbcon_select_primary()
2935 primary_device = info->node; in fbcon_select_primary()
2942 "fb%i, to tty %i-%i\n", info->node, in fbcon_select_primary()
2968 fbcon_registered_fb[info->node] = info; in do_fb_registered()
2971 idx = info->node; in do_fb_registered()
2975 pr_info("fbcon: Deferring console take-over\n"); in do_fb_registered()
2979 if (info_idx == -1) { in do_fb_registered()
2987 if (info_idx != -1) in do_fb_registered()
3020 struct fbcon_ops *ops = info->fbcon_par; in fbcon_fb_blanked()
3023 if (!ops || ops->currcon < 0) in fbcon_fb_blanked()
3026 vc = vc_cons[ops->currcon].d; in fbcon_fb_blanked()
3027 if (vc->vc_mode != KD_TEXT || in fbcon_fb_blanked()
3028 fbcon_info_from_console(ops->currcon) != info) in fbcon_fb_blanked()
3037 ops->blank_state = blank; in fbcon_fb_blanked()
3055 &info->modelist); in fbcon_new_modelist()
3057 fbcon_set_disp(info, &var, vc->vc_num); in fbcon_new_modelist()
3066 if (caps->flags) { in fbcon_get_requirement()
3071 if (vc && vc->vc_mode == KD_TEXT && in fbcon_get_requirement()
3072 info->node == con2fb_map[i]) { in fbcon_get_requirement()
3073 set_bit(vc->vc_font.width - 1, caps->x); in fbcon_get_requirement()
3074 set_bit(vc->vc_font.height - 1, caps->y); in fbcon_get_requirement()
3075 charcnt = vc->vc_font.charcount; in fbcon_get_requirement()
3076 if (caps->len < charcnt) in fbcon_get_requirement()
3077 caps->len = charcnt; in fbcon_get_requirement()
3083 if (vc && vc->vc_mode == KD_TEXT && in fbcon_get_requirement()
3084 info->node == con2fb_map[fg_console]) { in fbcon_get_requirement()
3085 bitmap_zero(caps->x, FB_MAX_BLIT_WIDTH); in fbcon_get_requirement()
3086 set_bit(vc->vc_font.width - 1, caps->x); in fbcon_get_requirement()
3087 bitmap_zero(caps->y, FB_MAX_BLIT_HEIGHT); in fbcon_get_requirement()
3088 set_bit(vc->vc_font.height - 1, caps->y); in fbcon_get_requirement()
3089 caps->len = vc->vc_font.charcount; in fbcon_get_requirement()
3100 return -EFAULT; in fbcon_set_con2fb_map_ioctl()
3102 return -EINVAL; in fbcon_set_con2fb_map_ioctl()
3104 return -EINVAL; in fbcon_set_con2fb_map_ioctl()
3108 return -EINVAL; in fbcon_set_con2fb_map_ioctl()
3112 ret = set_con2fb_map(con2fb.console - 1, in fbcon_set_con2fb_map_ioctl()
3124 return -EFAULT; in fbcon_get_con2fb_map_ioctl()
3126 return -EINVAL; in fbcon_get_con2fb_map_ioctl()
3129 con2fb.framebuffer = con2fb_map[con2fb.console - 1]; in fbcon_get_con2fb_map_ioctl()
3132 return copy_to_user(argp, &con2fb, sizeof(con2fb)) ? -EFAULT : 0; in fbcon_get_con2fb_map_ioctl()
3165 int rotate, idx; in store_rotate() local
3171 if (idx == -1 || fbcon_registered_fb[idx] == NULL) in store_rotate()
3175 rotate = simple_strtoul(buf, last, 0); in store_rotate()
3176 fbcon_rotate(info, rotate); in store_rotate()
3187 int rotate, idx; in store_rotate_all() local
3193 if (idx == -1 || fbcon_registered_fb[idx] == NULL) in store_rotate_all()
3197 rotate = simple_strtoul(buf, last, 0); in store_rotate_all()
3198 fbcon_rotate_all(info, rotate); in store_rotate_all()
3208 int rotate = 0, idx; in show_rotate() local
3213 if (idx == -1 || fbcon_registered_fb[idx] == NULL) in show_rotate()
3217 rotate = fbcon_get_rotate(info); in show_rotate()
3220 return sysfs_emit(buf, "%d\n", rotate); in show_rotate()
3228 int idx, blink = -1; in show_cursor_blink()
3233 if (idx == -1 || fbcon_registered_fb[idx] == NULL) in show_cursor_blink()
3237 ops = info->fbcon_par; in show_cursor_blink()
3242 blink = delayed_work_pending(&ops->cursor_work); in show_cursor_blink()
3259 if (idx == -1 || fbcon_registered_fb[idx] == NULL) in store_cursor_blink()
3264 if (!info->fbcon_par) in store_cursor_blink()
3283 __ATTR(rotate, S_IRUGO|S_IWUSR, show_rotate, store_rotate),
3303 while (--i >= 0) in fbcon_init_device()
3380 con2fb_map[i] = -1; in fb_console_init()