frontends/va: Get buffer feedback with locked mutex in MapBuffer

Fixes: 93d434362b ("frontends/va: Move encode fence to coded buffer")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/12344

Tested-by: Benjamin Cheng <benjamin.cheng@amd.com>
Reviewed-by: David (Ming Qiang) Wu <David.Wu3@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32761>
This commit is contained in:
David Rosca
2024-12-21 19:29:38 +01:00
committed by Marge Bot
parent 5ecea6ec4a
commit 36bedf6c80

View File

@@ -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;