From 6ec6e4318d7767d224385b610268716fa7220f42 Mon Sep 17 00:00:00 2001 From: Peng Yixin Date: Fri, 30 Oct 2020 19:40:32 +0800 Subject: [PATCH] h265: black screen a few seconds when start playback [1/1] PD#SWPL-34475 Problem: HEVC_STREAM_RD_PTR is not updated because there is a lot of dirty data in front of the CSD data, resulting in a long black screen Solution: When starting playback, all dirty data will be discarded. Verify: AH212 Change-Id: Id653526617e2b362af0baf170f687498f4576453 Signed-off-by: Peng Yixin --- drivers/frame_provider/decoder/h265/vh265.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/frame_provider/decoder/h265/vh265.c b/drivers/frame_provider/decoder/h265/vh265.c index 72833e4..9615388 100644 --- a/drivers/frame_provider/decoder/h265/vh265.c +++ b/drivers/frame_provider/decoder/h265/vh265.c @@ -468,6 +468,8 @@ static u32 max_decoding_time; * *bit 8: 0, use interlace policy * 1, NOT use interlace policy + *bit 9: 0, use manual parser NAL + * 1, NOT use manual parser NAL * */ @@ -11792,10 +11794,14 @@ static void vh265_prot_init(struct hevc_state_s *hevc) } else { /* check vps/sps/pps/i-slice in ucode */ unsigned ctl_val = 0x8; + if (hevc->PB_skip_mode == 0) ctl_val = 0x4; /* check vps/sps/pps only in ucode */ else if (hevc->PB_skip_mode == 3) ctl_val = 0x0; /* check vps/sps/pps/idr in ucode */ + if (((error_handle_policy & 0x200) == 0) && + input_stream_based(vdec)) + ctl_val = 0x1; WRITE_VREG(NAL_SEARCH_CTL, ctl_val); } if ((get_dbg_flag(hevc) & H265_DEBUG_NO_EOS_SEARCH_DONE) @@ -12978,14 +12984,20 @@ static void vh265_work_implement(struct hevc_state_s *hevc, else hevc->again_count = 0; - hevc->pre_parser_video_rp = STBUF_READ(&vdec->vbuf, get_rp);; + hevc->pre_parser_video_rp = STBUF_READ(&vdec->vbuf, get_rp); hevc->pre_parser_video_wp = STBUF_READ(&vdec->vbuf, get_wp); - if ((hevc->again_count > dirty_count_threshold) && - time_after64(get_jiffies_64(), hevc->again_timeout_jiffies)) { + if (((hevc->again_count > dirty_count_threshold) && + time_after64(get_jiffies_64(), hevc->again_timeout_jiffies)) || + (((error_handle_policy & 0x200) == 0) && + (hevc->pic_list_init_flag == 0) && + !(hevc->have_vps || hevc->have_sps || hevc->have_pps))) { mutex_lock(&hevc->chunks_mutex); + hevc->again_count = 0; vdec_vframe_dirty(hw_to_vdec(hevc), hevc->chunk); hevc->chunk = NULL; + hevc_print(hevc, PRINT_FLAG_VDEC_DETAIL, + "Discard dirty data\n"); mutex_unlock(&hevc->chunks_mutex); } } -- 2.20.1