Module: Mesa Branch: main Commit: 2c1da7fbde06900433993fda7813114510d59c0c URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=2c1da7fbde06900433993fda7813114510d59c0c
Author: Boyuan Zhang <[email protected]> Date: Thu Mar 23 09:34:55 2023 -0400 frontends/va: check decoder in va surface call Add a check to see if decoder is valid before using it. Currently we only support decode and encode operations, return unsupported error for all other entrypoints. Signed-off-by: Boyuan Zhang <[email protected]> Reviewed-by: Leo Liu <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21905> --- src/gallium/frontends/va/surface.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/gallium/frontends/va/surface.c b/src/gallium/frontends/va/surface.c index 936fd31384b..21cf8adee63 100644 --- a/src/gallium/frontends/va/surface.c +++ b/src/gallium/frontends/va/surface.c @@ -132,6 +132,11 @@ vlVaSyncSurface(VADriverContextP ctx, VASurfaceID render_target) return VA_STATUS_ERROR_INVALID_CONTEXT; } + if (!context->decoder) { + mtx_unlock(&drv->mutex); + return VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT; + } + if (context->decoder->entrypoint == PIPE_VIDEO_ENTRYPOINT_BITSTREAM) { int ret = 0; @@ -212,6 +217,11 @@ vlVaQuerySurfaceStatus(VADriverContextP ctx, VASurfaceID render_target, VASurfac return VA_STATUS_ERROR_INVALID_CONTEXT; } + if (!context->decoder) { + mtx_unlock(&drv->mutex); + return VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT; + } + if (context->decoder->entrypoint == PIPE_VIDEO_ENTRYPOINT_ENCODE) { if(surf->feedback == NULL) *status=VASurfaceReady;
