[PATCH] fbdev phys_to_virt() bugfix

Geert Uytterhoeven (Geert.Uytterhoeven@cs.kuleuven.ac.be)
Wed, 27 Jan 1999 10:34:16 +0100 (CET)


Hi Linus,

Since phys_to_virt() must not be used on MMIO regions, drivers/video/fbgen.c
cannot fill in the virtual frame buffer address in display->screen_base and
must leave this to the frame buffer device itself.

diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file native-2.2.0/drivers/video/clgenfb.c linux/drivers/video/clgenfb.c
--- native-2.2.0/drivers/video/clgenfb.c Thu Jan 21 23:32:23 1999
+++ linux/drivers/video/clgenfb.c Sun Jan 24 21:42:21 1999
@@ -204,8 +204,8 @@
struct fb_info_gen *info);
static int clgen_blank(int blank_mode, struct fb_info_gen *info);

-static void clgen_set_dispsw(const void *par, struct display *disp,
- struct fb_info_gen *info);
+static void clgen_set_disp(const void *par, struct display *disp,
+ struct fb_info_gen *info);

/* function table of the above functions */
static struct fbgen_hwswitch clgen_hwswitch =
@@ -220,7 +220,7 @@
clgen_setcolreg,
clgen_pan_display,
clgen_blank,
- clgen_set_dispsw
+ clgen_set_disp
};

/* Text console acceleration */
@@ -1372,13 +1372,14 @@
}
}

-static void clgen_set_dispsw(const void *par, struct display *disp,
- struct fb_info_gen *info)
+static void clgen_set_disp(const void *par, struct display *disp,
+ struct fb_info_gen *info)
{
struct clgenfb_par *_par = (struct clgenfb_par*) par;
struct clgenfb_info *info2 = (struct clgenfb_info *)info;

- printk("clgen_get_dispsw(): ");
+ printk("clgen_set_disp(): ");
+ disp->screen_base = info2->fbmem;
switch (_par->var.bits_per_pixel)
{
#ifdef FBCON_HAS_MFB
@@ -1670,7 +1671,7 @@
int init_module(void)
{
printk("init_module()\n");
- clgenfb_init(0);
+ clgenfb_init();
return 0;
}

diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file native-2.2.0/drivers/video/fbgen.c linux/drivers/video/fbgen.c
--- native-2.2.0/drivers/video/fbgen.c Fri Nov 20 10:03:02 1998
+++ linux/drivers/video/fbgen.c Sun Jan 24 20:27:02 1999
@@ -244,7 +244,6 @@
memset(&fix, 0, sizeof(struct fb_fix_screeninfo));
fbhw->encode_fix(&fix, &par, info);

- display->screen_base = phys_to_virt((unsigned long)fix.smem_start);
display->visual = fix.visual;
display->type = fix.type;
display->type_aux = fix.type_aux;
@@ -256,7 +255,7 @@
display->can_soft_blank = 1;
else
display->can_soft_blank = 0;
- fbhw->set_dispsw(&par, display, info);
+ fbhw->set_disp(&par, display, info);
#if 0 /* FIXME: generic inverse is not supported yet */
display->inverse = (fix.visual == FB_VISUAL_MONO01 ? !inverse : inverse);
#else
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file native-2.2.0/drivers/video/pm2fb.c linux/drivers/video/pm2fb.c
--- native-2.2.0/drivers/video/pm2fb.c Thu Jan 21 23:32:27 1999
+++ linux/drivers/video/pm2fb.c Sun Jan 24 21:41:50 1999
@@ -3,7 +3,7 @@
* Copyright (c) 1998-1999 Ilario Nardinocchi (nardinoc@CS.UniBO.IT)
* Based on linux/drivers/video/skeletonfb.c by Geert Uytterhoeven.
* --------------------------------------------------------------------------
- * $Id: pm2fb.c,v 1.1.2.1 1999/01/12 19:53:02 geert Exp $
+ * $Id: pm2fb.c,v 1.134 1999/01/11 15:35:35 illo Exp $
* --------------------------------------------------------------------------
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file README.legal in the main directory of this archive
@@ -286,14 +286,14 @@
static int pm2fb_blank(int blank_mode, struct fb_info_gen* info);
static int pm2fb_pan_display(const struct fb_var_screeninfo* var,
struct fb_info_gen* info);
-static void pm2fb_dispsw(const void* par, struct display* disp,
+static void pm2fb_set_disp(const void* par, struct display* disp,
struct fb_info_gen* info);

static struct fbgen_hwswitch pm2fb_hwswitch={
pm2fb_detect, pm2fb_encode_fix, pm2fb_decode_var,
pm2fb_encode_var, pm2fb_get_par, pm2fb_set_par,
pm2fb_getcolreg, pm2fb_setcolreg, pm2fb_pan_display,
- pm2fb_blank, pm2fb_dispsw
+ pm2fb_blank, pm2fb_set_disp
};

static int pm2fb_open(struct fb_info* info, int user);
@@ -1338,14 +1338,15 @@
return regno>255;
}

-static void pm2fb_dispsw(const void* par, struct display* disp,
- struct fb_info_gen* info) {
+static void pm2fb_set_disp(const void* par, struct display* disp,
+ struct fb_info_gen* info) {
struct pm2fb_info* i=(struct pm2fb_info* )info;
unsigned long flags;
unsigned long depth;

save_flags(flags);
cli();
+ disp->screen_base = i->regions.v_fb;
switch (depth=((struct pm2fb_par* )par)->depth) {
#ifdef FBCON_HAS_CFB8
case 8:
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file native-2.2.0/drivers/video/skeletonfb.c linux/drivers/video/skeletonfb.c
--- native-2.2.0/drivers/video/skeletonfb.c Mon Oct 5 19:36:05 1998
+++ linux/drivers/video/skeletonfb.c Sun Jan 24 20:27:02 1999
@@ -240,12 +240,13 @@
return 0;
}

-static void xxx_set_dispsw(const void *par, struct display *disp,
- struct fb_info_gen *info)
+static void xxx_set_disp(const void *par, struct display *disp,
+ struct fb_info_gen *info)
{
unsigned long flags;

/*
+ * Fill in a pointer with the virtual address of the mapped frame buffer.
* Fill in a pointer to appropriate low level text console operations (and
* optionally a pointer to help data) for the video mode `par' of your
* video hardware. These can be generic software routines, or hardware
@@ -254,6 +255,7 @@
* pointer to dummy operations, and there will be no text output.
*/
save_flags(flags); cli();
+ disp->screen_base = virtual_frame_buffer_address;
#ifdef FBCON_HAS_CFB8
if (is_cfb8) {
disp->dispsw = fbcon_cfb8;
@@ -278,7 +280,6 @@
} else
#endif
disp->dispsw = &fbcon_dummy;
- restore_flags(flags);
}


diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file native-2.2.0/include/linux/fb.h linux/include/linux/fb.h
--- native-2.2.0/include/linux/fb.h Wed Dec 23 19:50:06 1998
+++ linux/include/linux/fb.h Tue Jan 26 22:19:07 1999
@@ -340,8 +344,8 @@
int (*pan_display)(const struct fb_var_screeninfo *var,
struct fb_info_gen *info);
int (*blank)(int blank_mode, struct fb_info_gen *info);
- void (*set_dispsw)(const void *par, struct display *disp,
- struct fb_info_gen *info);
+ void (*set_disp)(const void *par, struct display *disp,
+ struct fb_info_gen *info);
};

struct fb_info_gen {

Greetings,

Geert

--
Geert Uytterhoeven                     Geert.Uytterhoeven@cs.kuleuven.ac.be
Wavelets, Linux/{m68k~Amiga,PPC~CHRP}  http://www.cs.kuleuven.ac.be/~geert/
Department of Computer Science -- Katholieke Universiteit Leuven -- Belgium

- 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/