[Mplayer-cvslog] CVS: main/libvo vo_vesa.c,1.33,1.34

Nick Kurshev nick at mplayer.dev.hu
Sun Nov 4 17:21:00 CET 2001


Update of /cvsroot/mplayer/main/libvo
In directory mplayer:/var/tmp.root/cvs-serv22165/main/libvo

Modified Files:
	vo_vesa.c 
Log Message:
Double buffering support

Index: vo_vesa.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_vesa.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- vo_vesa.c	4 Nov 2001 11:50:52 -0000	1.33
+++ vo_vesa.c	4 Nov 2001 16:20:40 -0000	1.34
@@ -147,9 +147,9 @@
   if((err=vbeSetWindow(win.idx,new_offset)) != VBE_OK)
   {
     show_err:
+    vesa_term();
     PRINT_VBE_ERR("vbeSetWindow",err);
     printf("vo_vesa: Fatal error occured! Can't continue\n");
-    vesa_term();
     exit(-1);
   }
   win.low = new_offset * gran;
@@ -313,14 +313,19 @@
     if(!HAS_DGA()) __vbeCopyData(dga_buffer);
     flip_trigger = 0;
   }
-#if 0
   if(vo_doublebuffering && multi_size > 1)
   {
-   vbeSetDisplayStart(multi_buff[multi_idx],1);
-   multi_idx = multi_idx ? 0 : 1;
-   win.ptr = dga_buffer = video_base + multi_buff[multi_idx];
+    int err;
+    if((err=vbeSetDisplayStart(multi_buff[multi_idx],1)) != VBE_OK)
+    {
+      vesa_term();
+      PRINT_VBE_ERR("vbeSetDispayStart",err);
+      printf("vo_vesa: Fatal error occured! Can't continue\n");
+      exit(EXIT_FAILURE);
+    }
+    multi_idx = multi_idx ? 0 : 1;
+    win.ptr = dga_buffer = video_base + multi_buff[multi_idx];
   }
-#endif
 /*
   else
   if(tripple_buffering)
@@ -418,6 +423,34 @@
   }
 }
 
+static void paintBkGnd( void )
+{
+    int x_res = video_mode_info.XResolution;
+    int y_res = video_mode_info.YResolution;
+    int x, y;
+
+    for (y = 0; y < y_res; ++y)
+    {
+	for (x = 0; x < x_res; ++x)
+	{
+	    int r, g, b;
+	    if ((x & 16) ^ (y & 16))
+	    {
+		r = x * 255 / x_res;
+		g = y * 255 / y_res;
+		b = 255 - x * 255 / x_res;
+	    }
+	    else
+	    {
+		r = 255 - x * 255 / x_res;
+		g = y * 255 / y_res;
+		b = 255 - y * 255 / y_res;
+	    }
+	    __vbeSetPixel(x, y, r, g, b);
+	}
+    }
+}
+
 static char *model2str(unsigned char type)
 {
   char *retval;
@@ -796,42 +829,24 @@
 	  printf("vo_vesa: VESA initialization complete\n");
 	  fflush(stdout);
 	}
-	if(verbose)
+	if(HAS_DGA())
 	{
-		int x_res = video_mode_info.XResolution;
-		int y_res = video_mode_info.YResolution;
-		int x, y;
-
-		for (y = 0; y < y_res; ++y)
-			{
-			for (x = 0; x < x_res; ++x)
-				{
-				int r, g, b;
-				if ((x & 16) ^ (y & 16))
-					{
-					r = x * 255 / x_res;
-					g = y * 255 / y_res;
-					b = 255 - x * 255 / x_res;
-					}
-				else
-					{
-					r = 255 - x * 255 / x_res;
-					g = y * 255 / y_res;
-					b = 255 - y * 255 / y_res;
-					}
-
-				__vbeSetPixel(x, y, r, g, b);
-				}
-			}
-	}
-	/*if(1)*/
-	{
-	  int x;
-	  x = video_mode_info.XCharSize ?
-	      (video_mode_info.XResolution/video_mode_info.XCharSize)/2-strlen(title)/2 :
-	      0;
-	  if(x < 0) x = 0;
-	  vbeWriteString(x,0,7,title);
+	    int y = 0;
+	    for(i=0;i<MAX_BUFFERS;i++)
+	    {
+		win.ptr = dga_buffer = video_base + multi_buff[i];
+		if(verbose) paintBkGnd();
+	    }
+	}
+	else
+	{
+	    if(verbose) paintBkGnd();
+	    {
+	        int x;
+	        x = (video_mode_info.XResolution/video_mode_info.XCharSize)/2-strlen(title)/2;
+	        if(x < 0) x = 0;
+	        vbeWriteString(x,0,7,title);
+	    }
 	}
 	return 0;
 }
@@ -847,9 +862,9 @@
 static void
 uninit(void)
 {
+    vesa_term();
     if(verbose > 2)
         printf("vo_vesa: uninit was called\n");
-	vesa_term();
 }
 
 




More information about the MPlayer-cvslog mailing list