All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC V1 0/6] Add Plane Color Properties
@ 2017-09-26  8:02 Uma Shankar
  2017-09-26  8:02 ` [RFC v1 1/6] drm: Add Plane Degamma properties Uma Shankar
                   ` (8 more replies)
  0 siblings, 9 replies; 14+ messages in thread
From: Uma Shankar @ 2017-09-26  8:02 UTC (permalink / raw)
  To: intel-gfx, dri-devel; +Cc: ville.syrjala, maarten.lankhorst

This patch series adds properties for plane color features. It adds
properties for degamma used to linearize data, CSC used for gamut
conversion, and gamma used to again non-linearize data as per panel
supported color space. These can be utilize by user space to convert
planes from one format to another, one color space to another etc.

Usersapce can take smart blending decisions and utilize these hardware
supported plane color features to get accurate color profile. The same
can help in consistent color quality from source to panel taking
advantage of advanced color features in hardware.

These patches just add the property interfaces and enable helper functions.
Based on community feedabck on this one, we can build up and add hardware
specific implementation on top of this series.

Note: This is just to get a design feedback whether these interfaces look ok. 
Once, designed is agreed will re-send the series with a hardware specific
implementation along with IGT tests for plane color. 

Uma Shankar (6):
  drm: Add Plane Degamma properties
  drm: Add Plane CTM property
  drm: Add Plane Gamma properties
  drm: Define helper function for plane color enabling
  drm: Define helper to set legacy gamma table size
  drm/i915: Enable plane color features

 drivers/gpu/drm/drm_atomic.c         |   29 ++++++++++++++++++++
 drivers/gpu/drm/drm_color_mgmt.c     |   41 +++++++++++++++++++++++++++++
 drivers/gpu/drm/drm_mode_config.c    |   35 +++++++++++++++++++++++++
 drivers/gpu/drm/drm_plane.c          |   48 ++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/i915_drv.h      |    8 ++++++
 drivers/gpu/drm/i915/intel_color.c   |   14 ++++++++++
 drivers/gpu/drm/i915/intel_display.c |    4 +++
 drivers/gpu/drm/i915/intel_drv.h     |    9 +++++++
 drivers/gpu/drm/i915/intel_sprite.c  |    4 +++
 include/drm/drm_color_mgmt.h         |    8 ++++++
 include/drm/drm_mode_config.h        |   28 ++++++++++++++++++++
 include/drm/drm_plane.h              |   31 ++++++++++++++++++++++
 12 files changed, 259 insertions(+)

-- 
1.7.9.5

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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [RFC v1 1/6] drm: Add Plane Degamma properties
  2017-09-26  8:02 [RFC V1 0/6] Add Plane Color Properties Uma Shankar
@ 2017-09-26  8:02 ` Uma Shankar
  2017-09-26  8:02 ` [RFC v1 2/6] drm: Add Plane CTM property Uma Shankar
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 14+ messages in thread
From: Uma Shankar @ 2017-09-26  8:02 UTC (permalink / raw)
  To: intel-gfx, dri-devel; +Cc: Uma Shankar, ville.syrjala, maarten.lankhorst

Add Plane Degamma as a blob property and plane
degamma size as a range property.

Signed-off-by: Uma Shankar <uma.shankar@intel.com>
---
 drivers/gpu/drm/drm_atomic.c        |   12 ++++++++++++
 drivers/gpu/drm/drm_atomic_helper.c |    6 ++++++
 drivers/gpu/drm/drm_mode_config.c   |   14 ++++++++++++++
 include/drm/drm_mode_config.h       |   11 +++++++++++
 include/drm/drm_plane.h             |   10 ++++++++++
 5 files changed, 53 insertions(+)

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index 366c56f..e226c3b 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -716,6 +716,8 @@ static int drm_atomic_plane_set_property(struct drm_plane *plane,
 {
 	struct drm_device *dev = plane->dev;
 	struct drm_mode_config *config = &dev->mode_config;
+	bool replaced = false;
+	int ret;
 
 	if (property == config->prop_fb_id) {
 		struct drm_framebuffer *fb = drm_framebuffer_lookup(dev, val);
@@ -761,6 +763,12 @@ static int drm_atomic_plane_set_property(struct drm_plane *plane,
 	} else if (plane->funcs->atomic_set_property) {
 		return plane->funcs->atomic_set_property(plane, state,
 				property, val);
+	} else if (property == config->plane_degamma_lut_property) {
+		ret = drm_atomic_replace_property_blob_from_id(dev,
+					&state->degamma_lut,
+					val, -1, &replaced);
+		state->color_mgmt_changed |= replaced;
+		return ret;
 	} else {
 		return -EINVAL;
 	}
@@ -819,6 +827,9 @@ static int drm_atomic_plane_set_property(struct drm_plane *plane,
 		*val = state->zpos;
 	} else if (plane->funcs->atomic_get_property) {
 		return plane->funcs->atomic_get_property(plane, state, property, val);
+	} else if (property == config->plane_degamma_lut_property) {
+		*val = (state->degamma_lut) ?
+			state->degamma_lut->base.id : 0;
 	} else {
 		return -EINVAL;
 	}
@@ -955,6 +966,7 @@ static void drm_atomic_plane_print_state(struct drm_printer *p,
 	drm_printf(p, "\tcrtc-pos=" DRM_RECT_FMT "\n", DRM_RECT_ARG(&dest));
 	drm_printf(p, "\tsrc-pos=" DRM_RECT_FP_FMT "\n", DRM_RECT_FP_ARG(&src));
 	drm_printf(p, "\trotation=%x\n", state->rotation);
+	drm_printf(p, "\tcolor_mgmt_changed=%d\n", state->color_mgmt_changed);
 
 	if (plane->funcs->atomic_print_state)
 		plane->funcs->atomic_print_state(p, state);
diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index 01c34bc..fbc4c33 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -3386,6 +3386,10 @@ void __drm_atomic_helper_plane_duplicate_state(struct drm_plane *plane,
 
 	state->fence = NULL;
 	state->commit = NULL;
+
+	if (state->degamma_lut)
+		drm_property_blob_get(state->degamma_lut);
+	state->color_mgmt_changed = false;
 }
 EXPORT_SYMBOL(__drm_atomic_helper_plane_duplicate_state);
 
@@ -3430,6 +3434,8 @@ void __drm_atomic_helper_plane_destroy_state(struct drm_plane_state *state)
 
 	if (state->commit)
 		drm_crtc_commit_put(state->commit);
+
+	drm_property_blob_put(state->degamma_lut);
 }
 EXPORT_SYMBOL(__drm_atomic_helper_plane_destroy_state);
 
diff --git a/drivers/gpu/drm/drm_mode_config.c b/drivers/gpu/drm/drm_mode_config.c
index 74f6ff5..c25342c 100644
--- a/drivers/gpu/drm/drm_mode_config.c
+++ b/drivers/gpu/drm/drm_mode_config.c
@@ -344,6 +344,20 @@ static int drm_mode_create_standard_properties(struct drm_device *dev)
 		return -ENOMEM;
 	dev->mode_config.modifiers_property = prop;
 
+	prop = drm_property_create(dev,
+			DRM_MODE_PROP_BLOB,
+			"PLANE_DEGAMMA_LUT", 0);
+	if (!prop)
+		return -ENOMEM;
+	dev->mode_config.plane_degamma_lut_property = prop;
+
+	prop = drm_property_create_range(dev,
+			DRM_MODE_PROP_IMMUTABLE,
+			"PLANE_DEGAMMA_LUT_SIZE", 0, UINT_MAX);
+	if (!prop)
+		return -ENOMEM;
+	dev->mode_config.plane_degamma_lut_size_property = prop;
+
 	return 0;
 }
 
diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h
index 1b37368..df362fb 100644
--- a/include/drm/drm_mode_config.h
+++ b/include/drm/drm_mode_config.h
@@ -731,6 +731,17 @@ struct drm_mode_config {
 	struct drm_property *gamma_lut_size_property;
 
 	/**
+	 * @plane_degamma_lut_property: Optional Plane property to set the LUT
+	 * used to convert the framebuffer's colors to linear gamma.
+	 */
+	struct drm_property *plane_degamma_lut_property;
+	/**
+	 * @plane_degamma_lut_size_property: Optional Plane property for the
+	 * size of the degamma LUT as supported by the driver (read-only).
+	 */
+	struct drm_property *plane_degamma_lut_size_property;
+
+	/**
 	 * @suggested_x_property: Optional connector property with a hint for
 	 * the position of the output on the host's screen.
 	 */
diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h
index 82a217b..1cbba7c 100644
--- a/include/drm/drm_plane.h
+++ b/include/drm/drm_plane.h
@@ -123,6 +123,14 @@ struct drm_plane_state {
 	 */
 	bool visible;
 
+	/* @degamma_lut:
+	 *
+	 * Lookup table for converting framebuffer pixel data before apply the
+	 * color conversion matrix @ctm. See drm_plane_enable_color_mgmt(). The
+	 * blob (if not NULL) is an array of &struct drm_color_lut.
+	 */
+	struct drm_property_blob *degamma_lut;
+
 	/**
 	 * @commit: Tracks the pending commit to prevent use-after-free conditions,
 	 * and for async plane updates.
@@ -132,6 +140,8 @@ struct drm_plane_state {
 	struct drm_crtc_commit *commit;
 
 	struct drm_atomic_state *state;
+
+	bool color_mgmt_changed : 1;
 };
 
 static inline struct drm_rect
-- 
1.7.9.5

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [RFC v1 2/6] drm: Add Plane CTM property
  2017-09-26  8:02 [RFC V1 0/6] Add Plane Color Properties Uma Shankar
  2017-09-26  8:02 ` [RFC v1 1/6] drm: Add Plane Degamma properties Uma Shankar
@ 2017-09-26  8:02 ` Uma Shankar
  2017-09-26  8:02 ` [RFC v1 3/6] drm: Add Plane Gamma properties Uma Shankar
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 14+ messages in thread
From: Uma Shankar @ 2017-09-26  8:02 UTC (permalink / raw)
  To: intel-gfx, dri-devel; +Cc: ville.syrjala, maarten.lankhorst

Add a blob property for plane CSC usage.

Signed-off-by: Uma Shankar <uma.shankar@intel.com>
---
 drivers/gpu/drm/drm_atomic.c        |   10 ++++++++++
 drivers/gpu/drm/drm_atomic_helper.c |    3 +++
 drivers/gpu/drm/drm_mode_config.c   |    7 +++++++
 include/drm/drm_mode_config.h       |    6 ++++++
 include/drm/drm_plane.h             |    8 ++++++++
 5 files changed, 34 insertions(+)

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index e226c3b..ba88f50 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -769,6 +769,14 @@ static int drm_atomic_plane_set_property(struct drm_plane *plane,
 					val, -1, &replaced);
 		state->color_mgmt_changed |= replaced;
 		return ret;
+	} else if (property == config->plane_ctm_property) {
+		ret = drm_atomic_replace_property_blob_from_id(dev,
+					&state->ctm,
+					val,
+					sizeof(struct drm_color_ctm),
+					&replaced);
+		state->color_mgmt_changed |= replaced;
+		return ret;
 	} else {
 		return -EINVAL;
 	}
@@ -830,6 +838,8 @@ static int drm_atomic_plane_set_property(struct drm_plane *plane,
 	} else if (property == config->plane_degamma_lut_property) {
 		*val = (state->degamma_lut) ?
 			state->degamma_lut->base.id : 0;
+	} else if (property == config->plane_ctm_property) {
+		*val = (state->ctm) ? state->ctm->base.id : 0;
 	} else {
 		return -EINVAL;
 	}
diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index fbc4c33..c6d08d3 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -3389,6 +3389,8 @@ void __drm_atomic_helper_plane_duplicate_state(struct drm_plane *plane,
 
 	if (state->degamma_lut)
 		drm_property_blob_get(state->degamma_lut);
+	if (state->ctm)
+		drm_property_blob_get(state->ctm);
 	state->color_mgmt_changed = false;
 }
 EXPORT_SYMBOL(__drm_atomic_helper_plane_duplicate_state);
@@ -3436,6 +3438,7 @@ void __drm_atomic_helper_plane_destroy_state(struct drm_plane_state *state)
 		drm_crtc_commit_put(state->commit);
 
 	drm_property_blob_put(state->degamma_lut);
+	drm_property_blob_put(state->ctm);
 }
 EXPORT_SYMBOL(__drm_atomic_helper_plane_destroy_state);
 
diff --git a/drivers/gpu/drm/drm_mode_config.c b/drivers/gpu/drm/drm_mode_config.c
index c25342c..98068c5 100644
--- a/drivers/gpu/drm/drm_mode_config.c
+++ b/drivers/gpu/drm/drm_mode_config.c
@@ -358,6 +358,13 @@ static int drm_mode_create_standard_properties(struct drm_device *dev)
 		return -ENOMEM;
 	dev->mode_config.plane_degamma_lut_size_property = prop;
 
+	prop = drm_property_create(dev,
+			DRM_MODE_PROP_BLOB,
+			"PLANE_CTM", 0);
+	if (!prop)
+		return -ENOMEM;
+	dev->mode_config.plane_ctm_property = prop;
+
 	return 0;
 }
 
diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h
index df362fb..2bee0b5 100644
--- a/include/drm/drm_mode_config.h
+++ b/include/drm/drm_mode_config.h
@@ -740,6 +740,12 @@ struct drm_mode_config {
 	 * size of the degamma LUT as supported by the driver (read-only).
 	 */
 	struct drm_property *plane_degamma_lut_size_property;
+	/**
+	 * @plane_ctm_property: Optional CRTC property to set the
+	 * matrix used to convert colors after the lookup in the
+	 * degamma LUT.
+	 */
+	struct drm_property *plane_ctm_property;
 
 	/**
 	 * @suggested_x_property: Optional connector property with a hint for
diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h
index 1cbba7c..8478d5f 100644
--- a/include/drm/drm_plane.h
+++ b/include/drm/drm_plane.h
@@ -132,6 +132,14 @@ struct drm_plane_state {
 	struct drm_property_blob *degamma_lut;
 
 	/**
+	 * @ctm:
+	 *
+	 * Color transformation matrix. See drm_plane_enable_color_mgmt(). The
+	 * blob (if not NULL) is a &struct drm_color_ctm.
+	 */
+	struct drm_property_blob *ctm;
+
+	/**
 	 * @commit: Tracks the pending commit to prevent use-after-free conditions,
 	 * and for async plane updates.
 	 *
-- 
1.7.9.5

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

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [RFC v1 3/6] drm: Add Plane Gamma properties
  2017-09-26  8:02 [RFC V1 0/6] Add Plane Color Properties Uma Shankar
  2017-09-26  8:02 ` [RFC v1 1/6] drm: Add Plane Degamma properties Uma Shankar
  2017-09-26  8:02 ` [RFC v1 2/6] drm: Add Plane CTM property Uma Shankar
@ 2017-09-26  8:02 ` Uma Shankar
  2017-09-26  8:02 ` [RFC v1 4/6] drm: Define helper function for plane color enabling Uma Shankar
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 14+ messages in thread
From: Uma Shankar @ 2017-09-26  8:02 UTC (permalink / raw)
  To: intel-gfx, dri-devel; +Cc: Uma Shankar, ville.syrjala, maarten.lankhorst

Add plane gamma as blob property and size as a
range property.

Signed-off-by: Uma Shankar <uma.shankar@intel.com>
---
 drivers/gpu/drm/drm_atomic.c        |    8 ++++++++
 drivers/gpu/drm/drm_atomic_helper.c |    3 +++
 drivers/gpu/drm/drm_mode_config.c   |   14 ++++++++++++++
 include/drm/drm_mode_config.h       |   11 +++++++++++
 include/drm/drm_plane.h             |    9 +++++++++
 5 files changed, 45 insertions(+)

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index ba88f50..f5c7188 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -777,6 +777,12 @@ static int drm_atomic_plane_set_property(struct drm_plane *plane,
 					&replaced);
 		state->color_mgmt_changed |= replaced;
 		return ret;
+	} else if (property == config->plane_gamma_lut_property) {
+		ret = drm_atomic_replace_property_blob_from_id(dev,
+					&state->gamma_lut,
+					val, -1, &replaced);
+		state->color_mgmt_changed |= replaced;
+		return ret;
 	} else {
 		return -EINVAL;
 	}
@@ -840,6 +846,8 @@ static int drm_atomic_plane_set_property(struct drm_plane *plane,
 			state->degamma_lut->base.id : 0;
 	} else if (property == config->plane_ctm_property) {
 		*val = (state->ctm) ? state->ctm->base.id : 0;
+	} else if (property == config->plane_gamma_lut_property) {
+		*val = (state->gamma_lut) ? state->gamma_lut->base.id : 0;
 	} else {
 		return -EINVAL;
 	}
diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index c6d08d3..3bf39a5 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -3391,6 +3391,8 @@ void __drm_atomic_helper_plane_duplicate_state(struct drm_plane *plane,
 		drm_property_blob_get(state->degamma_lut);
 	if (state->ctm)
 		drm_property_blob_get(state->ctm);
+	if (state->gamma_lut)
+		drm_property_blob_get(state->gamma_lut);
 	state->color_mgmt_changed = false;
 }
 EXPORT_SYMBOL(__drm_atomic_helper_plane_duplicate_state);
@@ -3439,6 +3441,7 @@ void __drm_atomic_helper_plane_destroy_state(struct drm_plane_state *state)
 
 	drm_property_blob_put(state->degamma_lut);
 	drm_property_blob_put(state->ctm);
+	drm_property_blob_put(state->gamma_lut);
 }
 EXPORT_SYMBOL(__drm_atomic_helper_plane_destroy_state);
 
diff --git a/drivers/gpu/drm/drm_mode_config.c b/drivers/gpu/drm/drm_mode_config.c
index 98068c5..c8f6b49 100644
--- a/drivers/gpu/drm/drm_mode_config.c
+++ b/drivers/gpu/drm/drm_mode_config.c
@@ -365,6 +365,20 @@ static int drm_mode_create_standard_properties(struct drm_device *dev)
 		return -ENOMEM;
 	dev->mode_config.plane_ctm_property = prop;
 
+	prop = drm_property_create(dev,
+			DRM_MODE_PROP_BLOB,
+			"PLANE_GAMMA_LUT", 0);
+	if (!prop)
+		return -ENOMEM;
+	dev->mode_config.plane_gamma_lut_property = prop;
+
+	prop = drm_property_create_range(dev,
+			DRM_MODE_PROP_IMMUTABLE,
+			"PLANE_GAMMA_LUT_SIZE", 0, UINT_MAX);
+	if (!prop)
+		return -ENOMEM;
+	dev->mode_config.plane_gamma_lut_size_property = prop;
+
 	return 0;
 }
 
diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h
index 2bee0b5..f509b06 100644
--- a/include/drm/drm_mode_config.h
+++ b/include/drm/drm_mode_config.h
@@ -746,6 +746,17 @@ struct drm_mode_config {
 	 * degamma LUT.
 	 */
 	struct drm_property *plane_ctm_property;
+	/**
+	 * @plane_gamma_lut_property: Optional Plane property to set the LUT
+	 * used to convert the colors, after the CTM matrix, to the common
+	 * gamma space chosen for blending.
+	 */
+	struct drm_property *plane_gamma_lut_property;
+	/**
+	 * @plane_gamma_lut_size_property: Optional Plane property for the size
+	 * of the gamma LUT as supported by the driver (read-only).
+	 */
+	struct drm_property *plane_gamma_lut_size_property;
 
 	/**
 	 * @suggested_x_property: Optional connector property with a hint for
diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h
index 8478d5f..172d0c1 100644
--- a/include/drm/drm_plane.h
+++ b/include/drm/drm_plane.h
@@ -140,6 +140,15 @@ struct drm_plane_state {
 	struct drm_property_blob *ctm;
 
 	/**
+	 * @gamma_lut:
+	 *
+	 * Lookup table for converting pixel data after the color conversion
+	 * matrix @ctm.  See drm_plane_enable_color_mgmt(). The blob (if not
+	 * NULL) is an array of &struct drm_color_lut.
+	 */
+	struct drm_property_blob *gamma_lut;
+
+	/**
 	 * @commit: Tracks the pending commit to prevent use-after-free conditions,
 	 * and for async plane updates.
 	 *
-- 
1.7.9.5

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [RFC v1 4/6] drm: Define helper function for plane color enabling
  2017-09-26  8:02 [RFC V1 0/6] Add Plane Color Properties Uma Shankar
                   ` (2 preceding siblings ...)
  2017-09-26  8:02 ` [RFC v1 3/6] drm: Add Plane Gamma properties Uma Shankar
@ 2017-09-26  8:02 ` Uma Shankar
  2017-09-26  8:02 ` [RFC v1 5/6] drm: Define helper to set legacy gamma table size Uma Shankar
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 14+ messages in thread
From: Uma Shankar @ 2017-09-26  8:02 UTC (permalink / raw)
  To: intel-gfx, dri-devel; +Cc: ville.syrjala, maarten.lankhorst

Define helper function to enable Plane color features
to attach plane color properties to plane structure.

Signed-off-by: Uma Shankar <uma.shankar@intel.com>
---
 drivers/gpu/drm/drm_plane.c  |   48 ++++++++++++++++++++++++++++++++++++++++++
 include/drm/drm_color_mgmt.h |    5 +++++
 2 files changed, 53 insertions(+)

diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
index 72cba98..f327f56 100644
--- a/drivers/gpu/drm/drm_plane.c
+++ b/drivers/gpu/drm/drm_plane.c
@@ -144,6 +144,54 @@ static int create_in_format_blob(struct drm_device *dev, struct drm_plane *plane
 }
 
 /**
+ * drm_plane_enable_color_mgmt - enable color management properties
+ * @plane: DRM Plane
+ * @plane_degamma_lut_size: the size of the degamma lut (before CSC)
+ * @plane_has_ctm: whether to attach ctm_property for CSC matrix
+ * @plane_gamma_lut_size: the size of the gamma lut (after CSC)
+ *
+ * This function lets the driver enable the color correction
+ * properties on a plane. This includes 3 degamma, csc and gamma
+ * properties that userspace can set and 2 size properties to inform
+ * the userspace of the lut sizes. Each of the properties are
+ * optional. The gamma and degamma properties are only attached if
+ * their size is not 0 and ctm_property is only attached if has_ctm is
+ * true.
+ *
+ * Drivers should use drm_atomic_helper_legacy_gamma_set() to implement the
+ * legacy &drm_crtc_funcs.gamma_set callback.
+ */
+void drm_plane_enable_color_mgmt(struct drm_plane *plane,
+				uint plane_degamma_lut_size,
+				bool plane_has_ctm,
+				uint plane_gamma_lut_size)
+{
+	struct drm_device *dev = plane->dev;
+	struct drm_mode_config *config = &dev->mode_config;
+
+	if (plane_degamma_lut_size) {
+		drm_object_attach_property(&plane->base,
+				config->plane_degamma_lut_property, 0);
+		drm_object_attach_property(&plane->base,
+				config->plane_degamma_lut_size_property,
+				plane_degamma_lut_size);
+	}
+
+	if (plane_has_ctm)
+		drm_object_attach_property(&plane->base,
+				config->plane_ctm_property, 0);
+
+	if (plane_gamma_lut_size) {
+		drm_object_attach_property(&plane->base,
+				config->plane_gamma_lut_property, 0);
+		drm_object_attach_property(&plane->base,
+				config->plane_gamma_lut_size_property,
+				plane_gamma_lut_size);
+	}
+}
+EXPORT_SYMBOL(drm_plane_enable_color_mgmt);
+
+/**
  * drm_universal_plane_init - Initialize a new universal plane object
  * @dev: DRM device
  * @plane: plane object to init
diff --git a/include/drm/drm_color_mgmt.h b/include/drm/drm_color_mgmt.h
index 03a59cb..155a9ba 100644
--- a/include/drm/drm_color_mgmt.h
+++ b/include/drm/drm_color_mgmt.h
@@ -37,4 +37,9 @@ void drm_crtc_enable_color_mgmt(struct drm_crtc *crtc,
 int drm_mode_crtc_set_gamma_size(struct drm_crtc *crtc,
 				 int gamma_size);
 
+void drm_plane_enable_color_mgmt(struct drm_plane *plane,
+				 uint plane_degamma_lut_size,
+				 bool plane_has_ctm,
+				 uint plane_gamma_lut_size);
+
 #endif
-- 
1.7.9.5

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

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [RFC v1 5/6] drm: Define helper to set legacy gamma table size
  2017-09-26  8:02 [RFC V1 0/6] Add Plane Color Properties Uma Shankar
                   ` (3 preceding siblings ...)
  2017-09-26  8:02 ` [RFC v1 4/6] drm: Define helper function for plane color enabling Uma Shankar
@ 2017-09-26  8:02 ` Uma Shankar
  2017-09-26 10:05   ` Lankhorst, Maarten
  2017-09-26  8:02 ` [RFC v1 6/6] drm/i915: Enable plane color features Uma Shankar
                   ` (3 subsequent siblings)
  8 siblings, 1 reply; 14+ messages in thread
From: Uma Shankar @ 2017-09-26  8:02 UTC (permalink / raw)
  To: intel-gfx, dri-devel; +Cc: ville.syrjala, maarten.lankhorst

Define a helper function to set legacy gamma table
size for planes.

Signed-off-by: Uma Shankar <uma.shankar@intel.com>
---
 drivers/gpu/drm/drm_color_mgmt.c |   41 ++++++++++++++++++++++++++++++++++++++
 include/drm/drm_color_mgmt.h     |    3 +++
 include/drm/drm_plane.h          |    4 ++++
 3 files changed, 48 insertions(+)

diff --git a/drivers/gpu/drm/drm_color_mgmt.c b/drivers/gpu/drm/drm_color_mgmt.c
index fe09827..8aef6b5 100644
--- a/drivers/gpu/drm/drm_color_mgmt.c
+++ b/drivers/gpu/drm/drm_color_mgmt.c
@@ -204,6 +204,47 @@ int drm_mode_crtc_set_gamma_size(struct drm_crtc *crtc,
 EXPORT_SYMBOL(drm_mode_crtc_set_gamma_size);
 
 /**
+ * drm_mode_plane_set_gamma_size - set the gamma table size
+ * @plane: Plane to set the gamma table size for
+ * @gamma_size: size of the gamma table
+ *
+ * Drivers which support gamma tables should set this to the supported gamma
+ * table size when initializing the Plane. Currently the drm core only supports
+ * a fixed gamma table size.
+ *
+ * Returns:
+ * Zero on success, negative errno on failure.
+ */
+int drm_mode_plane_set_gamma_size(struct drm_plane *plane,
+				int gamma_size)
+{
+	uint16_t *r_base, *g_base, *b_base;
+	int i;
+
+	plane->gamma_size = gamma_size;
+
+	plane->gamma_store = kcalloc(gamma_size, sizeof(uint16_t) * 3,
+			GFP_KERNEL);
+	if (!plane->gamma_store) {
+		plane->gamma_size = 0;
+		return -ENOMEM;
+	}
+
+	r_base = plane->gamma_store;
+	g_base = r_base + gamma_size;
+	b_base = g_base + gamma_size;
+	for (i = 0; i < gamma_size; i++) {
+		r_base[i] = i << 8;
+		g_base[i] = i << 8;
+		b_base[i] = i << 8;
+	}
+
+
+	return 0;
+}
+EXPORT_SYMBOL(drm_mode_plane_set_gamma_size);
+
+/**
  * drm_mode_gamma_set_ioctl - set the gamma table
  * @dev: DRM device
  * @data: ioctl data
diff --git a/include/drm/drm_color_mgmt.h b/include/drm/drm_color_mgmt.h
index 155a9ba..2f59c82 100644
--- a/include/drm/drm_color_mgmt.h
+++ b/include/drm/drm_color_mgmt.h
@@ -42,4 +42,7 @@ void drm_plane_enable_color_mgmt(struct drm_plane *plane,
 				 bool plane_has_ctm,
 				 uint plane_gamma_lut_size);
 
+int drm_mode_plane_set_gamma_size(struct drm_plane *plane,
+				  int plane_gamma_size);
+
 #endif
diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h
index 172d0c1..7dc8e53 100644
--- a/include/drm/drm_plane.h
+++ b/include/drm/drm_plane.h
@@ -575,6 +575,10 @@ struct drm_plane {
 
 	struct drm_property *zpos_property;
 	struct drm_property *rotation_property;
+
+	/* Legacy FB Plane gamma size for reporting to userspace */
+	uint32_t gamma_size;
+	uint16_t *gamma_store;
 };
 
 #define obj_to_plane(x) container_of(x, struct drm_plane, base)
-- 
1.7.9.5

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

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [RFC v1 6/6] drm/i915: Enable plane color features
  2017-09-26  8:02 [RFC V1 0/6] Add Plane Color Properties Uma Shankar
                   ` (4 preceding siblings ...)
  2017-09-26  8:02 ` [RFC v1 5/6] drm: Define helper to set legacy gamma table size Uma Shankar
@ 2017-09-26  8:02 ` Uma Shankar
  2017-09-26  9:31 ` ✓ Fi.CI.BAT: success for Add Plane Color Properties Patchwork
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 14+ messages in thread
From: Uma Shankar @ 2017-09-26  8:02 UTC (permalink / raw)
  To: intel-gfx, dri-devel; +Cc: Uma Shankar, ville.syrjala, maarten.lankhorst

Enable and initilaize plane color features.

Signed-off-by: Uma Shankar <uma.shankar@intel.com>
---
 drivers/gpu/drm/i915/i915_drv.h      |    8 ++++++++
 drivers/gpu/drm/i915/intel_color.c   |   14 ++++++++++++++
 drivers/gpu/drm/i915/intel_display.c |    4 ++++
 drivers/gpu/drm/i915/intel_drv.h     |    9 +++++++++
 drivers/gpu/drm/i915/intel_sprite.c  |    4 ++++
 5 files changed, 39 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 1cc31a5..0d3e93f 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -742,6 +742,9 @@ struct drm_i915_display_funcs {
 
 	void (*load_csc_matrix)(struct drm_crtc_state *crtc_state);
 	void (*load_luts)(struct drm_crtc_state *crtc_state);
+	/* Add Plane Color callbacks */
+	void (*load_plane_csc_matrix)(struct drm_plane_state *plane_state);
+	void (*load_plane_luts)(struct drm_plane_state *plane_state);
 };
 
 #define CSR_VERSION(major, minor)	((major) << 16 | (minor))
@@ -880,6 +883,11 @@ struct intel_device_info {
 		u16 degamma_lut_size;
 		u16 gamma_lut_size;
 	} color;
+
+	struct plane_color_luts {
+		u16 plane_degamma_lut_size;
+		u16 plane_gamma_lut_size;
+	} plane_color;
 };
 
 struct intel_display_error_state;
diff --git a/drivers/gpu/drm/i915/intel_color.c b/drivers/gpu/drm/i915/intel_color.c
index ff9ecd2..b9042b6 100644
--- a/drivers/gpu/drm/i915/intel_color.c
+++ b/drivers/gpu/drm/i915/intel_color.c
@@ -643,6 +643,20 @@ int intel_color_check(struct drm_crtc *crtc,
 	return -EINVAL;
 }
 
+void intel_plane_color_init(struct drm_plane *plane)
+{
+	struct drm_i915_private *dev_priv = to_i915(plane->dev);
+
+	drm_mode_plane_set_gamma_size(plane, 16);
+
+	/* Enable color management support when we have degamma & gamma LUTs. */
+	if (INTEL_INFO(dev_priv)->plane_color.plane_degamma_lut_size != 0 &&
+	    INTEL_INFO(dev_priv)->plane_color.plane_gamma_lut_size != 0)
+		drm_plane_enable_color_mgmt(plane,
+		INTEL_INFO(dev_priv)->plane_color.plane_degamma_lut_size,
+		true, INTEL_INFO(dev_priv)->plane_color.plane_gamma_lut_size);
+}
+
 void intel_color_init(struct drm_crtc *crtc)
 {
 	struct drm_i915_private *dev_priv = to_i915(crtc->dev);
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 524217d..b7af09a 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -13302,6 +13302,10 @@ static bool intel_cursor_plane_format_mod_supported(struct drm_plane *plane,
 						   DRM_MODE_ROTATE_0,
 						   supported_rotations);
 
+	/* Add Plane Color properties */
+	if (INTEL_GEN(dev_priv) >= 9)
+		intel_plane_color_init(&primary->base);
+
 	drm_plane_helper_add(&primary->base, &intel_plane_helper_funcs);
 
 	return primary;
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 3078076..740339a 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -440,6 +440,14 @@ struct intel_plane_state {
 	 */
 	int scaler_id;
 
+	/*
+	 * Use reduced/limited/broadcast rbg range, compressing from the full
+	 * range fed into the crtcs.
+	 */
+	bool limited_color_range;
+	/* Gamma mode programmed on the plane */
+	uint32_t gamma_mode;
+
 	struct drm_intel_sprite_colorkey ckey;
 };
 
@@ -2000,6 +2008,7 @@ int intel_plane_atomic_check_with_state(const struct intel_crtc_state *old_crtc_
 int intel_color_check(struct drm_crtc *crtc, struct drm_crtc_state *state);
 void intel_color_set_csc(struct drm_crtc_state *crtc_state);
 void intel_color_load_luts(struct drm_crtc_state *crtc_state);
+void intel_plane_color_init(struct drm_plane *plane);
 
 /* intel_lspcon.c */
 bool lspcon_init(struct intel_digital_port *intel_dig_port);
diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
index b0d6e3e..13381d0 100644
--- a/drivers/gpu/drm/i915/intel_sprite.c
+++ b/drivers/gpu/drm/i915/intel_sprite.c
@@ -1324,6 +1324,10 @@ struct intel_plane *
 					   DRM_MODE_ROTATE_0,
 					   supported_rotations);
 
+	/* Add Plane Color properties */
+	if (INTEL_GEN(dev_priv) >= 9)
+		intel_plane_color_init(&intel_plane->base);
+
 	drm_plane_helper_add(&intel_plane->base, &intel_plane_helper_funcs);
 
 	return intel_plane;
-- 
1.7.9.5

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* ✓ Fi.CI.BAT: success for Add Plane Color Properties
  2017-09-26  8:02 [RFC V1 0/6] Add Plane Color Properties Uma Shankar
                   ` (5 preceding siblings ...)
  2017-09-26  8:02 ` [RFC v1 6/6] drm/i915: Enable plane color features Uma Shankar
@ 2017-09-26  9:31 ` Patchwork
  2017-09-26 11:16 ` [Intel-gfx] [RFC V1 0/6] " Daniel Vetter
  2017-09-26 12:53 ` ✓ Fi.CI.IGT: success for " Patchwork
  8 siblings, 0 replies; 14+ messages in thread
From: Patchwork @ 2017-09-26  9:31 UTC (permalink / raw)
  To: Uma Shankar; +Cc: intel-gfx

== Series Details ==

Series: Add Plane Color Properties
URL   : https://patchwork.freedesktop.org/series/30875/
State : success

== Summary ==

Series 30875v1 Add Plane Color Properties
https://patchwork.freedesktop.org/api/1.0/series/30875/revisions/1/mbox/

Test kms_pipe_crc_basic:
        Subgroup hang-read-crc-pipe-b:
                dmesg-warn -> INCOMPLETE (fi-cfl-s) fdo#102294
Test drv_module_reload:
        Subgroup basic-no-display:
                dmesg-warn -> PASS       (fi-glk-1) fdo#102777

fdo#102294 https://bugs.freedesktop.org/show_bug.cgi?id=102294
fdo#102777 https://bugs.freedesktop.org/show_bug.cgi?id=102777

fi-bdw-5557u     total:289  pass:268  dwarn:0   dfail:0   fail:0   skip:21  time:448s
fi-bdw-gvtdvm    total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:469s
fi-blb-e6850     total:289  pass:224  dwarn:1   dfail:0   fail:0   skip:64  time:424s
fi-bsw-n3050     total:289  pass:243  dwarn:0   dfail:0   fail:0   skip:46  time:514s
fi-bwr-2160      total:289  pass:184  dwarn:0   dfail:0   fail:0   skip:105 time:277s
fi-bxt-j4205     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:505s
fi-byt-j1900     total:289  pass:254  dwarn:1   dfail:0   fail:0   skip:34  time:489s
fi-byt-n2820     total:289  pass:250  dwarn:1   dfail:0   fail:0   skip:38  time:492s
fi-cfl-s         total:231  pass:188  dwarn:17  dfail:0   fail:0   skip:25 
fi-cnl-y         total:289  pass:256  dwarn:0   dfail:0   fail:6   skip:27  time:637s
fi-elk-e7500     total:289  pass:230  dwarn:0   dfail:0   fail:0   skip:59  time:417s
fi-glk-1         total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:565s
fi-hsw-4770      total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:425s
fi-hsw-4770r     total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:403s
fi-ilk-650       total:289  pass:229  dwarn:0   dfail:0   fail:0   skip:60  time:433s
fi-ivb-3520m     total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:491s
fi-ivb-3770      total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:459s
fi-kbl-7500u     total:289  pass:264  dwarn:1   dfail:0   fail:0   skip:24  time:474s
fi-kbl-r         total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:590s
fi-pnv-d510      total:289  pass:223  dwarn:1   dfail:0   fail:0   skip:65  time:546s
fi-skl-6260u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:452s
fi-skl-6700k     total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:747s
fi-skl-6770hq    total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:487s
fi-skl-gvtdvm    total:289  pass:266  dwarn:0   dfail:0   fail:0   skip:23  time:471s
fi-snb-2520m     total:289  pass:251  dwarn:0   dfail:0   fail:0   skip:38  time:566s
fi-snb-2600      total:289  pass:250  dwarn:0   dfail:0   fail:0   skip:39  time:421s
fi-kbl-7560u failed to connect after reboot

b7dc379de4c0776d101c6be461ff5e18a2e9ae6e drm-tip: 2017y-09m-26d-08h-41m-45s UTC integration manifest
fe16c4775028 drm/i915: Enable plane color features
b6cc051ed4f7 drm: Define helper to set legacy gamma table size
d2c72cf8e4ec drm: Define helper function for plane color enabling
38c3e81c76d9 drm: Add Plane Gamma properties
36280cc42061 drm: Add Plane CTM property
4da58c1cba9d drm: Add Plane Degamma properties

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_5812/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [RFC v1 5/6] drm: Define helper to set legacy gamma table size
  2017-09-26  8:02 ` [RFC v1 5/6] drm: Define helper to set legacy gamma table size Uma Shankar
@ 2017-09-26 10:05   ` Lankhorst, Maarten
  2017-09-26 10:11     ` Shankar, Uma
  0 siblings, 1 reply; 14+ messages in thread
From: Lankhorst, Maarten @ 2017-09-26 10:05 UTC (permalink / raw)
  To: Shankar, Uma, intel-gfx, dri-devel; +Cc: Syrjala, Ville

Hey,

Uma Shankar schreef op di 26-09-2017 om 13:32 [+0530]:
> Define a helper function to set legacy gamma table
> size for planes.
> 
> Signed-off-by: Uma Shankar <uma.shankar@intel.com>
> ---
>  drivers/gpu/drm/drm_color_mgmt.c |   41
> ++++++++++++++++++++++++++++++++++++++
>  include/drm/drm_color_mgmt.h     |    3 +++
>  include/drm/drm_plane.h          |    4 ++++
>  3 files changed, 48 insertions(+)

Is this needed? I'm not aware of legacy tables for planes.

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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [RFC v1 5/6] drm: Define helper to set legacy gamma table size
  2017-09-26 10:05   ` Lankhorst, Maarten
@ 2017-09-26 10:11     ` Shankar, Uma
  2017-09-26 10:15       ` Lankhorst, Maarten
  0 siblings, 1 reply; 14+ messages in thread
From: Shankar, Uma @ 2017-09-26 10:11 UTC (permalink / raw)
  To: Lankhorst, Maarten, intel-gfx, dri-devel; +Cc: Syrjala, Ville



>-----Original Message-----
>From: dri-devel [mailto:dri-devel-bounces@lists.freedesktop.org] On Behalf Of
>Lankhorst, Maarten
>Sent: Tuesday, September 26, 2017 3:36 PM
>To: Shankar, Uma <uma.shankar@intel.com>; intel-gfx@lists.freedesktop.org;
>dri-devel@lists.freedesktop.org
>Cc: Syrjala, Ville <ville.syrjala@intel.com>
>Subject: Re: [RFC v1 5/6] drm: Define helper to set legacy gamma table size
>
>Hey,
>
>Uma Shankar schreef op di 26-09-2017 om 13:32 [+0530]:
>> Define a helper function to set legacy gamma table size for planes.
>>
>> Signed-off-by: Uma Shankar <uma.shankar@intel.com>
>> ---
>>  drivers/gpu/drm/drm_color_mgmt.c |   41
>> ++++++++++++++++++++++++++++++++++++++
>>  include/drm/drm_color_mgmt.h     |    3 +++
>>  include/drm/drm_plane.h          |    4 ++++
>>  3 files changed, 48 insertions(+)
>
>Is this needed? I'm not aware of legacy tables for planes.

I was not getting very concrete info on this. So kept it as per pipe gamma implementation.
I will try to get some more info and drop this in case it's not required.

Regards,
Uma Shankar

>Kind regards,
>Maarten
>_______________________________________________
>dri-devel mailing list
>dri-devel@lists.freedesktop.org
>https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [RFC v1 5/6] drm: Define helper to set legacy gamma table size
  2017-09-26 10:11     ` Shankar, Uma
@ 2017-09-26 10:15       ` Lankhorst, Maarten
  2017-09-26 10:20         ` Shankar, Uma
  0 siblings, 1 reply; 14+ messages in thread
From: Lankhorst, Maarten @ 2017-09-26 10:15 UTC (permalink / raw)
  To: Shankar, Uma, intel-gfx, dri-devel; +Cc: Syrjala, Ville

Shankar, Uma schreef op di 26-09-2017 om 15:41 [+0530]:
> > -----Original Message-----
> > From: dri-devel [mailto:dri-devel-bounces@lists.freedesktop.org] On
> > Behalf Of
> > Lankhorst, Maarten
> > Sent: Tuesday, September 26, 2017 3:36 PM
> > To: Shankar, Uma <uma.shankar@intel.com>; intel-gfx@lists.freedeskt
> > op.org;
> > dri-devel@lists.freedesktop.org
> > Cc: Syrjala, Ville <ville.syrjala@intel.com>
> > Subject: Re: [RFC v1 5/6] drm: Define helper to set legacy gamma
> > table size
> > 
> > Hey,
> > 
> > Uma Shankar schreef op di 26-09-2017 om 13:32 [+0530]:
> > > Define a helper function to set legacy gamma table size for
> > > planes.
> > > 
> > > Signed-off-by: Uma Shankar <uma.shankar@intel.com>
> > > ---
> > >  drivers/gpu/drm/drm_color_mgmt.c |   41
> > > ++++++++++++++++++++++++++++++++++++++
> > >  include/drm/drm_color_mgmt.h     |    3 +++
> > >  include/drm/drm_plane.h          |    4 ++++
> > >  3 files changed, 48 insertions(+)
> > 
> > Is this needed? I'm not aware of legacy tables for planes.
> 
> I was not getting very concrete info on this. So kept it as per pipe
> gamma implementation.
> I will try to get some more info and drop this in case it's not
> required.
> 

It's not, legacy gamma would only be used in drm_mode_gamma_get_ioctl,
which if you look at it only works for a crtc. :)

~Maarten
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 14+ messages in thread

* RE: [RFC v1 5/6] drm: Define helper to set legacy gamma table size
  2017-09-26 10:15       ` Lankhorst, Maarten
@ 2017-09-26 10:20         ` Shankar, Uma
  0 siblings, 0 replies; 14+ messages in thread
From: Shankar, Uma @ 2017-09-26 10:20 UTC (permalink / raw)
  To: Lankhorst, Maarten, intel-gfx, dri-devel; +Cc: Syrjala, Ville



>-----Original Message-----
>From: Lankhorst, Maarten
>Sent: Tuesday, September 26, 2017 3:45 PM
>To: Shankar, Uma <uma.shankar@intel.com>; intel-gfx@lists.freedesktop.org;
>dri-devel@lists.freedesktop.org
>Cc: Syrjala, Ville <ville.syrjala@intel.com>
>Subject: Re: [RFC v1 5/6] drm: Define helper to set legacy gamma table size
>
>Shankar, Uma schreef op di 26-09-2017 om 15:41 [+0530]:
>> > -----Original Message-----
>> > From: dri-devel [mailto:dri-devel-bounces@lists.freedesktop.org] On
>> > Behalf Of Lankhorst, Maarten
>> > Sent: Tuesday, September 26, 2017 3:36 PM
>> > To: Shankar, Uma <uma.shankar@intel.com>; intel-gfx@lists.freedeskt
>> > op.org; dri-devel@lists.freedesktop.org
>> > Cc: Syrjala, Ville <ville.syrjala@intel.com>
>> > Subject: Re: [RFC v1 5/6] drm: Define helper to set legacy gamma
>> > table size
>> >
>> > Hey,
>> >
>> > Uma Shankar schreef op di 26-09-2017 om 13:32 [+0530]:
>> > > Define a helper function to set legacy gamma table size for
>> > > planes.
>> > >
>> > > Signed-off-by: Uma Shankar <uma.shankar@intel.com>
>> > > ---
>> > >  drivers/gpu/drm/drm_color_mgmt.c |   41
>> > > ++++++++++++++++++++++++++++++++++++++
>> > >  include/drm/drm_color_mgmt.h     |    3 +++
>> > >  include/drm/drm_plane.h          |    4 ++++
>> > >  3 files changed, 48 insertions(+)
>> >
>> > Is this needed? I'm not aware of legacy tables for planes.
>>
>> I was not getting very concrete info on this. So kept it as per pipe
>> gamma implementation.
>> I will try to get some more info and drop this in case it's not
>> required.
>>
>
>It's not, legacy gamma would only be used in drm_mode_gamma_get_ioctl,
>which if you look at it only works for a crtc. :)
>

Yeah I thought that it was just added for crtc, and implementation for plane was not done. 
Was not sure if it can also be extended for plane.

Will drop this change. Thanks for clarifying.

Regards,
Uma Shankar

>~Maarten
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Intel-gfx] [RFC V1 0/6] Add Plane Color Properties
  2017-09-26  8:02 [RFC V1 0/6] Add Plane Color Properties Uma Shankar
                   ` (6 preceding siblings ...)
  2017-09-26  9:31 ` ✓ Fi.CI.BAT: success for Add Plane Color Properties Patchwork
@ 2017-09-26 11:16 ` Daniel Vetter
  2017-09-26 12:53 ` ✓ Fi.CI.IGT: success for " Patchwork
  8 siblings, 0 replies; 14+ messages in thread
From: Daniel Vetter @ 2017-09-26 11:16 UTC (permalink / raw)
  To: Uma Shankar; +Cc: intel-gfx, ville.syrjala, maarten.lankhorst, dri-devel

On Tue, Sep 26, 2017 at 01:32:52PM +0530, Uma Shankar wrote:
> This patch series adds properties for plane color features. It adds
> properties for degamma used to linearize data, CSC used for gamut
> conversion, and gamma used to again non-linearize data as per panel
> supported color space. These can be utilize by user space to convert
> planes from one format to another, one color space to another etc.
> 
> Usersapce can take smart blending decisions and utilize these hardware
> supported plane color features to get accurate color profile. The same
> can help in consistent color quality from source to panel taking
> advantage of advanced color features in hardware.
> 
> These patches just add the property interfaces and enable helper functions.
> Based on community feedabck on this one, we can build up and add hardware
> specific implementation on top of this series.
> 
> Note: This is just to get a design feedback whether these interfaces look ok. 
> Once, designed is agreed will re-send the series with a hardware specific
> implementation along with IGT tests for plane color. 

What's missing from this is the property documentation for the userspace
abi, like we have for the pipe color manager stuff:

https://dri.freedesktop.org/docs/drm/gpu/drm-kms.html#color-management-properties

Otherwise looks like a reasonable series, but the real challenges here is
properly enabling this in a HDR (or at least color space) aware compositor.
-Daniel

> 
> Uma Shankar (6):
>   drm: Add Plane Degamma properties
>   drm: Add Plane CTM property
>   drm: Add Plane Gamma properties
>   drm: Define helper function for plane color enabling
>   drm: Define helper to set legacy gamma table size
>   drm/i915: Enable plane color features
> 
>  drivers/gpu/drm/drm_atomic.c         |   29 ++++++++++++++++++++
>  drivers/gpu/drm/drm_color_mgmt.c     |   41 +++++++++++++++++++++++++++++
>  drivers/gpu/drm/drm_mode_config.c    |   35 +++++++++++++++++++++++++
>  drivers/gpu/drm/drm_plane.c          |   48 ++++++++++++++++++++++++++++++++++
>  drivers/gpu/drm/i915/i915_drv.h      |    8 ++++++
>  drivers/gpu/drm/i915/intel_color.c   |   14 ++++++++++
>  drivers/gpu/drm/i915/intel_display.c |    4 +++
>  drivers/gpu/drm/i915/intel_drv.h     |    9 +++++++
>  drivers/gpu/drm/i915/intel_sprite.c  |    4 +++
>  include/drm/drm_color_mgmt.h         |    8 ++++++
>  include/drm/drm_mode_config.h        |   28 ++++++++++++++++++++
>  include/drm/drm_plane.h              |   31 ++++++++++++++++++++++
>  12 files changed, 259 insertions(+)
> 
> -- 
> 1.7.9.5
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 14+ messages in thread

* ✓ Fi.CI.IGT: success for Add Plane Color Properties
  2017-09-26  8:02 [RFC V1 0/6] Add Plane Color Properties Uma Shankar
                   ` (7 preceding siblings ...)
  2017-09-26 11:16 ` [Intel-gfx] [RFC V1 0/6] " Daniel Vetter
@ 2017-09-26 12:53 ` Patchwork
  8 siblings, 0 replies; 14+ messages in thread
From: Patchwork @ 2017-09-26 12:53 UTC (permalink / raw)
  To: Shankar, Uma; +Cc: intel-gfx

== Series Details ==

Series: Add Plane Color Properties
URL   : https://patchwork.freedesktop.org/series/30875/
State : success

== Summary ==

Test kms_plane:
        Subgroup plane-panning-bottom-right-suspend-pipe-C-planes:
                skip       -> PASS       (shard-hsw)
        Subgroup plane-position-covered-pipe-A-planes:
                skip       -> PASS       (shard-hsw)
Test kms_frontbuffer_tracking:
        Subgroup fbc-1p-primscrn-spr-indfb-draw-mmap-wc:
                skip       -> PASS       (shard-hsw)
        Subgroup fbc-1p-offscren-pri-shrfb-draw-render:
                skip       -> PASS       (shard-hsw)
Test kms_vblank:
        Subgroup query-forked-busy:
                skip       -> PASS       (shard-hsw)
Test kms_atomic:
        Subgroup plane_invalid_params_fence:
                skip       -> PASS       (shard-hsw)
Test kms_chv_cursor_fail:
        Subgroup pipe-B-64x64-bottom-edge:
                skip       -> PASS       (shard-hsw)
Test kms_cursor_crc:
        Subgroup cursor-64x64-sliding:
                skip       -> PASS       (shard-hsw)
Test perf:
        Subgroup blocking:
                pass       -> FAIL       (shard-hsw) fdo#102252

fdo#102252 https://bugs.freedesktop.org/show_bug.cgi?id=102252

shard-hsw        total:2429 pass:1323 dwarn:6   dfail:0   fail:17  skip:1083 time:10000s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_5812/shards.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2017-09-26 12:53 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-26  8:02 [RFC V1 0/6] Add Plane Color Properties Uma Shankar
2017-09-26  8:02 ` [RFC v1 1/6] drm: Add Plane Degamma properties Uma Shankar
2017-09-26  8:02 ` [RFC v1 2/6] drm: Add Plane CTM property Uma Shankar
2017-09-26  8:02 ` [RFC v1 3/6] drm: Add Plane Gamma properties Uma Shankar
2017-09-26  8:02 ` [RFC v1 4/6] drm: Define helper function for plane color enabling Uma Shankar
2017-09-26  8:02 ` [RFC v1 5/6] drm: Define helper to set legacy gamma table size Uma Shankar
2017-09-26 10:05   ` Lankhorst, Maarten
2017-09-26 10:11     ` Shankar, Uma
2017-09-26 10:15       ` Lankhorst, Maarten
2017-09-26 10:20         ` Shankar, Uma
2017-09-26  8:02 ` [RFC v1 6/6] drm/i915: Enable plane color features Uma Shankar
2017-09-26  9:31 ` ✓ Fi.CI.BAT: success for Add Plane Color Properties Patchwork
2017-09-26 11:16 ` [Intel-gfx] [RFC V1 0/6] " Daniel Vetter
2017-09-26 12:53 ` ✓ Fi.CI.IGT: success for " Patchwork

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.