public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 03/12] drm/i915: Add output_types bitmask into the crtc state
Date: Wed, 8 Jun 2016 16:33:51 +0300	[thread overview]
Message-ID: <20160608133351.GQ4329@intel.com> (raw)
In-Reply-To: <20160608132525.GE32344@nuc-i3427.alporthouse.com>

On Wed, Jun 08, 2016 at 02:25:25PM +0100, Chris Wilson wrote:
> On Wed, Jun 08, 2016 at 01:41:38PM +0300, ville.syrjala@linux.intel.com wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > 
> > Rather than looping through encoders to see which encoder types
> > are being driven by the pipe, add an output_types bitmask into
> > the crtc state and populate it prior to compute_config and during
> > state readout.
> > 
> > v2: Determine output_types before .compute_config() hooks are called
> > 
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > ---
> >  drivers/gpu/drm/i915/intel_display.c | 51 +++++++++++++++---------------------
> >  drivers/gpu/drm/i915/intel_drv.h     |  5 ++++
> >  2 files changed, 26 insertions(+), 30 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> > index 12ff79594bc1..eabace447b1c 100644
> > --- a/drivers/gpu/drm/i915/intel_display.c
> > +++ b/drivers/gpu/drm/i915/intel_display.c
> > @@ -535,14 +535,7 @@ needs_modeset(struct drm_crtc_state *state)
> >   */
> >  bool intel_pipe_has_type(struct intel_crtc *crtc, enum intel_output_type type)
> >  {
> > -	struct drm_device *dev = crtc->base.dev;
> > -	struct intel_encoder *encoder;
> > -
> > -	for_each_encoder_on_crtc(dev, &crtc->base, encoder)
> > -		if (encoder->type == type)
> > -			return true;
> > -
> > -	return false;
> > +	return crtc->config->output_types & (1 << type);
> 
> This could become inline and then all those
> 
> 	if (intel_pipe_has_type(crtc, VGA) ||
> 	    intel_pipe_has_type(crtc, LVDS) ||
> 	    intel_pipe_has_type(crtc, HDMI))
> 
> whatnots will just disapear into a single test.

Sounds sane. Or we could just kill the entire function and just open
code it. Not sure hiding it in a function buys us anything at this
point.

> 
> I won't say how long those loops have been upsetting me without doing
> anything about them.
> 
> > @@ -12529,6 +12503,19 @@ intel_modeset_pipe_config(struct drm_crtc *crtc,
> >  			       &pipe_config->pipe_src_w,
> >  			       &pipe_config->pipe_src_h);
> >  
> > +	for_each_connector_in_state(state, connector, connector_state, i) {
> > +		if (connector_state->crtc != crtc)
> > +			continue;
> > +
> > +		encoder = to_intel_encoder(connector_state->best_encoder);
> > +
> > +		/*
> > +		 * Determine output_types before calling the .compute_config()
> > +		 * hooks so that the hooks can use this information safely.
> > +		 */
> > +		pipe_config->output_types |= 1 << encoder->type;
> 
> pipe_config->output_types |= BIT(encoder->type);
> 
> Not my personal favourite in obfuscation, but one available to us if we
> desire.

I've been a bit wary about BIT() on account of the UL in there. But I
suppose it might not make much of a difference in the end.

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2016-06-08 13:33 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-08 10:41 [PATCH 00/12] drm/i915: Eliminate DDI encoder->type frobbery ville.syrjala
2016-06-08 10:41 ` [PATCH 01/12] drm/i915: Don't mark eDP encoders as MST capable ville.syrjala
2016-06-16 12:27   ` Sharma, Shashank
2016-06-16 20:35   ` Dave Airlie
2016-06-17 14:25     ` Ville Syrjälä
2016-06-08 10:41 ` [PATCH 02/12] drm/i915: Remove encoder type checks from MST suspend/resume ville.syrjala
2016-06-16 12:41   ` Sharma, Shashank
2016-06-16 13:40     ` Ville Syrjälä
2016-06-16 17:48       ` Sharma, Shashank
2016-06-08 10:41 ` [PATCH 03/12] drm/i915: Add output_types bitmask into the crtc state ville.syrjala
2016-06-08 13:25   ` Chris Wilson
2016-06-08 13:33     ` Ville Syrjälä [this message]
2016-06-13 14:25   ` Daniel Vetter
2016-06-13 16:24     ` Ville Syrjälä
2016-06-08 10:41 ` [PATCH 04/12] drm/i915: Unify intel_pipe_has_type() and intel_pipe_will_have_type() ville.syrjala
2016-06-08 10:41 ` [PATCH 05/12] drm/i915: Replace manual lvds and sdvo/hdmi counting with intel_crtc_has_type() ville.syrjala
2016-06-08 10:41 ` [PATCH 06/12] drm/i915: Kill has_dp_encoder from pipe_config ville.syrjala
2016-06-08 10:41 ` [PATCH 07/12] drm/i915: Replace some open coded intel_crtc_has_dp_encoder()s ville.syrjala
2016-06-08 10:41 ` [PATCH 08/12] drm/i915: s/INTEL_OUTPUT_DISPLAYPORT/INTEL_OUTPUT_DP/ ville.syrjala
2016-06-08 13:05   ` Kahola, Mika
2016-06-08 10:41 ` [PATCH 09/12] drm/i915: Kill has_dsi_encoder ville.syrjala
2016-06-08 10:41 ` [PATCH 10/12] drm/i915: Simplify hdmi_12bpc_possible() ville.syrjala
2016-06-08 10:41 ` [PATCH 11/12] drm/i915: Check for invalid cloning earlier during modeset ville.syrjala
2016-06-08 13:15   ` Chris Wilson
2016-06-08 13:27     ` Ville Syrjälä
2016-06-20 13:54       ` Maarten Lankhorst
2016-06-08 10:41 ` [PATCH 12/12] drm/i915: Stop frobbing with DDI encoder->type ville.syrjala
2016-06-08 11:13 ` ✓ Ro.CI.BAT: success for drm/i915: Eliminate DDI encoder->type frobbery Patchwork

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=20160608133351.GQ4329@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.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