changeset 466:c7c03bf70bb7

UYVY support
author arpi_esp
date Mon, 16 Apr 2001 01:26:08 +0000
parents 7632ddc3f2b4
children e53a9edbee98
files drivers/mga_vid.c libvo/mga_common.c
diffstat 2 files changed, 32 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/drivers/mga_vid.c	Mon Apr 16 00:54:34 2001 +0000
+++ b/drivers/mga_vid.c	Mon Apr 16 01:26:08 2001 +0000
@@ -391,6 +391,8 @@
 	
 	//Setup the BES registers for a three plane 4:2:0 video source 
 
+	regs.besglobctl = 0;
+
 switch(config->format){
     case MGA_VID_FORMAT_YV12:	
 	regs.besctl = 1         // BES enabled
@@ -400,7 +402,7 @@
                     + (1<<16)   // chroma upsampling
                     + (1<<17)   // 4:2:0 mode
                     + (1<<18);  // dither enabled
-
+#if 0
 	if(is_g400)
 	{
 		//zoom disabled, zoom filter disabled, 420 3 plane format, proc amp
@@ -411,8 +413,9 @@
 	{
 		//zoom disabled, zoom filter disabled, Cb samples in 0246, Cr
 		//in 1357, BES register update on besvcnt
-		regs.besglobctl = 0;
+	        regs.besglobctl = 0;
 	}
+#endif
         break;
 
     case MGA_VID_FORMAT_YUY2:	
@@ -426,6 +429,19 @@
 
 	regs.besglobctl = 0;        // YUY2 format selected
         break;
+
+    case MGA_VID_FORMAT_UYVY:	
+	regs.besctl = 1         // BES enabled
+                    + (0<<6)    // even start polarity
+                    + (1<<10)   // x filtering enabled
+                    + (1<<11)   // y filtering enabled
+                    + (1<<16)   // chroma upsampling
+                    + (0<<17)   // 4:2:2 mode
+                    + (1<<18);  // dither enabled
+
+	regs.besglobctl = 1<<6;        // UYVY format selected
+        break;
+
     default:
 	printk(KERN_ERR "mga_vid: Unsupported pixel format: 0x%X\n",config->format);
 	return -1;
@@ -433,7 +449,7 @@
 
 
 	//Disable contrast and brightness control
-	regs.besglobctl = (1<<5) + (1<<7);
+	regs.besglobctl |= (1<<5) + (1<<7);
 	regs.beslumactl = (0x7f << 16) + (0x80<<0);
 	regs.beslumactl = 0x80<<0;
 
@@ -665,6 +681,7 @@
 			if ( mga_irq != -1 ) disable_irq();
 #endif
 			regs.besctl &= ~1;
+                        regs.besglobctl &= ~(1<<6);  // UYVY format selected
 			mga_vid_write_regs();
 		break;
 			
@@ -759,7 +776,8 @@
 		}
 	    }else{
 		switch((card_option>>11)&1){
-		    case 0:  mga_ram_size = 8; break;
+		    case 0:
+		    case 3:  mga_ram_size = 8; break;
 		    default: mga_ram_size = 16;
 		}
 	    } 
@@ -834,6 +852,7 @@
 
 	vid_src_ready = 0;   
 	regs.besctl &= ~1;
+        regs.besglobctl &= ~(1<<6);  // UYVY format selected
 	mga_vid_write_regs();
 	mga_vid_in_use = 0;
 
--- a/libvo/mga_common.c	Mon Apr 16 00:54:34 2001 +0000
+++ b/libvo/mga_common.c	Mon Apr 16 01:26:08 2001 +0000
@@ -12,10 +12,17 @@
 static void draw_alpha(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride){
     int x,y;
     uint32_t bespitch = (mga_vid_config.src_width + 31) & ~31;
-    if (mga_vid_config.format==MGA_VID_FORMAT_YV12)
+    switch(mga_vid_config.format){
+    case MGA_VID_FORMAT_YV12:
         vo_draw_alpha_yv12(w,h,src,srca,stride,vid_data+bespitch*y0+x0,bespitch);
-    else
+        break;
+    case MGA_VID_FORMAT_YUY2:
         vo_draw_alpha_yuy2(w,h,src,srca,stride,vid_data+2*(bespitch*y0+x0),2*bespitch);
+        break;
+    case MGA_VID_FORMAT_UYVY:
+        vo_draw_alpha_yuy2(w,h,src,srca,stride,vid_data+2*(bespitch*y0+x0)+1,2*bespitch);
+        break;
+    }
 }