[Intel-gfx] [RFC v1 2/7] drm/i915: Add intel crtc set and get property callback

Uma Shankar uma.shankar at intel.com
Tue Mar 19 08:30:13 UTC 2019


Add intel crtc set and get property callbacks. Currently
added for gamma mode property set and get implementation.

Signed-off-by: Uma Shankar <uma.shankar at intel.com>
---
 drivers/gpu/drm/i915/intel_display.c | 58 ++++++++++++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 61acbaf..7604f16 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -13679,6 +13679,62 @@ static int intel_atomic_commit(struct drm_device *dev,
 	return 0;
 }
 
+/**
+ * intel_crtc_atomic_get_property - hook for crtc->atomic_get_property.
+ * @crtc: Crtc to get the property for.
+ * @state: Crtc state to retrieve the property from.
+ * @property: Property to retrieve.
+ * @val: Return value for the property.
+ *
+ * Returns the atomic property value for a crtc.
+ */
+int intel_crtc_atomic_get_property(struct drm_crtc *crtc,
+				   const struct drm_crtc_state *state,
+				   struct drm_property *property,
+				   uint64_t *val)
+{
+	struct drm_device *dev = crtc->dev;
+	struct drm_i915_private *dev_priv = to_i915(dev);
+	struct intel_crtc_state *intel_crtc_state = to_intel_crtc_state(state);
+
+	if (property == dev_priv->gamma_mode_property) {
+		*val = intel_crtc_state->gamma_mode_type;
+	} else {
+		DRM_DEBUG_ATOMIC("Unknown property %s\n", property->name);
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
+/**
+ * intel_crtc_atomic_set_property - hook for crtc->atomic_set_property.
+ * @crtc: Crtc to set the property for.
+ * @state: Crtc state to set the property on.
+ * @property: Property to set.
+ * @val: New value for the property.
+ *
+ * Sets the atomic property value for a crtc.
+ */
+int intel_crtc_atomic_set_property(struct drm_crtc *crtc,
+				   struct drm_crtc_state *state,
+				   struct drm_property *property,
+				   uint64_t val)
+{
+	struct drm_device *dev = crtc->dev;
+	struct drm_i915_private *dev_priv = to_i915(dev);
+	struct intel_crtc_state *intel_crtc_state = to_intel_crtc_state(state);
+
+	if (property == dev_priv->gamma_mode_property) {
+		intel_crtc_state->gamma_mode_type = val;
+		state->color_mgmt_changed |= replaced;
+		return 0;
+	}
+
+	DRM_DEBUG_ATOMIC("Unknown property %s\n", property->name);
+	return -EINVAL;
+}
+
 static const struct drm_crtc_funcs intel_crtc_funcs = {
 	.gamma_set = drm_atomic_helper_legacy_gamma_set,
 	.set_config = drm_atomic_helper_set_config,
@@ -13689,6 +13745,8 @@ static int intel_atomic_commit(struct drm_device *dev,
 	.set_crc_source = intel_crtc_set_crc_source,
 	.verify_crc_source = intel_crtc_verify_crc_source,
 	.get_crc_sources = intel_crtc_get_crc_sources,
+	.atomic_get_property = intel_crtc_atomic_get_property,
+	.atomic_set_property = intel_crtc_atomic_set_property,
 };
 
 struct wait_rps_boost {
-- 
1.9.1



More information about the Intel-gfx mailing list