diff options
author | Indrajit Das <[email protected]> | 2019-01-03 14:36:33 +0530 |
---|---|---|
committer | Leo Liu <[email protected]> | 2019-01-09 11:34:22 -0500 |
commit | d2c170eb355a912586cb982858faac2fc85c4783 (patch) | |
tree | 5dcfd85e7d3fd1bf828d4bd3739e4756e416c72f /src/gallium/state_trackers | |
parent | 0c226d40ef6eb853d370c91ad6cc1ff694eb6727 (diff) |
st/va: Return correct status from vlVaQuerySurfaceStatus
This ensures that during encoding, applications can get
the correct status of the surface before submitting
more operations on the same.
Reviewed-by: Leo Liu <[email protected]>
Signed-off-by: Indrajit Das <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers')
-rw-r--r-- | src/gallium/state_trackers/va/surface.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/gallium/state_trackers/va/surface.c b/src/gallium/state_trackers/va/surface.c index 9646427ea5f..eca63fc76a0 100644 --- a/src/gallium/state_trackers/va/surface.c +++ b/src/gallium/state_trackers/va/surface.c @@ -146,9 +146,40 @@ vlVaSyncSurface(VADriverContextP ctx, VASurfaceID render_target) VAStatus vlVaQuerySurfaceStatus(VADriverContextP ctx, VASurfaceID render_target, VASurfaceStatus *status) { + vlVaDriver *drv; + vlVaSurface *surf; + vlVaContext *context; + if (!ctx) return VA_STATUS_ERROR_INVALID_CONTEXT; + drv = VL_VA_DRIVER(ctx); + if (!drv) + return VA_STATUS_ERROR_INVALID_CONTEXT; + + mtx_lock(&drv->mutex); + + surf = handle_table_get(drv->htab, render_target); + if (!surf || !surf->buffer) { + mtx_unlock(&drv->mutex); + return VA_STATUS_ERROR_INVALID_SURFACE; + } + + context = handle_table_get(drv->htab, surf->ctx); + if (!context) { + mtx_unlock(&drv->mutex); + return VA_STATUS_ERROR_INVALID_CONTEXT; + } + + if (context->decoder->entrypoint == PIPE_VIDEO_ENTRYPOINT_ENCODE) { + if(surf->feedback == NULL) + *status=VASurfaceReady; + else + *status=VASurfaceRendering; + } + + mtx_unlock(&drv->mutex); + return VA_STATUS_SUCCESS; } |