patch-2.1.124 linux/drivers/video/cyberfb.c

Next file: linux/drivers/video/dnfb.c
Previous file: linux/drivers/video/creatorfb.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.123/linux/drivers/video/cyberfb.c linux/drivers/video/cyberfb.c
@@ -37,10 +37,10 @@
 #include <asm/pgtable.h>
 #include <asm/amigahw.h>
 
-#include "s3blit.h"
-#include "fbcon.h"
-#include "fbcon-cfb8.h"
-#include "fbcon-cfb16.h"
+#include <video/s3blit.h>
+#include <video/fbcon.h>
+#include <video/fbcon-cfb8.h>
+#include <video/fbcon-cfb16.h>
 
 
 #ifdef CYBERFBDEBUG
@@ -118,7 +118,7 @@
 
 
 static unsigned int CyberKey = 0;
-static unsigned char Cyber_colour_table [256][4];
+static unsigned char Cyber_colour_table [256][3];
 static unsigned long CyberMem;
 static unsigned long CyberSize;
 static volatile char *CyberRegs;
@@ -309,7 +309,6 @@
 		Cyber_colour_table [i][0] = i;
 		Cyber_colour_table [i][1] = i;
 		Cyber_colour_table [i][2] = i;
-		Cyber_colour_table [i][3] = 0;
 	}
 
 	/*
@@ -356,7 +355,7 @@
 		*(CursorBase+3+(i*4)) = 0xffff0000;
 	}
 
-	Cyber_setcolreg (255, 56, 100, 160, 0, NULL /* unused */);
+	Cyber_setcolreg (255, 56<<8, 100<<8, 160<<8, 0, NULL /* unused */);
 	Cyber_setcolreg (254, 0, 0, 0, 0, NULL /* unused */);
 
 	return 0;
@@ -383,7 +382,7 @@
 	if (par->bpp == 8)
 		fix->visual = FB_VISUAL_PSEUDOCOLOR;
 	else
-		fix->visual = FB_VISUAL_DIRECTCOLOR;
+		fix->visual = FB_VISUAL_TRUECOLOR;
 
 	fix->xpanstep = 0;
 	fix->ypanstep = 0;
@@ -493,9 +492,7 @@
 
 
 /*
- *    Set a single color register. The values supplied are already
- *    rounded down to the hardware's capabilities (according to the
- *    entries in the var structure). Return != 0 for invalid regno.
+ *    Set a single color register. Return != 0 for invalid regno.
  */
 
 static int Cyber_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
@@ -507,14 +504,17 @@
 	}
 
 	wb_64(0x3c8, (unsigned char) regno);
-	Cyber_colour_table [regno][0] = red & 0xff;
-	Cyber_colour_table [regno][1] = green & 0xff;
-	Cyber_colour_table [regno][2] = blue & 0xff;
-	Cyber_colour_table [regno][3] = transp;
-
-	wb_64(0x3c9, (red & 0xff) >> 2);
-	wb_64(0x3c9, (green & 0xff) >> 2);
-	wb_64(0x3c9, (blue & 0xff) >> 2);
+	red >>= 10;
+	green >>= 10;
+	blue >>= 10;
+
+	Cyber_colour_table [regno][0] = red;
+	Cyber_colour_table [regno][1] = green;
+	Cyber_colour_table [regno][2] = blue;
+
+	wb_64(0x3c9, red);
+	wb_64(0x3c9, green);
+	wb_64(0x3c9, blue);
 
 	return (0);
 }
@@ -528,12 +528,17 @@
 static int Cyber_getcolreg(u_int regno, u_int *red, u_int *green, u_int *blue,
 			   u_int *transp, struct fb_info *info)
 {
+	int t;
+
 	if (regno >= 256)
 		return (1);
-	*red	= Cyber_colour_table [regno][0];
-	*green	= Cyber_colour_table [regno][1];
-	*blue	= Cyber_colour_table [regno][2];
-	*transp = Cyber_colour_table [regno][3];
+	t	= Cyber_colour_table [regno][0];
+	*red	= (t<<10) | (t<<4) | (t>>2);
+	t	= Cyber_colour_table [regno][1];
+	*green	= (t<<10) | (t<<4) | (t>>2);
+	t	= Cyber_colour_table [regno][2];
+	*blue	= (t<<10) | (t<<4) | (t>>2);
+	*transp = 0;
 	return (0);
 }
 
@@ -561,9 +566,9 @@
 		for (i = 0; i < 256; i++)
 		{
 			wb_64(0x3c8, (unsigned char) i);
-			wb_64(0x3c9, Cyber_colour_table[i][0] >> 2);
-			wb_64(0x3c9, Cyber_colour_table[i][1] >> 2);
-			wb_64(0x3c9, Cyber_colour_table[i][2] >> 2);
+			wb_64(0x3c9, Cyber_colour_table[i][0]);
+			wb_64(0x3c9, Cyber_colour_table[i][1]);
+			wb_64(0x3c9, Cyber_colour_table[i][2]);
 		}
 	}
 }
@@ -757,11 +762,10 @@
 	if (con != currcon)
 		return;
 	if (fb_display[con].cmap.len)
-		fb_set_cmap(&fb_display[con].cmap, &fb_display[con].var, 1,
-			    fbhw->setcolreg, info);
+		fb_set_cmap(&fb_display[con].cmap, 1, fbhw->setcolreg, info);
 	else
 		fb_set_cmap(fb_default_cmap(1<<fb_display[con].var.bits_per_pixel),
-			    &fb_display[con].var, 1, fbhw->setcolreg, info);
+			    1, fbhw->setcolreg, info);
 }
 
 
@@ -866,7 +870,7 @@
 		break;
 #endif
 	    default:
-		display->dispsw = NULL;
+		display->dispsw = &fbcon_dummy;
 		break;
 	}
 }
@@ -915,8 +919,7 @@
 			    struct fb_info *info)
 {
 	if (con == currcon) /* current console? */
-		return(fb_get_cmap(cmap, &fb_display[con].var,
-				   kspc, fbhw->getcolreg, info));
+		return(fb_get_cmap(cmap, kspc, fbhw->getcolreg, info));
 	else if (fb_display[con].cmap.len) /* non default colormap? */
 		fb_copy_cmap(&fb_display[con].cmap, cmap, kspc ? 0 : 2);
 	else
@@ -941,8 +944,7 @@
 			return(err);
 	}
 	if (con == currcon)		 /* current console? */
-		return(fb_set_cmap(cmap, &fb_display[con].var,
-				   kspc, fbhw->setcolreg, info));
+		return(fb_set_cmap(cmap, kspc, fbhw->setcolreg, info));
 	else
 		fb_copy_cmap(cmap, &fb_display[con].cmap, kspc ? 0 : 1);
 	return(0);
@@ -1042,6 +1044,7 @@
 	fb_info.switch_con = &Cyberfb_switch;
 	fb_info.updatevar = &Cyberfb_updatevar;
 	fb_info.blank = &Cyberfb_blank;
+	fb_info.flags = FBINFO_FLAG_DEFAULT;
 
 	fbhw->init();
 	fbhw->decode_var(&cyberfb_default, &par);
@@ -1067,8 +1070,8 @@
 {
 	/* Do we have to save the colormap? */
 	if (fb_display[currcon].cmap.len)
-		fb_get_cmap(&fb_display[currcon].cmap, &fb_display[currcon].var, 1,
-			    fbhw->getcolreg, info);
+		fb_get_cmap(&fb_display[currcon].cmap, 1, fbhw->getcolreg,
+			    info);
 
 	do_fb_set_var(&fb_display[con].var, 1);
 	currcon = con;
@@ -1130,9 +1133,9 @@
 			       int dx, int height, int width)
 {
     sx *= 8; dx *= 8; width *= 8;
-    Cyber_BitBLT((u_short)sx, (u_short)(sy*p->fontheight), (u_short)dx,
-		 (u_short)(dy*p->fontheight), (u_short)width,
-		 (u_short)(height*p->fontheight), (u_short)S3_NEW);
+    Cyber_BitBLT((u_short)sx, (u_short)(sy*fontheight(p)), (u_short)dx,
+		 (u_short)(dy*fontheight(p)), (u_short)width,
+		 (u_short)(height*fontheight(p)), (u_short)S3_NEW);
 }
 
 static void fbcon_cyber8_clear(struct vc_data *conp, struct display *p, int sy,
@@ -1143,9 +1146,9 @@
     sx *= 8; width *= 8;
     bg = attr_bgcol_ec(p,conp);
     Cyber_RectFill((u_short)sx,
-		   (u_short)(sy*p->fontheight),
+		   (u_short)(sy*fontheight(p)),
 		   (u_short)width,
-		   (u_short)(height*p->fontheight),
+		   (u_short)(height*fontheight(p)),
 		   (u_short)S3_NEW,
 		   (u_short)bg);
 }

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov