All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] drm/amdgpu: handle runtime pm in fbcon (v2)
@ 2016-09-02 15:18 Alex Deucher
       [not found] ` <1472829513-4539-1-git-send-email-alexander.deucher-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Alex Deucher @ 2016-09-02 15:18 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Alex Deucher

Ported from nouveau.

v2: re-enable runtime autosuspend in the error case

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
index 9191467..3c527cc 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
@@ -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,35 @@ 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) {
+		pm_runtime_mark_last_busy(adev->ddev->dev);
+		pm_runtime_put_autosuspend(adev->ddev->dev);
+		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,
-- 
2.5.5

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] drm/radeon: handle runtime pm in fbcon (v2)
       [not found] ` <1472829513-4539-1-git-send-email-alexander.deucher-5C7GfCeVMHo@public.gmane.org>
@ 2016-09-02 15:18   ` Alex Deucher
       [not found]     ` <1472829513-4539-2-git-send-email-alexander.deucher-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Alex Deucher @ 2016-09-02 15:18 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Alex Deucher

Ported from nouveau.

v2: re-enable runtime autosuspend in the error case

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/radeon/radeon_fb.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/drivers/gpu/drm/radeon/radeon_fb.c b/drivers/gpu/drm/radeon/radeon_fb.c
index 0e3143a..6b2537d 100644
--- a/drivers/gpu/drm/radeon/radeon_fb.c
+++ b/drivers/gpu/drm/radeon/radeon_fb.c
@@ -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,35 @@ 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) {
+		pm_runtime_mark_last_busy(rdev->ddev->dev);
+		pm_runtime_put_autosuspend(rdev->ddev->dev);
+		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,
-- 
2.5.5

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] drm/radeon: handle runtime pm in fbcon (v2)
       [not found]     ` <1472829513-4539-2-git-send-email-alexander.deucher-5C7GfCeVMHo@public.gmane.org>
@ 2016-09-03  5:07       ` Edward O'Callaghan
       [not found]         ` <19ade2e9-3fd5-a614-6ec8-a07147444ab1-dczkZgxz+BNUPWh3PAxdjQ@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Edward O'Callaghan @ 2016-09-03  5:07 UTC (permalink / raw)
  To: Alex Deucher, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Alex Deucher


[-- Attachment #1.1.1: Type: text/plain, Size: 2110 bytes --]



On 09/03/2016 01:18 AM, Alex Deucher wrote:
> Ported from nouveau.
> 
> v2: re-enable runtime autosuspend in the error case
> 
> Signed-off-by: Alex Deucher <alexander.deucher-5C7GfCeVMHo@public.gmane.org>
> ---
>  drivers/gpu/drm/radeon/radeon_fb.c | 28 ++++++++++++++++++++++++++++
>  1 file changed, 28 insertions(+)
> 
> diff --git a/drivers/gpu/drm/radeon/radeon_fb.c b/drivers/gpu/drm/radeon/radeon_fb.c
> index 0e3143a..6b2537d 100644
> --- a/drivers/gpu/drm/radeon/radeon_fb.c
> +++ b/drivers/gpu/drm/radeon/radeon_fb.c
> @@ -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,35 @@ 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) {
> +		pm_runtime_mark_last_busy(rdev->ddev->dev);
> +		pm_runtime_put_autosuspend(rdev->ddev->dev);
> +		return ret;
> +	}
> +	return 0;

Hi Alex,

Minor question - in the case of (ret == -EACCES) is that still regarded
as successful in the context of radeonfb_open()'s call?

If it indeed is then,

Acked-by: Edward O'Callaghan <funfunctor-dczkZgxz+BNUPWh3PAxdjQ@public.gmane.org>

Thanks for your time,
Edward.

> +}
> +
> +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,
> 


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] drm/radeon: handle runtime pm in fbcon (v2)
       [not found]         ` <19ade2e9-3fd5-a614-6ec8-a07147444ab1-dczkZgxz+BNUPWh3PAxdjQ@public.gmane.org>
@ 2016-09-05  7:48           ` Michel Dänzer
  2016-09-07 11:09           ` Deucher, Alexander
  1 sibling, 0 replies; 5+ messages in thread
From: Michel Dänzer @ 2016-09-05  7:48 UTC (permalink / raw)
  To: Edward O'Callaghan, Alex Deucher
  Cc: Alex Deucher, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW


[-- Attachment #1.1.1: Type: text/plain, Size: 1202 bytes --]

On 03/09/16 02:07 PM, Edward O'Callaghan wrote:
> On 09/03/2016 01:18 AM, Alex Deucher wrote:
>> Ported from nouveau.
>>
>> v2: re-enable runtime autosuspend in the error case
>>
>> Signed-off-by: Alex Deucher <alexander.deucher-5C7GfCeVMHo@public.gmane.org>

[...]

>> @@ -47,8 +48,35 @@ 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) {
>> +		pm_runtime_mark_last_busy(rdev->ddev->dev);
>> +		pm_runtime_put_autosuspend(rdev->ddev->dev);
>> +		return ret;
>> +	}
>> +	return 0;
> 
> Hi Alex,
> 
> Minor question - in the case of (ret == -EACCES) is that still regarded
> as successful in the context of radeonfb_open()'s call?

Yes, it is. Both patches are

Reviewed-by: Michel Dänzer <michel.daenzer-5C7GfCeVMHo@public.gmane.org>


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 163 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH 2/2] drm/radeon: handle runtime pm in fbcon (v2)
       [not found]         ` <19ade2e9-3fd5-a614-6ec8-a07147444ab1-dczkZgxz+BNUPWh3PAxdjQ@public.gmane.org>
  2016-09-05  7:48           ` Michel Dänzer
@ 2016-09-07 11:09           ` Deucher, Alexander
  1 sibling, 0 replies; 5+ messages in thread
From: Deucher, Alexander @ 2016-09-07 11:09 UTC (permalink / raw)
  To: 'Edward O'Callaghan',
	Alex Deucher, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

> -----Original Message-----
> From: Edward O'Callaghan [mailto:funfunctor@folklore1984.net]
> Sent: Saturday, September 03, 2016 1:08 AM
> To: Alex Deucher; amd-gfx@lists.freedesktop.org
> Cc: Deucher, Alexander
> Subject: Re: [PATCH 2/2] drm/radeon: handle runtime pm in fbcon (v2)
> 
> 
> 
> On 09/03/2016 01:18 AM, Alex Deucher wrote:
> > Ported from nouveau.
> >
> > v2: re-enable runtime autosuspend in the error case
> >
> > Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> > ---
> >  drivers/gpu/drm/radeon/radeon_fb.c | 28
> ++++++++++++++++++++++++++++
> >  1 file changed, 28 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/radeon/radeon_fb.c
> b/drivers/gpu/drm/radeon/radeon_fb.c
> > index 0e3143a..6b2537d 100644
> > --- a/drivers/gpu/drm/radeon/radeon_fb.c
> > +++ b/drivers/gpu/drm/radeon/radeon_fb.c
> > @@ -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,35 @@ 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) {
> > +		pm_runtime_mark_last_busy(rdev->ddev->dev);
> > +		pm_runtime_put_autosuspend(rdev->ddev->dev);
> > +		return ret;
> > +	}
> > +	return 0;
> 
> Hi Alex,
> 
> Minor question - in the case of (ret == -EACCES) is that still regarded
> as successful in the context of radeonfb_open()'s call?
> 
> If it indeed is then,

Yes, -EACCES just means runtime pm is disabled so there is no power up of the device necessary.

Alex

> 
> Acked-by: Edward O'Callaghan <funfunctor@folklore1984.net>
> 
> Thanks for your time,
> Edward.
> 
> > +}
> > +
> > +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,
> >

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-09-07 11:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-02 15:18 [PATCH 1/2] drm/amdgpu: handle runtime pm in fbcon (v2) Alex Deucher
     [not found] ` <1472829513-4539-1-git-send-email-alexander.deucher-5C7GfCeVMHo@public.gmane.org>
2016-09-02 15:18   ` [PATCH 2/2] drm/radeon: " Alex Deucher
     [not found]     ` <1472829513-4539-2-git-send-email-alexander.deucher-5C7GfCeVMHo@public.gmane.org>
2016-09-03  5:07       ` Edward O'Callaghan
     [not found]         ` <19ade2e9-3fd5-a614-6ec8-a07147444ab1-dczkZgxz+BNUPWh3PAxdjQ@public.gmane.org>
2016-09-05  7:48           ` Michel Dänzer
2016-09-07 11:09           ` Deucher, Alexander

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.