[Mplayer-cvslog] CVS: 0_90/drivers mga_vid.c,1.48,1.49

Arpi of Ize arpi at mplayerhq.hu
Mon Mar 10 15:04:49 CET 2003


Update of /cvsroot/mplayer/0_90/drivers
In directory mail:/var/tmp.root/cvs-serv25505

Modified Files:
	mga_vid.c 
Log Message:
backport: g400-16mb detection, sprintf->snprintf


Index: mga_vid.c
===================================================================
RCS file: /cvsroot/mplayer/0_90/drivers/mga_vid.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -r1.48 -r1.49
--- mga_vid.c	25 Jul 2002 21:34:24 -0000	1.48
+++ mga_vid.c	10 Mar 2003 14:04:47 -0000	1.49
@@ -88,6 +88,18 @@
 #define PCI_DEVICE_ID_MATROX_G550 0x2527
 #endif
 
+#ifndef PCI_SUBSYSTEM_ID_MATROX_G400_DH_16MB
+#define PCI_SUBSYSTEM_ID_MATROX_G400_DH_16MB 0x2159
+#endif
+
+#ifndef PCI_SUBSYSTEM_ID_MATROX_G400_16MB_SGRAM
+#define PCI_SUBSYSTEM_ID_MATROX_G400_16MB_SGRAM 0x19d8
+#endif
+
+#ifndef PCI_SUBSYSTEM_ID_MATROX_G400_16MB_SDRAM
+#define PCI_SUBSYSTEM_ID_MATROX_G400_16MB_SDRAM 0x0328
+#endif
+
 MODULE_AUTHOR("Aaron Holtzman <aholtzma at engr.uvic.ca>");
 #ifdef MODULE_LICENSE
 MODULE_LICENSE("GPL");
@@ -1366,6 +1378,15 @@
 			mga_ram_size = 16;
 			printk(KERN_INFO "mga_vid: Couldn't detect RAMSIZE, assuming 16MB!");
 		}
+		/* Check for buggy 16MB cards reporting 32 MB */
+		if(mga_ram_size != 16 &&
+		   (pci_dev->subsystem_device == PCI_SUBSYSTEM_ID_MATROX_G400_16MB_SDRAM ||
+		    pci_dev->subsystem_device == PCI_SUBSYSTEM_ID_MATROX_G400_16MB_SGRAM ||
+		    pci_dev->subsystem_device == PCI_SUBSYSTEM_ID_MATROX_G400_DH_16MB))
+		{
+		    printk(KERN_INFO "mga_vid: Detected 16MB card reporting %d MB RAMSIZE, overriding\n", mga_ram_size);
+		    mga_ram_size = 16;
+		}
 	    }else{
 		switch((card_option>>10)&0x17){
 //		    case 0x10:
@@ -1416,14 +1437,14 @@
 {
     unsigned len;
     len = 0;
-    len += sprintf(&mga_param_buff[len],"Interface version: %04X\n",MGA_VID_VERSION);
-    len += sprintf(&mga_param_buff[len],"Memory: %x:%dM\n",mga_mem_base,(unsigned int) mga_ram_size);
-    len += sprintf(&mga_param_buff[len],"MMIO: %p\n",mga_mmio_base);
-    len += sprintf(&mga_param_buff[len],"Configurable stuff:\n");
-    len += sprintf(&mga_param_buff[len],"~~~~~~~~~~~~~~~~~~~\n");
-    len += sprintf(&mga_param_buff[len],PARAM_BRIGHTNESS"%d\n",mga_brightness);
-    len += sprintf(&mga_param_buff[len],PARAM_CONTRAST"%d\n",mga_contrast);
-    len += sprintf(&mga_param_buff[len],PARAM_BLACKIE"%s\n",regs.blackie?"on":"off");
+    len += snprintf(&mga_param_buff[len],PARAM_BUFF_SIZE-len,"Interface version: %04X\n",MGA_VID_VERSION);                                                                                                       
+    len += snprintf(&mga_param_buff[len],PARAM_BUFF_SIZE-len,"Memory: %x:%dM\n",mga_mem_base,(unsigned int) mga_ram_size);                                                                                       
+    len += snprintf(&mga_param_buff[len],PARAM_BUFF_SIZE-len,"MMIO: %p\n",mga_mmio_base);                                                                                                                        
+    len += snprintf(&mga_param_buff[len],PARAM_BUFF_SIZE-len,"Configurable stuff:\n");                                                                                                                           
+    len += snprintf(&mga_param_buff[len],PARAM_BUFF_SIZE-len,"~~~~~~~~~~~~~~~~~~~\n");                                                                                                                           
+    len += snprintf(&mga_param_buff[len],PARAM_BUFF_SIZE-len,PARAM_BRIGHTNESS"%d\n",mga_brightness);                                                                                                             
+    len += snprintf(&mga_param_buff[len],PARAM_BUFF_SIZE-len,PARAM_CONTRAST"%d\n",mga_contrast);                                                                                                                 
+    len += snprintf(&mga_param_buff[len],PARAM_BUFF_SIZE-len,PARAM_BLACKIE"%s\n",regs.blackie?"on":"off");   
     mga_param_buff_len = len;
     // check boundaries of mga_param_buff before writing to it!!!
 }



More information about the MPlayer-cvslog mailing list