From 36bedf6c80d4ed4b50f3334f754754e1349cec21 Mon Sep 17 00:00:00 2001 From: David Rosca Date: Sat, 21 Dec 2024 19:29:38 +0100 Subject: [PATCH] frontends/va: Get buffer feedback with locked mutex in MapBuffer Fixes: 93d434362b2 ("frontends/va: Move encode fence to coded buffer") Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/12344 Tested-by: Benjamin Cheng Reviewed-by: David (Ming Qiang) Wu Part-of: --- src/gallium/frontends/va/buffer.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gallium/frontends/va/buffer.c b/src/gallium/frontends/va/buffer.c index a962f095821..7c65e83b3d0 100644 --- a/src/gallium/frontends/va/buffer.c +++ b/src/gallium/frontends/va/buffer.c @@ -145,6 +145,9 @@ VAStatus vlVaMapBuffer2(VADriverContextP ctx, VABufferID buf_id, return VA_STATUS_ERROR_INVALID_BUFFER; } + if (buf->type == VAEncCodedBufferType) + vlVaGetBufferFeedback(buf); + if (buf->derived_surface.resource) { struct pipe_resource *resource; struct pipe_box box; @@ -198,8 +201,6 @@ VAStatus vlVaMapBuffer2(VADriverContextP ctx, VABufferID buf_id, if (buf->type == VAEncCodedBufferType) { VACodedBufferSegment* curr_buf_ptr = (VACodedBufferSegment*) buf->data; - vlVaGetBufferFeedback(buf); - if ((buf->extended_metadata.present_metadata & PIPE_VIDEO_FEEDBACK_METADATA_TYPE_ENCODE_RESULT) && (buf->extended_metadata.encode_result & PIPE_VIDEO_FEEDBACK_METADATA_ENCODE_FLAG_FAILED)) { curr_buf_ptr->status = VA_CODED_BUF_STATUS_BAD_BITSTREAM;