intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Swati Sharma <swati2.sharma@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [v7][PATCH 11/12] drm/i915: Extract ilk_read_luts()
Date: Fri, 31 May 2019 18:33:42 +0300	[thread overview]
Message-ID: <20190531153342.GY5942@intel.com> (raw)
In-Reply-To: <1559123462-7343-12-git-send-email-swati2.sharma@intel.com>

On Wed, May 29, 2019 at 03:21:01PM +0530, Swati Sharma wrote:
> In this patch, hw gamma blob is created for ILK.
> 
> v4: -No need to initialize *blob [Jani]
>     -Removed right shifts [Jani]
>     -Dropped dev local var [Jani]
> v5: -Returned blob instead of assigning it internally within the
>      function [Ville]
>     -Renamed ilk_get_color_config() to ilk_read_luts() [Ville]
> 
> Signed-off-by: Swati Sharma <swati2.sharma@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_reg.h    |  3 +++
>  drivers/gpu/drm/i915/intel_color.c | 42 ++++++++++++++++++++++++++++++++++++--
>  2 files changed, 43 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
> index 249296b..d5ff323 100644
> --- a/drivers/gpu/drm/i915/i915_reg.h
> +++ b/drivers/gpu/drm/i915/i915_reg.h
> @@ -7189,6 +7189,9 @@ enum {
>  /* ilk/snb precision palette */
>  #define _PREC_PALETTE_A           0x4b000
>  #define _PREC_PALETTE_B           0x4c000
> +#define   PREC_PALETTE_RED_MASK   REG_GENMASK(29, 20)
> +#define   PREC_PALETTE_GREEN_MASK REG_GENMASK(19, 10)
> +#define   PREC_PALETTE_BLUE_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
> diff --git a/drivers/gpu/drm/i915/intel_color.c b/drivers/gpu/drm/i915/intel_color.c
> index 6e6e54b..7568b13 100644
> --- a/drivers/gpu/drm/i915/intel_color.c
> +++ b/drivers/gpu/drm/i915/intel_color.c
> @@ -1650,6 +1650,43 @@ static void ivb_read_luts(struct intel_crtc_state *crtc_state)
>  		crtc_state->base.gamma_lut = ivb_read_lut_10(crtc_state, PAL_PREC_INDEX_VALUE(0));
>  }
>  
> +static struct drm_property_blob *
> +ilk_read_gamma_lut(struct intel_crtc_state *crtc_state)

ilk_read_lut_10()

> +{
> +	struct intel_crtc *crtc = to_intel_crtc(crtc_state->base.crtc);
> +	struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
> +	u32 i, val, lut_size = INTEL_INFO(dev_priv)->color.gamma_lut_size;
> +	enum pipe pipe = crtc->pipe;
> +	struct drm_property_blob *blob;
> +	struct drm_color_lut *blob_data;
> +
> +	blob = drm_property_create_blob(&dev_priv->drm,
> +					sizeof(struct drm_color_lut) * lut_size,
> +					NULL);
> +	if (IS_ERR(blob))
> +		return NULL;
> +
> +	blob_data = blob->data;
> +
> +	for (i = 0; i < lut_size - 1; i++) {
> +		val = I915_READ(PREC_PALETTE(pipe, i));
> +
> +		blob_data[i].red = intel_color_lut_pack(REG_FIELD_GET(PREC_PALETTE_RED_MASK, val), 10);
> +		blob_data[i].green = intel_color_lut_pack(REG_FIELD_GET(PREC_PALETTE_GREEN_MASK, val), 10);
> +		blob_data[i].blue = intel_color_lut_pack(REG_FIELD_GET(PREC_PALETTE_BLUE_MASK, val), 10);
> +	}
> +
> +	return blob;
> +}
> +
> +static void ilk_read_luts(struct intel_crtc_state *crtc_state)
> +{
> +	if (crtc_state->gamma_mode == GAMMA_MODE_MODE_8BIT)
> +		crtc_state->base.gamma_lut = i9xx_read_lut_8(crtc_state);
> +	else
> +		crtc_state->base.gamma_lut = ilk_read_gamma_lut(crtc_state);
> +}
> +
>  void intel_color_init(struct intel_crtc *crtc)
>  {
>  	struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
> @@ -1703,9 +1740,10 @@ void intel_color_init(struct intel_crtc *crtc)
>  		} else if (INTEL_GEN(dev_priv) >= 7) {
>  			dev_priv->display.load_luts = ivb_load_luts;
>  			dev_priv->display.read_luts = ivb_read_luts;
> -		}
> -		else
> +		} else {
>  			dev_priv->display.load_luts = ilk_load_luts;
> +			dev_priv->display.read_luts = ilk_read_luts;
> +		}
>  	}
>  
>  	drm_crtc_enable_color_mgmt(&crtc->base,
> -- 
> 1.9.1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2019-05-31 15:33 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-29  9:50 [v7][PATCH 00/12] drm/i915: adding state checker for gamma lut values Swati Sharma
2019-05-29  9:50 ` [v7][PATCH 01/12] drm/i915: Introduce vfunc read_luts() to create hw lut Swati Sharma
2019-05-29  9:50 ` [v7][PATCH 02/12] drm/i915: Enable intel_color_get_config() Swati Sharma
2019-06-05 10:08   ` Jani Nikula
2019-05-29  9:50 ` [v7][PATCH 03/12] drm/i915: Add func to compare hw/sw gamma lut Swati Sharma
2019-05-31 15:28   ` Ville Syrjälä
2019-06-10 10:54     ` Sharma, Swati2
2019-06-10 17:03       ` Ville Syrjälä
2019-06-05 10:07   ` Jani Nikula
2019-06-12 11:38     ` Sharma, Swati2
2019-05-29  9:50 ` [v7][PATCH 04/12] drm/i915: Extract i9xx_read_luts() Swati Sharma
2019-05-29  9:50 ` [v7][PATCH 05/12] drm/i915: Extract chv_read_luts() Swati Sharma
2019-05-29  9:50 ` [v7][PATCH 06/12] drm/i915: Extract i965_read_luts() Swati Sharma
2019-05-31 15:33   ` Ville Syrjälä
2019-05-29  9:50 ` [v7][PATCH 07/12] drm/i915: Extract icl_read_luts() Swati Sharma
2019-05-29  9:50 ` [v7][PATCH 08/12] drm/i915: Extract glk_read_luts() Swati Sharma
2019-05-29  9:50 ` [v7][PATCH 09/12] drm/i915: Extract bdw_read_luts() Swati Sharma
2019-05-29  9:51 ` [v7][PATCH 10/12] drm/i915: Extract ivb_read_luts() Swati Sharma
2019-05-29  9:51 ` [v7][PATCH 11/12] drm/i915: Extract ilk_read_luts() Swati Sharma
2019-05-31 15:33   ` Ville Syrjälä [this message]
2019-05-29  9:51 ` [v7][PATCH 12/12] FOR_TESTING_ONLY: Print rgb values of hw and sw blobs Swati Sharma
2019-05-29 16:49 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915: adding state checker for gamma lut values (rev12) Patchwork
2019-05-29 16:54 ` ✗ Fi.CI.SPARSE: " Patchwork
2019-05-29 17:12 ` ✗ Fi.CI.BAT: failure " Patchwork
2019-05-31  8:17 ` ✓ Fi.CI.BAT: success " Patchwork
2019-05-31 17:47 ` ✓ Fi.CI.IGT: " Patchwork
2019-08-15  8:14 ` [v7][PATCH 00/12] drm/i915: adding state checker for gamma lut values Jani Nikula
2019-08-16  5:47   ` Sharma, Swati2
  -- strict thread matches above, loose matches on Subject: below --
2019-05-27 13:41 Swati Sharma
2019-05-27 13:42 ` [v7][PATCH 11/12] drm/i915: Extract ilk_read_luts() Swati Sharma

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=20190531153342.GY5942@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=swati2.sharma@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;
as well as URLs for NNTP newsgroup(s).