vdec: Temporarily save the value of the register [1/1]
authoryuanfa.zhuang <yuanfa.zhuang@amlogic.com>
Tue, 22 Dec 2020 09:33:43 +0000 (17:33 +0800)
committerHui Zhang <hui.zhang@amlogic.com>
Thu, 24 Dec 2020 05:40:07 +0000 (21:40 -0800)
PD#SWPL-38043

Problem:
AV_SCRATCH_F register is tampered with by mpeg2
during multi-channel playback, resulting in playback show mosaic

Solution:
Increase the variable to save the value,
read the value directly next time

Verify:
S905X4-AH212

Signed-off-by: yuanfa.zhuang <yuanfa.zhuang@amlogic.com>
Change-Id: If36a83b1965d51045af2cd399934c87740e79616

drivers/frame_provider/decoder/h264_multi/vmh264.c

index 718a4fa771c4a7ea75579521e87c534fa7dff743..025a8e724ebc024552098b8b2180eb51268b7f6d 100644 (file)
@@ -922,6 +922,7 @@ struct vdec_h264_hw_s {
        int fence_usage;
        bool discard_dv_data;
        int vdec_pg_enable_flag;
+       u32 save_reg_f;
 };
 
 static u32 again_threshold;
@@ -7536,7 +7537,7 @@ static int vh264_hw_ctx_restore(struct vdec_h264_hw_s *hw)
        /* WRITE_VREG(AV_SCRATCH_F,
         *      (READ_VREG(AV_SCRATCH_F) & 0xffffffc3) );
         */
-       WRITE_VREG(AV_SCRATCH_F, (READ_VREG(AV_SCRATCH_F) & 0xffffffc3) |
+       WRITE_VREG(AV_SCRATCH_F, (hw->save_reg_f & 0xffffffc3) |
                ((error_recovery_mode_in & 0x1) << 4));
        /*if (hw->ucode_type == UCODE_IP_ONLY_PARAM)
                SET_VREG_MASK(AV_SCRATCH_F, 1 << 6);
@@ -8802,6 +8803,7 @@ static void vh264_work_implement(struct vdec_h264_hw_s *hw,
                        dealloc_buf_specs(hw, 0);
                        mutex_unlock(&vmh264_mutex);
                }
+       hw->save_reg_f = READ_VREG(AV_SCRATCH_F);
        hw->dpb.last_dpb_status = hw->dpb.dec_dpb_status;
        if (hw->dec_result == DEC_RESULT_CONFIG_PARAM) {
                u32 param1 = READ_VREG(AV_SCRATCH_1);