Mesa (main): frontend/va: Create decoder once the max_references is updated
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Apr 7 14:58:55 UTC 2022
Module: Mesa
Branch: main
Commit: f21d6e18bc3f7fb9021b853544caf979bf87bc74
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f21d6e18bc3f7fb9021b853544caf979bf87bc74
Author: Krunal Patel <krunalkumarmukeshkumar.patel at amd.corp-partner.google.com>
Date: Tue Apr 5 17:29:20 2022 +0530
frontend/va: Create decoder once the max_references is updated
Issue: When a video is decoded where the max_references is updated the
decoder keeps using same old value. This results into green patches and
decoding is not proper.
Root Cause: The max_references is updated only once when the instance is
created for the first time.
Fix: Added a check along with the context->decoder to check if the
context->templat.max_references has changed. If yes, then we go ahead
and create the decoder again.
Reviewed-by: Leo Liu <leo.liu at amd.com>
Signed-off-by: Krunal Patel <krunalkumarmukeshkumar.patel at amd.corp-partner.google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15750>
---
src/gallium/frontends/va/picture_h264.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/gallium/frontends/va/picture_h264.c b/src/gallium/frontends/va/picture_h264.c
index c63b914a3c9..9e44a3387e5 100755
--- a/src/gallium/frontends/va/picture_h264.c
+++ b/src/gallium/frontends/va/picture_h264.c
@@ -131,7 +131,11 @@ void vlVaHandlePictureParameterBufferH264(vlVaDriver *drv, vlVaContext *context,
h264->pic_fields.bits.field_pic_flag &&
(h264->CurrPic.flags & VA_PICTURE_H264_BOTTOM_FIELD) != 0;
- if (!context->decoder && context->desc.h264.num_ref_frames > 0)
+ if (context->decoder && (context->templat.max_references != context->desc.h264.num_ref_frames)) {
+ context->templat.max_references = MIN2(context->desc.h264.num_ref_frames, 16);
+ context->decoder->destroy(context->decoder);
+ context->decoder = NULL;
+ } else if (!context->decoder && context->desc.h264.num_ref_frames > 0)
context->templat.max_references = MIN2(context->desc.h264.num_ref_frames, 16);
for (i = 0; i < context->templat.max_references; ++i) {
More information about the mesa-commit
mailing list