Mesa (pipe-video): [g3dvl] make ref_surface handling more sane

Christian König deathsimple at kemper.freedesktop.org
Sat Mar 26 01:04:26 UTC 2011


Module: Mesa
Branch: pipe-video
Commit: ce6f8331fa520bc464a9fa50c18fe57678dd0a24
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=ce6f8331fa520bc464a9fa50c18fe57678dd0a24

Author: Christian König <deathsimple at vodafone.de>
Date:   Fri Mar 25 19:32:22 2011 +0100

[g3dvl] make ref_surface handling more sane

---

 src/gallium/state_trackers/xorg/xvmc/surface.c |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/gallium/state_trackers/xorg/xvmc/surface.c b/src/gallium/state_trackers/xorg/xvmc/surface.c
index bb60192..0330123 100644
--- a/src/gallium/state_trackers/xorg/xvmc/surface.c
+++ b/src/gallium/state_trackers/xorg/xvmc/surface.c
@@ -334,6 +334,15 @@ Status XvMCRenderSurface(Display *dpy, XvMCContext *context, unsigned int pictur
    if (future_surface)
       unmap_and_flush_surface(future_surface->privData);
 
+   /* If the surface we're rendering hasn't changed the ref frames shouldn't change. */
+   if (target_surface_priv->mapped && (
+       target_surface_priv->ref_surfaces[0] != past_surface ||
+       target_surface_priv->ref_surfaces[1] != future_surface)) {
+
+      // If they change anyway we need to flush our surface
+      unmap_and_flush_surface(target_surface_priv);
+   }
+
    MacroBlocksToPipe(vpipe->screen, picture_structure, macroblocks, blocks, first_macroblock,
                      num_macroblocks, pipe_macroblocks);
 
@@ -342,11 +351,8 @@ Status XvMCRenderSurface(Display *dpy, XvMCContext *context, unsigned int pictur
       target_surface_priv->ref_surfaces[0] = past_surface;
       target_surface_priv->ref_surfaces[1] = future_surface;
       target_surface_priv->mapped = 1;
-   } else {
-      /* If the surface we're rendering hasn't changed the ref frames shouldn't change. */
-      assert(target_surface_priv->ref_surfaces[0] == past_surface);
-      assert(target_surface_priv->ref_surfaces[1] == future_surface);
    }
+
    t_buffer->add_macroblocks(t_buffer, num_macroblocks, &pipe_macroblocks->base);
 
    XVMC_MSG(XVMC_TRACE, "[XvMC] Submitted surface %p for rendering.\n", target_surface);




More information about the mesa-commit mailing list