[Mplayer-cvslog] CVS: main/drivers mga_vid.c,1.47,1.48

Arpi of Ize arpi at mplayerhq.hu
Thu Jul 25 23:34:27 CEST 2002


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

Modified Files:
	mga_vid.c 
Log Message:
- fixed overflow by +-0x80
- save brightness/contrast values, so they won't be reset at next file


Index: mga_vid.c
===================================================================
RCS file: /cvsroot/mplayer/main/drivers/mga_vid.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -r1.47 -r1.48
--- mga_vid.c	28 Jun 2002 16:35:37 -0000	1.47
+++ mga_vid.c	25 Jul 2002 21:34:24 -0000	1.48
@@ -767,10 +767,8 @@
 	//Enable contrast and brightness control
 	regs.besglobctl |= (1<<5) + (1<<7);
 	
-	// brightness ; default is 0x7f;
-	regs.beslumactl = (mga_brightness << 16);
-	// contrast:
-	regs.beslumactl|= ((mga_contrast+0x80)<<0);
+	// brightness (-128..127) && contrast (0..255)
+	regs.beslumactl = (mga_brightness << 16) | ((mga_contrast+0x80)&0xFFFF);
 
 	//Setup destination window boundaries
 	besleft = x > 0 ? x : 0;
@@ -1263,7 +1261,10 @@
 		break;
 
 		case MGA_VID_GET_LUMA:
-			tmp = regs.beslumactl - 0x80;
+			//tmp = regs.beslumactl;
+			//tmp = (tmp&0xFFFF0000) | (((tmp&0xFFFF) - 0x80)&0xFFFF);
+			tmp = (mga_brightness << 16) | (mga_contrast&0xFFFF);
+
 			if (copy_to_user((uint32_t *) arg, &tmp, sizeof(uint32_t)))
 			{
 				printk(KERN_ERR "mga_vid: failed copy %p to userspace %p\n",
@@ -1274,7 +1275,9 @@
 			
 		case MGA_VID_SET_LUMA:
 			tmp = arg;
-			regs.beslumactl = tmp + 0x80;
+			mga_brightness=tmp>>16; mga_contrast=tmp&0xFFFF;
+			//regs.beslumactl = (tmp&0xFFFF0000) | ((tmp + 0x80)&0xFFFF);
+			regs.beslumactl = (mga_brightness << 16) | ((mga_contrast+0x80)&0xFFFF);
 			mga_vid_write_regs(0);
 		break;
 			




More information about the MPlayer-cvslog mailing list