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>
(cherry picked from commit 93a749c449)
This commit is contained in:
David Rosca 2024-08-30 13:15:44 +02:00 committed by Dylan Baker
parent 5f17610fc8
commit d13e6294de
2 changed files with 10 additions and 3 deletions

View file

@ -874,7 +874,7 @@
"description": "frontends/va: Fix locking in vlVaQueryVideoProcPipelineCaps",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View file

@ -1512,12 +1512,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) {
@ -1530,9 +1535,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;
}