[mythtv] Problems with latest CVS & DVB & Unichrome

Daniel Thor Kristjansson danielk at mrl.nyu.edu
Sat Feb 5 20:52:29 UTC 2005


On Sat, 5 Feb 2005, Ivor Hewitt wrote:
]On Saturday 05 Feb 2005 17:23, Daniel Thor Kristjansson wrote:
]I've gone back to 31/1/2005 and the VLD acceleration is fine there. I'm a bit 
]busy at the moment but I'm trying to see what change caused the XvMC break.
]The bob deint is still broken for XV at that date. I assume it's a unichrome 
]driver bug, but no-ones reported it to us so who knows when it happened. 

Here's a debugging patch for xvmc. I compared with versions back to 1.38 
and added enable and disable defines at the top of the file. These let 
you disable the changes one by one that may be causing problems.

But if the change happened in 1.38 or earlier it begins to get 
complicated...

Are you saying the green flashing happening in XV with Jan 31st CVS?

If you mean something else...
In videoout_xv.cpp can you try changing
    InitColorKey(true);
to
    InitColorKey(false);
at around line 507? I think the color key painting might be
getting triggered way too often of some reason.

-- Daniel
-------------- next part --------------
Index: libs/libmythtv/videoout_xvmc.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/videoout_xvmc.cpp,v
retrieving revision 1.42
diff -u -r1.42 videoout_xvmc.cpp
--- libs/libmythtv/videoout_xvmc.cpp	3 Feb 2005 23:58:11 -0000	1.42
+++ libs/libmythtv/videoout_xvmc.cpp	5 Feb 2005 20:40:27 -0000
@@ -86,6 +86,13 @@
 #define GUID_IA44  0x34344941
 #define GUID_AI44  0x34344149
 
+#define ENABLE_LOCK_HACK         1 /* release locks to give more time to decoder      */
+#define ENABLE_SCALING           1 /* draw only needed portion of second frame        */
+#define ENABLE_VLD_HACK          1 /* wait for paint to finish before releasing locks */
+#define ENABLE_NEW_FRAME_DISCARD 1 /* discard frames more logically       */
+#define DISABLE_AUTOPAINT        1 /* disable autopaint to remove bug 166 */
+#define ENABLE_BOB_DEBUG         1 /* extra debugging during VB_PLAYBACK  */
+
 struct XvMCData
 {
     Window XJ_root;
@@ -513,7 +520,7 @@
         return false;
     }
 
-    InitColorKey(true);
+    InitColorKey(DISABLE_AUTOPAINT);
 
     if (gContext->GetNumSetting("UseOutputPictureControls", 0))
     {
@@ -551,8 +558,12 @@
 
                 if (turnoffautopaint)
                     XvSetPortAttribute(data->XJ_disp, xv_port, xv_atom, 0);
-                else 
-                    XvSetPortAttribute(data->XJ_disp, xv_port, xv_atom, 1);
+                else
+                {
+                    ret = XvSetPortAttribute(data->XJ_disp, xv_port, xv_atom, 1);
+                    if (ret == Success)
+                        data->needdrawcolor = false;
+                }
             }
         }
         XFree(attributes);
@@ -933,7 +944,6 @@
         {
             field = 2;
             halfLineSrc = (int) round(((float)disphoff)/imgh - 0.001f);
-            //src_h -= (halfLineSrc) ? 2 : 0;
         }
     }
 
@@ -963,25 +973,44 @@
     // away from the decoding process, and coming back from a pause can
     // result in a very low buffer situation, causing jerky playback.
     // Let's just hope that the XvMC driver's a bit threadsafe.
+#if ENABLE_LOCK_HACK
     if (field != 3)
         pthread_mutex_unlock(&lock);
+#endif
 
     int yoff = dispyoff;
     int hoff = disphoff;
-    if (!hasVLDAcceleration())
+
+    if (2 == field)
     {
-        yoff += halfLineSrc;
-        hoff -= halfLineSrc;
+        if (!hasVLDAcceleration())
+        {
+            yoff += halfLineSrc;
+#if ENABLE_SCALING
+            hoff -= 2 * halfLineSrc;
+            src_h -= (halfLineSrc) ? 2 : 0;
+#endif
+        }
+#if ENABLE_BOB_DEBUG
+        VERBOSE(VB_PLAYBACK,
+                QString("XvPut img_h(%1-%6) dest y(%2+%4) h(%3-%5)")
+                .arg(imgh).arg(yoff).arg(hoff)
+                .arg(halfLineSrc).arg(2 * halfLineSrc)
+                .arg(2 * ((halfLineSrc) ? 1 : 0))); /* 2* for imgh coords */
+#endif
     }
 
     XvMCPutSurface(data->XJ_disp, surf, data->XJ_curwin,
                    imgx, imgy, imgw, src_h,
                    dispxoff, yoff, dispwoff, hoff, field);
 
+#if ENABLE_LOCK_HACK
     if (field != 3)
         pthread_mutex_lock(&lock);
+#endif
 
-/*  Doesn't seem necessary.
+#if ENABLE_VLD_HACK
+    //Doesn't seem necessary.
     if (data->p_render_surface_visible && 
         (data->p_render_surface_visible != showingsurface))
     {
@@ -998,27 +1027,41 @@
             XvMCGetSurfaceStatus(data->XJ_disp, surf, &status);
         }
     }
-*/
+#endif
 
     data->p_render_surface_visible = data->p_render_surface_to_show;
 
+#if ENABLE_NEW_FRAME_DISCARD
     if (data->curosd && data->curosd != osdframe)
     {
         DiscardFrame(data->curosd);
         data->curosd = NULL;
     }
+#else
+    if (!m_deinterlacing || (m_deinterlacing && field == 2))
+        data->p_render_surface_to_show = NULL;
+#endif
 
     if (osdframe)
     {
         data->p_render_surface_visible = osdren;
+#if ENABLE_NEW_FRAME_DISCARD
+        data->curosd = osdframe;
+#else
+        if (data->curosd)
+            DiscardFrame(data->curosd);
         data->curosd = osdframe;
+        render->p_osd_target_surface_render = NULL;
+#endif
     } 
  
+#if ENABLE_NEW_FRAME_DISCARD
     if (!m_deinterlacing || (m_deinterlacing && scan != kScan_Interlaced))
     {
         data->p_render_surface_to_show = NULL;
         render->p_osd_target_surface_render = NULL;
     }
+#endif
 
     pthread_mutex_unlock(&lock);
 }
@@ -1110,12 +1153,16 @@
     // boboff assumes the smallest interlaced resolution is 480 lines
     int boboff = (int) round(((float)disphoff)/480 - 0.001f);
     boboff = (m_deinterlacing && m_deintfiltername == "bobdeint") ? boboff : 0;
+#if ENABLE_BOB_DEBUG
+    VERBOSE(VB_PLAYBACK, QString("disphoff(%1) boboff(%2) ndc(%3)")
+            .arg(disphoff).arg(boboff).arg((data->needdrawcolor?"yes":"no")));
+#endif
 
     if (data->needdrawcolor)
     {
         XSetForeground(data->XJ_disp, data->XJ_gc, data->colorkey);
         XFillRectangle(data->XJ_disp, data->XJ_curwin, data->XJ_gc,
-                       dispx, dispy+boboff, dispw, disph);
+                       dispx, dispy+boboff, dispw, disph - 2 * boboff);
     }
 
     XSetForeground(data->XJ_disp, data->XJ_gc, XJ_black);
@@ -1128,11 +1175,11 @@
                        (dispx+dispw)-(dispxoff+dispwoff), disph);
     if (dispyoff+boboff > dispy) // top of screen
         XFillRectangle(data->XJ_disp, data->XJ_curwin, data->XJ_gc, 
-                       dispx, dispy, dispw, dispyoff+boboff-dispy);
-    if (dispyoff+disphoff < dispy+disph) // bottom of screen
+                       dispx, dispy, dispw, dispyoff + boboff - dispy);
+    if (dispyoff + disphoff < dispy + disph + boboff) // bottom of screen
         XFillRectangle(data->XJ_disp, data->XJ_curwin, data->XJ_gc, 
-                       dispx, dispyoff+disphoff, 
-                       dispw, (dispy+disph)-(dispyoff+disphoff));
+                       dispx, dispyoff + disphoff - boboff,
+                       dispw, (dispy + disph + boboff) - (dispyoff + disphoff));
 
     if (sync)
         XSync(data->XJ_disp, false);


More information about the mythtv-dev mailing list