media_module: DVB pip playback stuck or show mosaic issue [1/1]
authorPeng Yixin <yixin.peng@amlogic.com>
Mon, 21 Dec 2020 11:27:40 +0000 (19:27 +0800)
committerYixin Peng <yixin.peng@amlogic.com>
Wed, 23 Dec 2020 08:11:06 +0000 (00:11 -0800)
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 <yixin.peng@amlogic.com>
Change-Id: I95ec497991fe14591086b000a6fbb2b4c68fb738

drivers/frame_provider/decoder/avs_multi/avs_multi.c
drivers/frame_provider/decoder/h264_multi/vmh264.c
drivers/frame_provider/decoder/mpeg12/vmpeg12_multi.c
drivers/frame_provider/decoder/mpeg4/vmpeg4_multi.c

index ae324719b85d1aaa8348a3f97d465f2ba444f47d..be250962bfb8c35acbe96827f87681683de8a122 100644 (file)
@@ -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)) {
index ffa17eff5eb61c1e46ba99ad243d17ad5ed15288..718a4fa771c4a7ea75579521e87c534fa7dff743 100644 (file)
@@ -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);
index 4ac580145b335f252344d7ac7a1371041040b66d..1fb6209fa62844644e3e9709c4e1a19743eb725c 100644 (file)
@@ -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;
index 4757b211bfc694b0acb2319d318b6b71cbb5b37b..c6e6422eec84682351cd4d8a3a0032179f193443 100644 (file)
@@ -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;