Date: Tue, 16 Dec 1997 09:43:59 +0100 (CET)
From: Geert Uytterhoeven <Geert.Uytterhoeven@cs.kuleuven.ac.be>
To: Linux/m68k <linux-m68k@lists.linux-m68k.org>
Subject: Re: L68K: Frame buffer cleanup (the sequel)
In-Reply-To: <Pine.LNX.3.96.971215114630.17654C-100000@mercator.cs.kuleuven.ac.be>
Sender: owner-linux-m68k@phil.uni-sb.de

On Mon, 15 Dec 1997, Geert Uytterhoeven wrote:
> Here is the next part of the great frame buffer clean up operation:

I forgot this one (not that you really would mind :-): it fixes the
screenblanker for the Open Firmware based frame buffer device.

--- drivers/video/offb.c.orig	Wed Dec 10 07:29:47 1997
+++ drivers/video/offb.c	Sun Dec 14 21:50:06 1997
@@ -29,8 +29,6 @@
 #include <asm/prom.h>
 
 
-#define arraysize(x)	(sizeof(x)/sizeof(*(x)))
-
 static int currcon = 0;
 static struct display disp;
 static struct fb_info fb_info;
@@ -42,6 +40,12 @@
 static struct fb_fix_screeninfo fb_fix = { { "OFfb ", } };
 static struct fb_var_screeninfo fb_var = { 0, };
 
+#ifdef __powerpc__
+#define mach_eieio()	eieio()
+#else
+#define mach_eieio()	do {} while (0)
+#endif
+
 
     /*
      *  Interface used by the world
@@ -316,7 +320,7 @@
     disp.ypanstep = 0;
     disp.ywrapstep = 0;
     disp.line_length = fb_fix.line_length;
-    disp.can_soft_blank = 1;
+    disp.can_soft_blank = unknown_cmap_adr ? 1 : 0;
     disp.inverse = 0;
 
     strcpy(fb_info.modename, "OFfb ");
@@ -378,7 +380,22 @@
 
 static void offbcon_blank(int blank)
 {
-    /* Nothing */
+    int i, j;
+
+    if (!unknown_cmap_adr)
+	return;
+
+    if (blank)
+	for (i = 0; i < 256; i++) {
+	    *unknown_cmap_adr = i;
+	    mach_eieio();
+	    for (j = 0; j < 3; j++) {
+		*unknown_cmap_data = 0;
+		mach_eieio();
+	    }
+	}
+    else
+	do_install_cmap(currcon);
 }
 
     /*
@@ -413,21 +430,13 @@
     palette[regno].green = green;
     palette[regno].blue = blue;
     *unknown_cmap_adr = regno;
-#ifdef __powerpc__
-    eieio();
-#endif
+    mach_eieio();
     *unknown_cmap_data = red;
-#ifdef __powerpc__
-    eieio();
-#endif
+    mach_eieio();
     *unknown_cmap_data = green;
-#ifdef __powerpc__
-    eieio();
-#endif
+    mach_eieio();
     *unknown_cmap_data = blue;
-#ifdef __powerpc__
-    eieio();
-#endif
+    mach_eieio();
     return 0;
 }
 
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

