drm_connector_attach_max_bpc_property() initializes max_requested_bpc and max_bpc in the connector state, but nothing restores them when the connector state is later thrown away and re-created: drm_bridge_connector_create_state() returns a zeroed state for non-HDMI bridge connectors, and drm_mode_config_reset() installs such a fresh state on every connector that implements &drm_connector_funcs.atomic_create_state instead of a .reset hook.
This matters because drivers can attach the property before drm_mode_config_reset() runs. Rockchip, for example, binds its component drivers (which create connectors and attach properties) before calling drm_mode_config_reset(). After that reset, max_requested_bpc is 0, so drm_atomic_connector_check() computes max_bpc = min(info->bpc ?: 8, 0) = 0. Any driver that filters output formats on conn_state->max_bpc then rejects every format, and clients that never set the "max bpc" property - fbcon in particular - end up with a black screen. meson already attaches the property on a drm_bridge_connector before drm_mode_config_reset() and so already boots with max_requested_bpc = 0 today. dw-hdmi's format negotiation does consume the value there, but meson attaches the property with a maximum of 8 and the 8-bit fallback formats are not gated on it, so negotiation yields the same result for 0 and 8 - the change is a no-op for meson. HDMI bridge connectors are immune: drm_bridge_connector_create_state() calls __drm_atomic_helper_connector_hdmi_state_init(), which initializes both fields from connector->max_bpc. amdgpu likewise re-initializes max_requested_bpc in its own .reset implementation. Non-HDMI bridge connectors have no equivalent. Mirror the HDMI helper on the non-HDMI path: record the upper attach limit in connector->max_bpc (drmm_connector_hdmi_init() already stores the same value there) and restore max_requested_bpc and max_bpc from it in drm_bridge_connector_create_state() whenever the "max bpc" property is attached. Connectors without the property behave exactly as before. Signed-off-by: Igor Paunovic <[email protected]> --- drivers/gpu/drm/display/drm_bridge_connector.c | 6 +++++- drivers/gpu/drm/drm_connector.c | 5 +++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/display/drm_bridge_connector.c b/drivers/gpu/drm/display/drm_bridge_connector.c index 632cc3ae3b54..d33c4fc42fbf 100644 --- a/drivers/gpu/drm/display/drm_bridge_connector.c +++ b/drivers/gpu/drm/display/drm_bridge_connector.c @@ -282,9 +282,13 @@ drm_bridge_connector_create_state(struct drm_connector *connector) if (IS_ERR(conn_state)) return conn_state; - if (bridge_connector->bridge_hdmi) + if (bridge_connector->bridge_hdmi) { __drm_atomic_helper_connector_hdmi_state_init(connector, conn_state); + } else if (connector->max_bpc_property) { + conn_state->max_requested_bpc = connector->max_bpc; + conn_state->max_bpc = connector->max_bpc; + } return conn_state; } diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c index 8b4baed060f3..0400a6a92e2b 100644 --- a/drivers/gpu/drm/drm_connector.c +++ b/drivers/gpu/drm/drm_connector.c @@ -2866,6 +2866,10 @@ EXPORT_SYMBOL(drm_connector_set_link_status_property); * @max: The maximum bit depth supported by the connector. * * This is used to add support for limiting the bit depth on a connector. + * @max is also recorded in &drm_connector.max_bpc, so that + * &drm_connector_funcs.atomic_create_state and &drm_connector_funcs.reset + * implementations can restore the property default when re-creating the + * connector state. * * Returns: * Zero on success, negative errno on failure. @@ -2888,6 +2892,7 @@ int drm_connector_attach_max_bpc_property(struct drm_connector *connector, drm_object_attach_property(&connector->base, prop, max); connector->state->max_requested_bpc = max; connector->state->max_bpc = max; + connector->max_bpc = max; return 0; } -- 2.43.0
