Commit 1ed51de9 authored by Daniel Vetter's avatar Daniel Vetter

drm/i915: Clarify logic for initial modeset

Currently we both set mode->private_flags to some value and also use
the pipe_config quirk. But since the pipe_config quirk isn't tied to
the lifetime of the mode object we need to check both.

Simplify this by only using mode.private_flags and stop using the
INHERITED_MODE quirk. Also for clarity add an explicit #define for
that driver priavete mode flag.

By using crtc_state->mode_changed we can also remove the recalc local
variable.

Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@intel.com>
Reviewed-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent e2ff2d4a
...@@ -13161,7 +13161,11 @@ static int intel_atomic_check(struct drm_device *dev, ...@@ -13161,7 +13161,11 @@ static int intel_atomic_check(struct drm_device *dev,
for_each_crtc_in_state(state, crtc, crtc_state, i) { for_each_crtc_in_state(state, crtc, crtc_state, i) {
struct intel_crtc_state *pipe_config = struct intel_crtc_state *pipe_config =
to_intel_crtc_state(crtc_state); to_intel_crtc_state(crtc_state);
bool modeset, recalc = false; bool modeset;
/* Catch I915_MODE_FLAG_INHERITED */
if (crtc_state->mode.private_flags != crtc->state->mode.private_flags)
crtc_state->mode_changed = true;
if (!crtc_state->enable) { if (!crtc_state->enable) {
if (needs_modeset(crtc_state)) if (needs_modeset(crtc_state))
...@@ -13170,28 +13174,22 @@ static int intel_atomic_check(struct drm_device *dev, ...@@ -13170,28 +13174,22 @@ static int intel_atomic_check(struct drm_device *dev,
} }
modeset = needs_modeset(crtc_state); modeset = needs_modeset(crtc_state);
/* see comment in intel_modeset_readout_hw_state */
if (!modeset && crtc_state->mode_blob != crtc->state->mode_blob &&
pipe_config->quirks & PIPE_CONFIG_QUIRK_INHERITED_MODE)
recalc = true;
if (!modeset && !recalc) if (!modeset)
continue; continue;
if (recalc) {
ret = drm_atomic_add_affected_connectors(state, crtc); ret = drm_atomic_add_affected_connectors(state, crtc);
if (ret) if (ret)
return ret; return ret;
}
ret = intel_modeset_pipe_config(crtc, pipe_config); ret = intel_modeset_pipe_config(crtc, pipe_config);
if (ret) if (ret)
return ret; return ret;
if (recalc && (!i915.fastboot || if (!i915.fastboot ||
!intel_pipe_config_compare(state->dev, !intel_pipe_config_compare(state->dev,
to_intel_crtc_state(crtc->state), to_intel_crtc_state(crtc->state),
pipe_config, true))) { pipe_config, true)) {
modeset = crtc_state->mode_changed = true; modeset = crtc_state->mode_changed = true;
ret = drm_atomic_add_affected_planes(state, crtc); ret = drm_atomic_add_affected_planes(state, crtc);
...@@ -15238,8 +15236,6 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev) ...@@ -15238,8 +15236,6 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev)
memset(crtc->config, 0, sizeof(*crtc->config)); memset(crtc->config, 0, sizeof(*crtc->config));
crtc->config->base.crtc = &crtc->base; crtc->config->base.crtc = &crtc->base;
crtc->config->quirks |= PIPE_CONFIG_QUIRK_INHERITED_MODE;
crtc->active = dev_priv->display.get_pipe_config(crtc, crtc->active = dev_priv->display.get_pipe_config(crtc,
crtc->config); crtc->config);
...@@ -15265,17 +15261,11 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev) ...@@ -15265,17 +15261,11 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev)
* right now it would cause a double modeset if * right now it would cause a double modeset if
* fbdev or userspace chooses a different initial mode. * fbdev or userspace chooses a different initial mode.
* *
* So to prevent the double modeset, fail the memcmp
* test in drm_atomic_set_mode_for_crtc to get a new
* mode blob, and compare if the mode blob changed
* when the PIPE_CONFIG_QUIRK_INHERITED_MODE quirk is
* set.
*
* If that happens, someone indicated they wanted a * If that happens, someone indicated they wanted a
* mode change, which means it's safe to do a full * mode change, which means it's safe to do a full
* recalculation. * recalculation.
*/ */
crtc->base.state->mode.private_flags = ~0; crtc->base.state->mode.private_flags = I915_MODE_FLAG_INHERITED;
} }
crtc->base.hwmode = crtc->config->base.adjusted_mode; crtc->base.hwmode = crtc->config->base.adjusted_mode;
......
...@@ -317,6 +317,9 @@ struct intel_crtc_scaler_state { ...@@ -317,6 +317,9 @@ struct intel_crtc_scaler_state {
int scaler_id; int scaler_id;
}; };
/* drm_mode->private_flags */
#define I915_MODE_FLAG_INHERITED 1
struct intel_crtc_state { struct intel_crtc_state {
struct drm_crtc_state base; struct drm_crtc_state base;
...@@ -329,7 +332,6 @@ struct intel_crtc_state { ...@@ -329,7 +332,6 @@ struct intel_crtc_state {
* accordingly. * accordingly.
*/ */
#define PIPE_CONFIG_QUIRK_MODE_SYNC_FLAGS (1<<0) /* unreliable sync mode.flags */ #define PIPE_CONFIG_QUIRK_MODE_SYNC_FLAGS (1<<0) /* unreliable sync mode.flags */
#define PIPE_CONFIG_QUIRK_INHERITED_MODE (1<<1) /* mode inherited from firmware */
unsigned long quirks; unsigned long quirks;
/* Pipe source size (ie. panel fitter input size) /* Pipe source size (ie. panel fitter input size)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment