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>
(cherry picked from commit 36bedf6c80)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33113>
This commit is contained in:
David Rosca 2024-12-21 19:29:38 +01:00 committed by Dylan Baker
parent 0d5f54b5ca
commit bca4ba9866
2 changed files with 4 additions and 3 deletions

View file

@ -124,7 +124,7 @@
"description": "frontends/va: Get buffer feedback with locked mutex in MapBuffer",
"nominated": true,
"nomination_type": 2,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "93d434362b22b5e6b93dbb3b2d70809fd080796b",
"notes": null

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;