[MPlayer-dev-eng] [PATCH] vo_dfbmga osd flicker fix

Ville Syrjälä syrjala at sci.fi
Tue Nov 12 21:41:54 CET 2002


This patch fixes the OSD flickering problem with vo_dfbmga.

-- 
Ville Syrjälä
syrjala at sci.fi
http://www.sci.fi/~syrjala/
-------------- next part --------------
Index: libvo/vo_dfbmga.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_dfbmga.c,v
retrieving revision 1.5
diff -u -r1.5 vo_dfbmga.c
--- libvo/vo_dfbmga.c	11 Nov 2002 15:20:25 -0000	1.5
+++ libvo/vo_dfbmga.c	12 Nov 2002 20:40:47 -0000
@@ -105,6 +105,8 @@
 static int use_spic  = 1;
 
 static int osd_changed;
+static int osd_dirty;
+static int osd_current;
 
 /******************************
 *	    vo_directfb       *
@@ -436,6 +438,9 @@
      if (use_spic)
           spic->SetOpacity( spic, 0xFF );
 
+     osd_dirty = 0;
+     osd_current = 1;
+
      return 0;
 }
 
@@ -497,8 +502,17 @@
      void *dst;
      int pitch;
 
-     if (use_spic && !osd_changed)
-          return;
+     if (use_spic) {
+          if (!osd_changed)
+               return;
+          osd_dirty |= osd_current;
+     } else if (use_crtc2) {
+          if (x0 < drect.x ||
+              y0 < drect.y ||
+              x0 + w > drect.x + drect.w ||
+              y0 + h > drect.y + drect.h)
+               osd_dirty |= osd_current;
+     }
 
      if (subframe->Lock( subframe, DSLF_WRITE, &dst, &pitch ) != DFB_OK)
           return;
@@ -608,7 +622,7 @@
 
      osd_changed = vo_osd_changed( 0 );
 
-     if (osd_changed) {
+     if (osd_dirty & osd_current) {
           if (use_spic) {
                subframe->Clear( subframe, 0, 0, 0, 0 );
           } else if (use_crtc2) {
@@ -627,6 +641,7 @@
                                         drect.x + drect.w, drect.y,
                                         drect.x, drect.h );
           }
+          osd_dirty &= ~osd_current;
      }
 
      if (use_crtc2) {
@@ -644,8 +659,10 @@
 
      vo_draw_text( sub_width, sub_height, draw_alpha );
 
-     if (use_spic)
+     if (use_spic && osd_changed) {
           subframe->Flip( subframe, NULL, 0 );
+          osd_current ^= 3;
+     }
 }
 
 static void
@@ -657,6 +674,8 @@
      } else {
           /* Flip CRTC2 */
           c2frame->Flip( c2frame, NULL, vo_vsync ? DSFLIP_WAITFORSYNC : 0 );
+          if (!use_spic)
+               osd_current ^= 3;
      }
 
      current_buf = 0;


More information about the MPlayer-dev-eng mailing list