[Intel-gfx] [PATCH 3/3] drm/i915: Fix enc_to_dig_port for MST encoders

Lyude cpaul at redhat.com
Thu Aug 4 23:51:06 UTC 2016


There was some discussion that happened on the original version of this
patch:

https://patchwork.kernel.org/patch/8960831/

The general consensus was while this fixed the issue, it probably isn't
the way we want to fix it. It would be a better idea just to have
enc_to_mst_primary() or something along those lines, or just use
enc_to_mst()->primary explicitly.

On Tue, 2016-08-02 at 18:46 -0700, Dhinakaran Pandiyan wrote:
> When a MST encoder is passed to enc_to_dig_port(), the container_of()
> macro
> does not return the digital port. Handle this by returning the member
> "primary" in "struct intel_dp_mst_encoder"
> 
> Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan at intel.com>
> ---
>  drivers/gpu/drm/i915/intel_drv.h | 16 ++++++++++------
>  1 file changed, 10 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_drv.h
> b/drivers/gpu/drm/i915/intel_drv.h
> index 45020d2..66af444 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -1023,18 +1023,22 @@ intel_attached_encoder(struct drm_connector
> *connector)
>  	return to_intel_connector(connector)->encoder;
>  }
>  
> -static inline struct intel_digital_port *
> -enc_to_dig_port(struct drm_encoder *encoder)
> -{
> -	return container_of(encoder, struct intel_digital_port,
> base.base);
> -}
> -
>  static inline struct intel_dp_mst_encoder *
>  enc_to_mst(struct drm_encoder *encoder)
>  {
>  	return container_of(encoder, struct intel_dp_mst_encoder,
> base.base);
>  }
>  
> +static inline struct intel_digital_port *
> +enc_to_dig_port(struct drm_encoder *encoder)
> +{
> +	if (encoder->encoder_type == DRM_MODE_ENCODER_DPMST)
> +		return enc_to_mst(encoder)->primary;
> +	else
> +		return container_of(encoder, struct
> intel_digital_port,
> +				    base.base);
> +}
> +
>  static inline struct intel_dp *enc_to_intel_dp(struct drm_encoder
> *encoder)
>  {
>  	return &enc_to_dig_port(encoder)->dp;
-- 
Cheers,
	Lyude


More information about the Intel-gfx mailing list