All of lore.kernel.org
 help / color / mirror / Atom feed
From: Manasi Navare <manasi.d.navare@intel.com>
To: Mika Kahola <mika.kahola@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH v2 3/5] drm/i915: Change the placement of some static functions in intel_dp.c
Date: Thu, 15 Sep 2016 12:08:02 -0700	[thread overview]
Message-ID: <20160915190802.GA15527@intel.com> (raw)
In-Reply-To: <1473925283.20751.27.camel@intel.com>

On Thu, Sep 15, 2016 at 10:41:23AM +0300, Mika Kahola wrote:
> On Tue, 2016-09-13 at 18:08 -0700, Manasi Navare wrote:
> > These static helper functions are required to be used within upfront
> > link training related functions so they need to be placed at the top
> > of the file. It also changes macro dev to dev_priv.
> > 
> We could split this patch into two parts. One being moving around the
> helper functions and the other one cleanup patch to change dev in favor
> of dev_priv.
>

It was just one place for changing dev to dev_priv. But sure I can
add a separate patch for that.

Manasi 
> > v2:
> > * Dont move around functions declared in intel_drv.h (Rodrigo Vivi)
> > 
> > Signed-off-by: Manasi Navare <manasi.d.navare@intel.com>
> > ---
> >  drivers/gpu/drm/i915/intel_dp.c | 158 ++++++++++++++++++++--------
> > ------------
> >  1 file changed, 79 insertions(+), 79 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_dp.c
> > b/drivers/gpu/drm/i915/intel_dp.c
> > index 07f9a49..a319102 100644
> > --- a/drivers/gpu/drm/i915/intel_dp.c
> > +++ b/drivers/gpu/drm/i915/intel_dp.c
> > @@ -190,6 +190,81 @@ intel_dp_max_data_rate(int max_link_clock, int
> > max_lanes)
> >  	return (max_link_clock * max_lanes * 8) / 10;
> >  }
> >  
> > +static int
> > +intel_dp_sink_rates(struct intel_dp *intel_dp, const int
> > **sink_rates)
> > +{
> > +	if (intel_dp->num_sink_rates) {
> > +		*sink_rates = intel_dp->sink_rates;
> > +		return intel_dp->num_sink_rates;
> > +	}
> > +
> > +	*sink_rates = default_rates;
> > +
> > +	return (intel_dp_max_link_bw(intel_dp) >> 3) + 1;
> > +}
> > +
> > +static int
> > +intel_dp_source_rates(struct intel_dp *intel_dp, const int
> > **source_rates)
> > +{
> > +	struct intel_digital_port *dig_port =
> > dp_to_dig_port(intel_dp);
> > +	struct drm_i915_private *dev_priv = to_i915(dig_port-
> > >base.base.dev);
> > +	int size;
> > +
> > +	if (IS_BROXTON(dev_priv)) {
> > +		*source_rates = bxt_rates;
> > +		size = ARRAY_SIZE(bxt_rates);
> > +	} else if (IS_SKYLAKE(dev_priv) || IS_KABYLAKE(dev_priv)) {
> > +		*source_rates = skl_rates;
> > +		size = ARRAY_SIZE(skl_rates);
> > +	} else {
> > +		*source_rates = default_rates;
> > +		size = ARRAY_SIZE(default_rates);
> > +	}
> > +
> > +	/* This depends on the fact that 5.4 is last value in the
> > array */
> > +	if (!intel_dp_source_supports_hbr2(intel_dp))
> > +		size--;
> > +
> > +	return size;
> > +}
> > +
> > +static int intersect_rates(const int *source_rates, int source_len,
> > +			   const int *sink_rates, int sink_len,
> > +			   int *common_rates)
> > +{
> > +	int i = 0, j = 0, k = 0;
> > +
> > +	while (i < source_len && j < sink_len) {
> > +		if (source_rates[i] == sink_rates[j]) {
> > +			if (WARN_ON(k >= DP_MAX_SUPPORTED_RATES))
> > +				return k;
> > +			common_rates[k] = source_rates[i];
> > +			++k;
> > +			++i;
> > +			++j;
> > +		} else if (source_rates[i] < sink_rates[j]) {
> > +			++i;
> > +		} else {
> > +			++j;
> > +		}
> > +	}
> > +	return k;
> > +}
> > +
> > +static int intel_dp_common_rates(struct intel_dp *intel_dp,
> > +				 int *common_rates)
> > +{
> > +	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(intel_dp, &source_rates);
> > +
> > +	return intersect_rates(source_rates, source_len,
> > +			       sink_rates, sink_len,
> > +			       common_rates);
> > +}
> > +
> >  static enum drm_mode_status
> >  intel_dp_mode_valid(struct drm_connector *connector,
> >  		    struct drm_display_mode *mode)
> > @@ -1256,60 +1331,22 @@ intel_dp_aux_init(struct intel_dp *intel_dp,
> > struct intel_connector *connector)
> >  	intel_dp->aux.transfer = intel_dp_aux_transfer;
> >  }
> >  
> > -static int
> > -intel_dp_sink_rates(struct intel_dp *intel_dp, const int
> > **sink_rates)
> > -{
> > -	if (intel_dp->num_sink_rates) {
> > -		*sink_rates = intel_dp->sink_rates;
> > -		return intel_dp->num_sink_rates;
> > -	}
> > -
> > -	*sink_rates = default_rates;
> > -
> > -	return (intel_dp_max_link_bw(intel_dp) >> 3) + 1;
> > -}
> > -
> >  bool intel_dp_source_supports_hbr2(struct intel_dp *intel_dp)
> >  {
> >  	struct intel_digital_port *dig_port =
> > dp_to_dig_port(intel_dp);
> > -	struct drm_device *dev = dig_port->base.base.dev;
> > +	struct drm_i915_private *dev_priv = to_i915(dig_port-
> > >base.base.dev);
> >  
> >  	/* WaDisableHBR2:skl */
> > -	if (IS_SKL_REVID(dev, 0, SKL_REVID_B0))
> > +	if (IS_SKL_REVID(dev_priv, 0, SKL_REVID_B0))
> >  		return false;
> >  
> > -	if ((IS_HASWELL(dev) && !IS_HSW_ULX(dev)) ||
> > IS_BROADWELL(dev) ||
> > -	    (INTEL_INFO(dev)->gen >= 9))
> > +	if ((IS_HASWELL(dev_priv) && !IS_HSW_ULX(dev_priv)) ||
> > +	    IS_BROADWELL(dev_priv) || (INTEL_GEN(dev_priv) >= 9))
> >  		return true;
> >  	else
> >  		return false;
> >  }
> >  
> > -static int
> > -intel_dp_source_rates(struct intel_dp *intel_dp, const int
> > **source_rates)
> > -{
> > -	struct intel_digital_port *dig_port =
> > dp_to_dig_port(intel_dp);
> > -	struct drm_device *dev = dig_port->base.base.dev;
> > -	int size;
> > -
> > -	if (IS_BROXTON(dev)) {
> > -		*source_rates = bxt_rates;
> > -		size = ARRAY_SIZE(bxt_rates);
> > -	} else if (IS_SKYLAKE(dev) || IS_KABYLAKE(dev)) {
> > -		*source_rates = skl_rates;
> > -		size = ARRAY_SIZE(skl_rates);
> > -	} else {
> > -		*source_rates = default_rates;
> > -		size = ARRAY_SIZE(default_rates);
> > -	}
> > -
> > -	/* This depends on the fact that 5.4 is last value in the
> > array */
> > -	if (!intel_dp_source_supports_hbr2(intel_dp))
> > -		size--;
> > -
> > -	return size;
> > -}
> > -
> >  static void
> >  intel_dp_set_clock(struct intel_encoder *encoder,
> >  		   struct intel_crtc_state *pipe_config)
> > @@ -1343,43 +1380,6 @@ intel_dp_set_clock(struct intel_encoder
> > *encoder,
> >  	}
> >  }
> >  
> > -static int intersect_rates(const int *source_rates, int source_len,
> > -			   const int *sink_rates, int sink_len,
> > -			   int *common_rates)
> > -{
> > -	int i = 0, j = 0, k = 0;
> > -
> > -	while (i < source_len && j < sink_len) {
> > -		if (source_rates[i] == sink_rates[j]) {
> > -			if (WARN_ON(k >= DP_MAX_SUPPORTED_RATES))
> > -				return k;
> > -			common_rates[k] = source_rates[i];
> > -			++k;
> > -			++i;
> > -			++j;
> > -		} else if (source_rates[i] < sink_rates[j]) {
> > -			++i;
> > -		} else {
> > -			++j;
> > -		}
> > -	}
> > -	return k;
> > -}
> > -
> > -static int intel_dp_common_rates(struct intel_dp *intel_dp,
> > -				 int *common_rates)
> > -{
> > -	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(intel_dp, &source_rates);
> > -
> > -	return intersect_rates(source_rates, source_len,
> > -			       sink_rates, sink_len,
> > -			       common_rates);
> > -}
> > -
> >  static void snprintf_int_array(char *str, size_t len,
> >  			       const int *array, int nelem)
> >  {
> -- 
> Mika Kahola - Intel OTC
> 
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2016-09-15 19:07 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-14  1:08 [PATCH 0/5] Remaining patches for upfront link training on DDI platforms Manasi Navare
2016-09-14  1:08 ` [PATCH v5 1/5] drm/i915: Fallback to lower link rate and lane count during link training Manasi Navare
2016-09-14  8:15   ` Mika Kahola
2016-09-15 19:56     ` Manasi Navare
2016-09-14  1:08 ` [PATCH v3 2/5] drm/i915: Remove the link rate and lane count loop in compute config Manasi Navare
2016-09-14  1:08 ` [PATCH v2 3/5] drm/i915: Change the placement of some static functions in intel_dp.c Manasi Navare
2016-09-15  7:41   ` Mika Kahola
2016-09-15 19:08     ` Manasi Navare [this message]
2016-09-14  1:08 ` [PATCH v17 4/5] drm/i915/dp: Enable Upfront link training on DDI platforms Manasi Navare
2016-09-14  1:08 ` [PATCH v3 5/5] drm/i915/dp/mst: Add support for upfront link training for DP MST Manasi Navare
2016-09-15 17:48   ` Pandiyan, Dhinakaran
2016-09-15 19:25     ` Manasi Navare
2016-09-19 17:03       ` Jim Bride
2016-09-19 17:22         ` Manasi Navare
2016-09-14  5:38 ` ✓ Fi.CI.BAT: success for Remaining patches for upfront link training on DDI platforms Patchwork
2016-09-16  0:03 ` [PATCH 0/6] " Manasi Navare
2016-09-16  0:03   ` [PATCH v6 1/6] drm/i915: Fallback to lower link rate and lane count during link training Manasi Navare
2016-09-16  9:29     ` Mika Kahola
2016-09-16 18:45     ` [PATCH v7 " Manasi Navare
2016-09-26 13:39       ` Jani Nikula
2016-09-27 15:25         ` Manasi Navare
2016-09-27 17:07           ` Jani Nikula
2016-09-29  6:41             ` Manasi Navare
2016-09-29 11:26               ` Jani Nikula
2016-09-29 11:44                 ` Chris Wilson
2016-09-29 15:10                   ` Ville Syrjälä
2016-09-29 15:48                     ` Jani Nikula
2016-09-29 16:05                       ` Manasi Navare
2016-09-29 23:17                         ` Manasi Navare
2016-10-03 23:29                           ` Manasi Navare
2016-09-16  0:04   ` [PATCH v3 2/6] drm/i915: Remove the link rate and lane count loop in compute config Manasi Navare
2016-09-26 13:41     ` Jani Nikula
2016-09-27 13:39       ` Jani Nikula
2016-09-27 22:13         ` Manasi Navare
2016-09-28  7:14           ` Jani Nikula
2016-09-28 22:30             ` Manasi Navare
2016-09-27 21:55       ` Manasi Navare
2016-09-28  7:38         ` Jani Nikula
2016-09-28 16:45           ` Manasi Navare
2016-09-29 14:52             ` Jani Nikula
2016-09-16  0:04   ` [PATCH v3 3/6] drm/i915: Change the placement of some static functions in intel_dp.c Manasi Navare
2016-09-16  8:12     ` Mika Kahola
2016-09-16  0:04   ` [PATCH 4/6] drm/i915: Code cleanup to use dev_priv and INTEL_GEN Manasi Navare
2016-09-16  7:40     ` Mika Kahola
2016-09-26 13:45     ` Jani Nikula
2016-09-28  0:03       ` Manasi Navare
2016-09-16  0:04   ` [PATCH v17 5/6] drm/i915/dp: Enable Upfront link training on DDI platforms Manasi Navare
2016-09-20 22:04     ` [PATCH v18 " Manasi Navare
2016-09-27 13:59       ` Jani Nikula
2016-09-29 12:15       ` Jani Nikula
2016-09-29 16:05         ` Jani Nikula
2016-09-16  0:04   ` [PATCH v3 6/6] drm/i915/dp/mst: Add support for upfront link training for DP MST Manasi Navare
2016-09-16  0:47   ` ✓ Fi.CI.BAT: success for series starting with [v6,1/6] drm/i915: Fallback to lower link rate and lane count during link training Patchwork
2016-09-16 19:25   ` ✓ Fi.CI.BAT: success for series starting with [v7,1/6] drm/i915: Fallback to lower link rate and lane count during link training (rev2) Patchwork
2016-09-20  8:45   ` [PATCH 0/6] Remaining patches for upfront link training on DDI platforms Jani Nikula
2016-09-20 22:49   ` ✓ Fi.CI.BAT: success for series starting with [v7,1/6] drm/i915: Fallback to lower link rate and lane count during link training (rev3) 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=20160915190802.GA15527@intel.com \
    --to=manasi.d.navare@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=mika.kahola@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.