drm/amd/amdgpu: add atomit helper function into suspend/resume functions
Subsystems (2)
PATCH 1/1 drm/amd/amdgpu: add atomit helper function into suspend/resume functions
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 33 ++++++++++++++++-------------- 2 files changed, 19 insertions(+), 16 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -1
@@ -1500,10 +1500,10 @@ struct amdgpu_device {/* link all gtt */ spinlock_t gtt_list_lock;struct list_head gtt_list; -/* record hw reset is performed */ bool has_hw_reset; +struct drm_atomic_state *atomic_state; };static inline struct amdgpu_device *amdgpu_ttm_adev (struct ttm_bo_device *bdev)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +18 -15
@@ -2059,7 +2059,20 @@ int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon)drm_kms_helper_poll_disable (dev); -if (!amdgpu_device_has_dc_support (adev)) { +if (fbcon) { +console_lock (); +amdgpu_fbdev_set_suspend (adev,1 ); +console_unlock (); + } + +if (amdgpu_device_has_dc_support (adev)) { + adev->atomic_state =drm_atomic_helper_suspend (adev->ddev); +if (IS_ERR (adev->atomic_state)) { +amdgpu_fbdev_set_suspend (adev,0 ); +drm_kms_helper_poll_enable (adev->ddev); +return PTR_ERR (adev->atomic_state); + } + }else {/* turn off display hw */ drm_modeset_lock_all (dev);list_for_each_entry (connector, &dev->mode_config.connector_list, head) {
@@ -2121,11 +2134,6 @@ int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon)DRM_ERROR ("amdgpu asic reset failed\n" ); } -if (fbcon) { -console_lock (); -amdgpu_fbdev_set_suspend (adev,1 ); -console_unlock (); - }return 0 ; }
@@ -2209,7 +2217,10 @@ int amdgpu_device_resume(struct drm_device *dev, bool resume, bool fbcon)/* blat the mode back in */ if (fbcon) { -if (!amdgpu_device_has_dc_support (adev)) { +if (amdgpu_device_has_dc_support (adev)) { +drm_atomic_helper_resume (adev->ddev, adev->atomic_state); +amdgpu_dm_display_resume (adev); + }else {/* pre DCE11 */ drm_helper_resume_force_mode (dev);
@@ -2219,14 +2230,6 @@ int amdgpu_device_resume(struct drm_device *dev, bool resume, bool fbcon)drm_helper_connector_dpms (connector,DRM_MODE_DPMS_ON ); }drm_modeset_unlock_all (dev); - }else { -/* -* There is no equivalent atomic helper to turn on -* display, so we defined our own function for this, -* once suspend resume is supported by the atomic -* framework this will be reworked -*/ -amdgpu_dm_display_resume (adev); } }
Signature · 6 lines
1.9.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Typo in the subject: "atomit"
drivers/gpu/drm/amd/amdgpu/amdgpu.h struct amdgpu_device { · line 1504
Quoted 12 lines · Jim Qu
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0
-1@@ -1500,10 +1500,10 @@ struct amdgpu_device {/* link all gtt */ spinlock_t gtt_list_lock;struct list_head gtt_list; -/* record hw reset is performed */ bool has_hw_reset;
Don't remove the empty line.
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0
-0static inline struct amdgpu_device *amdgpu_ttm_adev (struct ttm_bo_device *bdev)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-1@@ -2059,7 +2059,20 @@ int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon)drm_kms_helper_poll_disable (dev); -if (!amdgpu_device_has_dc_support (adev)) {
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon) · line 2071
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +10
-0+if (fbcon) { +console_lock (); +amdgpu_fbdev_set_suspend (adev,1 ); +console_unlock (); + } + +if (amdgpu_device_has_dc_support (adev)) { + adev->atomic_state =drm_atomic_helper_suspend (adev->ddev); +if (IS_ERR (adev->atomic_state)) { +amdgpu_fbdev_set_suspend (adev,0 );
I think this needs to be
if (fbcon) {
console_lock();
amdgpu_fbdev_set_suspend(adev, 0);
console_unlock();
}Maybe refactor this sequence into a helper function in a preparatory patch.
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_resume(struct drm_device *dev, bool resume, bool fbcon) · line 2222
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +3
-1@@ -2209,7 +2217,10 @@ int amdgpu_device_resume(struct drm_device *dev, bool resume, bool fbcon)/* blat the mode back in */ if (fbcon) { -if (!amdgpu_device_has_dc_support (adev)) { +if (amdgpu_device_has_dc_support (adev)) { +drm_atomic_helper_resume (adev->ddev, adev->atomic_state); +amdgpu_dm_display_resume (adev);
These also need to be called in the non-fbcon case, don't they?
Signature · 6 lines
Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Mesa and X developer _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Thanks to Michel. I have sent new patches, please help review.
Thanks
JimQu
________________________________________
发件人: Michel Dänzer <[email protected]>
发送时间: 2017年3月1日 14:27
收件人: Qu, Jim
抄送: [email protected]
主题: Re: [PATCH] drm/amd/amdgpu: add atomit helper function into suspend/resume functions
Typo in the subject: "atomit"
drivers/gpu/drm/amd/amdgpu/amdgpu.h struct amdgpu_device { · line 1504
Quoted 12 lines · Jim Qu
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0
-1@@ -1500,10 +1500,10 @@ struct amdgpu_device {/* link all gtt */ spinlock_t gtt_list_lock;struct list_head gtt_list; -/* record hw reset is performed */ bool has_hw_reset;
Don't remove the empty line.
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0
-0static inline struct amdgpu_device *amdgpu_ttm_adev (struct ttm_bo_device *bdev)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-1@@ -2059,7 +2059,20 @@ int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon)drm_kms_helper_poll_disable (dev); -if (!amdgpu_device_has_dc_support (adev)) {
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon) · line 2071
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +10
-0+if (fbcon) { +console_lock (); +amdgpu_fbdev_set_suspend (adev,1 ); +console_unlock (); + } + +if (amdgpu_device_has_dc_support (adev)) { + adev->atomic_state =drm_atomic_helper_suspend (adev->ddev); +if (IS_ERR (adev->atomic_state)) { +amdgpu_fbdev_set_suspend (adev,0 );
I think this needs to be
if (fbcon) {
console_lock();
amdgpu_fbdev_set_suspend(adev, 0);
console_unlock();
}Maybe refactor this sequence into a helper function in a preparatory patch.
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_resume(struct drm_device *dev, bool resume, bool fbcon) · line 2222
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +3
-1@@ -2209,7 +2217,10 @@ int amdgpu_device_resume(struct drm_device *dev, bool resume, bool fbcon)/* blat the mode back in */ if (fbcon) { -if (!amdgpu_device_has_dc_support (adev)) { +if (amdgpu_device_has_dc_support (adev)) { +drm_atomic_helper_resume (adev->ddev, adev->atomic_state); +amdgpu_dm_display_resume (adev);
These also need to be called in the non-fbcon case, don't they?
--
Earthling Michel Dänzer | http://www.amd.com
Libre software enthusiast | Mesa and X developer
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx