On Sun, Oct 11, 2026 at 02:27:32PM +0000, Jan Claußen wrote:
> Bridge connectors for HDMI do not expose the colorspace property,
> so userspace cannot signal the colorimetry (e.g. BT.2020 for HDR).
> KWin requires the property before it offers the HDR toggle.
> 
> Attach the property for HDMI bridge connectors, next to the other HDMI
> properties set up by drmm_connector_hdmi_init().
> 
> Force a modeset when the property changes so the new colorimetry
> reaches the sink, as vc4 does in its connector atomic_check.
> 
> After toggling HDR on, modetest shows that the correct BT.2020 color
> space is loaded. After toggling it off, it loads the default color space
> again.
> 
> Tested in KDE Plasma 6.7.5 on a Radxa Rock 5B (RK3588) with an LG
> OLED55B87LC.
> 
> Suggested-by: Javier Martinez Canillas <[email protected]>
> Signed-off-by: Jan Claußen <[email protected]>
> ---
>  .../gpu/drm/display/drm_bridge_connector.c    | 25 ++++++++++++++++---
>  1 file changed, 22 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/display/drm_bridge_connector.c 
> b/drivers/gpu/drm/display/drm_bridge_connector.c
> index 81f3e26f6fdf..885094cc6ddf 100644
> --- a/drivers/gpu/drm/display/drm_bridge_connector.c
> +++ b/drivers/gpu/drm/display/drm_bridge_connector.c
> @@ -414,11 +414,24 @@ static int drm_bridge_connector_atomic_check(struct 
> drm_connector *connector,
>  {
>       struct drm_bridge_connector *bridge_connector =
>               to_drm_bridge_connector(connector);
> +     struct drm_connector_state *old_state =
> +             drm_atomic_get_old_connector_state(state, connector);
> +     struct drm_connector_state *new_state =
> +             drm_atomic_get_new_connector_state(state, connector);
> +     struct drm_crtc_state *crtc_state;
>  
> -     if (bridge_connector->bridge_hdmi)
> -             return drm_atomic_helper_connector_hdmi_check(connector, state);
> +     if (!bridge_connector->bridge_hdmi)
> +             return 0;
>  
> -     return 0;
> +     if (new_state->crtc && old_state->colorspace != new_state->colorspace) {
> +             crtc_state = drm_atomic_get_crtc_state(state, new_state->crtc);
> +             if (IS_ERR(crtc_state))
> +                     return PTR_ERR(crtc_state);
> +
> +             crtc_state->mode_changed = true;
> +     }
> +
> +     return drm_atomic_helper_connector_hdmi_check(connector, state);
>  }
>  
>  static const struct drm_connector_helper_funcs 
> drm_bridge_connector_helper_funcs = {
> @@ -1079,6 +1092,12 @@ struct drm_connector *drm_bridge_connector_init(struct 
> drm_device *drm,
>                                              connector_type, ddc);
>               if (ret)
>                       return ERR_PTR(ret);
> +
> +             ret = drm_mode_create_hdmi_colorspace_property(connector, 0);

This should come from drivers, you can't expect every driver to support
every HDMI colorspace.

> +             if (ret)
> +                     return ERR_PTR(ret);
> +
> +             drm_connector_attach_colorspace_property(connector);

Most importantly, all that work should be in the HDMI helpers, it's an
HDMI feature just like, say, max bpc

Maxime

Attachment: signature.asc
Description: PGP signature

Reply via email to