Resent-Date: Wed, 16 Sep 1998 23:54:03 +0200 (MET DST)
To: Linux-m68k List <linux-m68k@phil.uni-sb.de>
Cc: Geert Uytterhoeven <Geert.Uytterhoeven@cs.kuleuven.ac.be>
Subject: Re: Falcon colours in 2.1.120 + patch
References: <Pine.LNX.4.03.9809162304300.7204-100000@mercator.cs.kuleuven.ac.be>
From: Tomas Berndtsson <tomas@nocrew.org>
Date: 16 Sep 1998 23:53:59 +0200
In-Reply-To: Geert Uytterhoeven's message of "Wed, 16 Sep 1998 23:05:53 +0200 (CEST)"
Sender: Tomas Berndtsson <tomas@junk.nocrew.org>
Resent-From: linux-m68k@phil.uni-sb.de

Geert Uytterhoeven <Geert.Uytterhoeven@cs.kuleuven.ac.be> writes:

> The color specs changed: all color components are now 16 bit values. This means
> you have to perform the scaling to/from your hardware's magnitude in
> falcon_[sg]etcolreg().

Ok, here's the patch.. of course it's atafb.c and not fbcon.c as I
said before. :) 

I've only tested this in 16 and 256 colour mode.


--- linux-2.1.120/drivers/video/atafb.c~	Tue Sep 15 17:42:35 1998
+++ linux-2.1.120/drivers/video/atafb.c	Wed Sep 16 23:20:50 1998
@@ -1636,9 +1636,9 @@
 	 * Even with hicolor r/g/b=5/6/5 bit!
 	 */
 	col = f030_col[regno];
-	*red = (col >> 26) & 0x3f;
-	*green = (col >> 18) & 0x3f;
-	*blue = (col >> 2) & 0x3f;
+	*red = (col >> 16) & 0xff00;
+	*green = (col >> 8) & 0xff00;
+	*blue = (col << 8) & 0xff00;
 	*transp = 0;
 	return 0;
 }
@@ -1650,14 +1650,18 @@
 {
 	if (regno > 255)
 		return 1;
-	f030_col[regno] = (red << 26) | (green << 18) | (blue << 2);
+	f030_col[regno] = (((red & 0xfc00) << 16) |
+			   ((green & 0xfc00) << 8) |
+			   ((blue & 0xfc00) >> 8));
 	if (regno < 16) {
 		shifter_tt.color_reg[regno] =
-			(((red & 0xe) >> 1) | ((red & 1) << 3) << 8) |
-			(((green & 0xe) >> 1) | ((green & 1) << 3) << 4) |
-			((blue & 0xe) >> 1) | ((blue & 1) << 3);
+			(((red & 0xe000) >> 13) | ((red & 0x1000) >> 12) << 8) |
+			(((green & 0xe000) >> 13) | ((green & 0x1000) >> 12) << 4) |
+			((blue & 0xe000) >> 13) | ((blue & 0x1000) >> 12);
 #ifdef FBCON_HAS_CFB16
-		fbcon_cfb16_cmap[regno] = (red << 11) | (green << 5) | blue;
+		fbcon_cfb16_cmap[regno] = ((red & 0xf800) |
+					   ((green & 0xfc00) >> 5) |
+					   ((blue & 0xf800) >> 11));
 #endif
 	}
 	return 0;



Greetings,

Tomas - tomas[@.]nocrew.org

