[Mplayer-cvslog] CVS: main/drivers mga_vid.c,1.51,1.52

Alex Beregszaszi alex at mplayerhq.hu
Fri Mar 21 17:29:14 CET 2003


Update of /cvsroot/mplayer/main/drivers
In directory mail:/var/tmp.root/cvs-serv7824

Modified Files:
	mga_vid.c 
Log Message:
multiple mga device support by Hans-Andreas Engel <engel at node.ch>

Index: mga_vid.c
===================================================================
RCS file: /cvsroot/mplayer/main/drivers/mga_vid.c,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -r1.51 -r1.52
--- mga_vid.c	2 Mar 2003 21:21:56 -0000	1.51
+++ mga_vid.c	21 Mar 2003 16:29:04 -0000	1.52
@@ -269,6 +269,7 @@
 
 static int mga_brightness = 0;	// initial brightness
 static int mga_contrast = 0;	// initial contrast
+static int mga_number = 0; // which device/card is taken
 
 //static int mga_force_memsize = 0;
 
@@ -276,6 +277,8 @@
 MODULE_PARM(mga_top_reserved, "i");
 MODULE_PARM(mga_brightness, "i");
 MODULE_PARM(mga_contrast, "i");
+MODULE_PARM(mga_number, "i");
+MODULE_PARM_DESC(mga_number, "selects matrox device/card (0=first)");
 
 static struct pci_dev *pci_dev;
 
@@ -1306,32 +1309,48 @@
 {
 	struct pci_dev *dev = NULL;
 	unsigned int card_option;
+	char *mga_dev_name;
+	int num_found = 0;
 
-	if((dev = pci_find_device(PCI_VENDOR_ID_MATROX, PCI_DEVICE_ID_MATROX_G550, NULL)))
+	while((dev = pci_find_device(PCI_VENDOR_ID_MATROX, PCI_ANY_ID, dev)))
 	{
-		is_g400 = 1;
-		printk(KERN_INFO "mga_vid: Found MGA G550\n");
-	}
-	else if((dev = pci_find_device(PCI_VENDOR_ID_MATROX, PCI_DEVICE_ID_MATROX_G400, NULL)))
-	{
-		is_g400 = 1;
-		printk(KERN_INFO "mga_vid: Found MGA G400/G450\n");
-	}
-	else if((dev = pci_find_device(PCI_VENDOR_ID_MATROX, PCI_DEVICE_ID_MATROX_G200_AGP, NULL)))
-	{
-		is_g400 = 0;
-		printk(KERN_INFO "mga_vid: Found MGA G200 AGP\n");
-	}
-	else if((dev = pci_find_device(PCI_VENDOR_ID_MATROX, PCI_DEVICE_ID_MATROX_G200_PCI, NULL)))
-	{
-		is_g400 = 0;
-		printk(KERN_INFO "mga_vid: Found MGA G200 PCI\n");
+		mga_dev_name = "";
+		num_found++;
+		switch(dev->device) {
+		case PCI_DEVICE_ID_MATROX_G550:
+			is_g400 = 1;
+			mga_dev_name = "MGA G550";
+			break;
+		case PCI_DEVICE_ID_MATROX_G400:
+			is_g400 = 1;
+			mga_dev_name = "MGA G400/G450";
+			break;
+		case PCI_DEVICE_ID_MATROX_G200_AGP:
+			is_g400 = 0;
+			mga_dev_name = "MGA G200 AGP";
+			break;
+		case PCI_DEVICE_ID_MATROX_G200_PCI:
+			is_g400 = 0;
+			mga_dev_name = "MGA G200";
+			break;
+		default:
+			num_found--;
+			printk(KERN_INFO "mga_vid: ignoring matrox device (%d) at %s [%s]\n", dev->device, dev->slot_name, dev->name);
+			break;
+		}
+		if(num_found == mga_number+1)
+			break;
 	}
-	else
+ 	
+	if(!dev)
 	{
-		printk(KERN_ERR "mga_vid: No supported cards found\n");
+		if(num_found==0)
+			printk(KERN_ERR "mga_vid: No supported cards found\n");
+		else
+			printk(KERN_ERR "mga_vid: Only %d supported cards found\n", num_found);
 		return FALSE;   
 	}
+	printk(KERN_INFO "mga_vid: Found %s at %s [%s]\n", mga_dev_name, dev->slot_name, dev->name);
 
 	pci_dev = dev;
 



More information about the MPlayer-cvslog mailing list