backend-drm: Add 'link bpc' connector property

The 'link bpc' DRM connector property can be used to retrieve the
physical bpc value.

This property can be used to find out the physical link value as
drivers will try to lower the bpc value when creaing an optimal output.

If we detect change we would notify the user if the value set with 'max
bpc' would be different than that of 'link bpc'.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
This commit is contained in:
Marius Vlad 2025-10-21 12:40:45 +00:00
parent 564f6687eb
commit c192672700
3 changed files with 18 additions and 0 deletions

View file

@ -124,6 +124,7 @@ enum wdrm_connector_property {
WDRM_CONNECTOR_CONTENT_TYPE,
WDRM_CONNECTOR_COLORSPACE,
WDRM_CONNECTOR_VRR_CAPABLE,
WDRM_CONNECTOR_LINK_BPC,
WDRM_CONNECTOR__COUNT
};

View file

@ -3774,6 +3774,19 @@ drm_connector_find_property_by_id(struct drm_connector *connector,
return prop;
}
static void
weston_head_verify_bpc_status(struct drm_head *head)
{
unsigned int link_bpc;
link_bpc = drm_property_get_value(&head->connector.props[WDRM_CONNECTOR_LINK_BPC],
head->connector.props_drm, 0);
if (head->inherited_max_bpc != link_bpc)
weston_log("WARNING: max bpc was set to %u but current link bpc "
"set to %u\n", head->inherited_max_bpc, link_bpc);
}
static void
drm_backend_update_conn_props(struct drm_backend *b,
struct drm_device *device,
@ -3801,6 +3814,9 @@ drm_backend_update_conn_props(struct drm_backend *b,
weston_head_set_content_protection_status(&head->base,
drm_head_get_current_protection(head));
}
if (conn_prop == WDRM_CONNECTOR_LINK_BPC)
weston_head_verify_bpc_status(head);
}
static int

View file

@ -252,6 +252,7 @@ const struct drm_property_info connector_props[] = {
[WDRM_CONNECTOR_VRR_CAPABLE] = {
.name = "vrr_capable",
},
[WDRM_CONNECTOR_LINK_BPC] = { .name = "link bpc", },
};
const struct drm_property_info crtc_props[] = {