Commit 02e93c35 authored by Ville Syrjälä's avatar Ville Syrjälä Committed by Daniel Vetter

drm/i915: Factor out intel_crtc_has_encoders()

Make the code mode readable by pulling the "does this crtc have any
encoders?" deduction into a separate function.

Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: default avatarJani Nikula <jani.nikula@intel.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 0f64614d
...@@ -14807,13 +14807,22 @@ intel_check_plane_mapping(struct intel_crtc *crtc) ...@@ -14807,13 +14807,22 @@ intel_check_plane_mapping(struct intel_crtc *crtc)
return true; return true;
} }
static bool intel_crtc_has_encoders(struct intel_crtc *crtc)
{
struct drm_device *dev = crtc->base.dev;
struct intel_encoder *encoder;
for_each_encoder_on_crtc(dev, &crtc->base, encoder)
return true;
return false;
}
static void intel_sanitize_crtc(struct intel_crtc *crtc) static void intel_sanitize_crtc(struct intel_crtc *crtc)
{ {
struct drm_device *dev = crtc->base.dev; struct drm_device *dev = crtc->base.dev;
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_encoder *encoder;
u32 reg; u32 reg;
bool enable;
/* Clear any frame start delays used for debugging left by the BIOS */ /* Clear any frame start delays used for debugging left by the BIOS */
reg = PIPECONF(crtc->config->cpu_transcoder); reg = PIPECONF(crtc->config->cpu_transcoder);
...@@ -14857,16 +14866,11 @@ static void intel_sanitize_crtc(struct intel_crtc *crtc) ...@@ -14857,16 +14866,11 @@ static void intel_sanitize_crtc(struct intel_crtc *crtc)
/* Adjust the state of the output pipe according to whether we /* Adjust the state of the output pipe according to whether we
* have active connectors/encoders. */ * have active connectors/encoders. */
enable = false; if (!intel_crtc_has_encoders(crtc))
for_each_encoder_on_crtc(dev, &crtc->base, encoder) {
enable = true;
break;
}
if (!enable)
intel_crtc_disable_noatomic(&crtc->base); intel_crtc_disable_noatomic(&crtc->base);
if (crtc->active != crtc->base.state->active) { if (crtc->active != crtc->base.state->active) {
struct intel_encoder *encoder;
/* This can happen either due to bugs in the get_hw_state /* This can happen either due to bugs in the get_hw_state
* functions or because of calls to intel_crtc_disable_noatomic, * functions or because of calls to intel_crtc_disable_noatomic,
......
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