[PATCH v4 6/7] drm/rockchip: dw_hdmi_qp: Set the VOP2 color space from the connector

Cristian Ciocaltea cristian.ciocaltea at collabora.com
Tue Nov 10 11:05:30 PST 2026


Hi Jan,

On 10/18/26 5:31 PM, Jan Claußen wrote:
> VOP2 converts RGB to YCbCr using the matrix selected by the CRTC
> state's color_space, 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.
> 
> Derive color_space from the connector colorspace before the early
> return, so that a colorspace change alone is applied.
> 
> Signed-off-by: Jan Claußen <jan.claussen10 at web.de>
> ---
>  drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c | 16 ++++++++++++++++
>  1 file changed, 16 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..10c5b6d6406e 100644
> --- a/drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c
> +++ b/drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c
> @@ -17,6 +17,7 @@
>  #include <linux/phy/phy.h>
>  #include <linux/phy/phy-hdmi.h>
>  #include <linux/regmap.h>
> +#include <linux/videodev2.h>
>  #include <linux/workqueue.h>
>  
>  #include <drm/bridge/dw_hdmi_qp.h>
> @@ -187,6 +188,19 @@ static int dw_hdmi_qp_rockchip_get_vop_format(struct drm_encoder *encoder,
>  	return bstate->output_bus_cfg.format;
>  }
>  
> +static u32
> +dw_hdmi_qp_rockchip_color_space(const struct drm_connector_state *conn_state)
> +{
> +	switch (conn_state->colorspace) {
> +	case DRM_MODE_COLORIMETRY_BT2020_RGB:
> +	case DRM_MODE_COLORIMETRY_BT2020_YCC:
> +	case DRM_MODE_COLORIMETRY_BT2020_CYCC:
> +		return V4L2_COLORSPACE_BT2020;
> +	default:
> +		return V4L2_COLORSPACE_DEFAULT;
> +	}
> +}

My main concern is introducing V4L2_COLORSPACE_* logic into a DRM bridge driver,
which should rather rely on enum drm_colorspace / DRM_MODE_COLORIMETRY_*.
Translating the DRM colorimetry into V4L2 values only for VOP2 to map them back
to a CSC matrix doesn't seem fully justified.

The root problem is rather on the VOP2 side: the color_space field in struct
rockchip_crtc_state and its V4L2-based handling in the CSC selection look like
leftovers inherited from the vendor kernel, and I think this is a good time to
clean that up instead of building on it.

Cristian



More information about the Linux-rockchip mailing list