patch-2.3.15 linux/drivers/video/matroxfb.c

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

diff -u --recursive --new-file v2.3.14/linux/drivers/video/matroxfb.c linux/drivers/video/matroxfb.c
@@ -2680,7 +2680,7 @@
 /* --------------------------------------------------------------------- */
 
 static struct fb_var_screeninfo vesafb_defined __initdata = {
-	0,0,0,0,	/* W,H, W, H (virtual) load xres,xres_virtual*/
+	640,480,640,480,/* W,H, W, H (virtual) load xres,xres_virtual*/
 	0,0,		/* virtual -> visible no offset */
 	8,		/* depth -> load bits_per_pixel */
 	0,		/* greyscale ? */
@@ -2692,8 +2692,8 @@
 	FB_ACTIVATE_NOW,
 	-1,-1,
 	FB_ACCELF_TEXT,	/* accel flags */
-	0L,0L,0L,0L,0L,
-	0L,0L,0,	/* No sync info */
+	39721L,48L,16L,33L,10L,
+	96L,2L,~0,	/* No sync info */
 	FB_VMODE_NONINTERLACED,
 	{0,0,0,0,0,0}
 };
@@ -4622,7 +4622,7 @@
 	memset(fix, 0, sizeof(struct fb_fix_screeninfo));
 	strcpy(fix->id,"MATROX");
 
-	fix->smem_start = (void*)ACCESS_FBINFO(video.base) + ACCESS_FBINFO(curr.ydstorg.bytes);
+	fix->smem_start = ACCESS_FBINFO(video.base) + ACCESS_FBINFO(curr.ydstorg.bytes);
 	fix->smem_len = ACCESS_FBINFO(video.len_usable) - ACCESS_FBINFO(curr.ydstorg.bytes);
 	fix->type = p->type;
 	fix->type_aux = p->type_aux;
@@ -4631,7 +4631,7 @@
 	fix->ypanstep = 1;
 	fix->ywrapstep = 0;
 	fix->line_length = p->line_length;
-	fix->mmio_start = (void*)ACCESS_FBINFO(mmio.base);
+	fix->mmio_start = ACCESS_FBINFO(mmio.base);
 	fix->mmio_len = ACCESS_FBINFO(mmio.len);
 	fix->accel = ACCESS_FBINFO(devflags.accelerator);
 	return 0;
@@ -5152,7 +5152,10 @@
 static unsigned int fh = 0;		/* "matrox:fh:xxxxxk" */
 static unsigned int maxclk = 0;		/* "matrox:maxclk:xxxxM" */
 static char fontname[64];		/* "matrox:font:xxxxx" */
+
+#ifndef MODULE
 static char videomode[64];		/* "matrox:mode:xxxxx" or "matrox:xxxxx" */
+#endif
 
 #ifndef MODULE
 int __init matroxfb_setup(char *options) {
@@ -5207,7 +5210,7 @@
 		else if (!strncmp(this_opt, "vesa:", 5)) 
 			vesa = simple_strtoul(this_opt+5, NULL, 0);
 		else if (!strncmp(this_opt, "font:", 5))
-			strcpy(fontname, this_opt+5);
+			strncpy(fontname, this_opt+5, sizeof(fontname)-1);
 		else if (!strncmp(this_opt, "maxclk:", 7))
 			maxclk = simple_strtoul(this_opt+7, NULL, 0);
 		else if (!strncmp(this_opt, "fh:", 3))
@@ -5217,7 +5220,7 @@
 		else if (!strncmp(this_opt, "mem:", 4)) 
 			mem = simple_strtoul(this_opt+4, NULL, 0);
 		else if (!strncmp(this_opt, "mode:", 5))
-			strcpy(videomode, this_opt+5);
+			strncpy(videomode, this_opt+5, sizeof(videomode)-1);
 #ifdef CONFIG_FB_OF
 		else if (!strncmp(this_opt, "vmode:", 6)) {
 			unsigned int vmode = simple_strtoul(this_opt+6, NULL, 0);
@@ -5289,13 +5292,13 @@
 			else if (!strcmp(this_opt, "grayscale"))
 				grayscale = value;
 			else {
-				printk(KERN_ERR "matroxfb: unknown parameter %s%s\n", value?"":"no", this_opt);
+				strncpy(videomode, this_opt, sizeof(videomode)-1);
 			}
 		}
 	}
 	return 0;
 }
-#endif
+#endif /* !MODULE */
 
 static int matroxfb_getmemory(WPMINFO unsigned int maxSize, unsigned int* realOffset, unsigned int *realSize){
 	vaddr_t vm;
@@ -5847,15 +5850,6 @@
 		if (depth == -1)
 			depth = RSDepth(RSptr->info);
 	}
-#if 0	
-	if (sync == -1) {
-		sync = 0;
-		if (yres < 400)
-			sync |= FB_SYNC_HOR_HIGH_ACT;
-		else if (yres < 480)
-			sync |= FB_SYNC_VERT_HIGH_ACT;
-	}
-#endif
 	if ((depth == RSText8) && (!*ACCESS_FBINFO(fbcon.fontname))) {
 		strcpy(ACCESS_FBINFO(fbcon.fontname), "VGA8x8");
 	}
@@ -5879,13 +5873,23 @@
 	ACCESS_FBINFO(fbcon.flags) = FBINFO_FLAG_DEFAULT;
 	ACCESS_FBINFO(video.len_usable) &= PAGE_MASK;
 
-#if 0
-	fb_find_mode(&vesafb_defined, &ACCESS_FBINFO(fbcon), videomode[0]?videomode:NULL,
-		NULL, 0, NULL, vesafb_defined.bits_per_pixel);
-#endif
+#ifndef MODULE
+	/* mode database is marked __init ... */
+	{
+		/* it cannot be static const struct due to __initdata
+		marker */
+		static struct fb_videomode defaultmode __initdata = {
+			/* 640x480 @ 60Hz, 31.5 kHz */
+			NULL, 60, 640, 480, 39721, 40, 24, 32, 11, 96, 2,
+			0, FB_VMODE_NONINTERLACED
+		};
+
+		fb_find_mode(&vesafb_defined, &ACCESS_FBINFO(fbcon), videomode[0]?videomode:NULL,
+		NULL, 0, &defaultmode, vesafb_defined.bits_per_pixel);
+	}
+#endif /* !MODULE */
+
 	/* mode modifiers */
-	if (sync != -1)
-		vesafb_defined.sync = sync;
 	if (hslen)
 		vesafb_defined.hsync_len = hslen;
 	if (vslen)
@@ -5902,6 +5906,16 @@
 		vesafb_defined.xres = xres;
 	if (yres)
 		vesafb_defined.yres = yres;
+	if (sync != -1)
+		vesafb_defined.sync = sync;
+	else if (vesafb_defined.sync == ~0) {
+		vesafb_defined.sync = 0;
+		if (yres < 400)
+			vesafb_defined.sync |= FB_SYNC_HOR_HIGH_ACT;
+		else if (yres < 480)
+			vesafb_defined.sync |= FB_SYNC_VERT_HIGH_ACT;
+	}
+	
 	/* fv, fh, maxclk limits was specified */
 	{
 		unsigned int tmp;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)