public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Uma Shankar <uma.shankar@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: ville.syrjala@intel.com, maarten.lankhorst@intel.com
Subject: [RFC v1 1/7] drm/i915: Add gamma mode property
Date: Tue, 19 Mar 2019 14:00:12 +0530	[thread overview]
Message-ID: <1552984218-3357-2-git-send-email-uma.shankar@intel.com> (raw)
In-Reply-To: <1552984218-3357-1-git-send-email-uma.shankar@intel.com>

Gen platforms support multiple gamma modes, currently
it's hard coded to operate only in 1 specific mode.
This patch adds a property to make gamma mode programmable.
User can select which mode should be used for a particular
usecase or scenario.

Signed-off-by: Uma Shankar <uma.shankar@intel.com>
---
 drivers/gpu/drm/i915/i915_drv.h    |  2 ++
 drivers/gpu/drm/i915/intel_color.c | 46 ++++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_drv.h   |  3 +++
 3 files changed, 51 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index c65c2e6..02231ae 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1735,6 +1735,8 @@ struct drm_i915_private {
 	struct drm_property *broadcast_rgb_property;
 	struct drm_property *force_audio_property;
 
+	struct drm_property *gamma_mode_property;
+
 	/* hda/i915 audio component */
 	struct i915_audio_component *audio_component;
 	bool audio_component_registered;
diff --git a/drivers/gpu/drm/i915/intel_color.c b/drivers/gpu/drm/i915/intel_color.c
index 467fd1a..9d43d19 100644
--- a/drivers/gpu/drm/i915/intel_color.c
+++ b/drivers/gpu/drm/i915/intel_color.c
@@ -92,6 +92,19 @@
 	0x0800, 0x0100, 0x0800,
 };
 
+#define LEGACY_PALETTE_MODE_8BIT		BIT(0)
+#define PRECISION_PALETTE_MODE_10BIT		BIT(1)
+#define INTERPOLATED_GAMMA_MODE_12BIT		BIT(2)
+#define MULTI_SEGMENTED_GAMMA_MODE_12BIT	BIT(3)
+#define SPLIT_GAMMA_MODE_12BIT			BIT(4)
+
+#define INTEL_GAMMA_MODE_MASK (\
+		LEGACY_PALETTE_MODE_8BIT | \
+		PRECISION_PALETTE_MODE_10BIT | \
+		INTERPOLATED_GAMMA_MODE_12BIT | \
+		MULTI_SEGMENTED_GAMMA_MODE_12BIT | \
+		BIT_SPLIT_GAMMA_MODE_12BIT)
+
 static bool lut_is_legacy(const struct drm_property_blob *lut)
 {
 	return drm_color_lut_size(lut) == LEGACY_LUT_LENGTH;
@@ -105,6 +118,37 @@ static bool crtc_state_is_legacy_gamma(const struct intel_crtc_state *crtc_state
 		lut_is_legacy(crtc_state->base.gamma_lut);
 }
 
+static const struct drm_prop_enum_list gamma_mode_supported[] = {
+	{ LEGACY_PALETTE_MODE_8BIT, "8 Bit Legacy Palette Mode" },
+	{ PRECISION_PALETTE_MODE_10BIT, "10 Bit Precision Palette Mode" },
+	{ INTERPOLATED_GAMMA_MODE_12BIT, "12 Bit Interploated Gamma Mode" },
+	{ MULTI_SEGMENTED_GAMMA_MODE_12BIT,
+			"12 Bit Multi Segmented Gamma Mode" },
+	{ SPLIT_GAMMA_MODE_12BIT, "12 Bit Split Gamma Mode" },
+};
+
+void
+intel_attach_gamma_mode_property(struct intel_crtc *crtc)
+{
+	struct drm_device *dev = crtc->base.dev;
+	struct drm_i915_private *dev_priv = to_i915(dev);
+	struct drm_property *prop;
+
+	prop = dev_priv->gamma_mode_property;
+	if (!prop) {
+		prop = drm_property_create_enum(dev, DRM_MODE_PROP_ENUM,
+						"Gamma Mode",
+						gamma_mode_supported,
+						ARRAY_SIZE(gamma_mode_supported));
+		if (!prop)
+			return;
+
+		dev_priv->gamma_mode_property = prop;
+	}
+
+	drm_object_attach_property(&crtc->base.base, prop, 0);
+}
+
 /*
  * When using limited range, multiply the matrix given by userspace by
  * the matrix that we would use for the limited range.
@@ -907,4 +951,6 @@ void intel_color_init(struct intel_crtc *crtc)
 					   INTEL_INFO(dev_priv)->color.degamma_lut_size,
 					   true,
 					   INTEL_INFO(dev_priv)->color.gamma_lut_size);
+
+	intel_attach_gamma_mode_property(crtc);
 }
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index d9f188e..fd84fe9 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -1034,6 +1034,9 @@ struct intel_crtc_state {
 	u8 nv12_planes;
 	u8 c8_planes;
 
+	/* Gamma mode type programmed on the pipe */
+	u32 gamma_mode_type;
+
 	/* bitmask of planes that will be updated during the commit */
 	u8 update_planes;
 
-- 
1.9.1

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

  parent reply	other threads:[~2019-03-19  8:05 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-19  8:30 [RFC v1 0/7] Add Multi Segment Gamma Support Uma Shankar
2019-03-19  8:12 ` ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
2019-03-19  8:15 ` ✗ Fi.CI.SPARSE: " Patchwork
2019-03-19  8:30 ` Uma Shankar [this message]
2019-03-21 21:19   ` [RFC v1 1/7] drm/i915: Add gamma mode property Matt Roper
2019-03-22 13:06     ` Shankar, Uma
2019-03-22 13:39       ` Brian Starkey
2019-03-22 14:02         ` Ville Syrjälä
2019-03-22 15:42           ` Brian Starkey
2019-03-22 15:51             ` Ville Syrjälä
2019-03-19  8:30 ` [RFC v1 2/7] drm/i915: Add intel crtc set and get property callback Uma Shankar
2019-03-19  8:30 ` [RFC v1 3/7] drm/i915: Add Support for Multi Segment Gamma Mode Uma Shankar
2019-03-19  8:46   ` Lankhorst, Maarten
2019-03-19 16:59     ` Ville Syrjälä
2019-03-20 17:03       ` Shankar, Uma
2019-03-21 21:52         ` Matt Roper
2019-03-22 13:12           ` Shankar, Uma
2019-03-22 13:52         ` Ville Syrjälä
2019-03-28 19:00           ` Shankar, Uma
2019-03-28 19:28             ` Ville Syrjälä
2019-03-19  8:30 ` [RFC v1 4/7] drm/i915: Implement get set property handler for multi segment gamma Uma Shankar
2019-03-19  8:30 ` [RFC v1 5/7] drm/i915/icl: Add register definitions for Multi Segmented gamma Uma Shankar
2019-03-19  8:30 ` [RFC v1 6/7] drm/i915/icl: Add support for multi segmented gamma mode Uma Shankar
2019-03-19  8:30 ` [RFC v1 7/7] drm/i915: Add multi segment gamma for icl Uma Shankar
2019-03-21 22:04   ` Matt Roper
2019-03-22 13:17     ` Shankar, Uma
2019-03-19  8:31 ` ✗ Fi.CI.BAT: failure for Add Multi Segment Gamma Support 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=1552984218-3357-2-git-send-email-uma.shankar@intel.com \
    --to=uma.shankar@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=maarten.lankhorst@intel.com \
    --cc=ville.syrjala@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