From b83df39a037c8be880a294567fcdbe126630d240 Mon Sep 17 00:00:00 2001 From: Peng Yixin Date: Mon, 17 Aug 2020 14:39:24 +0800 Subject: [PATCH] media_module: h265 dvb playback unsmooth and mosaic [1/1] PD#SWPL-31281 Problem: Because the mmu box is mistakenly released, cause mmu memory has no cache mechanism, so memory allocation spend a lot of time(ave 7ms), leading to playback unsmooth.And DVB playback, decoding speed is not enough to lead stream buffer overflow, then show mosaic picture. Solution: The current mechanism is not to release mmu idx to resolve this issue. Verify: AB311-B Change-Id: I6eaf0eb7ffd659b96907a352cf4d548070569001 Signed-off-by: Peng Yixin --- drivers/frame_provider/decoder/h265/vh265.c | 33 ++++--------------- .../decoder/utils/decoder_mmu_box.c | 1 + 2 files changed, 7 insertions(+), 27 deletions(-) diff --git a/drivers/frame_provider/decoder/h265/vh265.c b/drivers/frame_provider/decoder/h265/vh265.c index f04ff95..33164ec 100644 --- a/drivers/frame_provider/decoder/h265/vh265.c +++ b/drivers/frame_provider/decoder/h265/vh265.c @@ -2168,7 +2168,6 @@ static void restore_decode_state(struct hevc_state_s *hevc) hevc->decoding_pic->referenced = 0; hevc->decoding_pic->POC = INVALID_POC; put_mv_buf(hevc, hevc->decoding_pic); - release_pic_mmu_buf(hevc, hevc->decoding_pic); release_aux_data(hevc, hevc->decoding_pic); hevc->decoding_pic = NULL; } @@ -5647,6 +5646,7 @@ static void pic_list_process(struct hevc_state_s *hevc) if (alloc_pic_count > work_pic_num) { pic->width = 0; pic->height = 0; + release_pic_mmu_buf(hevc, pic); pic->index = -1; } else { pic->width = hevc->pic_w; @@ -5683,24 +5683,6 @@ static void pic_list_process(struct hevc_state_s *hevc) } } -static void recycle_mmu_bufs(struct hevc_state_s *hevc) -{ - int i; - struct PIC_s *pic; - for (i = 0; i < MAX_REF_PIC_NUM; i++) { - pic = hevc->m_PIC[i]; - if (pic == NULL || pic->index == -1) - continue; - - if (pic->output_mark == 0 && pic->referenced == 0 - && pic->output_ready == 0 - && pic->scatter_alloc - ) - release_pic_mmu_buf(hevc, pic); - } - -} - static struct PIC_s *get_new_pic(struct hevc_state_s *hevc, union param_u *rpm_param) { @@ -7209,8 +7191,8 @@ static int hevc_slice_segment_header_process(struct hevc_state_s *hevc, apply_ref_pic_set(hevc, hevc->curr_POC, rpm_param); - if (hevc->mmu_enable) - recycle_mmu_bufs(hevc); + /*if (hevc->mmu_enable) + recycle_mmu_bufs(hevc);*/ #ifdef CONFIG_AMLOGIC_MEDIA_ENHANCEMENT_DOLBYVISION if (vdec->master) { @@ -7583,10 +7565,7 @@ static int H265_alloc_mmu(struct hevc_state_s *hevc, struct PIC_s *new_pic, /*hevc_print(hevc, 0, "alloc_mmu cur_idx : %d picture_size : %d mmu_4k_number : %d\r\n", cur_buf_idx, picture_size, cur_mmu_4k_number);*/ - if (new_pic->scatter_alloc) { - decoder_mmu_box_free_idx(hevc->mmu_box, new_pic->index); - new_pic->scatter_alloc = 0; - } + if (get_cpu_major_id() >= AM_MESON_CPU_MAJOR_ID_SM1) max_frame_num = MAX_FRAME_8K_NUM; else @@ -7603,8 +7582,8 @@ static int H265_alloc_mmu(struct hevc_state_s *hevc, struct PIC_s *new_pic, cur_buf_idx, cur_mmu_4k_number, mmu_index_adr); - if (ret == 0) - new_pic->scatter_alloc = 1; + + new_pic->scatter_alloc = 1; hevc_print(hevc, H265_DEBUG_BUFMGR_MORE, "%s pic index %d page count(%d) ret =%d\n", diff --git a/drivers/frame_provider/decoder/utils/decoder_mmu_box.c b/drivers/frame_provider/decoder/utils/decoder_mmu_box.c index 8389514..75862ec 100644 --- a/drivers/frame_provider/decoder/utils/decoder_mmu_box.c +++ b/drivers/frame_provider/decoder/utils/decoder_mmu_box.c @@ -189,6 +189,7 @@ int decoder_mmu_box_alloc_idx( ret = codec_mm_scatter_alloc_want_pages(sc, num_pages); else { + box->box_ref_cnt--; codec_mm_scatter_dec_owner_user(sc, 0); box->sc_list[idx] = NULL; sc = NULL; -- 2.20.1