[Mesa-dev] st/va: Return correct status from vlVaQuerySurfaceStatus

Das, Indrajit-kumar Indrajit-kumar.Das at amd.com
Thu Jan 3 10:20:09 UTC 2019


From: Indrajit Das <indrajit-kumar.das at amd.com>
Date: Thu, 3 Jan 2019 14:36:33 +0530
Subject: [PATCH] st/va: Return correct status from vlVaQuerySurfaceStatus

Signed-off-by: Indrajit Das <indrajit-kumar.das at amd.com>
---
 src/gallium/state_trackers/va/surface.c | 31 +++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/src/gallium/state_trackers/va/surface.c b/src/gallium/state_trackers/va/surface.c
index cc26efe..e7ed64b 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;
 }
 
-- 
2.17.1



More information about the mesa-dev mailing list