From: Swati Sharma <swati2.sharma@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: jani.nikula@intel.com, daniel.vetter@ffwll.ch,
ankit.k.nautiyal@intel.com
Subject: [v9][PATCH 08/11] drm/i915/display: Extract ilk_read_luts()
Date: Fri, 30 Aug 2019 14:01:50 +0530 [thread overview]
Message-ID: <1567153913-20166-9-git-send-email-swati2.sharma@intel.com> (raw)
In-Reply-To: <1567153913-20166-1-git-send-email-swati2.sharma@intel.com>
For ilk, add hw read out to create hw blob of gamma
lut values.
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]
v9: -80 character limit [Uma]
-Made read func para as const [Ville, Uma]
-Renamed ilk_read_gamma_lut() to ilk_read_lut_10() [Uma, Ville]
Signed-off-by: Swati Sharma <swati2.sharma@intel.com>
---
drivers/gpu/drm/i915/display/intel_color.c | 45 +++++++++++++++++++++++++++++-
drivers/gpu/drm/i915/i915_reg.h | 3 ++
2 files changed, 47 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/i915/display/intel_color.c b/drivers/gpu/drm/i915/display/intel_color.c
index b28b3b9..33bcbda 100644
--- a/drivers/gpu/drm/i915/display/intel_color.c
+++ b/drivers/gpu/drm/i915/display/intel_color.c
@@ -1711,6 +1711,47 @@ static void chv_read_luts(struct intel_crtc_state *crtc_state)
crtc_state->base.gamma_lut = chv_read_cgm_lut(crtc_state);
}
+static struct drm_property_blob *
+ilk_read_lut_10(const struct intel_crtc_state *crtc_state)
+{
+ struct intel_crtc *crtc = to_intel_crtc(crtc_state->base.crtc);
+ struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
+ u32 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;
+ u32 i, val;
+
+ 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_lut_10(crtc_state);
+}
+
void intel_color_init(struct intel_crtc *crtc)
{
struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
@@ -1760,8 +1801,10 @@ void intel_color_init(struct intel_crtc *crtc)
dev_priv->display.load_luts = bdw_load_luts;
else if (INTEL_GEN(dev_priv) >= 7)
dev_priv->display.load_luts = ivb_load_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,
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index f5a2e73..e457739 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -7203,6 +7203,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
--
1.9.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2019-08-30 8:42 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-30 8:31 [v9][PATCH 00/11] drm/i915: adding state checker for gamma lut values Swati Sharma
2019-08-30 8:31 ` [v9][PATCH 01/11] drm/i915/display: Add func to get gamma bit precision Swati Sharma
2019-08-30 12:02 ` Jani Nikula
2019-08-30 12:04 ` Jani Nikula
2019-08-30 12:05 ` Jani Nikula
2019-08-30 8:31 ` [v9][PATCH 02/11] drm/i915/display: Add debug log for color parameters Swati Sharma
2019-08-30 12:06 ` Jani Nikula
2019-08-30 8:31 ` [v9][PATCH 03/11] drm/i915/display: Add func to compare hw/sw gamma lut Swati Sharma
2019-08-30 12:47 ` Jani Nikula
2019-09-09 13:53 ` Sharma, Swati2
2019-09-09 14:14 ` Jani Nikula
2019-09-09 14:19 ` Ville Syrjälä
2019-08-30 8:31 ` [v9][PATCH 04/11] drm/i915/display: Add macro to compare gamma hw/sw lut Swati Sharma
2019-08-30 8:31 ` [v9][PATCH 05/11] drm/i915/display: Extract i9xx_read_luts() Swati Sharma
2019-08-30 12:54 ` Jani Nikula
2019-08-30 8:31 ` [v9][PATCH 06/11] drm/i915/display: Extract i965_read_luts() Swati Sharma
2019-08-30 13:08 ` Jani Nikula
2019-08-30 8:31 ` [v9][PATCH 07/11] drm/i915/display: Extract chv_read_luts() Swati Sharma
2019-08-30 13:15 ` Jani Nikula
2019-08-30 8:31 ` Swati Sharma [this message]
2019-08-30 13:18 ` [v9][PATCH 08/11] drm/i915/display: Extract ilk_read_luts() Jani Nikula
2019-08-30 8:31 ` [v9][PATCH 09/11] drm/i915/display: Extract glk_read_luts() Swati Sharma
2019-08-30 8:31 ` [v9][PATCH 10/11] drm/i915/display: Extract icl_read_luts() Swati Sharma
2019-08-30 8:31 ` [v9][PATCH 11/11] FOR_TESTING_ONLY: Print rgb values of hw and sw blobs Swati Sharma
2019-08-30 9:39 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915: adding state checker for gamma lut values (rev13) Patchwork
2019-08-30 9:44 ` ✗ Fi.CI.SPARSE: " Patchwork
2019-08-30 10:01 ` ✓ Fi.CI.BAT: success " Patchwork
2019-08-31 3:01 ` ✓ 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=1567153913-20166-9-git-send-email-swati2.sharma@intel.com \
--to=swati2.sharma@intel.com \
--cc=ankit.k.nautiyal@intel.com \
--cc=daniel.vetter@ffwll.ch \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@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.