drm/amdgpu/vcn: not pause dpg for unified queue
authorjsg <jsg@openbsd.org>
Fri, 30 Aug 2024 04:25:22 +0000 (04:25 +0000)
committerjsg <jsg@openbsd.org>
Fri, 30 Aug 2024 04:25:22 +0000 (04:25 +0000)
From Boyuan Zhang
c6372cbd919b57d3b426938b7262ee1fb5be34e2 in linux-6.6.y/6.6.48
7d75ef3736a025db441be652c8cc8e84044a215f in mainline linux

sys/dev/pci/drm/amd/amdgpu/amdgpu_vcn.c

index 3d295ba..032eca4 100644 (file)
@@ -372,7 +372,9 @@ static void amdgpu_vcn_idle_work_handler(struct work_struct *work)
                for (i = 0; i < adev->vcn.num_enc_rings; ++i)
                        fence[j] += amdgpu_fence_count_emitted(&adev->vcn.inst[j].ring_enc[i]);
 
-               if (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG)    {
+               /* Only set DPG pause for VCN3 or below, VCN4 and above will be handled by FW */
+               if (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG &&
+                   !adev->vcn.using_unified_queue) {
                        struct dpg_pause_state new_state;
 
                        if (fence[j] ||
@@ -418,7 +420,9 @@ void amdgpu_vcn_ring_begin_use(struct amdgpu_ring *ring)
        amdgpu_device_ip_set_powergating_state(adev, AMD_IP_BLOCK_TYPE_VCN,
               AMD_PG_STATE_UNGATE);
 
-       if (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG)    {
+       /* Only set DPG pause for VCN3 or below, VCN4 and above will be handled by FW */
+       if (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG &&
+           !adev->vcn.using_unified_queue) {
                struct dpg_pause_state new_state;
 
                if (ring->funcs->type == AMDGPU_RING_TYPE_VCN_ENC) {
@@ -444,8 +448,12 @@ void amdgpu_vcn_ring_begin_use(struct amdgpu_ring *ring)
 
 void amdgpu_vcn_ring_end_use(struct amdgpu_ring *ring)
 {
+       struct amdgpu_device *adev = ring->adev;
+
+       /* Only set DPG pause for VCN3 or below, VCN4 and above will be handled by FW */
        if (ring->adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG &&
-               ring->funcs->type == AMDGPU_RING_TYPE_VCN_ENC)
+           ring->funcs->type == AMDGPU_RING_TYPE_VCN_ENC &&
+           !adev->vcn.using_unified_queue)
                atomic_dec(&ring->adev->vcn.inst[ring->me].dpg_enc_submission_cnt);
 
        atomic_dec(&ring->adev->vcn.total_submission_cnt);