On Montag 25 September 2006 21:58, Marko Mäkelä wrote:
> On Mon, Sep 25, 2006 at 07:47:17PM +0200, Stefan Lucke wrote:
> > On Montag 25 September 2006 09:37, Marko Mäkelä wrote:
> > > On Sun, Sep 24, 2006 at 11:23:44PM +0200, Stefan Lucke wrote:
> > > > > > Patch dfb-blbar-clear-03.patch includes this and osdMutex removal
> > > > > > from video-dfb.c . Did only a compile check with this one.
> > > > > 
> > > > > I tested this one first.  It removed the fading effect, but 
> > > > > unfortunately
> > > > > it also caused OSD updates to take much longer or to be lost.  When I
> > > > > pressed the Down button for a second in a short Recordings menu that 
> > > > > fits
> > > > > entirely on screen, the selection jumped around in a bit chaotic way.
> > > > > I'm just guessing, but could it be a locking granularity issue?
> > > > 
> > > > Was that during live-tv or during a paused playback of a recording?
> > > > Could be an issue with triplebuffering too.
> > > 
> > > It was during live-tv.  Would you like me to repeat this and send you the
> > > log messages?  Should I enable some extra diagnostics?
> > 
> > I think I have to test this with tv-out too as I didn't get the effects
> > you described with vga out.
> > 
> > You can however do the following (if you like):
> > - If you've still enabled youre usleeps, disable them.
> 
> Sorry, I should have done that.  The usleeps do not seem to affect this.
> 
> > - dirtyLines in GetLockOsdSurface() should be cleared by:
> >   memset(dirtyLines,false,sizeof(bool)*Yres);
> >   as sizeof(dirtyLines) is 4 :-) .
> 
> Changed to the following:
> 
>     memset(dirtyLines,false,sizeof(*dirtyLines) * Yres);
> 
> No effect.
> 
> Sometimes, I can keep the Down or Up button pressed for several seconds,
> and the selection on the Recordings menu will be updated okay (i.e.,
> always jumping by one entry at a constant speed).  Other times, the
> selection will jump abnormally at least once per second.  This occurs
> also on static scenes.  For the record, the key-repeat rate of RCUs
> using the RC5 code is 113.8 ms.

So my tv-out test is still pending, but I've a new version of the patch.
If it still happens for you sometimes, there is the possibility to enable
a mutex around Flip() and Blit() calls. To enable this, USE_TEST_MUTEX
should be defined to 1.

Don't know if DirectFB locks Flip() and Blit() calls internal.

-- 
Stefan Lucke
Index: video.c
===================================================================
RCS file: /cvsroot/softdevice/softdevice/video.c,v
retrieving revision 1.66
diff -U3 -r1.66 video.c
--- video.c	22 Sep 2006 19:28:04 -0000	1.66
+++ video.c	25 Sep 2006 21:17:45 -0000
@@ -105,7 +105,7 @@
 
     if (
         OsdRefreshCounter > 120 || // blanks the screen after inactivity (4s)
-        (current_osdMode == OSDMODE_SOFTWARE &&
+        (IsSoftOSDMode() &&
          OsdRefreshCounter>5 && Osd_changed))
     {
       oldPictureMutex.Lock();
@@ -492,6 +492,13 @@
   Osd_changed=1;
 
  osdMutex.Unlock();
+}
+
+/* ---------------------------------------------------------------------------
+ */
+bool cVideoOut::IsSoftOSDMode()
+{
+  return current_osdMode == OSDMODE_SOFTWARE;
 }
 
 #if VDRVERSNUM >= 10307
Index: video.h
===================================================================
RCS file: /cvsroot/softdevice/softdevice/video.h,v
retrieving revision 1.43
diff -U3 -r1.43 video.h
--- video.h	22 Sep 2006 19:28:04 -0000	1.43
+++ video.h	25 Sep 2006 21:17:46 -0000
@@ -89,7 +89,6 @@
     inline double GetAspect_F()
     { return aspect_F;};
 
-protected:
     // -----------------------------------------------------------------------
     // State changes of OSD like on / off transitions, must be proteced by
     // osdMutex. This are changes of variable OSDpresent, as the output method
@@ -193,6 +192,8 @@
 public:
     virtual void ClearOSD();
     // clear the OSD buffer
+
+    virtual bool IsSoftOSDMode();
 
 #if VDRVERSNUM >= 10307
     virtual void OpenOSD();
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	25 Sep 2006 21:17:48 -0000
@@ -49,6 +49,8 @@
            }                                                         \
      }
 
+#define USE_TEST_MUTEX 0
+
 typedef struct
 {
   const char            *shortName;
@@ -661,8 +663,8 @@
     }
   }
 
-  if (OsdRefreshCounter && (OsdRefreshCounter % 3) == 0)
-    ShowOSD();
+  //if (OsdRefreshCounter && (OsdRefreshCounter % 3) == 0)
+    //ShowOSD();
 }
 
 /* ---------------------------------------------------------------------------
@@ -1072,7 +1074,7 @@
   try
   {
     dirtyLines=DirtyLines=new bool[Yres];
-    memset(dirtyLines,false,sizeof(dirtyLines));
+    memset(dirtyLines,false,sizeof(bool)*Yres);
 
     tmpOsdSurface = (useStretchBlit) ? osdSurface : scrSurface;
     tmpOsdSurface->Lock(DSLF_WRITE, (void **)&dst, &pitch) ;
@@ -1100,7 +1102,13 @@
     DFBRectangle      osdsrc;
 
     tmpOsdSurface->Unlock();
+#if USE_TEST_MUTEX
+    dfbFlipMutex.Lock();
+#endif
     tmpOsdSurface->Flip();
+#if USE_TEST_MUTEX
+    dfbFlipMutex.Unlock();
+#endif
 
     int miny=0;
     int maxy=0;
@@ -1203,6 +1211,14 @@
 
 /* ---------------------------------------------------------------------------
  */
+bool cDFBVideoOut::IsSoftOSDMode()
+{
+  return cVideoOut::IsSoftOSDMode() ||
+         useStretchBlit;
+}
+
+/* ---------------------------------------------------------------------------
+ */
 void cDFBVideoOut::CloseOSD()
 {
     IDirectFBSurface  *tmpSurface;
@@ -1210,8 +1226,8 @@
   if (!videoInitialized)
     return;
 
+  cVideoOut::CloseOSD();
   tmpSurface = (useStretchBlit) ? osdSurface : scrSurface;
-
   try
   {
     if (useStretchBlit)
@@ -1274,6 +1290,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)
@@ -1448,6 +1490,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);
 
@@ -1457,6 +1525,11 @@
         osdsrc.x = osdsrc.y = 0;
         osdsrc.w = Xres;osdsrc.h=Yres;
         scrSurface->SetBlittingFlags(DSBLIT_BLEND_ALPHACHANNEL);
+
+#if USE_TEST_MUTEX
+        dfbFlipMutex.Lock();
+#endif
+
 #if 0
         /* --------------------------------------------------------------------
          * test for OSD scaleinf to 4:3 aspect on a 16:9 tv
@@ -1467,6 +1540,10 @@
         scrSurface->StretchBlit(osdSurface, &osdsrc, &osddest);
 #else
         scrSurface->Blit(osdSurface, &osdsrc, 0, 0);
+#endif
+
+#if USE_TEST_MUTEX
+        dfbFlipMutex.Unlock();
 #endif
 
       }
Index: video-dfb.h
===================================================================
RCS file: /cvsroot/softdevice/softdevice/video-dfb.h,v
retrieving revision 1.22
diff -U3 -r1.22 video-dfb.h
--- video-dfb.h	17 Jun 2006 16:27:35 -0000	1.22
+++ video-dfb.h	25 Sep 2006 21:17:49 -0000
@@ -50,6 +50,8 @@
     void SetParams();
     void EnableFieldParity(IDirectFBDisplayLayer *layer);
 
+    cMutex  dfbFlipMutex;
+
 #ifdef HAVE_CLE266_MPEG_DECODER
     IDirectFBSurface* mpegfb[LAST_PICBUF];
     int               mpegfb_ofs[4];
@@ -62,6 +64,7 @@
     void ProcessEvents ();
     void ShowOSD ();
     void GetDisplayFrameTime();
+    virtual bool IsSoftOSDMode();
 
 #if VDRVERSNUM >= 10307
     bool *dirtyLines;
_______________________________________________
Softdevice-devel mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/softdevice-devel

Reply via email to