comparison src/video/x11/SDL_x11yuv.c @ 182:d4ebd1bbea9a

Fix XVideo on GeForce by using last available adaptor
author Sam Lantinga <slouken@libsdl.org>
date Fri, 14 Sep 2001 02:55:36 +0000
parents 74212992fb08
children e8157fcb3114
comparison
equal deleted inserted replaced
181:e5bc29de3f0a 182:d4ebd1bbea9a
48 #endif 48 #endif
49 49
50 /* Workaround when pitch != width */ 50 /* Workaround when pitch != width */
51 #define PITCH_WORKAROUND 51 #define PITCH_WORKAROUND
52 52
53 /* Fix for the NVidia GeForce 2 - use the last available adaptor */
54 #define USE_LAST_ADAPTOR
55
53 /* The functions used to manipulate software video overlays */ 56 /* The functions used to manipulate software video overlays */
54 static struct private_yuvhwfuncs x11_yuvfuncs = { 57 static struct private_yuvhwfuncs x11_yuvfuncs = {
55 X11_LockYUVOverlay, 58 X11_LockYUVOverlay,
56 X11_UnlockYUVOverlay, 59 X11_UnlockYUVOverlay,
57 X11_DisplayYUVOverlay, 60 X11_DisplayYUVOverlay,
79 xv_port = -1; 82 xv_port = -1;
80 if ( (Success == XvQueryExtension(GFX_Display, &j, &j, &j, &j, &j)) && 83 if ( (Success == XvQueryExtension(GFX_Display, &j, &j, &j, &j, &j)) &&
81 (Success == XvQueryAdaptors(GFX_Display, 84 (Success == XvQueryAdaptors(GFX_Display,
82 RootWindow(GFX_Display, SDL_Screen), 85 RootWindow(GFX_Display, SDL_Screen),
83 &adaptors, &ainfo)) ) { 86 &adaptors, &ainfo)) ) {
87 #ifdef USE_LAST_ADAPTOR
88 for ( i=0; i < adaptors; ++i ) {
89 #else
84 for ( i=0; (i < adaptors) && (xv_port == -1); ++i ) { 90 for ( i=0; (i < adaptors) && (xv_port == -1); ++i ) {
91 #endif /* USE_LAST_ADAPTOR */
85 /* Check to see if the visual can be used */ 92 /* Check to see if the visual can be used */
86 if ( BUGGY_XFREE86(<=, 4001) ) { 93 if ( BUGGY_XFREE86(<=, 4001) ) {
87 int visual_ok = 0; 94 int visual_ok = 0;
88 for ( j=0; j<ainfo[i].num_formats; ++j ) { 95 for ( j=0; j<ainfo[i].num_formats; ++j ) {
89 if ( ainfo[i].formats[j].visual_id == 96 if ( ainfo[i].formats[j].visual_id ==
100 (ainfo[i].type & XvImageMask) ) { 107 (ainfo[i].type & XvImageMask) ) {
101 int num_formats; 108 int num_formats;
102 XvImageFormatValues *formats; 109 XvImageFormatValues *formats;
103 formats = XvListImageFormats(GFX_Display, 110 formats = XvListImageFormats(GFX_Display,
104 ainfo[i].base_id, &num_formats); 111 ainfo[i].base_id, &num_formats);
112 #ifdef USE_LAST_ADAPTOR
113 for ( j=0; j < num_formats; ++j ) {
114 #else
105 for ( j=0; (j < num_formats) && (xv_port == -1); ++j ) { 115 for ( j=0; (j < num_formats) && (xv_port == -1); ++j ) {
116 #endif /* USE_LAST_ADAPTOR */
106 if ( (Uint32)formats[j].id == format ) { 117 if ( (Uint32)formats[j].id == format ) {
107 for ( k=0; k < ainfo[i].num_ports; ++k ) { 118 for ( k=0; k < ainfo[i].num_ports; ++k ) {
108 if ( Success == XvGrabPort(GFX_Display, ainfo[i].base_id+k, CurrentTime) ) { 119 if ( Success == XvGrabPort(GFX_Display, ainfo[i].base_id+k, CurrentTime) ) {
109 xv_port = ainfo[i].base_id+k; 120 xv_port = ainfo[i].base_id+k;
110 break; 121 break;