All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: sonika <sonika.jindal@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 07/13] drm/i915: Hide the source vs. sink rate handling from intel_dp_compute_config()
Date: Fri, 13 Mar 2015 14:02:46 +0200	[thread overview]
Message-ID: <20150313120246.GD17419@intel.com> (raw)
In-Reply-To: <5502CDBB.8030301@intel.com>

On Fri, Mar 13, 2015 at 05:14:59PM +0530, sonika wrote:
> 
> On Thursday 12 March 2015 08:40 PM, ville.syrjala@linux.intel.com wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> >
> > intel_dp_compute_config() only really needs to know the rates supported
> > by both source and sink, so hide the raw source and sink arrays from it.
> >
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > ---
> >   drivers/gpu/drm/i915/intel_dp.c | 37 +++++++++++++++++++++++--------------
> >   1 file changed, 23 insertions(+), 14 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> > index 61538f4..a88f932 100644
> > --- a/drivers/gpu/drm/i915/intel_dp.c
> > +++ b/drivers/gpu/drm/i915/intel_dp.c
> > @@ -1192,9 +1192,9 @@ intel_dp_set_clock(struct intel_encoder *encoder,
> >   	}
> >   }
> >   
> > -static int intel_supported_rates(const int *source_rates, int source_len,
> > -				 const int *sink_rates, int sink_len,
> > -				 int *supported_rates)
> > +static int intersect_rates(const int *source_rates, int source_len,
> > +			   const int *sink_rates, int sink_len,
> > +			   int *supported_rates)
> >   {
> >   	int i = 0, j = 0, k = 0;
> >   
> > @@ -1213,6 +1213,21 @@ static int intel_supported_rates(const int *source_rates, int source_len,
> >   	return k;
> >   }
> >   
> > +static int intel_supported_rates(struct intel_dp *intel_dp,
> > +				 int *supported_rates)
> > +{
> > +	struct drm_device *dev = intel_dp_to_dev(intel_dp);
> > +	const int *source_rates, *sink_rates;
> > +	int source_len, sink_len;
> > +
> > +	sink_len = intel_dp_sink_rates(intel_dp, &sink_rates);
> > +	source_len = intel_dp_source_rates(dev, &source_rates);
> > +
> > +	return intersect_rates(source_rates, source_len,
> > +			       sink_rates, sink_len,
> > +			       supported_rates);
> > +}
> > +
> Now when I am looking at it, the name "supported_rates", sounds 
> confusing. Because first we are using it for sink_rates in 
> intel_dp->supported_rates
> and then we use it to store the intersect_rates. Since sink_rates are 
> termed supported_rates in the spec, can we remove the sink_rates altogether
> and have source_rates, sink_supported_rates and common_rates (or 
> something else ?)

Hmm. Yeah. Maybe just rename to intel_dp->sink_rates? And common_rates
would seem like a decent name for the intersection.

> 
> -Sonika
> >   static int rate_to_index(int find, const int *rates)
> >   {
> >   	int i = 0;
> > @@ -1243,17 +1258,10 @@ intel_dp_compute_config(struct intel_encoder *encoder,
> >   	int max_clock;
> >   	int bpp, mode_rate;
> >   	int link_avail, link_clock;
> > -	const int *sink_rates;
> > -	int supported_rates[8] = {0};
> > -	const int *source_rates;
> > -	int source_len, sink_len, supported_len;
> > -
> > -	sink_len = intel_dp_sink_rates(intel_dp, &sink_rates);
> > -
> > -	source_len = intel_dp_source_rates(dev, &source_rates);
> > +	int supported_rates[DP_MAX_SUPPORTED_RATES] = {};
> > +	int supported_len;
> >   
> > -	supported_len = intel_supported_rates(source_rates, source_len,
> > -				sink_rates, sink_len, supported_rates);
> > +	supported_len = intel_supported_rates(intel_dp, supported_rates);
> >   
> >   	/* No common link rates between source and sink */
> >   	WARN_ON(supported_len <= 0);
> > @@ -1352,7 +1360,8 @@ found:
> >   
> >   	if (INTEL_INFO(dev)->gen >= 9 && intel_dp->supported_rates[0]) {
> >   		intel_dp->rate_select =
> > -			rate_to_index(supported_rates[clock], sink_rates);
> > +			rate_to_index(supported_rates[clock],
> > +				      intel_dp->supported_rates);
> >   		intel_dp->link_bw = 0;
> >   	}
> >   

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

  reply	other threads:[~2015-03-13 12:02 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-12 15:10 [PATCH 00/13] drm/i915: Clean up the DP link rate code ville.syrjala
2015-03-12 15:10 ` [PATCH 01/13] drm/i915: Make the DP rates int instead of uint32_t ville.syrjala
2015-03-13 22:45   ` Todd Previte
2015-03-12 15:10 ` [PATCH 02/13] drm/i915: Store the converted link rates in intel_dp->supported_rates[] ville.syrjala
2015-03-13 22:58   ` Todd Previte
2015-03-12 15:10 ` [PATCH 03/13] drm/i915: Don't copy the DP source rates arrays ville.syrjala
2015-03-13 23:04   ` Todd Previte
2015-03-16  9:13   ` Jindal, Sonika
2015-03-16  9:34     ` Ville Syrjälä
2015-03-16  9:37       ` Jindal, Sonika
2015-03-16 10:55         ` Ville Syrjälä
2015-03-16 11:33           ` sonika
2015-03-16 11:55             ` Ville Syrjälä
2015-03-12 15:10 ` [PATCH 04/13] drm/i915: Don't copy sink rates either ville.syrjala
2015-03-12 15:10 ` [PATCH 05/13] drm/i915: Remove special case from intel_supported_rates() ville.syrjala
2015-03-12 15:10 ` [PATCH 06/13] drm/i915: Fully separate source vs. sink rates ville.syrjala
2015-03-17 10:06   ` Daniel Vetter
2015-03-12 15:10 ` [PATCH 07/13] drm/i915: Hide the source vs. sink rate handling from intel_dp_compute_config() ville.syrjala
2015-03-13 11:44   ` sonika
2015-03-13 12:02     ` Ville Syrjälä [this message]
2015-03-13 11:56       ` sonika
2015-03-12 15:10 ` [PATCH 08/13] drm/i915: Fix max link rate in intel_dp_mode_valid() ville.syrjala
2015-03-12 15:10 ` [PATCH 09/13] drm/i915: Use DP_LINK_RATE_SET whenever possible ville.syrjala
2015-03-12 15:10 ` [PATCH 10/13] drm/i915: Fix MST link rate handling ville.syrjala
2015-03-12 15:10 ` [PATCH 11/13] drm/i915: Avoid overflowing the DP link rate arrays ville.syrjala
2015-03-12 15:10 ` [PATCH 12/13] drm/i915: Add eDP intermediate frequencies for CHV ville.syrjala
2015-03-12 15:10 ` [PATCH 13/13] drm/i915: Include the sink/source/supported rates in debug output ville.syrjala
2015-03-12 19:42   ` shuang.he
2015-03-13 17:40 ` [PATCH 14/13] drm/i915: Unconfuse DP link rate array names ville.syrjala
2015-03-17  9:45   ` sonika
2015-03-17 10:13     ` 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=20150313120246.GD17419@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=sonika.jindal@intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.