I am not programator, but i saw too very different structure of code compare to aml 4.9:
static bool is_buffer_available(struct vdec_s *vdec)
{
bool buffer_available = 1;
struct vdec_h264_hw_s *hw = (struct vdec_h264_hw_s *)(vdec->private);
struct h264_dpb_stru *p_H264_Dpb = &hw->dpb;
struct DecodedPictureBuffer *p_Dpb = &p_H264_Dpb->mDPB;
if ((kfifo_len(&hw->newframe_q) <= 0) ||
((hw->config_bufmgr_done) && (!have_free_buf_spec(vdec))) ||
((p_H264_Dpb->mDPB.init_done) &&
(p_H264_Dpb->mDPB.used_size == p_H264_Dpb->mDPB.size) &&
(is_there_unused_frame_from_dpb(&p_H264_Dpb->mDPB) == 0))) {
dpb_print(DECODE_ID(hw), PRINT_FLAG_VDEC_DETAIL,
"%s, empty, newq(%d), free_spec(%d), initdon(%d), used_size(%d/%d), unused_fr_dpb(%d)\n",
__func__,
kfifo_len(&hw->newframe_q),
have_free_buf_spec(vdec),
p_H264_Dpb->mDPB.init_done,
p_H264_Dpb->mDPB.used_size, p_H264_Dpb->mDPB.size,
is_there_unused_frame_from_dpb(&p_H264_Dpb->mDPB)
);
buffer_available = 0;
if (dpb_is_debug(DECODE_ID(hw),
DEBUG_DISABLE_RUNREADY_RMBUF))
return buffer_available;