changeset 395:01768a027e7d

- fixed bug with depth and mpg when current bpp of XServer was != 32 - when -bpp is selected, I accept only query_modes() for THIS particular depth (if it's supported by hardware)
author acki2
date Fri, 13 Apr 2001 22:11:08 +0000
parents f4fb35ef4c06
children b5748246482d
files libvo/vo_dga.c
diffstat 1 files changed, 30 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/vo_dga.c	Fri Apr 13 21:04:13 2001 +0000
+++ b/libvo/vo_dga.c	Fri Apr 13 22:11:08 2001 +0000
@@ -23,11 +23,10 @@
  * - works only on x86 architectures
  *
  * $Log$
- * Revision 1.11  2001/04/13 18:49:59  acki2
- * - completely rewrote depth switching
- * - support for -bpp
- *   (needs at least mplayer.c 1.53 and cfg-mplayer.h 1.18 and latest stuff from
- *   libvo to work)
+ * Revision 1.12  2001/04/13 22:11:08  acki2
+ * - fixed bug with depth and mpg when current bpp of XServer was != 32
+ * - when -bpp is selected, I accept only query_modes() for THIS particular depth
+ *   (if it's supported by hardware)
  *
  * Revision 1.10  2001/04/01 22:01:28  acki2
  * - still more debug output to be able to fix 15/16 bpp problem
@@ -154,6 +153,18 @@
 }
 
 
+int vd_ValidateMode( int mplayer_depth){
+  int i;
+  if(mplayer_depth == 0)return 0;
+  for(i=1; i<vo_dga_mode_num; i++){
+    if(vo_dga_modes[i].vdm_mplayer_depth == mplayer_depth ){ 
+      vo_dga_modes[i].vdm_supported = 1;
+      return i;
+    }
+  }
+  return 0;
+}
+
 int vd_ModeValid( int mplayer_depth){
   int i;
   if(mplayer_depth == 0)return 0;
@@ -361,12 +372,12 @@
      vd_printf(VD_ERR, "vo_dga: Can't open display!\n");
      return 0;
    }
-
-   vo_dga_XServer_mode = vd_EnableMode(  DefaultDepth(qdisp, DefaultScreen(qdisp)),
-                       BitmapUnit(qdisp),
-                       DefaultVisual(qdisp, DefaultScreen(qdisp))->red_mask,
-                       DefaultVisual(qdisp, DefaultScreen(qdisp))->green_mask,
-                       DefaultVisual(qdisp, DefaultScreen(qdisp))->blue_mask);
+   if( !vo_init() ){
+    vd_printf(VD_ERR, "vo_dga: vo_init() failed!\n");
+    return 1; 
+  }
+  vo_dga_XServer_mode = vd_ValidateMode(vo_depthonscreen);
+ 
    if(vo_dga_XServer_mode ==0){
 #ifndef HAVE_DGA2
      vd_printf(VD_ERR, "vo_dga: Your X-Server is not running in a ");
@@ -388,7 +399,7 @@
 		modelines[i].redMask,
 		modelines[i].greenMask,
 	        modelines[i].blueMask,
-		modelines[i].viewportWidth,
+	 	modelines[i].viewportWidth,
 		modelines[i].viewportHeight);			  
         vd_EnableMode(
 		modelines[i].depth,
@@ -406,7 +417,12 @@
 
    for(i=0; i<vo_dga_mode_num; i++){
      if(vo_dga_modes[i].vdm_supported != 0){
-       vd_printf(VD_INFO, "vo_dga: Supporting mode: %s\n", vd_GetModeString(i));
+       vd_printf(VD_INFO, "vo_dga: Supporting mode: %s", vd_GetModeString(i));
+       if(vo_dbpp && vo_dbpp != vo_dga_modes[i].vdm_mplayer_depth){
+         vo_dga_modes[i].vdm_supported = 0;
+         vd_printf(VD_INFO, " ...disabled by -bpp %d", vo_dbpp );
+       }
+       vd_printf(VD_INFO, "\n");
      }
    }
  }
@@ -435,11 +451,11 @@
     XUngrabPointer (vo_dga_dpy, CurrentTime);
     XUngrabKeyboard (vo_dga_dpy, CurrentTime);
 #ifdef HAVE_DGA2
+    XDGACloseFramebuffer(vo_dga_dpy, XDefaultScreen(vo_dga_dpy));
     dgadevice = XDGASetMode(vo_dga_dpy, XDefaultScreen(vo_dga_dpy), 0);
     if(dgadevice != NULL){
       XFree(dgadevice);	
     }
-    XDGACloseFramebuffer(vo_dga_dpy, XDefaultScreen(vo_dga_dpy));
 #else
     XF86DGADirectVideo (vo_dga_dpy, XDefaultScreen(vo_dga_dpy), 0);
     // first disable DirectVideo and then switch mode back!