Resent-Date: Mon, 2 Nov 1998 14:29:53 +0100 (MET)
Date: Sat, 31 Oct 1998 17:03:48 GMT
From: Jesper Skov <jskov@cygnus.co.uk>
To: linux-m68k@lists.linux-m68k.org
Subject: Video patch
Resent-From: linux-m68k@phil.uni-sb.de

Hey

Patch to fix video problem on Linux/APUS. Also applies to Linux/m68k
even though it doesn't seem to be bothered by the address mixup. The
problem was tracked down by Carsten Pluntke.

Included in the patch is also:

 o a few #ifdef m68k -> m68k|apus conditions.
 o defines for 16bit displays on Virge (courtesy of Geert)

Jesper


diff -u --recursive -B --exclude-from=/home/jskov/lib/diff-excludes -P /home/jskov/kernel/dist/linux-2.1.124/drivers/video/amifb.c ./amifb.c
--- /home/jskov/kernel/dist/linux-2.1.124/drivers/video/amifb.c	Fri Oct  9 19:36:37 1998
+++ ./amifb.c	Sat Oct 31 17:29:42 1998
@@ -60,6 +60,7 @@
 #include <asm/amigahw.h>
 #include <asm/amigaints.h>
 #include <asm/setup.h>
+#include <asm/io.h>
 
 #include <video/fbcon.h>
 #include <video/fbcon-afb.h>
@@ -1478,7 +1479,8 @@
 			struct fb_fix_screeninfo fix;
 
 			ami_encode_fix(&fix, &par);
-			display->screen_base = fix.smem_start;
+			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;
@@ -2124,7 +2126,7 @@
 {
 	memset(fix, 0, sizeof(struct fb_fix_screeninfo));
 	strcpy(fix->id, amifb_name);
-	fix->smem_start = (char *)videomemory;
+	fix->smem_start = (char*) virt_to_phys((void *)videomemory);
 	fix->smem_len = videomemorysize;
 
 #ifdef FBCON_HAS_MFB
diff -u --recursive -B --exclude-from=/home/jskov/lib/diff-excludes -P /home/jskov/kernel/dist/linux-2.1.124/drivers/video/clgenfb.c ./clgenfb.c
--- /home/jskov/kernel/dist/linux-2.1.124/drivers/video/clgenfb.c	Fri Oct  9 19:36:37 1998
+++ ./clgenfb.c	Sat Oct 31 17:22:10 1998
@@ -16,6 +16,7 @@
 #include <asm/amigahw.h>
 #include <asm/pgtable.h>
 #include <asm/delay.h>
+#include <asm/io.h>
 
 #include <video/fbcon.h>
 #include <video/fbcon-mfb.h>
@@ -333,7 +334,7 @@
     memset(fix, 0, sizeof(struct fb_fix_screeninfo));
     strcpy(fix->id, clgenfb_name);
 	
-    fix->smem_start	= (char*)_info->fbmem;
+    fix->smem_start	= (char*) virt_to_phys((void*)_info->fbmem);
     
     /* monochrome: only 1 memory plane */
     /* 8 bit and above: Use whole memory area */
@@ -346,7 +347,7 @@
     fix->ypanstep	= 1;
     fix->ywrapstep	= 0;
     fix->line_length	= _par->line_length;
-    fix->mmio_start	= (char *)_info->regs;
+    fix->mmio_start	= (char*) virt_to_phys ((void *)_info->regs);
     fix->mmio_len	= 0x10000;
     fix->accel		= FB_ACCEL_NONE;
 
diff -u --recursive -B --exclude-from=/home/jskov/lib/diff-excludes -P /home/jskov/kernel/dist/linux-2.1.124/drivers/video/cyberfb.c ./cyberfb.c
--- /home/jskov/kernel/dist/linux-2.1.124/drivers/video/cyberfb.c	Fri Oct  9 19:36:37 1998
+++ ./cyberfb.c	Sat Oct 31 17:36:46 1998
@@ -36,6 +36,7 @@
 #include <asm/irq.h>
 #include <asm/pgtable.h>
 #include <asm/amigahw.h>
+#include <asm/io.h>
 
 #include <video/s3blit.h>
 #include <video/fbcon.h>
@@ -372,9 +373,9 @@
 {
 	memset(fix, 0, sizeof(struct fb_fix_screeninfo));
 	strcpy(fix->id, cyberfb_name);
-	fix->smem_start = (char *)CyberMem;
+	fix->smem_start = (char*) virt_to_phys ((void *)CyberMem);
 	fix->smem_len = CyberSize;
-	fix->mmio_start = (char *)CyberRegs;
+	fix->mmio_start = (char*) virt_to_phys ((void *)CyberRegs);
 	fix->mmio_len = 0x10000;
 
 	fix->type = FB_TYPE_PACKED_PIXELS;
@@ -846,7 +847,7 @@
 	cyberfb_get_fix(&fix, con, info);
 	if (con == -1)
 		con = 0;
-	display->screen_base = fix.smem_start;
+	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;
diff -u --recursive -B --exclude-from=/home/jskov/lib/diff-excludes -P /home/jskov/kernel/dist/linux-2.1.124/drivers/video/fbgen.c ./fbgen.c
--- /home/jskov/kernel/dist/linux-2.1.124/drivers/video/fbgen.c	Mon Sep  7 21:04:10 1998
+++ ./fbgen.c	Sat Oct 31 17:38:10 1998
@@ -15,6 +15,7 @@
 #include <linux/slab.h>
 
 #include <asm/uaccess.h>
+#include <asm/io.h>
 
 
 static int currcon = 0;
@@ -243,7 +244,7 @@
     memset(&fix, 0, sizeof(struct fb_fix_screeninfo));
     fbhw->encode_fix(&fix, &par, info);
 
-    display->screen_base = fix.smem_start;
+    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;
diff -u --recursive -B --exclude-from=/home/jskov/lib/diff-excludes -P /home/jskov/kernel/dist/linux-2.1.124/drivers/video/fbmem.c ./fbmem.c
--- /home/jskov/kernel/dist/linux-2.1.124/drivers/video/fbmem.c	Fri Oct  9 19:36:37 1998
+++ ./fbmem.c	Sat Oct 31 17:10:51 1998
@@ -29,7 +29,7 @@
 #include <linux/kmod.h>
 #endif
 
-#ifdef __mc68000__
+#if defined(__mc68000__) || defined(CONFIG_APUS)
 #include <asm/setup.h>
 #endif
 #ifdef __powerpc__
diff -u --recursive -B --exclude-from=/home/jskov/lib/diff-excludes -P /home/jskov/kernel/dist/linux-2.1.124/drivers/video/fonts.c ./fonts.c
--- /home/jskov/kernel/dist/linux-2.1.124/drivers/video/fonts.c	Mon Sep  7 21:04:10 1998
+++ ./fonts.c	Sun Oct 11 10:48:46 1998
@@ -90,7 +90,7 @@
     for(i=0; i<num_fonts; i++) {
 	f = fbcon_fonts[i];
 	c = f->pref;
-#ifdef __mc68000__
+#if defined(__mc68000__) || defined(CONFIG_APUS)
 #ifdef CONFIG_FONT_PEARL_8x8
 	if (MACH_IS_AMIGA && f->idx == PEARL8x8_IDX)
 	    c = 100;
diff -u --recursive -B --exclude-from=/home/jskov/lib/diff-excludes -P /home/jskov/kernel/dist/linux-2.1.124/drivers/video/retz3fb.c ./retz3fb.c
--- /home/jskov/kernel/dist/linux-2.1.124/drivers/video/retz3fb.c	Fri Oct  9 19:36:37 1998
+++ ./retz3fb.c	Sat Oct 31 17:36:34 1998
@@ -36,6 +36,7 @@
 #include <asm/system.h>
 #include <asm/irq.h>
 #include <asm/pgtable.h>
+#include <asm/io.h>
 
 #include <video/fbcon.h>
 #include <video/fbcon-cfb8.h>
@@ -835,9 +836,9 @@
 {
 	memset(fix, 0, sizeof(struct fb_fix_screeninfo));
 	strcpy(fix->id, retz3fb_name);
-	fix->smem_start = (char *)z3_fbmem;
+	fix->smem_start = (char*) virt_to_phys((void *)z3_fbmem);
 	fix->smem_len = z3_size;
-	fix->mmio_start = (char *)z3_regs;
+	fix->mmio_start = (char*) virt_to_phys((void *)z3_regs);
 	fix->mmio_len = 0x00c00000;
 
 	fix->type = FB_TYPE_PACKED_PIXELS;
@@ -1272,7 +1273,7 @@
 	if (con == -1)
 		con = 0;
 
-	display->screen_base = fix.smem_start;
+	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;
@@ -1348,7 +1349,8 @@
 			struct fb_fix_screeninfo fix;
 			retz3fb_get_fix(&fix, con, info);
 
-			display->screen_base = fix.smem_start;
+			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;
diff -u --recursive -B --exclude-from=/home/jskov/lib/diff-excludes -P /home/jskov/kernel/dist/linux-2.1.124/drivers/video/virgefb.c ./virgefb.c
--- /home/jskov/kernel/dist/linux-2.1.124/drivers/video/virgefb.c	Fri Oct  9 19:36:38 1998
+++ ./virgefb.c	Sat Oct 31 17:35:34 1998
@@ -32,6 +32,7 @@
 #include <asm/irq.h>
 #include <asm/pgtable.h>
 #include <asm/amigahw.h>
+#include <asm/io.h>
 
 #include <video/s3blit.h>
 #include <video/fbcon.h>
@@ -208,6 +209,13 @@
 	    0, 0, -1, -1, 0, VIRGE16_PIXCLOCK, 64, 96, 35, 12, 112, 2,
 	    FB_SYNC_COMP_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
 	}
+    }, {
+	"1024x768-16", {         /* Cybervision 16 bpp */
+	    1024, 768, 1024, 768, 0, 0, 16, 0,
+	    {11, 5, 0}, {5, 6, 0}, {0, 5, 0}, {0, 0, 0},
+	    0, 0, -1, -1, 0, VIRGE16_PIXCLOCK, 64, 96, 35, 12, 112, 2,
+	    FB_SYNC_COMP_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
+       }
     }
 };
 
@@ -371,9 +379,9 @@
 {
 	memset(fix, 0, sizeof(struct fb_fix_screeninfo));
 	strcpy(fix->id, virgefb_name);
-	fix->smem_start = (char *)CyberMem;
+	fix->smem_start = (char*) virt_to_phys((void *)CyberMem);
 	fix->smem_len = CyberSize;
-	fix->mmio_start = (char *)CyberRegs;
+	fix->mmio_start = (char*) virt_to_phys((void *)CyberRegs);
 	fix->mmio_len = 0x10000; /* TODO: verify this for the CV64/3D */
 
 	fix->type = FB_TYPE_PACKED_PIXELS;
@@ -843,7 +851,7 @@
 	virgefb_get_fix(&fix, con, info);
 	if (con == -1)
 		con = 0;
-	display->screen_base = fix.smem_start;
+	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;

