From: yuanfa.zhuang <yuanfa.zhuang@amlogic.com>
Date: Tue, 22 Dec 2020 09:33:43 +0000 (+0800)
Subject: vdec: Temporarily save the value of the register [1/1]
X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=8c69b346b6ec7d0dafe3d17b7f023380ceaa9a69;p=GitHub%2FLineageOS%2FG12%2Fandroid_hardware_amlogic_kernel-modules_media.git

vdec: Temporarily save the value of the register [1/1]

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
---

diff --git a/drivers/frame_provider/decoder/h264_multi/vmh264.c b/drivers/frame_provider/decoder/h264_multi/vmh264.c
index 718a4fa..025a8e7 100644
--- a/drivers/frame_provider/decoder/h264_multi/vmh264.c
+++ b/drivers/frame_provider/decoder/h264_multi/vmh264.c
@@ -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);