drm: Add drm_plane_force_disable()
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Mon, 3 Jun 2013 13:10:40 +0000 (16:10 +0300)
committerDave Airlie <airlied@gmail.com>
Mon, 17 Jun 2013 08:32:54 +0000 (18:32 +1000)
drm_plane_force_disable() will forcibly disable the plane even if user
had previously requested the plane to be enabled.

This can be used to force planes to be off when restoring the fbdev
mode.

The code was simply pulled from drm_framebuffer_remove(), which now
calls the new function as well.

v2: Check plane->fb in drm_plane_force_disable(), drop bogus comment
    about disabling crtc

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Dave Airlie <airlied@gmail.com>
drivers/gpu/drm/drm_crtc.c
include/drm/drm_crtc.h

index baee5752ca6bde3349fc8c40e1725711e48e657c..c8042a1c83b85ee7975673d7e1572a12b5e61ab1 100644 (file)
@@ -592,16 +592,8 @@ void drm_framebuffer_remove(struct drm_framebuffer *fb)
                }
 
                list_for_each_entry(plane, &dev->mode_config.plane_list, head) {
-                       if (plane->fb == fb) {
-                               /* should turn off the crtc */
-                               ret = plane->funcs->disable_plane(plane);
-                               if (ret)
-                                       DRM_ERROR("failed to disable plane with busy fb\n");
-                               /* disconnect the plane from the fb and crtc: */
-                               __drm_framebuffer_unreference(plane->fb);
-                               plane->fb = NULL;
-                               plane->crtc = NULL;
-                       }
+                       if (plane->fb == fb)
+                               drm_plane_force_disable(plane);
                }
                drm_modeset_unlock_all(dev);
        }
@@ -891,6 +883,23 @@ void drm_plane_cleanup(struct drm_plane *plane)
 }
 EXPORT_SYMBOL(drm_plane_cleanup);
 
+void drm_plane_force_disable(struct drm_plane *plane)
+{
+       int ret;
+
+       if (!plane->fb)
+               return;
+
+       ret = plane->funcs->disable_plane(plane);
+       if (ret)
+               DRM_ERROR("failed to disable plane with busy fb\n");
+       /* disconnect the plane from the fb and crtc: */
+       __drm_framebuffer_unreference(plane->fb);
+       plane->fb = NULL;
+       plane->crtc = NULL;
+}
+EXPORT_SYMBOL(drm_plane_force_disable);
+
 /**
  * drm_mode_create - create a new display mode
  * @dev: DRM device
index 53c33e28a2f7a5da71f0015d7a7048b9d626f54e..da137e732ac22dcd13876b3fb3b0bfa7fa8bc55c 100644 (file)
@@ -894,6 +894,7 @@ extern int drm_plane_init(struct drm_device *dev,
                          const uint32_t *formats, uint32_t format_count,
                          bool priv);
 extern void drm_plane_cleanup(struct drm_plane *plane);
+extern void drm_plane_force_disable(struct drm_plane *plane);
 
 extern void drm_encoder_cleanup(struct drm_encoder *encoder);