* [PATCH 1/2] drm/i915: Assign hwmode after encoder state readout
@ 2015-08-13 17:31 ville.syrjala
2015-08-13 17:31 ` [PATCH 2/2] drm/i915: Fix clock readout when pipes are enabld w/o ports ville.syrjala
0 siblings, 1 reply; 7+ messages in thread
From: ville.syrjala @ 2015-08-13 17:31 UTC (permalink / raw)
To: intel-gfx
From: Ville Syrjälä <ville.syrjala@linux.intel.com>
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
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
drivers/gpu/drm/i915/intel_display.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 21aa745..b4229ce 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -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,
--
2.4.6
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 2/2] drm/i915: Fix clock readout when pipes are enabld w/o ports
2015-08-13 17:31 [PATCH 1/2] drm/i915: Assign hwmode after encoder state readout ville.syrjala
@ 2015-08-13 17:31 ` ville.syrjala
2015-08-26 16:39 ` [PATCH v2 2/2] drm/i915: Fix clock readout when pipes are enabled " ville.syrjala
0 siblings, 1 reply; 7+ messages in thread
From: ville.syrjala @ 2015-08-13 17:31 UTC (permalink / raw)
To: intel-gfx
From: Ville Syrjälä <ville.syrjala@linux.intel.com>
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
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
drivers/gpu/drm/i915/intel_display.c | 31 ++++++++++++++++++++++---------
1 file changed, 22 insertions(+), 9 deletions(-)
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index b4229ce..32e9f91 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -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;
}
}
--
2.4.6
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH v2 2/2] drm/i915: Fix clock readout when pipes are enabled w/o ports
2015-08-13 17:31 ` [PATCH 2/2] drm/i915: Fix clock readout when pipes are enabld w/o ports ville.syrjala
@ 2015-08-26 16:39 ` ville.syrjala
2015-08-26 16:39 ` [PATCH 3/2] drm/i915: Factor out intel_crtc_has_encoders() ville.syrjala
2015-08-27 13:11 ` [PATCH v2 2/2] drm/i915: Fix clock readout when pipes are enabled w/o ports Maarten Lankhorst
0 siblings, 2 replies; 7+ messages in thread
From: ville.syrjala @ 2015-08-26 16:39 UTC (permalink / raw)
To: intel-gfx
From: Ville Syrjälä <ville.syrjala@linux.intel.com>
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)
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
drivers/gpu/drm/i915/intel_display.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index dde8597..9e92915 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -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;
}
--
2.4.6
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/2] drm/i915: Factor out intel_crtc_has_encoders()
2015-08-26 16:39 ` [PATCH v2 2/2] drm/i915: Fix clock readout when pipes are enabled " ville.syrjala
@ 2015-08-26 16:39 ` ville.syrjala
2015-08-27 7:29 ` Jani Nikula
2015-08-27 13:11 ` [PATCH v2 2/2] drm/i915: Fix clock readout when pipes are enabled w/o ports Maarten Lankhorst
1 sibling, 1 reply; 7+ messages in thread
From: ville.syrjala @ 2015-08-26 16:39 UTC (permalink / raw)
To: intel-gfx
From: Ville Syrjälä <ville.syrjala@linux.intel.com>
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: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
drivers/gpu/drm/i915/intel_display.c | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 9e92915..ac2c2f1 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -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,
--
2.4.6
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH 3/2] drm/i915: Factor out intel_crtc_has_encoders()
2015-08-26 16:39 ` [PATCH 3/2] drm/i915: Factor out intel_crtc_has_encoders() ville.syrjala
@ 2015-08-27 7:29 ` Jani Nikula
2015-09-01 10:03 ` Daniel Vetter
0 siblings, 1 reply; 7+ messages in thread
From: Jani Nikula @ 2015-08-27 7:29 UTC (permalink / raw)
To: ville.syrjala, intel-gfx
On Wed, 26 Aug 2015, ville.syrjala@linux.intel.com wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> 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: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
> ---
> drivers/gpu/drm/i915/intel_display.c | 22 +++++++++++++---------
> 1 file changed, 13 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 9e92915..ac2c2f1 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -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,
> --
> 2.4.6
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH 3/2] drm/i915: Factor out intel_crtc_has_encoders()
2015-08-27 7:29 ` Jani Nikula
@ 2015-09-01 10:03 ` Daniel Vetter
0 siblings, 0 replies; 7+ messages in thread
From: Daniel Vetter @ 2015-09-01 10:03 UTC (permalink / raw)
To: Jani Nikula; +Cc: intel-gfx
On Thu, Aug 27, 2015 at 10:29:13AM +0300, Jani Nikula wrote:
> On Wed, 26 Aug 2015, ville.syrjala@linux.intel.com wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> >
> > 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: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Both applied to dinq, thanks.
-Daniel
>
>
> > ---
> > drivers/gpu/drm/i915/intel_display.c | 22 +++++++++++++---------
> > 1 file changed, 13 insertions(+), 9 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> > index 9e92915..ac2c2f1 100644
> > --- a/drivers/gpu/drm/i915/intel_display.c
> > +++ b/drivers/gpu/drm/i915/intel_display.c
> > @@ -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,
> > --
> > 2.4.6
> >
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/intel-gfx
>
> --
> Jani Nikula, Intel Open Source Technology Center
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 2/2] drm/i915: Fix clock readout when pipes are enabled w/o ports
2015-08-26 16:39 ` [PATCH v2 2/2] drm/i915: Fix clock readout when pipes are enabled " ville.syrjala
2015-08-26 16:39 ` [PATCH 3/2] drm/i915: Factor out intel_crtc_has_encoders() ville.syrjala
@ 2015-08-27 13:11 ` Maarten Lankhorst
1 sibling, 0 replies; 7+ messages in thread
From: Maarten Lankhorst @ 2015-08-27 13:11 UTC (permalink / raw)
To: ville.syrjala, intel-gfx
Op 26-08-15 om 18:39 schreef ville.syrjala@linux.intel.com:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> 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)
>
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
> drivers/gpu/drm/i915/intel_display.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index dde8597..9e92915 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -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;
> }
>
This patch + 1/2 and 3/2.
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
I'll send a separate patch for killing off the plane sanitization. :)
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2015-09-01 10:03 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-13 17:31 [PATCH 1/2] drm/i915: Assign hwmode after encoder state readout ville.syrjala
2015-08-13 17:31 ` [PATCH 2/2] drm/i915: Fix clock readout when pipes are enabld w/o ports ville.syrjala
2015-08-26 16:39 ` [PATCH v2 2/2] drm/i915: Fix clock readout when pipes are enabled " ville.syrjala
2015-08-26 16:39 ` [PATCH 3/2] drm/i915: Factor out intel_crtc_has_encoders() ville.syrjala
2015-08-27 7:29 ` Jani Nikula
2015-09-01 10:03 ` Daniel Vetter
2015-08-27 13:11 ` [PATCH v2 2/2] drm/i915: Fix clock readout when pipes are enabled w/o ports Maarten Lankhorst
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox