]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/amdgpu: disable gfxoff if VCN is busy
authorJiansong Chen <Jiansong.Chen@amd.com>
Fri, 30 Oct 2020 11:23:07 +0000 (19:23 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 2 Nov 2020 20:32:43 +0000 (15:32 -0500)
Toggle on/off gfxoff during video playback to fix gpu hang.

v2: change sequence to be more compatible with original code.

Signed-off-by: Jiansong Chen <Jiansong.Chen@amd.com>
Reviewed-by: James Zhu <James.Zhu@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c

index 277a8435dd0672ab02ba63c0bc2d543155861235..62d4614d48eb584a998123daab4dad241940f653 100644 (file)
@@ -358,6 +358,7 @@ static void amdgpu_vcn_idle_work_handler(struct work_struct *work)
        }
 
        if (!fences && !atomic_read(&adev->vcn.total_submission_cnt)) {
+               amdgpu_gfx_off_ctrl(adev, true);
                amdgpu_device_ip_set_powergating_state(adev, AMD_IP_BLOCK_TYPE_VCN,
                       AMD_PG_STATE_GATE);
        } else {
@@ -370,7 +371,9 @@ void amdgpu_vcn_ring_begin_use(struct amdgpu_ring *ring)
        struct amdgpu_device *adev = ring->adev;
 
        atomic_inc(&adev->vcn.total_submission_cnt);
-       cancel_delayed_work_sync(&adev->vcn.idle_work);
+
+       if (!cancel_delayed_work_sync(&adev->vcn.idle_work))
+               amdgpu_gfx_off_ctrl(adev, false);
 
        mutex_lock(&adev->vcn.vcn_pg_lock);
        amdgpu_device_ip_set_powergating_state(adev, AMD_IP_BLOCK_TYPE_VCN,