[PATCH 53/81] drm/i915: Update connector DPMS state after an atomic modeset

ville.syrjala at linux.intel.com ville.syrjala at linux.intel.com
Wed Dec 12 08:16:20 PST 2012


From: Ville Syrjälä <ville.syrjala at linux.intel.com>

Update the connector DPMS state after atomic modeset operations.

Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
---
 drivers/gpu/drm/i915/intel_atomic.c |   31 +++++++++++++++++++++++++++++++
 1 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_atomic.c b/drivers/gpu/drm/i915/intel_atomic.c
index c5558cc..1fce359 100644
--- a/drivers/gpu/drm/i915/intel_atomic.c
+++ b/drivers/gpu/drm/i915/intel_atomic.c
@@ -1475,6 +1475,36 @@ static void update_props(struct drm_device *dev,
 	}
 }
 
+/*
+ * FIXME
+ * Perhaps atomic modeset shouldn't actually change the DPMS state,
+ * unless explicitly asked to do so. That's the way we treat everything
+ * else, so it makes sense. Although the dpms property is already a bit
+ * special in the legacy codepaths, so maybe we should follow the same
+ * pattern. Ie. a modeset forces DPMS to on (which is what we do here).
+ */
+static void update_connector_dpms(struct drm_device *dev, struct drm_crtc *crtc)
+{
+	struct drm_connector *connector;
+
+	list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
+		int dpms = connector->dpms;
+
+		if (connector->encoder && connector->encoder->crtc == crtc)
+			dpms = DRM_MODE_DPMS_ON;
+		else if (!connector->encoder || !connector->encoder->crtc)
+			dpms = DRM_MODE_DPMS_OFF;
+
+		if (connector->dpms == dpms)
+			continue;
+
+		connector->dpms = dpms;
+		drm_connector_property_set_value(connector,
+						 dev->mode_config.dpms_property,
+						 dpms);
+	}
+}
+
 static void update_crtc(struct drm_device *dev,
 			struct intel_atomic_state *s)
 {
@@ -1494,6 +1524,7 @@ static void update_crtc(struct drm_device *dev,
 		if (st->mode_dirty) {
 			drm_calc_timestamping_constants(crtc);
 			intel_crtc_update_sarea(crtc, crtc->enabled);
+			update_connector_dpms(dev, crtc);
 		}
 
 		if (st->fb_dirty)
-- 
1.7.8.6



More information about the dri-devel mailing list