[MPlayer-matrox] r252 - in mga_vid/trunk: mga_vid.c mga_vid.h

attila subversion at mplayerhq.hu
Sun Mar 18 11:02:18 CET 2007


Author: attila
Date: Sun Mar 18 11:02:17 2007
New Revision: 252

Modified:
   mga_vid/trunk/mga_vid.c
   mga_vid/trunk/mga_vid.h

Log:
replace is_g400 in the mga_vid internal card struct by card_type 
to be able to distinguish between G400 and G550


Modified: mga_vid/trunk/mga_vid.c
==============================================================================
--- mga_vid/trunk/mga_vid.c	(original)
+++ mga_vid/trunk/mga_vid.c	Sun Mar 18 11:02:17 2007
@@ -269,7 +269,7 @@ typedef struct mga_card_s {
 	size_t param_buff_len;
 	bes_registers_t regs;
 	uint32_t vid_in_use;
-	uint32_t is_g400;
+	uint32_t card_type;
 	uint32_t vid_src_ready;
 	uint32_t vid_overlay_on;
 
@@ -458,7 +458,7 @@ if(!restore){
 
 	// Backend Scaler
 	writel( card->regs.besctl,      card->mmio_base + BESCTL); 
-	if(card->is_g400)
+	if(card->card_type != MGA_G200)
 		writel( card->regs.beslumactl,  card->mmio_base + BESLUMACTL); 
 	writel( card->regs.bespitch,    card->mmio_base + BESPITCH); 
 
@@ -470,7 +470,7 @@ if(!restore){
 	writel( card->regs.besb1corg,   card->mmio_base + BESB1CORG);
 	writel( card->regs.besb2org,    card->mmio_base + BESB2ORG);
 	writel( card->regs.besb2corg,   card->mmio_base + BESB2CORG);
-	if(card->is_g400) 
+	if(card->card_type != MGA_G200) 
 	{
 		writel( card->regs.besa1c3org,  card->mmio_base + BESA1C3ORG);
 		writel( card->regs.besa2c3org,  card->mmio_base + BESA2C3ORG);
@@ -550,7 +550,7 @@ switch(config->format){
                     + (1<<17)   // 4:2:0 mode
                     + (1<<18);  // dither enabled
 #if 0
-	if(card->is_g400)
+	if(card->card_type != MGA_G200)
 	{
 		//zoom disabled, zoom filter disabled, 420 3 plane format, proc amp
 		//disabled, rgb mode disabled 
@@ -639,12 +639,12 @@ if(config->format==MGA_VID_FORMAT_YV12
  ||config->format==MGA_VID_FORMAT_I420
  ){
         // planar YUV frames:
-	if (card->is_g400) 
+	if (card->card_type != MGA_G200) 
 		baseadrofs = ( ( (ofstop * card->regs.besviscal ) / 4 ) >> 16 ) * card->regs.bespitch;
 	else 
 		baseadrofs = ( ( ( ofstop * card->regs.besviscal ) / 2 ) >> 16 ) * card->regs.bespitch;
 
-    if(config->format==MGA_VID_FORMAT_YV12 || !card->is_g400){
+    if(config->format==MGA_VID_FORMAT_YV12 || (card->card_type == MGA_G200)){
 	card->regs.besa1corg = (uint32_t) card->src_base + baseadrofs + card->regs.bespitch * sh ;
 	card->regs.besa2corg = (uint32_t) card->src_base + baseadrofs + 1*frame_size + card->regs.bespitch * sh;
 	card->regs.besb1corg = (uint32_t) card->src_base + baseadrofs + 2*frame_size + card->regs.bespitch * sh;
@@ -729,10 +729,7 @@ static int mga_vid_ioctl(struct inode *i
 			printk(KERN_DEBUG "mga YUV buffer base: 0x%X\n", card->src_base);
 #endif			
 			
-			if (card->is_g400) 
-			  card->config.card_type = MGA_G400;
-			else
-			  card->config.card_type = MGA_G200;
+			card->config.card_type = card->card_type;
 		       
 			card->config.ram_size = card->ram_size;
 
@@ -809,7 +806,7 @@ static int mga_vid_ioctl(struct inode *i
 	return 0;
 }
 
-static void cards_init(mga_card_t * card, struct pci_dev * dev, int card_number, int is_g400);
+static void cards_init(mga_card_t * card, struct pci_dev * dev, int card_number, int card_type);
 
 // returns the number of found cards
 static int mga_vid_find_card(void)
@@ -843,22 +840,22 @@ static int mga_vid_find_card(void)
 		case PCI_DEVICE_ID_MATROX_G550:
 			mga_dev_name = "MGA G550";
 			printk(KERN_INFO "mga_vid: Found %s at %s\n", mga_dev_name,  pci_name(dev));
-			cards_init(card, dev, mga_cards_num - 1, 1);
+			cards_init(card, dev, mga_cards_num - 1, MGA_G550);
 			break;
 		case PCI_DEVICE_ID_MATROX_G400:
 			mga_dev_name = "MGA G400/G450";
 			printk(KERN_INFO "mga_vid: Found %s at %s\n", mga_dev_name, pci_name(dev));
-			cards_init(card, dev, mga_cards_num - 1, 1);
+			cards_init(card, dev, mga_cards_num - 1, MGA_G400);
 			break;
 		case PCI_DEVICE_ID_MATROX_G200_AGP:
 			mga_dev_name = "MGA G200 AGP";
 			printk(KERN_INFO "mga_vid: Found %s at %s\n", mga_dev_name, pci_name(dev));
-			cards_init(card, dev, mga_cards_num - 1, 0);
+			cards_init(card, dev, mga_cards_num - 1, MGA_G200);
 			break;
 		case PCI_DEVICE_ID_MATROX_G200_PCI:
 			mga_dev_name = "MGA G200";
 			printk(KERN_INFO "mga_vid: Found %s at %s\n", mga_dev_name, pci_name(dev));
-			cards_init(card, dev, mga_cards_num - 1, 0);
+			cards_init(card, dev, mga_cards_num - 1, MGA_G200);
 			break;
 		default:
 			mga_cards_num--;
@@ -1029,14 +1026,15 @@ static struct file_operations mga_vid_fo
 	release: 	mga_vid_release
 };
 
-static void cards_init(mga_card_t * card, struct pci_dev * dev, int card_number, int is_g400)
+static void cards_init(mga_card_t * card, struct pci_dev * dev, int card_number, int card_type)
 {
 	unsigned int card_option;
 
 	memset(card,0,sizeof(mga_card_t));
 
 	card->pci_dev = dev;
-	card->is_g400 = is_g400;
+
+	card->card_type = card_type;
 
 	card->param_buff = kmalloc(PARAM_BUFF_SIZE,GFP_KERNEL);
 	if(card->param_buff) card->param_buff_size = PARAM_BUFF_SIZE;
@@ -1065,7 +1063,7 @@ static void cards_init(mga_card_t * card
 
 #else
 
-	    if (card->is_g400){
+	    if (card->card_type != MGA_G200){
 		switch((card_option>>10)&0x17){
 		    // SDRAM:
 		    case 0x00:

Modified: mga_vid/trunk/mga_vid.h
==============================================================================
--- mga_vid/trunk/mga_vid.h	(original)
+++ mga_vid/trunk/mga_vid.h	Sun Mar 18 11:02:17 2007
@@ -15,8 +15,6 @@
 #ifndef __LINUX_MGAVID_H
 #define __LINUX_MGAVID_H
 
-//#include <inttypes.h>
-
 typedef struct mga_vid_config_s
 {
 uint16_t version;
@@ -52,6 +50,9 @@ uint32_t num_frames;
 
 #define MGA_G200 0x1234
 #define MGA_G400 0x5678
+// currently unused, G450 are mapped to MGA_G400
+// #define MGA_G450 0x9ABC
+#define MGA_G550 0xDEF0
 
 #define MGA_VID_VERSION 0x0201
 



More information about the MPlayer-matrox mailing list