From: Peng Yixin Date: Mon, 21 Dec 2020 11:27:40 +0000 (+0800) Subject: media_module: DVB pip playback stuck or show mosaic issue [1/1] X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=cbb14c256a98166fc165a18e6c25ffbf9245dc70;p=GitHub%2FLineageOS%2FG12%2Fandroid_hardware_amlogic_kernel-modules_media.git media_module: DVB pip playback stuck or show mosaic issue [1/1] PD#SWPL-39258 Problem: The MDEC_PIC_DC_CTRL register was modified at the same time,one channel is decoding, and other channel do initialization operation. Solution: This problem was solved by moving the MDEC_PIC_DC_CTRL register operation of probe to the run function to resolve this problem. Verify: SC2 Signed-off-by: Peng Yixin Change-Id: I95ec497991fe14591086b000a6fbb2b4c68fb738 --- diff --git a/drivers/frame_provider/decoder/avs_multi/avs_multi.c b/drivers/frame_provider/decoder/avs_multi/avs_multi.c index ae32471..be25096 100644 --- a/drivers/frame_provider/decoder/avs_multi/avs_multi.c +++ b/drivers/frame_provider/decoder/avs_multi/avs_multi.c @@ -553,6 +553,7 @@ struct vdec_avs_hw_s { u32 old_udebug_flag; u32 decode_status_skip_pic_done_flag; u32 decode_decode_cont_start_code; + int vdec_pg_enable_flag; }; static void reset_process_time(struct vdec_avs_hw_s *hw); @@ -2160,7 +2161,7 @@ static s32 vavs_init(struct vdec_avs_hw_s *hw) //hw->stat |= STAT_TIMER_INIT; - amvdec_enable(); + //amvdec_enable(); //vdec_enable_DMC(NULL); @@ -2464,7 +2465,7 @@ static int amvdec_avs_remove(struct platform_device *pdev) hw->fw = NULL; } - amvdec_disable(); + //amvdec_disable(); //vdec_disable_DMC(NULL); hw->pic_type = 0; @@ -2978,8 +2979,13 @@ void (*callback)(struct vdec_s *, void *), { struct vdec_avs_hw_s *hw = (struct vdec_avs_hw_s *)vdec->private; - int save_reg = READ_VREG(POWER_CTL_VLD); + int save_reg; int size, ret; + if (!hw->vdec_pg_enable_flag) { + hw->vdec_pg_enable_flag = 1; + amvdec_enable(); + } + save_reg = READ_VREG(POWER_CTL_VLD); /* reset everything except DOS_TOP[1] and APB_CBUS[0]*/ debug_print(hw, PRINT_FLAG_RUN_FLOW,"run in\n"); if (vdec_stream_based(vdec)) { diff --git a/drivers/frame_provider/decoder/h264_multi/vmh264.c b/drivers/frame_provider/decoder/h264_multi/vmh264.c index ffa17ef..718a4fa 100644 --- a/drivers/frame_provider/decoder/h264_multi/vmh264.c +++ b/drivers/frame_provider/decoder/h264_multi/vmh264.c @@ -921,6 +921,7 @@ struct vdec_h264_hw_s { bool enable_fence; int fence_usage; bool discard_dv_data; + int vdec_pg_enable_flag; }; static u32 again_threshold; @@ -7699,12 +7700,12 @@ static s32 vh264_init(struct vdec_h264_hw_s *hw) INIT_WORK(&hw->user_data_ready_work, user_data_ready_notify_work); #endif - if (!amvdec_enable_flag) { + /*if (!amvdec_enable_flag) { amvdec_enable_flag = true; amvdec_enable(); if (hw->mmu_enable) amhevc_enable(); - } + }*/ if (hw->mmu_enable) { hw->frame_mmu_map_addr = @@ -7755,6 +7756,7 @@ static s32 vh264_init(struct vdec_h264_hw_s *hw) if (!hw->mc_cpu_addr) { amvdec_enable_flag = false; amvdec_disable(); + hw->vdec_pg_enable_flag = 0; if (hw->mmu_enable) amhevc_disable(); pr_info("vh264_init: Can not allocate mc memory.\n"); @@ -9327,7 +9329,12 @@ static void run(struct vdec_s *vdec, unsigned long mask, (struct vdec_h264_hw_s *)vdec->private; struct h264_dpb_stru *p_H264_Dpb = &hw->dpb; int size, ret = -1; - + if (!hw->vdec_pg_enable_flag) { + hw->vdec_pg_enable_flag = 1; + amvdec_enable(); + if (hw->mmu_enable) + amhevc_enable(); + } run_count[DECODE_ID(hw)]++; vdec_reset_core(vdec); if (hw->mmu_enable) @@ -9461,7 +9468,7 @@ static void run(struct vdec_s *vdec, unsigned long mask, if (ret < 0) { amvdec_enable_flag = false; amvdec_disable(); - + hw->vdec_pg_enable_flag = 0; dpb_print(DECODE_ID(hw), PRINT_FLAG_ERROR, "MH264 the %s fw loading failed, err: %x\n", tee_enabled() ? "TEE" : "local", ret); @@ -9477,7 +9484,6 @@ static void run(struct vdec_s *vdec, unsigned long mask, if (ret < 0) { amvdec_enable_flag = false; amhevc_disable(); - dpb_print(DECODE_ID(hw), PRINT_FLAG_ERROR, "MH264_MMU the %s fw loading failed, err: %x\n", tee_enabled() ? "TEE" : "local", ret); diff --git a/drivers/frame_provider/decoder/mpeg12/vmpeg12_multi.c b/drivers/frame_provider/decoder/mpeg12/vmpeg12_multi.c index 4ac5801..1fb6209 100644 --- a/drivers/frame_provider/decoder/mpeg12/vmpeg12_multi.c +++ b/drivers/frame_provider/decoder/mpeg12/vmpeg12_multi.c @@ -335,6 +335,7 @@ struct vdec_mpeg12_hw_s { u32 profile_idc; u32 level_idc; int dec_again_cnt; + int vdec_pg_enable_flag; }; static void vmpeg12_local_init(struct vdec_mpeg12_hw_s *hw); static int vmpeg12_hw_ctx_restore(struct vdec_mpeg12_hw_s *hw); @@ -3068,7 +3069,7 @@ static s32 vmpeg12_init(struct vdec_mpeg12_hw_s *hw) hw->user_data_buffer, USER_DATA_SIZE); - amvdec_enable(); + //amvdec_enable(); init_timer(&hw->check_timer); hw->check_timer.data = (unsigned long)hw; hw->check_timer.function = check_timer_func; @@ -3223,13 +3224,17 @@ void (*callback)(struct vdec_s *, void *), { struct vdec_mpeg12_hw_s *hw = (struct vdec_mpeg12_hw_s *)vdec->private; - //int save_reg = READ_VREG(POWER_CTL_VLD); + int save_reg; int size, ret; - + if (!hw->vdec_pg_enable_flag) { + hw->vdec_pg_enable_flag = 1; + amvdec_enable(); + } + save_reg = READ_VREG(POWER_CTL_VLD); /* reset everything except DOS_TOP[1] and APB_CBUS[0]*/ - //WRITE_VREG(DOS_SW_RESET0, 0xfffffff0); - //WRITE_VREG(DOS_SW_RESET0, 0); - //WRITE_VREG(POWER_CTL_VLD, save_reg); + WRITE_VREG(DOS_SW_RESET0, 0xfffffff0); + WRITE_VREG(DOS_SW_RESET0, 0); + WRITE_VREG(POWER_CTL_VLD, save_reg); hw->run_count++; vdec_reset_core(vdec); hw->vdec_cb_arg = arg; diff --git a/drivers/frame_provider/decoder/mpeg4/vmpeg4_multi.c b/drivers/frame_provider/decoder/mpeg4/vmpeg4_multi.c index 4757b21..c6e6422 100644 --- a/drivers/frame_provider/decoder/mpeg4/vmpeg4_multi.c +++ b/drivers/frame_provider/decoder/mpeg4/vmpeg4_multi.c @@ -331,6 +331,7 @@ struct vdec_mpeg4_hw_s { unsigned int b_concealed_frames; u32 profile_idc; u32 level_idc; + int vdec_pg_enable_flag; }; static void vmpeg4_local_init(struct vdec_mpeg4_hw_s *hw); static int vmpeg4_hw_ctx_restore(struct vdec_mpeg4_hw_s *hw); @@ -2274,7 +2275,7 @@ static s32 vmmpeg4_init(struct vdec_mpeg4_hw_s *hw) pr_info("%s\n", __func__); - amvdec_enable(); + //amvdec_enable(); init_timer(&hw->check_timer); hw->check_timer.data = (unsigned long)hw; @@ -2373,7 +2374,10 @@ static void run(struct vdec_s *vdec, unsigned long mask, { struct vdec_mpeg4_hw_s *hw = (struct vdec_mpeg4_hw_s *)vdec->private; int size = 0, ret = 0; - + if (!hw->vdec_pg_enable_flag) { + hw->vdec_pg_enable_flag = 1; + amvdec_enable(); + } hw->run_count++; hw->vdec_cb_arg = arg; hw->vdec_cb = callback;