Re: [PATCH v4] drm/i915: use for_each_pipe loop to assign crtc_mask

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

 



On Sat, Sep 08, 2018 at 11:40:48AM +0530, Mahesh Kumar wrote:
> This cleanup patch makes changes to use for_each_pipe loop
> during bit-mask assignment of allowed crtc with encoder.
> 
> changes:
>  - use BIT(i) macro instead of (1 << i) (Chris)
> changes from V2:
>  - use int for consistency (Jani)
> changes from V3:
>  - instead use enum pipe (Ville)
> 
> Cc: Jani Nikula <jani.nikula@xxxxxxxxx>
> Cc: Rodrigo Vivi <rodrigo.vivi@xxxxxxxxx>
> Signed-off-by: Mahesh Kumar <mahesh1.kumar@xxxxxxxxx>
> ---
>  drivers/gpu/drm/i915/intel_ddi.c  | 4 +++-
>  drivers/gpu/drm/i915/intel_dp.c   | 5 ++++-
>  drivers/gpu/drm/i915/intel_hdmi.c | 5 ++++-
>  3 files changed, 11 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
> index cd01a09c5e0f..0ef2448fd350 100644
> --- a/drivers/gpu/drm/i915/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/intel_ddi.c
> @@ -3751,6 +3751,7 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
>  	struct intel_encoder *intel_encoder;
>  	struct drm_encoder *encoder;
>  	bool init_hdmi, init_dp, init_lspcon = false;
> +	enum pipe pipe;
>  
>  
>  	init_hdmi = (dev_priv->vbt.ddi_port_info[port].supports_dvi ||
> @@ -3801,8 +3802,9 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
>  	intel_encoder->type = INTEL_OUTPUT_DDI;
>  	intel_encoder->power_domain = intel_port_to_power_domain(port);
>  	intel_encoder->port = port;
> -	intel_encoder->crtc_mask = (1 << 0) | (1 << 1) | (1 << 2);
>  	intel_encoder->cloneable = 0;
> +	for_each_pipe(dev_priv, pipe)
> +		intel_encoder->crtc_mask |= BIT(pipe);

This makes sense.

>  
>  	if (INTEL_GEN(dev_priv) >= 11)
>  		intel_dig_port->saved_port_bits = I915_READ(DDI_BUF_CTL(port)) &
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index 436c22de33b6..7302b5807884 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -6709,7 +6709,10 @@ bool intel_dp_init(struct drm_i915_private *dev_priv,
>  		else
>  			intel_encoder->crtc_mask = (1 << 0) | (1 << 1);
>  	} else {
> -		intel_encoder->crtc_mask = (1 << 0) | (1 << 1) | (1 << 2);
> +		enum pipe pipe;
> +
> +		for_each_pipe(dev_priv, pipe)
> +			intel_encoder->crtc_mask |= BIT(pipe);

These I'm not so sure. Why only DP and HDMI and not the rest?
Considering everything !ddi is legacy I don't think there's any
real point in future proofing them agaisnt pipe D+.

And why do I now have a feeling someone sent a patch earlier to fix
these all up to use BIT(). Where did that patch go? Ah, it was me :)
https://lists.freedesktop.org/archives/dri-devel/2018-June/180155.html
And I guess I never pushed it.

OK, so I'd say drop the dp/hdmi changes and this is
Reviewed-by: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>

I can then rebase my stuff on top and resend it.

>  	}
>  	intel_encoder->cloneable = 0;
>  	intel_encoder->port = port;
> diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
> index a2dab0b6bde6..0d4c6f565d65 100644
> --- a/drivers/gpu/drm/i915/intel_hdmi.c
> +++ b/drivers/gpu/drm/i915/intel_hdmi.c
> @@ -2468,7 +2468,10 @@ void intel_hdmi_init(struct drm_i915_private *dev_priv,
>  		else
>  			intel_encoder->crtc_mask = (1 << 0) | (1 << 1);
>  	} else {
> -		intel_encoder->crtc_mask = (1 << 0) | (1 << 1) | (1 << 2);
> +		enum pipe pipe;
> +
> +		for_each_pipe(dev_priv, pipe)
> +			intel_encoder->crtc_mask |= BIT(pipe);
>  	}
>  	intel_encoder->cloneable = 1 << INTEL_OUTPUT_ANALOG;
>  	/*
> -- 
> 2.16.2

-- 
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://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