[MPlayer-cvslog] CVS: main/libvo vo_3dfx.c,1.20,1.21

Ivan Kalvachev CVS syncmail at mplayerhq.hu
Sat Dec 10 23:30:33 CET 2005


CVS change done by Ivan Kalvachev CVS

Update of /cvsroot/mplayer/main/libvo
In directory mail:/var2/tmp/cvs-serv3086

Modified Files:
	vo_3dfx.c 
Log Message:
move to next vo if /dev/3dfx could not be opened
open it on preinit not at config time.


Index: vo_3dfx.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_3dfx.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- vo_3dfx.c	10 Dec 2005 21:00:48 -0000	1.20
+++ vo_3dfx.c	10 Dec 2005 22:30:30 -0000	1.21
@@ -101,6 +101,8 @@
 static int bpp;
 static XWindowAttributes attribs;
 
+static int fd=-1;
+
 
 static void 
 restore(void) 
@@ -307,11 +309,12 @@
 static int 
 config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t fullscreen, char *title, uint32_t format) 
 {
-	int fd;
 	char *name = ":0.0";
 	pioData data;
 	uint32_t retval;
 
+//TODO use x11_common for X and window handling
+
 	if(getenv("DISPLAY"))
 		name = getenv("DISPLAY");
 	display = XOpenDisplay(name);
@@ -328,9 +331,9 @@
 	//alarm(120);
 
 	// Open driver device
-	if ( (fd = open("/dev/3dfx",O_RDWR) ) == -1) 
+	if ( fd == -1 ) 
 	{
-		printf("Couldn't open /dev/3dfx\n");
+		printf("Device not opened /dev/3dfx\n");
 		return -1;
 	}
 
@@ -350,7 +353,7 @@
 	if ((retval = ioctl(fd,_IOC(_IOC_READ,'3',3,0),&data)) < 0) 
 	{
 		printf("Error: %d\n",retval);
-		//return -1;
+		return -1;
 	}
 
 	// Ask 3dfx driver for base memory address 1
@@ -361,7 +364,7 @@
 	if ((retval = ioctl(fd,_IOC(_IOC_READ,'3',3,0),&data)) < 0) 
 	{
 		printf("Error: %d\n",retval);
-		//return -1;
+		return -1;
 	}
 
 	// Map all 3dfx memory areas
@@ -406,8 +409,6 @@
 	//XF86DGADirectVideo(display,0,XF86DGADirectGraphics); //| XF86DGADirectMouse | XF86DGADirectKeyb);
 #endif
 
-	/* fd is deliberately not closed - if it were, mmaps might be released??? */
-
 	atexit(restore);
 
 	printf("(display) 3dfx initialized %p\n",memBase1);
@@ -469,6 +470,8 @@
 static void
 uninit(void)
 {
+    if( fd != -1 )
+        close(fd);
 }
 
 
@@ -478,6 +481,12 @@
 
 static int preinit(const char *arg)
 {
+    if ( (fd = open("/dev/3dfx",O_RDWR) ) == -1) 
+    {
+        printf("Couldn't open /dev/3dfx\n");
+        return -1;
+    }
+                                                        
     if(arg) 
     {
 	printf("vo_3dfx: Unknown subdevice: %s\n",arg);




More information about the MPlayer-cvslog mailing list