Add "link bpc" DRM property
Subsystems (2)
v6 cover Add "link bpc" DRM property
This series adds a new "link bpc" DRM property. It reflects the display link's actual achieved output bits per component, considering any degradation of the bit depth done by drivers for bandwidth or other reasons. The property's value is updated during an atomic commit, which is also when it fires an uevent if it changed to let userspace know.
There's a weston implementation at [1] which makes use of this new property. It is not representative of the entire use case of the property, but rather a proof-of-concept.
[1]: https://gitlab.freedesktop.org/wayland/weston/-/merge_requests/1850
---
Changes in v6:
- Drop amdgpu patch to unblock series.
- Reword property documentation to make it more explicit as to what bits this counts and why someone would want this.
- Reword first patch message to do the same.
- Link to v5: https://lore.kernel.org/r/[email protected]
Changes in v5:
- Split "drm/connector: hdmi: Add a 'link bpc' property" into two
patches; one adding the property, the other making use for it in the
HDMI helpers (Maxime)
- Apply Maxime's Ack to the two split patches as per the review
- Link to v4: https://lore.kernel.org/r/[email protected]
Changes in v4:
- Throw out the workqueue and delayed work item
- Remove the drm_connector_update_link_bpc_state function
- Reimplement it by updating the property and firing the uevent in commit_tail
- Check that the provided max_bpc value in attach_link_bpc_property is within the expected range
- Clamp the connector state's link_bpc value between 8 and max_bpc so
that no value outside the declared range is ever written to the drm property
- Update and reword doc strings
- Add an amdgpu implementation
- Link to v3: https://lore.kernel.org/r/[email protected]/T/
Changes in v3:
- remove VRR mention from commit description (Ville)
- add DRM_MODE_PROP_IMMUTABLE to flags (Ville)
- provide helpers functions for drivers to use (can be used by other
types of connectors, not just HDMI)
- send uevent informating userspace when 'link bpc' connector state
changed (Daniel @ https://gitlab.freedesktop.org/wayland/weston/-/merge_requests/1850)
- added missing doc entry
- Link to v2: https://lore.kernel.org/r/[email protected]/T/
Changes in v2:
- replace return with EBUSY if connector already exists (Dmitry)
- add i-g-t test and an implementation for Weston (Dmitry)
- re-wording patch description (Jani)
- Link to v1: https://lore.kernel.org/r/[email protected]/T/
---
Nicolas Frattaroli (2):
drm/connector: Add a 'link bpc' property drm/connector: hdmi: Add support for 'link bpc' property
drivers/gpu/drm/display/drm_hdmi_state_helper.c | 2 + drivers/gpu/drm/drm_atomic_helper.c | 9 +++ drivers/gpu/drm/drm_atomic_uapi.c | 2 + drivers/gpu/drm/drm_connector.c | 88 +++++++++++++++++++++++++ include/drm/drm_connector.h | 16 +++++ 5 files changed, 117 insertions(+)
---
base-commit: 3a48a999a2e3c3d1988d44370ed8f43ff54700b6
change-id: 20260309-link-bpc-d0afc475ac49
Best regards,
Signature · 1 line
Nicolas Frattaroli <[email protected]>
PATCH v6 1/2 drm/connector: Add a 'link bpc' property
Display drivers may degrade from higher bit depths to lower bit depths for reasons such as bandwidth constraints. Userspace applications, such as compositors, may wish to know that this has occurred transparently.
Introduce a new immutable DRM property called "link bpc" that reflects the current display link's bits-per-component without considering a lower "on the wire" bit depth caused by display protocol features such as compression or dithering. An uevent is fired when the link bpc value changes on an atomic commit.
--- drivers/gpu/drm/drm_atomic_helper.c | 9 ++++ drivers/gpu/drm/drm_atomic_uapi.c | 2 + drivers/gpu/drm/drm_connector.c | 84 +++++++++++++++++++++++++++++++++++++ include/drm/drm_connector.h | 16 +++++++ 4 files changed, 111 insertions(+)
drivers/gpu/drm/drm_atomic_helper.c +9 -0
@@ -2033,9 +2033,11 @@ EXPORT_SYMBOL(drm_atomic_helper_commit_tail_rpm);static void commit_tail (struct drm_atomic_state *state) { +struct drm_connector_state *old_conn_state, *new_conn_state;struct drm_device *dev = state->dev;const struct drm_mode_config_helper_funcs *funcs;struct drm_crtc_state *new_crtc_state; +struct drm_connector *connector;struct drm_crtc *crtc;ktime_t start;s64 commit_time_ms;
@@ -2059,6 +2061,13 @@ static void commit_tail(struct drm_atomic_state *state)drm_atomic_helper_wait_for_dependencies (state); +for_each_oldnew_connector_in_state (state, connector, old_conn_state, + new_conn_state, i) { +if (old_conn_state->link_bpc != new_conn_state->link_bpc) +drm_connector_update_link_bpc_property (connector, + new_conn_state); + } +/* * We cannot safely access new_crtc_state after * drm_atomic_helper_commit_hw_done() so figure out which crtc's have
drivers/gpu/drm/drm_atomic_uapi.c +2 -0
@@ -1020,6 +1020,8 @@ drm_atomic_connector_get_property(struct drm_connector *connector, *val = state->privacy_screen_sw_state; }else if (property == connector->broadcast_rgb_property) { *val = state->hdmi.broadcast_rgb; + }else if (property == connector->link_bpc_property) { + *val = state->link_bpc; }else if (connector->funcs->atomic_get_property) {return connector->funcs->atomic_get_property (connector, state, property, val);
drivers/gpu/drm/drm_connector.c +84 -0
96 lines not on this page · raw message
include/drm/drm_connector.h +16 -0
@@ -1154,6 +1154,11 @@ struct drm_connector_state {*/ u8 max_bpc; +/** +* @link_bpc: Current display link's bits-per-component. +*/ +u8 link_bpc; +/** * @privacy_screen_sw_state: See :ref:`Standard Connector * Properties<standard_connector_properties>`
@@ -2146,6 +2151,12 @@ struct drm_connector {*/ struct drm_property *max_bpc_property; +/** +* @link_bpc_property: Connector property that reflects the current +* output bits per component. +*/ +struct drm_property *link_bpc_property; +/** @privacy_screen: drm_privacy_screen for this connector, or NULL. */ struct drm_privacy_screen *privacy_screen;
@@ -2556,6 +2567,11 @@ void drm_connector_attach_privacy_screen_provider( struct drm_connector *connector, struct drm_privacy_screen *priv);void drm_connector_update_privacy_screen (const struct drm_connector_state *connector_state); +int drm_connector_attach_link_bpc_property (struct drm_connector *connector, +unsigned int max_bpc); +void drm_connector_update_link_bpc_property (struct drm_connector *connector, +struct drm_connector_state *state); +/** * struct drm_tile_group - Tile group metadata * @refcount: reference count
Signature · 1 line
2.53.0
PATCH v6 2/2 drm/connector: hdmi: Add support for 'link bpc' property
In reply to Nicolas FrattaroliCreate and attach the 'link bpc' DRM property for every HDMI connector that's created through drmm_connector_hdmi_init.
Then, set the connector state's link_bpc member in the HDMI atomic check state helper to the connector state's HDMI output bpc.
--- drivers/gpu/drm/display/drm_hdmi_state_helper.c | 2 ++ drivers/gpu/drm/drm_connector.c | 4 ++++ 2 files changed, 6 insertions(+)
drivers/gpu/drm/display/drm_hdmi_state_helper.c +2 -0
@@ -887,6 +887,8 @@ int drm_atomic_helper_connector_hdmi_check(struct drm_connector *connector,struct drm_crtc *crtc = new_conn_state->crtc;struct drm_crtc_state *crtc_state; + new_conn_state->link_bpc = new_conn_state->hdmi.output_bpc; + crtc_state =drm_atomic_get_crtc_state (state, crtc);if (IS_ERR (crtc_state))return PTR_ERR (crtc_state);
drivers/gpu/drm/drm_connector.c +4 -0
@@ -693,6 +693,10 @@ int drmm_connector_hdmi_init(struct drm_device *dev,drm_connector_attach_max_bpc_property (connector,8 , max_bpc); connector->max_bpc = max_bpc; + ret =drm_connector_attach_link_bpc_property (connector, max_bpc); +if (ret) +return ret; +if (max_bpc >8 )drm_connector_attach_hdr_output_metadata_property (connector);
Signature · 1 line
2.53.0
Quoted 70 lines · On Monday, 30 March 2026 10:33:08 Central European Summer Time Nicolas…
This series adds a new "link bpc" DRM property. It reflects the display link's actual achieved output bits per component, considering any degradation of the bit depth done by drivers for bandwidth or other reasons. The property's value is updated during an atomic commit, which is also when it fires an uevent if it changed to let userspace know.
There's a weston implementation at [1] which makes use of this new property. It is not representative of the entire use case of the property, but rather a proof-of-concept.
[1]: https://gitlab.freedesktop.org/wayland/weston/-/merge_requests/1850
---
Changes in v6:
- Drop amdgpu patch to unblock series.
- Reword property documentation to make it more explicit as to what bits this counts and why someone would want this.
- Reword first patch message to do the same.
- Link to v5: https://lore.kernel.org/r/[email protected]Changes in v5:
- Split "drm/connector: hdmi: Add a 'link bpc' property" into two
patches; one adding the property, the other making use for it in the
HDMI helpers (Maxime)
- Apply Maxime's Ack to the two split patches as per the review
- Link to v4: https://lore.kernel.org/r/[email protected]Changes in v4:
- Throw out the workqueue and delayed work item
- Remove thedrm_connector_update_link_bpc_statefunction
- Reimplement it by updating the property and firing the uevent incommit_tail
- Check that the providedmax_bpcvalue inattach_link_bpc_propertyis within the expected range
- Clamp the connector state'slink_bpcvalue between 8 andmax_bpcso
that no value outside the declared range is ever written to the drm property
- Update and reword doc strings
- Add an amdgpu implementation
- Link to v3: https://lore.kernel.org/r/[email protected]/T/Changes in v3:
- remove VRR mention from commit description (Ville)
- addDRM_MODE_PROP_IMMUTABLEto flags (Ville)
- provide helpers functions for drivers to use (can be used by other
types of connectors, not just HDMI)
- send uevent informating userspace when 'link bpc' connector state
changed (Daniel @ https://gitlab.freedesktop.org/wayland/weston/-/merge_requests/1850)
- added missing doc entry
- Link to v2: https://lore.kernel.org/r/[email protected]/T/Changes in v2:
- replace return with EBUSY if connector already exists (Dmitry)
- add i-g-t test and an implementation for Weston (Dmitry)
- re-wording patch description (Jani)
- Link to v1: https://lore.kernel.org/r/[email protected]/T/Signed-off-by Nicolas Frattaroli <[email protected]>---
Nicolas Frattaroli (2):
drm/connector: Add a 'link bpc' property drm/connector: hdmi: Add support for 'link bpc' propertydrivers/gpu/drm/display/drm_hdmi_state_helper.c | 2 + drivers/gpu/drm/drm_atomic_helper.c | 9 +++ drivers/gpu/drm/drm_atomic_uapi.c | 2 + drivers/gpu/drm/drm_connector.c | 88 +++++++++++++++++++++++++ include/drm/drm_connector.h | 16 +++++ 5 files changed, 117 insertions(+)
Quoted 9 lines
---
base-commit:3a48a999a2e3c3d1988d44370ed8f43ff54700b6
change-id: 20260309-link-bpc-d0afc475ac49Best regards,
Signature · 1 line
Nicolas Frattaroli <[email protected]>
There's a lot of unresolved discussion on v5 of the series going on at the moment, so please don't merge v6 despite the acks, there will likely be a v7.
Kind regards,
Nicolas Frattaroli