Messages in this thread Patch in this message |  | | | Date | Sat, 27 Nov 1999 21:24:08 -0500 (EST) | | From | James Simmons <> | | Subject | [PATCH] fbcon/fbdev cleanup |
| |
This patch does some code cleanup in fbcon. It moves the struct display from fbdev to fbcon. It has been tested on my system with no problems.
-----==- ----==-- _ ---==---(_)__ __ ____ __ James Simmons --==---/ / _ \/ // /\ \/ / jsimmons@edgeglobal.com -=====/_/_//_/\_,_/ /_/\_\ fbcon/gfx developer The choice of a GNU generation ----------------------------------------------------------------------------- diff -ruN linux-2.3.30-3/drivers/video/atafb.c linux/drivers/video/atafb.c --- linux-2.3.30-3/drivers/video/atafb.c Fri Nov 12 18:58:17 1999 +++ linux/drivers/video/atafb.c Sat Nov 27 21:17:38 1999 @@ -71,6 +71,7 @@ #include <linux/fb.h> #include <asm/atarikb.h> +#include <video/fbcon.h> #include <video/fbcon-cfb8.h> #include <video/fbcon-cfb16.h> #include <video/fbcon-iplan2p2.h> diff -ruN linux-2.3.30-3/drivers/video/dnfb.c linux/drivers/video/dnfb.c --- linux-2.3.30-3/drivers/video/dnfb.c Wed Nov 10 15:09:56 1999 +++ linux/drivers/video/dnfb.c Sat Nov 27 21:17:38 1999 @@ -14,6 +14,7 @@ #include <linux/fb.h> #include <linux/module.h> +#include <video/fbcon.h> #include <video/fbcon-mfb.h> diff -ruN linux-2.3.30-3/drivers/video/fbcon.c linux/drivers/video/fbcon.c --- linux-2.3.30-3/drivers/video/fbcon.c Wed Nov 10 15:09:56 1999 +++ linux/drivers/video/fbcon.c Sat Nov 27 21:17:38 1999 @@ -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; @@ -238,6 +239,84 @@ cursor_timer.data = 0; cursor_timer.next = cursor_timer.next = NULL; 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); + } } /* diff -ruN linux-2.3.30-3/drivers/video/fbmem.c linux/drivers/video/fbmem.c --- linux-2.3.30-3/drivers/video/fbmem.c Wed Nov 24 11:04:28 1999 +++ linux/drivers/video/fbmem.c Sat Nov 27 21:17:38 1999 @@ -20,7 +20,6 @@ #include <linux/mman.h> #include <linux/tty.h> #include <linux/console.h> -#include <linux/console_struct.h> #include <linux/init.h> #include <linux/proc_fs.h> #ifdef CONFIG_KMOD @@ -38,7 +37,7 @@ #include <asm/pgtable.h> #include <linux/fb.h> - +#include <video/fbcon.h> /* * Frame buffer device initialization and setup routines @@ -228,36 +227,12 @@ struct fb_info *registered_fb[FB_MAX]; int num_registered_fb = 0; -int fbcon_softback_size = 32768; - -char con2fb_map[MAX_NR_CONSOLES]; +extern int fbcon_softback_size; static int first_fb_vc = 0; static int last_fb_vc = MAX_NR_CONSOLES-1; static int fbcon_is_default = 1; -static 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; -} - static int fbmem_read_proc(char *buf, char **start, off_t offset, int len, int *eof, void *private) { @@ -319,63 +294,6 @@ return -EFAULT; file->f_pos += copy_size; return copy_size; -} - - -static 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; -} - -static 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); - } } #ifdef CONFIG_KMOD diff -ruN linux-2.3.30-3/drivers/video/hpfb.c linux/drivers/video/hpfb.c --- linux-2.3.30-3/drivers/video/hpfb.c Wed Nov 10 15:09:56 1999 +++ linux/drivers/video/hpfb.c Sat Nov 27 21:17:38 1999 @@ -22,6 +22,7 @@ #include <asm/blinken.h> #include <asm/hwtest.h> +#include <video/fbcon.h> #include <video/fbcon-mfb.h> #include <video/fbcon-cfb2.h> #include <video/fbcon-cfb4.h> diff -ruN linux-2.3.30-3/include/linux/fb.h linux/include/linux/fb.h --- linux-2.3.30-3/include/linux/fb.h Wed Nov 24 11:04:30 1999 +++ linux/include/linux/fb.h Sat Nov 27 21:17:38 1999 @@ -255,61 +255,6 @@ int (*fb_rasterimg)(struct fb_info *info, int start); }; - - /* - * This is the interface between the low-level console driver and the - * low-level frame buffer device - */ - -struct display { - /* Filled in by the frame buffer device */ - - struct fb_var_screeninfo var; /* variable infos. yoffset and vmode */ - /* are updated by fbcon.c */ - struct fb_cmap cmap; /* colormap */ - char *screen_base; /* pointer to top of virtual screen */ - /* (virtual address) */ - int visual; - int type; /* see FB_TYPE_* */ - int type_aux; /* Interleave for interleaved Planes */ - u_short ypanstep; /* zero if no hardware ypan */ - u_short ywrapstep; /* zero if no hardware ywrap */ - u_long line_length; /* length of a line in bytes */ - u_short can_soft_blank; /* zero if no hardware blanking */ - u_short inverse; /* != 0 text black on white as default */ - struct display_switch *dispsw; /* low level operations */ - void *dispsw_data; /* optional dispsw helper data */ - -#if 0 - struct fb_fix_cursorinfo fcrsr; - struct fb_var_cursorinfo *vcrsr; - struct fb_cursorstate crsrstate; -#endif - - /* Filled in by the low-level console driver */ - - struct vc_data *conp; /* pointer to console data */ - struct fb_info *fb_info; /* frame buffer for this console */ - int vrows; /* number of virtual rows */ - unsigned short cursor_x; /* current cursor position */ - unsigned short cursor_y; - int fgcol; /* text colors */ - int bgcol; - u_long next_line; /* offset to one line below */ - u_long next_plane; /* offset to next plane */ - u_char *fontdata; /* Font associated to this display */ - unsigned short _fontheightlog; - unsigned short _fontwidthlog; - unsigned short _fontheight; - unsigned short _fontwidth; - int userfont; /* != 0 if fontdata kmalloc()ed */ - u_short scrollmode; /* Scroll Method */ - short yscroll; /* Hardware scrolling */ - unsigned char fgshift, bgshift; - unsigned short charmask; /* 0xff or 0x1ff */ -}; - - struct fb_info { char modename[40]; /* default video mode */ kdev_t node; @@ -415,15 +360,11 @@ extern int num_registered_fb; extern struct fb_info *registered_fb[FB_MAX]; -extern char con2fb_map[MAX_NR_CONSOLES]; /* drivers/video/fbmon.c */ extern int fbmon_valid_timings(u_int pixclock, u_int htotal, u_int vtotal, const struct fb_info *fb_info); extern int fbmon_dpms(const struct fb_info *fb_info); - -/* drivers/video/fbcon.c */ -extern struct display fb_display[MAX_NR_CONSOLES]; /* drivers/video/fbcmap.c */ extern int fb_alloc_cmap(struct fb_cmap *cmap, int len, int transp); diff -ruN linux-2.3.30-3/include/video/fbcon.h linux/include/video/fbcon.h --- linux-2.3.30-3/include/video/fbcon.h Wed Nov 10 15:09:45 1999 +++ linux/include/video/fbcon.h Sat Nov 27 21:17:38 1999 @@ -44,6 +44,67 @@ extern struct display_switch fbcon_dummy; + /* + * This is the interface between the low-level console driver and the + * low-level frame buffer device + */ + +struct display { + /* Filled in by the frame buffer device */ + + struct fb_var_screeninfo var; /* variable infos. yoffset and vmode */ + /* are updated by fbcon.c */ + struct fb_cmap cmap; /* colormap */ + char *screen_base; /* pointer to top of virtual screen */ + /* (virtual address) */ + int visual; + int type; /* see FB_TYPE_* */ + int type_aux; /* Interleave for interleaved Planes */ + u_short ypanstep; /* zero if no hardware ypan */ + u_short ywrapstep; /* zero if no hardware ywrap */ + u_long line_length; /* length of a line in bytes */ + u_short can_soft_blank; /* zero if no hardware blanking */ + u_short inverse; /* != 0 text black on white as default */ + struct display_switch *dispsw; /* low level operations */ + void *dispsw_data; /* optional dispsw helper data */ + +#if 0 + struct fb_fix_cursorinfo fcrsr; + struct fb_var_cursorinfo *vcrsr; + struct fb_cursorstate crsrstate; +#endif + + /* Filled in by the low-level console driver */ + + struct vc_data *conp; /* pointer to console data */ + struct fb_info *fb_info; /* frame buffer for this console */ + int vrows; /* number of virtual rows */ + unsigned short cursor_x; /* current cursor position */ + unsigned short cursor_y; + int fgcol; /* text colors */ + int bgcol; + u_long next_line; /* offset to one line below */ + u_long next_plane; /* offset to next plane */ + u_char *fontdata; /* Font associated to this display */ + unsigned short _fontheightlog; + unsigned short _fontwidthlog; + unsigned short _fontheight; + unsigned short _fontwidth; + int userfont; /* != 0 if fontdata kmalloc()ed */ + u_short scrollmode; /* Scroll Method */ + short yscroll; /* Hardware scrolling */ + unsigned char fgshift, bgshift; + unsigned short charmask; /* 0xff or 0x1ff */ +}; + +/* drivers/video/fbcon.c */ +extern struct display fb_display[MAX_NR_CONSOLES]; +extern char con2fb_map[MAX_NR_CONSOLES]; +extern int PROC_CONSOLE(const struct fb_info *info); +extern void set_con2fb_map(int unit, int newidx); +extern int set_all_vcs(int fbidx, struct fb_ops *fb, + struct fb_var_screeninfo *var, struct fb_info *info); + #define fontheight(p) ((p)->_fontheight) #define fontheightlog(p) ((p)->_fontheightlog)
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
|  |