Skip to contentSkip to conversation

drm/amdgpu: handle runtime pm in fbcon (v2)

PATCH In review Alex Deucher 4 participants 5 messages Sep 2, 2016 – Sep 7, 2016 3 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 drm/amdgpu: handle runtime pm in fbcon (v2)

Ported from nouveau.

v2: re-enable runtime autosuspend in the error case

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +28 -0
index 9191467..3c527cc 100644
@@ -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,
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): 1472829513-4539-1-git-send-email-alexander.deucher-5C7GfCeVMHo@public.gmane.org

#2 lore raw

PATCH 2/2 drm/radeon: handle runtime pm in fbcon (v2)

Ported from nouveau.

v2: re-enable runtime autosuspend in the error case

---
 drivers/gpu/drm/radeon/radeon_fb.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
drivers/gpu/drm/radeon/radeon_fb.c +28 -0
index 0e3143a..6b2537d 100644
@@ -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,
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): 1472829513-4539-2-git-send-email-alexander.deucher-5C7GfCeVMHo@public.gmane.org

#4 lore raw

Re: [PATCH 2/2] drm/radeon: handle runtime pm in fbcon (v2)

Quoted 27 lines · Alex Deucher

Ported from nouveau.

v2: re-enable runtime autosuspend in the error case

---
 drivers/gpu/drm/radeon/radeon_fb.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
drivers/gpu/drm/radeon/radeon_fb.c +3 -0
index 0e3143a..6b2537d 100644
@@ -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)

drivers/gpu/drm/radeon/radeon_fb.c struct radeon_fbdev { · line 62

Quoted 10 lines
drivers/gpu/drm/radeon/radeon_fb.c +10 -0
+{
+	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,

Thanks for your time,
Edward.

Quoted 11 lines
drivers/gpu/drm/radeon/radeon_fb.c +10 -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);

drivers/gpu/drm/radeon/radeon_fb.c struct radeon_fbdev { · line 82

Quoted 10 lines
drivers/gpu/drm/radeon/radeon_fb.c +5 -0
+	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
[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): 19ade2e9-3fd5-a614-6ec8-a07147444ab1-dczkZgxz+BNUPWh3PAxdjQ@public.gmane.org

Reviewed-by
#6 lore raw

Re: [PATCH 2/2] drm/radeon: handle runtime pm in fbcon (v2)

Quoted 6 lines · Edward O'Callaghan
Quoted 5 lines · Alex Deucher

Ported from nouveau.

v2: re-enable runtime autosuspend in the error case

[...]

Quoted 19 lines
Quoted 6 lines
drivers/gpu/drm/radeon/radeon_fb.c +2 -0
@@ -47,8 +48,35 @@ struct radeon_fbdev {
 	struct radeon_device *rdev;
 };
 
+static int
+radeonfb_open(struct fb_info *info, int user)

drivers/gpu/drm/radeon/radeon_fb.c struct radeon_fbdev { · line 62

Quoted 10 lines
drivers/gpu/drm/radeon/radeon_fb.c +10 -0
+{
+	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,

Quoted 2 lines

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

Signature · 2 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

#7 lore raw

RE: [PATCH 2/2] drm/radeon: handle runtime pm in fbcon (v2)

In reply to a message not in the archive
Quoted 52 lines

-----Original Message-----
From: Edward O'Callaghan [mailto:[email protected]]
Sent: Saturday, September 03, 2016 1:08 AM
To: Alex Deucher; [email protected]
Cc: Deucher, Alexander
Subject: Re: [PATCH 2/2] drm/radeon: handle runtime pm in fbcon (v2)

Quoted 7 lines · Alex Deucher

Ported from nouveau.

v2: re-enable runtime autosuspend in the error case

---
 drivers/gpu/drm/radeon/radeon_fb.c | 28

++++++++++++++++++++++++++++

Review

Quoted 3 lines
 1 file changed, 28 insertions(+)
(quoted diff) +0 -0

b/drivers/gpu/drm/radeon/radeon_fb.c

Quoted 17 lines

index 0e3143a..6b2537d 100644

drivers/gpu/drm/radeon/radeon_fb.c +3 -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,35 @@ struct radeon_fbdev {
 	struct radeon_device *rdev;
 };
 
+static int
+radeonfb_open(struct fb_info *info, int user)

drivers/gpu/drm/radeon/radeon_fb.c struct radeon_fbdev { · line 62

Quoted 10 lines
drivers/gpu/drm/radeon/radeon_fb.c +10 -0
+{
+	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,

Quoted 4 lines

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

Quoted 19 lines

Thanks for your time,
Edward.

Quoted 13 lines
drivers/gpu/drm/radeon/radeon_fb.c +13 -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;
+}
+
Quoted 8 lines

drivers/gpu/drm/radeon/radeon_fb.c struct radeon_fbdev { · line 82

Quoted 8 lines
drivers/gpu/drm/radeon/radeon_fb.c +2 -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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx