drm/amdgpu/vcn:fix dpg pause mode hang issue
authorJames Zhu <James.Zhu@amd.com>
Tue, 2 Oct 2018 15:44:50 +0000 (11:44 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 9 Oct 2018 22:07:26 +0000 (17:07 -0500)
Use mmUVD_SCRATCH2 tracking decode write point.
It will help avoid dpg pause mode hang issue.

Signed-off-by: James Zhu <James.Zhu@amd.com>
Acked-by: Leo Liu <leo.liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c
drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c

index 64e527b1c02f01d4bec2f3ee9b27e7502e65b160..12a60ecd44b3301de251d8c3feec023421ed7d44 100644 (file)
@@ -263,7 +263,7 @@ static int amdgpu_vcn_pause_dpg_mode(struct amdgpu_device *adev,
 
                                ring = &adev->vcn.ring_dec;
                                WREG32_SOC15(UVD, 0, mmUVD_RBC_RB_WPTR,
-                                            lower_32_bits(ring->wptr) | 0x80000000);
+                                                  RREG32_SOC15(UVD, 0, mmUVD_SCRATCH2));
                                SOC15_WAIT_ON_RREG(UVD, 0, mmUVD_POWER_STATUS,
                                                   UVD_PGFSM_CONFIG__UVDM_UVDU_PWR_ON,
                                                   UVD_POWER_STATUS__UVD_POWER_STATUS_MASK, ret_code);
@@ -320,7 +320,7 @@ static int amdgpu_vcn_pause_dpg_mode(struct amdgpu_device *adev,
 
                                ring = &adev->vcn.ring_dec;
                                WREG32_SOC15(UVD, 0, mmUVD_RBC_RB_WPTR,
-                                            lower_32_bits(ring->wptr) | 0x80000000);
+                                                  RREG32_SOC15(UVD, 0, mmUVD_SCRATCH2));
                                SOC15_WAIT_ON_RREG(UVD, 0, mmUVD_POWER_STATUS,
                                                   UVD_PGFSM_CONFIG__UVDM_UVDU_PWR_ON,
                                                   UVD_POWER_STATUS__UVD_POWER_STATUS_MASK, ret_code);
index fbc05ef905a74cdec1ed664de1420dea12f3781f..78a3115b5f4b1c75cc43a8cd675fce75ee8bc45c 100644 (file)
@@ -873,6 +873,8 @@ static int vcn_v1_0_start_spg_mode(struct amdgpu_device *adev)
        /* Initialize the ring buffer's read and write pointers */
        WREG32_SOC15(UVD, 0, mmUVD_RBC_RB_RPTR, 0);
 
+       WREG32_SOC15(UVD, 0, mmUVD_SCRATCH2, 0);
+
        ring->wptr = RREG32_SOC15(UVD, 0, mmUVD_RBC_RB_RPTR);
        WREG32_SOC15(UVD, 0, mmUVD_RBC_RB_WPTR,
                        lower_32_bits(ring->wptr));
@@ -1049,6 +1051,8 @@ static int vcn_v1_0_start_dpg_mode(struct amdgpu_device *adev)
        /* Initialize the ring buffer's read and write pointers */
        WREG32_SOC15(UVD, 0, mmUVD_RBC_RB_RPTR, 0);
 
+       WREG32_SOC15(UVD, 0, mmUVD_SCRATCH2, 0);
+
        ring->wptr = RREG32_SOC15(UVD, 0, mmUVD_RBC_RB_RPTR);
        WREG32_SOC15(UVD, 0, mmUVD_RBC_RB_WPTR,
                                                                lower_32_bits(ring->wptr));
@@ -1215,6 +1219,10 @@ static void vcn_v1_0_dec_ring_set_wptr(struct amdgpu_ring *ring)
 {
        struct amdgpu_device *adev = ring->adev;
 
+       if (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG)
+               WREG32_SOC15(UVD, 0, mmUVD_SCRATCH2,
+                       lower_32_bits(ring->wptr) | 0x80000000);
+
        WREG32_SOC15(UVD, 0, mmUVD_RBC_RB_WPTR, lower_32_bits(ring->wptr));
 }