[Intel-gfx] [PATCH 22/35] drm/i915: Don't use struct intel_set_config *_changed flags

Ander Conselvan de Oliveira ander.conselvan.de.oliveira at intel.com
Tue Apr 21 07:13:11 PDT 2015


Use the similar fields in crtc_state instead, so that this code can be
moved to our future implementation of atomic_check().

Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira at intel.com>
---
 drivers/gpu/drm/i915/intel_display.c | 66 +++++++++++++++++++-----------------
 1 file changed, 34 insertions(+), 32 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 08694f8..8caddc5 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -12138,6 +12138,18 @@ intel_modeset_compute_config(struct drm_crtc *crtc,
 	if (ret)
 		return ERR_PTR(ret);
 
+	/* Check things that can only be changed through modeset */
+	if (pipe_config->has_audio !=
+	    to_intel_crtc(crtc)->config->has_audio)
+		pipe_config->base.mode_changed = true;
+
+	/*
+	 * Note we have an issue here with infoframes: current code
+	 * only updates them on the full mode set path per hw
+	 * requirements.  So here we should be checking for any
+	 * required changes and forcing a mode set.
+	 */
+
 	intel_dump_pipe_config(to_intel_crtc(crtc), pipe_config,"[modeset]");
 
 	return pipe_config;
@@ -12536,7 +12548,7 @@ is_crtc_connector_off(struct drm_mode_set *set)
 
 static void
 intel_set_config_compute_mode_changes(struct drm_mode_set *set,
-				      struct intel_set_config *config)
+				      struct intel_crtc_state *pipe_config)
 {
 	struct drm_device *dev = set->crtc->dev;
 	struct intel_connector *connector;
@@ -12546,7 +12558,7 @@ intel_set_config_compute_mode_changes(struct drm_mode_set *set,
 	/* We should be able to check here if the fb has the same properties
 	 * and then just flip_or_move it */
 	if (is_crtc_connector_off(set)) {
-		config->mode_changed = true;
+		pipe_config->base.mode_changed = true;
 	} else if (set->crtc->primary->fb != set->fb) {
 		/*
 		 * If we have no fb, we can only flip as long as the crtc is
@@ -12560,36 +12572,36 @@ intel_set_config_compute_mode_changes(struct drm_mode_set *set,
 
 			if (intel_crtc->active) {
 				DRM_DEBUG_KMS("crtc has no fb, will flip\n");
-				config->fb_changed = true;
+				pipe_config->base.planes_changed = true;
 			} else {
 				DRM_DEBUG_KMS("inactive crtc, full mode set\n");
-				config->mode_changed = true;
+				pipe_config->base.mode_changed = true;
 			}
 		} else if (set->fb == NULL) {
-			config->mode_changed = true;
+			pipe_config->base.mode_changed = true;
 		} else if (set->fb->pixel_format !=
 			   set->crtc->primary->fb->pixel_format) {
-			config->mode_changed = true;
+			pipe_config->base.mode_changed = true;
 		} else {
-			config->fb_changed = true;
+			pipe_config->base.planes_changed = true;
 		}
 	}
 
 	if (set->fb && (set->x != set->crtc->x || set->y != set->crtc->y))
-		config->fb_changed = true;
+		pipe_config->base.planes_changed = true;
 
 	if (set->mode && !drm_mode_equal(set->mode, &set->crtc->mode)) {
 		DRM_DEBUG_KMS("modes are different, full mode set\n");
 		drm_mode_debug_printmodeline(&set->crtc->mode);
 		drm_mode_debug_printmodeline(set->mode);
-		config->mode_changed = true;
+		pipe_config->base.mode_changed = true;
 	}
 
 	for_each_intel_connector(dev, connector) {
 		if (&connector->new_encoder->base == connector->base.encoder)
 			continue;
 
-		config->mode_changed = true;
+		pipe_config->base.mode_changed = true;
 		DRM_DEBUG_KMS("[CONNECTOR:%d:%s] encoder changed, full mode switch\n",
 			      connector->base.base.id,
 			      connector->base.name);
@@ -12602,7 +12614,7 @@ intel_set_config_compute_mode_changes(struct drm_mode_set *set,
 		DRM_DEBUG_KMS("[ENCODER:%d:%s] crtc changed, full mode switch\n",
 			      encoder->base.base.id,
 			      encoder->base.name);
-		config->mode_changed = true;
+		pipe_config->base.mode_changed = true;
 	}
 
 	for_each_intel_crtc(dev, crtc) {
@@ -12612,11 +12624,12 @@ intel_set_config_compute_mode_changes(struct drm_mode_set *set,
 		DRM_DEBUG_KMS("[CRTC:%d] %sabled, full mode switch\n",
 			      crtc->base.base.id,
 			      crtc->new_enabled ? "en" : "dis");
-		config->mode_changed = true;
+		pipe_config->base.mode_changed = true;
 	}
 
 	DRM_DEBUG_KMS("computed changes for [CRTC:%d], mode_changed=%d, fb_changed=%d\n",
-			set->crtc->base.id, config->mode_changed, config->fb_changed);
+			set->crtc->base.id, pipe_config->base.mode_changed,
+			pipe_config->base.planes_changed);
 }
 
 static int
@@ -12800,36 +12813,25 @@ static int intel_crtc_set_config(struct drm_mode_set *set)
 	if (ret)
 		goto fail;
 
-	/* Compute whether we need a full modeset, only an fb base update or no
-	 * change at all. In the future we might also check whether only the
-	 * mode changed, e.g. for LVDS where we only change the panel fitter in
-	 * such cases. */
-	intel_set_config_compute_mode_changes(set, config);
-
 	pipe_config = intel_modeset_compute_config(set->crtc, set->mode,
 						   state);
 	if (IS_ERR(pipe_config)) {
 		ret = PTR_ERR(pipe_config);
 		goto fail;
-	} else if (pipe_config) {
-		if (pipe_config->has_audio !=
-		    to_intel_crtc(set->crtc)->config->has_audio)
-			config->mode_changed = true;
-
-		/*
-		 * Note we have an issue here with infoframes: current code
-		 * only updates them on the full mode set path per hw
-		 * requirements.  So here we should be checking for any
-		 * required changes and forcing a mode set.
-		 */
 	}
 
+	/* Compute whether we need a full modeset, only an fb base update or no
+	 * change at all. In the future we might also check whether only the
+	 * mode changed, e.g. for LVDS where we only change the panel fitter in
+	 * such cases. */
+	intel_set_config_compute_mode_changes(set, pipe_config);
+
 	intel_update_pipe_size(to_intel_crtc(set->crtc));
 
-	if (config->mode_changed) {
+	if (pipe_config->base.mode_changed) {
 		ret = intel_set_mode_with_config(set->crtc, set->mode,
 						 pipe_config);
-	} else if (config->fb_changed) {
+	} else if (pipe_config->base.planes_changed) {
 		struct intel_crtc *intel_crtc = to_intel_crtc(set->crtc);
 		struct drm_plane *primary = set->crtc->primary;
 		struct intel_plane_state *plane_state =
-- 
2.1.0



More information about the Intel-gfx mailing list