diff mbox

drm/i915: Enable fastset by default, except on initial modeset

Message ID 20180516103821.53661-1-maarten.lankhorst@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Maarten Lankhorst May 16, 2018, 10:38 a.m. UTC
We may not be perfect at reading out the initial mode, but when the mode
is sanitized by our first modeset we know for sure the state is compatible,
so we can compare with intel_pipe_config_compare.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_display.c | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index e6babd9ae07a..9985236b488b 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -12179,6 +12179,22 @@  static int calc_watermark_data(struct drm_atomic_state *state)
 	return 0;
 }
 
+static bool can_fastset(struct drm_i915_private *dev_priv,
+			struct intel_crtc_state *old_crtc_state,
+			struct intel_crtc_state *new_crtc_state)
+{
+	bool reset_mode =
+		old_crtc_state->base.mode.private_flags &&
+		!new_crtc_state->base.mode.private_flags;
+
+	/* Without fastboot, we always want to modeset the initial mode. */
+	if (reset_mode && !i915_modparams.fastboot)
+		return false;
+
+	return intel_pipe_config_compare(dev_priv, old_crtc_state,
+					 new_crtc_state, true);
+}
+
 /**
  * intel_atomic_check - validate state object
  * @dev: drm device
@@ -12209,6 +12225,8 @@  static int intel_atomic_check(struct drm_device *dev,
 	for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, crtc_state, i) {
 		struct intel_crtc_state *pipe_config =
 			to_intel_crtc_state(crtc_state);
+		struct intel_crtc_state *old_intel_crtc_state =
+			to_intel_crtc_state(old_crtc_state);
 
 		if (!needs_modeset(crtc_state))
 			continue;
@@ -12225,10 +12243,7 @@  static int intel_atomic_check(struct drm_device *dev,
 			return ret;
 		}
 
-		if (i915_modparams.fastboot &&
-		    intel_pipe_config_compare(dev_priv,
-					to_intel_crtc_state(old_crtc_state),
-					pipe_config, true)) {
+		if (can_fastset(dev_priv, old_intel_crtc_state, pipe_config)) {
 			crtc_state->mode_changed = false;
 			pipe_config->update_pipe = true;
 		}