aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVille Syrjälä <ville.syrjala@linux.intel.com>2013-06-03 09:10:40 -0400
committerDave Airlie <airlied@gmail.com>2013-06-17 04:32:54 -0400
commit9125e6186822b2698da17690416cd1b55c030115 (patch)
tree33c993cb831125d9c59dda1b011737cfb2be54ef
parente6e792092e816bea0797995c886fb057c91d4546 (diff)
drm: Add drm_plane_force_disable()
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>
-rw-r--r--drivers/gpu/drm/drm_crtc.c29
-rw-r--r--include/drm/drm_crtc.h1
2 files changed, 20 insertions, 10 deletions
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index baee5752ca6b..c8042a1c83b8 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -592,16 +592,8 @@ void drm_framebuffer_remove(struct drm_framebuffer *fb)
592 } 592 }
593 593
594 list_for_each_entry(plane, &dev->mode_config.plane_list, head) { 594 list_for_each_entry(plane, &dev->mode_config.plane_list, head) {
595 if (plane->fb == fb) { 595 if (plane->fb == fb)
596 /* should turn off the crtc */ 596 drm_plane_force_disable(plane);
597 ret = plane->funcs->disable_plane(plane);
598 if (ret)
599 DRM_ERROR("failed to disable plane with busy fb\n");
600 /* disconnect the plane from the fb and crtc: */
601 __drm_framebuffer_unreference(plane->fb);
602 plane->fb = NULL;
603 plane->crtc = NULL;
604 }
605 } 597 }
606 drm_modeset_unlock_all(dev); 598 drm_modeset_unlock_all(dev);
607 } 599 }
@@ -891,6 +883,23 @@ void drm_plane_cleanup(struct drm_plane *plane)
891} 883}
892EXPORT_SYMBOL(drm_plane_cleanup); 884EXPORT_SYMBOL(drm_plane_cleanup);
893 885
886void drm_plane_force_disable(struct drm_plane *plane)
887{
888 int ret;
889
890 if (!plane->fb)
891 return;
892
893 ret = plane->funcs->disable_plane(plane);
894 if (ret)
895 DRM_ERROR("failed to disable plane with busy fb\n");
896 /* disconnect the plane from the fb and crtc: */
897 __drm_framebuffer_unreference(plane->fb);
898 plane->fb = NULL;
899 plane->crtc = NULL;
900}
901EXPORT_SYMBOL(drm_plane_force_disable);
902
894/** 903/**
895 * drm_mode_create - create a new display mode 904 * drm_mode_create - create a new display mode
896 * @dev: DRM device 905 * @dev: DRM device
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 53c33e28a2f7..da137e732ac2 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -894,6 +894,7 @@ extern int drm_plane_init(struct drm_device *dev,
894 const uint32_t *formats, uint32_t format_count, 894 const uint32_t *formats, uint32_t format_count,
895 bool priv); 895 bool priv);
896extern void drm_plane_cleanup(struct drm_plane *plane); 896extern void drm_plane_cleanup(struct drm_plane *plane);
897extern void drm_plane_force_disable(struct drm_plane *plane);
897 898
898extern void drm_encoder_cleanup(struct drm_encoder *encoder); 899extern void drm_encoder_cleanup(struct drm_encoder *encoder);
899 900