From: Michel Dänzer <michel.daen...@amd.com>

Since we are now preserving the cursor across modesets, the cursor could
be left over in console if e.g. X crashed.

Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
 drivers/gpu/drm/radeon/radeon_fb.c | 29 ++++++++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/radeon/radeon_fb.c 
b/drivers/gpu/drm/radeon/radeon_fb.c
index 0ea1db8..311886b 100644
--- a/drivers/gpu/drm/radeon/radeon_fb.c
+++ b/drivers/gpu/drm/radeon/radeon_fb.c
@@ -48,10 +48,37 @@ 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);
+
+       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 = drm_fb_helper_set_par,
+       .fb_set_par = radeon_fb_helper_set_par,
        .fb_fillrect = cfb_fillrect,
        .fb_copyarea = cfb_copyarea,
        .fb_imageblit = cfb_imageblit,
-- 
2.1.3

Reply via email to