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@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12105>
This commit is contained in:
Pierre-Eric Pelloux-Prayer 2021-07-26 15:47:24 +02:00
parent f376597d00
commit 2ea88d7cea
2 changed files with 6 additions and 6 deletions

View File

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

View File

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