Skip to content

Commit c807ab3

Browse files
alexdeuchergregkh
authored andcommitted
drm/amdgpu: rework resume handling for display (v2)
commit 73dae652dcac776296890da215ee7dec357a1032 upstream. Split resume into a 3rd step to handle displays when DCC is enabled on DCN 4.0.1. Move display after the buffer funcs have been re-enabled so that the GPU will do the move and properly set the DCC metadata for DCN. v2: fix fence irq resume ordering Reviewed-by: Christian König <[email protected]> Signed-off-by: Alex Deucher <[email protected]> Cc: [email protected] # 6.11.x Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 77ab79b commit c807ab3

File tree

1 file changed

+43
-2
lines changed

1 file changed

+43
-2
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3242,7 +3242,7 @@ static int amdgpu_device_ip_resume_phase1(struct amdgpu_device *adev)
32423242
*
32433243
* @adev: amdgpu_device pointer
32443244
*
3245-
* First resume function for hardware IPs. The list of all the hardware
3245+
* Second resume function for hardware IPs. The list of all the hardware
32463246
* IPs that make up the asic is walked and the resume callbacks are run for
32473247
* all blocks except COMMON, GMC, and IH. resume puts the hardware into a
32483248
* functional state after a suspend and updates the software state as
@@ -3260,6 +3260,7 @@ static int amdgpu_device_ip_resume_phase2(struct amdgpu_device *adev)
32603260
if (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_COMMON ||
32613261
adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_GMC ||
32623262
adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_IH ||
3263+
adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_DCE ||
32633264
adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_PSP)
32643265
continue;
32653266
r = adev->ip_blocks[i].version->funcs->resume(adev);
@@ -3283,6 +3284,36 @@ static int amdgpu_device_ip_resume_phase2(struct amdgpu_device *adev)
32833284
return 0;
32843285
}
32853286

3287+
/**
3288+
* amdgpu_device_ip_resume_phase3 - run resume for hardware IPs
3289+
*
3290+
* @adev: amdgpu_device pointer
3291+
*
3292+
* Third resume function for hardware IPs. The list of all the hardware
3293+
* IPs that make up the asic is walked and the resume callbacks are run for
3294+
* all DCE. resume puts the hardware into a functional state after a suspend
3295+
* and updates the software state as necessary. This function is also used
3296+
* for restoring the GPU after a GPU reset.
3297+
*
3298+
* Returns 0 on success, negative error code on failure.
3299+
*/
3300+
static int amdgpu_device_ip_resume_phase3(struct amdgpu_device *adev)
3301+
{
3302+
int i, r;
3303+
3304+
for (i = 0; i < adev->num_ip_blocks; i++) {
3305+
if (!adev->ip_blocks[i].status.valid || adev->ip_blocks[i].status.hw)
3306+
continue;
3307+
if (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_DCE) {
3308+
r = adev->ip_blocks[i].version->funcs->resume(adev);
3309+
if (r)
3310+
return r;
3311+
}
3312+
}
3313+
3314+
return 0;
3315+
}
3316+
32863317
/**
32873318
* amdgpu_device_ip_resume - run resume for hardware IPs
32883319
*
@@ -3313,6 +3344,13 @@ static int amdgpu_device_ip_resume(struct amdgpu_device *adev)
33133344

33143345
r = amdgpu_device_ip_resume_phase2(adev);
33153346

3347+
if (r)
3348+
return r;
3349+
3350+
amdgpu_fence_driver_hw_init(adev);
3351+
3352+
r = amdgpu_device_ip_resume_phase3(adev);
3353+
33163354
return r;
33173355
}
33183356

@@ -4311,7 +4349,6 @@ int amdgpu_device_resume(struct drm_device *dev, bool fbcon)
43114349
dev_err(adev->dev, "amdgpu_device_ip_resume failed (%d).\n", r);
43124350
return r;
43134351
}
4314-
amdgpu_fence_driver_hw_init(adev);
43154352

43164353
r = amdgpu_device_ip_late_init(adev);
43174354
if (r)
@@ -5065,6 +5102,10 @@ int amdgpu_do_asic_reset(struct list_head *device_list_handle,
50655102
if (r)
50665103
goto out;
50675104

5105+
r = amdgpu_device_ip_resume_phase3(tmp_adev);
5106+
if (r)
5107+
goto out;
5108+
50685109
if (vram_lost)
50695110
amdgpu_device_fill_reset_magic(tmp_adev);
50705111

0 commit comments

Comments
 (0)