Skip to content

Commit 2daba7d

Browse files
alexdeuchergregkh
authored andcommitted
drm/amdgpu: rework resume handling for display (v2)
commit 73dae65 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 aec3eec commit 2daba7d

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
@@ -3172,7 +3172,7 @@ static int amdgpu_device_ip_resume_phase1(struct amdgpu_device *adev)
31723172
*
31733173
* @adev: amdgpu_device pointer
31743174
*
3175-
* First resume function for hardware IPs. The list of all the hardware
3175+
* Second resume function for hardware IPs. The list of all the hardware
31763176
* IPs that make up the asic is walked and the resume callbacks are run for
31773177
* all blocks except COMMON, GMC, and IH. resume puts the hardware into a
31783178
* functional state after a suspend and updates the software state as
@@ -3190,6 +3190,7 @@ static int amdgpu_device_ip_resume_phase2(struct amdgpu_device *adev)
31903190
if (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_COMMON ||
31913191
adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_GMC ||
31923192
adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_IH ||
3193+
adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_DCE ||
31933194
adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_PSP)
31943195
continue;
31953196
r = adev->ip_blocks[i].version->funcs->resume(adev);
@@ -3204,6 +3205,36 @@ static int amdgpu_device_ip_resume_phase2(struct amdgpu_device *adev)
32043205
return 0;
32053206
}
32063207

3208+
/**
3209+
* amdgpu_device_ip_resume_phase3 - run resume for hardware IPs
3210+
*
3211+
* @adev: amdgpu_device pointer
3212+
*
3213+
* Third resume function for hardware IPs. The list of all the hardware
3214+
* IPs that make up the asic is walked and the resume callbacks are run for
3215+
* all DCE. resume puts the hardware into a functional state after a suspend
3216+
* and updates the software state as necessary. This function is also used
3217+
* for restoring the GPU after a GPU reset.
3218+
*
3219+
* Returns 0 on success, negative error code on failure.
3220+
*/
3221+
static int amdgpu_device_ip_resume_phase3(struct amdgpu_device *adev)
3222+
{
3223+
int i, r;
3224+
3225+
for (i = 0; i < adev->num_ip_blocks; i++) {
3226+
if (!adev->ip_blocks[i].status.valid || adev->ip_blocks[i].status.hw)
3227+
continue;
3228+
if (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_DCE) {
3229+
r = adev->ip_blocks[i].version->funcs->resume(adev);
3230+
if (r)
3231+
return r;
3232+
}
3233+
}
3234+
3235+
return 0;
3236+
}
3237+
32073238
/**
32083239
* amdgpu_device_ip_resume - run resume for hardware IPs
32093240
*
@@ -3230,6 +3261,13 @@ static int amdgpu_device_ip_resume(struct amdgpu_device *adev)
32303261

32313262
r = amdgpu_device_ip_resume_phase2(adev);
32323263

3264+
if (r)
3265+
return r;
3266+
3267+
amdgpu_fence_driver_hw_init(adev);
3268+
3269+
r = amdgpu_device_ip_resume_phase3(adev);
3270+
32333271
return r;
32343272
}
32353273

@@ -4229,7 +4267,6 @@ int amdgpu_device_resume(struct drm_device *dev, bool fbcon)
42294267
dev_err(adev->dev, "amdgpu_device_ip_resume failed (%d).\n", r);
42304268
goto exit;
42314269
}
4232-
amdgpu_fence_driver_hw_init(adev);
42334270

42344271
r = amdgpu_device_ip_late_init(adev);
42354272
if (r)
@@ -4999,6 +5036,10 @@ int amdgpu_do_asic_reset(struct list_head *device_list_handle,
49995036
if (r)
50005037
goto out;
50015038

5039+
r = amdgpu_device_ip_resume_phase3(tmp_adev);
5040+
if (r)
5041+
goto out;
5042+
50025043
if (vram_lost)
50035044
amdgpu_device_fill_reset_magic(tmp_adev);
50045045

0 commit comments

Comments
 (0)