frontends/va: make vlVaSyncSurface blocking

According to VA documentation, vaSyncSurface should block,
so this mapping function vlVaSyncSurface is changed to be blocking.
add vlVaSyncSurface2 which can be used as non-blocking version.

Signed-off-by: David (Ming Qiang) Wu <David.Wu3@amd.com>
Reviewed-by: Boyuan Zhang <Boyuan.Zhang@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27309>
This commit is contained in:
David (Ming Qiang) Wu
2024-01-26 15:07:34 -05:00
committed by Marge Bot
parent c4b32f9e90
commit b75ee1a067
3 changed files with 22 additions and 7 deletions

View File

@@ -103,7 +103,7 @@ static struct VADriverVTable vtable =
&vlVaExportSurfaceHandle,
#endif
#if VA_CHECK_VERSION(1, 15, 0)
NULL, /* vaSyncSurface2 */
&vlVaSyncSurface2,
&vlVaSyncBuffer,
#endif
#if VA_CHECK_VERSION(1, 21, 0)

View File

@@ -99,8 +99,8 @@ vlVaDestroySurfaces(VADriverContextP ctx, VASurfaceID *surface_list, int num_sur
return VA_STATUS_SUCCESS;
}
VAStatus
vlVaSyncSurface(VADriverContextP ctx, VASurfaceID render_target)
static VAStatus
_vlVaSyncSurface(VADriverContextP ctx, VASurfaceID render_target, uint64_t timeout_ns)
{
vlVaDriver *drv;
vlVaContext *context;
@@ -152,8 +152,7 @@ vlVaSyncSurface(VADriverContextP ctx, VASurfaceID render_target)
if (context->decoder->get_processor_fence)
ret = context->decoder->get_processor_fence(context->decoder,
surf->fence,
PIPE_DEFAULT_DECODER_FEEDBACK_TIMEOUT_NS);
surf->fence, timeout_ns);
mtx_unlock(&drv->mutex);
// Assume that the GPU has hung otherwise.
@@ -163,8 +162,7 @@ vlVaSyncSurface(VADriverContextP ctx, VASurfaceID render_target)
if (context->decoder->get_decoder_fence)
ret = context->decoder->get_decoder_fence(context->decoder,
surf->fence,
PIPE_DEFAULT_DECODER_FEEDBACK_TIMEOUT_NS);
surf->fence, timeout_ns);
mtx_unlock(&drv->mutex);
// Assume that the GPU has hung otherwise.
@@ -197,6 +195,20 @@ vlVaSyncSurface(VADriverContextP ctx, VASurfaceID render_target)
return VA_STATUS_SUCCESS;
}
VAStatus
vlVaSyncSurface(VADriverContextP ctx, VASurfaceID render_target)
{
return _vlVaSyncSurface(ctx, render_target, VA_TIMEOUT_INFINITE);
}
#if VA_CHECK_VERSION(1, 15, 0)
VAStatus
vlVaSyncSurface2(VADriverContextP ctx, VASurfaceID surface, uint64_t timeout_ns)
{
return _vlVaSyncSurface(ctx, surface, timeout_ns);
}
#endif
VAStatus
vlVaQuerySurfaceStatus(VADriverContextP ctx, VASurfaceID render_target, VASurfaceStatus *status)
{

View File

@@ -444,6 +444,9 @@ VAStatus vlVaBeginPicture(VADriverContextP ctx, VAContextID context, VASurfaceID
VAStatus vlVaRenderPicture(VADriverContextP ctx, VAContextID context, VABufferID *buffers, int num_buffers);
VAStatus vlVaEndPicture(VADriverContextP ctx, VAContextID context);
VAStatus vlVaSyncSurface(VADriverContextP ctx, VASurfaceID render_target);
#if VA_CHECK_VERSION(1, 15, 0)
VAStatus vlVaSyncSurface2(VADriverContextP ctx, VASurfaceID surface, uint64_t timeout_ns);
#endif
VAStatus vlVaQuerySurfaceStatus(VADriverContextP ctx, VASurfaceID render_target, VASurfaceStatus *status);
VAStatus vlVaQuerySurfaceError(VADriverContextP ctx, VASurfaceID render_target,
VAStatus error_status, void **error_info);