changeset 221:3daeae4a4aa6

Added support to vo_dga to change the video mode to the lowest resolution that is larger (or equal to) the video stream. Also, by using the -x and -y options the user can specify a specific video mode. Changed the DOCS/AUTHORS file to reflect this patch so that flames get sent to me :)
author mgraffam
date Tue, 27 Mar 2001 04:29:22 +0000
parents 5348fa1313fe
children 163bb3cee94d
files DOCS/AUTHORS libvo/vo_dga.c
diffstat 2 files changed, 46 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/DOCS/AUTHORS	Tue Mar 27 00:39:24 2001 +0000
+++ b/DOCS/AUTHORS	Tue Mar 27 04:29:22 2001 +0000
@@ -43,15 +43,13 @@
 Felix Bünemann: <Felix.Buenemann@gmx.de>
 - SDL driver fixes
 
-Michael Graffam: <mgraffam@idsi.net>
-- XF86VidMode support for x11 driver
-
 TeLeNiEkO: <telenieko@telenieko.com>
 - debian packaging support (see debian/* and DOCS/DEBIAN)
 - spanish translations (see DOCS/Spanish/*)
 
-Michael Graffam: (mgraffam@idsi.net)
+Michael Graffam: <mgraffam@idsi.net>
 - XF86VidMode support to vo_x11
+- Video mode switching code to vo_dga
 
 Main testers:
   Balazs Tibor (Tibcu)
--- a/libvo/vo_dga.c	Tue Mar 27 00:39:24 2001 +0000
+++ b/libvo/vo_dga.c	Tue Mar 27 04:29:22 2001 +0000
@@ -241,6 +241,11 @@
   int bank, ram;
   int x_off, y_off;
 
+// needed to change DGA video mode
+  int modecount,mX, mY, X, Y, i,j;
+  XDGAMode *modelines=NULL;
+  XDGADevice *dgadevice;
+
   if( vo_dga_is_running )return -1;
 
   if( !vo_init() ){
@@ -254,11 +259,48 @@
     return 1;
   } 
 
+// Code to change the video mode added by Michael Graffam
+// mgraffam@idsi.net
+  if (modelines==NULL)
+    modelines=XDGAQueryModes(vo_dga_dpy, XDefaultScreen(vo_dga_dpy),&modecount);
+  
+  mX=modelines[0].imageWidth;
+  mY=modelines[0].imageHeight;
+  X=d_width; Y=d_height; 
+  
+  j=0; 
+  for (i=1; i<=modecount; i++)
+  {
+    if ( (modelines[i].bitsPerPixel == vo_depthonscreen) && 
+         (modelines[i].maxViewportX) && 
+         (modelines[i].viewportWidth >= X) && 
+         (modelines[i].viewportHeight >= Y) && 
+         (modelines[i].viewportWidth < mX) &&
+         (modelines[i].viewportHeight < mY) ) 
+        {
+           mX=modelines[i].viewportWidth;
+           mY=modelines[i].viewportHeight;
+           j=i;
+        }
+   }
+  X=(modelines[j].imageWidth-mX)/2;
+  Y=(modelines[j].imageHeight-mY)/2;
+  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);
+  dgadevice=XDGASetMode(vo_dga_dpy, XDefaultScreen(vo_dga_dpy), modelines[j].num);
+  XDGASync(vo_dga_dpy, XDefaultScreen(vo_dga_dpy));
+
+  XFree(modelines);
+  XFree(dgadevice);
+
+// end mode change code
+
   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;
   
   // do some more checkings here ...
   if( format==IMGFMT_YV12 ) 
@@ -298,8 +340,6 @@
          vo_dga_vp_offset, vo_dga_vp_skip, vo_dga_bytes_per_line);
 
 
-  
-  XF86DGASetViewPort (vo_dga_dpy, XDefaultScreen(vo_dga_dpy), 0, 0);
   XF86DGADirectVideo (vo_dga_dpy, XDefaultScreen(vo_dga_dpy), 
                       XF86DGADirectGraphics | XF86DGADirectMouse | 
                       XF86DGADirectKeyb);