Mesa (main): gallium/va: don't use key=NULL in hash tables
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Jul 30 08:49:45 UTC 2021
Module: Mesa
Branch: main
Commit: 2ea88d7cea070c3288c252064cae9236bd462646
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=2ea88d7cea070c3288c252064cae9236bd462646
Author: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Date: Mon Jul 26 15:47:24 2021 +0200
gallium/va: don't use key=NULL in hash tables
Add 1 to the key index otherwise we hit the following assert
in hash_table_insert:
assert(!key_pointer_is_reserved(ht, key));
Cc: mesa-stable
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12105>
---
src/gallium/frontends/va/picture_h264_enc.c | 6 +++---
src/gallium/frontends/va/picture_hevc_enc.c | 6 +++---
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/gallium/frontends/va/picture_h264_enc.c b/src/gallium/frontends/va/picture_h264_enc.c
index ba67f6eb018..18890aed7a2 100644
--- a/src/gallium/frontends/va/picture_h264_enc.c
+++ b/src/gallium/frontends/va/picture_h264_enc.c
@@ -53,7 +53,7 @@ vlVaHandleVAEncPictureParameterBufferTypeH264(vlVaDriver *drv, vlVaContext *cont
context->coded_buf = coded_buf;
_mesa_hash_table_insert(context->desc.h264enc.frame_idx,
- UINT_TO_PTR(h264->CurrPic.picture_id),
+ UINT_TO_PTR(h264->CurrPic.picture_id + 1),
UINT_TO_PTR(h264->frame_num));
if (h264->pic_fields.bits.idr_pic_flag == 1)
@@ -84,12 +84,12 @@ vlVaHandleVAEncSliceParameterBufferTypeH264(vlVaDriver *drv, vlVaContext *contex
if (h264->RefPicList0[i].picture_id != VA_INVALID_ID) {
if (context->desc.h264enc.ref_idx_l0 == VA_INVALID_ID)
context->desc.h264enc.ref_idx_l0 = PTR_TO_UINT(util_hash_table_get(context->desc.h264enc.frame_idx,
- UINT_TO_PTR(h264->RefPicList0[i].picture_id)));
+ UINT_TO_PTR(h264->RefPicList0[i].picture_id + 1)));
}
if (h264->RefPicList1[i].picture_id != VA_INVALID_ID && h264->slice_type == 1) {
if (context->desc.h264enc.ref_idx_l1 == VA_INVALID_ID)
context->desc.h264enc.ref_idx_l1 = PTR_TO_UINT(util_hash_table_get(context->desc.h264enc.frame_idx,
- UINT_TO_PTR(h264->RefPicList1[i].picture_id)));
+ UINT_TO_PTR(h264->RefPicList1[i].picture_id + 1)));
}
}
diff --git a/src/gallium/frontends/va/picture_hevc_enc.c b/src/gallium/frontends/va/picture_hevc_enc.c
index 74857461764..17bc252ae5e 100644
--- a/src/gallium/frontends/va/picture_hevc_enc.c
+++ b/src/gallium/frontends/va/picture_hevc_enc.c
@@ -83,7 +83,7 @@ vlVaHandleVAEncPictureParameterBufferTypeHEVC(vlVaDriver *drv, vlVaContext *cont
context->desc.h265enc.pic.constrained_intra_pred_flag = h265->pic_fields.bits.constrained_intra_pred_flag;
_mesa_hash_table_insert(context->desc.h265enc.frame_idx,
- UINT_TO_PTR(h265->decoded_curr_pic.picture_id),
+ UINT_TO_PTR(h265->decoded_curr_pic.picture_id + 1),
UINT_TO_PTR(context->desc.h265enc.frame_num));
return VA_STATUS_SUCCESS;
@@ -102,12 +102,12 @@ vlVaHandleVAEncSliceParameterBufferTypeHEVC(vlVaDriver *drv, vlVaContext *contex
if (h265->ref_pic_list0[i].picture_id != VA_INVALID_ID) {
if (context->desc.h265enc.ref_idx_l0 == VA_INVALID_ID)
context->desc.h265enc.ref_idx_l0 = PTR_TO_UINT(util_hash_table_get(context->desc.h265enc.frame_idx,
- UINT_TO_PTR(h265->ref_pic_list0[i].picture_id)));
+ UINT_TO_PTR(h265->ref_pic_list0[i].picture_id + 1)));
}
if (h265->ref_pic_list1[i].picture_id != VA_INVALID_ID && h265->slice_type == 1) {
if (context->desc.h265enc.ref_idx_l1 == VA_INVALID_ID)
context->desc.h265enc.ref_idx_l1 = PTR_TO_UINT(util_hash_table_get(context->desc.h265enc.frame_idx,
- UINT_TO_PTR(h265->ref_pic_list1[i].picture_id)));
+ UINT_TO_PTR(h265->ref_pic_list1[i].picture_id + 1)));
}
}
More information about the mesa-commit
mailing list