summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/va
diff options
context:
space:
mode:
authorMark Thompson <[email protected]>2016-09-26 23:22:31 +0100
committerChristian König <[email protected]>2016-09-27 14:21:44 +0200
commita543f231d712dbdfd309ff589766179c5cb32b20 (patch)
treea2e80e7eb6c80fd55787524c1a5925b529e933aa /src/gallium/state_trackers/va
parentdf920367bf85d3a326da5928a73f35844a4a8c72 (diff)
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 <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/va')
-rw-r--r--src/gallium/state_trackers/va/surface.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/gallium/state_trackers/va/surface.c b/src/gallium/state_trackers/va/surface.c
index 115db43f791..173e7d91ac6 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;