Skip to contentSkip to conversation

drm: handle cursor_set2 in restore_fbdev_mode

PATCH In review Alex Deucher 6 participants 12 messages Sep 30, 2015 – Oct 2, 2015

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

PATCH 1/2 drm: handle cursor_set2 in restore_fbdev_mode

If a driver uses the cursor_set2 crtc callback rather than cursor_set, use that. This fixes the fbdev helper for drivers that use cursor_set2.

Change-Id I127d3f8e72789ba70c3648140f87c6187864e130
---
 drivers/gpu/drm/drm_fb_helper.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_fb_helper.c +5 -1
index 418d299..ca08c47 100644
@@ -345,7 +345,11 @@ static bool restore_fbdev_mode(struct drm_fb_helper *fb_helper)
 		struct drm_crtc *crtc = mode_set->crtc;
 		int ret;
 
-		if (crtc->funcs->cursor_set) {
+		if (crtc->funcs->cursor_set2) {
+			ret = crtc->funcs->cursor_set2(crtc, NULL, 0, 0, 0, 0, 0);
+			if (ret)
+				error = true;
+		} else if (crtc->funcs->cursor_set) {
 			ret = crtc->funcs->cursor_set(crtc, NULL, 0, 0, 0);
 			if (ret)
 				error = true;
Signature · 6 lines
1.8.3.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw

PATCH 2/2 drm/radeon: drop radeon_fb_helper_set_par

It was just a wrapper around drm_fb_helper_set_par that called cursor_set2 in addition. Now that the core handles this, drop this radeon specific version.

Change-Id I037664baaf150efbf07074a96be84f6260cf0dc1
---
 drivers/gpu/drm/radeon/radeon_fb.c | 32 +-------------------------------
 1 file changed, 1 insertion(+), 31 deletions(-)
drivers/gpu/drm/radeon/radeon_fb.c +1 -31
index 7214858..1aa657f 100644
@@ -48,40 +48,10 @@ struct radeon_fbdev {
 	struct radeon_device *rdev;
 };
 
-/**
- * radeon_fb_helper_set_par - Hide cursor on CRTCs used by fbdev.
- *
- * @info: fbdev info
- *
- * This function hides the cursor on all CRTCs used by fbdev.
- */
-static int radeon_fb_helper_set_par(struct fb_info *info)
-{
-	int ret;
-
-	ret = drm_fb_helper_set_par(info);
-
-	/* XXX: with universal plane support fbdev will automatically disable
-	 * all non-primary planes (including the cursor)
-	 */
-	if (ret == 0) {
-		struct drm_fb_helper *fb_helper = info->par;
-		int i;
-
-		for (i = 0; i < fb_helper->crtc_count; i++) {
-			struct drm_crtc *crtc = fb_helper->crtc_info[i].mode_set.crtc;
-
-			radeon_crtc_cursor_set2(crtc, NULL, 0, 0, 0, 0, 0);
-		}
-	}
-
-	return ret;
-}
-
 static struct fb_ops radeonfb_ops = {
 	.owner = THIS_MODULE,
 	.fb_check_var = drm_fb_helper_check_var,
-	.fb_set_par = radeon_fb_helper_set_par,
+	.fb_set_par = drm_fb_helper_set_par,
 	.fb_fillrect = drm_fb_helper_cfb_fillrect,
 	.fb_copyarea = drm_fb_helper_cfb_copyarea,
 	.fb_imageblit = drm_fb_helper_cfb_imageblit,
Signature · 6 lines
1.8.3.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#2 lore raw
In reply to Alex Deucher
Quoted 6 lines · Alex Deucher

If a driver uses the cursor_set2 crtc callback rather than cursor_set, use that. This fixes the fbdev helper for drivers that use cursor_set2.

Change-Id I127d3f8e72789ba70c3648140f87c6187864e130

I'm not very familiar with the code, but that looks like it makes sense.

Both patches are Reviewed-by: Christian König <[email protected]>

Quoted 11 lines
---
  drivers/gpu/drm/drm_fb_helper.c | 6 +++++-
  1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_fb_helper.c +0 -0
index 418d299..ca08c47 100644
@@ -345,7 +345,11 @@ static bool restore_fbdev_mode(struct drm_fb_helper *fb_helper)
  		struct drm_crtc *crtc = mode_set->crtc;
  		int ret;

drivers/gpu/drm/drm_fb_helper.c static bool restore_fbdev_mode(struct drm_fb_helper *fb_helper) · line 355

Quoted 10 lines
drivers/gpu/drm/drm_fb_helper.c +5 -1
 
-		if (crtc->funcs->cursor_set) {
+		if (crtc->funcs->cursor_set2) {
+			ret = crtc->funcs->cursor_set2(crtc, NULL, 0, 0, 0, 0, 0);
+			if (ret)
+				error = true;
+		} else if (crtc->funcs->cursor_set) {
  			ret = crtc->funcs->cursor_set(crtc, NULL, 0, 0, 0);
  			if (ret)
  				error = true;

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

Reviewed-by on v1 1/2
#3 lore raw
In reply to Alex Deucher
Quoted 18 lines · Alex Deucher

If a driver uses the cursor_set2 crtc callback rather than cursor_set, use that. This fixes the fbdev helper for drivers that use cursor_set2.

Change-Id I127d3f8e72789ba70c3648140f87c6187864e130
---
 drivers/gpu/drm/drm_fb_helper.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_fb_helper.c +0 -0
index 418d299..ca08c47 100644
@@ -345,7 +345,11 @@ static bool restore_fbdev_mode(struct drm_fb_helper *fb_helper)
 		struct drm_crtc *crtc = mode_set->crtc;
 		int ret;

drivers/gpu/drm/drm_fb_helper.c static bool restore_fbdev_mode(struct drm_fb_helper *fb_helper) · line 355

Quoted 10 lines
drivers/gpu/drm/drm_fb_helper.c +5 -1
 
-		if (crtc->funcs->cursor_set) {
+		if (crtc->funcs->cursor_set2) {
+			ret = crtc->funcs->cursor_set2(crtc, NULL, 0, 0, 0, 0, 0);
+			if (ret)
+				error = true;
+		} else if (crtc->funcs->cursor_set) {
 			ret = crtc->funcs->cursor_set(crtc, NULL, 0, 0, 0);
 			if (ret)
 				error = true;

Hah, nice catch. The series is

(I assume you tested with something like killall -9 Xorg and confirming sure the cursor doesn't stay visible in console)

Signature · 6 lines
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#4 lore raw
Quoted 32 lines · Michel Dänzer
Quoted 18 lines · Alex Deucher

If a driver uses the cursor_set2 crtc callback rather than cursor_set, use that. This fixes the fbdev helper for drivers that use cursor_set2.

Change-Id I127d3f8e72789ba70c3648140f87c6187864e130
---
 drivers/gpu/drm/drm_fb_helper.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_fb_helper.c +0 -0
index 418d299..ca08c47 100644
@@ -345,7 +345,11 @@ static bool restore_fbdev_mode(struct drm_fb_helper *fb_helper)
              struct drm_crtc *crtc = mode_set->crtc;
              int ret;

drivers/gpu/drm/drm_fb_helper.c static bool restore_fbdev_mode(struct drm_fb_helper *fb_helper) · line 355

Quoted 10 lines
drivers/gpu/drm/drm_fb_helper.c +5 -1
 
-             if (crtc->funcs->cursor_set) {
+             if (crtc->funcs->cursor_set2) {
+                     ret = crtc->funcs->cursor_set2(crtc, NULL, 0, 0, 0, 0, 0);
+                     if (ret)
+                             error = true;
+             } else if (crtc->funcs->cursor_set) {
                      ret = crtc->funcs->cursor_set(crtc, NULL, 0, 0, 0);
                      if (ret)
                              error = true;

Hah, nice catch. The series is

Quoted 5 lines

(I assume you tested with something like killall -9 Xorg and confirming sure the cursor doesn't stay visible in console)

The cursor still stays visible in the console. Interestingly, the cursor still shows up in the console even without these patches.

Alex
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#5 lore raw
Quoted 33 lines · Alex Deucher
Quoted 32 lines · Michel Dänzer
Quoted 18 lines · Alex Deucher

If a driver uses the cursor_set2 crtc callback rather than cursor_set, use that. This fixes the fbdev helper for drivers that use cursor_set2.

Change-Id I127d3f8e72789ba70c3648140f87c6187864e130
---
 drivers/gpu/drm/drm_fb_helper.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_fb_helper.c +0 -0
index 418d299..ca08c47 100644
@@ -345,7 +345,11 @@ static bool restore_fbdev_mode(struct drm_fb_helper *fb_helper)
              struct drm_crtc *crtc = mode_set->crtc;
              int ret;

drivers/gpu/drm/drm_fb_helper.c static bool restore_fbdev_mode(struct drm_fb_helper *fb_helper) · line 355

Quoted 10 lines
drivers/gpu/drm/drm_fb_helper.c +5 -1
 
-             if (crtc->funcs->cursor_set) {
+             if (crtc->funcs->cursor_set2) {
+                     ret = crtc->funcs->cursor_set2(crtc, NULL, 0, 0, 0, 0, 0);
+                     if (ret)
+                             error = true;
+             } else if (crtc->funcs->cursor_set) {
                      ret = crtc->funcs->cursor_set(crtc, NULL, 0, 0, 0);
                      if (ret)
                              error = true;

Hah, nice catch. The series is

Quoted 8 lines
Quoted 5 lines

(I assume you tested with something like killall -9 Xorg and confirming sure the cursor doesn't stay visible in console)

The cursor still stays visible in the console. Interestingly, the cursor still shows up in the console even without these patches.

restore_fbdev_mode doesn't end up get called when I killall -9 X.

Alex

Quoted 2 lines

Alex

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#6 lore raw
Quoted 36 lines · Alex Deucher
Quoted 35 lines · Alex Deucher
Quoted 34 lines · Michel Dänzer
Quoted 18 lines · Alex Deucher

If a driver uses the cursor_set2 crtc callback rather than cursor_set, use that. This fixes the fbdev helper for drivers that use cursor_set2.

Change-Id I127d3f8e72789ba70c3648140f87c6187864e130
---
 drivers/gpu/drm/drm_fb_helper.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_fb_helper.c +0 -0
index 418d299..ca08c47 100644
@@ -345,7 +345,11 @@ static bool restore_fbdev_mode(struct drm_fb_helper *fb_helper)
              struct drm_crtc *crtc = mode_set->crtc;
              int ret;

drivers/gpu/drm/drm_fb_helper.c static bool restore_fbdev_mode(struct drm_fb_helper *fb_helper) · line 355

Quoted 10 lines
drivers/gpu/drm/drm_fb_helper.c +5 -1
 
-             if (crtc->funcs->cursor_set) {
+             if (crtc->funcs->cursor_set2) {
+                     ret = crtc->funcs->cursor_set2(crtc, NULL, 0, 0, 0, 0, 0);
+                     if (ret)
+                             error = true;
+             } else if (crtc->funcs->cursor_set) {
                      ret = crtc->funcs->cursor_set(crtc, NULL, 0, 0, 0);
                      if (ret)
                              error = true;

Hah, nice catch. The series is

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

(I assume you tested with something like killall -9 Xorg and confirming sure the cursor doesn't stay visible in console)

The cursor still stays visible in the console. Interestingly, the cursor still shows up in the console even without these patches.

restore_fbdev_mode doesn't end up get called when I killall -9 X.

For clarity, drm_fb_helper_set_par which which ultimately calls restore_fbdev_mode never gets called.

Alex

Quoted 5 lines

Alex

Quoted 2 lines

Alex

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#7 lore raw
Quoted 41 lines · Alex Deucher
Quoted 40 lines · Alex Deucher
Quoted 39 lines · Alex Deucher
Quoted 37 lines · Michel Dänzer
Quoted 18 lines · Alex Deucher

If a driver uses the cursor_set2 crtc callback rather than cursor_set, use that. This fixes the fbdev helper for drivers that use cursor_set2.

Change-Id I127d3f8e72789ba70c3648140f87c6187864e130
---
 drivers/gpu/drm/drm_fb_helper.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_fb_helper.c +0 -0
index 418d299..ca08c47 100644
@@ -345,7 +345,11 @@ static bool restore_fbdev_mode(struct drm_fb_helper *fb_helper)
              struct drm_crtc *crtc = mode_set->crtc;
              int ret;

drivers/gpu/drm/drm_fb_helper.c static bool restore_fbdev_mode(struct drm_fb_helper *fb_helper) · line 355

Quoted 10 lines
drivers/gpu/drm/drm_fb_helper.c +5 -1
 
-             if (crtc->funcs->cursor_set) {
+             if (crtc->funcs->cursor_set2) {
+                     ret = crtc->funcs->cursor_set2(crtc, NULL, 0, 0, 0, 0, 0);
+                     if (ret)
+                             error = true;
+             } else if (crtc->funcs->cursor_set) {
                      ret = crtc->funcs->cursor_set(crtc, NULL, 0, 0, 0);
                      if (ret)
                              error = true;

Hah, nice catch. The series is

(I assume you tested with something like killall -9 Xorg and confirming sure the cursor doesn't stay visible in console)

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

The cursor still stays visible in the console. Interestingly, the cursor still shows up in the console even without these patches.

restore_fbdev_mode doesn't end up get called when I killall -9 X.

For clarity, drm_fb_helper_set_par which which ultimately calls restore_fbdev_mode never gets called.

You need to force restore the fbdev in your lastclose hook for that to work.
-Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#8 lore raw
In reply to Alex Deucher
Quoted 41 lines · Alex Deucher
Quoted 40 lines · Alex Deucher
Quoted 39 lines · Alex Deucher
Quoted 37 lines · Michel Dänzer
Quoted 18 lines · Alex Deucher

If a driver uses the cursor_set2 crtc callback rather than cursor_set, use that. This fixes the fbdev helper for drivers that use cursor_set2.

Change-Id I127d3f8e72789ba70c3648140f87c6187864e130
---
 drivers/gpu/drm/drm_fb_helper.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_fb_helper.c +0 -0
index 418d299..ca08c47 100644
@@ -345,7 +345,11 @@ static bool restore_fbdev_mode(struct drm_fb_helper *fb_helper)
              struct drm_crtc *crtc = mode_set->crtc;
              int ret;

drivers/gpu/drm/drm_fb_helper.c static bool restore_fbdev_mode(struct drm_fb_helper *fb_helper) · line 355

Quoted 10 lines
drivers/gpu/drm/drm_fb_helper.c +5 -1
 
-             if (crtc->funcs->cursor_set) {
+             if (crtc->funcs->cursor_set2) {
+                     ret = crtc->funcs->cursor_set2(crtc, NULL, 0, 0, 0, 0, 0);
+                     if (ret)
+                             error = true;
+             } else if (crtc->funcs->cursor_set) {
                      ret = crtc->funcs->cursor_set(crtc, NULL, 0, 0, 0);
                      if (ret)
                              error = true;

Hah, nice catch. The series is

(I assume you tested with something like killall -9 Xorg and confirming sure the cursor doesn't stay visible in console)

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

The cursor still stays visible in the console. Interestingly, the cursor still shows up in the console even without these patches.

restore_fbdev_mode doesn't end up get called when I killall -9 X.

For clarity, drm_fb_helper_set_par which which ultimately calls restore_fbdev_mode never gets called.

Hmm, radeon_fb_helper_set_par definitely got hit when I was adding it, but maybe I was only testing with killall -3 or something like that.

Signature · 6 lines
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#9 lore raw
In reply to Alex Deucher

Hi Alex,

Quoted 5 lines · Alex Deucher

If a driver uses the cursor_set2 crtc callback rather than cursor_set, use that. This fixes the fbdev helper for drivers that use cursor_set2.

Change-Id: I127d3f8e72789ba70c3648140f87c6187864e130

Are Change-Id lines accepted in the kernel ? Iirc there was some noise against them a while back.

Thanks
Emil
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#10 lore raw
Quoted 10 lines · Emil Velikov

Hi Alex,

Quoted 5 lines · Alex Deucher

If a driver uses the cursor_set2 crtc callback rather than cursor_set, use that. This fixes the fbdev helper for drivers that use cursor_set2.

Change-Id: I127d3f8e72789ba70c3648140f87c6187864e130

Are Change-Id lines accepted in the kernel ? Iirc there was some noise against them a while back.

Some maintainers reject them, I don't think anyone here in the drm subsystem cares really.
-Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#11 lore raw
In reply to Emil Velikov
Quoted 11 lines

-----Original Message-----
From: Emil Velikov [mailto:[email protected]]
Sent: Thursday, October 01, 2015 7:36 AM
To: Alex Deucher
Cc: ML dri-devel; Deucher, Alexander
Subject: Re: [PATCH 1/2] drm: handle cursor_set2 in restore_fbdev_mode

Hi Alex,

On 30 September 2015 at 19:47, Alex Deucher <[email protected]> wrote:

Quoted 7 lines
Quoted 5 lines

If a driver uses the cursor_set2 crtc callback rather than cursor_set, use that. This fixes the fbdev helper for drivers that use cursor_set2.

Change-Id: I127d3f8e72789ba70c3648140f87c6187864e130

Are Change-Id lines accepted in the kernel ? Iirc there was some noise against them a while back.

It was just a temporary problem with my git client. I've already fixed it locally.

Alex

Quoted 3 lines

Thanks
Emil

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel