Mercurial > mplayer.hg
changeset 17162:e2b0daab849c
move to next vo if /dev/3dfx could not be opened
open it on preinit not at config time.
author | iive |
---|---|
date | Sat, 10 Dec 2005 22:30:30 +0000 |
parents | 4dbe8679f3e1 |
children | 3062ab43fa10 |
files | libvo/vo_3dfx.c |
diffstat | 1 files changed, 16 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/libvo/vo_3dfx.c Sat Dec 10 22:22:24 2005 +0000 +++ b/libvo/vo_3dfx.c Sat Dec 10 22:30:30 2005 +0000 @@ -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);