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@amd.com>
Signed-off-by: Krunal Patel <krunalkumarmukeshkumar.patel@amd.corp-partner.google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15750>
This commit is contained in:
Krunal Patel 2022-04-05 17:11:20 +05:30 committed by Marge Bot
parent 2f8d11463f
commit f21d6e18bc

View file

@ -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) {