[Intel-gfx] [PATCH 08/10] drm/i915: Assert {pre, post}_csc_lut were assigned sensibly

Shankar, Uma uma.shankar at intel.com
Wed Oct 19 07:09:24 UTC 2022



> -----Original Message-----
> From: Intel-gfx <intel-gfx-bounces at lists.freedesktop.org> On Behalf Of Ville Syrjala
> Sent: Thursday, September 29, 2022 12:45 PM
> To: intel-gfx at lists.freedesktop.org
> Subject: [Intel-gfx] [PATCH 08/10] drm/i915: Assert {pre, post}_csc_lut were
> assigned sensibly
> 
> From: Ville Syrjälä <ville.syrjala at linux.intel.com>
> 
> Since we now have the extra step from hw.(de)gamma_lut into {pre,post}_csc_lut
> let's make sure we didn't forget to assign them appropriately. Ie. basically making
> sure intel_color_check() was called when necessary (and that it did its job suitable
> well).

Looks Good to me.
Reviewed-by: Uma Shankar <uma.shankar at intel.com>

> Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_color.c   | 20 ++++++++++++++++++++
>  drivers/gpu/drm/i915/display/intel_color.h   |  1 +
>  drivers/gpu/drm/i915/display/intel_display.c |  2 ++
>  3 files changed, 23 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_color.c
> b/drivers/gpu/drm/i915/display/intel_color.c
> index 380f44720fe6..575d2a23682a 100644
> --- a/drivers/gpu/drm/i915/display/intel_color.c
> +++ b/drivers/gpu/drm/i915/display/intel_color.c
> @@ -1355,6 +1355,26 @@ static u32 i9xx_gamma_mode(struct intel_crtc_state
> *crtc_state)
>  		return GAMMA_MODE_MODE_10BIT; /* i965+ only */  }
> 
> +void intel_color_assert_luts(const struct intel_crtc_state *crtc_state)
> +{
> +	struct drm_i915_private *i915 = to_i915(crtc_state->uapi.crtc->dev);
> +
> +	/* make sure {pre,post}_csc_lut were correctly assigned */
> +	if (DISPLAY_VER(i915) >= 10 || HAS_GMCH(i915)) {
> +		drm_WARN_ON(&i915->drm,
> +			    crtc_state->pre_csc_lut != crtc_state->hw.degamma_lut);
> +		drm_WARN_ON(&i915->drm,
> +			    crtc_state->post_csc_lut != crtc_state->hw.gamma_lut);
> +	} else {
> +		drm_WARN_ON(&i915->drm,
> +			    crtc_state->pre_csc_lut != crtc_state->hw.degamma_lut
> &&
> +			    crtc_state->pre_csc_lut != crtc_state->hw.gamma_lut);
> +		drm_WARN_ON(&i915->drm,
> +			    crtc_state->post_csc_lut != crtc_state->hw.degamma_lut
> &&
> +			    crtc_state->post_csc_lut != crtc_state->hw.gamma_lut);
> +	}
> +}
> +
>  static void intel_assign_luts(struct intel_crtc_state *crtc_state)  {
>  	drm_property_replace_blob(&crtc_state->pre_csc_lut,
> diff --git a/drivers/gpu/drm/i915/display/intel_color.h
> b/drivers/gpu/drm/i915/display/intel_color.h
> index 67702451e2fd..b76f18e6c452 100644
> --- a/drivers/gpu/drm/i915/display/intel_color.h
> +++ b/drivers/gpu/drm/i915/display/intel_color.h
> @@ -24,5 +24,6 @@ int intel_color_get_gamma_bit_precision(const struct
> intel_crtc_state *crtc_stat  bool intel_color_lut_equal(struct drm_property_blob
> *blob1,
>  			   struct drm_property_blob *blob2,
>  			   u32 gamma_mode, u32 bit_precision);
> +void intel_color_assert_luts(const struct intel_crtc_state
> +*crtc_state);
> 
>  #endif /* __INTEL_COLOR_H__ */
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c
> b/drivers/gpu/drm/i915/display/intel_display.c
> index 20569b6838d1..441811ac0ab0 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -6906,6 +6906,8 @@ static int intel_atomic_check(struct drm_device *dev,
> 
>  	for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state,
>  					    new_crtc_state, i) {
> +		intel_color_assert_luts(new_crtc_state);
> +
>  		ret = intel_async_flip_check_hw(state, crtc);
>  		if (ret)
>  			goto fail;
> --
> 2.35.1



More information about the Intel-gfx mailing list