* [PATCH v3 0/6] drm: Add colorspace property support to the HDMI helpers
@ 2026-10-18 12:30 ` Jan Claußen
0 siblings, 0 replies; 15+ messages in thread
From: Jan Claußen @ 2026-10-18 12:30 UTC (permalink / raw)
To: Sandy Huang, Heiko Stübner, Andy Yan, Andrzej Hajda,
Neil Armstrong, Robert Foss, Laurent Pinchart, Jonas Karlman,
Jernej Skrabec, Luca Ceresoli, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Dmitry Baryshkov,
Daniel Stone, Cristian Ciocaltea, Nicolas Frattaroli,
Jan Claußen
Cc: dri-devel, linux-rockchip, linux-kernel, linux-arm-kernel
HDMI connectors set up through drmm_connector_hdmi_init() don't expose
the colorspace property, so userspace can't signal BT.2020 colorimetry
for HDR. KWin, for example, doesn't offer HDR without it.
This series lets drivers declare which colorspaces they support and has
the HDMI helpers create the property and force a modeset when it
changes. dw-hdmi-qp on RK3588 is the first user.
Tested on a Radxa Rock 5B (RK3588) with an LG OLED55B87LC in KDE
Plasma 6.7.5. Only BT.2020 RGB is tested.
Does VOP2 use matching coefficients for BT.709/BT.2020 YCC
output?
Changes in v3:
- Move colorspace handling into the HDMI helpers (Maxime)
- Let drivers declare supported colorspaces instead of exposing all
- Split into a series
Changes in v2:
- Fix possible null pointer dereferencing requested by the Sashiko bot
v2: https://lore.kernel.org/all/20261011142733.7806-1-jan.claussen10@web.de
v1: https://lore.kernel.org/all/20261011132024.2833-1-jan.claussen10@web.de
Jan Claußen (6):
drm/connector: Fix typo in colorspace error messages
drm/display: hdmi-state-helper: Force modeset on colorspace change
drm/connector: hdmi: Create the colorspace property
drm/bridge-connector: Pass supported colorspaces to the HDMI helpers
drm/bridge: dw-hdmi-qp: Forward supported colorspaces from platform
data
drm/rockchip: dw_hdmi_qp: Advertise BT.709 and BT.2020 colorimetries
drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c | 3 +++
drivers/gpu/drm/display/drm_bridge_connector.c | 4 ++++
drivers/gpu/drm/display/drm_hdmi_state_helper.c | 3 ++-
drivers/gpu/drm/drm_connector.c | 17 +++++++++++++----
drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c | 4 ++++
include/drm/bridge/dw_hdmi_qp.h | 2 ++
include/drm/drm_bridge.h | 7 +++++++
include/drm/drm_connector.h | 7 +++++++
8 files changed, 42 insertions(+), 5 deletions(-)
--
2.56.0
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
^ permalink raw reply [flat|nested] 15+ messages in thread* [PATCH v3 1/6] drm/connector: Fix typo in colorspace error messages
2026-10-18 12:30 ` Jan Claußen
(?)
@ 2026-10-18 12:30 ` Jan Claußen
-1 siblings, 0 replies; 15+ messages in thread
From: Jan Claußen @ 2026-10-18 12:30 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter
Cc: Jan Claußen, dri-devel, linux-kernel
Change provded to provided.
Signed-off-by: Jan Claußen <jan.claussen10@web.de>
---
drivers/gpu/drm/drm_connector.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
index 893716a9e489..66f53e155342 100644
--- a/drivers/gpu/drm/drm_connector.c
+++ b/drivers/gpu/drm/drm_connector.c
@@ -2768,14 +2768,14 @@ static int drm_mode_create_colorspace_property(struct drm_connector *connector,
return 0;
if (!supported_colorspaces) {
- drm_err(dev, "No supported colorspaces provded on [CONNECTOR:%d:%s]\n",
- connector->base.id, connector->name);
+ drm_err(dev, "No supported colorspaces provided on [CONNECTOR:%d:%s]\n",
+ connector->base.id, connector->name);
return -EINVAL;
}
if ((supported_colorspaces & -BIT(DRM_MODE_COLORIMETRY_COUNT)) != 0) {
- drm_err(dev, "Unknown colorspace provded on [CONNECTOR:%d:%s]\n",
- connector->base.id, connector->name);
+ drm_err(dev, "Unknown colorspace provided on [CONNECTOR:%d:%s]\n",
+ connector->base.id, connector->name);
return -EINVAL;
}
--
2.56.0
^ permalink raw reply related [flat|nested] 15+ messages in thread* [PATCH v3 2/6] drm/display: hdmi-state-helper: Force modeset on colorspace change
2026-10-18 12:30 ` Jan Claußen
(?)
(?)
@ 2026-10-18 12:30 ` Jan Claußen
-1 siblings, 0 replies; 15+ messages in thread
From: Jan Claußen @ 2026-10-18 12:30 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Dmitry Baryshkov, Daniel Stone, Cristian Ciocaltea,
Nicolas Frattaroli, Jan Claußen
Cc: John Harrison, dri-devel, linux-kernel
The colorimetry signalled to the sink is part of the AVI infoframe,
which is only updated on a modeset. A change of the colorspace
property therefore never reaches the sink.
Treat a colorspace change like a change of the Broadcast RGB, output
bpc or output format, and force a modeset.
Signed-off-by: Jan Claußen <jan.claussen10@web.de>
---
drivers/gpu/drm/display/drm_hdmi_state_helper.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/display/drm_hdmi_state_helper.c b/drivers/gpu/drm/display/drm_hdmi_state_helper.c
index 7cdb7ca3dc12..9368e53c5945 100644
--- a/drivers/gpu/drm/display/drm_hdmi_state_helper.c
+++ b/drivers/gpu/drm/display/drm_hdmi_state_helper.c
@@ -925,7 +925,8 @@ int drm_atomic_helper_connector_hdmi_check(struct drm_connector *connector,
if (old_conn_state->hdmi.broadcast_rgb != new_conn_state->hdmi.broadcast_rgb ||
old_conn_state->hdmi.output_bpc != new_conn_state->hdmi.output_bpc ||
- old_conn_state->hdmi.output_format != new_conn_state->hdmi.output_format) {
+ old_conn_state->hdmi.output_format != new_conn_state->hdmi.output_format ||
+ old_conn_state->colorspace != new_conn_state->colorspace) {
struct drm_crtc *crtc = new_conn_state->crtc;
struct drm_crtc_state *crtc_state;
--
2.56.0
^ permalink raw reply related [flat|nested] 15+ messages in thread* [PATCH v3 3/6] drm/connector: hdmi: Create the colorspace property
2026-10-18 12:30 ` Jan Claußen
` (2 preceding siblings ...)
(?)
@ 2026-10-18 12:30 ` Jan Claußen
-1 siblings, 0 replies; 15+ messages in thread
From: Jan Claußen @ 2026-10-18 12:30 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter
Cc: Jan Claußen, dri-devel, linux-kernel
HDMI connectors initialised through drmm_connector_hdmi_init() do not
expose the colorspace property, so userspace cannot signal colorimetry
such as BT.2020 for HDR output. KWin, for instance, does not offer HDR
without it.
Add a supported_colorspaces bitmask to struct drm_connector_hdmi_funcs.
If a driver sets it, create and attach the colorspace property with
the colorspaces it lists, next to the other HDMI properties.
Signed-off-by: Jan Claußen <jan.claussen10@web.de>
---
drivers/gpu/drm/drm_connector.c | 9 +++++++++
include/drm/drm_connector.h | 7 +++++++
2 files changed, 16 insertions(+)
diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
index 66f53e155342..eea27bb6557c 100644
--- a/drivers/gpu/drm/drm_connector.c
+++ b/drivers/gpu/drm/drm_connector.c
@@ -672,6 +672,15 @@ int drmm_connector_hdmi_init(struct drm_device *dev,
/* TODO: remove after conversion to new drmm_connector_hdmi_init() */
connector->max_bpc = hdmi_funcs->max_bpc;
+ if (hdmi_funcs->supported_colorspaces) {
+ ret = drm_mode_create_hdmi_colorspace_property(connector,
+ hdmi_funcs->supported_colorspaces);
+ if (ret)
+ return ret;
+
+ drm_connector_attach_colorspace_property(connector);
+ }
+
if (hdmi_funcs->max_bpc > 8)
drm_connector_attach_hdr_output_metadata_property(connector);
diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
index 2ee7c59329aa..9d2d133463ba 100644
--- a/include/drm/drm_connector.h
+++ b/include/drm/drm_connector.h
@@ -1521,6 +1521,13 @@ struct drm_connector_hdmi_funcs {
*/
unsigned long supported_formats;
+ /**
+ * @supported_colorspaces:
+ *
+ * Bitmask of &enum drm_colorspace listing supported color spaces.
+ */
+ unsigned long supported_colorspaces;
+
/**
* @max_bpc: Maximum bits per char the HDMI connector supports.
*/
--
2.56.0
^ permalink raw reply related [flat|nested] 15+ messages in thread* [PATCH v3 4/6] drm/bridge-connector: Pass supported colorspaces to the HDMI helpers
2026-10-18 12:30 ` Jan Claußen
` (3 preceding siblings ...)
(?)
@ 2026-10-18 12:30 ` Jan Claußen
-1 siblings, 0 replies; 15+ messages in thread
From: Jan Claußen @ 2026-10-18 12:30 UTC (permalink / raw)
To: Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
Jonas Karlman, Jernej Skrabec, Luca Ceresoli, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter
Cc: Jan Claußen, Javier Martinez Canillas, dri-devel,
linux-kernel
Add a supported_colorspaces field to struct drm_bridge so HDMI bridges
can declare the colorimetries they support, and pass it on to
drmm_connector_hdmi_init() so the colorspace property gets created.
Suggested-by: Javier Martinez Canillas <javierm@redhat.com>
Signed-off-by: Jan Claußen <jan.claussen10@web.de>
---
drivers/gpu/drm/display/drm_bridge_connector.c | 4 ++++
include/drm/drm_bridge.h | 7 +++++++
2 files changed, 11 insertions(+)
diff --git a/drivers/gpu/drm/display/drm_bridge_connector.c b/drivers/gpu/drm/display/drm_bridge_connector.c
index 81f3e26f6fdf..40f50304c46f 100644
--- a/drivers/gpu/drm/display/drm_bridge_connector.c
+++ b/drivers/gpu/drm/display/drm_bridge_connector.c
@@ -1042,6 +1042,10 @@ struct drm_connector *drm_bridge_connector_init(struct drm_device *drm,
bridge_connector->hdmi_funcs.supported_formats =
bridge_connector->bridge_hdmi->supported_formats;
+ if (bridge_connector->bridge_hdmi->supported_colorspaces)
+ bridge_connector->hdmi_funcs.supported_colorspaces =
+ bridge_connector->bridge_hdmi->supported_colorspaces;
+
if (!connector->ycbcr_420_allowed)
bridge_connector->hdmi_funcs.supported_formats &=
~BIT(DRM_OUTPUT_COLOR_FORMAT_YCBCR420);
diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h
index 1981d24a700d..b46d34040024 100644
--- a/include/drm/drm_bridge.h
+++ b/include/drm/drm_bridge.h
@@ -1129,6 +1129,13 @@ struct drm_bridge {
*/
unsigned int supported_formats;
+ /**
+ * @supported_colorspaces: Bitmask of &enum drm_colorspace listing
+ * supported color spaces. This is only relevant if @DRM_BRIDGE_OP_HDMI
+ * is set.
+ */
+ unsigned int supported_colorspaces;
+
/**
* @max_tmds_char_rate: Maximum TMDS character rate, in Hz, the HDMI
* bridge supports. A value of 0 means the core should use the default
--
2.56.0
^ permalink raw reply related [flat|nested] 15+ messages in thread* [PATCH v3 5/6] drm/bridge: dw-hdmi-qp: Forward supported colorspaces from platform data
2026-10-18 12:30 ` Jan Claußen
@ 2026-10-18 12:30 ` Jan Claußen
-1 siblings, 0 replies; 15+ messages in thread
From: Jan Claußen @ 2026-10-18 12:30 UTC (permalink / raw)
To: Sandy Huang, Heiko Stübner, Andy Yan, Andrzej Hajda,
Neil Armstrong, Robert Foss, Laurent Pinchart, Jonas Karlman,
Jernej Skrabec, Luca Ceresoli, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter
Cc: Jan Claußen, dri-devel, linux-rockchip, linux-kernel
Let platform glue drivers declare the supported colorspaces, the same
way they already declare supported output formats and max bpc.
Signed-off-by: Jan Claußen <jan.claussen10@web.de>
---
drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c | 3 +++
include/drm/bridge/dw_hdmi_qp.h | 2 ++
2 files changed, 5 insertions(+)
diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c
index c9568aea98dc..6017c44b03d4 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c
@@ -1129,6 +1129,9 @@ struct dw_hdmi_qp *dw_hdmi_qp_bind(struct platform_device *pdev,
if (plat_data->supported_formats)
hdmi->bridge.supported_formats = plat_data->supported_formats;
+ if (plat_data->supported_colorspaces)
+ hdmi->bridge.supported_colorspaces = plat_data->supported_colorspaces;
+
if (plat_data->max_bpc)
hdmi->bridge.max_bpc = plat_data->max_bpc;
diff --git a/include/drm/bridge/dw_hdmi_qp.h b/include/drm/bridge/dw_hdmi_qp.h
index 6ea9c561cfef..a15af81989cc 100644
--- a/include/drm/bridge/dw_hdmi_qp.h
+++ b/include/drm/bridge/dw_hdmi_qp.h
@@ -27,6 +27,8 @@ struct dw_hdmi_qp_plat_data {
unsigned long ref_clk_rate;
/* Supported output formats: bitmask of @drm_output_color_format */
unsigned int supported_formats;
+ /* Supported colorspaces: bitmask of &enum drm_colorspace */
+ unsigned int supported_colorspaces;
/* Maximum bits per color channel: 8, 10 or 12 */
unsigned int max_bpc;
};
--
2.56.0
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
^ permalink raw reply related [flat|nested] 15+ messages in thread* [PATCH v3 5/6] drm/bridge: dw-hdmi-qp: Forward supported colorspaces from platform data
@ 2026-10-18 12:30 ` Jan Claußen
0 siblings, 0 replies; 15+ messages in thread
From: Jan Claußen @ 2026-10-18 12:30 UTC (permalink / raw)
To: Sandy Huang, Heiko Stübner, Andy Yan, Andrzej Hajda,
Neil Armstrong, Robert Foss, Laurent Pinchart, Jonas Karlman,
Jernej Skrabec, Luca Ceresoli, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter
Cc: Jan Claußen, dri-devel, linux-rockchip, linux-kernel
Let platform glue drivers declare the supported colorspaces, the same
way they already declare supported output formats and max bpc.
Signed-off-by: Jan Claußen <jan.claussen10@web.de>
---
drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c | 3 +++
include/drm/bridge/dw_hdmi_qp.h | 2 ++
2 files changed, 5 insertions(+)
diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c
index c9568aea98dc..6017c44b03d4 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c
@@ -1129,6 +1129,9 @@ struct dw_hdmi_qp *dw_hdmi_qp_bind(struct platform_device *pdev,
if (plat_data->supported_formats)
hdmi->bridge.supported_formats = plat_data->supported_formats;
+ if (plat_data->supported_colorspaces)
+ hdmi->bridge.supported_colorspaces = plat_data->supported_colorspaces;
+
if (plat_data->max_bpc)
hdmi->bridge.max_bpc = plat_data->max_bpc;
diff --git a/include/drm/bridge/dw_hdmi_qp.h b/include/drm/bridge/dw_hdmi_qp.h
index 6ea9c561cfef..a15af81989cc 100644
--- a/include/drm/bridge/dw_hdmi_qp.h
+++ b/include/drm/bridge/dw_hdmi_qp.h
@@ -27,6 +27,8 @@ struct dw_hdmi_qp_plat_data {
unsigned long ref_clk_rate;
/* Supported output formats: bitmask of @drm_output_color_format */
unsigned int supported_formats;
+ /* Supported colorspaces: bitmask of &enum drm_colorspace */
+ unsigned int supported_colorspaces;
/* Maximum bits per color channel: 8, 10 or 12 */
unsigned int max_bpc;
};
--
2.56.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v3 6/6] drm/rockchip: dw_hdmi_qp: Advertise BT.709 and BT.2020 colorimetries
2026-10-18 12:30 ` Jan Claußen
@ 2026-10-18 12:30 ` Jan Claußen
-1 siblings, 0 replies; 15+ messages in thread
From: Jan Claußen @ 2026-10-18 12:30 UTC (permalink / raw)
To: Sandy Huang, Heiko Stübner, Andy Yan, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter
Cc: Jan Claußen, dri-devel, linux-rockchip, linux-arm-kernel,
linux-kernel
Expose BT.2020 RGB and YCC colorimetry so userspace can enable HDR
output. Also explicitly expose BT.709 YCC as it is listed in the
Rockchip RK3588 TRM V1.0-Part2 20220309 data sheet.
Tested on a Radxa Rock 5B (RK3588) with an LG OLED55B87LC in KDE
Plasma 6.7.5: enabling HDR switches the colorspace to BT.2020, and
disabling it restores the default.
Signed-off-by: Jan Claußen <jan.claussen10@web.de>
---
Not sure if BT.709 needs to be explicitly exposed here, but it is mentioned in the data sheet.
Might be covered by DRM_MODE_COLORIMETRY_DEFAULT though.
BT.709/BT.2020 YCC are untested.
drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c
index 9c4cf68d79d5..dbb87dfd000c 100644
--- a/drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c
+++ b/drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c
@@ -605,6 +605,10 @@ static int dw_hdmi_qp_rockchip_bind(struct device *dev, struct device *master,
BIT(DRM_OUTPUT_COLOR_FORMAT_YCBCR444) |
BIT(DRM_OUTPUT_COLOR_FORMAT_YCBCR422);
+ plat_data.supported_colorspaces = BIT(DRM_MODE_COLORIMETRY_BT709_YCC) |
+ BIT(DRM_MODE_COLORIMETRY_BT2020_RGB) |
+ BIT(DRM_MODE_COLORIMETRY_BT2020_YCC);
+
encoder = &hdmi->encoder.encoder;
encoder->possible_crtcs = drm_of_find_possible_crtcs(drm, dev->of_node);
--
2.56.0
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v3 6/6] drm/rockchip: dw_hdmi_qp: Advertise BT.709 and BT.2020 colorimetries
@ 2026-10-18 12:30 ` Jan Claußen
0 siblings, 0 replies; 15+ messages in thread
From: Jan Claußen @ 2026-10-18 12:30 UTC (permalink / raw)
To: Sandy Huang, Heiko Stübner, Andy Yan, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter
Cc: Jan Claußen, dri-devel, linux-rockchip, linux-arm-kernel,
linux-kernel
Expose BT.2020 RGB and YCC colorimetry so userspace can enable HDR
output. Also explicitly expose BT.709 YCC as it is listed in the
Rockchip RK3588 TRM V1.0-Part2 20220309 data sheet.
Tested on a Radxa Rock 5B (RK3588) with an LG OLED55B87LC in KDE
Plasma 6.7.5: enabling HDR switches the colorspace to BT.2020, and
disabling it restores the default.
Signed-off-by: Jan Claußen <jan.claussen10@web.de>
---
Not sure if BT.709 needs to be explicitly exposed here, but it is mentioned in the data sheet.
Might be covered by DRM_MODE_COLORIMETRY_DEFAULT though.
BT.709/BT.2020 YCC are untested.
drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c
index 9c4cf68d79d5..dbb87dfd000c 100644
--- a/drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c
+++ b/drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c
@@ -605,6 +605,10 @@ static int dw_hdmi_qp_rockchip_bind(struct device *dev, struct device *master,
BIT(DRM_OUTPUT_COLOR_FORMAT_YCBCR444) |
BIT(DRM_OUTPUT_COLOR_FORMAT_YCBCR422);
+ plat_data.supported_colorspaces = BIT(DRM_MODE_COLORIMETRY_BT709_YCC) |
+ BIT(DRM_MODE_COLORIMETRY_BT2020_RGB) |
+ BIT(DRM_MODE_COLORIMETRY_BT2020_YCC);
+
encoder = &hdmi->encoder.encoder;
encoder->possible_crtcs = drm_of_find_possible_crtcs(drm, dev->of_node);
--
2.56.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH v3 6/6] drm/rockchip: dw_hdmi_qp: Advertise BT.709 and BT.2020 colorimetries
2026-10-18 12:30 ` Jan Claußen
(?)
@ 2026-10-18 12:41 ` sashiko-bot
-1 siblings, 0 replies; 15+ messages in thread
From: sashiko-bot @ 2026-10-18 12:41 UTC (permalink / raw)
To: Jan Claußen; +Cc: dri-devel
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] drm/rockchip: missing s->color_space update in dw_hdmi_qp atomic_check()
--
commit 43d044058730a347faa3ac82bf806a1a71fe7cd1
Author: Jan Claußen <jan.claussen10@web.de>
drm/rockchip: dw_hdmi_qp: Advertise BT.709 and BT.2020 colorimetries
This commit populates plat_data.supported_colorspaces in
dw_hdmi_qp_rockchip_bind() to advertise BT.709 YCC, BT.2020 RGB, and
BT.2020 YCC colorimetries on the Rockchip DW HDMI QP connector.
> diff --git a/drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c
> index 9c4cf68d79d50..dbb87dfd000c2 100644
> --- a/drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c
> +++ b/drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c
> @@ -605,6 +605,10 @@ static int dw_hdmi_qp_rockchip_bind(struct device *dev, struct device *master,
> BIT(DRM_OUTPUT_COLOR_FORMAT_YCBCR444) |
> BIT(DRM_OUTPUT_COLOR_FORMAT_YCBCR422);
>
> + plat_data.supported_colorspaces = BIT(DRM_MODE_COLORIMETRY_BT709_YCC) |
> + BIT(DRM_MODE_COLORIMETRY_BT2020_RGB) |
> + BIT(DRM_MODE_COLORIMETRY_BT2020_YCC);
> +
[Severity: Medium]
When userspace selects DRM_MODE_COLORIMETRY_BT2020_YCC or
DRM_MODE_COLORIMETRY_BT2020_RGB while the HDMI output format is YCbCr
(DRM_OUTPUT_COLOR_FORMAT_YCBCR444 or DRM_OUTPUT_COLOR_FORMAT_YCBCR422),
should dw_hdmi_qp_rockchip_encoder_atomic_check() also update s->color_space
from conn_state->colorspace?
On RK3588 and RK3576, RGB-to-YCbCr conversion is performed by VOP2 when the
bridge requests a YUV bus format (such as MEDIA_BUS_FMT_YUV8_1X24,
MEDIA_BUS_FMT_YUV10_1X30, or MEDIA_BUS_FMT_UYVY8_1X16). Both
vop2_setup_csc_mode() and vop2_bgcolor_setup() in
drivers/gpu/drm/rockchip/rockchip_drm_vop2.c rely on vcstate->color_space to
choose between CSC_BT2020L (for V4L2_COLORSPACE_BT2020) and CSC_BT709L:
drivers/gpu/drm/rockchip/rockchip_drm_vop2.c:vop2_setup_csc_mode() {
int output_csc = vcstate->color_space;
...
} else if (!is_input_yuv && is_output_yuv) {
y2r_en = false;
r2y_en = true;
csc_mode = vop2_convert_csc_mode(output_csc);
}
}
drivers/gpu/drm/rockchip/rockchip_drm_vop2.c:vop2_bgcolor_setup() {
if (new_vcstate->yuv_overlay) {
vop2_rgb16_to_yuv16(new_vcstate->color_space,
DRM_ARGB64_GETR(bgcolor),
DRM_ARGB64_GETG(bgcolor),
DRM_ARGB64_GETB(bgcolor),
&y, &cb, &cr);
}
Currently, dw_hdmi_qp_rockchip_encoder_atomic_check() never sets
s->color_space, and its early return check only compares tmds_char_rate,
output_bpc, and bus_format:
drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c:dw_hdmi_qp_rockchip_encoder_atomic_check() {
if (hdmi->tmds_char_rate == conn_state->hdmi.tmds_char_rate &&
s->output_bpc == conn_state->hdmi.output_bpc &&
s->bus_format == ingest_fmt)
return 0;
...
if (!ret) {
hdmi->tmds_char_rate = conn_state->hdmi.tmds_char_rate;
s->output_type = DRM_MODE_CONNECTOR_HDMIA;
s->output_bpc = conn_state->hdmi.output_bpc;
s->bus_format = ingest_fmt;
}
}
Without updating s->color_space, won't VOP2 leave vcstate->color_space at 0
(V4L2_COLORSPACE_DEFAULT) and convert RGB planes and the background color to
YCbCr using the Rec. 709 matrix (CSC_BT709L) while the HDMI AVI InfoFrame
signals BT.2020 colorimetry to the sink?
> encoder = &hdmi->encoder.encoder;
> encoder->possible_crtcs = drm_of_find_possible_crtcs(drm, dev->of_node);
>
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261018123037.19560-1-jan.claussen10@web.de?part=6
^ permalink raw reply [flat|nested] 15+ messages in thread* Re: [PATCH v3 6/6] drm/rockchip: dw_hdmi_qp: Advertise BT.709 and BT.2020 colorimetries
2026-10-18 12:30 ` Jan Claußen
@ 2026-10-19 3:19 ` Chaoyi Chen
-1 siblings, 0 replies; 15+ messages in thread
From: Chaoyi Chen @ 2026-10-19 3:19 UTC (permalink / raw)
To: Jan Claußen, Sandy Huang, Heiko Stübner, Andy Yan,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter
Cc: linux-rockchip, linux-arm-kernel, dri-devel, linux-kernel
Hi Jan,
On 10/18/2026 8:30 PM, Jan Claußen wrote:
> Expose BT.2020 RGB and YCC colorimetry so userspace can enable HDR
> output. Also explicitly expose BT.709 YCC as it is listed in the
> Rockchip RK3588 TRM V1.0-Part2 20220309 data sheet.
>
> Tested on a Radxa Rock 5B (RK3588) with an LG OLED55B87LC in KDE
> Plasma 6.7.5: enabling HDR switches the colorspace to BT.2020, and
> disabling it restores the default.
>
> Signed-off-by: Jan Claußen <jan.claussen10@web.de>
> ---
>
> Not sure if BT.709 needs to be explicitly exposed here, but it is mentioned in the data sheet.
> Might be covered by DRM_MODE_COLORIMETRY_DEFAULT though.
Cc: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
Hi Cristian, may be you would be interested in this series?
"DEFAULT" may refer to either BT.601 or BT.709. It should support the
following color spaces:
#define HDMI_COLORSPACE_CAPS_V1 (DRM_MODE_COLORIMETRY_DEFAULT | \
DRM_MODE_COLORIMETRY_SMPTE_170M_YCC | \
DRM_MODE_COLORIMETRY_BT709_YCC | \
DRM_MODE_COLORIMETRY_BT2020_RGB)
#define HDMI_COLORSPACE_CAPS_V2 (HDMI_COLORSPACE_CAPS_V1 | \
DRM_MODE_COLORIMETRY_DCI_P3_RGB_D65)
>
> BT.709/BT.2020 YCC are untested.
>
> drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c
> index 9c4cf68d79d5..dbb87dfd000c 100644
> --- a/drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c
> +++ b/drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c
> @@ -605,6 +605,10 @@ static int dw_hdmi_qp_rockchip_bind(struct device *dev, struct device *master,
> BIT(DRM_OUTPUT_COLOR_FORMAT_YCBCR444) |
> BIT(DRM_OUTPUT_COLOR_FORMAT_YCBCR422);
>
> + plat_data.supported_colorspaces = BIT(DRM_MODE_COLORIMETRY_BT709_YCC) |
> + BIT(DRM_MODE_COLORIMETRY_BT2020_RGB) |
> + BIT(DRM_MODE_COLORIMETRY_BT2020_YCC);
> +
> encoder = &hdmi->encoder.encoder;
> encoder->possible_crtcs = drm_of_find_possible_crtcs(drm, dev->of_node);
>
--
Best,
Chaoyi
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v3 6/6] drm/rockchip: dw_hdmi_qp: Advertise BT.709 and BT.2020 colorimetries
@ 2026-10-19 3:19 ` Chaoyi Chen
0 siblings, 0 replies; 15+ messages in thread
From: Chaoyi Chen @ 2026-10-19 3:19 UTC (permalink / raw)
To: Jan Claußen, Sandy Huang, Heiko Stübner, Andy Yan,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter
Cc: Cristian Ciocaltea, dri-devel, linux-rockchip, linux-arm-kernel,
linux-kernel
Hi Jan,
On 10/18/2026 8:30 PM, Jan Claußen wrote:
> Expose BT.2020 RGB and YCC colorimetry so userspace can enable HDR
> output. Also explicitly expose BT.709 YCC as it is listed in the
> Rockchip RK3588 TRM V1.0-Part2 20220309 data sheet.
>
> Tested on a Radxa Rock 5B (RK3588) with an LG OLED55B87LC in KDE
> Plasma 6.7.5: enabling HDR switches the colorspace to BT.2020, and
> disabling it restores the default.
>
> Signed-off-by: Jan Claußen <jan.claussen10@web.de>
> ---
>
> Not sure if BT.709 needs to be explicitly exposed here, but it is mentioned in the data sheet.
> Might be covered by DRM_MODE_COLORIMETRY_DEFAULT though.
Cc: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
Hi Cristian, may be you would be interested in this series?
"DEFAULT" may refer to either BT.601 or BT.709. It should support the
following color spaces:
#define HDMI_COLORSPACE_CAPS_V1 (DRM_MODE_COLORIMETRY_DEFAULT | \
DRM_MODE_COLORIMETRY_SMPTE_170M_YCC | \
DRM_MODE_COLORIMETRY_BT709_YCC | \
DRM_MODE_COLORIMETRY_BT2020_RGB)
#define HDMI_COLORSPACE_CAPS_V2 (HDMI_COLORSPACE_CAPS_V1 | \
DRM_MODE_COLORIMETRY_DCI_P3_RGB_D65)
>
> BT.709/BT.2020 YCC are untested.
>
> drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c
> index 9c4cf68d79d5..dbb87dfd000c 100644
> --- a/drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c
> +++ b/drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c
> @@ -605,6 +605,10 @@ static int dw_hdmi_qp_rockchip_bind(struct device *dev, struct device *master,
> BIT(DRM_OUTPUT_COLOR_FORMAT_YCBCR444) |
> BIT(DRM_OUTPUT_COLOR_FORMAT_YCBCR422);
>
> + plat_data.supported_colorspaces = BIT(DRM_MODE_COLORIMETRY_BT709_YCC) |
> + BIT(DRM_MODE_COLORIMETRY_BT2020_RGB) |
> + BIT(DRM_MODE_COLORIMETRY_BT2020_YCC);
> +
> encoder = &hdmi->encoder.encoder;
> encoder->possible_crtcs = drm_of_find_possible_crtcs(drm, dev->of_node);
>
--
Best,
Chaoyi
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v3 6/6] drm/rockchip: dw_hdmi_qp: Advertise BT.709 and BT.2020 colorimetries
2026-10-19 3:19 ` Chaoyi Chen
@ 2026-10-19 10:40 ` Cristian Ciocaltea
-1 siblings, 0 replies; 15+ messages in thread
From: Cristian Ciocaltea @ 2026-10-19 10:40 UTC (permalink / raw)
To: Chaoyi Chen, Jan Claußen, Sandy Huang, Heiko Stübner,
Andy Yan, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
David Airlie, Simona Vetter
Cc: dri-devel, linux-rockchip, linux-arm-kernel, linux-kernel
On 10/19/26 6:19 AM, Chaoyi Chen wrote:
> Hi Jan,
>
> On 10/18/2026 8:30 PM, Jan Claußen wrote:
>> Expose BT.2020 RGB and YCC colorimetry so userspace can enable HDR
>> output. Also explicitly expose BT.709 YCC as it is listed in the
>> Rockchip RK3588 TRM V1.0-Part2 20220309 data sheet.
>>
>> Tested on a Radxa Rock 5B (RK3588) with an LG OLED55B87LC in KDE
>> Plasma 6.7.5: enabling HDR switches the colorspace to BT.2020, and
>> disabling it restores the default.
>>
>> Signed-off-by: Jan Claußen <jan.claussen10@web.de>
>> ---
>>
>> Not sure if BT.709 needs to be explicitly exposed here, but it is mentioned in the data sheet.
>> Might be covered by DRM_MODE_COLORIMETRY_DEFAULT though.
>
> Cc: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
>
> Hi Cristian, may be you would be interested in this series?
Hi Chaoyi, I already planned to check this out soon. Please note there's a newer
revision of the series, so I think it's best to move further discussions there.
Regards,
Cristian
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v3 6/6] drm/rockchip: dw_hdmi_qp: Advertise BT.709 and BT.2020 colorimetries
@ 2026-10-19 10:40 ` Cristian Ciocaltea
0 siblings, 0 replies; 15+ messages in thread
From: Cristian Ciocaltea @ 2026-10-19 10:40 UTC (permalink / raw)
To: Chaoyi Chen, Jan Claußen, Sandy Huang, Heiko Stübner,
Andy Yan, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
David Airlie, Simona Vetter
Cc: dri-devel, linux-rockchip, linux-arm-kernel, linux-kernel
On 10/19/26 6:19 AM, Chaoyi Chen wrote:
> Hi Jan,
>
> On 10/18/2026 8:30 PM, Jan Claußen wrote:
>> Expose BT.2020 RGB and YCC colorimetry so userspace can enable HDR
>> output. Also explicitly expose BT.709 YCC as it is listed in the
>> Rockchip RK3588 TRM V1.0-Part2 20220309 data sheet.
>>
>> Tested on a Radxa Rock 5B (RK3588) with an LG OLED55B87LC in KDE
>> Plasma 6.7.5: enabling HDR switches the colorspace to BT.2020, and
>> disabling it restores the default.
>>
>> Signed-off-by: Jan Claußen <jan.claussen10@web.de>
>> ---
>>
>> Not sure if BT.709 needs to be explicitly exposed here, but it is mentioned in the data sheet.
>> Might be covered by DRM_MODE_COLORIMETRY_DEFAULT though.
>
> Cc: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
>
> Hi Cristian, may be you would be interested in this series?
Hi Chaoyi, I already planned to check this out soon. Please note there's a newer
revision of the series, so I think it's best to move further discussions there.
Regards,
Cristian
^ permalink raw reply [flat|nested] 15+ messages in thread