author | Peng Yixin <yixin.peng@amlogic.com> | 2020-05-31 05:56:37 (GMT) |
---|---|---|
committer | Shen Liu <shen.liu@amlogic.com> | 2020-06-28 12:01:28 (GMT) |
commit | 4b1c9a849eaba9b8fdfe5d15a7a4b1ccab24f21a (patch) | |
tree | 7727741dd4411f44ab49424ed80e1d4a8b6ef0e6 | |
parent | 4f5f21fbd53aea3ec69ecce6935b667a0672c714 (diff) | |
download | media_modules-4b1c9a849eaba9b8fdfe5d15a7a4b1ccab24f21a.zip media_modules-4b1c9a849eaba9b8fdfe5d15a7a4b1ccab24f21a.tar.gz media_modules-4b1c9a849eaba9b8fdfe5d15a7a4b1ccab24f21a.tar.bz2 |
media_module: h264 show mosaic picture when resolution change [1/1]
PD#SWPL-26883
Problem:
When the dpb buffer reset immediately
after the resolution change, When switch
a bigger resolution, but the buffer size
used the small buffer, causing this problems.
Solution:
Optimize the dpb buffer reset logic
to use the correct buffer.
Verify:
U215
Change-Id: Ia567867f955ce24f619bd9de999c978e87bc8bac
Signed-off-by: Peng Yixin <yixin.peng@amlogic.com>
-rw-r--r-- | drivers/frame_provider/decoder/h264_multi/vmh264.c | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/drivers/frame_provider/decoder/h264_multi/vmh264.c b/drivers/frame_provider/decoder/h264_multi/vmh264.c index 7dfc608..36c62e6 100644 --- a/drivers/frame_provider/decoder/h264_multi/vmh264.c +++ b/drivers/frame_provider/decoder/h264_multi/vmh264.c @@ -1615,14 +1615,21 @@ static void hevc_sao_wait_done(struct vdec_h264_hw_s *hw) } return; } -static void buf_spec_init(struct vdec_h264_hw_s *hw) +static void buf_spec_init(struct vdec_h264_hw_s *hw, bool buffer_reset_flag) { int i; unsigned long flags; spin_lock_irqsave(&hw->bufspec_lock, flags); - for (i = 0; i < BUFSPEC_POOL_SIZE; i++) { - hw->buffer_spec[i].used = -1; - hw->buffer_spec[i].canvas_pos = -1; + if (buffer_reset_flag) { + for (i = 0; i < BUFSPEC_POOL_SIZE; i++) { + if (hw->buffer_spec[i].used != -1) + hw->buffer_spec[i].used = 0; + } + } else { + for (i = 0; i < BUFSPEC_POOL_SIZE; i++) { + hw->buffer_spec[i].used = -1; + hw->buffer_spec[i].canvas_pos = -1; + } } if (dpb_is_debug(DECODE_ID(hw), PRINT_FLAG_DUMP_BUFSPEC)) @@ -4044,7 +4051,7 @@ static void vh264_config_canvs_for_mmu(struct vdec_h264_hw_s *hw) } static int vh264_set_params(struct vdec_h264_hw_s *hw, - u32 param1, u32 param2, u32 param3, u32 param4) + u32 param1, u32 param2, u32 param3, u32 param4, bool buffer_reset_flag) { int i, j; int mb_width, mb_total; @@ -4245,7 +4252,8 @@ static int vh264_set_params(struct vdec_h264_hw_s *hw, mutex_lock(&vmh264_mutex); if (!hw->mmu_enable) { - config_buf_specs(vdec); + if (!buffer_reset_flag) + config_buf_specs(vdec); i = get_buf_spec_by_canvas_pos(hw, 0); if (hw->is_used_v4l) { @@ -7442,7 +7450,7 @@ static void vh264_work_implement(struct vdec_h264_hw_s *hw, u32 param3 = READ_VREG(AV_SCRATCH_6); u32 param4 = READ_VREG(AV_SCRATCH_B); if (vh264_set_params(hw, param1, - param2, param3, param4) < 0) + param2, param3, param4, false) < 0) dpb_print(DECODE_ID(hw), 0, "set parameters error\n"); WRITE_VREG(AV_SCRATCH_0, (hw->max_reference_size<<24) | @@ -8289,7 +8297,7 @@ static void h264_reset_bufmgr(struct vdec_s *vdec) vf_notify_receiver(vdec->vf_provider_name, VFRAME_EVENT_PROVIDER_RESET, NULL); dealloc_buf_specs(hw, 1); - buf_spec_init(hw); + buf_spec_init(hw, true); vh264_local_init(hw); /*hw->decode_pic_count = 0; @@ -8298,7 +8306,7 @@ static void h264_reset_bufmgr(struct vdec_s *vdec) hw->cfg_param1, hw->cfg_param2, hw->cfg_param3, - hw->cfg_param4) < 0) + hw->cfg_param4, true) < 0) hw->stat |= DECODER_FATAL_ERROR_SIZE_OVERFLOW; p_H264_Dpb->first_insert_frame = FirstInsertFrm_RESET; hw->init_flag = 1; @@ -8487,7 +8495,7 @@ static int ammvdec_h264_probe(struct platform_device *pdev) platform_set_drvdata(pdev, pdata); - buf_spec_init(hw); + buf_spec_init(hw, false); hw->platform_dev = pdev; |