The addition of register read-back in VCN v3.0 is intended to prevent
potential race conditions.

Signed-off-by: David (Ming Qiang) Wu <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c 
b/drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c
index 0b19f0ab4480..792edc6582c1 100644
--- a/drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c
@@ -1173,6 +1173,11 @@ static int vcn_v3_0_start_dpg_mode(struct 
amdgpu_vcn_inst *vinst, bool indirect)
        WREG32_P(SOC15_REG_OFFSET(VCN, inst_idx, mmUVD_POWER_STATUS),
                0, ~UVD_POWER_STATUS__STALL_DPG_POWER_UP_MASK);
 
+       /* Keeping one read-back to ensure all register writes are done, 
otherwise
+        * it may introduce race conditions
+        */
+       RREG32_SOC15(VCN, inst_idx, mmUVD_RBC_RB_WPTR);
+
        return 0;
 }
 
@@ -1360,6 +1365,11 @@ static int vcn_v3_0_start(struct amdgpu_vcn_inst *vinst)
                fw_shared->multi_queue.encode_lowlatency_queue_mode &= 
cpu_to_le32(~FW_QUEUE_RING_RESET);
        }
 
+       /* Keeping one read-back to ensure all register writes are done, 
otherwise
+        * it may introduce race conditions
+        */
+       RREG32_SOC15(VCN, i, mmUVD_RBC_RB_WPTR);
+
        return 0;
 }
 
-- 
2.49.0

Reply via email to