From: Zhao Yakui <yakui.z...@intel.com>

Disable all the possible outputs/crtcs before entering KMS mode.

Signed-off-by: Zhao Yakui <yakui.z...@intel.com>
---
 drivers/gpu/drm/drm_crtc_helper.c |   32 ++++++++++++++++++++++++++++++++
 include/drm/drm_crtc_helper.h     |    2 ++
 2 files changed, 34 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/drm_crtc_helper.c 
b/drivers/gpu/drm/drm_crtc_helper.c
index 3963b3c..b49028f 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -1020,6 +1020,9 @@ bool drm_helper_initial_config(struct drm_device *dev)
 {
        int count = 0;
 
+       /* Disable all the possible outputs/crtc before entering KMS mode */
+       drm_helper_disable_connector_crtc(dev);
+
        drm_fb_helper_parse_command_line(dev);
 
        count = drm_helper_probe_connector_modes(dev,
@@ -1067,6 +1070,35 @@ static int drm_helper_choose_crtc_dpms(struct drm_crtc 
*crtc)
 }
 
 /**
+ * drm_helper_disable_connector_crtc
+ * @dev: drm_device
+ *
+ * Disable all the possible outputs & Crtcs
+ */
+void drm_helper_disable_connector_crtc(struct drm_device *dev)
+{
+       struct drm_encoder *encoder;
+       struct drm_crtc *crtc;
+
+       list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) {
+               struct drm_encoder_helper_funcs *encoder_funcs =
+                                               encoder->helper_private;
+               if (encoder_funcs && encoder_funcs->dpms)
+                       (*encoder_funcs->dpms)(encoder, DRM_MODE_DPMS_OFF);
+       }
+
+       list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
+               struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private;
+               if (crtc_funcs && crtc_funcs->dpms)
+                       (*crtc_funcs->dpms)(crtc, DRM_MODE_DPMS_OFF);
+       }
+
+       return;
+}
+
+EXPORT_SYMBOL(drm_helper_disable_connector_crtc);
+
+/**
  * drm_helper_connector_dpms
  * @connector affected connector
  * @mode DPMS mode
diff --git a/include/drm/drm_crtc_helper.h b/include/drm/drm_crtc_helper.h
index b29e201..007bbba 100644
--- a/include/drm/drm_crtc_helper.h
+++ b/include/drm/drm_crtc_helper.h
@@ -131,4 +131,6 @@ static inline int drm_connector_helper_add(struct 
drm_connector *connector,
 }
 
 extern int drm_helper_resume_force_mode(struct drm_device *dev);
+/* disable all the possible outputs & crtcs for one drm_device */
+extern void drm_helper_disable_connector_crtc(struct drm_device *dev);
 #endif
-- 
1.5.4.5


------------------------------------------------------------------------------
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing. 
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev
--
_______________________________________________
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel

Reply via email to