All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v5 0/8] drm: Add colorspace property support to the HDMI helpers
@ 2026-11-21 13:10 ` Jan Claußen
  0 siblings, 0 replies; 15+ messages in thread
From: Jan Claußen @ 2026-11-21 13:10 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.
                                                                            
Changes in v5:
- Convert VOP2 from V4L2 colorspace values to enum drm_colorspace, so the
  HDMI glue doesn't need a V4L2 translation (Cristian)
- dw_hdmi_qp: Pass conn_state->colorspace directly and set it before the
  early return, so a colorspace change alone is applied
                                                                            
Changes in v4:
- Set the VOP2 color space from the connector colorspace, so YCbCr output
  is converted with the matching matrix (Sashiko)
                                                                            
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
                                                                            
v4: https://lore.kernel.org/all/20261018143135.5745-1-jan.claussen10@web.de/
v3: https://lore.kernel.org/all/20261018123037.19560-1-jan.claussen10@web.de
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 (8):
  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: vop2: Select the CSC matrix from the DRM colorimetry
  drm/rockchip: dw_hdmi_qp: Set the VOP2 color space from the connector
  drm/rockchip: dw_hdmi_qp: Advertise BT.709 and BT.2020 colorimetries

 drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c  |  3 ++
 .../gpu/drm/display/drm_bridge_connector.c    |  4 ++
 .../gpu/drm/display/drm_hdmi_state_helper.c   |  3 +-
 drivers/gpu/drm/drm_connector.c               | 17 +++++++--
 .../gpu/drm/rockchip/dw-mipi-dsi2-rockchip.c  |  3 --
 drivers/gpu/drm/rockchip/dw_dp-rockchip.c     |  2 -
 .../gpu/drm/rockchip/dw_hdmi_qp-rockchip.c    |  6 +++
 drivers/gpu/drm/rockchip/rockchip_drm_drv.h   |  2 +-
 drivers/gpu/drm/rockchip/rockchip_drm_vop2.c  | 37 +++++++------------
 include/drm/bridge/dw_hdmi_qp.h               |  2 +
 include/drm/drm_bridge.h                      |  7 ++++
 include/drm/drm_connector.h                   |  7 ++++
 12 files changed, 59 insertions(+), 34 deletions(-)

-- 
2.56.0



^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH v5 0/8] drm: Add colorspace property support to the HDMI helpers
@ 2026-11-21 13:10 ` Jan Claußen
  0 siblings, 0 replies; 15+ messages in thread
From: Jan Claußen @ 2026-11-21 13:10 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.
                                                                            
Changes in v5:
- Convert VOP2 from V4L2 colorspace values to enum drm_colorspace, so the
  HDMI glue doesn't need a V4L2 translation (Cristian)
- dw_hdmi_qp: Pass conn_state->colorspace directly and set it before the
  early return, so a colorspace change alone is applied
                                                                            
Changes in v4:
- Set the VOP2 color space from the connector colorspace, so YCbCr output
  is converted with the matching matrix (Sashiko)
                                                                            
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
                                                                            
v4: https://lore.kernel.org/all/20261018143135.5745-1-jan.claussen10@web.de/
v3: https://lore.kernel.org/all/20261018123037.19560-1-jan.claussen10@web.de
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 (8):
  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: vop2: Select the CSC matrix from the DRM colorimetry
  drm/rockchip: dw_hdmi_qp: Set the VOP2 color space from the connector
  drm/rockchip: dw_hdmi_qp: Advertise BT.709 and BT.2020 colorimetries

 drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c  |  3 ++
 .../gpu/drm/display/drm_bridge_connector.c    |  4 ++
 .../gpu/drm/display/drm_hdmi_state_helper.c   |  3 +-
 drivers/gpu/drm/drm_connector.c               | 17 +++++++--
 .../gpu/drm/rockchip/dw-mipi-dsi2-rockchip.c  |  3 --
 drivers/gpu/drm/rockchip/dw_dp-rockchip.c     |  2 -
 .../gpu/drm/rockchip/dw_hdmi_qp-rockchip.c    |  6 +++
 drivers/gpu/drm/rockchip/rockchip_drm_drv.h   |  2 +-
 drivers/gpu/drm/rockchip/rockchip_drm_vop2.c  | 37 +++++++------------
 include/drm/bridge/dw_hdmi_qp.h               |  2 +
 include/drm/drm_bridge.h                      |  7 ++++
 include/drm/drm_connector.h                   |  7 ++++
 12 files changed, 59 insertions(+), 34 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 v5 1/8] drm/connector: Fix typo in colorspace error messages
  2026-11-21 13:10 ` Jan Claußen
  (?)
@ 2026-11-21 13:10 ` Jan Claußen
  -1 siblings, 0 replies; 15+ messages in thread
From: Jan Claußen @ 2026-11-21 13:10 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 v5 2/8] drm/display: hdmi-state-helper: Force modeset on colorspace change
  2026-11-21 13:10 ` Jan Claußen
  (?)
  (?)
@ 2026-11-21 13:10 ` Jan Claußen
  -1 siblings, 0 replies; 15+ messages in thread
From: Jan Claußen @ 2026-11-21 13:10 UTC (permalink / raw)
  To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter, Dmitry Baryshkov, Daniel Stone, Cristian Ciocaltea,
	Nicolas Frattaroli, John Harrison
  Cc: Jan Claußen, 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 v5 3/8] drm/connector: hdmi: Create the colorspace property
  2026-11-21 13:10 ` Jan Claußen
                   ` (2 preceding siblings ...)
  (?)
@ 2026-11-21 13:10 ` Jan Claußen
  -1 siblings, 0 replies; 15+ messages in thread
From: Jan Claußen @ 2026-11-21 13:10 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 v5 4/8] drm/bridge-connector: Pass supported colorspaces to the HDMI helpers
  2026-11-21 13:10 ` Jan Claußen
                   ` (3 preceding siblings ...)
  (?)
@ 2026-11-21 13:10 ` Jan Claußen
  -1 siblings, 0 replies; 15+ messages in thread
From: Jan Claußen @ 2026-11-21 13:10 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 v5 5/8] drm/bridge: dw-hdmi-qp: Forward supported colorspaces from platform data
  2026-11-21 13:10 ` Jan Claußen
@ 2026-11-21 13:10   ` Jan Claußen
  -1 siblings, 0 replies; 15+ messages in thread
From: Jan Claußen @ 2026-11-21 13:10 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 b268c9376087..81180e9e8d94 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c
@@ -1170,6 +1170,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 ad33f9cafdeb..c336bd40c9cb 100644
--- a/include/drm/bridge/dw_hdmi_qp.h
+++ b/include/drm/bridge/dw_hdmi_qp.h
@@ -28,6 +28,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 v5 5/8] drm/bridge: dw-hdmi-qp: Forward supported colorspaces from platform data
@ 2026-11-21 13:10   ` Jan Claußen
  0 siblings, 0 replies; 15+ messages in thread
From: Jan Claußen @ 2026-11-21 13:10 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 b268c9376087..81180e9e8d94 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c
@@ -1170,6 +1170,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 ad33f9cafdeb..c336bd40c9cb 100644
--- a/include/drm/bridge/dw_hdmi_qp.h
+++ b/include/drm/bridge/dw_hdmi_qp.h
@@ -28,6 +28,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 v5 6/8] drm/rockchip: vop2: Select the CSC matrix from the DRM colorimetry
  2026-11-21 13:10 ` Jan Claußen
@ 2026-11-21 13:11   ` Jan Claußen
  -1 siblings, 0 replies; 15+ messages in thread
From: Jan Claußen @ 2026-11-21 13:11 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

The color_space field in struct rockchip_crtc_state holds V4L2 colorspace
values, a leftover from the vendor kernel. The DP and DSI2 encoders only
ever set V4L2_COLORSPACE_DEFAULT, so VOP2 always ends up with BT.709.
An HDMI encoder that wants to honour the connector colorspace property
would have to translate DRM colorimetry into V4L2 values, only for VOP2
to map them back to a CSC matrix.

Store the connector's enum drm_colorspace in the CRTC state instead and
pick the CSC matrix from DRM_MODE_COLORIMETRY_* directly. Since
DRM_MODE_COLORIMETRY_DEFAULT is 0, the zero-initialised state keeps the
current BT.709 behaviour and the encoder assignments can go.

No functional change.

Signed-off-by: Jan Claußen <jan.claussen10@web.de>
---
 .../gpu/drm/rockchip/dw-mipi-dsi2-rockchip.c  |  3 --
 drivers/gpu/drm/rockchip/dw_dp-rockchip.c     |  2 -
 drivers/gpu/drm/rockchip/rockchip_drm_drv.h   |  2 +-
 drivers/gpu/drm/rockchip/rockchip_drm_vop2.c  | 37 +++++++------------
 4 files changed, 15 insertions(+), 29 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi2-rockchip.c b/drivers/gpu/drm/rockchip/dw-mipi-dsi2-rockchip.c
index 6db88665060d..87bab11d6f8a 100644
--- a/drivers/gpu/drm/rockchip/dw-mipi-dsi2-rockchip.c
+++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi2-rockchip.c
@@ -23,8 +23,6 @@
 #include <drm/drm_mipi_dsi.h>
 #include <drm/drm_of.h>
 
-#include <uapi/linux/videodev2.h>
-
 #include "rockchip_drm_drv.h"
 
 #define PSEC_PER_SEC			1000000000000LL
@@ -268,7 +266,6 @@ dw_mipi_dsi2_encoder_atomic_check(struct drm_encoder *encoder,
 
 	s->output_type = DRM_MODE_CONNECTOR_DSI;
 	s->bus_flags = info->bus_flags;
-	s->color_space = V4L2_COLORSPACE_DEFAULT;
 
 	return 0;
 }
diff --git a/drivers/gpu/drm/rockchip/dw_dp-rockchip.c b/drivers/gpu/drm/rockchip/dw_dp-rockchip.c
index b23efb153c9e..412796435af6 100644
--- a/drivers/gpu/drm/rockchip/dw_dp-rockchip.c
+++ b/drivers/gpu/drm/rockchip/dw_dp-rockchip.c
@@ -10,7 +10,6 @@
 #include <linux/media-bus-format.h>
 #include <linux/of_device.h>
 #include <linux/platform_device.h>
-#include <linux/videodev2.h>
 
 #include <drm/bridge/dw_dp.h>
 #include <drm/drm_atomic_helper.h>
@@ -62,7 +61,6 @@ static int dw_dp_encoder_atomic_check(struct drm_encoder *encoder,
 	s->output_type = DRM_MODE_CONNECTOR_DisplayPort;
 	s->bus_format = bus_format;
 	s->bus_flags = di->bus_flags;
-	s->color_space = V4L2_COLORSPACE_DEFAULT;
 
 	return 0;
 }
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.h b/drivers/gpu/drm/rockchip/rockchip_drm_drv.h
index 4705dc6b8bd7..9c0d744ed95b 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.h
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.h
@@ -56,7 +56,7 @@ struct rockchip_crtc_state {
 	bool yuv_overlay;
 	u32 bus_format;
 	u32 bus_flags;
-	int color_space;
+	enum drm_colorspace colorspace;
 };
 #define to_rockchip_crtc_state(s) \
 		container_of(s, struct rockchip_crtc_state, base)
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
index bfb384142568..41035bf27491 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
@@ -33,8 +33,6 @@
 #include <drm/drm_probe_helper.h>
 #include <drm/drm_vblank.h>
 
-#include <uapi/linux/videodev2.h>
-
 #include "rockchip_drm_gem.h"
 #include "rockchip_drm_vop2.h"
 #include "rockchip_rgb.h"
@@ -647,20 +645,13 @@ static void vop2_setup_scale(struct vop2 *vop2, const struct vop2_win *win,
 	}
 }
 
-static int vop2_convert_csc_mode(int csc_mode)
+static enum vop_csc_format
+vop2_convert_csc_mode(enum drm_colorspace colorspace)
 {
-	switch (csc_mode) {
-	case V4L2_COLORSPACE_SMPTE170M:
-	case V4L2_COLORSPACE_470_SYSTEM_M:
-	case V4L2_COLORSPACE_470_SYSTEM_BG:
-		return CSC_BT601L;
-	case V4L2_COLORSPACE_REC709:
-	case V4L2_COLORSPACE_SMPTE240M:
-	case V4L2_COLORSPACE_DEFAULT:
-		return CSC_BT709L;
-	case V4L2_COLORSPACE_JPEG:
-		return CSC_BT601F;
-	case V4L2_COLORSPACE_BT2020:
+	switch (colorspace) {
+	case DRM_MODE_COLORIMETRY_BT2020_RGB:
+	case DRM_MODE_COLORIMETRY_BT2020_YCC:
+	case DRM_MODE_COLORIMETRY_BT2020_CYCC:
 		return CSC_BT2020L;
 	default:
 		return CSC_BT709L;
@@ -707,8 +698,8 @@ static void vop2_setup_csc_mode(struct vop2_video_port *vp,
 	struct rockchip_crtc_state *vcstate = to_rockchip_crtc_state(vp->crtc.state);
 	int is_input_yuv = pstate->fb->format->is_yuv;
 	int is_output_yuv = is_yuv_output(vcstate->bus_format);
-	int input_csc = V4L2_COLORSPACE_DEFAULT;
-	int output_csc = vcstate->color_space;
+	enum drm_colorspace input_csc = DRM_MODE_COLORIMETRY_DEFAULT;
+	enum drm_colorspace output_csc = vcstate->colorspace;
 	bool r2y_en, y2r_en;
 	int csc_mode;
 
@@ -797,10 +788,10 @@ vop2_rgb2yuv_get_matrix(enum vop_csc_format csc)
 }
 
 /* Convert an RGB (16bpc) to YUV444 (16bpc). */
-static void vop2_rgb16_to_yuv16(int v4l2_cs, u16 r, u16 g, u16 b,
-				u16 *y, u16 *cb, u16 *cr)
+static void vop2_rgb16_to_yuv16(enum drm_colorspace colorspace,
+				u16 r, u16 g, u16 b, u16 *y, u16 *cb, u16 *cr)
 {
-	enum vop_csc_format csc = vop2_convert_csc_mode(v4l2_cs);
+	enum vop_csc_format csc = vop2_convert_csc_mode(colorspace);
 	const struct rgb2yuv_matrix *m = vop2_rgb2yuv_get_matrix(csc);
 	s64 rs = r, gs = g, bs = b;
 	s64 ys, cbs, crs;
@@ -1652,7 +1643,7 @@ static void vop2_bgcolor_setup(struct drm_crtc *crtc, bool force,
 	u32 val;
 
 	if (!force && old_crtc_state->background_color == bgcolor &&
-	    old_vcstate->color_space == new_vcstate->color_space)
+	    old_vcstate->colorspace == new_vcstate->colorspace)
 		return;
 
 	/*
@@ -1660,7 +1651,7 @@ static void vop2_bgcolor_setup(struct drm_crtc *crtc, bool force,
 	 * format when operating in YUV overlay mode, and RGB otherwise.
 	 */
 	if (new_vcstate->yuv_overlay) {
-		vop2_rgb16_to_yuv16(new_vcstate->color_space,
+		vop2_rgb16_to_yuv16(new_vcstate->colorspace,
 				    DRM_ARGB64_GETR(bgcolor),
 				    DRM_ARGB64_GETG(bgcolor),
 				    DRM_ARGB64_GETB(bgcolor),
@@ -2140,7 +2131,7 @@ static int vop2_crtc_state_dump(struct drm_crtc *crtc, struct seq_file *s)
 	seq_printf(s, "\tbus_format[%x]: %s\n", vcstate->bus_format,
 		   drm_get_bus_format_name(vcstate->bus_format));
 	seq_printf(s, "\toutput_mode[%x]", vcstate->output_mode);
-	seq_printf(s, " color_space[%d]\n", vcstate->color_space);
+	seq_printf(s, " colorspace[%d]\n", vcstate->colorspace);
 	seq_printf(s, "\tbackground color (10bpc): r=0x%x g=0x%x b=0x%x\n",
 		   DRM_ARGB64_GETR_BPCS(cstate->background_color, 10),
 		   DRM_ARGB64_GETG_BPCS(cstate->background_color, 10),
-- 
2.56.0


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH v5 6/8] drm/rockchip: vop2: Select the CSC matrix from the DRM colorimetry
@ 2026-11-21 13:11   ` Jan Claußen
  0 siblings, 0 replies; 15+ messages in thread
From: Jan Claußen @ 2026-11-21 13:11 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

The color_space field in struct rockchip_crtc_state holds V4L2 colorspace
values, a leftover from the vendor kernel. The DP and DSI2 encoders only
ever set V4L2_COLORSPACE_DEFAULT, so VOP2 always ends up with BT.709.
An HDMI encoder that wants to honour the connector colorspace property
would have to translate DRM colorimetry into V4L2 values, only for VOP2
to map them back to a CSC matrix.

Store the connector's enum drm_colorspace in the CRTC state instead and
pick the CSC matrix from DRM_MODE_COLORIMETRY_* directly. Since
DRM_MODE_COLORIMETRY_DEFAULT is 0, the zero-initialised state keeps the
current BT.709 behaviour and the encoder assignments can go.

No functional change.

Signed-off-by: Jan Claußen <jan.claussen10@web.de>
---
 .../gpu/drm/rockchip/dw-mipi-dsi2-rockchip.c  |  3 --
 drivers/gpu/drm/rockchip/dw_dp-rockchip.c     |  2 -
 drivers/gpu/drm/rockchip/rockchip_drm_drv.h   |  2 +-
 drivers/gpu/drm/rockchip/rockchip_drm_vop2.c  | 37 +++++++------------
 4 files changed, 15 insertions(+), 29 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi2-rockchip.c b/drivers/gpu/drm/rockchip/dw-mipi-dsi2-rockchip.c
index 6db88665060d..87bab11d6f8a 100644
--- a/drivers/gpu/drm/rockchip/dw-mipi-dsi2-rockchip.c
+++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi2-rockchip.c
@@ -23,8 +23,6 @@
 #include <drm/drm_mipi_dsi.h>
 #include <drm/drm_of.h>
 
-#include <uapi/linux/videodev2.h>
-
 #include "rockchip_drm_drv.h"
 
 #define PSEC_PER_SEC			1000000000000LL
@@ -268,7 +266,6 @@ dw_mipi_dsi2_encoder_atomic_check(struct drm_encoder *encoder,
 
 	s->output_type = DRM_MODE_CONNECTOR_DSI;
 	s->bus_flags = info->bus_flags;
-	s->color_space = V4L2_COLORSPACE_DEFAULT;
 
 	return 0;
 }
diff --git a/drivers/gpu/drm/rockchip/dw_dp-rockchip.c b/drivers/gpu/drm/rockchip/dw_dp-rockchip.c
index b23efb153c9e..412796435af6 100644
--- a/drivers/gpu/drm/rockchip/dw_dp-rockchip.c
+++ b/drivers/gpu/drm/rockchip/dw_dp-rockchip.c
@@ -10,7 +10,6 @@
 #include <linux/media-bus-format.h>
 #include <linux/of_device.h>
 #include <linux/platform_device.h>
-#include <linux/videodev2.h>
 
 #include <drm/bridge/dw_dp.h>
 #include <drm/drm_atomic_helper.h>
@@ -62,7 +61,6 @@ static int dw_dp_encoder_atomic_check(struct drm_encoder *encoder,
 	s->output_type = DRM_MODE_CONNECTOR_DisplayPort;
 	s->bus_format = bus_format;
 	s->bus_flags = di->bus_flags;
-	s->color_space = V4L2_COLORSPACE_DEFAULT;
 
 	return 0;
 }
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.h b/drivers/gpu/drm/rockchip/rockchip_drm_drv.h
index 4705dc6b8bd7..9c0d744ed95b 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.h
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.h
@@ -56,7 +56,7 @@ struct rockchip_crtc_state {
 	bool yuv_overlay;
 	u32 bus_format;
 	u32 bus_flags;
-	int color_space;
+	enum drm_colorspace colorspace;
 };
 #define to_rockchip_crtc_state(s) \
 		container_of(s, struct rockchip_crtc_state, base)
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
index bfb384142568..41035bf27491 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
@@ -33,8 +33,6 @@
 #include <drm/drm_probe_helper.h>
 #include <drm/drm_vblank.h>
 
-#include <uapi/linux/videodev2.h>
-
 #include "rockchip_drm_gem.h"
 #include "rockchip_drm_vop2.h"
 #include "rockchip_rgb.h"
@@ -647,20 +645,13 @@ static void vop2_setup_scale(struct vop2 *vop2, const struct vop2_win *win,
 	}
 }
 
-static int vop2_convert_csc_mode(int csc_mode)
+static enum vop_csc_format
+vop2_convert_csc_mode(enum drm_colorspace colorspace)
 {
-	switch (csc_mode) {
-	case V4L2_COLORSPACE_SMPTE170M:
-	case V4L2_COLORSPACE_470_SYSTEM_M:
-	case V4L2_COLORSPACE_470_SYSTEM_BG:
-		return CSC_BT601L;
-	case V4L2_COLORSPACE_REC709:
-	case V4L2_COLORSPACE_SMPTE240M:
-	case V4L2_COLORSPACE_DEFAULT:
-		return CSC_BT709L;
-	case V4L2_COLORSPACE_JPEG:
-		return CSC_BT601F;
-	case V4L2_COLORSPACE_BT2020:
+	switch (colorspace) {
+	case DRM_MODE_COLORIMETRY_BT2020_RGB:
+	case DRM_MODE_COLORIMETRY_BT2020_YCC:
+	case DRM_MODE_COLORIMETRY_BT2020_CYCC:
 		return CSC_BT2020L;
 	default:
 		return CSC_BT709L;
@@ -707,8 +698,8 @@ static void vop2_setup_csc_mode(struct vop2_video_port *vp,
 	struct rockchip_crtc_state *vcstate = to_rockchip_crtc_state(vp->crtc.state);
 	int is_input_yuv = pstate->fb->format->is_yuv;
 	int is_output_yuv = is_yuv_output(vcstate->bus_format);
-	int input_csc = V4L2_COLORSPACE_DEFAULT;
-	int output_csc = vcstate->color_space;
+	enum drm_colorspace input_csc = DRM_MODE_COLORIMETRY_DEFAULT;
+	enum drm_colorspace output_csc = vcstate->colorspace;
 	bool r2y_en, y2r_en;
 	int csc_mode;
 
@@ -797,10 +788,10 @@ vop2_rgb2yuv_get_matrix(enum vop_csc_format csc)
 }
 
 /* Convert an RGB (16bpc) to YUV444 (16bpc). */
-static void vop2_rgb16_to_yuv16(int v4l2_cs, u16 r, u16 g, u16 b,
-				u16 *y, u16 *cb, u16 *cr)
+static void vop2_rgb16_to_yuv16(enum drm_colorspace colorspace,
+				u16 r, u16 g, u16 b, u16 *y, u16 *cb, u16 *cr)
 {
-	enum vop_csc_format csc = vop2_convert_csc_mode(v4l2_cs);
+	enum vop_csc_format csc = vop2_convert_csc_mode(colorspace);
 	const struct rgb2yuv_matrix *m = vop2_rgb2yuv_get_matrix(csc);
 	s64 rs = r, gs = g, bs = b;
 	s64 ys, cbs, crs;
@@ -1652,7 +1643,7 @@ static void vop2_bgcolor_setup(struct drm_crtc *crtc, bool force,
 	u32 val;
 
 	if (!force && old_crtc_state->background_color == bgcolor &&
-	    old_vcstate->color_space == new_vcstate->color_space)
+	    old_vcstate->colorspace == new_vcstate->colorspace)
 		return;
 
 	/*
@@ -1660,7 +1651,7 @@ static void vop2_bgcolor_setup(struct drm_crtc *crtc, bool force,
 	 * format when operating in YUV overlay mode, and RGB otherwise.
 	 */
 	if (new_vcstate->yuv_overlay) {
-		vop2_rgb16_to_yuv16(new_vcstate->color_space,
+		vop2_rgb16_to_yuv16(new_vcstate->colorspace,
 				    DRM_ARGB64_GETR(bgcolor),
 				    DRM_ARGB64_GETG(bgcolor),
 				    DRM_ARGB64_GETB(bgcolor),
@@ -2140,7 +2131,7 @@ static int vop2_crtc_state_dump(struct drm_crtc *crtc, struct seq_file *s)
 	seq_printf(s, "\tbus_format[%x]: %s\n", vcstate->bus_format,
 		   drm_get_bus_format_name(vcstate->bus_format));
 	seq_printf(s, "\toutput_mode[%x]", vcstate->output_mode);
-	seq_printf(s, " color_space[%d]\n", vcstate->color_space);
+	seq_printf(s, " colorspace[%d]\n", vcstate->colorspace);
 	seq_printf(s, "\tbackground color (10bpc): r=0x%x g=0x%x b=0x%x\n",
 		   DRM_ARGB64_GETR_BPCS(cstate->background_color, 10),
 		   DRM_ARGB64_GETG_BPCS(cstate->background_color, 10),
-- 
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 v5 7/8] drm/rockchip: dw_hdmi_qp: Set the VOP2 color space from the connector
  2026-11-21 13:10 ` Jan Claußen
@ 2026-11-21 13:11   ` Jan Claußen
  -1 siblings, 0 replies; 15+ messages in thread
From: Jan Claußen @ 2026-11-21 13:11 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

VOP2 converts RGB to YCbCr using the matrix selected by the CRTC
state's colorspace, but the HDMI encoder never sets it, so VOP2
always converts with BT.709. Once the colorspace property can
signal BT.2020 colorimetry to the sink, a YCbCr output would be
encoded with BT.709 and decoded with BT.2020.

Pass the connector colorspace on to VOP2, and do so before the
early return so that a colorspace change alone is applied.

Signed-off-by: Jan Claußen <jan.claussen10@web.de>
---
 drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c
index f2a1ea8dfefa..24a28b5f4576 100644
--- a/drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c
+++ b/drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c
@@ -205,6 +205,8 @@ dw_hdmi_qp_rockchip_encoder_atomic_check(struct drm_encoder *encoder,
 	if (ingest_fmt < 0)
 		return -EINVAL;
 
+	s->colorspace = conn_state->colorspace;
+
 	if (hdmi->tmds_char_rate == conn_state->hdmi.tmds_char_rate &&
 	    s->output_bpc == conn_state->hdmi.output_bpc &&
 	    s->bus_format == ingest_fmt)
-- 
2.56.0


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH v5 7/8] drm/rockchip: dw_hdmi_qp: Set the VOP2 color space from the connector
@ 2026-11-21 13:11   ` Jan Claußen
  0 siblings, 0 replies; 15+ messages in thread
From: Jan Claußen @ 2026-11-21 13:11 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

VOP2 converts RGB to YCbCr using the matrix selected by the CRTC
state's colorspace, but the HDMI encoder never sets it, so VOP2
always converts with BT.709. Once the colorspace property can
signal BT.2020 colorimetry to the sink, a YCbCr output would be
encoded with BT.709 and decoded with BT.2020.

Pass the connector colorspace on to VOP2, and do so before the
early return so that a colorspace change alone is applied.

Signed-off-by: Jan Claußen <jan.claussen10@web.de>
---
 drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c
index f2a1ea8dfefa..24a28b5f4576 100644
--- a/drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c
+++ b/drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c
@@ -205,6 +205,8 @@ dw_hdmi_qp_rockchip_encoder_atomic_check(struct drm_encoder *encoder,
 	if (ingest_fmt < 0)
 		return -EINVAL;
 
+	s->colorspace = conn_state->colorspace;
+
 	if (hdmi->tmds_char_rate == conn_state->hdmi.tmds_char_rate &&
 	    s->output_bpc == conn_state->hdmi.output_bpc &&
 	    s->bus_format == ingest_fmt)
-- 
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 v5 8/8] drm/rockchip: dw_hdmi_qp: Advertise BT.709 and BT.2020 colorimetries
  2026-11-21 13:10 ` Jan Claußen
@ 2026-11-21 13:11   ` Jan Claußen
  -1 siblings, 0 replies; 15+ messages in thread
From: Jan Claußen @ 2026-11-21 13:11 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>
---
 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 24a28b5f4576..890791c5277d 100644
--- a/drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c
+++ b/drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c
@@ -644,6 +644,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

* [PATCH v5 8/8] drm/rockchip: dw_hdmi_qp: Advertise BT.709 and BT.2020 colorimetries
@ 2026-11-21 13:11   ` Jan Claußen
  0 siblings, 0 replies; 15+ messages in thread
From: Jan Claußen @ 2026-11-21 13:11 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>
---
 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 24a28b5f4576..890791c5277d 100644
--- a/drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c
+++ b/drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c
@@ -644,6 +644,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

* Re: [PATCH v5 6/8] drm/rockchip: vop2: Select the CSC matrix from the DRM colorimetry
  2026-11-21 13:11   ` Jan Claußen
  (?)
@ 2026-11-21 13:22   ` sashiko-bot
  -1 siblings, 0 replies; 15+ messages in thread
From: sashiko-bot @ 2026-11-21 13:22 UTC (permalink / raw)
  To: Jan Claußen; +Cc: dri-devel

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] drm/rockchip: vop2: dropped BT.601 mappings in
  vop2_convert_csc_mode()
--

commit 2d1b69aeefd3a8b09e750140ac04acf448f1e9ea
Author: Jan Claußen <jan.claussen10@web.de>

drm/rockchip: vop2: Select the CSC matrix from the DRM colorimetry

This commit replaces the V4L2 colorspace field in struct
rockchip_crtc_state with enum drm_colorspace and selects the VOP2 CSC
format directly from DRM_MODE_COLORIMETRY_* values.

> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
> index bfb3841425687..41035bf27491d 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c

[ ... ]

> @@ -647,20 +645,13 @@ static void vop2_setup_scale(struct vop2 *vop2, const struct vop2_win *win,
>  	}
>  }
>  
> -static int vop2_convert_csc_mode(int csc_mode)
> +static enum vop_csc_format
> +vop2_convert_csc_mode(enum drm_colorspace colorspace)
>  {
> -	switch (csc_mode) {
> -	case V4L2_COLORSPACE_SMPTE170M:
> -	case V4L2_COLORSPACE_470_SYSTEM_M:
> -	case V4L2_COLORSPACE_470_SYSTEM_BG:
> -		return CSC_BT601L;
> -	case V4L2_COLORSPACE_REC709:
> -	case V4L2_COLORSPACE_SMPTE240M:
> -	case V4L2_COLORSPACE_DEFAULT:
> -		return CSC_BT709L;
> -	case V4L2_COLORSPACE_JPEG:
> -		return CSC_BT601F;
> -	case V4L2_COLORSPACE_BT2020:
> +	switch (colorspace) {
> +	case DRM_MODE_COLORIMETRY_BT2020_RGB:
> +	case DRM_MODE_COLORIMETRY_BT2020_YCC:
> +	case DRM_MODE_COLORIMETRY_BT2020_CYCC:
>  		return CSC_BT2020L;
>  	default:
>  		return CSC_BT709L;

[Severity: Low]
Should vop2_convert_csc_mode() keep mappings for BT.601 colorimetries (such
as DRM_MODE_COLORIMETRY_SMPTE_170M_YCC and DRM_MODE_COLORIMETRY_BT601_YCC),
or should the unused BT.601 matrix tables be dropped if BT.601 is not
needed?

Dropping CSC_BT601L and CSC_BT601F here causes any BT.601 colorspace to
fall back to CSC_BT709L and leaves the CSC_BT601L and CSC_BT601F cases (and
rgb2yuv_bt601l / rgb2yuv_bt601f) in vop2_rgb2yuv_get_matrix() unreachable.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261121131126.3358-1-jan.claussen10@web.de?part=6

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2026-11-21 13:23 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-21 13:10 [PATCH v5 0/8] drm: Add colorspace property support to the HDMI helpers Jan Claußen
2026-11-21 13:10 ` Jan Claußen
2026-11-21 13:10 ` [PATCH v5 1/8] drm/connector: Fix typo in colorspace error messages Jan Claußen
2026-11-21 13:10 ` [PATCH v5 2/8] drm/display: hdmi-state-helper: Force modeset on colorspace change Jan Claußen
2026-11-21 13:10 ` [PATCH v5 3/8] drm/connector: hdmi: Create the colorspace property Jan Claußen
2026-11-21 13:10 ` [PATCH v5 4/8] drm/bridge-connector: Pass supported colorspaces to the HDMI helpers Jan Claußen
2026-11-21 13:10 ` [PATCH v5 5/8] drm/bridge: dw-hdmi-qp: Forward supported colorspaces from platform data Jan Claußen
2026-11-21 13:10   ` Jan Claußen
2026-11-21 13:11 ` [PATCH v5 6/8] drm/rockchip: vop2: Select the CSC matrix from the DRM colorimetry Jan Claußen
2026-11-21 13:11   ` Jan Claußen
2026-11-21 13:22   ` sashiko-bot
2026-11-21 13:11 ` [PATCH v5 7/8] drm/rockchip: dw_hdmi_qp: Set the VOP2 color space from the connector Jan Claußen
2026-11-21 13:11   ` Jan Claußen
2026-11-21 13:11 ` [PATCH v5 8/8] drm/rockchip: dw_hdmi_qp: Advertise BT.709 and BT.2020 colorimetries Jan Claußen
2026-11-21 13:11   ` Jan Claußen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.