All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] Add a "min bpc" connector property
@ 2026-07-29 12:13 Nicolas Frattaroli
  2026-07-29 12:13 ` [PATCH v2 1/2] drm/connector: Introduce " Nicolas Frattaroli
  2026-07-29 12:13 ` [PATCH v2 2/2] drm/connector: hdmi: Implement "min bpc" property Nicolas Frattaroli
  0 siblings, 2 replies; 5+ messages in thread
From: Nicolas Frattaroli @ 2026-07-29 12:13 UTC (permalink / raw)
  To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter, Xaver Hugl, Michel Dänzer, Harry Wentland,
	Mario Kleiner, Pekka Paalanen, Ville Syrjälä,
	Daniel Stone, Marius Vlad
  Cc: dri-devel, linux-kernel, kernel, wayland-devel,
	Nicolas Frattaroli

This series is an alternative to the link-bpc[1] series, which
implemented an immutable property to determine the output's bit depth.
The link bpc property wasn't very liked as it'd only be updated after an
atomic commit went through. For a userspace that's trying to evaluate
all available bit depths at a certain configuration, this was untenable.

After some discussion at Display Next Hackfest 2026, the general
consensus seemed to be that a "min bpc" property would be a better way
forward. By setting it and "max bpc" to the same value, userspace can
probe for supported BPCs of a configuration with repeated atomic test
commits, without actually doing a modeset.

At the same time, it satisfies a common userspace use case: often times,
userspace just wants to ensure that its deep color plane it's submitting
is not being degraded by the driver to 8bpc for bandwidth reasons. By
setting "min bpc" accordingly, userspace will get definitive feedback
(an atomic commit failure) and can then make content-specific trade-off
decisions that the kernel wouldn't be able to do, such as by lowering
the framerate, or once "color format" is in, by subsampling the chroma.
Alternatively, userspace can of course also accept that there's really
nothing better it can do, and lower "min bpc" to accept the degradation.

This series adds the property (including documentation) and implements
it in the common HDMI state helpers (including new KUnit tests). Drivers
that don't use the common HDMI state helpers will need to register the
property and implement the (fairly simple) logic themselves.

There is a draft minimal userspace implementation in weston at [2] which
doesn't do any fancy atomic test commit probing with dynamic
userspace-side fallbacks.

[1]: https://lore.kernel.org/dri-devel/20260330-link-bpc-v6-0-ff124af93e48@collabora.com/T/
[2]: https://gitlab.freedesktop.org/wayland/weston/-/merge_requests/1850

Signed-off-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
---
Changes in v2:
- Add link to weston draft MR in cover letter
- Apply trailers
- Link to v1: https://patch.msgid.link/20260612-min-bpc-v1-0-bba88c2c4836@collabora.com

---
Nicolas Frattaroli (2):
      drm/connector: Introduce "min bpc" connector property
      drm/connector: hdmi: Implement "min bpc" property

 drivers/gpu/drm/display/drm_hdmi_state_helper.c    |  10 +-
 drivers/gpu/drm/drm_atomic_helper.c                |   4 +
 drivers/gpu/drm/drm_atomic_uapi.c                  |   4 +
 drivers/gpu/drm/drm_connector.c                    |  81 ++++++++++++
 drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c | 146 +++++++++++++++++++++
 include/drm/drm_connector.h                        |  13 ++
 6 files changed, 254 insertions(+), 4 deletions(-)
---
base-commit: 5df28e621a86e501b09902fdf816f8c02a162794
change-id: 20260605-min-bpc-dbbf3b3a2521

Best regards,
--  
Nicolas Frattaroli <nicolas.frattaroli@collabora.com>


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

* [PATCH v2 1/2] drm/connector: Introduce "min bpc" connector property
  2026-07-29 12:13 [PATCH v2 0/2] Add a "min bpc" connector property Nicolas Frattaroli
@ 2026-07-29 12:13 ` Nicolas Frattaroli
  2026-07-29 12:25   ` sashiko-bot
  2026-07-29 12:13 ` [PATCH v2 2/2] drm/connector: hdmi: Implement "min bpc" property Nicolas Frattaroli
  1 sibling, 1 reply; 5+ messages in thread
From: Nicolas Frattaroli @ 2026-07-29 12:13 UTC (permalink / raw)
  To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter, Xaver Hugl, Michel Dänzer, Harry Wentland,
	Mario Kleiner, Pekka Paalanen, Ville Syrjälä,
	Daniel Stone, Marius Vlad
  Cc: dri-devel, linux-kernel, kernel, wayland-devel,
	Nicolas Frattaroli

Add a new KMS connector property called "min bpc". Its purpose is to
allow userspace to mandate that the output bit depth ends up greater
than or equal to a specified depth, or else have the commit fail. This
is useful for checking for output depth degradation in combination with
atomic test commits.

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
---
 drivers/gpu/drm/drm_atomic_helper.c |  4 ++
 drivers/gpu/drm/drm_atomic_uapi.c   |  4 ++
 drivers/gpu/drm/drm_connector.c     | 77 +++++++++++++++++++++++++++++++++++++
 include/drm/drm_connector.h         | 13 +++++++
 4 files changed, 98 insertions(+)

diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index 285aac3554df..613a674ace87 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -739,6 +739,10 @@ drm_atomic_helper_check_modeset(struct drm_device *dev,
 			    new_connector_state->max_requested_bpc)
 				new_crtc_state->connectors_changed = true;
 
+			if (old_connector_state->min_requested_bpc !=
+			    new_connector_state->min_requested_bpc)
+				new_crtc_state->connectors_changed = true;
+
 			if (old_connector_state->color_format !=
 			    new_connector_state->color_format)
 				new_crtc_state->connectors_changed = true;
diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c
index 1050dddadb17..0440cb63f786 100644
--- a/drivers/gpu/drm/drm_atomic_uapi.c
+++ b/drivers/gpu/drm/drm_atomic_uapi.c
@@ -956,6 +956,8 @@ static int drm_atomic_connector_set_property(struct drm_connector *connector,
 						   fence_ptr);
 	} else if (property == connector->max_bpc_property) {
 		state->max_requested_bpc = val;
+	} else if (property == connector->min_bpc_property) {
+		state->min_requested_bpc = val;
 	} else if (property == connector->privacy_screen_sw_state_property) {
 		state->privacy_screen_sw_state = val;
 	} else if (property == connector->broadcast_rgb_property) {
@@ -1043,6 +1045,8 @@ drm_atomic_connector_get_property(struct drm_connector *connector,
 		*val = 0;
 	} else if (property == connector->max_bpc_property) {
 		*val = state->max_requested_bpc;
+	} else if (property == connector->min_bpc_property) {
+		*val = state->min_requested_bpc;
 	} else if (property == connector->privacy_screen_sw_state_property) {
 		*val = state->privacy_screen_sw_state;
 	} else if (property == connector->broadcast_rgb_property) {
diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
index 8b4baed060f3..3ecc079404a1 100644
--- a/drivers/gpu/drm/drm_connector.c
+++ b/drivers/gpu/drm/drm_connector.c
@@ -1739,6 +1739,46 @@ EXPORT_SYMBOL(drm_hdmi_connector_get_output_format_name);
  *	drm_connector_attach_max_bpc_property() to create and attach the
  *	property to the connector during initialization.
  *
+ * min bpc:
+ *	This range property is used by userspace to set a minimum bit depth that
+ *	the driver must reach on the connector for a given atomic state. If it
+ *	cannot do so, the atomic commit fails.
+ *
+ *	The precise definition of minimum bit depth used for the "min bpc"
+ *	property must align with the definition a given driver uses for the
+ *	"max bpc" property, such that when "min bpc" and "max bpc" are set to
+ *	the same value, the allowable range of bit depths is a single set point.
+ *
+ *	Drivers should ideally use a definition of bit depth that refers to a
+ *	perceptual optical bit depth, meaning it is equivalent to an
+ *	uncompressed optical bit depth for a variety of content to the median
+ *	human eyeball in a variety of viewing environments. The display link's
+ *	actual optical bit depth to represent the data on the wire may be lower
+ *	due to compression techniques, or even higher due to padding. In
+ *	concrete terms, userspace should not need to know how to implement DSC
+ *	compression in order to set a minimum bit depth to the appropriate
+ *	value, and should not need to perform display-protocol-specific
+ *	calculations to set the right on-the-wire format.
+ *
+ *	Userspace may use the "min bpc" property in combination with performing
+ *	atomic test commits in order to enumerate the possible output bit depths
+ *	for a given configuration. This way, userspace compositors can make
+ *	use-case and content-specific tradeoffs to reach a desired output bit
+ *	depth, such as by using chroma subsampling, or by choosing a lower
+ *	refresh rate mode.
+ *
+ *	Userspace may use the "min bpc" property in combination with the
+ *	"max bpc" property to know what output bit depth a successful atomic
+ *	commit is using. By setting "min bpc" and "max bpc" to the same value,
+ *	a successful commit will be using an output bit depth of said value.
+ *
+ *	When "min bpc" is set to a non-zero value, any bit depth degradation
+ *	logic below "min bpc" must be implemented by userspace (through lowering
+ *	"min bpc"), rather than by kernel drivers. For a driver to degrade to an
+ *	uncompressed optical output bit depth below "min bpc" is always a bug no
+ *	matter how good the intentions are, since it renders the property
+ *	useless as an oracle.
+ *
  * Connectors also have one standardized atomic property:
  *
  * CRTC_ID:
@@ -2893,6 +2933,43 @@ int drm_connector_attach_max_bpc_property(struct drm_connector *connector,
 }
 EXPORT_SYMBOL(drm_connector_attach_max_bpc_property);
 
+/**
+ * drm_connector_attach_min_bpc_property - attach "min bpc" property
+ * @connector: connector to attach min bpc property on.
+ * @max: The maximum bit depth supported by the connector.
+ *
+ * Create and attach the "min bpc" connector property, which is used by
+ * userspace to require that a certain minimum bit depth is reached by the
+ * connector on atomic commit.
+ *
+ * Returns:
+ * Zero on success, negative errno on failure.
+ */
+int drm_connector_attach_min_bpc_property(struct drm_connector *connector,
+					  unsigned int max)
+{
+	struct drm_device *dev = connector->dev;
+	struct drm_property *prop;
+
+	if (max > U8_MAX)
+		return -ERANGE;
+
+	prop = connector->min_bpc_property;
+	if (!prop) {
+		prop = drm_property_create_range(dev, 0, "min bpc", 0, max);
+		if (!prop)
+			return -ENOMEM;
+
+		connector->min_bpc_property = prop;
+	}
+
+	drm_object_attach_property(&connector->base, prop, 0);
+	connector->state->min_requested_bpc = 0;
+
+	return 0;
+}
+EXPORT_SYMBOL(drm_connector_attach_min_bpc_property);
+
 /**
  * drm_connector_attach_hdr_output_metadata_property - attach "HDR_OUTPUT_METADATA" property
  * @connector: connector to attach the property on.
diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
index a0cf0268de48..35f395d46f6b 100644
--- a/include/drm/drm_connector.h
+++ b/include/drm/drm_connector.h
@@ -1267,6 +1267,11 @@ struct drm_connector_state {
 	 */
 	u8 max_requested_bpc;
 
+	/**
+	 * @min_requested_bpc: Minimum output bit depth requested by userspace
+	 */
+	u8 min_requested_bpc;
+
 	/**
 	 * @max_bpc: Connector max_bpc based on the requested max_bpc property
 	 * and the connector bpc limitations obtained from edid.
@@ -2297,6 +2302,12 @@ struct drm_connector {
 	 */
 	struct drm_property *max_bpc_property;
 
+	/**
+	 * @min_bpc_property: Default connector property for the minimum bit
+	 * depth for the output to reach, or the commit to fail otherwise.
+	 */
+	struct drm_property *min_bpc_property;
+
 	/** @privacy_screen: drm_privacy_screen for this connector, or NULL. */
 	struct drm_privacy_screen *privacy_screen;
 
@@ -2706,6 +2717,8 @@ int drm_connector_set_orientation_from_panel(
 	struct drm_panel *panel);
 int drm_connector_attach_max_bpc_property(struct drm_connector *connector,
 					  int min, int max);
+int drm_connector_attach_min_bpc_property(struct drm_connector *connector,
+					  unsigned int max);
 void drm_connector_create_privacy_screen_properties(struct drm_connector *conn);
 void drm_connector_attach_privacy_screen_properties(struct drm_connector *conn);
 void drm_connector_attach_privacy_screen_provider(

-- 
2.55.0


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

* [PATCH v2 2/2] drm/connector: hdmi: Implement "min bpc" property
  2026-07-29 12:13 [PATCH v2 0/2] Add a "min bpc" connector property Nicolas Frattaroli
  2026-07-29 12:13 ` [PATCH v2 1/2] drm/connector: Introduce " Nicolas Frattaroli
@ 2026-07-29 12:13 ` Nicolas Frattaroli
  2026-07-29 12:23   ` sashiko-bot
  1 sibling, 1 reply; 5+ messages in thread
From: Nicolas Frattaroli @ 2026-07-29 12:13 UTC (permalink / raw)
  To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter, Xaver Hugl, Michel Dänzer, Harry Wentland,
	Mario Kleiner, Pekka Paalanen, Ville Syrjälä,
	Daniel Stone, Marius Vlad
  Cc: dri-devel, linux-kernel, kernel, wayland-devel,
	Nicolas Frattaroli

Act on the "min bpc" property's min_requested_bpc state in the common
HDMI state helpers, and register the property on HDMI connectors.

Also add two KUnit tests to verify that the property behaves as
expected.

Signed-off-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
---
 drivers/gpu/drm/display/drm_hdmi_state_helper.c    |  10 +-
 drivers/gpu/drm/drm_connector.c                    |   4 +
 drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c | 146 +++++++++++++++++++++
 3 files changed, 156 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/display/drm_hdmi_state_helper.c b/drivers/gpu/drm/display/drm_hdmi_state_helper.c
index ce17eeefc2da..fa015d218b41 100644
--- a/drivers/gpu/drm/display/drm_hdmi_state_helper.c
+++ b/drivers/gpu/drm/display/drm_hdmi_state_helper.c
@@ -636,10 +636,12 @@ hdmi_compute_format_bpc(const struct drm_connector *connector,
 			unsigned int max_bpc, enum drm_output_color_format fmt)
 {
 	struct drm_device *dev = connector->dev;
-	unsigned int bpc;
+	unsigned int bpc, min_bpc;
 	int ret;
 
-	for (bpc = max_bpc; bpc >= 8; bpc -= 2) {
+	min_bpc = max(conn_state->min_requested_bpc, 8);
+
+	for (bpc = max_bpc; bpc >= min_bpc; bpc -= 2) {
 		ret = hdmi_try_format_bpc(connector, conn_state, mode, bpc, fmt);
 		if (!ret)
 			continue;
@@ -657,8 +659,8 @@ hdmi_compute_format_bpc(const struct drm_connector *connector,
 		return 0;
 	}
 
-	drm_dbg_kms(dev, "Failed. %s output format not supported for any bpc count.\n",
-		    drm_hdmi_connector_get_output_format_name(fmt));
+	drm_dbg_kms(dev, "Failed. %s output format not supported for any bpc <= %u and >= %u.\n",
+		    drm_hdmi_connector_get_output_format_name(fmt), max_bpc, min_bpc);
 
 	return -EINVAL;
 }
diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
index 3ecc079404a1..f019bd5fef69 100644
--- a/drivers/gpu/drm/drm_connector.c
+++ b/drivers/gpu/drm/drm_connector.c
@@ -640,6 +640,10 @@ int drmm_connector_hdmi_init(struct drm_device *dev,
 	if (ret)
 		return ret;
 
+	ret = drm_connector_attach_min_bpc_property(connector, max_bpc);
+	if (ret)
+		return ret;
+
 	connector->hdmi.funcs = hdmi_funcs;
 
 	return 0;
diff --git a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
index 353a261d42da..8f8f7a528e08 100644
--- a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
+++ b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
@@ -1361,6 +1361,150 @@ static void drm_test_check_tmds_char_rate_rgb_12bpc(struct kunit *test)
 	drm_modeset_acquire_fini(&ctx);
 }
 
+/*
+ * Test that an atomic check with a min bpc of 10 fails on a connector that
+ * maxes out at 8bpc even if the EDID could go higher.
+ */
+static void drm_test_check_min_bpc_10bit_connector_fail(struct kunit *test)
+{
+	struct drm_atomic_helper_connector_hdmi_priv *priv;
+	struct drm_modeset_acquire_ctx ctx;
+	struct drm_connector_state *conn_state;
+	struct drm_display_mode *preferred;
+	struct drm_atomic_commit *state;
+	struct drm_connector *conn;
+	struct drm_device *drm;
+	int ret;
+
+	priv = drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test,
+				BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444) |
+				BIT(DRM_OUTPUT_COLOR_FORMAT_YCBCR420) |
+				BIT(DRM_OUTPUT_COLOR_FORMAT_YCBCR422) |
+				BIT(DRM_OUTPUT_COLOR_FORMAT_YCBCR444),
+				8,
+				&dummy_connector_hdmi_funcs,
+				test_edid_hdmi_1080p_rgb_yuv_dc_max_340mhz);
+	KUNIT_ASSERT_NOT_NULL(test, priv);
+
+	drm = &priv->drm;
+	conn = &priv->connector;
+	preferred = find_preferred_mode(conn);
+	KUNIT_ASSERT_NOT_NULL(test, preferred);
+
+	drm_modeset_acquire_init(&ctx, 0);
+
+retry_conn_enable:
+	ret = drm_kunit_helper_enable_crtc_connector(test, drm, priv->crtc,
+						     conn, preferred, &ctx);
+	if (ret == -EDEADLK) {
+		ret = drm_modeset_backoff(&ctx);
+		if (!ret)
+			goto retry_conn_enable;
+	}
+	KUNIT_ASSERT_EQ(test, ret, 0);
+
+	state = drm_kunit_helper_atomic_state_alloc(test, drm, &ctx);
+	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state);
+
+retry_conn_state:
+	conn_state = drm_atomic_get_connector_state(state, conn);
+	if (PTR_ERR(conn_state) == -EDEADLK) {
+		drm_atomic_commit_clear(state);
+		ret = drm_modeset_backoff(&ctx);
+		if (!ret)
+			goto retry_conn_state;
+	}
+	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, conn_state);
+
+	conn_state->min_requested_bpc = 10;
+
+	ret = drm_atomic_check_only(state);
+	if (ret == -EDEADLK) {
+		drm_atomic_commit_clear(state);
+		ret = drm_modeset_backoff(&ctx);
+		if (!ret)
+			goto retry_conn_state;
+	}
+	KUNIT_EXPECT_LT(test, ret, 0);
+
+	drm_modeset_drop_locks(&ctx);
+	drm_modeset_acquire_fini(&ctx);
+}
+
+/*
+ * Test that an atomic check with a min bpc of 10 succeeds on a connector that
+ * can do 10bpc if the EDID can also do 10bpc.
+ */
+static void drm_test_check_min_bpc_10bit_success(struct kunit *test)
+{
+	struct drm_atomic_helper_connector_hdmi_priv *priv;
+	struct drm_modeset_acquire_ctx ctx;
+	struct drm_connector_state *conn_state;
+	struct drm_display_mode *preferred;
+	struct drm_atomic_commit *state;
+	struct drm_connector *conn;
+	struct drm_device *drm;
+	int ret;
+
+	priv = drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test,
+				BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444),
+				12,
+				&dummy_connector_hdmi_funcs,
+				test_edid_hdmi_1080p_rgb_yuv_dc_max_340mhz);
+	KUNIT_ASSERT_NOT_NULL(test, priv);
+
+	drm = &priv->drm;
+	conn = &priv->connector;
+	preferred = find_preferred_mode(conn);
+	KUNIT_ASSERT_NOT_NULL(test, preferred);
+	KUNIT_ASSERT_TRUE(test, conn->display_info.edid_hdmi_rgb444_dc_modes &
+				DRM_EDID_HDMI_DC_30);
+
+	drm_modeset_acquire_init(&ctx, 0);
+
+retry_conn_enable:
+	ret = drm_kunit_helper_enable_crtc_connector(test, drm, priv->crtc,
+						     conn, preferred, &ctx);
+	if (ret == -EDEADLK) {
+		ret = drm_modeset_backoff(&ctx);
+		if (!ret)
+			goto retry_conn_enable;
+	}
+	KUNIT_ASSERT_EQ(test, ret, 0);
+
+	state = drm_kunit_helper_atomic_state_alloc(test, drm, &ctx);
+	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state);
+
+retry_conn_state:
+	conn_state = drm_atomic_get_connector_state(state, conn);
+	if (PTR_ERR(conn_state) == -EDEADLK) {
+		drm_atomic_commit_clear(state);
+		ret = drm_modeset_backoff(&ctx);
+		if (!ret)
+			goto retry_conn_state;
+	}
+	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, conn_state);
+
+	conn_state->min_requested_bpc = 10;
+
+	ret = drm_atomic_check_only(state);
+	if (ret == -EDEADLK) {
+		drm_atomic_commit_clear(state);
+		ret = drm_modeset_backoff(&ctx);
+		if (!ret)
+			goto retry_conn_state;
+	}
+	KUNIT_EXPECT_EQ(test, ret, 0);
+
+	conn_state = drm_atomic_get_new_connector_state(state, conn);
+	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, conn_state);
+	KUNIT_EXPECT_GE(test, conn_state->hdmi.output_bpc, 10);
+	KUNIT_ASSERT_EQ(test, conn_state->hdmi.output_format, DRM_OUTPUT_COLOR_FORMAT_RGB444);
+
+	drm_modeset_drop_locks(&ctx);
+	drm_modeset_acquire_fini(&ctx);
+}
+
 /*
  * Test that if we filter a rate through our hook, it's indeed rejected
  * by the whole atomic_check logic.
@@ -2476,6 +2620,8 @@ static struct kunit_case drm_atomic_helper_connector_hdmi_check_tests[] = {
 	KUNIT_CASE(drm_test_check_tmds_char_rate_rgb_8bpc),
 	KUNIT_CASE(drm_test_check_tmds_char_rate_rgb_10bpc),
 	KUNIT_CASE(drm_test_check_tmds_char_rate_rgb_12bpc),
+	KUNIT_CASE(drm_test_check_min_bpc_10bit_connector_fail),
+	KUNIT_CASE(drm_test_check_min_bpc_10bit_success),
 	KUNIT_CASE_PARAM(drm_test_check_hdmi_color_format,
 			 check_hdmi_color_format_gen_params),
 	KUNIT_CASE_PARAM(drm_test_check_hdmi_color_format_420_only,

-- 
2.55.0


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

* Re: [PATCH v2 2/2] drm/connector: hdmi: Implement "min bpc" property
  2026-07-29 12:13 ` [PATCH v2 2/2] drm/connector: hdmi: Implement "min bpc" property Nicolas Frattaroli
@ 2026-07-29 12:23   ` sashiko-bot
  0 siblings, 0 replies; 5+ messages in thread
From: sashiko-bot @ 2026-07-29 12:23 UTC (permalink / raw)
  To: Nicolas Frattaroli; +Cc: dri-devel

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] The new `min_requested_bpc` property is not printed in `drm_atomic_connector_print_state()`.
--

--- Patch [2]: [PATCH v2 2/2] drm/connector: hdmi: Implement "min bpc" property ---
commit 1bb247d1cac675bb602431e3c391ddd31f8fed8d
Author: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>

drm/connector: hdmi: Implement "min bpc" property

Act on the "min bpc" property's min_requested_bpc state in the common
HDMI state helpers, and register the property on HDMI connectors.
Also add two KUnit tests to verify that the property behaves as expected.

> diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
> index 3ecc079404a10..f019bd5fef692 100644
> --- a/drivers/gpu/drm/drm_connector.c
> +++ b/drivers/gpu/drm/drm_connector.c
> @@ -640,6 +640,10 @@ int drmm_connector_hdmi_init(struct drm_device *dev,
>  	if (ret)
>  		return ret;
>  
> +	ret = drm_connector_attach_min_bpc_property(connector, max_bpc);
> +	if (ret)
> +		return ret;
> +

[Severity: Low]
Since we are adding support for the min bpc property and using
min_requested_bpc in the connector state, should this also be printed in
drm_atomic_connector_print_state() alongside max_requested_bpc?

For example, looking at drivers/gpu/drm/drm_atomic.c in
drm_atomic_connector_print_state():

	drm_printf_indent(p, 1, "max_requested_bpc=%d\n", state->max_requested_bpc);
	drm_printf_indent(p, 1, "colorspace=%s\n", drm_get_colorspace_name(state->colorspace));

Without printing it here, the debugfs atomic state dump will not display
the min_requested_bpc field, which might make debugging atomic commits
incomplete.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260729-min-bpc-v2-0-7d0036ef437c@collabora.com?part=2

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

* Re: [PATCH v2 1/2] drm/connector: Introduce "min bpc" connector property
  2026-07-29 12:13 ` [PATCH v2 1/2] drm/connector: Introduce " Nicolas Frattaroli
@ 2026-07-29 12:25   ` sashiko-bot
  0 siblings, 0 replies; 5+ messages in thread
From: sashiko-bot @ 2026-07-29 12:25 UTC (permalink / raw)
  To: Nicolas Frattaroli; +Cc: dri-devel

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] Missing generic bounds validation for `min_requested_bpc` against `max_bpc` in core DRM atomic check.
- [Low] The newly introduced 'min_requested_bpc' field is not printed in debugfs atomic state dumps.
--

--- Patch [1]: [PATCH v2 1/2] drm/connector: Introduce "min bpc" connector property ---
commit c6fed32ee27d744d2ae9e2fb7635ec916f3ea61f
Author: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>

    drm/connector: Introduce "min bpc" connector property
    
    Add a new KMS connector property called "min bpc". Its purpose is to
    allow userspace to mandate that the output bit depth ends up greater
    than or equal to a specified depth, or else have the commit fail. This
    is useful for checking for output depth degradation in combination with
    atomic test commits.

> diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
> index a0cf0268de483..35f395d46f6b9 100644
> --- a/include/drm/drm_connector.h
> +++ b/include/drm/drm_connector.h
> @@ -1267,6 +1267,11 @@ struct drm_connector_state {
>  	 */
>  	u8 max_requested_bpc;
>  
> +	/**
> +	 * @min_requested_bpc: Minimum output bit depth requested by userspace
> +	 */
> +	u8 min_requested_bpc;
> +

[Severity: Low]
Does this omit printing the newly added min_requested_bpc?

When a developer or user reads /sys/kernel/debug/dri/*/state to inspect the
atomic KMS configuration, drm_atomic_connector_print_state() in
drivers/gpu/drm/drm_atomic.c prints max_requested_bpc but doesn't seem to
print min_requested_bpc, which could lead to incomplete state dumps.

[Severity: Medium]
Does the DRM core need to validate that min_requested_bpc <= max_bpc?

The core drm_atomic_connector_check() function in drivers/gpu/drm/drm_atomic.c
calculates state->max_bpc but doesn't verify that
state->min_requested_bpc <= state->max_bpc. 

If userspace sets the "min bpc" property to a value higher than max_bpc and
issues an atomic commit, this impossible constraint isn't rejected by the DRM
core.

This forces every driver implementing this property to manually check for this
contradiction. If a driver fails to do so, it may silently configure a bit
depth lower than min_requested_bpc, violating the explicit uAPI contract
that the commit must fail if the minimum bit depth cannot be met.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260729-min-bpc-v2-0-7d0036ef437c@collabora.com?part=1

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

end of thread, other threads:[~2026-07-29 12:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-29 12:13 [PATCH v2 0/2] Add a "min bpc" connector property Nicolas Frattaroli
2026-07-29 12:13 ` [PATCH v2 1/2] drm/connector: Introduce " Nicolas Frattaroli
2026-07-29 12:25   ` sashiko-bot
2026-07-29 12:13 ` [PATCH v2 2/2] drm/connector: hdmi: Implement "min bpc" property Nicolas Frattaroli
2026-07-29 12:23   ` sashiko-bot

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.