intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Uma Shankar <uma.shankar@intel.com>
To: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Cc: dcastagna@chromium.org, seanpaul@chromium.org,
	ville.syrjala@intel.com, harry.wentland@amd.com,
	maarten.lankhorst@intel.com
Subject: [RFC v4 1/8] drm: Add Enhanced Gamma LUT precision structure
Date: Fri, 17 Aug 2018 19:48:44 +0530	[thread overview]
Message-ID: <1534515531-20599-2-git-send-email-uma.shankar@intel.com> (raw)
In-Reply-To: <1534515531-20599-1-git-send-email-uma.shankar@intel.com>

Existing LUT precision structure is having only 16 bit
precision. This is not enough for upcoming enhanced hardwares
and advance usecases like HDR processing. Hence added a new
structure with 32 bit precision values. Also added the code,
for extracting the same from values passed from userspace.

v4: Rebase

Signed-off-by: Uma Shankar <uma.shankar@intel.com>
---
 drivers/gpu/drm/drm_plane.c | 19 +++++++++++++++++++
 include/uapi/drm/drm_mode.h | 15 +++++++++++++++
 2 files changed, 34 insertions(+)

diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
index 6153cbd..cd71fd0 100644
--- a/drivers/gpu/drm/drm_plane.c
+++ b/drivers/gpu/drm/drm_plane.c
@@ -430,6 +430,25 @@ void drm_plane_force_disable(struct drm_plane *plane)
 }
 EXPORT_SYMBOL(drm_plane_force_disable);
 
+/*
+ * Added to accommodate enhanced LUT precision.
+ * Max LUT precision is 32 bits.
+ */
+uint32_t drm_color_lut_extract_ext(uint32_t user_input, uint32_t bit_precision)
+{
+	uint32_t val = user_input;
+	uint32_t max = 0xffffffff >> (32 - bit_precision);
+
+	/* Round only if we're not using full precision. */
+	if (bit_precision < 32) {
+		val += 1UL << (32 - bit_precision - 1);
+		val >>= 32 - bit_precision;
+	}
+
+	return clamp_val(val, 0, max);
+}
+EXPORT_SYMBOL(drm_color_lut_extract_ext);
+
 /**
  * drm_mode_plane_set_obj_prop - set the value of a property
  * @plane: drm plane object to set property value for
diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h
index 8d67243..874407b 100644
--- a/include/uapi/drm/drm_mode.h
+++ b/include/uapi/drm/drm_mode.h
@@ -629,6 +629,21 @@ struct drm_color_lut {
 	__u16 reserved;
 };
 
+/*
+ * Creating 32 bit palette entries for better data
+ * precision. This will be required for HDR and
+ * similar color processing usecases.
+ */
+struct drm_color_lut_ext {
+	/*
+	 * Data is U0.32 fixed point format.
+	 */
+	__u32 red;
+	__u32 green;
+	__u32 blue;
+	__u32 reserved;
+};
+
 #define DRM_MODE_PAGE_FLIP_EVENT 0x01
 #define DRM_MODE_PAGE_FLIP_ASYNC 0x02
 #define DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE 0x4
-- 
1.9.1

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

  parent reply	other threads:[~2018-08-17 14:18 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-17 14:18 [RFC v4 0/8] Add Plane Color Properties Uma Shankar
2018-08-17 14:12 ` ✗ Fi.CI.CHECKPATCH: warning for Add Plane Color Properties (rev4) Patchwork
2018-08-17 14:18 ` ✗ Fi.CI.SPARSE: " Patchwork
2018-08-17 14:18 ` Uma Shankar [this message]
2018-08-21  9:30   ` [RFC v4 1/8] drm: Add Enhanced Gamma LUT precision structure Alexandru-Cosmin Gheorghe
2018-08-23  5:20     ` Shankar, Uma
2018-08-17 14:18 ` [RFC v4 2/8] drm: Add Plane Degamma properties Uma Shankar
2018-08-21  9:38   ` Alexandru-Cosmin Gheorghe
2018-08-17 14:18 ` [RFC v4 3/8] drm: Add Plane CTM property Uma Shankar
2018-08-21  9:40   ` Alexandru-Cosmin Gheorghe
2018-08-22  8:40   ` Lankhorst, Maarten
2018-08-22  9:53     ` [Intel-gfx] " Ville Syrjälä
2018-08-22 11:11       ` Brian Starkey
2018-08-22 12:51         ` [Intel-gfx] " Lankhorst, Maarten
2018-08-22 13:06         ` Ville Syrjälä
2018-08-23  5:18           ` Shankar, Uma
2018-08-17 14:18 ` [RFC v4 4/8] drm: Add Plane Gamma properties Uma Shankar
2018-08-21  9:42   ` Alexandru-Cosmin Gheorghe
2018-08-17 14:18 ` [RFC v4 5/8] drm: Define helper function for plane color enabling Uma Shankar
2018-08-21  9:46   ` Alexandru-Cosmin Gheorghe
2018-08-17 14:18 ` [RFC v4 6/8] drm/i915: Enable plane color features Uma Shankar
2018-08-17 14:18 ` [RFC v4 7/8] drm/i915: Implement Plane Gamma for Bdw and Gen9 platforms Uma Shankar
2018-08-21  9:56   ` Alexandru-Cosmin Gheorghe
2018-08-23  5:22     ` Shankar, Uma
2018-08-17 14:18 ` [RFC v4 8/8] drm/i915: Load plane color luts from atomic flip Uma Shankar
2018-08-17 14:30 ` ✓ Fi.CI.BAT: success for Add Plane Color Properties (rev4) Patchwork
2018-08-17 16:36 ` ✓ 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=1534515531-20599-2-git-send-email-uma.shankar@intel.com \
    --to=uma.shankar@intel.com \
    --cc=dcastagna@chromium.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=harry.wentland@amd.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=maarten.lankhorst@intel.com \
    --cc=seanpaul@chromium.org \
    --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;
as well as URLs for NNTP newsgroup(s).