[Mplayer-cvslog] CVS: main/vidix/drivers cyberblade_vid.c,1.1,1.2

Alex Beregszaszi alex at mplayerhq.hu
Sat Dec 21 22:01:21 CET 2002


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

Modified Files:
	cyberblade_vid.c 
Log Message:
more safer version by the author

Index: cyberblade_vid.c
===================================================================
RCS file: /cvsroot/mplayer/main/vidix/drivers/cyberblade_vid.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- cyberblade_vid.c	21 Dec 2002 13:06:23 -0000	1.1
+++ cyberblade_vid.c	21 Dec 2002 21:01:19 -0000	1.2
@@ -2,11 +2,11 @@
     Driver for CyberBlade/i1 - Version 0.1.1
 
     Copyright (C) 2002 by Alastair M. Robinson.
+    Official homepage: http://www.blackfiveservices.co.uk/EPIAVidix.shtml
+
     Based on Permedia 3 driver by Måns Rullgård
 
     Thanks to Gilles Frattini for bugfixes
-    
-    Official homepage: http://www.blackfiveservices.co.uk/EPIAVidix.shtml
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -200,6 +200,7 @@
 	SROUTB(0x11, protect);
 	unmap_phys_mem(cyberblade_reg_base, 0x20000);
 	unmap_phys_mem(cyberblade_mem, 0x800000);
+	disable_app_io();
 }
 
 
@@ -255,8 +256,12 @@
 int vixSetGrKeys(const vidix_grkey_t *grkey)
 {
 	int pixfmt=CRINB(0x38);
+	int protect;
 	memcpy(&cyberblade_grkey, grkey, sizeof(vidix_grkey_t));
 
+	protect=SRINB(0x11);
+	SROUTB(0x11, 0x92);
+
 	if(pixfmt&0x28) /* 32 or 24 bpp */
 	{
 		SROUTB(0x50, cyberblade_grkey.ckey.blue); /* Colour Key */
@@ -278,6 +283,7 @@
 		SROUTB(0x55, 0xff); /* Colour Key Mask */
 		SROUTB(0x56, 0x00); /* Colour Key Mask */
 	}
+	SROUTB(0x11,protect);
 	return(0);
 }
 
@@ -385,13 +391,13 @@
 			break;
 	}
 
-	/* Assume we have 4 MB to play with */
-	info->num_frames = 0x400000 / info->frame_size;
+	/* Assume we have 2 MB to play with */
+	info->num_frames = 0x200000 / info->frame_size;
 	if(info->num_frames > VID_PLAY_MAXFRAMES)
 		info->num_frames = VID_PLAY_MAXFRAMES;
 
-	/* Start at 4 MB. Let's hope it's not in use. */
-	base0 = 0x400000;
+	/* Start at 6 MB. Let's hope it's not in use. */
+	base0 = 0x600000;
 	info->dga_addr = cyberblade_mem + base0;
 
 	info->dest.pitch.y = 16;
@@ -404,6 +410,12 @@
 		frames[i] = base0+info->offsets[i];
 	}
 
+	enable_app_io();
+	OUTPORT8(0x3d4,0x39);
+	OUTPORT8(0x3d5,INPORT(0x3d5)|1);
+
+	SRINB(0x0b); /* Select new mode */
+
 	/* Unprotect hardware registers... */
 	protect=SRINB(0x11);
 	SROUTB(0x11, 0x92);
@@ -422,6 +434,7 @@
 			SROUTB(0x54, 0xff); /* Colour Key Mask */
 			SROUTB(0x55, 0xff); /* Colour Key Mask */
 			SROUTB(0x56, 0xff); /* Colour Key Mask */
+                        printf("[cyberblade] 24/32-bit mode detected\n"); 
 		}
 		else
 		{
@@ -434,6 +447,7 @@
 			SROUTB(0x54, 0xff); /* Colour Key Mask */
 			SROUTB(0x55, 0xff); /* Colour Key Mask */
 			SROUTB(0x56, 0x00); /* Colour Key Mask */
+                        printf("[cyberblade] 16-bit assumed\n"); 
 		}
 	}
 	/* compute_scale_factor(&src_w, &drw_w, &shrink, &zoom); */
@@ -443,7 +457,7 @@
 
 		if(CRINB(0xd1)&0x80)
 		{
-			fprintf(stderr,"[cyberblade] Using TV-CRTC\n");
+			printf("[cyberblade] Using TV-CRTC\n");
 			HTotal=CRINB(0xe0);
 			HSync=CRINB(0xe4);
 			VTotal=CRINB(0xe6);
@@ -459,7 +473,7 @@
 		}
 		else
 		{
-			fprintf(stderr,"[cyberblade] Using Standard CRTC\n");
+			printf("[cyberblade] Using Standard CRTC\n");
 			HTotal=CRINB(0x00);
 			HSync=CRINB(0x04);
 			VTotal=CRINB(0x06);
@@ -469,10 +483,13 @@
 			HSync <<=3;
 			VTotal |= (Overflow & 1) <<8;
 			VTotal |= (Overflow & 0x20) <<4;
+			VTotal +=4;
 			VSync |= (Overflow & 4) <<6;
 			VSync |= (Overflow & 0x80) <<2;
 		}
 
+		printf("[cyberblade] HTotal: 0x%x, HSStart: 0x%x\n",HTotal,HSync); 
+		printf("  VTotal: 0x%x, VStart: 0x%x\n",VTotal,VSync);
 		tx1=(HTotal-HSync)+15+info->dest.x;
 		ty1=(VTotal-VSync)-8+info->dest.y;
 		tx2=tx1+info->dest.w;




More information about the MPlayer-cvslog mailing list