diff --git a/drivers/amlogic/media_modules/frame_provider/decoder/h264_multi/vmh264.c b/drivers/amlogic/media_modules/frame_provider/decoder/h264_multi/vmh264.c index 36a654936820..7ee7a7cda9f0 100644 --- a/drivers/amlogic/media_modules/frame_provider/decoder/h264_multi/vmh264.c +++ b/drivers/amlogic/media_modules/frame_provider/decoder/h264_multi/vmh264.c @@ -2850,7 +2850,7 @@ static int vh264_vf_states(struct vframe_states *states, void *op_arg) static struct vframe_s *vh264_vf_peek(void *op_arg) { - struct vframe_s *vf; + struct vframe_s *vf[2] = {0, 0}; struct vdec_s *vdec = op_arg; struct vdec_h264_hw_s *hw = (struct vdec_h264_hw_s *)vdec->private; @@ -2863,8 +2863,14 @@ static struct vframe_s *vh264_vf_peek(void *op_arg) return &hw->vframe_dummy; } - if (kfifo_peek(&hw->display_q, &vf)) - return vf; + if (kfifo_out_peek(&hw->display_q, (void *)&vf, 2)) { + if (vf[1]) { + vf[0]->next_vf_pts_valid = true; + vf[0]->next_vf_pts = vf[1]->pts; + } else + vf[0]->next_vf_pts_valid = false; + return vf[0]; + } return NULL; } @@ -2962,6 +2968,7 @@ static struct vframe_s *vh264_vf_get(void *op_arg) int time = jiffies; unsigned int frame_interval = 1000*(time - hw->last_frame_time)/HZ; + struct vframe_s *next_vf; if (dpb_is_debug(DECODE_ID(hw), PRINT_FLAG_VDEC_STATUS)) { struct h264_dpb_stru *p_H264_Dpb = &hw->dpb; @@ -2980,6 +2987,11 @@ static struct vframe_s *vh264_vf_get(void *op_arg) } hw->last_frame_time = time; hw->vf_get_count++; + if (kfifo_peek(&hw->display_q, &next_vf)) { + vf->next_vf_pts_valid = true; + vf->next_vf_pts = next_vf->pts; + } else + vf->next_vf_pts_valid = false; return vf; } diff --git a/drivers/amlogic/media_modules/frame_provider/decoder/h265/vh265.c b/drivers/amlogic/media_modules/frame_provider/decoder/h265/vh265.c index 7fbb7c6439c4..3f73b76030d5 100644 --- a/drivers/amlogic/media_modules/frame_provider/decoder/h265/vh265.c +++ b/drivers/amlogic/media_modules/frame_provider/decoder/h265/vh265.c @@ -6248,7 +6248,7 @@ static int vh265_vf_states(struct vframe_states *states, void *op_arg) static struct vframe_s *vh265_vf_peek(void *op_arg) { - struct vframe_s *vf; + struct vframe_s *vf[2] = {0, 0}; #ifdef MULTI_INSTANCE_SUPPORT struct vdec_s *vdec = op_arg; struct hevc_state_s *hevc = (struct hevc_state_s *)vdec->private; @@ -6265,8 +6265,15 @@ static struct vframe_s *vh265_vf_peek(void *op_arg) return &hevc->vframe_dummy; } - if (kfifo_peek(&hevc->display_q, &vf)) - return vf; + + if (kfifo_out_peek(&hevc->display_q, (void *)&vf, 2)) { + if (vf[1]) { + vf[0]->next_vf_pts_valid = true; + vf[0]->next_vf_pts = vf[1]->pts; + } else + vf[0]->next_vf_pts_valid = false; + return vf[0]; + } return NULL; } @@ -6360,6 +6367,7 @@ static struct vframe_s *vh265_vf_get(void *op_arg) #endif if (kfifo_get(&hevc->display_q, &vf)) { + struct vframe_s *next_vf; if (get_dbg_flag(hevc) & H265_DEBUG_PIC_STRUCT) hevc_print(hevc, 0, "%s(type %d index 0x%x poc %d/%d) pts(%d,%d) dur %d\n", @@ -6371,6 +6379,13 @@ static struct vframe_s *vh265_vf_get(void *op_arg) hevc->show_frame_num++; hevc->vf_get_count++; + + if (kfifo_peek(&hevc->display_q, &next_vf)) { + vf->next_vf_pts_valid = true; + vf->next_vf_pts = next_vf->pts; + } else + vf->next_vf_pts_valid = false; + return vf; } diff --git a/drivers/amlogic/media_modules/frame_provider/decoder/vp9/vvp9.c b/drivers/amlogic/media_modules/frame_provider/decoder/vp9/vvp9.c index 4d8f1b298750..cfca5817f7bc 100644 --- a/drivers/amlogic/media_modules/frame_provider/decoder/vp9/vvp9.c +++ b/drivers/amlogic/media_modules/frame_provider/decoder/vp9/vvp9.c @@ -6456,14 +6456,20 @@ static int vvp9_vf_states(struct vframe_states *states, void *op_arg) static struct vframe_s *vvp9_vf_peek(void *op_arg) { - struct vframe_s *vf; + struct vframe_s *vf[2] = {0, 0}; struct VP9Decoder_s *pbi = (struct VP9Decoder_s *)op_arg; if (step == 2) return NULL; - if (kfifo_peek(&pbi->display_q, &vf)) - return vf; + if (kfifo_out_peek(&pbi->display_q, (void *)&vf, 2)) { + if (vf[1]) { + vf[0]->next_vf_pts_valid = true; + vf[0]->next_vf_pts = vf[1]->pts; + } else + vf[0]->next_vf_pts_valid = false; + return vf[0]; + } return NULL; } @@ -6479,6 +6485,7 @@ static struct vframe_s *vvp9_vf_get(void *op_arg) step = 2; if (kfifo_get(&pbi->display_q, &vf)) { + struct vframe_s *next_vf; uint8_t index = vf->index & 0xff; if (index >= 0 && index < pbi->used_buf_num) { pbi->vf_get_count++; @@ -6488,6 +6495,13 @@ static struct vframe_s *vvp9_vf_get(void *op_arg) vf->width, vf->height, vf->pts, vf->pts_us64); + + if (kfifo_peek(&pbi->display_q, &next_vf)) { + vf->next_vf_pts_valid = true; + vf->next_vf_pts = next_vf->pts; + } else + vf->next_vf_pts_valid = false; + return vf; } }