All of lore.kernel.org
 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: [v2 3/7] drm: Add gamma mode property
Date: Mon,  1 Apr 2019 23:00:07 +0530	[thread overview]
Message-ID: <1554139811-13280-4-git-send-email-uma.shankar@intel.com> (raw)
In-Reply-To: <1554139811-13280-1-git-send-email-uma.shankar@intel.com>

Add Gamma Mode property to set the gamma mode
(Interploated, Split, Multi Segmented etc) from the
list obtained through the gamma mode caps property.

Create the blob and send to driver for programming
the luts to the appropriate registers and setting
the chosen gamma mode.

Signed-off-by: Uma Shankar <uma.shankar@intel.com>
---
 drivers/gpu/drm/drm_atomic_uapi.c | 10 ++++++++++
 drivers/gpu/drm/drm_color_mgmt.c  | 32 ++++++++++++++++++++++++++++++++
 include/drm/drm_color_mgmt.h      |  3 +++
 include/drm/drm_crtc.h            |  7 +++++++
 include/drm/drm_mode_config.h     |  5 +++++
 include/uapi/drm/drm_mode.h       | 11 +++++++++++
 6 files changed, 68 insertions(+)

diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c
index 03df2a4..d3008ea 100644
--- a/drivers/gpu/drm/drm_atomic_uapi.c
+++ b/drivers/gpu/drm/drm_atomic_uapi.c
@@ -459,6 +459,14 @@ static int drm_atomic_crtc_set_property(struct drm_crtc *crtc,
 					&replaced);
 		state->color_mgmt_changed |= replaced;
 		return ret;
+	} else if (property == config->gamma_mode_property) {
+		ret = drm_atomic_replace_property_blob_from_id(dev,
+					&state->gamma_mode,
+					val,
+					-1, sizeof(struct drm_color_mode_lut),
+					&replaced);
+		state->color_mgmt_changed |= replaced;
+		return ret;
 	} else if (property == config->prop_out_fence_ptr) {
 		s32 __user *fence_ptr = u64_to_user_ptr(val);
 
@@ -498,6 +506,8 @@ static int drm_atomic_crtc_set_property(struct drm_crtc *crtc,
 	else if (property == config->gamma_mode_caps_property)
 		*val = (state->gamma_mode_caps) ?
 			state->gamma_mode_caps->base.id : 0;
+	else if (property == config->gamma_mode_property)
+		*val = (state->gamma_mode) ? state->gamma_mode->base.id : 0;
 	else if (property == config->degamma_lut_property)
 		*val = (state->degamma_lut) ? state->degamma_lut->base.id : 0;
 	else if (property == config->ctm_property)
diff --git a/drivers/gpu/drm/drm_color_mgmt.c b/drivers/gpu/drm/drm_color_mgmt.c
index 054f0ed..cba1d6d 100644
--- a/drivers/gpu/drm/drm_color_mgmt.c
+++ b/drivers/gpu/drm/drm_color_mgmt.c
@@ -176,6 +176,38 @@ void drm_crtc_enable_color_mgmt(struct drm_crtc *crtc,
 }
 EXPORT_SYMBOL(drm_crtc_enable_color_mgmt);
 
+void drm_crtc_attach_gamma_mode_property(struct drm_crtc *crtc)
+{
+	struct drm_device *dev = crtc->dev;
+	struct drm_mode_config *config = &dev->mode_config;
+
+	if (!config->gamma_mode_property)
+		return;
+
+	drm_object_attach_property(&crtc->base,
+				   config->gamma_mode_property, 0);
+}
+EXPORT_SYMBOL(drm_crtc_attach_gamma_mode_property);
+
+int drm_color_create_gamma_mode_property(struct drm_device *dev,
+					 int num_values)
+{
+	struct drm_mode_config *config = &dev->mode_config;
+	struct drm_property *prop;
+
+	prop = drm_property_create(dev,
+				   DRM_MODE_PROP_BLOB |
+				   DRM_MODE_PROP_ATOMIC,
+				   "GAMMA_MODE", num_values);
+	if (!prop)
+		return -ENOMEM;
+
+	config->gamma_mode_property = prop;
+
+	return 0;
+}
+EXPORT_SYMBOL(drm_color_create_gamma_mode_property);
+
 void drm_crtc_attach_gamma_mode_caps_property(struct drm_crtc *crtc)
 {
 	struct drm_device *dev = crtc->dev;
diff --git a/include/drm/drm_color_mgmt.h b/include/drm/drm_color_mgmt.h
index e0f94db..4306e07 100644
--- a/include/drm/drm_color_mgmt.h
+++ b/include/drm/drm_color_mgmt.h
@@ -54,6 +54,9 @@ static inline int drm_color_lut_size(const struct drm_property_blob *blob)
 int drm_color_create_gamma_mode_caps_property(struct drm_device *dev,
 					      int num_values);
 void drm_crtc_attach_gamma_mode_caps_property(struct drm_crtc *crtc);
+int drm_color_create_gamma_mode_property(struct drm_device *dev,
+					 int num_values);
+void drm_crtc_attach_gamma_mode_property(struct drm_crtc *crtc);
 int drm_color_add_gamma_mode_range(struct drm_device *dev,
 				   const char *name,
 				   const struct drm_color_lut_range *ranges,
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index cdfda90..bc8a2e7 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -256,6 +256,13 @@ struct drm_crtc_state {
 	struct drm_property_blob *gamma_mode_caps;
 
 	/**
+	 * @gamma_mode:
+	 *
+	 * FIXME
+	 */
+	struct drm_property_blob *gamma_mode;
+
+	/**
 	 * @degamma_lut:
 	 *
 	 * Lookup table for converting framebuffer pixel data before apply the
diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h
index 7b20355..f5bb807 100644
--- a/include/drm/drm_mode_config.h
+++ b/include/drm/drm_mode_config.h
@@ -766,6 +766,11 @@ struct drm_mode_config {
 	 */
 	struct drm_property *gamma_mode_caps_property;
 	/**
+	 * @gamma_mode_property: Optional CRTC property to enumerate and
+	 * select the mode of the crtc gamma/degmama LUTs.
+	 */
+	struct drm_property *gamma_mode_property;
+	/**
 	 * @degamma_lut_property: Optional CRTC property to set the LUT used to
 	 * convert the framebuffer's colors to linear gamma.
 	 */
diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h
index e475f4a..e84389d 100644
--- a/include/uapi/drm/drm_mode.h
+++ b/include/uapi/drm/drm_mode.h
@@ -667,6 +667,17 @@ struct drm_color_lut_range {
 	__s32 min, max;
 };
 
+struct drm_color_mode_lut {
+	/* DRM_MODE_LUT_* */
+	__u32 flags;
+	/* number of points on the curve */
+	__u32 count;
+	/* Name of Gamma Mode */
+	char name[DRM_PROP_NAME_LEN];
+	/* Pointer to Lut elements */
+	__u64 lut;
+};
+
 #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:[~2019-04-01 17:30 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-01 17:30 [v2 0/7] Add Multi Segment Gamma Support Uma Shankar
2019-04-01 17:30 ` [v2 1/7] drm: Add gamma mode caps property Uma Shankar
2019-04-01 18:33   ` Sam Ravnborg
2019-04-08 14:45     ` Shankar, Uma
2019-04-01 17:30 ` [v2 2/7] drm/i915: Define color lut range structure Uma Shankar
2019-04-08 10:09   ` Ville Syrjälä
2019-04-08 12:28     ` Shankar, Uma
2019-04-01 17:30 ` Uma Shankar [this message]
2019-04-01 18:37   ` [v2 3/7] drm: Add gamma mode property Sam Ravnborg
2019-04-08 14:49     ` Shankar, Uma
2019-04-01 17:30 ` [v2 4/7] drm/i915/icl: Add register definitions for Multi Segmented gamma Uma Shankar
2019-04-01 17:30 ` [v2 5/7] drm/i915/icl: Add support for multi segmented gamma mode Uma Shankar
2019-04-08 10:19   ` Ville Syrjälä
2019-04-08 12:51     ` Shankar, Uma
2019-04-01 17:30 ` [v2 6/7] drm/i915: Add gamma mode caps property Uma Shankar
2019-04-01 17:30 ` [v2 7/7] drm/i915: Attach gamma mode property Uma Shankar
2019-04-02 12:44 ` ✗ Fi.CI.CHECKPATCH: warning for Add Multi Segment Gamma Support (rev2) Patchwork
2019-04-02 13:14 ` ✗ Fi.CI.BAT: failure " Patchwork
2019-04-05 16:12 ` [Intel-gfx] [v2 0/7] Add Multi Segment Gamma Support Ville Syrjälä
2019-04-08 12:26   ` Shankar, Uma
2019-04-08 12:31     ` Ville Syrjälä
2019-04-08 14:40       ` Shankar, Uma
2019-04-08 14:57         ` [Intel-gfx] " Ville Syrjälä
2019-04-08 15:40           ` Shankar, Uma
2019-04-08 15:45             ` Ville Syrjälä
2019-04-08 15:59               ` Shankar, Uma
2019-04-08 16:07                 ` [Intel-gfx] " Ville Syrjälä
2019-04-10 13:20                   ` Shankar, Uma
2019-04-10 15:38                     ` Ville Syrjälä
2019-04-11  7:59                       ` [Intel-gfx] " Shankar, Uma

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=1554139811-13280-4-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 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.