frontends/va: Don't relock mutex in vlVaEndPicture

While this should not cause any real issues, there is no reason
to unlock the mutex just to lock it again couple lines below.

Fixes coverity issue 1559431 Value not atomically updated

Acked-by: Leo Liu <leo.liu@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31622>
This commit is contained in:
David Rosca
2024-10-09 11:14:23 +02:00
committed by Marge Bot
parent 2cb3c2e8d5
commit 4adb652392
+7 -4
View File
@@ -1126,15 +1126,19 @@ vlVaEndPicture(VADriverContextP ctx, VAContextID context_id)
mtx_lock(&drv->mutex);
context = handle_table_get(drv->htab, context_id);
mtx_unlock(&drv->mutex);
if (!context)
if (!context) {
mtx_unlock(&drv->mutex);
return VA_STATUS_ERROR_INVALID_CONTEXT;
}
if (!context->decoder) {
if (context->templat.profile != PIPE_VIDEO_PROFILE_UNKNOWN)
if (context->templat.profile != PIPE_VIDEO_PROFILE_UNKNOWN) {
mtx_unlock(&drv->mutex);
return VA_STATUS_ERROR_INVALID_CONTEXT;
}
/* VPP */
mtx_unlock(&drv->mutex);
return VA_STATUS_SUCCESS;
}
@@ -1142,7 +1146,6 @@ vlVaEndPicture(VADriverContextP ctx, VAContextID context_id)
out_target = &context->target;
apply_av1_fg = vlVaQueryApplyFilmGrainAV1(context, &output_id, &out_target);
mtx_lock(&drv->mutex);
surf = handle_table_get(drv->htab, output_id);
vlVaGetSurfaceBuffer(drv, surf);
if (!surf || !surf->buffer) {