Mesa (master): st/va: Fix vaSyncSurface with no outstanding operation

Christian König deathsimple at kemper.freedesktop.org
Tue Sep 27 12:21:52 UTC 2016


Module: Mesa
Branch: master
Commit: a543f231d712dbdfd309ff589766179c5cb32b20
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a543f231d712dbdfd309ff589766179c5cb32b20

Author: Mark Thompson <sw at jkqxz.net>
Date:   Mon Sep 26 23:22:31 2016 +0100

st/va: Fix vaSyncSurface with no outstanding operation

Fixes crash if the application doesn't do what the state tracker expects.

Reviewed-by: Christian König <christian.koenig at amd.com>

---

 src/gallium/state_trackers/va/surface.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/gallium/state_trackers/va/surface.c b/src/gallium/state_trackers/va/surface.c
index 115db43..173e7d9 100644
--- a/src/gallium/state_trackers/va/surface.c
+++ b/src/gallium/state_trackers/va/surface.c
@@ -111,6 +111,12 @@ vlVaSyncSurface(VADriverContextP ctx, VASurfaceID render_target)
       return VA_STATUS_ERROR_INVALID_SURFACE;
    }
 
+   if (!surf->feedback) {
+      // No outstanding operation: nothing to do.
+      pipe_mutex_unlock(drv->mutex);
+      return VA_STATUS_SUCCESS;
+   }
+
    context = handle_table_get(drv->htab, surf->ctx);
    if (!context) {
       pipe_mutex_unlock(drv->mutex);
@@ -126,6 +132,7 @@ vlVaSyncSurface(VADriverContextP ctx, VASurfaceID render_target)
       if (frame_diff < 2)
          context->decoder->flush(context->decoder);
       context->decoder->get_feedback(context->decoder, surf->feedback, &(surf->coded_buf->coded_size));
+      surf->feedback = NULL;
    }
    pipe_mutex_unlock(drv->mutex);
    return VA_STATUS_SUCCESS;




More information about the mesa-commit mailing list