Re: [PATCH 1/2] drm/i915/dsc: abstract helpers to get bigjoiner primary/secondary crtc

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

 




> -----Original Message-----
> From: Nikula, Jani <jani.nikula@xxxxxxxxx>
> Sent: Thursday, June 3, 2021 5:59 PM
> To: intel-gfx@xxxxxxxxxxxxxxxxxxxxx
> Cc: Nikula, Jani <jani.nikula@xxxxxxxxx>; Manna, Animesh
> <animesh.manna@xxxxxxxxx>; Navare, Manasi D
> <manasi.d.navare@xxxxxxxxx>; Kulkarni, Vandita <vandita.kulkarni@xxxxxxxxx>
> Subject: [PATCH 1/2] drm/i915/dsc: abstract helpers to get bigjoiner
> primary/secondary crtc
> 
> Add a single point of truth for figuring out the primary/secondary crtc for
> bigjoiner instead of duplicating the magic pipe +/- 1 in multiple places.
> 
> Also fix the pipe validity checks to properly take non-contiguous pipes into
> account. The current checks may theoretically overflow
> i915->pipe_to_crtc_mapping[pipe], albeit with a warning, due to fused
> off pipes, as INTEL_NUM_PIPES() returns the actual number of pipes on the
> platform, and the check is for INTEL_NUM_PIPES() == pipe + 1.
> 
> Prefer primary/secondary terminology going forward.
> 
> Fixes: 8a029c113b17 ("drm/i915/dp: Modify VDSC helpers to configure DSC for
> Bigjoiner slave")
> Fixes: d961eb20adb6 ("drm/i915/bigjoiner: atomic commit changes for
> uncompressed joiner")
> Cc: Animesh Manna <animesh.manna@xxxxxxxxx>
> Cc: Manasi Navare <manasi.d.navare@xxxxxxxxx>
> Cc: Vandita Kulkarni <vandita.kulkarni@xxxxxxxxx>
> Signed-off-by: Jani Nikula <jani.nikula@xxxxxxxxx>

Changes look good to me.
Reviewed-by: Animesh Manna <animesh.manna@xxxxxxxxx>

> ---
>  drivers/gpu/drm/i915/display/intel_display.c |  7 ++--
>  drivers/gpu/drm/i915/display/intel_vdsc.c    | 42 ++++++++++++++------
>  drivers/gpu/drm/i915/display/intel_vdsc.h    |  2 +
>  3 files changed, 35 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c
> b/drivers/gpu/drm/i915/display/intel_display.c
> index caf0414e0b50..1b213ed42396 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -9603,7 +9603,6 @@ static int intel_atomic_check_bigjoiner(struct
> intel_atomic_state *state,
>  					struct intel_crtc_state *old_crtc_state,
>  					struct intel_crtc_state
> *new_crtc_state)  {
> -	struct drm_i915_private *dev_priv = to_i915(state->base.dev);
>  	struct intel_crtc_state *slave_crtc_state, *master_crtc_state;
>  	struct intel_crtc *slave, *master;
> 
> @@ -9619,15 +9618,15 @@ static int intel_atomic_check_bigjoiner(struct
> intel_atomic_state *state,
>  	if (!new_crtc_state->bigjoiner)
>  		return 0;
> 
> -	if (1 + crtc->pipe >= INTEL_NUM_PIPES(dev_priv)) {
> +	slave = intel_dsc_get_bigjoiner_secondary(crtc);
> +	if (!slave) {
>  		DRM_DEBUG_KMS("[CRTC:%d:%s] Big joiner configuration
> requires "
>  			      "CRTC + 1 to be used, doesn't exist\n",
>  			      crtc->base.base.id, crtc->base.name);
>  		return -EINVAL;
>  	}
> 
> -	slave = new_crtc_state->bigjoiner_linked_crtc =
> -		intel_get_crtc_for_pipe(dev_priv, crtc->pipe + 1);
> +	new_crtc_state->bigjoiner_linked_crtc = slave;
>  	slave_crtc_state = intel_atomic_get_crtc_state(&state->base, slave);
>  	master = crtc;
>  	if (IS_ERR(slave_crtc_state))
> diff --git a/drivers/gpu/drm/i915/display/intel_vdsc.c
> b/drivers/gpu/drm/i915/display/intel_vdsc.c
> index 19cd9531c115..1fd81bd3ea09 100644
> --- a/drivers/gpu/drm/i915/display/intel_vdsc.c
> +++ b/drivers/gpu/drm/i915/display/intel_vdsc.c
> @@ -1106,6 +1106,32 @@ static i915_reg_t dss_ctl2_reg(const struct
> intel_crtc_state *crtc_state)
>  	return is_pipe_dsc(crtc_state) ? ICL_PIPE_DSS_CTL2(pipe) : DSS_CTL2;  }
> 
> +struct intel_crtc *
> +intel_dsc_get_bigjoiner_secondary(const struct intel_crtc
> +*primary_crtc) {
> +	struct drm_i915_private *i915 = to_i915(primary_crtc->base.dev);
> +	enum pipe pipe = primary_crtc->pipe + 1;
> +
> +	if (drm_WARN_ON(&i915->drm, pipe >= I915_MAX_PIPES ||
> +			!(INTEL_INFO(i915)->pipe_mask & BIT(pipe))))
> +		return NULL;
> +
> +	return intel_get_crtc_for_pipe(i915, pipe); }
> +
> +struct intel_crtc *
> +intel_dsc_get_bigjoiner_primary(const struct intel_crtc
> +*secondary_crtc) {
> +	struct drm_i915_private *i915 = to_i915(secondary_crtc->base.dev);
> +	enum pipe pipe = secondary_crtc->pipe - 1;
> +
> +	if (drm_WARN_ON(&i915->drm, pipe <= INVALID_PIPE ||
> +			!(INTEL_INFO(i915)->pipe_mask & BIT(pipe))))
> +		return NULL;
> +
> +	return intel_get_crtc_for_pipe(i915, pipe); }
> +
>  void intel_uncompressed_joiner_enable(const struct intel_crtc_state
> *crtc_state)  {
>  	struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
> @@ -1178,15 +1204,11 @@ void intel_uncompressed_joiner_get_config(struct
> intel_crtc_state *crtc_state)
>  	dss_ctl1 = intel_de_read(dev_priv, dss_ctl1_reg(crtc_state));
>  	if (dss_ctl1 & UNCOMPRESSED_JOINER_MASTER) {
>  		crtc_state->bigjoiner = true;
> -		if (!WARN_ON(INTEL_NUM_PIPES(dev_priv) == crtc->pipe + 1))
> -			crtc_state->bigjoiner_linked_crtc =
> -				intel_get_crtc_for_pipe(dev_priv, crtc->pipe +
> 1);
> +		crtc_state->bigjoiner_linked_crtc =
> +intel_dsc_get_bigjoiner_secondary(crtc);
>  	} else if (dss_ctl1 & UNCOMPRESSED_JOINER_SLAVE) {
>  		crtc_state->bigjoiner = true;
>  		crtc_state->bigjoiner_slave = true;
> -		if (!WARN_ON(crtc->pipe == PIPE_A))
> -			crtc_state->bigjoiner_linked_crtc =
> -				intel_get_crtc_for_pipe(dev_priv, crtc->pipe -
> 1);
> +		crtc_state->bigjoiner_linked_crtc =
> +intel_dsc_get_bigjoiner_primary(crtc);
>  	}
>  }
> 
> @@ -1224,13 +1246,9 @@ void intel_dsc_get_config(struct intel_crtc_state
> *crtc_state)
> 
>  		if (!(dss_ctl1 & MASTER_BIG_JOINER_ENABLE)) {
>  			crtc_state->bigjoiner_slave = true;
> -			if (!WARN_ON(crtc->pipe == PIPE_A))
> -				crtc_state->bigjoiner_linked_crtc =
> -					intel_get_crtc_for_pipe(dev_priv, crtc-
> >pipe - 1);
> +			crtc_state->bigjoiner_linked_crtc =
> +intel_dsc_get_bigjoiner_primary(crtc);
>  		} else {
> -			if (!WARN_ON(INTEL_NUM_PIPES(dev_priv) == crtc-
> >pipe + 1))
> -				crtc_state->bigjoiner_linked_crtc =
> -					intel_get_crtc_for_pipe(dev_priv, crtc-
> >pipe + 1);
> +			crtc_state->bigjoiner_linked_crtc =
> +intel_dsc_get_bigjoiner_secondary(crtc);
>  		}
>  	}
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_vdsc.h
> b/drivers/gpu/drm/i915/display/intel_vdsc.h
> index fe4d45561253..da95944f4de2 100644
> --- a/drivers/gpu/drm/i915/display/intel_vdsc.h
> +++ b/drivers/gpu/drm/i915/display/intel_vdsc.h
> @@ -22,5 +22,7 @@ void intel_uncompressed_joiner_get_config(struct
> intel_crtc_state *crtc_state);  void intel_dsc_get_config(struct intel_crtc_state
> *crtc_state);  enum intel_display_power_domain
> intel_dsc_power_domain(const struct intel_crtc_state *crtc_state);
> +struct intel_crtc *intel_dsc_get_bigjoiner_primary(const struct
> +intel_crtc *secondary_crtc); struct intel_crtc
> +*intel_dsc_get_bigjoiner_secondary(const struct intel_crtc
> +*primary_crtc);
> 
>  #endif /* __INTEL_VDSC_H__ */
> --
> 2.20.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx



[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux