[Intel-gfx] [PATCH 02/12] drm/i915: Read PSR caps/intermediate freqs/etc. only once on eDP

Chris Wilson chris at chris-wilson.co.uk
Thu Jul 28 17:30:47 UTC 2016


On Thu, Jul 28, 2016 at 05:50:38PM +0300, ville.syrjala at linux.intel.com wrote:
> From: Ville Syrjälä <ville.syrjala at linux.intel.com>
> 
> Currently we re-read a bunch of static eDP panel caps from the DPCD
> over and over again. Let's do it only once to save some time and effort.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>

>  static bool
>  intel_dp_get_dpcd(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(dev);
> +	bool init_edp_dpcd = is_edp(intel_dp) &&
> +		intel_dp->dpcd[DP_DPCD_REV] == 0;
>  
>  	if (drm_dp_dpcd_read(&intel_dp->aux, 0x000, intel_dp->dpcd,
>  			     sizeof(intel_dp->dpcd)) < 0)

> +	if (init_edp_dpcd)
> +		intel_edp_get_dpcd(intel_dp);

I have to admit it took me a few passes to realise how this achieves
init once.

	bool intel_dp_dpcd_is_unset(intel_dp)
	{
		return intel_dp->dpcd[DP_DPCD_REV] == 0;
	}

Not really sure how else to make it clear to the causal reader that test
is only true on the first call.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list