From: Imre Deak <imre.deak@intel.com>
To: Jesse Barnes <jbarnes@virtuousgeek.org>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 09/19] drm/i915: check port power domain when reading the encoder hw state
Date: Mon, 24 Feb 2014 14:53:11 +0200 [thread overview]
Message-ID: <1393246391.13131.72.camel@intelbox> (raw)
In-Reply-To: <20140220113620.72cae64f@jbarnes-desktop>
[-- Attachment #1.1: Type: text/plain, Size: 6026 bytes --]
On Thu, 2014-02-20 at 11:36 -0800, Jesse Barnes wrote:
> On Tue, 18 Feb 2014 00:02:10 +0200
> Imre Deak <imre.deak@intel.com> wrote:
>
> > Since the encoder is tied to its port, we need to make sure the power
> > domain for that port is on before reading out the encoder HW state.
> >
> > Signed-off-by: Imre Deak <imre.deak@intel.com>
> > ---
> > drivers/gpu/drm/i915/intel_ddi.c | 2 +-
> > drivers/gpu/drm/i915/intel_display.c | 23 ++++++++++++++++++-----
> > drivers/gpu/drm/i915/intel_drv.h | 1 +
> > 3 files changed, 20 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
> > index 2643d3b..f95bc3a 100644
> > --- a/drivers/gpu/drm/i915/intel_ddi.c
> > +++ b/drivers/gpu/drm/i915/intel_ddi.c
> > @@ -1110,7 +1110,7 @@ bool intel_ddi_connector_get_hw_state(struct intel_connector *intel_connector)
> > enum transcoder cpu_transcoder;
> > uint32_t tmp;
> >
> > - if (!intel_encoder->get_hw_state(intel_encoder, &pipe))
> > + if (!intel_encoder_get_hw_state(intel_encoder, &pipe))
> > return false;
> >
> > if (port == PORT_A)
> > diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> > index 7ef06fa..ce1c00a 100644
> > --- a/drivers/gpu/drm/i915/intel_display.c
> > +++ b/drivers/gpu/drm/i915/intel_display.c
> > @@ -4519,7 +4519,7 @@ static void intel_connector_check_state(struct intel_connector *connector)
> > WARN(!encoder->connectors_active,
> > "encoder->connectors_active not set\n");
> >
> > - encoder_enabled = encoder->get_hw_state(encoder, &pipe);
> > + encoder_enabled = intel_encoder_get_hw_state(encoder, &pipe);
> > WARN(!encoder_enabled, "encoder not enabled\n");
> > if (WARN_ON(!encoder->base.crtc))
> > return;
> > @@ -4561,7 +4561,7 @@ bool intel_connector_get_hw_state(struct intel_connector *connector)
> > enum pipe pipe = 0;
> > struct intel_encoder *encoder = connector->encoder;
> >
> > - return encoder->get_hw_state(encoder, &pipe);
> > + return intel_encoder_get_hw_state(encoder, &pipe);
> > }
> >
> > static bool ironlake_check_fdi_lanes(struct drm_device *dev, enum pipe pipe,
> > @@ -9464,6 +9464,19 @@ check_connector_state(struct drm_device *dev)
> > }
> > }
> >
> > +bool intel_encoder_get_hw_state(struct intel_encoder *intel_encoder,
> > + enum pipe *pipe)
> > +{
> > + enum intel_display_power_domain power_domain;
> > + struct drm_i915_private *dev_priv = intel_encoder->base.dev->dev_private;
> > +
> > + power_domain = intel_display_port_power_domain(intel_encoder);
> > + if (!intel_display_power_enabled(dev_priv, power_domain))
> > + return false;
> > +
> > + return intel_encoder->get_hw_state(intel_encoder, pipe);
> > +}
> > +
> > static void
> > check_encoder_state(struct drm_device *dev)
> > {
> > @@ -9504,7 +9517,7 @@ check_encoder_state(struct drm_device *dev)
> > "encoder's computed active state doesn't match tracked active state "
> > "(expected %i, found %i)\n", active, encoder->connectors_active);
> >
> > - active = encoder->get_hw_state(encoder, &pipe);
> > + active = intel_encoder_get_hw_state(encoder, &pipe);
> > WARN(active != encoder->connectors_active,
> > "encoder's hw state doesn't match sw tracking "
> > "(expected %i, found %i)\n",
> > @@ -9571,7 +9584,7 @@ check_crtc_state(struct drm_device *dev)
> > enum pipe pipe;
> > if (encoder->base.crtc != &crtc->base)
> > continue;
> > - if (encoder->get_hw_state(encoder, &pipe))
> > + if (intel_encoder_get_hw_state(encoder, &pipe))
> > encoder->get_config(encoder, &pipe_config);
> > }
> >
> > @@ -11350,7 +11363,7 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev)
> > base.head) {
> > pipe = 0;
> >
> > - if (encoder->get_hw_state(encoder, &pipe)) {
> > + if (intel_encoder_get_hw_state(encoder, &pipe)) {
> > crtc = to_intel_crtc(dev_priv->pipe_to_crtc_mapping[pipe]);
> > encoder->base.crtc = &crtc->base;
> > encoder->get_config(encoder, &crtc->config);
> > diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> > index e31eb1e..afc01a4 100644
> > --- a/drivers/gpu/drm/i915/intel_drv.h
> > +++ b/drivers/gpu/drm/i915/intel_drv.h
> > @@ -738,6 +738,7 @@ intel_display_port_power_domain(struct intel_encoder *intel_encoder);
> > int valleyview_get_vco(struct drm_i915_private *dev_priv);
> > void intel_mode_from_pipe_config(struct drm_display_mode *mode,
> > struct intel_crtc_config *pipe_config);
> > +bool intel_encoder_get_hw_state(struct intel_encoder *encoder, enum pipe *pipe);
> >
> > /* intel_dp.c */
> > void intel_dp_init(struct drm_device *dev, int output_reg, enum port port);
>
> I think there are a few more places to switch over, e.g.
> connector_check_state and connector_get_hw_state?
I haven't added a high level power domain check for those, because they
only call the encoder check-state and get-hw-state handler internally,
and those have power domain checks in place already.
I also postponed adding power domain checks for the PLL HW readout/state
checking code, since the development of that part is still in a bit of a
flux. But atm, it's only relevant on PCH platforms where we don't need
to care about power wells. So I'd add the checks for this when things
have settled.
> Maybe we should
> rename the fn pointer field to include a __ in the front so the
> compiler will catch them all and we'll know they're not to be called
> directly.
Hm, that'd mean some extra churn. I agree with your argument about the
compile time check it's a very nice guarantee for reviewers. I don't
have a strong opinion about the second argument. Some existing handlers
are also not ok to call in some contexts, so to keep things unified we'd
also have to prefix those. For now I'd just punt on this ..
--Imre
[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 490 bytes --]
[-- Attachment #2: Type: text/plain, Size: 159 bytes --]
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2014-02-24 12:53 UTC|newest]
Thread overview: 68+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-17 22:02 [PATCH 00/19] drm/i915: vlv power domains support Imre Deak
2014-02-17 22:02 ` [PATCH 01/19] drm/i915: use drm_i915_private everywhere in the power domain api Imre Deak
2014-02-20 19:16 ` Jesse Barnes
2014-02-17 22:02 ` [PATCH 02/19] drm/i915: fold in __intel_power_well_get/put functions Imre Deak
2014-02-20 19:17 ` Jesse Barnes
2014-02-20 19:44 ` Chris Wilson
2014-02-24 13:23 ` Paulo Zanoni
2014-02-24 14:07 ` Imre Deak
2014-02-17 22:02 ` [PATCH 03/19] drm/i915: move modeset_update_power_wells earlier Imre Deak
2014-02-20 19:18 ` Jesse Barnes
2014-02-17 22:02 ` [PATCH 04/19] drm/i915: move power domain macros to intel_pm.c Imre Deak
2014-02-20 19:21 ` Jesse Barnes
2014-02-24 13:38 ` Paulo Zanoni
2014-02-24 13:54 ` Imre Deak
2014-02-17 22:02 ` [PATCH 05/19] drm/i915: power domains: add power well ops Imre Deak
2014-02-20 19:26 ` Jesse Barnes
2014-02-24 11:42 ` Imre Deak
2014-02-17 22:02 ` [PATCH 06/19] drm/i915: remove power_well->always_on flag Imre Deak
2014-02-20 19:27 ` Jesse Barnes
2014-02-17 22:02 ` [PATCH 07/19] drm/i915: add port power domains Imre Deak
2014-02-20 19:31 ` Jesse Barnes
2014-02-24 11:52 ` Imre Deak
2014-03-05 10:11 ` Daniel Vetter
2014-02-17 22:02 ` [PATCH 08/19] drm/i915: get port power domain in connector detect Imre Deak
2014-02-19 12:35 ` Ville Syrjälä
2014-02-19 12:39 ` Imre Deak
2014-02-20 19:33 ` Jesse Barnes
2014-02-24 11:56 ` Imre Deak
2014-03-05 10:15 ` Daniel Vetter
2014-02-17 22:02 ` [PATCH 09/19] drm/i915: check port power domain when reading the encoder hw state Imre Deak
2014-02-20 19:36 ` Jesse Barnes
2014-02-24 12:53 ` Imre Deak [this message]
2014-03-05 10:21 ` Daniel Vetter
2014-02-17 22:02 ` [PATCH 10/19] drm/i915: check pipe power domain when reading its " Imre Deak
2014-02-20 19:37 ` Jesse Barnes
2014-03-05 10:24 ` Daniel Vetter
2014-02-17 22:02 ` [PATCH 11/19] drm/i915: vlv: keep first level vblank IRQs masked Imre Deak
2014-02-18 16:54 ` Ville Syrjälä
2014-02-17 22:02 ` [PATCH 12/19] drm/i915: sanitize PUNIT register macro definitions Imre Deak
2014-02-20 19:46 ` Jesse Barnes
2014-02-24 13:12 ` Imre Deak
2014-02-17 22:02 ` [PATCH 13/19] drm/i915: factor out reset_vblank_counter Imre Deak
2014-02-18 16:55 ` Ville Syrjälä
2014-02-17 22:02 ` [PATCH 14/19] drm/i915: switch order of power domain init wrt. irq install Imre Deak
2014-02-20 19:48 ` Jesse Barnes
2014-02-24 13:23 ` Imre Deak
2014-03-05 10:29 ` Daniel Vetter
2014-02-17 22:02 ` [PATCH 15/19] drm/i915: use power domain api to check vga power state Imre Deak
2014-02-20 19:51 ` Jesse Barnes
2014-03-05 10:31 ` Daniel Vetter
2014-02-17 22:02 ` [PATCH 16/19] drm/i915: sanity check power well sw state against hw state Imre Deak
2014-02-18 16:55 ` Ville Syrjälä
2014-02-18 17:37 ` Imre Deak
2014-02-18 17:59 ` Ville Syrjälä
2014-03-05 10:32 ` Daniel Vetter
2014-02-17 22:02 ` [PATCH 17/19] drm/i915: vlv: factor out valleyview_display_irq_install Imre Deak
2014-02-20 19:56 ` Jesse Barnes
2014-02-24 13:34 ` Imre Deak
2014-02-17 22:02 ` [PATCH 18/19] drm/i915: move hsw power domain comment to its right place Imre Deak
2014-02-20 19:53 ` Jesse Barnes
2014-03-05 10:34 ` Daniel Vetter
2014-02-17 22:02 ` [PATCH 19/19] drm/i915: power domains: add vlv power wells Imre Deak
2014-02-19 12:29 ` Ville Syrjälä
2014-02-20 19:58 ` Jesse Barnes
2014-02-26 18:02 ` Imre Deak
2014-02-26 19:52 ` Jesse Barnes
2014-02-27 10:03 ` Imre Deak
2014-03-05 10:38 ` Daniel Vetter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1393246391.13131.72.camel@intelbox \
--to=imre.deak@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jbarnes@virtuousgeek.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox