frontends/va: add ability for encoder to output statistics

Signed-off-by: Thong Thai <thong.thai@amd.com>
Reviewed-by: Boyuan Zhang <boyuan.zhang@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19512>
This commit is contained in:
Thong Thai 2022-10-27 20:04:38 -04:00 committed by Marge Bot
parent 022d03013a
commit 2d1bd619df

View file

@ -686,6 +686,27 @@ handleVAEncPackedHeaderDataBufferType(vlVaContext *context, vlVaBuffer *buf)
return status;
}
static VAStatus
handleVAStatsStatisticsBufferType(VADriverContextP ctx, vlVaContext *context, vlVaBuffer *buf)
{
if (context->decoder->entrypoint != PIPE_VIDEO_ENTRYPOINT_ENCODE)
return VA_STATUS_ERROR_UNIMPLEMENTED;
vlVaDriver *drv;
drv = VL_VA_DRIVER(ctx);
if (!drv)
return VA_STATUS_ERROR_INVALID_CONTEXT;
if (!buf->derived_surface.resource)
buf->derived_surface.resource = pipe_buffer_create(drv->pipe->screen, PIPE_BIND_VERTEX_BUFFER,
PIPE_USAGE_STREAM, buf->size);
context->target->associated_data = buf->derived_surface.resource;
return VA_STATUS_SUCCESS;
}
VAStatus
vlVaRenderPicture(VADriverContextP ctx, VAContextID context_id, VABufferID *buffers, int num_buffers)
{
@ -781,6 +802,10 @@ vlVaRenderPicture(VADriverContextP ctx, VAContextID context_id, VABufferID *buff
handleVAEncPackedHeaderDataBufferType(context, buf);
break;
case VAStatsStatisticsBufferType:
handleVAStatsStatisticsBufferType(ctx, context, buf);
break;
default:
break;
}