frontends/va: Fix locking in vlVaQueryVideoProcPipelineCaps

The mutex needs to be locked before accessing the handle table.

Cc: mesa-stable
Reviewed-By: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30935>
This commit is contained in:
David Rosca
2024-08-30 13:15:44 +02:00
committed by Marge Bot
parent fccf31c231
commit 93a749c449

View File

@@ -1559,12 +1559,17 @@ vlVaQueryVideoProcPipelineCaps(VADriverContextP ctx, VAContextID context,
if (pipe_blend_modes & PIPE_VIDEO_VPP_BLEND_MODE_GLOBAL_ALPHA)
pipeline_cap->blend_flags |= VA_BLEND_GLOBAL_ALPHA;
vlVaDriver *drv = VL_VA_DRIVER(ctx);
mtx_lock(&drv->mutex);
for (i = 0; i < num_filters; i++) {
vlVaBuffer *buf = handle_table_get(VL_VA_DRIVER(ctx)->htab, filters[i]);
vlVaBuffer *buf = handle_table_get(drv->htab, filters[i]);
VAProcFilterParameterBufferBase *filter;
if (!buf || buf->type != VAProcFilterParameterBufferType)
if (!buf || buf->type != VAProcFilterParameterBufferType) {
mtx_unlock(&drv->mutex);
return VA_STATUS_ERROR_INVALID_BUFFER;
}
filter = buf->data;
switch (filter->type) {
@@ -1577,9 +1582,11 @@ vlVaQueryVideoProcPipelineCaps(VADriverContextP ctx, VAContextID context,
break;
}
default:
mtx_unlock(&drv->mutex);
return VA_STATUS_ERROR_UNIMPLEMENTED;
}
}
mtx_unlock(&drv->mutex);
return VA_STATUS_SUCCESS;
}