Skip to contentSkip to conversation

drm/i915: Add support for XRandR Border property

RFC In review Vivek Kasireddy 3 participants 7 messages Feb 21, 2024 – Feb 22, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover drm/i915: Add support for XRandR Border property

Some customers and users have expressed interest in adding borders (or margins) to certain displays in their multi-display configurations. To address this need, this patchset implements the XRandR Border property as defined here:
https://cgit.freedesktop.org/xorg/proto/randrproto/tree/randrproto.txt#n2032

---

Patchset overview:

Patch 1: Create skl_program_crtc_scaler() to program scaler for crtc Patch 2: Create and attach the Border property to DP and HDMI Patch 3: Implement Border property by enabling crtc scalar

This series is tested using following method:
- Run the following xrandr command with different parameters:
xrandr --output HDMI-3 --pos 1920x0 --mode 1280x1024 --fb 3840x2160 --scale 2.11x2.11 --set "Border" 150,0,150,0

The following patch was also added to the modesetting driver to implement the Border property:
https://gitlab.freedesktop.org/Vivek/xserver/-/commit/62abfc438f0d17fe7f88bf2826c9784c2b36443b

Cc Ville Syrjälä <[email protected]>
Cc Matt Roper <[email protected]>
Cc Dongwon Kim <[email protected]>

Vivek Kasireddy (3):
drm/i915: Rename skl_pfit_enable() to skl_program_crtc_scaler() drm/i915: Attach the Border property to DP and HDMI connectors drm/i915: Apply border adjustments and enable scaler on the crtc

 drivers/gpu/drm/i915/display/intel_atomic.c   | 29 ++++++++++-
 .../gpu/drm/i915/display/intel_connector.c    | 49 +++++++++++++++++++
 .../gpu/drm/i915/display/intel_connector.h    |  3 ++
 drivers/gpu/drm/i915/display/intel_display.c  | 25 ++++++++--
 .../gpu/drm/i915/display/intel_display_core.h |  1 +
 .../drm/i915/display/intel_display_types.h    |  6 +++
 drivers/gpu/drm/i915/display/intel_dp.c       | 11 +++++
 drivers/gpu/drm/i915/display/intel_hdmi.c     | 11 +++++
 drivers/gpu/drm/i915/display/skl_scaler.c     | 27 ++++++----
 drivers/gpu/drm/i915/display/skl_scaler.h     |  3 +-
 10 files changed, 149 insertions(+), 16 deletions(-)
Signature · 1 line
2.43.0
#1 lore raw

RFC 1/3 drm/i915: Rename skl_pfit_enable() to skl_program_crtc_scaler()

Given that skl_pfit_enable() mostly enables (or programs) the scaler at the crtc level, it makes sense to change its name to skl_program_crtc_scaler(). Also, the rename and the addition of struct drm_rect * parameter helps if we'd like to use this function to enable the scaler at the crtc level for features other than panel fitting.

Cc Ville Syrjälä <[email protected]>
Cc Matt Roper <[email protected]>
---
 drivers/gpu/drm/i915/display/intel_display.c | 14 ++++++++++----
 drivers/gpu/drm/i915/display/skl_scaler.c    |  7 ++-----
 drivers/gpu/drm/i915/display/skl_scaler.h    |  3 ++-
 3 files changed, 14 insertions(+), 10 deletions(-)
drivers/gpu/drm/i915/display/intel_display.c +10 -4
index c5de4561f458..0ea62c278948 100644
@@ -1678,10 +1678,14 @@ static void hsw_crtc_enable(struct intel_atomic_state *state,
 	if (psl_clkgate_wa)
 		glk_pipe_scaler_clock_gating_wa(dev_priv, pipe, true);
 
-	if (DISPLAY_VER(dev_priv) >= 9)
-		skl_pfit_enable(new_crtc_state);
-	else
+	if (DISPLAY_VER(dev_priv) >= 9) {
+		const struct drm_rect *dst = &new_crtc_state->pch_pfit.dst;
+
+		if (new_crtc_state->pch_pfit.enabled)
+			skl_program_crtc_scaler(new_crtc_state, dst);
+	} else {
 		ilk_pfit_enable(new_crtc_state);
+	}
 
 	/*
 	 * On ILK+ LUT must be loaded before the pipe is running but with
@@ -6560,8 +6564,10 @@ static void intel_pipe_fastset(const struct intel_crtc_state *old_crtc_state,
 
 	/* on skylake this is done by detaching scalers */
 	if (DISPLAY_VER(dev_priv) >= 9) {
+		const struct drm_rect *dst = &new_crtc_state->pch_pfit.dst;
+
 		if (new_crtc_state->pch_pfit.enabled)
-			skl_pfit_enable(new_crtc_state);
+			skl_program_crtc_scaler(new_crtc_state, dst);
 	} else if (HAS_PCH_SPLIT(dev_priv)) {
 		if (new_crtc_state->pch_pfit.enabled)
 			ilk_pfit_enable(new_crtc_state);
drivers/gpu/drm/i915/display/skl_scaler.c +2 -5
index 8a934bada624..67a87cc0411a 100644
@@ -704,13 +704,13 @@ static void skl_scaler_setup_filter(struct drm_i915_private *dev_priv, enum pipe
 	}
 }
 
-void skl_pfit_enable(const struct intel_crtc_state *crtc_state)
+void skl_program_crtc_scaler(const struct intel_crtc_state *crtc_state,
+			     const struct drm_rect *dst)
 {
 	struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
 	struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
 	const struct intel_crtc_scaler_state *scaler_state =
 		&crtc_state->scaler_state;
-	const struct drm_rect *dst = &crtc_state->pch_pfit.dst;
 	u16 uv_rgb_hphase, uv_rgb_vphase;
 	enum pipe pipe = crtc->pipe;
 	int width = drm_rect_width(dst);
@@ -722,9 +722,6 @@ void skl_pfit_enable(const struct intel_crtc_state *crtc_state)
 	int id;
 	u32 ps_ctrl;
 
-	if (!crtc_state->pch_pfit.enabled)
-		return;
-
 	if (drm_WARN_ON(&dev_priv->drm,
 			crtc_state->scaler_state.scaler_id < 0))
 		return;
drivers/gpu/drm/i915/display/skl_scaler.h +2 -1
index 63f93ca03c89..45b9ac3ec779 100644
@@ -24,7 +24,8 @@ int intel_atomic_setup_scalers(struct drm_i915_private *dev_priv,
 			       struct intel_crtc *intel_crtc,
 			       struct intel_crtc_state *crtc_state);
 
-void skl_pfit_enable(const struct intel_crtc_state *crtc_state);
+void skl_program_crtc_scaler(const struct intel_crtc_state *crtc_state,
+			     const struct drm_rect *dst);
 
 void skl_program_plane_scaler(struct intel_plane *plane,
 			      const struct intel_crtc_state *crtc_state,
Signature · 1 line
2.43.0
#2 lore raw

RFC 2/3 drm/i915: Attach the Border property to DP and HDMI connectors

In reply to Vivek Kasireddy

The Border property is created as a blob if it doesn't exist and then attached to DP and HDMI connectors. When userspace wants to populate this blob, it is expected that it provides data of size sizeof(struct drm_rect).

Cc Ville Syrjälä <[email protected]>
Cc Matt Roper <[email protected]>
---
 drivers/gpu/drm/i915/display/intel_atomic.c   | 29 ++++++++++++++++++-
 .../gpu/drm/i915/display/intel_connector.c    | 20 +++++++++++++
 .../gpu/drm/i915/display/intel_connector.h    |  1 +
 .../gpu/drm/i915/display/intel_display_core.h |  1 +
 .../drm/i915/display/intel_display_types.h    |  1 +
 drivers/gpu/drm/i915/display/intel_dp.c       |  2 ++
 drivers/gpu/drm/i915/display/intel_hdmi.c     |  2 ++
 7 files changed, 55 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/display/intel_atomic.c +28 -1
index ec0d5168b503..76cdcad175cc 100644
@@ -67,6 +67,9 @@ int intel_digital_connector_atomic_get_property(struct drm_connector *connector,
 		*val = intel_conn_state->force_audio;
 	else if (property == dev_priv->display.properties.broadcast_rgb)
 		*val = intel_conn_state->broadcast_rgb;
+	else if (property == dev_priv->display.properties.border)
+		*val = (intel_conn_state->border) ?
+		       intel_conn_state->border->base.id : 0;
 	else {
 		drm_dbg_atomic(&dev_priv->drm,
 			       "Unknown property [PROP:%d:%s]\n",
@@ -95,6 +98,8 @@ int intel_digital_connector_atomic_set_property(struct drm_connector *connector,
 	struct drm_i915_private *dev_priv = to_i915(dev);
 	struct intel_digital_connector_state *intel_conn_state =
 		to_intel_digital_connector_state(state);
+	bool replaced;
+	int ret;
 
 	if (property == dev_priv->display.properties.force_audio) {
 		intel_conn_state->force_audio = val;
@@ -106,11 +111,32 @@ int intel_digital_connector_atomic_set_property(struct drm_connector *connector,
 		return 0;
 	}
 
+	if (property == dev_priv->display.properties.border) {
+		ret = drm_property_replace_blob_from_id(dev,
+						&intel_conn_state->border,
+						val,
+						sizeof(struct drm_rect), -1,
+						&replaced);
+		return ret;
+	}
+
 	drm_dbg_atomic(&dev_priv->drm, "Unknown property [PROP:%d:%s]\n",
 		       property->base.id, property->name);
 	return -EINVAL;
 }
 
+static bool intel_connector_blob_equal(struct drm_property_blob *old_blob,
+				       struct drm_property_blob *new_blob)
+{
+	if (!old_blob || !new_blob)
+		return false;
+
+	if (old_blob->length != new_blob->length)
+		return false;
+
+	return !memcmp(old_blob->data, new_blob->data, old_blob->length);
+}
+
 int intel_digital_connector_atomic_check(struct drm_connector *conn,
 					 struct drm_atomic_state *state)
 {
@@ -142,7 +168,8 @@ int intel_digital_connector_atomic_check(struct drm_connector *conn,
 	    new_conn_state->base.content_type != old_conn_state->base.content_type ||
 	    new_conn_state->base.scaling_mode != old_conn_state->base.scaling_mode ||
 	    new_conn_state->base.privacy_screen_sw_state != old_conn_state->base.privacy_screen_sw_state ||
-	    !drm_connector_atomic_hdr_metadata_equal(old_state, new_state))
+	    !drm_connector_atomic_hdr_metadata_equal(old_state, new_state) ||
+	    !intel_connector_blob_equal(old_conn_state->border, new_conn_state->border))
 		crtc_state->mode_changed = true;
 
 	return 0;
drivers/gpu/drm/i915/display/intel_connector.c +20 -0
index c65887870ddc..05185db6635e 100644
@@ -308,3 +308,23 @@ intel_attach_scaling_mode_property(struct drm_connector *connector)
 
 	connector->state->scaling_mode = DRM_MODE_SCALE_ASPECT;
 }
+
+void
+intel_attach_border_property(struct drm_connector *connector)
+{
+	struct drm_device *dev = connector->dev;
+	struct drm_i915_private *dev_priv = to_i915(dev);
+	struct drm_property *prop;
+
+	prop = dev_priv->display.properties.border;
+	if (prop == NULL) {
+		prop = drm_property_create(dev, DRM_MODE_PROP_BLOB,
+					   "Border", 0);
+		if (prop == NULL)
+			return;
+
+		dev_priv->display.properties.border = prop;
+	}
+
+	drm_object_attach_property(&connector->base, prop, 0);
+}
drivers/gpu/drm/i915/display/intel_connector.h +1 -0
index bafde3f11ff4..ab88b57d475b 100644
@@ -33,5 +33,6 @@ void intel_attach_aspect_ratio_property(struct drm_connector *connector);
 void intel_attach_hdmi_colorspace_property(struct drm_connector *connector);
 void intel_attach_dp_colorspace_property(struct drm_connector *connector);
 void intel_attach_scaling_mode_property(struct drm_connector *connector);
+void intel_attach_border_property(struct drm_connector *connector);
 
 #endif /* __INTEL_CONNECTOR_H__ */
drivers/gpu/drm/i915/display/intel_display_core.h +1 -0
index 8853a05dc331..c0f87ac67a94 100644
@@ -471,6 +471,7 @@ struct intel_display {
 	struct {
 		struct drm_property *broadcast_rgb;
 		struct drm_property *force_audio;
+		struct drm_property *border;
 	} properties;
 
 	struct {
drivers/gpu/drm/i915/display/intel_display_types.h +1 -0
index ae2e8cff9d69..399ed0867c20 100644
@@ -646,6 +646,7 @@ struct intel_digital_connector_state {
 
 	enum hdmi_force_audio force_audio;
 	int broadcast_rgb;
+	struct drm_property_blob *border;
 };
 
 #define to_intel_digital_connector_state(x) container_of(x, struct intel_digital_connector_state, base)
drivers/gpu/drm/i915/display/intel_dp.c +2 -0
index 7e4b7d5606d4..065e685ada84 100644
@@ -6216,6 +6216,8 @@ intel_dp_add_properties(struct intel_dp *intel_dp, struct drm_connector *connect
 
 	if (HAS_VRR(dev_priv))
 		drm_connector_attach_vrr_capable_property(connector);
+
+	intel_attach_border_property(connector);
 }
 
 static void
drivers/gpu/drm/i915/display/intel_hdmi.c +2 -0
index 7020e5806109..ac736d708c22 100644
@@ -2622,6 +2622,8 @@ intel_hdmi_add_properties(struct intel_hdmi *intel_hdmi, struct drm_connector *c
 
 	if (!HAS_GMCH(dev_priv))
 		drm_connector_attach_max_bpc_property(connector, 8, 12);
+
+	intel_attach_border_property(connector);
 }
 
 /*
Signature · 1 line
2.43.0
#3 lore raw

RFC 3/3 drm/i915: Apply border adjustments and enable scaler on the crtc

In reply to Vivek Kasireddy

If the userspace has enabled the border property on a given connector, then relevant adjustments to position and size are made in addition to enabling the scaler on the associated crtc.

Similar to how the panel fitter is implemented, the visible area of the crtc is tracked using a struct drm_rect object that is part of the crtc_state. This object is added to the state checker and support for hardware readout is also included.

Cc Ville Syrjälä <[email protected]>
Cc Matt Roper <[email protected]>
---
 .../gpu/drm/i915/display/intel_connector.c    | 29 +++++++++++++++++++
 .../gpu/drm/i915/display/intel_connector.h    |  2 ++
 drivers/gpu/drm/i915/display/intel_display.c  | 17 ++++++++---
 .../drm/i915/display/intel_display_types.h    |  5 ++++
 drivers/gpu/drm/i915/display/intel_dp.c       |  9 ++++++
 drivers/gpu/drm/i915/display/intel_hdmi.c     |  9 ++++++
 drivers/gpu/drm/i915/display/skl_scaler.c     | 20 ++++++++++---
 7 files changed, 83 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/display/intel_connector.c +29 -0
index 05185db6635e..8c5dfbb98811 100644
@@ -219,6 +219,35 @@ static const struct drm_prop_enum_list force_audio_names[] = {
 	{ HDMI_AUDIO_ON, "on" },
 };
 
+int intel_connector_apply_border(struct intel_crtc_state *crtc_state,
+				 void *border_data)
+{
+	const struct drm_display_mode *adjusted_mode =
+		&crtc_state->hw.adjusted_mode;
+	int width = adjusted_mode->crtc_hdisplay;
+	int height = adjusted_mode->crtc_vdisplay;
+	struct drm_rect *border = border_data;
+	int left = border->x1;
+	int top = border->y1;
+	int right = border->x2;
+	int bottom = border->y2;
+
+	if (left < 0 || top < 0 || right < 0 || bottom < 0)
+		return -EINVAL;
+
+	if (left + right >= width || top + bottom >= height)
+		return -EINVAL;
+
+	width -= (left + right);
+	height -= (top + bottom);
+
+	drm_rect_init(&crtc_state->border.dst,
+		      left, top, width, height);
+	crtc_state->border.enabled = true;
+
+	return 0;
+}
+
 void
 intel_attach_force_audio_property(struct drm_connector *connector)
 {
drivers/gpu/drm/i915/display/intel_connector.h +2 -0
index ab88b57d475b..93106d855452 100644
@@ -26,6 +26,8 @@ bool intel_connector_get_hw_state(struct intel_connector *connector);
 enum pipe intel_connector_get_pipe(struct intel_connector *connector);
 int intel_connector_update_modes(struct drm_connector *connector,
 				 const struct drm_edid *drm_edid);
+int intel_connector_apply_border(struct intel_crtc_state *crtc_state,
+				 void *border_data);
 int intel_ddc_get_modes(struct drm_connector *c, struct i2c_adapter *ddc);
 void intel_attach_force_audio_property(struct drm_connector *connector);
 void intel_attach_broadcast_rgb_property(struct drm_connector *connector);
drivers/gpu/drm/i915/display/intel_display.c +13 -4
index 0ea62c278948..af615e576fe7 100644
@@ -1679,9 +1679,12 @@ static void hsw_crtc_enable(struct intel_atomic_state *state,
 		glk_pipe_scaler_clock_gating_wa(dev_priv, pipe, true);
 
 	if (DISPLAY_VER(dev_priv) >= 9) {
-		const struct drm_rect *dst = &new_crtc_state->pch_pfit.dst;
+		const struct drm_rect *dst = new_crtc_state->pch_pfit.enabled ?
+					     &new_crtc_state->pch_pfit.dst :
+					     &new_crtc_state->border.dst;
 
-		if (new_crtc_state->pch_pfit.enabled)
+		if (new_crtc_state->pch_pfit.enabled ||
+		    new_crtc_state->border.enabled)
 			skl_program_crtc_scaler(new_crtc_state, dst);
 	} else {
 		ilk_pfit_enable(new_crtc_state);
@@ -5196,6 +5199,9 @@ intel_pipe_config_compare(const struct intel_crtc_state *current_config,
 		PIPE_CONF_CHECK_BOOL(pch_pfit.enabled);
 		PIPE_CONF_CHECK_RECT(pch_pfit.dst);
 
+		PIPE_CONF_CHECK_BOOL(border.enabled);
+		PIPE_CONF_CHECK_RECT(border.dst);
+
 		PIPE_CONF_CHECK_I(scaler_state.scaler_id);
 		PIPE_CONF_CHECK_I(pixel_rate);
 
@@ -6564,9 +6570,12 @@ static void intel_pipe_fastset(const struct intel_crtc_state *old_crtc_state,
 
 	/* on skylake this is done by detaching scalers */
 	if (DISPLAY_VER(dev_priv) >= 9) {
-		const struct drm_rect *dst = &new_crtc_state->pch_pfit.dst;
+		const struct drm_rect *dst = new_crtc_state->pch_pfit.enabled ?
+					     &new_crtc_state->pch_pfit.dst :
+					     &new_crtc_state->border.dst;
 
-		if (new_crtc_state->pch_pfit.enabled)
+		if (new_crtc_state->pch_pfit.enabled ||
+		    new_crtc_state->border.enabled)
 			skl_program_crtc_scaler(new_crtc_state, dst);
 	} else if (HAS_PCH_SPLIT(dev_priv)) {
 		if (new_crtc_state->pch_pfit.enabled)
drivers/gpu/drm/i915/display/intel_display_types.h +5 -0
index 399ed0867c20..6e46e585a0da 100644
@@ -1419,6 +1419,11 @@ struct intel_crtc_state {
 		u8 pixel_overlap;
 	} splitter;
 
+	struct {
+		struct drm_rect dst;
+		bool enabled;
+	} border;
+
 	/* for loading single buffered registers during vblank */
 	struct drm_vblank_work vblank_work;
 };
drivers/gpu/drm/i915/display/intel_dp.c +9 -0
index 065e685ada84..0f552537d42c 100644
@@ -2842,6 +2842,8 @@ intel_dp_compute_config(struct intel_encoder *encoder,
 			struct intel_crtc_state *pipe_config,
 			struct drm_connector_state *conn_state)
 {
+	const struct intel_digital_connector_state *intel_conn_state =
+		to_intel_digital_connector_state(conn_state);
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
 	struct drm_display_mode *adjusted_mode = &pipe_config->hw.adjusted_mode;
 	struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
@@ -2889,6 +2891,13 @@ intel_dp_compute_config(struct intel_encoder *encoder,
 			return ret;
 	}
 
+	if (intel_conn_state->border) {
+		ret = intel_connector_apply_border(pipe_config,
+					intel_conn_state->border->data);
+		if (ret)
+			return ret;
+	}
+
 	pipe_config->limited_color_range =
 		intel_dp_limited_color_range(pipe_config, conn_state);
 
drivers/gpu/drm/i915/display/intel_hdmi.c +9 -0
index ac736d708c22..7428ff5d658a 100644
@@ -2285,6 +2285,8 @@ int intel_hdmi_compute_config(struct intel_encoder *encoder,
 			      struct intel_crtc_state *pipe_config,
 			      struct drm_connector_state *conn_state)
 {
+	const struct intel_digital_connector_state *intel_conn_state =
+		to_intel_digital_connector_state(conn_state);
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
 	struct drm_display_mode *adjusted_mode = &pipe_config->hw.adjusted_mode;
 	struct drm_connector *connector = conn_state->connector;
@@ -2330,6 +2332,13 @@ int intel_hdmi_compute_config(struct intel_encoder *encoder,
 			return ret;
 	}
 
+	if (intel_conn_state->border) {
+		ret = intel_connector_apply_border(pipe_config,
+					intel_conn_state->border->data);
+		if (ret)
+			return ret;
+	}
+
 	pipe_config->limited_color_range =
 		intel_hdmi_limited_color_range(pipe_config, conn_state);
 
drivers/gpu/drm/i915/display/skl_scaler.c +16 -4
index 67a87cc0411a..a0a26e0b4e98 100644
@@ -237,11 +237,16 @@ skl_update_scaler(struct intel_crtc_state *crtc_state, bool force_detach,
 int skl_update_scaler_crtc(struct intel_crtc_state *crtc_state)
 {
 	const struct drm_display_mode *pipe_mode = &crtc_state->hw.pipe_mode;
+	bool need_scaler = crtc_state->pch_pfit.enabled ||
+			   crtc_state->border.enabled;
 	int width, height;
 
 	if (crtc_state->pch_pfit.enabled) {
 		width = drm_rect_width(&crtc_state->pch_pfit.dst);
 		height = drm_rect_height(&crtc_state->pch_pfit.dst);
+	} else if (crtc_state->border.enabled) {
+		width = drm_rect_width(&crtc_state->border.dst);
+		height = drm_rect_height(&crtc_state->border.dst);
 	} else {
 		width = pipe_mode->crtc_hdisplay;
 		height = pipe_mode->crtc_vdisplay;
@@ -251,8 +256,7 @@ int skl_update_scaler_crtc(struct intel_crtc_state *crtc_state)
 				 &crtc_state->scaler_state.scaler_id,
 				 drm_rect_width(&crtc_state->pipe_src),
 				 drm_rect_height(&crtc_state->pipe_src),
-				 width, height, NULL, 0,
-				 crtc_state->pch_pfit.enabled);
+				 width, height, NULL, 0, need_scaler);
 }
 
 /**
@@ -859,6 +863,7 @@ void skl_scaler_get_config(struct intel_crtc_state *crtc_state)
 	struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
 	struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
 	struct intel_crtc_scaler_state *scaler_state = &crtc_state->scaler_state;
+	struct drm_rect *dst;
 	int id = -1;
 	int i;
 
@@ -871,12 +876,19 @@ void skl_scaler_get_config(struct intel_crtc_state *crtc_state)
 			continue;
 
 		id = i;
-		crtc_state->pch_pfit.enabled = true;
 
 		pos = intel_de_read(dev_priv, SKL_PS_WIN_POS(crtc->pipe, i));
 		size = intel_de_read(dev_priv, SKL_PS_WIN_SZ(crtc->pipe, i));
 
-		drm_rect_init(&crtc_state->pch_pfit.dst,
+		if (intel_crtc_has_type(crtc_state, INTEL_OUTPUT_LVDS)) {
+			crtc_state->pch_pfit.enabled = true;
+			dst = &crtc_state->pch_pfit.dst;
+		} else {
+			crtc_state->border.enabled = true;
+			dst = &crtc_state->border.dst;
+		}
+
+		drm_rect_init(dst,
 			      REG_FIELD_GET(PS_WIN_XPOS_MASK, pos),
 			      REG_FIELD_GET(PS_WIN_YPOS_MASK, pos),
 			      REG_FIELD_GET(PS_WIN_XSIZE_MASK, size),
Signature · 1 line
2.43.0
#4 lore raw

✗ Fi.CI.BUILD: failure for drm/i915: Add support for XRandR Border property

In reply to Vivek Kasireddy
== Series Details ==

== Series Details ==

Series: drm/i915: Add support for XRandR Border property
URL : https://patchwork.freedesktop.org/series/130183/
State : failure

== Summary ==

Error: make failed
CALL scripts/checksyscalls.sh
DESCEND objtool
INSTALL libsubcmd_headers
LD [M] drivers/gpu/drm/i915/i915.o
LD [M] drivers/gpu/drm/i915/kvmgt.o
HDRTEST drivers/gpu/drm/i915/display/intel_connector.h
In file included from <command-line>:
./drivers/gpu/drm/i915/display/intel_connector.h:29:41: error: ‘struct intel_crtc_state’ declared inside parameter list will not be visible outside of this definition or declaration [-Werror]
29 | int intel_connector_apply_border(struct intel_crtc_state *crtc_state,

      |                                         ^~~~~~~~~~~~~~~~

cc1: all warnings being treated as errors
make[6]: *** [drivers/gpu/drm/i915/Makefile:440: drivers/gpu/drm/i915/display/intel_connector.hdrtest] Error 1 make[5]: *** [scripts/Makefile.build:481: drivers/gpu/drm/i915] Error 2
make[4]: *** [scripts/Makefile.build:481: drivers/gpu/drm] Error 2
make[3]: *** [scripts/Makefile.build:481: drivers/gpu] Error 2
make[2]: *** [scripts/Makefile.build:481: drivers] Error 2
make[1]: *** [/home/kbuild/kernel/Makefile:1921: .] Error 2
make: *** [Makefile:240: __sub-make] Error 2
Build failed, no error log produced

#5 lore raw
In reply to Vivek Kasireddy
Quoted 14 lines · Vivek Kasireddy

Some customers and users have expressed interest in adding borders (or margins) to certain displays in their multi-display configurations. To address this need, this patchset implements the XRandR Border property as defined here:
https://cgit.freedesktop.org/xorg/proto/randrproto/tree/randrproto.txt#n2032

---

Patchset overview:

Patch 1: Create skl_program_crtc_scaler() to program scaler for crtc Patch 2: Create and attach the Border property to DP and HDMI Patch 3: Implement Border property by enabling crtc scalar

Quoted 7 lines

This series is tested using following method:
- Run the following xrandr command with different parameters:
xrandr --output HDMI-3 --pos 1920x0 --mode 1280x1024 --fb 3840x2160 --scale 2.11x2.11 --set "Border" 150,0,150,0

The following patch was also added to the modesetting driver to implement the Border property:
https://gitlab.freedesktop.org/Vivek/xserver/-/commit/62abfc438f0d17fe7f88bf2826c9784c2b36443b

I have an old branch implementing the margin properties:
https://github.com/vsyrjala/linux.git hdmi_margins_3

but it got stalled due to the scaler code being in a very poor state. I started sketching some reworks there, but that got put on the backburner due to other stuff:
https://github.com/vsyrjala/linux.git scaler_rework_2

I might have somehting more recent than that locally, but I'd have to trawl through my branches to check what's the latest state.

Quoted 24 lines
Cc Ville Syrjälä <[email protected]>
Cc Matt Roper <[email protected]>
Cc Dongwon Kim <[email protected]>

Vivek Kasireddy (3):
drm/i915: Rename skl_pfit_enable() to skl_program_crtc_scaler() drm/i915: Attach the Border property to DP and HDMI connectors drm/i915: Apply border adjustments and enable scaler on the crtc

 drivers/gpu/drm/i915/display/intel_atomic.c   | 29 ++++++++++-
 .../gpu/drm/i915/display/intel_connector.c    | 49 +++++++++++++++++++
 .../gpu/drm/i915/display/intel_connector.h    |  3 ++
 drivers/gpu/drm/i915/display/intel_display.c  | 25 ++++++++--
 .../gpu/drm/i915/display/intel_display_core.h |  1 +
 .../drm/i915/display/intel_display_types.h    |  6 +++
 drivers/gpu/drm/i915/display/intel_dp.c       | 11 +++++
 drivers/gpu/drm/i915/display/intel_hdmi.c     | 11 +++++
 drivers/gpu/drm/i915/display/skl_scaler.c     | 27 ++++++----
 drivers/gpu/drm/i915/display/skl_scaler.h     |  3 +-
 10 files changed, 149 insertions(+), 16 deletions(-)
Signature · 1 line
2.43.0
Signature · 2 lines
Ville Syrjälä
Intel
#6 lore raw

Hi Ville,

Quoted 29 lines
Quoted 5 lines

Some customers and users have expressed interest in adding borders (or margins) to certain displays in their multi-display configurations. To address this need, this patchset implements the XRandR Border property as defined here:

https://cgit.freedesktop.org/xorg/proto/randrproto/tree/randrproto.txt#n2
032

Quoted 5 lines

---

Patchset overview:

Quoted 7 lines

Patch 1: Create skl_program_crtc_scaler() to program scaler for crtc Patch 2: Create and attach the Border property to DP and HDMI Patch 3: Implement Border property by enabling crtc scalar

This series is tested using following method:
- Run the following xrandr command with different parameters:
xrandr --output HDMI-3 --pos 1920x0 --mode 1280x1024 --fb 3840x2160 --

scale 2.11x2.11 --set "Border" 150,0,150,0

Quoted 4 lines

The following patch was also added to the modesetting driver to implement the Border property:
https://gitlab.freedesktop.org/Vivek/xserver/-

/commit/62abfc438f0d17fe7f88bf2826c9784c2b36443b

I have an old branch implementing the margin properties:
https://github.com/vsyrjala/linux.git hdmi_margins_3

Quoted 7 lines

but it got stalled due to the scaler code being in a very poor state. I started sketching some reworks there, but that got put on the backburner due to other stuff:
https://github.com/vsyrjala/linux.git scaler_rework_2

I might have somehting more recent than that locally, but I'd have to trawl through my branches to check what's the latest state.

There is a lot to unpack in these two branches than what I had anticipated. However, it looks like some of the patches are already merged. Do you have any plan to revive this work anytime soon?

And, besides the remaining unmerged patches in the above two branches, are there still any other missing pieces preventing this feature from getting merged?

Thanks,
Vivek

Quoted 29 lines
Quoted 23 lines
Cc Ville Syrjälä <[email protected]>
Cc Matt Roper <[email protected]>
Cc Dongwon Kim <[email protected]>

Vivek Kasireddy (3):
drm/i915: Rename skl_pfit_enable() to skl_program_crtc_scaler() drm/i915: Attach the Border property to DP and HDMI connectors drm/i915: Apply border adjustments and enable scaler on the crtc

 drivers/gpu/drm/i915/display/intel_atomic.c   | 29 ++++++++++-
 .../gpu/drm/i915/display/intel_connector.c    | 49 +++++++++++++++++++
 .../gpu/drm/i915/display/intel_connector.h    |  3 ++
 drivers/gpu/drm/i915/display/intel_display.c  | 25 ++++++++--
 .../gpu/drm/i915/display/intel_display_core.h |  1 +
 .../drm/i915/display/intel_display_types.h    |  6 +++
 drivers/gpu/drm/i915/display/intel_dp.c       | 11 +++++
 drivers/gpu/drm/i915/display/intel_hdmi.c     | 11 +++++
 drivers/gpu/drm/i915/display/skl_scaler.c     | 27 ++++++----
 drivers/gpu/drm/i915/display/skl_scaler.h     |  3 +-
 10 files changed, 149 insertions(+), 16 deletions(-)
Quoted 2 lines

--
2.43.0

--
Ville Syrjälä
Intel