mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
To: "Jan Claußen" <jan.claussen10@web.de>,
	"Sandy Huang" <hjc@rock-chips.com>,
	"Heiko Stübner" <heiko@sntech.de>,
	"Andy Yan" <andy.yan@rock-chips.com>,
	"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"Maxime Ripard" <mripard@kernel.org>,
	"Thomas Zimmermann" <tzimmermann@suse.de>,
	"David Airlie" <airlied@gmail.com>,
	"Simona Vetter" <simona@ffwll.ch>
Cc: dri-devel@lists.freedesktop.org,
	linux-rockchip@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 6/7] drm/rockchip: dw_hdmi_qp: Set the VOP2 color space from the connector
Date: Tue, 10 Nov 2026 21:05:30 +0200	[thread overview]
Message-ID: <cd6ff4c0-cd5d-4c42-8f52-5f3893aec015@collabora.com> (raw)
In-Reply-To: <20261018143135.5745-7-jan.claussen10@web.de>

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@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

  reply	other threads:[~2026-11-10 19:05 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-18 14:31 [PATCH v4 0/7] drm: Add colorspace property support to the HDMI helpers Jan Claußen
2026-10-18 14:31 ` [PATCH v4 1/7] drm/connector: Fix typo in colorspace error messages Jan Claußen
2026-10-18 14:31 ` [PATCH v4 2/7] drm/display: hdmi-state-helper: Force modeset on colorspace change Jan Claußen
2026-10-18 14:31 ` [PATCH v4 3/7] drm/connector: hdmi: Create the colorspace property Jan Claußen
2026-10-18 14:31 ` [PATCH v4 4/7] drm/bridge-connector: Pass supported colorspaces to the HDMI helpers Jan Claußen
2026-10-18 14:31 ` [PATCH v4 5/7] drm/bridge: dw-hdmi-qp: Forward supported colorspaces from platform data Jan Claußen
2026-10-18 14:31 ` [PATCH v4 6/7] drm/rockchip: dw_hdmi_qp: Set the VOP2 color space from the connector Jan Claußen
2026-11-10 19:05   ` Cristian Ciocaltea [this message]
2026-10-18 14:31 ` [PATCH v4 7/7] drm/rockchip: dw_hdmi_qp: Advertise BT.709 and BT.2020 colorimetries Jan Claußen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cd6ff4c0-cd5d-4c42-8f52-5f3893aec015@collabora.com \
    --to=cristian.ciocaltea@collabora.com \
    --cc=airlied@gmail.com \
    --cc=andy.yan@rock-chips.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=heiko@sntech.de \
    --cc=hjc@rock-chips.com \
    --cc=jan.claussen10@web.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=simona@ffwll.ch \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®