Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Nautiyal, Ankit K" <ankit.k.nautiyal@intel.com>
To: Ville Syrjala <ville.syrjala@linux.intel.com>,
	<intel-gfx@lists.freedesktop.org>
Subject: Re: [Intel-gfx] [PATCH 06/12] drm/i915: Utilize crtc_state->csc on chv
Date: Thu, 6 Apr 2023 14:51:44 +0530	[thread overview]
Message-ID: <f1be66f6-bd70-c04f-3675-5e074da9bc25@intel.com> (raw)
In-Reply-To: <20230329135002.3096-7-ville.syrjala@linux.intel.com>


On 3/29/2023 7:19 PM, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Store the chv cgm csc matrix in the crtc state as well. We
> shall store it in the same place where we store the ilk+
> pipe csc matrix (as opposed to the output csc matrix).
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>   drivers/gpu/drm/i915/display/intel_color.c | 35 +++++++++++++---------
>   1 file changed, 21 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_color.c b/drivers/gpu/drm/i915/display/intel_color.c
> index a6f7eba59e12..7e8820583942 100644
> --- a/drivers/gpu/drm/i915/display/intel_color.c
> +++ b/drivers/gpu/drm/i915/display/intel_color.c
> @@ -431,10 +431,10 @@ static void icl_load_csc_matrix(const struct intel_crtc_state *crtc_state)
>   		icl_update_output_csc(crtc, &crtc_state->output_csc);
>   }
>   
> -static void chv_cgm_csc_convert_ctm(struct intel_csc_matrix *csc,
> -				    const struct drm_property_blob *blob)
> +static void chv_cgm_csc_convert_ctm(const struct intel_crtc_state *crtc_state,
> +				    struct intel_csc_matrix *csc)
>   {
> -	const struct drm_color_ctm *ctm = blob->data;
> +	const struct drm_color_ctm *ctm = crtc_state->hw.ctm->data;
>   	int i;
>   
>   	for (i = 0; i < 9; i++) {
> @@ -457,24 +457,30 @@ static void chv_cgm_csc_convert_ctm(struct intel_csc_matrix *csc,
>   }
>   
>   static void chv_load_cgm_csc(struct intel_crtc *crtc,
> -			     const struct drm_property_blob *blob)
> +			     const struct intel_csc_matrix *csc)
>   {
>   	struct drm_i915_private *i915 = to_i915(crtc->base.dev);
>   	enum pipe pipe = crtc->pipe;
> -	struct intel_csc_matrix tmp;
> -
> -	chv_cgm_csc_convert_ctm(&tmp, blob);
>   
>   	intel_de_write_fw(i915, CGM_PIPE_CSC_COEFF01(pipe),
> -			  tmp.coeff[1] << 16 | tmp.coeff[0]);
> +			  csc->coeff[1] << 16 | csc->coeff[0]);
>   	intel_de_write_fw(i915, CGM_PIPE_CSC_COEFF23(pipe),
> -			  tmp.coeff[3] << 16 | tmp.coeff[2]);
> +			  csc->coeff[3] << 16 | csc->coeff[2]);
>   	intel_de_write_fw(i915, CGM_PIPE_CSC_COEFF45(pipe),
> -			  tmp.coeff[5] << 16 | tmp.coeff[4]);
> +			  csc->coeff[5] << 16 | csc->coeff[4]);
>   	intel_de_write_fw(i915, CGM_PIPE_CSC_COEFF67(pipe),
> -			  tmp.coeff[7] << 16 | tmp.coeff[6]);
> +			  csc->coeff[7] << 16 | csc->coeff[6]);
>   	intel_de_write_fw(i915, CGM_PIPE_CSC_COEFF8(pipe),
> -			  tmp.coeff[8]);
> +			  csc->coeff[8]);
> +}
> +
> +static void chv_assign_csc(struct intel_crtc_state *crtc_state)
> +{
> +	if (crtc_state->hw.ctm) {
> +		chv_cgm_csc_convert_ctm(crtc_state, &crtc_state->csc);
> +	} else {
> +		intel_csc_clear(&crtc_state->csc);
> +	}

It does make sense to have a block for csc and another for output_csc, 
analogous to the load part.

We are anyway adding drm_Warn later, so braces can be dropped here and 
introduced in patch adding warn_ons

Otherwise the Patch looks good to me.

Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>


>   }
>   
>   /* convert hw value with given bit_precision to lut property val */
> @@ -1442,10 +1448,9 @@ static void chv_load_luts(const struct intel_crtc_state *crtc_state)
>   	struct drm_i915_private *i915 = to_i915(crtc->base.dev);
>   	const struct drm_property_blob *pre_csc_lut = crtc_state->pre_csc_lut;
>   	const struct drm_property_blob *post_csc_lut = crtc_state->post_csc_lut;
> -	const struct drm_property_blob *ctm = crtc_state->hw.ctm;
>   
>   	if (crtc_state->cgm_mode & CGM_PIPE_MODE_CSC)
> -		chv_load_cgm_csc(crtc, ctm);
> +		chv_load_cgm_csc(crtc, &crtc_state->csc);
>   
>   	if (crtc_state->cgm_mode & CGM_PIPE_MODE_DEGAMMA)
>   		chv_load_cgm_degamma(crtc, pre_csc_lut);
> @@ -1872,6 +1877,8 @@ static int chv_color_check(struct intel_crtc_state *crtc_state)
>   
>   	intel_assign_luts(crtc_state);
>   
> +	chv_assign_csc(crtc_state);
> +
>   	crtc_state->preload_luts = chv_can_preload_luts(crtc_state);
>   
>   	return 0;

  reply	other threads:[~2023-04-06  9:22 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-29 13:49 [Intel-gfx] [PATCH 00/12] drm/i915: Add CSC state readout/check Ville Syrjala
2023-03-29 13:49 ` [Intel-gfx] [PATCH 01/12] drm/i915: Fix limited range csc matrix Ville Syrjala
2023-04-06 10:56   ` Nautiyal, Ankit K
2023-04-06 11:10     ` Ville Syrjälä
2023-04-06 11:54       ` Nautiyal, Ankit K
2023-03-29 13:49 ` [Intel-gfx] [PATCH 02/12] drm/i915: Introduce intel_csc_matrix struct Ville Syrjala
2023-04-06  9:00   ` Nautiyal, Ankit K
2023-04-11  5:07     ` Ville Syrjälä
2023-04-11  5:35       ` Nautiyal, Ankit K
2023-03-29 13:49 ` [Intel-gfx] [PATCH 03/12] drm/i915: Split chv_load_cgm_csc() into pieces Ville Syrjala
2023-04-06  9:03   ` Nautiyal, Ankit K
2023-04-06  9:17     ` Nautiyal, Ankit K
2023-04-06 10:45     ` Ville Syrjälä
2023-03-29 13:49 ` [Intel-gfx] [PATCH 04/12] drm/i915: Start using struct intel_csc_matrix for chv cgm csc Ville Syrjala
2023-04-06  9:05   ` Nautiyal, Ankit K
2023-03-29 13:49 ` [Intel-gfx] [PATCH 05/12] drm/i915: Store ilk+ csc matrices in the crtc state Ville Syrjala
2023-04-06  9:12   ` Nautiyal, Ankit K
2023-03-29 13:49 ` [Intel-gfx] [PATCH 06/12] drm/i915: Utilize crtc_state->csc on chv Ville Syrjala
2023-04-06  9:21   ` Nautiyal, Ankit K [this message]
2023-03-29 13:49 ` [Intel-gfx] [PATCH 07/12] drm/i915: Sprinke a few sanity check WARNS during csc assignment Ville Syrjala
2023-04-06  9:24   ` Nautiyal, Ankit K
2023-03-29 13:49 ` [Intel-gfx] [PATCH 08/12] drm/i915: Add hardware csc readout for ilk+ Ville Syrjala
2023-04-06  9:30   ` Nautiyal, Ankit K
2023-03-29 13:49 ` [Intel-gfx] [PATCH 09/12] drm/i915: Implement chv cgm csc readout Ville Syrjala
2023-04-06  9:31   ` Nautiyal, Ankit K
2023-03-29 13:50 ` [Intel-gfx] [PATCH 10/12] drm/i915: Include the csc matrices in the crtc state dump Ville Syrjala
2023-04-06  9:49   ` Nautiyal, Ankit K
2023-03-29 13:50 ` [Intel-gfx] [PATCH 11/12] drm/i915: Hook up csc into state checker Ville Syrjala
2023-04-06  9:53   ` Nautiyal, Ankit K
2023-03-29 13:50 ` [Intel-gfx] [PATCH 12/12] drm/i915: Do state check for color management changes Ville Syrjala
2023-03-29 18:50 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Add CSC state readout/check Patchwork
2023-03-29 18:50 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2023-03-29 18:59 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2023-03-30 11:06 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f1be66f6-bd70-c04f-3675-5e074da9bc25@intel.com \
    --to=ankit.k.nautiyal@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=ville.syrjala@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox