drm/connector: hdmi: Add a 'link bpc' property
Subsystems (2)
PATCH v3 1/1 drm/connector: hdmi: Add a 'link bpc' property
From: Derek Foreman <[email protected]>
Add a way to know the actual bpc of a running link.
Drivers might change the current bpc link value due to changes in mode line or refresh rates. An example can be found when switching the color output format, part of YUV420 fallback.
This means we might be displaying a stale bpc value although it was modified for different reasons -- like a refresh rate or an output color format.
Introduces a new property 'link bpc' that user-space can use to get the current bpc value of a running link while in the same time allow user-space to set-up bpc using 'max bpc' property.
An implementation for Weston [1] and a simple test for i-g-t [2] have been added.
[1] https://gitlab.freedesktop.org/wayland/weston/-/merge_requests/1850
[2] https://lists.freedesktop.org/archives/igt-dev/2025-October/097061.html
---
v1:
- https://lore.kernel.org/dri-devel/[email protected]/T/#u
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)
- https://lore.kernel.org/dri-devel/[email protected]/
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
.../gpu/drm/display/drm_hdmi_state_helper.c | 3 + drivers/gpu/drm/drm_atomic_uapi.c | 2 + drivers/gpu/drm/drm_connector.c | 125 ++++++++++++++++++ include/drm/drm_connector.h | 32 +++++ 4 files changed, 162 insertions(+)
drivers/gpu/drm/display/drm_hdmi_state_helper.c +3 -0
@@ -866,6 +866,9 @@ int drm_atomic_helper_connector_hdmi_check(struct drm_connector *connector, crtc_state->mode_changed = true; } +drm_connector_update_link_bpc_state (connector, + new_conn_state->hdmi.output_bpc); +return 0 ; }EXPORT_SYMBOL (drm_atomic_helper_connector_hdmi_check);
drivers/gpu/drm/drm_atomic_uapi.c +2 -0
@@ -865,6 +865,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 +125 -0
161 lines not on this page · raw message
include/drm/drm_connector.h +32 -0
@@ -1132,6 +1132,11 @@ struct drm_connector_state {*/ u8 max_bpc; +/* +* @link_bpc: Current link bpc +*/ +u8 link_bpc; +/** * @privacy_screen_sw_state: See :ref:`Standard Connector * Properties<standard_connector_properties>`
@@ -1882,6 +1887,16 @@ struct drm_connector_cec {void *data; }; +/* +* struct link_bpc_wq - holds the necessary bits to queue uevents for +* propagating 'link bpc' connector updates +*/ +struct link_bpc_wq { +struct workqueue_struct *wq; +struct delayed_work d_work; +struct mutex lock; +}; +/** * struct drm_connector - central DRM connector control structure *
@@ -2079,6 +2094,19 @@ struct drm_connector {*/ struct drm_property *max_bpc_property; +/** +* @link_bpc_property: Current connector link bpc set by the driver +* This property can be used to store the current link bpc. +*/ +struct drm_property *link_bpc_property; + +/** +* @link_bpc_wq: workqueue for sending uevent to userspace with updated +* 'link bpc' value +*/ +struct link_bpc_wq link_bpc; + +/** @privacy_screen: drm_privacy_screen for this connector, or NULL. */ struct drm_privacy_screen *privacy_screen;
@@ -2488,6 +2516,10 @@ 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); +void drm_connector_update_link_bpc_state (struct drm_connector *connector,u8 val); +/** * struct drm_tile_group - Tile group metadata * @refcount: reference count
Signature · 1 line
2.47.2