drm/fb-helper: Disable cursors and planes when restoring fbdev mode
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Mon, 3 Jun 2013 13:10:42 +0000 (16:10 +0300)
committerDave Airlie <airlied@gmail.com>
Mon, 17 Jun 2013 08:33:16 +0000 (18:33 +1000)
Cursors and plane can obscure whatever fbdev wants to show the user.
Disable them all in drm_fb_helper_restore_fbdev_mode.

After the cursors and planes have been disabled, user space needs to
explicitly re-enable them to make them visible again.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@gmail.com>
drivers/gpu/drm/drm_fb_helper.c

index b78cbe74dadfaa3b99a9e0a5781c89eec159dc46..78219752dd0e989a64f155514ad5c2a71c2bf59c 100644 (file)
@@ -284,13 +284,27 @@ EXPORT_SYMBOL(drm_fb_helper_debug_leave);
  */
 bool drm_fb_helper_restore_fbdev_mode(struct drm_fb_helper *fb_helper)
 {
+       struct drm_device *dev = fb_helper->dev;
+       struct drm_plane *plane;
        bool error = false;
-       int i, ret;
+       int i;
+
+       drm_warn_on_modeset_not_all_locked(dev);
 
-       drm_warn_on_modeset_not_all_locked(fb_helper->dev);
+       list_for_each_entry(plane, &dev->mode_config.plane_list, head)
+               drm_plane_force_disable(plane);
 
        for (i = 0; i < fb_helper->crtc_count; i++) {
                struct drm_mode_set *mode_set = &fb_helper->crtc_info[i].mode_set;
+               struct drm_crtc *crtc = mode_set->crtc;
+               int ret;
+
+               if (crtc->funcs->cursor_set) {
+                       ret = crtc->funcs->cursor_set(crtc, NULL, 0, 0, 0);
+                       if (ret)
+                               error = true;
+               }
+
                ret = drm_mode_set_config_internal(mode_set);
                if (ret)
                        error = true;