frontends/va: Stop reallocating buffers for protected playback

Instead set the protected flag on allocation and return error
when the protected state of surface doesn't match context.

Reviewed-by: Leo Liu <leo.liu@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32089>
This commit is contained in:
David Rosca
2024-10-24 15:46:33 +02:00
committed by Marge Bot
parent 63fd685b31
commit 0df7e80179
+4 -6
View File
@@ -1168,6 +1168,8 @@ vlVaEndPicture(VADriverContextP ctx, VAContextID context_id)
apply_av1_fg = vlVaQueryApplyFilmGrainAV1(context, &output_id, &out_target);
surf = handle_table_get(drv->htab, output_id);
if (surf && !surf->buffer && context->desc.base.protected_playback)
surf->templat.bind |= PIPE_BIND_PROTECTED;
vlVaGetSurfaceBuffer(drv, surf);
if (!surf || !surf->buffer) {
mtx_unlock(&drv->mutex);
@@ -1219,12 +1221,8 @@ vlVaEndPicture(VADriverContextP ctx, VAContextID context_id)
}
if ((bool)(surf->templat.bind & PIPE_BIND_PROTECTED) != context->desc.base.protected_playback) {
if (context->desc.base.protected_playback) {
surf->templat.bind |= PIPE_BIND_PROTECTED;
}
else
surf->templat.bind &= ~PIPE_BIND_PROTECTED;
realloc = true;
mtx_unlock(&drv->mutex);
return VA_STATUS_ERROR_INVALID_SURFACE;
}
if (realloc) {