Thanks to Michel. I have sent new patches, please help review. Thanks JimQu ________________________________________ å??件人: Michel Dänzer <michel at daenzer.net> å??é??æ?¶é?´: 2017å¹´3æ??1æ?¥ 14:27 æ?¶ä»¶äºº: Qu, Jim æ??é??: amd-gfx at lists.freedesktop.org 主é¢?: Re: [PATCH] drm/amd/amdgpu: add atomit helper function into suspend/resume functions Typo in the subject: "atomit" On 01/03/17 12:24 PM, Jim Qu wrote: > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h > index 8a5f8cb..cf75f6b 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h > @@ -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. > static inline struct amdgpu_device *amdgpu_ttm_adev(struct ttm_bo_device *bdev) > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c > index c0679d3..62083a3 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c > @@ -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); 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. > @@ -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