Re: [PATCH 03/13] drm/i915: Don't copy the DP source rates arrays

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Mar 16, 2015 at 05:03:28PM +0530, sonika wrote:
> 
> On Monday 16 March 2015 04:25 PM, Ville Syrjälä wrote:
> > On Mon, Mar 16, 2015 at 03:07:05PM +0530, Jindal, Sonika wrote:
> >>
> >> On 3/16/2015 3:04 PM, Ville Syrjälä wrote:
> >>> On Mon, Mar 16, 2015 at 02:43:19PM +0530, Jindal, Sonika wrote:
> >>>>
> >>>> On 3/12/2015 8:40 PM, ville.syrjala@xxxxxxxxxxxxxxx wrote:
> >>>>> From: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>
> >>>>>
> >>>>> The source rates don't change, so we can just point the caller at the
> >>>>> const arrays.
> >>>>>
> >>>>> Signed-off-by: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>
> >>>>> ---
> >>>>>     drivers/gpu/drm/i915/intel_dp.c | 24 ++++++++++--------------
> >>>>>     1 file changed, 10 insertions(+), 14 deletions(-)
> >>>>>
> >>>>> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> >>>>> index d638f5e..537f1d0 100644
> >>>>> --- a/drivers/gpu/drm/i915/intel_dp.c
> >>>>> +++ b/drivers/gpu/drm/i915/intel_dp.c
> >>>>> @@ -1157,22 +1157,18 @@ intel_read_sink_rates(struct intel_dp *intel_dp, int *sink_rates)
> >>>>>     }
> >>>>>
> >>>>>     static int
> >>>>> -intel_read_source_rates(struct intel_dp *intel_dp, int *source_rates)
> >>>>> +intel_dp_source_rates(struct intel_dp *intel_dp, const int **source_rates)
> >>>>>     {
> >>>>>     	struct drm_device *dev = intel_dp_to_dev(intel_dp);
> >>>>> -	int i;
> >>>>> -	int max_default_rate;
> >>>>>
> >>>>> -	if (INTEL_INFO(dev)->gen >= 9 && intel_dp->supported_rates[0]) {
> >>>>> -		for (i = 0; i < ARRAY_SIZE(gen9_rates); ++i)
> >>>>> -			source_rates[i] = gen9_rates[i];
> >>>>> -	} else {
> >>>>> -		/* Index of the max_link_bw supported + 1 */
> >>>>> -		max_default_rate = (intel_dp_max_link_bw(intel_dp) >> 3) + 1;
> >>>>> -		for (i = 0; i < max_default_rate; ++i)
> >>>>> -			source_rates[i] = default_rates[i];
> >>>>> +	if (INTEL_INFO(dev)->gen >= 9) {
> >>>>> +		*source_rates = gen9_rates;
> >>>>> +		return ARRAY_SIZE(gen9_rates);
> >>>>>     	}
> >>>>> -	return i;
> >>>>> +
> >>>>> +	*source_rates = default_rates;
> >>>>> +
> >>>>> +	return (intel_dp_max_link_bw(intel_dp) >> 3) + 1;
> >>>> Now when intel_dp_max_link_bw doesn't do much, can this be simply
> >>>> ARRAY_SIZE(default_rates)? and we can get away with this function.
> >>> If you'll look at patch 6 you'll see me moving the source limitations
> >>> from intel_dp_max_link_bw() to intel_dp_source_rates().
> >>>
> >> Yes, thats why I think we can remove the intel_dp_max_link_bw function
> >> altogether.
> > We still need it to limit the sink rates appropriately when
> > SUPPORTED_LINK_RATES is not present.
> But with this series, haven't we already removed that? We are not using 
> it anymore.

SUPPORTED_LINK_RATES may not be there. We obviously still need to
find out what's the maximum link rate supported by the sink when it's
not available. Hence we still need intel_dp_max_link_bw() to decode
the MAX_LINK_RATE (actually the only thing it does after my
patches is filter out invalid values of MAX_LINK_RATE and issue a
warning).

> >>>>>     }
> >>>>>
> >>>>>     static void
> >>>>> @@ -1269,12 +1265,12 @@ intel_dp_compute_config(struct intel_encoder *encoder,
> >>>>>     	int link_avail, link_clock;
> >>>>>     	int sink_rates[8];
> >>>>>     	int supported_rates[8] = {0};
> >>>>> -	int source_rates[8];
> >>>>> +	const int *source_rates;
> >>>>>     	int source_len, sink_len, supported_len;
> >>>>>
> >>>>>     	sink_len = intel_read_sink_rates(intel_dp, sink_rates);
> >>>>>
> >>>>> -	source_len = intel_read_source_rates(intel_dp, source_rates);
> >>>>> +	source_len = intel_dp_source_rates(intel_dp, &source_rates);
> >>>>>
> >>>>>     	supported_len = intel_supported_rates(source_rates, source_len,
> >>>>>     				sink_rates, sink_len, supported_rates);
> >>>>>

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





[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux