frontends/va: Check if target buffer is supported in vlVaEndPicture

This is mainly to reject buffers allocated with modifiers not supported
for given entrypoint. There is no interface to query supported modifiers
for different formats and entrypoints in libva, so applications can
import externally allocated buffers that may be unsupported with some
entrypoints.

Reviewed-by: Thong Thai <thong.thai@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29932>
This commit is contained in:
David Rosca 2024-06-25 20:57:37 +02:00 committed by Marge Bot
parent a7469a9ffd
commit 2b93a918b3

View file

@ -1304,6 +1304,16 @@ vlVaEndPicture(VADriverContextP ctx, VAContextID context_id)
}
context->desc.base.input_full_range = surf->full_range;
if (screen->is_video_target_buffer_supported &&
!screen->is_video_target_buffer_supported(screen,
context->desc.base.output_format,
context->target,
context->decoder->profile,
context->decoder->entrypoint)) {
mtx_unlock(&drv->mutex);
return VA_STATUS_ERROR_INVALID_SURFACE;
}
int driver_metadata_support = drv->pipe->screen->get_video_param(drv->pipe->screen,
context->decoder->profile,
context->decoder->entrypoint,