[mythtv] [patch] xvmc misc, small

Daniel Thor Kristjansson danielk at cat.nyu.edu
Tue Aug 24 11:30:11 EDT 2004


Two little things. First, increase the number of XvMC buffers allocated
from 7 to 8. Second, move a lock to take effect one statement earlier.

Really, we should allocate as many XvMC buffers as possible, but that's
a more extensive change. Eight is the limit on the nvidia cards, so there
isn't much point at the moment. The lock is just a correctness thing,
it's just one assignment that isn't protected.

Allocating more buffers helps with skipping. With other changes, not in
this patch, it also gives us slightly more time to render each frame.

-- Daniel
-------------- next part --------------
Index: libs/libmythtv/videoout_xvmc.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/videoout_xvmc.cpp,v
retrieving revision 1.33
diff -u -r1.33 videoout_xvmc.cpp
--- libs/libmythtv/videoout_xvmc.cpp	5 Aug 2004 07:35:02 -0000	1.33
+++ libs/libmythtv/videoout_xvmc.cpp	24 Aug 2004 15:21:12 -0000
@@ -72,7 +72,7 @@
     extern XvImage  *XvShmCreateImage(Display*, XvPortID, int, char*, int, int, XShmSegmentInfo*);
 }
 
-const int kNumBuffers = 7;
+const int kNumBuffers = 8;
 const int kPrebufferFrames = 4;
 const int kNeedFreeFrames = 2;
 const int kKeepPrebuffer = 1;
@@ -814,7 +814,7 @@
 
     pthread_mutex_lock(&lock);
 
-    xvmc_render_state_t *render = (xvmc_render_state_t *)buffer->buf;
+    xvmc_render_state_t *render = reinterpret_cast<xvmc_render_state_t *>(buffer->buf);
 
     SyncSurface(data->XJ_disp, render->p_surface);
 
@@ -856,10 +856,15 @@
             break;
     }
 
+    pthread_mutex_lock(&lock);
+
     xvmc_render_state_t *render = data->p_render_surface_to_show;
 
     if (render == NULL)
+    {
+        pthread_mutex_unlock(&lock);
         return;
+    }
 
     xvmc_render_state_t *osdren = NULL;
 
@@ -870,8 +875,6 @@
     xvmc_render_state_t *showingsurface = (osdren) ? osdren : render;
     XvMCSurface *surf = showingsurface->p_surface;
 
-    pthread_mutex_lock(&lock);
-
     if (data->p_render_surface_visible != NULL)
         data->p_render_surface_visible->state &= ~MP_XVMC_STATE_DISPLAY_PENDING;
 


More information about the mythtv-dev mailing list