patch-2.3.51 linux/drivers/video/fbcon.c
Next file: linux/drivers/video/fbmem.c
Previous file: linux/drivers/video/atyfb.c
Back to the patch index
Back to the overall index
- Lines: 205
- Date:
Wed Mar 8 14:00:08 2000
- Orig file:
v2.3.50/linux/drivers/video/fbcon.c
- Orig date:
Tue Mar 7 14:32:26 2000
diff -u --recursive --new-file v2.3.50/linux/drivers/video/fbcon.c linux/drivers/video/fbcon.c
@@ -111,6 +111,10 @@
#define LOGO_W 80
#define LOGO_LINE (LOGO_W/8)
+static int first_fb_vc = 0;
+static int last_fb_vc = MAX_NR_CONSOLES-1;
+static int fbcon_is_default = 1;
+
struct display fb_display[MAX_NR_CONSOLES];
char con2fb_map[MAX_NR_CONSOLES];
static int logo_lines;
@@ -128,6 +132,8 @@
#define FNTSUM(fd) (((int *)(fd))[-4])
#define FONT_EXTRA_WORDS 4
+static char fontname[40] __initdata = { 0 }; /* default font name */
+
#define CM_SOFTBACK (8)
#define advance_row(p, delta) (unsigned short *)((unsigned long)(p) + (delta) * conp->vc_size_row)
@@ -197,7 +203,8 @@
* Internal routines
*/
-static void fbcon_setup(int con, int init, int logo);
+static int __init fbcon_setup(char *options);
+static void fbcon_set_disp(int con, int init, int logo);
static __inline__ int real_y(struct display *p, int ypos);
static void fbcon_vbl_handler(int irq, void *dummy, struct pt_regs *fp);
static __inline__ void updatescrollmode(struct display *p);
@@ -293,6 +300,8 @@
newfb = registered_fb[newidx];
if (newfb->fbops->fb_open(newfb,0))
return;
+ newfb->count++;
+ oldfb->count--;
oldfb->fbops->fb_release(oldfb,0);
conp = fb_display[unit].conp;
fontdata = fb_display[unit].fontdata;
@@ -323,6 +332,57 @@
}
}
+static int __init fbcon_setup(char *options)
+{
+ int i, j;
+
+ if (!options || !*options)
+ return 0;
+
+ if (!strncmp(options, "font:", 5))
+ strcpy(fontname, options+5);
+
+ if (!strncmp(options, "scrollback:", 11)) {
+ options += 11;
+ if (*options) {
+ fbcon_softback_size = simple_strtoul(options, &options, 0);
+ if (*options == 'k' || *options == 'K') {
+ fbcon_softback_size *= 1024;
+ options++;
+ }
+ if (*options != ',')
+ return 0;
+ options++;
+ } else
+ return 0;
+ }
+
+ if (!strncmp(options, "map:", 4)) {
+ options += 4;
+ if (*options)
+ for (i = 0, j = 0; i < MAX_NR_CONSOLES; i++) {
+ if (!options[j])
+ j = 0;
+ con2fb_map[i] = (options[j++]-'0') % FB_MAX;
+ }
+ return 0;
+ }
+
+ if (!strncmp(options, "vc:", 3)) {
+ options += 3;
+ if (*options)
+ first_fb_vc = simple_strtoul(options, &options, 10) - 1;
+ if (first_fb_vc < 0)
+ first_fb_vc = 0;
+ if (*options++ == '-')
+ last_fb_vc = simple_strtoul(options, &options, 10) - 1;
+ fbcon_is_default = 0;
+ }
+ return 0;
+}
+
+__setup("fbcon=", fbcon_setup);
+
/*
* Low Level Operations
*/
@@ -419,15 +479,23 @@
return display_desc;
}
-
static void fbcon_init(struct vc_data *conp, int init)
{
- int unit = conp->vc_num;
+ int j, unit = conp->vc_num;
struct fb_info *info;
-
+
/* on which frame buffer will we open this console? */
info = registered_fb[(int)con2fb_map[unit]];
+ /*
+ * We assume initial frame buffer devices can be opened this
+ * many times
+ */
+ for (j = 0; j < (last_fb_vc - first_fb_vc + 1); j++) {
+ info->fbops->fb_open(info,0);
+ info->count++;
+ }
+
info->changevar = &fbcon_changevar;
fb_display[unit] = *(info->disp); /* copy from default */
DPRINTK("mode: %s\n",info->modename);
@@ -443,8 +511,8 @@
fb_display[unit].cmap.green = 0;
fb_display[unit].cmap.blue = 0;
fb_display[unit].cmap.transp = 0;
- fbcon_setup(unit, init, !init);
- /* Must be done after fbcon_setup to prevent excess updates */
+ fbcon_set_disp(unit, init, !init);
+ /* Must be done after fbcon_set_disp to prevent excess updates */
conp->vc_display_fg = &info->display_fg;
if (!info->display_fg)
info->display_fg = conp;
@@ -458,6 +526,7 @@
fbcon_free_font(p);
p->dispsw = &fbcon_dummy;
+ p->fb_info->count = 0;
p->conp = 0;
}
@@ -465,7 +534,7 @@
static int fbcon_changevar(int con)
{
if (fb_display[con].conp)
- fbcon_setup(con, 0, 0);
+ fbcon_set_disp(con, 0, 0);
return 0;
}
@@ -504,7 +573,7 @@
#define fontwidthvalid(p,w) ((p)->dispsw->fontwidthmask & FONTWIDTH(w))
-static void fbcon_setup(int con, int init, int logo)
+static void fbcon_set_disp(int con, int init, int logo)
{
struct display *p = &fb_display[con];
struct vc_data *conp = p->conp;
@@ -568,9 +637,8 @@
}
if (!p->fontdata) {
- if (!p->fb_info->fontname[0] ||
- !(font = fbcon_find_font(p->fb_info->fontname)))
- font = fbcon_get_default_font(p->var.xres, p->var.yres);
+ if (!fontname[0] || !(font = fbcon_find_font(fontname)))
+ font = fbcon_get_default_font(p->var.xres, p->var.yres);
p->_fontwidth = font->width;
p->_fontheight = font->height;
p->fontdata = font->data;
@@ -586,7 +654,7 @@
#endif
{
/* ++Geert: changed from panic() to `correct and continue' */
- printk(KERN_ERR "fbcon_setup: No support for fontwidth %d\n", fontwidth(p));
+ printk(KERN_ERR "fbcon_set_disp: No support for fontwidth %d\n", fontwidth(p));
p->dispsw = &fbcon_dummy;
}
}
@@ -669,7 +737,7 @@
}
if (p->dispsw == &fbcon_dummy)
- printk(KERN_WARNING "fbcon_setup: type %d (aux %d, depth %d) not "
+ printk(KERN_WARNING "fbcon_set_disp: type %d (aux %d, depth %d) not "
"supported\n", p->type, p->type_aux, p->var.bits_per_pixel);
p->dispsw->setup(p);
@@ -2394,6 +2462,13 @@
con_getxy: fbcon_getxy,
};
+void __init fbconsole_init(void)
+{
+ if (!num_registered_fb || (first_fb_vc > last_fb_vc))
+ return;
+
+ take_over_console(&fb_con, first_fb_vc, last_fb_vc, fbcon_is_default);
+}
/*
* Dummy Low Level Operations
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)