drm/amdgpu: use register distance member instead of hardcode in UVD7/VCE4
authorHuang Rui <ray.huang@amd.com>
Wed, 1 Jul 2020 07:39:02 +0000 (15:39 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 8 Jul 2020 13:03:25 +0000 (09:03 -0400)
This patch updates to use register distance member instead of hardcode
in UVD7/VCE4. They are for the same ASIC.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Tested-by: AnZhong Huang <anzhong.huang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c
drivers/gpu/drm/amd/amdgpu/vce_v4_0.c

index 7a55457e6f9e091a418ad76213ead235f516ef02..e07e3fae99b5b318d23037b229233caea199df19 100644 (file)
@@ -1375,7 +1375,7 @@ static void uvd_v7_0_ring_emit_vm_flush(struct amdgpu_ring *ring,
        pd_addr = amdgpu_gmc_emit_flush_gpu_tlb(ring, vmid, pd_addr);
 
        /* wait for reg writes */
-       data0 = hub->ctx0_ptb_addr_lo32 + vmid * 2;
+       data0 = hub->ctx0_ptb_addr_lo32 + vmid * hub->ctx_addr_distance;
        data1 = lower_32_bits(pd_addr);
        mask = 0xffffffff;
        uvd_v7_0_ring_emit_reg_wait(ring, data0, data1, mask);
@@ -1417,7 +1417,8 @@ static void uvd_v7_0_enc_ring_emit_vm_flush(struct amdgpu_ring *ring,
        pd_addr = amdgpu_gmc_emit_flush_gpu_tlb(ring, vmid, pd_addr);
 
        /* wait for reg writes */
-       uvd_v7_0_enc_ring_emit_reg_wait(ring, hub->ctx0_ptb_addr_lo32 + vmid * 2,
+       uvd_v7_0_enc_ring_emit_reg_wait(ring, hub->ctx0_ptb_addr_lo32 +
+                                       vmid * hub->ctx_addr_distance,
                                        lower_32_bits(pd_addr), 0xffffffff);
 }
 
index a0fb119240f40d0b6a7742626d1858cce7505d06..37fa163393fd4dacd949a9298c17b3c2016769c0 100644 (file)
@@ -991,7 +991,8 @@ static void vce_v4_0_emit_vm_flush(struct amdgpu_ring *ring,
        pd_addr = amdgpu_gmc_emit_flush_gpu_tlb(ring, vmid, pd_addr);
 
        /* wait for reg writes */
-       vce_v4_0_emit_reg_wait(ring, hub->ctx0_ptb_addr_lo32 + vmid * 2,
+       vce_v4_0_emit_reg_wait(ring, hub->ctx0_ptb_addr_lo32 +
+                              vmid * hub->ctx_addr_distance,
                               lower_32_bits(pd_addr), 0xffffffff);
 }