[fbcon patch] struct display

James Simmons (jsimmons@edgeglobal.com)
Sat, 6 Nov 1999 09:08:47 -0500 (EST)


Hi!

I need people to test this patch. As you can see its against a pre
2.3.26-2 kernel. What the patch does is it moves struct display out of
fb.h into fbcon.h. The reason is to begin the seperation of the fbdev
from fbcon. This will allow for much simpler API for fbcon in the future
as well as much needed code reduction. I have tested on my system with the
maxtrofb driver and it works like a charm. If anyone have problems
compiling it or other types of problems let me know. Also the default
2.3.26-2 kernel has a bug in fbmem.c that will not allow the kernel to
compile. The fix is to go into fb_mmap and change the line

vma->vm_pgoff = off >> PAGE_CACHE_SHIFT;

to

vma->vm_pgoff = off >> PAGE_SHIFT;

happy hacking!

diff -ruN linux-2.3.26-2/drivers/video/atafb.c linux/drivers/video/atafb.c
--- linux-2.3.26-2/drivers/video/atafb.c Fri Nov 5 20:33:15 1999
+++ linux/drivers/video/atafb.c Fri Nov 5 21:11:24 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.26-2/drivers/video/bwtwofb.c linux/drivers/video/bwtwofb.c
--- linux-2.3.26-2/drivers/video/bwtwofb.c Fri Nov 5 20:33:15 1999
+++ linux/drivers/video/bwtwofb.c Fri Nov 5 21:11:24 1999
@@ -29,6 +29,7 @@
#include <asm/sun4paddr.h>
#endif

+#include <video/fbcon.h>
#include <video/fbcon-mfb.h>

/* OBio addresses for the bwtwo registers */
diff -ruN linux-2.3.26-2/drivers/video/cgfourteenfb.c linux/drivers/video/cgfourteenfb.c
--- linux-2.3.26-2/drivers/video/cgfourteenfb.c Fri Nov 5 20:33:15 1999
+++ linux/drivers/video/cgfourteenfb.c Fri Nov 5 21:11:24 1999
@@ -25,6 +25,7 @@
#include <asm/pgtable.h>
#include <asm/uaccess.h>

+#include <video/fbcon.h>
#include <video/fbcon-cfb8.h>

#define CG14_MCR_INTENABLE_SHIFT 7
diff -ruN linux-2.3.26-2/drivers/video/cgsixfb.c linux/drivers/video/cgsixfb.c
--- linux-2.3.26-2/drivers/video/cgsixfb.c Fri Nov 5 20:33:15 1999
+++ linux/drivers/video/cgsixfb.c Fri Nov 5 21:11:24 1999
@@ -21,6 +21,7 @@
#include <linux/init.h>
#include <linux/selection.h>

+#include <video/fbcon.h>
#include <video/sbusfb.h>
#include <asm/io.h>

diff -ruN linux-2.3.26-2/drivers/video/fbcon.c linux/drivers/video/fbcon.c
--- linux-2.3.26-2/drivers/video/fbcon.c Fri Nov 5 20:33:15 1999
+++ linux/drivers/video/fbcon.c Sat Nov 6 09:03:33 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,46 @@
cursor_timer.data = 0;
cursor_timer.next = cursor_timer.next = NULL;
add_timer(&cursor_timer);
+}
+
+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.26-2/drivers/video/fbmem.c linux/drivers/video/fbmem.c
--- linux-2.3.26-2/drivers/video/fbmem.c Fri Nov 5 20:57:05 1999
+++ linux/drivers/video/fbmem.c Sat Nov 6 09:04:12 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,9 +227,7 @@

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;
@@ -336,46 +333,6 @@
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.26-2/include/linux/fb.h linux/include/linux/fb.h
--- linux-2.3.26-2/include/linux/fb.h Fri Nov 5 20:56:28 1999
+++ linux/include/linux/fb.h Sat Nov 6 08:51:06 1999
@@ -254,61 +254,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;
@@ -408,20 +353,17 @@
extern void fbgen_blank(int blank, struct fb_info *info);


-/* drivers/char/fbmem.c */
+/* drivers/video/fbmem.c */
extern int register_framebuffer(struct fb_info *fb_info);
extern int unregister_framebuffer(const struct fb_info *fb_info);
-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);
-

extern int num_registered_fb;
extern struct fb_info *registered_fb[FB_MAX];
-extern char con2fb_map[MAX_NR_CONSOLES];

-/* drivers/video/fbcon.c */
-extern struct display fb_display[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/fbcmap.c */
extern int fb_alloc_cmap(struct fb_cmap *cmap, int len, int transp);
diff -ruN linux-2.3.26-2/include/video/fbcon.h linux/include/video/fbcon.h
--- linux-2.3.26-2/include/video/fbcon.h Fri Nov 5 20:33:05 1999
+++ linux/include/video/fbcon.h Sat Nov 6 09:02:08 1999
@@ -44,6 +44,65 @@

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[];
+extern struct display_switch fbcon_dummy;
+extern char con2fb_map[MAX_NR_CONSOLES];
+extern void set_con2fb_map(int unit, int newidx);
+
#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/