All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Ville Syrjala <ville.syrjala@linux.intel.com>,
	intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH v2 03/18] drm/i915: Clean up 12.4bit precision palette defines
Date: Fri, 11 Nov 2022 17:13:23 +0200	[thread overview]
Message-ID: <87zgcx4j8s.fsf@intel.com> (raw)
In-Reply-To: <20221110082144.19666-4-ville.syrjala@linux.intel.com>

On Thu, 10 Nov 2022, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Use consistent bit definitions for the 12.4bit precision palette bits.
> We just define these alongside the ilk/snb register definitions and
> point to those from the icl+ superfine segment defines (and we also
> already pointed to them from the ivb+ precision palette defines).
>
> Also use the these appropriately in the LUT entry pack/unpack
> functions.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_color.c | 22 ++++++++++++----------
>  drivers/gpu/drm/i915/i915_reg.h            | 15 +++++++++------
>  2 files changed, 21 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_color.c b/drivers/gpu/drm/i915/display/intel_color.c
> index 6486a0890583..758869971e45 100644
> --- a/drivers/gpu/drm/i915/display/intel_color.c
> +++ b/drivers/gpu/drm/i915/display/intel_color.c
> @@ -485,25 +485,27 @@ static void ilk_lut_10_pack(struct drm_color_lut *entry, u32 val)
>  /* ilk+ "12.4" interpolated format (high 10 bits) */
>  static u32 ilk_lut_12p4_udw(const struct drm_color_lut *color)
>  {
> -	return (color->red >> 6) << 20 | (color->green >> 6) << 10 |
> -		(color->blue >> 6);
> +	return REG_FIELD_PREP(PREC_PALETTE_12P4_RED_UDW_MASK, color->red >> 6) |
> +		REG_FIELD_PREP(PREC_PALETTE_12P4_GREEN_UDW_MASK, color->green >> 6) |
> +		REG_FIELD_PREP(PREC_PALETTE_12P4_BLUE_UDW_MASK, color->blue >> 6);
>  }
>  
>  /* ilk+ "12.4" interpolated format (low 6 bits) */
>  static u32 ilk_lut_12p4_ldw(const struct drm_color_lut *color)
>  {
> -	return (color->red & 0x3f) << 24 | (color->green & 0x3f) << 14 |
> -		(color->blue & 0x3f) << 4;
> +	return REG_FIELD_PREP(PREC_PALETTE_12P4_RED_LDW_MASK, color->red & 0x3f) |
> +		REG_FIELD_PREP(PREC_PALETTE_12P4_GREEN_LDW_MASK, color->green & 0x3f) |
> +		REG_FIELD_PREP(PREC_PALETTE_12P4_BLUE_LDW_MASK, color->blue & 0x3f);

Same thing with masking as in an earlier patch.

Reviewed-by: Jani Nikula <jani.nikula@intel.com>

>  }
>  
>  static void ilk_lut_12p4_pack(struct drm_color_lut *entry, u32 ldw, u32 udw)
>  {
> -	entry->red = REG_FIELD_GET(PAL_PREC_MULTI_SEG_RED_UDW_MASK, udw) << 6 |
> -		REG_FIELD_GET(PAL_PREC_MULTI_SEG_RED_LDW_MASK, ldw);
> -	entry->green = REG_FIELD_GET(PAL_PREC_MULTI_SEG_GREEN_UDW_MASK, udw) << 6 |
> -		REG_FIELD_GET(PAL_PREC_MULTI_SEG_GREEN_LDW_MASK, ldw);
> -	entry->blue = REG_FIELD_GET(PAL_PREC_MULTI_SEG_BLUE_UDW_MASK, udw) << 6 |
> -		REG_FIELD_GET(PAL_PREC_MULTI_SEG_BLUE_LDW_MASK, ldw);
> +	entry->red = REG_FIELD_GET(PREC_PALETTE_12P4_RED_UDW_MASK, udw) << 6 |
> +		REG_FIELD_GET(PREC_PALETTE_12P4_RED_LDW_MASK, ldw);
> +	entry->green = REG_FIELD_GET(PREC_PALETTE_12P4_GREEN_UDW_MASK, udw) << 6 |
> +		REG_FIELD_GET(PREC_PALETTE_12P4_GREEN_LDW_MASK, ldw);
> +	entry->blue = REG_FIELD_GET(PREC_PALETTE_12P4_BLUE_UDW_MASK, udw) << 6 |
> +		REG_FIELD_GET(PREC_PALETTE_12P4_BLUE_LDW_MASK, ldw);
>  }
>  
>  static void icl_color_commit_noarm(const struct intel_crtc_state *crtc_state)
> diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
> index 3aa3db2b56f5..ecb34f133980 100644
> --- a/drivers/gpu/drm/i915/i915_reg.h
> +++ b/drivers/gpu/drm/i915/i915_reg.h
> @@ -5391,6 +5391,14 @@
>  #define   PREC_PALETTE_10_RED_MASK		REG_GENMASK(29, 20)
>  #define   PREC_PALETTE_10_GREEN_MASK		REG_GENMASK(19, 10)
>  #define   PREC_PALETTE_10_BLUE_MASK		REG_GENMASK(9, 0)
> +/* 12.4 interpolated mode ldw */
> +#define   PREC_PALETTE_12P4_RED_LDW_MASK	REG_GENMASK(29, 24)
> +#define   PREC_PALETTE_12P4_GREEN_LDW_MASK	REG_GENMASK(19, 14)
> +#define   PREC_PALETTE_12P4_BLUE_LDW_MASK	REG_GENMASK(9, 4)
> +/* 12.4 interpolated mode udw */
> +#define   PREC_PALETTE_12P4_RED_UDW_MASK	REG_GENMASK(29, 20)
> +#define   PREC_PALETTE_12P4_GREEN_UDW_MASK	REG_GENMASK(19, 10)
> +#define   PREC_PALETTE_12P4_BLUE_UDW_MASK	REG_GENMASK(9, 0)
>  #define PREC_PALETTE(pipe, i) _MMIO(_PIPE(pipe, _PREC_PALETTE_A, _PREC_PALETTE_B) + (i) * 4)
>  
>  #define  _PREC_PIPEAGCMAX              0x4d000
> @@ -7656,12 +7664,7 @@ enum skl_power_gate {
>  
>  #define _PAL_PREC_MULTI_SEG_DATA_A	0x4A40C
>  #define _PAL_PREC_MULTI_SEG_DATA_B	0x4AC0C
> -#define  PAL_PREC_MULTI_SEG_RED_LDW_MASK   REG_GENMASK(29, 24)
> -#define  PAL_PREC_MULTI_SEG_RED_UDW_MASK   REG_GENMASK(29, 20)
> -#define  PAL_PREC_MULTI_SEG_GREEN_LDW_MASK REG_GENMASK(19, 14)
> -#define  PAL_PREC_MULTI_SEG_GREEN_UDW_MASK REG_GENMASK(19, 10)
> -#define  PAL_PREC_MULTI_SEG_BLUE_LDW_MASK  REG_GENMASK(9, 4)
> -#define  PAL_PREC_MULTI_SEG_BLUE_UDW_MASK  REG_GENMASK(9, 0)
> +/* see PREC_PALETTE_12P4_* for the bits */
>  
>  #define PREC_PAL_MULTI_SEG_INDEX(pipe)	_MMIO_PIPE(pipe, \
>  					_PAL_PREC_MULTI_SEG_INDEX_A, \

-- 
Jani Nikula, Intel Open Source Graphics Center

  reply	other threads:[~2022-11-11 15:13 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-10  8:21 [Intel-gfx] [PATCH v2 00/18] drm/i915: Finish (de)gamma readout Ville Syrjala
2022-11-10  8:21 ` [Intel-gfx] [PATCH v2 01/18] drm/i915: Clean up legacy palette defines Ville Syrjala
2022-11-11 15:09   ` Jani Nikula
2022-11-11 18:24     ` Ville Syrjälä
2022-11-10  8:21 ` [Intel-gfx] [PATCH v2 02/18] drm/i915: Clean up 10bit precision " Ville Syrjala
2022-11-11 15:10   ` Jani Nikula
2022-11-10  8:21 ` [Intel-gfx] [PATCH v2 03/18] drm/i915: Clean up 12.4bit " Ville Syrjala
2022-11-11 15:13   ` Jani Nikula [this message]
2022-11-10  8:21 ` [Intel-gfx] [PATCH v2 04/18] drm/i915: Clean up chv CGM (de)gamma defines Ville Syrjala
2022-11-11 15:15   ` Jani Nikula
2022-11-10  8:21 ` [Intel-gfx] [PATCH v2 05/18] drm/i915: Reorder 12.4 lut udw vs. ldw functions Ville Syrjala
2022-11-11 15:15   ` Jani Nikula
2022-11-10  8:21 ` [Intel-gfx] [PATCH v2 06/18] drm/i915: Fix adl+ degamma LUT size Ville Syrjala
2022-11-10  8:21 ` [Intel-gfx] [PATCH v2 07/18] drm/i915: Add glk+ degamma readout Ville Syrjala
2022-11-10  8:21 ` [Intel-gfx] [PATCH v2 08/18] drm/i915: Read out CHV CGM degamma Ville Syrjala
2022-11-10  8:21 ` [Intel-gfx] [PATCH v2 09/18] drm/i915: Add gamma/degamma readout for bdw+ Ville Syrjala
2022-11-10  8:21 ` [Intel-gfx] [PATCH v2 10/18] drm/i915: Add gamma/degamma readout for ivb/hsw Ville Syrjala
2022-11-10  8:21 ` [Intel-gfx] [PATCH v2 11/18] drm/i915: Make ilk_read_luts() capable of degamma readout Ville Syrjala
2022-11-10  8:21 ` [Intel-gfx] [PATCH v2 12/18] drm/i915: Make .read_luts() mandatory Ville Syrjala
2022-11-10  8:21 ` [Intel-gfx] [PATCH v2 13/18] drm/i915: Finish the LUT state checker Ville Syrjala
2022-11-12 15:55   ` [Intel-gfx] [PATCH v3 " Ville Syrjala
2022-11-10  8:21 ` [Intel-gfx] [PATCH v2 14/18] drm/i915: Rework legacy LUT handling Ville Syrjala
2022-11-10  8:21 ` [Intel-gfx] [PATCH v2 15/18] drm/i915: Use hw degamma LUT for sw gamma on glk with YCbCr output Ville Syrjala
2022-11-10  8:21 ` [Intel-gfx] [PATCH v2 16/18] drm/i915: Use gamma LUT for RGB limited range compression Ville Syrjala
2022-11-10  8:21 ` [Intel-gfx] [PATCH v2 17/18] drm/i915: Add 10bit gamma mode for gen2/3 Ville Syrjala
2022-11-12 15:56   ` [Intel-gfx] [PATCH v3 " Ville Syrjala
2022-11-10  8:21 ` [Intel-gfx] [PATCH v2 18/18] drm/i915: Do state check for color management changes Ville Syrjala
2022-11-11 14:37   ` [Intel-gfx] [PATCH v3 " Ville Syrjala
2022-11-10 21:55 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Finish (de)gamma readout (rev2) Patchwork
2022-11-10 21:55 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2022-11-10 22:17 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
2022-11-11 14:59 ` [Intel-gfx] ✗ Fi.CI.SPARSE: warning for drm/i915: Finish (de)gamma readout (rev3) Patchwork
2022-11-11 15:24 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
2022-11-11 19:27 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Finish (de)gamma readout (rev4) Patchwork
2022-11-11 19:27 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2022-11-11 19:49 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2022-11-12 12:47 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
2022-11-12 16:37 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Finish (de)gamma readout (rev6) Patchwork
2022-11-12 16:37 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2022-11-12 16:59 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
2022-11-12 19:47 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Finish (de)gamma readout (rev7) Patchwork
2022-11-12 19:47 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2022-11-12 20:09 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2022-11-12 21:49 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " 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=87zgcx4j8s.fsf@intel.com \
    --to=jani.nikula@linux.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.