[Intel-gfx] [PATCH 1/7] drm/i915: Add pipe scaler pipe source drm property

Nabendu Maiti nabendu.bikash.maiti at intel.com
Tue Aug 30 05:00:55 UTC 2016


Initialization of pipe source size property as intel drm property to drm level
to dynamically change pipe source size.

Signed-off-by: Nabendu Maiti <nabendu.bikash.maiti at intel.com>
---
 drivers/gpu/drm/drm_atomic.c | 10 ++++++++++
 drivers/gpu/drm/drm_crtc.c   | 16 ++++++++++++++++
 include/drm/drm_crtc.h       |  7 +++++++
 3 files changed, 33 insertions(+)

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index 0b8f33d..066f010 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -493,6 +493,12 @@ int drm_atomic_crtc_set_property(struct drm_crtc *crtc,
 					&replaced);
 		state->color_mgmt_changed |= replaced;
 		return ret;
+	} else if (property == config->prop_pipe_src_w) {
+		state->src_w = val;
+		state->pipescaler_changed = true;
+	} else if (property == config->prop_pipe_src_h) {
+		state->src_h = val;
+		state->pipescaler_changed = true;
 	} else if (crtc->funcs->atomic_set_property)
 		return crtc->funcs->atomic_set_property(crtc, state, property, val);
 	else
@@ -535,6 +541,10 @@ drm_atomic_crtc_get_property(struct drm_crtc *crtc,
 		*val = (state->ctm) ? state->ctm->base.id : 0;
 	else if (property == config->gamma_lut_property)
 		*val = (state->gamma_lut) ? state->gamma_lut->base.id : 0;
+	else if (property == config->prop_pipe_src_w)
+		*val =  state->src_w;
+	else if (property == config->prop_pipe_src_h)
+		*val =  state->src_h;
 	else if (crtc->funcs->atomic_get_property)
 		return crtc->funcs->atomic_get_property(crtc, state, property, val);
 	else
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 9316a2b..6fd6dd8 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -377,6 +377,10 @@ int drm_crtc_init_with_planes(struct drm_device *dev, struct drm_crtc *crtc,
 	if (drm_core_check_feature(dev, DRIVER_ATOMIC)) {
 		drm_object_attach_property(&crtc->base, config->prop_active, 0);
 		drm_object_attach_property(&crtc->base, config->prop_mode_id, 0);
+		drm_object_attach_property(&crtc->base,
+					   config->prop_pipe_src_w, 0);
+		drm_object_attach_property(&crtc->base,
+					   config->prop_pipe_src_h, 0);
 	}
 
 	return 0;
@@ -943,6 +947,18 @@ static int drm_mode_create_standard_properties(struct drm_device *dev)
 		return -ENOMEM;
 	dev->mode_config.gamma_lut_size_property = prop;
 
+	prop = drm_property_create_range(dev, DRM_MODE_PROP_ATOMIC,
+			"PIPE_SRC_W", 0, INT_MAX);
+	if (!prop)
+		return -ENOMEM;
+	dev->mode_config.prop_pipe_src_w = prop;
+
+	prop = drm_property_create_range(dev, DRM_MODE_PROP_ATOMIC,
+			"PIPE_SRC_H", 0, INT_MAX);
+	if (!prop)
+		return -ENOMEM;
+	dev->mode_config.prop_pipe_src_h = prop;
+
 	return 0;
 }
 
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index bb214a1..4d6b580 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -197,6 +197,9 @@ struct drm_crtc_state {
 	struct drm_pending_vblank_event *event;
 
 	struct drm_atomic_state *state;
+
+	bool pipescaler_changed;
+	u32 src_w, src_h;
 };
 
 /**
@@ -1942,6 +1945,10 @@ struct drm_mode_config {
 	 */
 	struct drm_property *prop_mode_id;
 
+	/* pipe scaler properties */
+	struct drm_property *prop_pipe_src_w;
+	struct drm_property *prop_pipe_src_h;
+
 	/**
 	 * @dvi_i_subconnector_property: Optional DVI-I property to
 	 * differentiate between analog or digital mode.
-- 
1.9.1



More information about the Intel-gfx mailing list