summaryrefslogtreecommitdiffstats
path: root/drivers/video/fbcon.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/video/fbcon.c')
-rw-r--r--drivers/video/fbcon.c81
1 files changed, 80 insertions, 1 deletions
diff --git a/drivers/video/fbcon.c b/drivers/video/fbcon.c
index 77336e223..dfb019fdd 100644
--- a/drivers/video/fbcon.c
+++ b/drivers/video/fbcon.c
@@ -112,10 +112,11 @@
#define LOGO_LINE (LOGO_W/8)
struct display fb_display[MAX_NR_CONSOLES];
+char con2fb_map[MAX_NR_CONSOLES];
static int logo_lines;
static int logo_shown = -1;
/* Software scrollback */
-extern int fbcon_softback_size;
+int fbcon_softback_size = 32768;
static unsigned long softback_buf, softback_curr;
static unsigned long softback_in;
static unsigned long softback_top, softback_end;
@@ -240,6 +241,84 @@ static void cursor_timer_handler(unsigned long dev_addr)
add_timer(&cursor_timer);
}
+int PROC_CONSOLE(const struct fb_info *info)
+{
+ int fgc;
+
+ if (info->display_fg != NULL)
+ fgc = info->display_fg->vc_num;
+ else
+ return -1;
+
+ if (!current->tty)
+ return fgc;
+
+ if (current->tty->driver.type != TTY_DRIVER_TYPE_CONSOLE)
+ /* XXX Should report error here? */
+ return fgc;
+
+ if (MINOR(current->tty->device) < 1)
+ return fgc;
+
+ return MINOR(current->tty->device) - 1;
+}
+
+int set_all_vcs(int fbidx, struct fb_ops *fb, struct fb_var_screeninfo *var,
+ struct fb_info *info)
+{
+ int unit, err;
+
+ var->activate |= FB_ACTIVATE_TEST;
+ err = fb->fb_set_var(var, PROC_CONSOLE(info), info);
+ var->activate &= ~FB_ACTIVATE_TEST;
+ if (err)
+ return err;
+ for (unit = 0; unit < MAX_NR_CONSOLES; unit++)
+ if (fb_display[unit].conp && con2fb_map[unit] == fbidx)
+ fb->fb_set_var(var, unit, info);
+ return 0;
+}
+
+void set_con2fb_map(int unit, int newidx)
+{
+ int oldidx = con2fb_map[unit];
+ struct fb_info *oldfb, *newfb;
+ struct vc_data *conp;
+ char *fontdata;
+ unsigned short fontwidth, fontheight, fontwidthlog, fontheightlog;
+ int userfont;
+
+ if (newidx != con2fb_map[unit]) {
+ oldfb = registered_fb[oldidx];
+ newfb = registered_fb[newidx];
+ if (newfb->fbops->fb_open(newfb,0))
+ return;
+ oldfb->fbops->fb_release(oldfb,0);
+ conp = fb_display[unit].conp;
+ fontdata = fb_display[unit].fontdata;
+ fontwidth = fb_display[unit]._fontwidth;
+ fontheight = fb_display[unit]._fontheight;
+ fontwidthlog = fb_display[unit]._fontwidthlog;
+ fontheightlog = fb_display[unit]._fontheightlog;
+ userfont = fb_display[unit].userfont;
+ con2fb_map[unit] = newidx;
+ fb_display[unit] = *(newfb->disp);
+ fb_display[unit].conp = conp;
+ fb_display[unit].fontdata = fontdata;
+ fb_display[unit]._fontwidth = fontwidth;
+ fb_display[unit]._fontheight = fontheight;
+ fb_display[unit]._fontwidthlog = fontwidthlog;
+ fb_display[unit]._fontheightlog = fontheightlog;
+ fb_display[unit].userfont = userfont;
+ fb_display[unit].fb_info = newfb;
+ if (!newfb->changevar)
+ newfb->changevar = oldfb->changevar;
+ /* tell console var has changed */
+ if (newfb->changevar)
+ newfb->changevar(unit);
+ }
+}
+
/*
* Low Level Operations
*/