changeset 233:f62ccacbe1e5

Changes to configure to autodetect DGA 2.0 functionality, and to only use DGA video mode switching when DGA 2.0 is present
author mgraffam
date Wed, 28 Mar 2001 19:58:45 +0000
parents 6ec35ac3c74c
children fae0ed5ac7d2
files configure libvo/vo_dga.c
diffstat 2 files changed, 49 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/configure	Wed Mar 28 18:15:51 2001 +0000
+++ b/configure	Wed Mar 28 19:58:45 2001 +0000
@@ -167,6 +167,7 @@
 _mpg123=no
 _xmga=no
 _dga=no
+_dga2=no
 _fbdev=no
 _lirc=no
 
@@ -393,6 +394,18 @@
 
 # ---
 
+# Check if DGA is 2.0 or greater
+cat > $TMPC << EOF
+#include <stdio.h>
+#include <X11/Xlib.h>
+#include <X11/extensions/xf86dga.h>
+int main (void) { XDGAMode mode; XDGADevice device; return 0;}
+EOF
+
+_dga2=no
+$_cc $TMPC -o $TMPO -L/usr/X11R6/lib -L/usr/X11/lib -lX11 -lXext -lXxf86dga -lXxf86vm &> /dev/null && _dga2=yes
+
+
 cat > $TMPC << EOF
 #include <GL/gl.h>
 int main( void ) { return 0; }
@@ -443,7 +456,10 @@
         ;;	
   --enable-dga)
         _dga=yes
-        ;;	
+        ;;
+  --enable-dga2)
+        _dga2=yes
+        ;;
   --enable-xv)
         _xv=yes
         ;;
@@ -513,6 +529,9 @@
   --disable-dga)
 	_dga=no
 	;;
+  --disable-dga2)
+        _dga2=no
+        ;;
   --disable-fbdev)
   	_fbdev=no
 	;;
@@ -555,6 +574,7 @@
 echo "Checking for Xv ... $_xv"
 echo "Checking for X11 ... $_x11"
 echo "Checking for DGA ... $_dga"
+echo "Checking for DGA 2.0 .. $_dga2"
 echo "Checking for Xf86VM ... $_vm"
 echo "Checking for FBDev ... $_fbdev"
 # write conf files.
@@ -727,6 +747,13 @@
  _dga='#undef HAVE_DGA'
 fi
 
+if [ $_dga2 = yes ]; then
+ _dga2='#define HAVE_DGA2'
+ _vosrc=$_vosrc' vo_dga.c vo_fsdga.c'
+else
+ _dga2='#undef HAVE_DGA2'
+fi
+
 if [ $_fbdev = yes ]; then
  _fbdev='#define HAVE_FBDEV'
  _vosrc=$_vosrc' vo_fbdev.c'
@@ -807,6 +834,7 @@
 $_vm
 $_gl
 $_dga
+$_dga2
 $_sdldef
 $_3dfx
 $_mga
--- a/libvo/vo_dga.c	Wed Mar 28 18:15:51 2001 +0000
+++ b/libvo/vo_dga.c	Wed Mar 28 19:58:45 2001 +0000
@@ -241,10 +241,13 @@
   int bank, ram;
   int x_off, y_off;
 
+#ifdef HAVE_DGA2
 // needed to change DGA video mode
-  int modecount,mX, mY, X, Y, i,j;
+  int modecount,mX, mY, i,j;
+  int X,Y;
   XDGAMode *modelines=NULL;
   XDGADevice *dgadevice;
+#endif
 
   if( vo_dga_is_running )return -1;
 
@@ -259,6 +262,7 @@
     return 1;
   } 
 
+#ifdef HAVE_DGA2
 // Code to change the video mode added by Michael Graffam
 // mgraffam@idsi.net
   if (modelines==NULL)
@@ -285,6 +289,7 @@
    }
   X=(modelines[j].imageWidth-mX)/2;
   Y=(modelines[j].imageHeight-mY)/2;
+  printf("vo_dga: Using DGA 2.0 mode changing support\n");
   printf("vo_dga: Selected video mode %dx%d for image size %dx%d.\n", mX, mY,width, height);  
 
   XF86DGASetViewPort (vo_dga_dpy, XDefaultScreen(vo_dga_dpy), X,Y);
@@ -293,15 +298,22 @@
 
   XFree(modelines);
   XFree(dgadevice);
-
-// end mode change code
+  // end mode change code
+#else
+printf("vo_dga: DGA 1.0 compatibility code\n");
+#endif
 
-  XF86DGAGetVideo (vo_dga_dpy, XDefaultScreen(vo_dga_dpy), 
-                  (char **)&vo_dga_base, &vo_dga_width, &bank, &ram);
+XF86DGAGetViewPortSize(vo_dga_dpy,XDefaultScreen(vo_dga_dpy),
+			&vo_dga_vp_width,
+			&vo_dga_vp_height); 
 
-  vo_dga_vp_width=modelines[j].viewportWidth;
-  vo_dga_vp_height=modelines[j].viewportHeight;
-  
+XF86DGAGetVideo (vo_dga_dpy, XDefaultScreen(vo_dga_dpy), 
+                (char **)&vo_dga_base, &vo_dga_width, &bank, &ram);
+
+#ifndef HAVE_DGA2
+XF86DGASetViewPort (vo_dga_dpy, XDefaultScreen(vo_dga_dpy), 0, 0);
+#endif
+
   // do some more checkings here ...
   if( format==IMGFMT_YV12 ) 
     yuv2rgb_init( vo_depthonscreen, MODE_RGB );