drm/amdgpu: handle runtime pm in drm pre/post close
Subsystems (2)
PATCH 1/10 drm/amdgpu: handle runtime pm in drm pre/post close
Close was not handled correctly.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +4 -0
@@ -600,6 +600,9 @@ void amdgpu_driver_postclose_kms(struct drm_device *dev,kfree (fpriv); file_priv->driver_priv =NULL ; + +pm_runtime_mark_last_busy (dev->dev); +pm_runtime_put_autosuspend (dev->dev); }/**
@@ -614,6 +617,7 @@ void amdgpu_driver_postclose_kms(struct drm_device *dev,void amdgpu_driver_preclose_kms (struct drm_device *dev,struct drm_file *file_priv) { +pm_runtime_get_sync (dev->dev); }/*
Signature · 6 lines
2.5.5 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1472681336-30106-1-git-send-email-alexander.deucher-5C7GfCeVMHo@public.gmane.org
PATCH 2/10 drm/amdgpu: handle runtime pm correctly in amdgpu_driver_open_kms
Need to fix the error pathes.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +9 -8
@@ -542,12 +542,16 @@ int amdgpu_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv)return r; fpriv =kzalloc (sizeof (*fpriv),GFP_KERNEL ); -if (unlikely (!fpriv)) -return -ENOMEM ; +if (unlikely (!fpriv)) { + r = -ENOMEM ; + goto out_suspend; + } r =amdgpu_vm_init (adev, &fpriv->vm); -if (r) - goto error_free; +if (r) { +kfree (fpriv); + goto out_suspend; + }mutex_init (&fpriv->bo_list_lock);idr_init (&fpriv->bo_list_handles);
@@ -556,12 +560,9 @@ int amdgpu_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv) file_priv->driver_priv = fpriv; +out_suspend:pm_runtime_mark_last_busy (dev->dev);pm_runtime_put_autosuspend (dev->dev); -return 0 ; - -error_free: -kfree (fpriv);return r; }
Signature · 6 lines
2.5.5 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1472681336-30106-2-git-send-email-alexander.deucher-5C7GfCeVMHo@public.gmane.org
Michel Dänzer
Reviewed-byRe: [PATCH 02/10] drm/amdgpu: handle runtime pm correctly in amdgpu_driver_open_kms
Quoted 1 line · Alex Deucher
Need to fix the error pathes.
Typo? "pathes"
Quoted 31 lines
Signed-off-by Alex Deucher <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +8
-4@@ -542,12 +542,16 @@ int amdgpu_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv)return r; fpriv =kzalloc (sizeof (*fpriv),GFP_KERNEL ); -if (unlikely (!fpriv)) -return -ENOMEM ; +if (unlikely (!fpriv)) { + r = -ENOMEM ; + goto out_suspend; + } r =amdgpu_vm_init (adev, &fpriv->vm); -if (r) - goto error_free; +if (r) { +kfree (fpriv); + goto out_suspend; + }mutex_init (&fpriv->bo_list_lock);idr_init (&fpriv->bo_list_handles);
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c int amdgpu_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv) · line 564
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +1
-4@@ -556,12 +560,9 @@ int amdgpu_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv) file_priv->driver_priv = fpriv; +out_suspend:pm_runtime_mark_last_busy (dev->dev);pm_runtime_put_autosuspend (dev->dev); -return 0 ; - -error_free: -kfree (fpriv);
This patch and patch 7 are
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
PATCH 3/10 drm/amdgpu: handle runtime pm in fbcon
In reply to a message not in the archivePorted from nouveau.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +25 -0
@@ -26,6 +26,7 @@#include <linux/module.h> #include <linux/slab.h> #include <linux/fb.h> +#include <linux/pm_runtime.h> #include <drm/drmP.h> #include <drm/drm_crtc.h>
@@ -48,8 +49,32 @@ struct amdgpu_fbdev {struct amdgpu_device *adev; }; +static int +amdgpufb_open (struct fb_info *info,int user) +{ +struct amdgpu_fbdev *rfbdev = info->par; +struct amdgpu_device *adev = rfbdev->adev; +int ret =pm_runtime_get_sync (adev->ddev->dev); +if (ret <0 && ret != -EACCES ) +return ret; +return 0 ; +} + +static int +amdgpufb_release (struct fb_info *info,int user) +{ +struct amdgpu_fbdev *rfbdev = info->par; +struct amdgpu_device *adev = rfbdev->adev; + +pm_runtime_mark_last_busy (adev->ddev->dev); +pm_runtime_put_autosuspend (adev->ddev->dev); +return 0 ; +} +static struct fb_ops amdgpufb_ops = { .owner =THIS_MODULE , + .fb_open = amdgpufb_open, + .fb_release = amdgpufb_release, .fb_check_var = drm_fb_helper_check_var, .fb_set_par = drm_fb_helper_set_par, .fb_fillrect = drm_fb_helper_cfb_fillrect,
Signature · 6 lines
2.5.5 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1472681336-30106-3-git-send-email-alexander.deucher-5C7GfCeVMHo@public.gmane.org
Re: [PATCH 03/10] drm/amdgpu: handle runtime pm in fbcon
Quoted 3 lines · Alex Deucher
Ported from nouveau.
Signed-off-by Alex Deucher <[email protected]>
[...]
Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +11
-0+static int +amdgpufb_open (struct fb_info *info,int user) +{ +struct amdgpu_fbdev *rfbdev = info->par; +struct amdgpu_device *adev = rfbdev->adev; +int ret =pm_runtime_get_sync (adev->ddev->dev); +if (ret <0 && ret != -EACCES ) +return ret; +return 0 ; +} +
drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c struct amdgpu_fbdev { · line 72
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +10
-0+static int +amdgpufb_release (struct fb_info *info,int user) +{ +struct amdgpu_fbdev *rfbdev = info->par; +struct amdgpu_device *adev = rfbdev->adev; + +pm_runtime_mark_last_busy (adev->ddev->dev); +pm_runtime_put_autosuspend (adev->ddev->dev); +return 0 ; +}
If pm_runtime_get_sync returns -EACCES, won't there be an imbalance with the pm_runtime_put_autosuspend call, which might result in the GPU powering off even when there's something else which is supposed to keep it on?
Same for patch 8.
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
A message that is not in the archive (sent off-list or not yet received): c2ff0619-5d11-c443-a1b4-b57530dc89f6-otUistvHUpPR7s880joybQ@public.gmane.org
Re: [PATCH 03/10] drm/amdgpu: handle runtime pm in fbcon
Quoted 34 lines · Michel Dänzer
Quoted 3 lines · Alex Deucher
Ported from nouveau.
Signed-off-by Alex Deucher <[email protected]>[...]
Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +11
-0+static int +amdgpufb_open (struct fb_info *info,int user) +{ +struct amdgpu_fbdev *rfbdev = info->par; +struct amdgpu_device *adev = rfbdev->adev; +int ret =pm_runtime_get_sync (adev->ddev->dev); +if (ret <0 && ret != -EACCES ) +return ret; +return 0 ; +} +drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c struct amdgpu_fbdev { · line 72
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +10
-0+static int +amdgpufb_release (struct fb_info *info,int user) +{ +struct amdgpu_fbdev *rfbdev = info->par; +struct amdgpu_device *adev = rfbdev->adev; + +pm_runtime_mark_last_busy (adev->ddev->dev); +pm_runtime_put_autosuspend (adev->ddev->dev); +return 0 ; +}If
pm_runtime_get_syncreturns-EACCES, won't there be an imbalance with thepm_runtime_put_autosuspendcall, which might result in the GPU powering off even when there's something else which is supposed to keep it on?
Quoted 1 line
Same for patch 8.
pm_runtime_get_sync only returns -EACCES when runtime pm has been disabled in which case the GPU is on and pm_runtime_put_autosuspend won't do anything.
Alex
Quoted 5 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
A message that is not in the archive (sent off-list or not yet received): CADnq5_P+HQ=7LQfFjG8dLihbGsEKnLZFNmeFeUdL79VvuwyqdA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Re: [PATCH 03/10] drm/amdgpu: handle runtime pm in fbcon
Quoted 35 lines · Alex Deucher
Quoted 34 lines · Michel Dänzer
Quoted 3 lines · Alex Deucher
Ported from nouveau.
Signed-off-by Alex Deucher <[email protected]>[...]
Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +11
-0+static int +amdgpufb_open (struct fb_info *info,int user) +{ +struct amdgpu_fbdev *rfbdev = info->par; +struct amdgpu_device *adev = rfbdev->adev; +int ret =pm_runtime_get_sync (adev->ddev->dev); +if (ret <0 && ret != -EACCES ) +return ret; +return 0 ; +} +drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c struct amdgpu_fbdev { · line 72
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +10
-0+static int +amdgpufb_release (struct fb_info *info,int user) +{ +struct amdgpu_fbdev *rfbdev = info->par; +struct amdgpu_device *adev = rfbdev->adev; + +pm_runtime_mark_last_busy (adev->ddev->dev); +pm_runtime_put_autosuspend (adev->ddev->dev); +return 0 ; +}If
pm_runtime_get_syncreturns-EACCES, won't there be an imbalance with thepm_runtime_put_autosuspendcall, which might result in the GPU powering off even when there's something else which is supposed to keep it on?
Quoted 5 lines
Quoted 1 line
Same for patch 8.
pm_runtime_get_synconly returns-EACCESwhen runtime pm has been disabled in which case the GPU is on andpm_runtime_put_autosuspendwon't do anything.
It decreases dev->power.usage_count, and my worry was that pm_runtime_get_sync might not have increased it when it returns an error. But it turns out that it does increase it unconditionally.
However, I'm afraid there seems to be another related problem: If amdgpufb_open returns an error, amdgpufb_release won't be called AFAICT. In which case amdgpufb_open needs to call pm_runtime_put_autosuspend in the error case, or the GPU can never power off after that.
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
A message that is not in the archive (sent off-list or not yet received): 38837769-4dfc-8a19-b6de-c5d18014c889-otUistvHUpPR7s880joybQ@public.gmane.org
RE: [PATCH 03/10] drm/amdgpu: handle runtime pm in fbcon
Quoted 57 lines
-----Original Message-----
From: Michel Dänzer [mailto:[email protected]]
Sent: Thursday, September 01, 2016 9:47 PM
To: Alex Deucher
Cc: amd-gfx list; Deucher, Alexander
Subject: Re: [PATCH 03/10] drm/amdgpu: handle runtime pm in fbconQuoted 1 line · Alex Deucher
On Wed, Aug 31, 2016 at 9:04 PM, Michel Dänzer <[email protected]>
Quoted 22 lines · wrote:
Quoted 22 lines · Alex Deucher
Quoted 3 lines
Ported from nouveau.
Signed-off-by Alex Deucher <[email protected]>[...]
Quoted 15 lines
(quoted diff) +15
-0+static int +amdgpufb_open(struct fb_info *info, int user) +{ + struct amdgpu_fbdev *rfbdev = info->par; + struct amdgpu_device *adev = rfbdev->adev; + int ret = pm_runtime_get_sync(adev->ddev->dev); + if (ret < 0 && ret != -EACCES) + return ret; + return 0; +} + +static int +amdgpufb_release(struct fb_info *info, int user) +{ + struct amdgpu_fbdev *rfbdev = info->par;Quoted 8 lines
Quoted 8 lines
Review
Quoted 6 lines
(quoted diff) +6
-0+ struct amdgpu_device *adev = rfbdev->adev; + + pm_runtime_mark_last_busy(adev->ddev->dev); + pm_runtime_put_autosuspend(adev->ddev->dev); + return 0; +}If
pm_runtime_get_syncreturns-EACCES, won't there be an imbalancewith
Quoted 2 lines
Quoted 2 lines
the
pm_runtime_put_autosuspendcall, which might result in the GPU powering off even when there's something else which is supposed tokeep
Quoted 7 lines
Quoted 3 lines
it on?
Same for patch 8.
pm_runtime_get_synconly returns-EACCESwhen runtime pm has been disabled in which case the GPU is on andpm_runtime_put_autosuspendwon't do anything.It decreases
dev->power.usage_count, and my worry was thatpm_runtime_get_syncmight not have increased it when it returns an error. But it turns out that it does increase it unconditionally.
Quoted 6 lines
However, I'm afraid there seems to be another related problem: If
amdgpufb_openreturns an error,amdgpufb_releasewon't be called AFAICT.
In which caseamdgpufb_openneeds to callpm_runtime_put_autosuspendin
the error case, or the GPU can never power off after that.
Good point. I'll fix that up.
Alex
Quoted 5 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
PATCH 4/10 drm/amdgpu: skip suspend/resume on DRM_SWITCH_POWER_DYNAMIC_OFF
In reply to a message not in the archiveMissed this case previously. No need to do anything if the device is already off. runtime pm will handle it.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +4 -2
@@ -1842,7 +1842,8 @@ int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon, adev = dev->dev_private; -if (dev->switch_power_state ==DRM_SWITCH_POWER_OFF ) +if (dev->switch_power_state ==DRM_SWITCH_POWER_OFF || + dev->switch_power_state ==DRM_SWITCH_POWER_DYNAMIC_OFF )return 0 ;drm_kms_helper_poll_disable (dev);
@@ -1926,7 +1927,8 @@ int amdgpu_device_resume(struct drm_device *dev, bool resume, bool fbcon,struct drm_crtc *crtc;int r; -if (dev->switch_power_state ==DRM_SWITCH_POWER_OFF ) +if (dev->switch_power_state ==DRM_SWITCH_POWER_OFF || + dev->switch_power_state ==DRM_SWITCH_POWER_DYNAMIC_OFF )return 0 ;if (fbcon) {
Signature · 6 lines
2.5.5 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1472681336-30106-4-git-send-email-alexander.deucher-5C7GfCeVMHo@public.gmane.org
Michel Dänzer
Acked-byRe: [PATCH 04/10] drm/amdgpu: skip suspend/resume on DRM_SWITCH_POWER_DYNAMIC_OFF
Quoted 24 lines · Alex Deucher
Missed this case previously. No need to do anything if the device is already off. runtime pm will handle it.
Signed-off-by Alex Deucher <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2
-1@@ -1842,7 +1842,8 @@ int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon, adev = dev->dev_private; -if (dev->switch_power_state ==DRM_SWITCH_POWER_OFF ) +if (dev->switch_power_state ==DRM_SWITCH_POWER_OFF || + dev->switch_power_state ==DRM_SWITCH_POWER_DYNAMIC_OFF )return 0 ;drm_kms_helper_poll_disable (dev);
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_resume(struct drm_device *dev, bool resume, bool fbcon, · line 1934
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2
-1@@ -1926,7 +1927,8 @@ int amdgpu_device_resume(struct drm_device *dev, bool resume, bool fbcon,struct drm_crtc *crtc;int r; -if (dev->switch_power_state ==DRM_SWITCH_POWER_OFF ) +if (dev->switch_power_state ==DRM_SWITCH_POWER_OFF || + dev->switch_power_state ==DRM_SWITCH_POWER_DYNAMIC_OFF )return 0 ;if (fbcon) {
This patch and patches 5, 9 & 10 are
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
PATCH 5/10 drm/amdgpu: set runtime pm state to active on resume
In reply to a message not in the archiveThe sbios always powers up the dGPU on resume.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +8 -0
@@ -495,6 +495,14 @@ static int amdgpu_pmops_resume(struct device *dev) {struct pci_dev *pdev =to_pci_dev (dev);struct drm_device *drm_dev =pci_get_drvdata (pdev); + +/* GPU comes up enabled by the bios on resume */ +if (amdgpu_device_is_px (drm_dev)) { +pm_runtime_disable (dev); +pm_runtime_set_active (dev); +pm_runtime_enable (dev); + } +return amdgpu_device_resume (drm_dev, true, true, false); }
Signature · 6 lines
2.5.5 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 6/10 drm/radeon: handle runtime pm in drm pre/post close
In reply to a message not in the archiveClose was not handled correctly.
--- drivers/gpu/drm/radeon/radeon_kms.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/radeon/radeon_kms.c +4 -0
@@ -717,6 +717,8 @@ void radeon_driver_postclose_kms(struct drm_device *dev,kfree (fpriv); file_priv->driver_priv =NULL ; } +pm_runtime_mark_last_busy (dev->dev); +pm_runtime_put_autosuspend (dev->dev); }/**
@@ -733,6 +735,8 @@ void radeon_driver_preclose_kms(struct drm_device *dev, {struct radeon_device *rdev = dev->dev_private; +pm_runtime_get_sync (dev->dev); +mutex_lock (&rdev->gem.mutex);if (rdev->hyperz_filp == file_priv) rdev->hyperz_filp =NULL ;
Signature · 6 lines
2.5.5 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 7/10 drm/radeon: handle runtime pm correctly in amdgpu_driver_open_kms
In reply to a message not in the archiveNeed to fix the error paths.
--- drivers/gpu/drm/radeon/radeon_kms.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/gpu/drm/radeon/radeon_kms.c +7 -6
@@ -641,11 +641,11 @@ int radeon_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv)if (rdev->family >=CHIP_CAYMAN ) {struct radeon_fpriv *fpriv;struct radeon_vm *vm; -int r; fpriv =kzalloc (sizeof (*fpriv),GFP_KERNEL );if (unlikely (!fpriv)) { -return -ENOMEM ; + r = -ENOMEM ; + goto out_suspend; }if (rdev->accel_working) {
@@ -653,14 +653,14 @@ int radeon_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv) r =radeon_vm_init (rdev, vm);if (r) {kfree (fpriv); -return r; + goto out_suspend; } r =radeon_bo_reserve (rdev->ring_tmp_bo.bo, false);if (r) {radeon_vm_fini (rdev, vm);kfree (fpriv); -return r; + goto out_suspend; }/* map the ib pool buffer read only into
@@ -674,15 +674,16 @@ int radeon_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv)if (r) {radeon_vm_fini (rdev, vm);kfree (fpriv); -return r; + goto out_suspend; } } file_priv->driver_priv = fpriv; } +out_suspend:pm_runtime_mark_last_busy (dev->dev);pm_runtime_put_autosuspend (dev->dev); -return 0 ; +return r; }/**
Signature · 6 lines
2.5.5 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 8/10 drm/radeon: handle runtime pm in fbcon
In reply to a message not in the archivePorted from nouveau.
--- drivers/gpu/drm/radeon/radeon_fb.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
drivers/gpu/drm/radeon/radeon_fb.c +25 -0
@@ -26,6 +26,7 @@#include <linux/module.h> #include <linux/slab.h> #include <linux/fb.h> +#include <linux/pm_runtime.h> #include <drm/drmP.h> #include <drm/drm_crtc.h>
@@ -47,8 +48,32 @@ struct radeon_fbdev {struct radeon_device *rdev; }; +static int +radeonfb_open (struct fb_info *info,int user) +{ +struct radeon_fbdev *rfbdev = info->par; +struct radeon_device *rdev = rfbdev->rdev; +int ret =pm_runtime_get_sync (rdev->ddev->dev); +if (ret <0 && ret != -EACCES ) +return ret; +return 0 ; +} + +static int +radeonfb_release (struct fb_info *info,int user) +{ +struct radeon_fbdev *rfbdev = info->par; +struct radeon_device *rdev = rfbdev->rdev; + +pm_runtime_mark_last_busy (rdev->ddev->dev); +pm_runtime_put_autosuspend (rdev->ddev->dev); +return 0 ; +} +static struct fb_ops radeonfb_ops = { .owner =THIS_MODULE , + .fb_open = radeonfb_open, + .fb_release = radeonfb_release, .fb_check_var = drm_fb_helper_check_var, .fb_set_par = drm_fb_helper_set_par, .fb_fillrect = drm_fb_helper_cfb_fillrect,
Signature · 6 lines
2.5.5 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 9/10 drm/radeon: skip suspend/resume on DRM_SWITCH_POWER_DYNAMIC_OFF
In reply to a message not in the archiveMissed this case previously. No need to do anything if the device is already off. runtime pm will handle it.
--- drivers/gpu/drm/radeon/radeon_device.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/radeon/radeon_device.c +4 -2
@@ -1594,7 +1594,8 @@ int radeon_suspend_kms(struct drm_device *dev, bool suspend, rdev = dev->dev_private; -if (dev->switch_power_state ==DRM_SWITCH_POWER_OFF ) +if (dev->switch_power_state ==DRM_SWITCH_POWER_OFF || + dev->switch_power_state ==DRM_SWITCH_POWER_DYNAMIC_OFF )return 0 ;drm_kms_helper_poll_disable (dev);
@@ -1689,7 +1690,8 @@ int radeon_resume_kms(struct drm_device *dev, bool resume, bool fbcon)struct drm_crtc *crtc;int r; -if (dev->switch_power_state ==DRM_SWITCH_POWER_OFF ) +if (dev->switch_power_state ==DRM_SWITCH_POWER_OFF || + dev->switch_power_state ==DRM_SWITCH_POWER_DYNAMIC_OFF )return 0 ;if (fbcon) {
Signature · 6 lines
2.5.5 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 10/10 drm/radeon: set runtime pm state to active on resume
In reply to a message not in the archiveThe sbios always powers up the dGPU on resume.
--- drivers/gpu/drm/radeon/radeon_drv.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/gpu/drm/radeon/radeon_drv.c +8 -0
@@ -386,6 +386,14 @@ static int radeon_pmops_resume(struct device *dev) {struct pci_dev *pdev =to_pci_dev (dev);struct drm_device *drm_dev =pci_get_drvdata (pdev); + +/* GPU comes up enabled by the bios on resume */ +if (radeon_is_px (drm_dev)) { +pm_runtime_disable (dev); +pm_runtime_set_active (dev); +pm_runtime_enable (dev); + } +return radeon_resume_kms (drm_dev, true, true); }
Signature · 6 lines
2.5.5 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 22 lines · Alex Deucher
Close was not handled correctly.
Signed-off-by Alex Deucher <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 4 ++++ 1 file changed, 4 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +3
-0@@ -600,6 +600,9 @@ void amdgpu_driver_postclose_kms(struct drm_device *dev,kfree (fpriv); file_priv->driver_priv =NULL ; + +pm_runtime_mark_last_busy (dev->dev); +pm_runtime_put_autosuspend (dev->dev); }/**
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c void amdgpu_driver_postclose_kms(struct drm_device *dev, · line 621
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +1
-0@@ -614,6 +617,7 @@ void amdgpu_driver_postclose_kms(struct drm_device *dev,void amdgpu_driver_preclose_kms (struct drm_device *dev,struct drm_file *file_priv) { +pm_runtime_get_sync (dev->dev); }
What if pm_runtime_get_sync returns an error?
Same for patch 6.
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
A message that is not in the archive (sent off-list or not yet received): 6648435f-d52e-e4d3-55f4-df1837b3b8a8-otUistvHUpPR7s880joybQ@public.gmane.org
Quoted 31 lines · Michel Dänzer
Quoted 22 lines · Alex Deucher
Close was not handled correctly.
Signed-off-by Alex Deucher <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 4 ++++ 1 file changed, 4 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +3
-0@@ -600,6 +600,9 @@ void amdgpu_driver_postclose_kms(struct drm_device *dev,kfree (fpriv); file_priv->driver_priv =NULL ; + +pm_runtime_mark_last_busy (dev->dev); +pm_runtime_put_autosuspend (dev->dev); }/** drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c void amdgpu_driver_postclose_kms(struct drm_device *dev, · line 621
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +1
-0@@ -614,6 +617,7 @@ void amdgpu_driver_postclose_kms(struct drm_device *dev,void amdgpu_driver_preclose_kms (struct drm_device *dev,struct drm_file *file_priv) { +pm_runtime_get_sync (dev->dev); }What if
pm_runtime_get_syncreturns an error?
Quoted 2 lines
Same for patch 6.
I guess we could report it. drm_release() doesn't check the return value however.
Alex
Quoted 4 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
A message that is not in the archive (sent off-list or not yet received): CADnq5_N3e=xLhziKFKJog9vodd-=0sG4o2xW+kqU9ck+jFtMYA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Michel Dänzer
Reviewed-byQuoted 32 lines · Alex Deucher
Quoted 31 lines · Michel Dänzer
Quoted 22 lines · Alex Deucher
Close was not handled correctly.
Signed-off-by Alex Deucher <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 4 ++++ 1 file changed, 4 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +3
-0@@ -600,6 +600,9 @@ void amdgpu_driver_postclose_kms(struct drm_device *dev,kfree (fpriv); file_priv->driver_priv =NULL ; + +pm_runtime_mark_last_busy (dev->dev); +pm_runtime_put_autosuspend (dev->dev); }/** drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c void amdgpu_driver_postclose_kms(struct drm_device *dev, · line 621
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +1
-0@@ -614,6 +617,7 @@ void amdgpu_driver_postclose_kms(struct drm_device *dev,void amdgpu_driver_preclose_kms (struct drm_device *dev,struct drm_file *file_priv) { +pm_runtime_get_sync (dev->dev); }What if
pm_runtime_get_syncreturns an error?
Quoted 3 lines
Quoted 1 line
Same for patch 6.
I guess we could report it.
Based on the discussion of patch 3, it doesn't seem necessary. So this patch and patch 6 are
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