drm/i915: Assign hwmode after encoder state readout
Subsystems (2)
PATCH 1/2 drm/i915: Assign hwmode after encoder state readout
From: Ville Syrjälä <[email protected]>
The dotclock is often calculated in encoder .get_config(), so we shouldn't copy the adjusted_mode to hwmode until we have read out the dotclock.
Gets rid of some warnings like these:
[drm:drm_calc_timestamping_constants [drm]] *ERROR* crtc 21: Can't calculate constants, dotclock = 0! [drm:i915_get_vblank_timestamp] crtc 0 is disabled
--- drivers/gpu/drm/i915/intel_display.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +4 -1
@@ -15119,7 +15119,6 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev) crtc->base.state->mode.private_flags =I915_MODE_FLAG_INHERITED ; } - crtc->base.hwmode = crtc->config->base.adjusted_mode;readout_plane_state (crtc,to_intel_crtc_state (crtc->base.state)); DRM_DEBUG_KMS("[CRTC:%d] hw state readout: %s\n",
@@ -15179,6 +15178,10 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev) connector->base.name, connector->base.encoder ? "enabled" : "disabled"); } + +for_each_intel_crtc (dev, crtc) { + crtc->base.hwmode = crtc->config->base.adjusted_mode; + } }/* Scan out the current hw modeset state,
Signature · 6 lines
2.4.6 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/2 drm/i915: Fix clock readout when pipes are enabld w/o ports
From: Ville Syrjälä <[email protected]>
The BIOS sometimes likes to enable pipes w/o any ports, at least on older machines. Currently we fail to assign anything sensible to crtc->hwmode.crtc_clock which leads to complaints from the vblank code. Deal with active pipes w/o ports and assign something sensible to crtc_clock.
Gets rid of rest of these on my gen4:
[drm:drm_calc_timestamping_constants [drm]] *ERROR* crtc 24: Can't calculate constants, dotclock = 0! [drm:i915_get_vblank_timestamp] crtc 1 is disabled
--- drivers/gpu/drm/i915/intel_display.c | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/intel_display.c +22 -9
@@ -14857,13 +14857,22 @@ intel_check_plane_mapping(struct intel_crtc *crtc)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) {struct drm_device *dev = crtc->base.dev;struct drm_i915_private *dev_priv = dev->dev_private; -struct intel_encoder *encoder;u32 reg; -bool enable;/* Clear any frame start delays used for debugging left by the BIOS */ reg =PIPECONF (crtc->config->cpu_transcoder);
@@ -14907,16 +14916,11 @@ static void intel_sanitize_crtc(struct intel_crtc *crtc)/* Adjust the state of the output pipe according to whether we * have active connectors/encoders. */ - enable = false; -for_each_encoder_on_crtc (dev, &crtc->base, encoder) { - enable = true; -break ; - } - -if (!enable) +if (!intel_crtc_has_encoders (crtc))intel_crtc_disable_noatomic (&crtc->base);if (crtc->active != crtc->base.state->active) { +struct intel_encoder *encoder;/* This can happen either due to bugs in the get_hw_state * functions or because of calls to intel_crtc_disable_noatomic,
@@ -15180,6 +15184,15 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev) }for_each_intel_crtc (dev, crtc) { +/* in case the pipe is active w/o any ports */ +if (crtc->active && !intel_crtc_has_encoders (crtc)) { + crtc->config->base.adjusted_mode.crtc_clock = + crtc->config->port_clock; +if (crtc->config->pixel_multiplier) + crtc->config->base.adjusted_mode.crtc_clock /= + crtc->config->pixel_multiplier; + } + crtc->base.hwmode = crtc->config->base.adjusted_mode; } }
Signature · 6 lines
2.4.6 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 2/2 drm/i915: Fix clock readout when pipes are enabled w/o ports
From: Ville Syrjälä <[email protected]>
The BIOS sometimes likes to enable pipes w/o any ports, at least on older machines. Currently we fail to assign anything sensible to crtc->hwmode.crtc_clock which leads to complaints from the vblank code. Deal with active pipes w/o ports and assign something sensible to crtc_clock in i9xx_get_pipe_config(). The encoder .get_config() will override this if the port is enabled.
Gets rid of rest of these on my gen4:
[drm:drm_calc_timestamping_constants [drm]] *ERROR* crtc 24: Can't calculate constants, dotclock = 0! [drm:i915_get_vblank_timestamp] crtc 1 is disabled
v2: Fill out crtc_clock already in i9xx_get_pipe_config() (Maarten)
--- drivers/gpu/drm/i915/intel_display.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/gpu/drm/i915/intel_display.c +8 -0
@@ -8107,6 +8107,14 @@ static bool i9xx_get_pipe_config(struct intel_crtc *crtc,else i9xx_crtc_clock_get (crtc, pipe_config); +/* +* Normally the dotclock is filled in by the encoder .get_config() +* but in case the pipe is enabled w/o any ports we need a sane +* default. +*/ + pipe_config->base.adjusted_mode.crtc_clock = + pipe_config->port_clock / pipe_config->pixel_multiplier; +return true; }
Signature · 6 lines
2.4.6 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
[PATCH 3/2] drm/i915: Factor out intel_crtc_has_encoders()
From: Ville Syrjälä <[email protected]>
Make the code mode readable by pulling the "does this crtc have any encoders?" deduction into a separate function.
--- drivers/gpu/drm/i915/intel_display.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/intel_display.c +13 -9
@@ -14855,13 +14855,22 @@ intel_check_plane_mapping(struct intel_crtc *crtc)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) {struct drm_device *dev = crtc->base.dev;struct drm_i915_private *dev_priv = dev->dev_private; -struct intel_encoder *encoder;u32 reg; -bool enable;/* Clear any frame start delays used for debugging left by the BIOS */ reg =PIPECONF (crtc->config->cpu_transcoder);
@@ -14905,16 +14914,11 @@ static void intel_sanitize_crtc(struct intel_crtc *crtc)/* Adjust the state of the output pipe according to whether we * have active connectors/encoders. */ - enable = false; -for_each_encoder_on_crtc (dev, &crtc->base, encoder) { - enable = true; -break ; - } - -if (!enable) +if (!intel_crtc_has_encoders (crtc))intel_crtc_disable_noatomic (&crtc->base);if (crtc->active != crtc->base.state->active) { +struct intel_encoder *encoder;/* This can happen either due to bugs in the get_hw_state * functions or because of calls to intel_crtc_disable_noatomic,
Signature · 6 lines
2.4.6 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 3/2] drm/i915: Factor out intel_crtc_has_encoders()
Quoted 7 lines · On Wed, 26 Aug 2015, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
Make the code mode readable by pulling the "does this crtc have any encoders?" deduction into a separate function.
Cc Maarten Lankhorst <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>
Quoted 59 lines
--- drivers/gpu/drm/i915/intel_display.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-)drivers/gpu/drm/i915/intel_display.c +13
-9@@ -14855,13 +14855,22 @@ intel_check_plane_mapping(struct intel_crtc *crtc)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) {struct drm_device *dev = crtc->base.dev;struct drm_i915_private *dev_priv = dev->dev_private; -struct intel_encoder *encoder;u32 reg; -bool enable;/* Clear any frame start delays used for debugging left by the BIOS */ reg =PIPECONF (crtc->config->cpu_transcoder);@@ -14905,16 +14914,11 @@ static void intel_sanitize_crtc(struct intel_crtc *crtc)/* Adjust the state of the output pipe according to whether we * have active connectors/encoders. */ - enable = false; -for_each_encoder_on_crtc (dev, &crtc->base, encoder) { - enable = true; -break ; - } - -if (!enable) +if (!intel_crtc_has_encoders (crtc))intel_crtc_disable_noatomic (&crtc->base);if (crtc->active != crtc->base.state->active) { +struct intel_encoder *encoder;/* This can happen either due to bugs in the get_hw_state * functions or because of calls to intel_crtc_disable_noatomic, Signature · 6 lines
2.4.6 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 3/2] drm/i915: Factor out intel_crtc_has_encoders()
Quoted 10 lines · Jani Nikula
Quoted 7 lines · On Wed, 26 Aug 2015, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
Make the code mode readable by pulling the "does this crtc have any encoders?" deduction into a separate function.
Cc Maarten Lankhorst <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>Reviewed-by Jani Nikula <[email protected]>
Both applied to dinq, thanks.
-Daniel
Quoted 68 lines
Quoted 61 lines
--- drivers/gpu/drm/i915/intel_display.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-)drivers/gpu/drm/i915/intel_display.c +13
-9@@ -14855,13 +14855,22 @@ intel_check_plane_mapping(struct intel_crtc *crtc)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) {struct drm_device *dev = crtc->base.dev;struct drm_i915_private *dev_priv = dev->dev_private; -struct intel_encoder *encoder;u32 reg; -bool enable;/* Clear any frame start delays used for debugging left by the BIOS */ reg =PIPECONF (crtc->config->cpu_transcoder);@@ -14905,16 +14914,11 @@ static void intel_sanitize_crtc(struct intel_crtc *crtc)/* Adjust the state of the output pipe according to whether we * have active connectors/encoders. */ - enable = false; -for_each_encoder_on_crtc (dev, &crtc->base, encoder) { - enable = true; -break ; - } - -if (!enable) +if (!intel_crtc_has_encoders (crtc))intel_crtc_disable_noatomic (&crtc->base);if (crtc->active != crtc->base.state->active) { +struct intel_encoder *encoder;/* This can happen either due to bugs in the get_hw_state * functions or because of calls to intel_crtc_disable_noatomic, Signature · 6 lines
2.4.6 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfxSignature · 5 lines
Jani Nikula, Intel Open Source Technology Center _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v2 2/2] drm/i915: Fix clock readout when pipes are enabled w/o ports
In reply to [email protected]Op 26-08-15 om 18:39 schreef [email protected]:
Quoted 30 lines
From: Ville Syrjälä <[email protected]>
The BIOS sometimes likes to enable pipes w/o any ports, at least on older machines. Currently we fail to assign anything sensible to
crtc->hwmode.crtc_clockwhich leads to complaints from the vblank code. Deal with active pipes w/o ports and assign something sensible tocrtc_clockini9xx_get_pipe_config(). The encoder .get_config() will override this if the port is enabled.Gets rid of rest of these on my gen4:
[drm:drm_calc_timestamping_constants [drm]] *ERROR* crtc 24: Can't calculate constants, dotclock = 0! [drm:i915_get_vblank_timestamp] crtc 1 is disabledv2: Fill out
crtc_clockalready ini9xx_get_pipe_config()(Maarten)Cc Maarten Lankhorst <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>--- drivers/gpu/drm/i915/intel_display.c | 8 ++++++++ 1 file changed, 8 insertions(+)drivers/gpu/drm/i915/intel_display.c +1
-0@@ -8107,6 +8107,14 @@ static bool i9xx_get_pipe_config(struct intel_crtc *crtc,else i9xx_crtc_clock_get (crtc, pipe_config); +/*
drivers/gpu/drm/i915/intel_display.c static bool i9xx_get_pipe_config(struct intel_crtc *crtc, · line 8120
Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +7
-0+* Normally the dotclock is filled in by the encoder .get_config() +* but in case the pipe is enabled w/o any ports we need a sane +* default. +*/ + pipe_config->base.adjusted_mode.crtc_clock = + pipe_config->port_clock / pipe_config->pixel_multiplier; +return true; }
This patch + 1/2 and 3/2.
I'll send a separate patch for killing off the plane sanitization. :)
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx