From: Aivils S. <ai...@us...> - 2004-06-17 10:45:05
|
Update of /cvsroot/linuxconsole/ruby/ruby-2.6/drivers/video/console In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30292/ruby-2.6/drivers/video/console Modified Files: dummycon.c fbcon.c fbcon.h vgacon.c Log Message: sync to 2.6.7 Index: dummycon.c =================================================================== RCS file: /cvsroot/linuxconsole/ruby/ruby-2.6/drivers/video/console/dummycon.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- dummycon.c 28 Oct 2003 07:14:53 -0000 1.5 +++ dummycon.c 17 Jun 2004 10:44:53 -0000 1.6 @@ -11,6 +11,7 @@ #include <linux/console.h> #include <linux/vt_kern.h> #include <linux/init.h> +#include <linux/module.h> /* * Dummy console driver @@ -66,6 +67,7 @@ */ const struct consw dummy_con = { + .owner = THIS_MODULE, .con_startup = dummycon_startup, .con_init = dummycon_init, .con_deinit = DUMMY, Index: fbcon.c =================================================================== RCS file: /cvsroot/linuxconsole/ruby/ruby-2.6/drivers/video/console/fbcon.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- fbcon.c 25 May 2004 05:26:48 -0000 1.9 +++ fbcon.c 17 Jun 2004 10:44:53 -0000 1.10 @@ -116,6 +116,8 @@ static unsigned long softback_in; static unsigned long softback_top, softback_end; static int softback_lines; +/* font data */ +static char fontname[40]; #define REFCOUNT(fd) (((int *)(fd))[-1]) #define FNTSIZE(fd) (((int *)(fd))[-2]) @@ -169,9 +171,7 @@ /* * Internal routines */ -static void fbcon_set_display(struct vc_data *vc, int init, int logo); static __inline__ int real_y(struct display *p, int ypos); -static __inline__ void updatescrollmode(struct display *p, struct vc_data *vc); static __inline__ void ywrap_up(struct vc_data *vc, int count); static __inline__ void ywrap_down(struct vc_data *vc, int count); static __inline__ void ypan_up(struct vc_data *vc, int count); @@ -196,9 +196,8 @@ { struct fb_info *info = (struct fb_info *) private; - /* Test to see if the cursor is erased but still on */ if (!info || info->state != FBINFO_STATE_RUNNING || - (info->cursor.rop == ROP_COPY)) + info->cursor.rop == ROP_COPY) return; acquire_console_sem(); info->cursor.enable ^= 1; @@ -219,18 +218,13 @@ return IRQ_HANDLED; } #endif - -static void cursor_timer_handler(unsigned long dev_addr); - -static struct timer_list cursor_timer = - TIMER_INITIALIZER(cursor_timer_handler, 0, 0); static void cursor_timer_handler(unsigned long dev_addr) { struct fb_info *info = (struct fb_info *) dev_addr; schedule_work(&info->queue); - mod_timer(&cursor_timer, jiffies + HZ/5); + mod_timer(&info->cursor_timer, jiffies + HZ/5); } int __init fb_console_setup(char *this_opt) @@ -242,11 +236,8 @@ return 0; while ((options = strsep(&this_opt, ",")) != NULL) { - if (!strncmp(options, "font:", 5)) { - for (unit = 0; unit < MAX_NR_CONSOLES; unit++) - strcpy(fb_display[unit].fontname, - options + 5); - } + if (!strncmp(options, "font:", 5)) + strcpy(fontname, options + 5); if (!strncmp(options, "scrollback:", 11)) { options += 11; @@ -431,10 +422,10 @@ /* NOTE: fbcon cannot be __init: it may be called from take_over_console later */ static const char *fbcon_startup(struct vt_struct *vt, int init) { + struct vc_data *vc = vt->default_mode; struct font_desc *font = NULL; struct module *owner; struct fb_info *info; - struct vc_data *vc = vt->default_mode; static int done = 0; int irqres; @@ -481,34 +472,32 @@ softback_lines = 0; } - font = get_default_font(info->var.xres, info->var.yres); - - if (!vc) { - if (softback_buf) - kfree((void *) softback_buf); - return NULL; - } - /* Setup default font */ - vc->vc_font.data = font->data; + if (!fontname[0] || !(font = find_font(fontname))) + font = get_default_font(info->var.xres, + info->var.yres); vc->vc_font.width = font->width; vc->vc_font.height = font->height; + vc->vc_font.data = font->data; vc->vc_font.charcount = 256; /* FIXME Need to support more fonts */ + /* + * We must always set the mode. The mode of the previous console + * driver could be in the same resolution but we are using different + * hardware so we have to initialize the hardware. + */ + if (info->fbops->fb_set_par) + info->fbops->fb_set_par(info); vc->vc_cols = info->var.xres/vc->vc_font.width; vc->vc_rows = info->var.yres/vc->vc_font.height; vc->vc_can_do_color = info->var.bits_per_pixel != 1; - /* We trust the mode the driver supplies. */ - if (!done && info->fbops->fb_set_par) - info->fbops->fb_set_par(info); - DPRINTK("mode: %s\n", info->fix.id); DPRINTK("visual: %d\n", info->fix.visual); DPRINTK("res: %dx%d-%d\n", info->var.xres, info->var.yres, info->var.bits_per_pixel); - + info->display_fg = vt; #ifdef CONFIG_ATARI @@ -573,12 +562,14 @@ /* Initialize the work queue. If the driver provides its * own work queue this means it will use something besides * default timer to flash the cursor. */ - if (!done && !info->queue.func) { + if (!info->queue.func) { INIT_WORK(&info->queue, fb_flashcursor, info); - cursor_timer.expires = jiffies + HZ / 5; - cursor_timer.data = (unsigned long ) info; - add_timer(&cursor_timer); + init_timer(&info->cursor_timer); + info->cursor_timer.function = cursor_timer_handler; + info->cursor_timer.expires = jiffies + HZ / 5; + info->cursor_timer.data = (unsigned long ) info; + add_timer(&info->cursor_timer); } done = 1; return info->fix.id; @@ -586,102 +577,56 @@ static void fbcon_init(struct vc_data *vc, int init) { - int unit = vc->vc_num; - struct fb_info *info; - - /* on which frame buffer will we open this console? */ - info = (struct fb_info *)vc->display_fg->data_hook; - - if (info->var.accel_flags) - fb_display[unit].scrollmode = SCROLL_YNOMOVE; - else - fb_display[unit].scrollmode = SCROLL_YREDRAW; - fbcon_set_display(vc, init, !init); -} - -static void fbcon_deinit(struct vc_data *vc) -{ - struct display *p = &fb_display[vc->vc_num]; - - fbcon_free_font(p); -} - -static __inline__ void updatescrollmode(struct display *p, struct vc_data *vc) -{ - struct fb_info *info = (struct fb_info *)vc->display_fg->data_hook; - - int m; - if (p->scrollmode & __SCROLL_YFIXED) - return; - if (divides(info->fix.ywrapstep, vc->vc_font.height) && - divides(vc->vc_font.height, info->var.yres_virtual)) - m = __SCROLL_YWRAP; - else if (divides(info->fix.ypanstep, vc->vc_font.height) && - info->var.yres_virtual >= info->var.yres + vc->vc_font.height) - m = __SCROLL_YPAN; - else if (p->scrollmode & __SCROLL_YNOMOVE) - m = __SCROLL_YREDRAW; - else - m = __SCROLL_YMOVE; - p->scrollmode = (p->scrollmode & ~__SCROLL_YMASK) | m; -} - -static void fbcon_set_display(struct vc_data *vc, int init, int logo) -{ struct fb_info *info = (struct fb_info *)vc->display_fg->data_hook; + struct vc_data *default_mode = vc->display_fg->default_mode; struct display *p = &fb_display[vc->vc_num]; - int nr_rows, nr_cols; - int old_rows, old_cols; + int logo = 1, rows, cols, charcnt = 256; unsigned short *save = NULL, *r, *q; - int i, charcnt = 256; - struct font_desc *font; - if (!IS_VISIBLE || (info->flags & FBINFO_FLAG_MODULE) || - info->fix.type == FB_TYPE_TEXT) + if (vc != vc->display_fg->fg_console || (info->flags & FBINFO_FLAG_MODULE) || + (info->fix.type == FB_TYPE_TEXT)) logo = 0; info->var.xoffset = info->var.yoffset = p->yscroll = 0; /* reset wrap/pan */ - for (i = 0; i < MAX_NR_CONSOLES; i++) - if (vc && i != vc->vc_num && fb_display[i].fontdata) - break; - - fbcon_free_font(p); - if (i < MAX_NR_CONSOLES) { - struct display *q = &fb_display[i]; - struct vc_data *tmp = find_vc(i); - - if (tmp) { - /* If we are not the first console on this - fb, copy the font from that console */ - vc->vc_font.width = tmp->vc_font.width; - vc->vc_font.height = tmp->vc_font.height; - vc->vc_font.data = p->fontdata = q->fontdata; - p->userfont = q->userfont; - if (p->userfont) { - REFCOUNT(p->fontdata)++; - charcnt = FNTCHARCNT(p->fontdata); - } - con_copy_unimap(vc, tmp); - } + /* If we are not the first console on this + fb, copy the font from that console */ + vc->vc_font.width = default_mode->vc_font.width; + vc->vc_font.height = default_mode->vc_font.height; + vc->vc_font.data = p->fontdata = default_mode->vc_font.data; + if (p->userfont) { + REFCOUNT(p->fontdata)++; + charcnt = FNTCHARCNT(p->fontdata); } - if (!p->fontdata) { - if (!p->fontname[0] || !(font = find_font(p->fontname))) - font = get_default_font(info->var.xres, - info->var.yres); - vc->vc_font.width = font->width; - vc->vc_font.height = font->height; - vc->vc_font.data = p->fontdata = font->data; + vc->vc_can_do_color = info->var.bits_per_pixel != 1; + vc->vc_complement_mask = vc->vc_can_do_color ? 0x7700 : 0x0800; + if (charcnt == 256) { + vc->vc_hi_font_mask = 0; + } else { + vc->vc_hi_font_mask = 0x100; + if (vc->vc_can_do_color) + vc->vc_complement_mask <<= 1; } - updatescrollmode(p, vc); + cols = info->var.xres / vc->vc_font.width; + rows = info->var.yres / vc->vc_font.height; + vc_resize(vc, cols, rows); - old_cols = vc->vc_cols; - old_rows = vc->vc_rows; + if (info->var.accel_flags) + p->scrollmode = SCROLL_YNOMOVE; + else + p->scrollmode = SCROLL_YREDRAW; - nr_cols = info->var.xres / vc->vc_font.width; - nr_rows = info->var.yres / vc->vc_font.height; + /* + * ++guenther: console.c:vc_allocate() relies on initializing + * vc_{cols,rows}, but we must not set those if we are only + * resizing the console. + */ + if (init) { + vc->vc_cols = cols; + vc->vc_rows = rows; + } if (logo) { /* Need to make room for the logo */ @@ -692,34 +637,28 @@ logo_lines = (logo_height + vc->vc_font.height - 1) / vc->vc_font.height; q = (unsigned short *) (vc->vc_origin + - vc->vc_size_row * old_rows); - step = logo_lines * old_cols; - for (r = q - logo_lines * old_cols; r < q; r++) + vc->vc_size_row * rows); + step = logo_lines * cols; + for (r = q - logo_lines * cols; r < q; r++) if (scr_readw(r) != vc->vc_video_erase_char) break; - if (r != q && nr_rows >= old_rows + logo_lines) { - save = - kmalloc(logo_lines * nr_cols * 2, GFP_KERNEL); + if (r != q && rows >= rows + logo_lines) { + save = kmalloc(logo_lines * cols * 2, GFP_KERNEL); if (save) { - int i = - old_cols < - nr_cols ? old_cols : nr_cols; scr_memsetw(save, vc->vc_video_erase_char, - logo_lines * nr_cols * 2); + logo_lines * cols * 2); r = q - step; - for (cnt = 0; cnt < logo_lines; - cnt++, r += i) - scr_memcpyw(save + cnt * nr_cols, - r, 2 * i); + for (cnt = 0; cnt < logo_lines; cnt++, r += cols) + scr_memcpyw(save + cnt * cols, r, 2 * cols); r = q; } } if (r == q) { /* We can scroll screen down */ - r = q - step - old_cols; - for (cnt = old_rows - logo_lines; cnt > 0; cnt--) { + r = q - step - cols; + for (cnt = rows - logo_lines; cnt > 0; cnt--) { scr_memcpyw(r + step, r, vc->vc_size_row); - r -= old_cols; + r -= cols; } if (!save) { vc->vc_y += logo_lines; @@ -729,56 +668,20 @@ scr_memsetw((unsigned short *) vc->vc_origin, vc->vc_video_erase_char, vc->vc_size_row * logo_lines); - } - - /* - * ++guenther: console.c:vc_allocate() relies on initializing - * vc_{cols,rows}, but we must not set those if we are only - * resizing the console. - */ - if (init) { - vc->vc_cols = nr_cols; - vc->vc_rows = nr_rows; - } - p->vrows = info->var.yres_virtual / vc->vc_font.height; - if(info->var.yres > (vc->vc_font.height * (vc->vc_rows + 1))) { - p->vrows -= (info->var.yres - (vc->vc_font.height * vc->vc_rows)) / vc->vc_font.height; - } - if ((info->var.yres % vc->vc_font.height) && - (info->var.yres_virtual % vc->vc_font.height < - info->var.yres % vc->vc_font.height)) - p->vrows--; - vc->vc_can_do_color = info->var.bits_per_pixel != 1; - vc->vc_complement_mask = vc->vc_can_do_color ? 0x7700 : 0x0800; - if (charcnt == 256) { - vc->vc_hi_font_mask = 0; - } else { - vc->vc_hi_font_mask = 0x100; - if (vc->vc_can_do_color) - vc->vc_complement_mask <<= 1; - } - if (!init) { - - if (vc->vc_cols != nr_cols || vc->vc_rows != nr_rows) - vc_resize(vc, nr_cols, nr_rows); - else if (IS_VISIBLE && - vc->vc_mode == KD_TEXT) { + if (IS_VISIBLE && vc->vc_mode == KD_TEXT) { accel_clear_margins(vc, info, 0); update_screen(vc); } if (save) { q = (unsigned short *) (vc->vc_origin + vc->vc_size_row * - old_rows); - scr_memcpyw(q, save, logo_lines * nr_cols * 2); + rows); + scr_memcpyw(q, save, logo_lines * cols * 2); vc->vc_y += logo_lines; vc->vc_pos += logo_lines * vc->vc_size_row; kfree(save); } - } - - if (logo) { if (logo_lines > vc->vc_bottom) { logo_shown = -1; printk(KERN_INFO @@ -789,7 +692,7 @@ } } - if (IS_VISIBLE && softback_buf) { + if (vc == vc->display_fg->fg_console && softback_buf) { int l = fbcon_softback_size / vc->vc_size_row; if (l > 5) softback_end = softback_buf + l * vc->vc_size_row; @@ -801,6 +704,12 @@ } } +static void fbcon_deinit(struct vc_data *vc) +{ + struct display *p = &fb_display[vc->vc_num]; + + fbcon_free_font(p); +} /* ====================================================================== */ @@ -1535,6 +1444,25 @@ height, width); } +static __inline__ void updatescrollmode(struct display *p, struct fb_info *info, struct vc_data *vc) +{ + int m; + + if (p->scrollmode & __SCROLL_YFIXED) + return; + if (divides(info->fix.ywrapstep, vc->vc_font.height) && + divides(vc->vc_font.height, info->var.yres_virtual)) + m = __SCROLL_YWRAP; + else if (divides(info->fix.ypanstep, vc->vc_font.height) && + info->var.yres_virtual >= info->var.yres + vc->vc_font.height) + m = __SCROLL_YPAN; + else if (p->scrollmode & __SCROLL_YNOMOVE) + m = __SCROLL_YREDRAW; + else + m = __SCROLL_YMOVE; + p->scrollmode = (p->scrollmode & ~__SCROLL_YMASK) | m; +} + static int fbcon_resize(struct vc_data *vc, unsigned int width, unsigned int height) { @@ -1549,20 +1477,30 @@ var.yres = height * fh; x_diff = info->var.xres - var.xres; y_diff = info->var.yres - var.yres; - if (x_diff < 0 || x_diff > fw || - (y_diff < 0 || y_diff > fh)) { - var.activate = FB_ACTIVATE_TEST; - err = fb_set_var(info, &var); - if (err || width > var.xres/fw || - height > var.yres/fh) + if (x_diff < 0 || x_diff > fw || (y_diff < 0 || y_diff > fh)) { + char mode[40]; + + DPRINTK("attempting resize %ix%i\n", var.xres, var.yres); + if (!info->fbops->fb_set_par) + return -EINVAL; + + sprintf(mode, "%dx%d", var.xres, var.yres); + err = fb_find_mode(&var, info, mode, NULL, 0, NULL, + info->var.bits_per_pixel); + if (!err || width > var.xres/fw || height > var.yres/fh) return -EINVAL; DPRINTK("resize now %ix%i\n", var.xres, var.yres); - var.activate = FB_ACTIVATE_NOW; - fb_set_var(info, &var); + if (IS_VISIBLE) { + var.activate = FB_ACTIVATE_NOW; + fb_set_var(info, &var); + } } p->vrows = var.yres_virtual/fh; if (var.yres > (fh * (height + 1))) p->vrows -= (var.yres - (fh * height)) / fh; + if ((var.yres % fh) && (var.yres_virtual % fh < var.yres % fh)) + p->vrows--; + updatescrollmode(p, info, vc); return 0; } @@ -1797,8 +1735,8 @@ } else if (!vc->vc_hi_font_mask && cnt == 512) { vc->vc_hi_font_mask = 0x100; if (vc->vc_can_do_color) { - vc->vc_complement_mask >>= 1; - vc->vc_s_complement_mask >>= 1; + vc->vc_complement_mask <<= 1; + vc->vc_s_complement_mask <<= 1; } /* ++Edmund: reorder the attribute bits */ @@ -1832,16 +1770,6 @@ if (resize) { /* reset wrap/pan */ info->var.xoffset = info->var.yoffset = p->yscroll = 0; - p->vrows = info->var.yres_virtual / h; - -#if 0 /* INCOMPLETE - let the console gurus handle this */ - if(info->var.yres > (h * (vc->vc_rows + 1)) - p->vrows -= (info->var.yres - (h * vc->vc_rows)) / h; -#endif - if ((info->var.yres % h) - && (info->var.yres_virtual % h < info->var.yres % h)) - p->vrows--; - updatescrollmode(p, vc); vc_resize(vc, info->var.xres / w, info->var.yres / h); if (IS_VISIBLE && softback_buf) { int l = fbcon_softback_size / vc->vc_size_row; @@ -2236,6 +2164,7 @@ */ const struct consw fb_con = { + .owner = THIS_MODULE, .con_startup = fbcon_startup, .con_init = fbcon_init, .con_deinit = fbcon_deinit, @@ -2270,8 +2199,7 @@ if(vt2fb[unit] == TAKE_OVER_CONSOLE) { admin_vt->data_hook = (void *)info; - take_over_console(admin_vt, &fb_con); - return 0; + return take_over_console(admin_vt, &fb_con); } vt = (struct vt_struct *) kmalloc(sizeof(struct vt_struct),GFP_KERNEL); @@ -2381,4 +2309,3 @@ EXPORT_SYMBOL(fb_con); MODULE_LICENSE("GPL"); - Index: fbcon.h =================================================================== RCS file: /cvsroot/linuxconsole/ruby/ruby-2.6/drivers/video/console/fbcon.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- fbcon.h 20 Feb 2004 06:52:18 -0000 1.3 +++ fbcon.h 17 Jun 2004 10:44:53 -0000 1.4 @@ -27,7 +27,6 @@ /* Filled in by the frame buffer device */ u_short inverse; /* != 0 text black on white as default */ /* Filled in by the low-level console driver */ - char fontname[40]; /* Font associated to this display */ u_char *fontdata; int userfont; /* != 0 if fontdata kmalloc()ed */ u_short scrollmode; /* Scroll Method */ Index: vgacon.c =================================================================== RCS file: /cvsroot/linuxconsole/ruby/ruby-2.6/drivers/video/console/vgacon.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- vgacon.c 11 Jun 2004 11:09:24 -0000 1.5 +++ vgacon.c 17 Jun 2004 10:44:53 -0000 1.6 @@ -1053,6 +1053,7 @@ #define DUMMY (void *) vgacon_dummy const struct consw vga_con = { + .owner = THIS_MODULE, .con_startup = vgacon_startup, .con_init = vgacon_init, .con_deinit = vgacon_deinit, |