On Montag 18 September 2006 20:50, Marko Mäkelä wrote:
> On Mon, Sep 18, 2006 at 12:55:30PM +0300, Marko Mäkelä wrote:
> > I'm using CVS versions of softdevice and DirectFB from one or two weeks
> > ago, when Stefan fixed the big OSD flicker.
> > 
> > I occasionally see flicker on the OSD layer.  Sometimes, when I close the
> > OSD, it appears that one of the two interlaced fields is not completely
> > cleared.  A few top and bottom lines will flicker between transparent
> > and their previous contents until another menu is opened.  Has anyone
> > else experienced this?
> 
> One or two weeks ago I have noticed that when something is blanked
> (made transparent) in the OSD of -vo dfb:mgatv, the change does not
> happen immediately, but the pixels will fade out in at least 4 steps.

This fading effect is caused by not clearing non-video area (black 
borders). It most visible in paused mode when there are OSD changes
outside the active video area.

Attached patch dfb-blbar-clear-02.patch should fix this. 
Tested this only in pause mode. As this may cause a  higher
load, it should be tested more careful on small systems.

Patch dfb-blbar-clear-03.patch includes this and osdMutex removal
from video-dfb.c . Did only a compile check with this one.


-- 
Stefan Lucke
Index: video-dfb.c
===================================================================
RCS file: /cvsroot/softdevice/softdevice/video-dfb.c,v
retrieving revision 1.71
diff -U3 -r1.71 video-dfb.c
--- video-dfb.c	16 Sep 2006 09:30:19 -0000	1.71
+++ video-dfb.c	22 Sep 2006 20:24:46 -0000
@@ -1274,6 +1274,32 @@
         clearBackground--;
       }
 
+      /* ---------------------------------------------------------------------
+       * clear parts of screen when OSD is present and which are not
+       * covered by video. This avoids fading effects when 16:9 video
+       * is shown on 4:3 screen (top & bottom) or when 4:3 video is shown
+       * on 16:9 screen (left & right).
+       */
+      if (OSDpresent) {
+          scrSurface->SetColor(0,0,0,0);
+
+        /* -------------------------------------------------------------------
+         * clear top & bottom black bar area
+         */
+        if (lyoff) {
+          scrSurface->FillRectangle(0,0,            dwidth,lyoff);
+          scrSurface->FillRectangle(0,lyoff+lheight,dwidth,lyoff);
+        }
+
+        /* -------------------------------------------------------------------
+         * clear left & right black bar area
+         */
+        if (lxoff) {
+          scrSurface->FillRectangle(0,0,           lxoff,dheight);
+          scrSurface->FillRectangle(lxoff+lwidth,0,lxoff,dheight);
+        }
+      }
+
       scrSurface->SetBlittingFlags(DSBLIT_NOFX);
       scrSurface->StretchBlit(videoSurface, &src, &dst);
       if (OSDpresent)
@@ -1447,6 +1473,32 @@
       }
 
       osdMutex.Unlock();
+
+      /* ---------------------------------------------------------------------
+       * clear parts of screen when OSD is present and which are not
+       * covered by video. This avoids fading effects when 16:9 video
+       * is shown on 4:3 screen (top & bottom) or when 4:3 video is shown
+       * on 16:9 screen (left & right).
+       */
+      if (OSDpresent) {
+          scrSurface->SetColor(0,0,0,0);
+
+        /* -------------------------------------------------------------------
+         * clear top & bottom black bar area
+         */
+        if (lyoff) {
+          scrSurface->FillRectangle(0,0,            dwidth,lyoff);
+          scrSurface->FillRectangle(0,lyoff+lheight,dwidth,lyoff);
+        }
+
+        /* -------------------------------------------------------------------
+         * clear left & right black bar area
+         */
+        if (lxoff) {
+          scrSurface->FillRectangle(0,0,           lxoff,dheight);
+          scrSurface->FillRectangle(lxoff+lwidth,0,lxoff,dheight);
+        }
+      }
 
       scrSurface->SetBlittingFlags(DSBLIT_NOFX);
       scrSurface->StretchBlit(videoSurface, &src, &dst);
Index: video-dfb.c
===================================================================
RCS file: /cvsroot/softdevice/softdevice/video-dfb.c,v
retrieving revision 1.71
diff -U3 -r1.71 video-dfb.c
--- video-dfb.c	16 Sep 2006 09:30:19 -0000	1.71
+++ video-dfb.c	22 Sep 2006 21:07:04 -0000
@@ -1137,6 +1137,7 @@
   delete[] dirtyLines;
   dirtyLines=NULL;
   tmpOsdSurface=NULL;
+  clearBackground = 0;
   cVideoOut::CommitUnlockOsdSurface();
 }
 
@@ -1216,10 +1217,8 @@
   {
     if (useStretchBlit)
     {
-      osdMutex.Lock();
       OSDpresent  = false;
-      osdClrBack = true;
-      osdMutex.Unlock();
+      clearBackground = clearBackCount;
       tmpSurface->Clear(COLORKEY,clearAlpha); //clear and
     }
     else
@@ -1248,7 +1247,7 @@
   if (!videoInitialized)
     return;
 
-  if (useStretchBlit && (OSDpresent || osdClrBack)) {
+  if (useStretchBlit && OSDpresent) {
     // do image and OSD mix here
       DFBRectangle  src, dst, osdsrc;
 
@@ -1261,12 +1260,6 @@
     dst.w = lwidth;
     dst.h = lheight;
 
-    osdMutex.Lock();
-    if (osdClrBack) {
-      clearBackground = clearBackCount;
-      osdClrBack = false;
-    }
-
     try
     {
       if (clearBackground) {
@@ -1274,6 +1267,32 @@
         clearBackground--;
       }
 
+      /* ---------------------------------------------------------------------
+       * clear parts of screen when OSD is present and which are not
+       * covered by video. This avoids fading effects when 16:9 video
+       * is shown on 4:3 screen (top & bottom) or when 4:3 video is shown
+       * on 16:9 screen (left & right).
+       */
+      if (OSDpresent) {
+          scrSurface->SetColor(0,0,0,0);
+
+        /* -------------------------------------------------------------------
+         * clear top & bottom black bar area
+         */
+        if (lyoff) {
+          scrSurface->FillRectangle(0,0,            dwidth,lyoff);
+          scrSurface->FillRectangle(0,lyoff+lheight,dwidth,lyoff);
+        }
+
+        /* -------------------------------------------------------------------
+         * clear left & right black bar area
+         */
+        if (lxoff) {
+          scrSurface->FillRectangle(0,0,           lxoff,dheight);
+          scrSurface->FillRectangle(lxoff+lwidth,0,lxoff,dheight);
+        }
+      }
+
       scrSurface->SetBlittingFlags(DSBLIT_NOFX);
       scrSurface->StretchBlit(videoSurface, &src, &dst);
       if (OSDpresent)
@@ -1292,7 +1311,6 @@
                ex->GetAction(), ex->GetResult());
       delete ex;
     }
-    osdMutex.Unlock();
   }
 }
 
@@ -1436,9 +1454,7 @@
       //fprintf (stderr, "src (%d,%d %dx%d)\n", sxoff,syoff,swidth,sheight);
       //fprintf (stderr, "dst (%d,%d %dx%d)\n", lxoff,lyoff,lwidth,lheight);
 
-      osdMutex.Lock();
-      clearBackground = (aspect_changed || osdClrBack) ? clearBackCount: clearBackground;
-      osdClrBack = false;
+      clearBackground = (aspect_changed) ? clearBackCount: clearBackground;
 
       if (clearBackground)
       {
@@ -1446,7 +1462,31 @@
         clearBackground--;
       }
 
-      osdMutex.Unlock();
+      /* ---------------------------------------------------------------------
+       * clear parts of screen when OSD is present and which are not
+       * covered by video. This avoids fading effects when 16:9 video
+       * is shown on 4:3 screen (top & bottom) or when 4:3 video is shown
+       * on 16:9 screen (left & right).
+       */
+      if (OSDpresent) {
+          scrSurface->SetColor(0,0,0,0);
+
+        /* -------------------------------------------------------------------
+         * clear top & bottom black bar area
+         */
+        if (lyoff) {
+          scrSurface->FillRectangle(0,0,            dwidth,lyoff);
+          scrSurface->FillRectangle(0,lyoff+lheight,dwidth,lyoff);
+        }
+
+        /* -------------------------------------------------------------------
+         * clear left & right black bar area
+         */
+        if (lxoff) {
+          scrSurface->FillRectangle(0,0,           lxoff,dheight);
+          scrSurface->FillRectangle(lxoff+lwidth,0,lxoff,dheight);
+        }
+      }
 
       scrSurface->SetBlittingFlags(DSBLIT_NOFX);
       scrSurface->StretchBlit(videoSurface, &src, &dst);
_______________________________________________
Softdevice-devel mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/softdevice-devel

Reply via email to