public inbox for intel-gfx@lists.freedesktop.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 10/11] drm/i915: Share {csc, gamma}_enable calculation for ilk/snb vs. ivb+
Date: Thu, 3 Nov 2022 15:55:50 +0530	[thread overview]
Message-ID: <e370fcf1-30fc-08ef-27ba-859bccf15212@intel.com> (raw)
In-Reply-To: <20221026113906.10551-11-ville.syrjala@linux.intel.com>

LGTM.

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

On 10/26/2022 5:09 PM, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> ilk/snb vs. ivb+ hardware is mostly identical except for the addition
> of the split gamma mode on ivb. Thus we can share the csc_enable
> and gamma_enable calculation for both variants. Pull that stuff
> into a few helpers.
>
> Note that this also fills in the missing ctm/degamma stuff into
> ilk_color_check() pretty much, so for good measure let's also
> add a few extra checks relating to that, although we still don't
> expose ctm/degamma to userspace. But now it'll be trivial to do
> so if we wish.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>   drivers/gpu/drm/i915/display/intel_color.c | 49 ++++++++++++++--------
>   1 file changed, 32 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_color.c b/drivers/gpu/drm/i915/display/intel_color.c
> index 926784f266f2..33871bfacee7 100644
> --- a/drivers/gpu/drm/i915/display/intel_color.c
> +++ b/drivers/gpu/drm/i915/display/intel_color.c
> @@ -1442,6 +1442,20 @@ static int chv_color_check(struct intel_crtc_state *crtc_state)
>   	return 0;
>   }
>   
> +static bool ilk_gamma_enable(const struct intel_crtc_state *crtc_state)
> +{
> +	return (crtc_state->hw.gamma_lut ||
> +		crtc_state->hw.degamma_lut) &&
> +		!crtc_state->c8_planes;
> +}
> +
> +static bool ilk_csc_enable(const struct intel_crtc_state *crtc_state)
> +{
> +	return crtc_state->output_format != INTEL_OUTPUT_FORMAT_RGB ||
> +		ilk_csc_limited_range(crtc_state) ||
> +		crtc_state->hw.ctm;
> +}
> +
>   static u32 ilk_gamma_mode(const struct intel_crtc_state *crtc_state)
>   {
>   	if (!crtc_state->gamma_enable ||
> @@ -1487,22 +1501,29 @@ static void ilk_assign_luts(struct intel_crtc_state *crtc_state)
>   
>   static int ilk_color_check(struct intel_crtc_state *crtc_state)
>   {
> +	struct drm_i915_private *i915 = to_i915(crtc_state->uapi.crtc->dev);
>   	int ret;
>   
>   	ret = check_luts(crtc_state);
>   	if (ret)
>   		return ret;
>   
> -	crtc_state->gamma_enable =
> -		crtc_state->hw.gamma_lut &&
> -		!crtc_state->c8_planes;
> +	if (crtc_state->hw.degamma_lut && crtc_state->hw.gamma_lut) {
> +		drm_dbg_kms(&i915->drm,
> +			    "Degamma and gamma together are not possible\n");
> +		return -EINVAL;
> +	}
>   
> -	/*
> -	 * We don't expose the ctm on ilk/snb currently, also RGB
> -	 * limited range output is handled by the hw automagically.
> -	 */
> -	crtc_state->csc_enable =
> -		crtc_state->output_format != INTEL_OUTPUT_FORMAT_RGB;
> +	if (crtc_state->output_format != INTEL_OUTPUT_FORMAT_RGB &&
> +	    crtc_state->hw.ctm) {
> +		drm_dbg_kms(&i915->drm,
> +			    "YCbCr and CTM together are not possible\n");
> +		return -EINVAL;
> +	}
> +
> +	crtc_state->gamma_enable = ilk_gamma_enable(crtc_state);
> +
> +	crtc_state->csc_enable = ilk_csc_enable(crtc_state);
>   
>   	crtc_state->gamma_mode = ilk_gamma_mode(crtc_state);
>   
> @@ -1546,7 +1567,6 @@ static u32 ivb_csc_mode(const struct intel_crtc_state *crtc_state)
>   static int ivb_color_check(struct intel_crtc_state *crtc_state)
>   {
>   	struct drm_i915_private *i915 = to_i915(crtc_state->uapi.crtc->dev);
> -	bool limited_color_range = ilk_csc_limited_range(crtc_state);
>   	int ret;
>   
>   	ret = check_luts(crtc_state);
> @@ -1567,14 +1587,9 @@ static int ivb_color_check(struct intel_crtc_state *crtc_state)
>   		return -EINVAL;
>   	}
>   
> -	crtc_state->gamma_enable =
> -		(crtc_state->hw.gamma_lut ||
> -		 crtc_state->hw.degamma_lut) &&
> -		!crtc_state->c8_planes;
> +	crtc_state->gamma_enable = ilk_gamma_enable(crtc_state);
>   
> -	crtc_state->csc_enable =
> -		crtc_state->output_format != INTEL_OUTPUT_FORMAT_RGB ||
> -		crtc_state->hw.ctm || limited_color_range;
> +	crtc_state->csc_enable = ilk_csc_enable(crtc_state);
>   
>   	crtc_state->gamma_mode = ivb_gamma_mode(crtc_state);
>   

  reply	other threads:[~2022-11-03 10:26 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-26 11:38 [Intel-gfx] [PATCH 00/11] drm/i915: More gamma work Ville Syrjala
2022-10-26 11:38 ` [Intel-gfx] [PATCH 01/11] drm/i915: Use sizeof(variable) instead sizeof(type) Ville Syrjala
2022-11-03  5:29   ` Nautiyal, Ankit K
2022-10-26 11:38 ` [Intel-gfx] [PATCH 02/11] drm/i915: Use _MMIO_PIPE() for SKL_BOTTOM_COLOR Ville Syrjala
2022-11-03  5:38   ` Nautiyal, Ankit K
2022-10-26 11:38 ` [Intel-gfx] [PATCH 03/11] drm/i915: s/dev_priv/i915/ in intel_color.c Ville Syrjala
2022-11-03  5:52   ` Nautiyal, Ankit K
2022-10-26 11:38 ` [Intel-gfx] [PATCH 04/11] drm/i915: s/icl_load_gcmax/ivb_load_lut_max/ Ville Syrjala
2022-11-03  6:19   ` Nautiyal, Ankit K
2022-11-03  9:34     ` Ville Syrjälä
2022-11-03 10:28       ` Nautiyal, Ankit K
2022-10-26 11:39 ` [Intel-gfx] [PATCH 05/11] drm/i915: Split ivb_load_lut_ext_max() into two parts Ville Syrjala
2022-11-03  6:31   ` Nautiyal, Ankit K
2022-10-26 11:39 ` [Intel-gfx] [PATCH 06/11] drm/i915: Deconfuse the ilk+ 12.4 LUT entry functions Ville Syrjala
2022-11-03  7:37   ` Nautiyal, Ankit K
2022-11-03  9:37   ` Ville Syrjälä
2022-10-26 11:39 ` [Intel-gfx] [PATCH 07/11] drm/i915: Pass limited_range explicitly to ilk_csc_convert_ctm() Ville Syrjala
2022-11-03 10:04   ` Nautiyal, Ankit K
2022-10-26 11:39 ` [Intel-gfx] [PATCH 08/11] drm/i915: Reuse ilk_gamma_mode() on ivb+ Ville Syrjala
2022-11-03 10:09   ` Nautiyal, Ankit K
2022-10-26 11:39 ` [Intel-gfx] [PATCH 09/11] drm/i915: Reject YCbCr output with degamma+gamma on pre-icl Ville Syrjala
2022-11-03 10:14   ` Nautiyal, Ankit K
2022-10-26 11:39 ` [Intel-gfx] [PATCH 10/11] drm/i915: Share {csc, gamma}_enable calculation for ilk/snb vs. ivb+ Ville Syrjala
2022-11-03 10:25   ` Nautiyal, Ankit K [this message]
2022-10-26 11:39 ` [Intel-gfx] [PATCH 11/11] drm/i915: Create resized LUTs for ivb+ split gamma mode Ville Syrjala
2022-11-04  5:19   ` Nautiyal, Ankit K
2022-11-04  9:42     ` Ville Syrjälä
2022-11-10  4:05       ` Nautiyal, Ankit K
2022-11-10  7:23         ` Ville Syrjälä
2022-10-26 12:27 ` [Intel-gfx] ✗ Fi.CI.SPARSE: warning for drm/i915: More gamma work Patchwork
2022-10-26 12:50 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2022-10-26 23:25 ` [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=e370fcf1-30fc-08ef-27ba-859bccf15212@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