Linux-mediatek Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Robert Mader <robert.mader@collabora.com>
To: Ariel D'Alessandro <ariel.dalessandro@collabora.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>,
	Chun-Kuang Hu <chunkuang.hu@kernel.org>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>,
	Louis Chauvet <louis.chauvet@bootlin.com>,
	Haneen Mohammed <hamohammed.sa@gmail.com>,
	Melissa Wen <melissa.srw@gmail.com>
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	linux-mediatek@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org, kernel@collabora.com,
	"Nícolas F. R. A. Prado" <nfraprado@collabora.com>
Subject: Re: [PATCH v3 06/21] drm: Introduce DRM_CLIENT_CAP_CRTC_COLOR_PIPELINE
Date: Wed, 8 Jul 2026 09:28:07 +0200	[thread overview]
Message-ID: <e8384d37-5fb6-442a-b17a-547506abd157@collabora.com> (raw)
In-Reply-To: <20251223-mtk-post-blend-color-pipeline-v3-6-7d969f9a37a0@collabora.com>

Hi, thanks for the series!

On 23.12.25 19:01, Ariel D'Alessandro wrote:
> From: "Nícolas F. R. A. Prado" <nfraprado@collabora.com>
>
> Introduce DRM_CLIENT_CAP_CRTC_COLOR_PIPELINE which a DRM client can set
> to enable the usage of CRTC (post-blend) color pipelines instead of the
> now deprecated CRTC color management properties: "GAMMA_LUT",
> "DEGAMMA_LUT" and "CTM".
>
> Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
> Co-developed-by: Ariel D'Alessandro <ariel.dalessandro@collabora.com>
> Signed-off-by: Ariel D'Alessandro <ariel.dalessandro@collabora.com>
> Reviewed-by: Louis Chauvet <louis.chauvet@bootlin.com>
> ---
>   drivers/gpu/drm/drm_atomic_uapi.c   | 20 ++++++++++++++++++++
>   drivers/gpu/drm/drm_connector.c     |  1 +
>   drivers/gpu/drm/drm_crtc_internal.h |  1 +
>   drivers/gpu/drm/drm_ioctl.c         |  9 +++++++++
>   drivers/gpu/drm/drm_mode_object.c   |  9 +++++++++
>   include/drm/drm_file.h              |  7 +++++++
>   include/uapi/drm/drm.h              | 19 +++++++++++++++++++
>   7 files changed, 66 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c
> index 07d0d224fe58c..d1bc78b2567a9 100644
> --- a/drivers/gpu/drm/drm_atomic_uapi.c
> +++ b/drivers/gpu/drm/drm_atomic_uapi.c
> @@ -433,6 +433,11 @@ static int drm_atomic_crtc_set_property(struct drm_crtc *crtc,
>   	if (property == config->prop_active)
>   		state->active = val;
>   	else if (property == crtc->color_pipeline_property) {
> +		if (!file_priv->crtc_color_pipeline) {
> +			drm_dbg_atomic(dev,
> +				"Setting COLOR_PIPELINE CRTC property not permitted without DRM_CLIENT_CAP_CRTC_COLOR_PIPELINE client cap\n");
> +			return -EINVAL;
> +		}
>   		/* find DRM colorop object */
>   		struct drm_colorop *colorop = NULL;
>   
> @@ -451,6 +456,11 @@ static int drm_atomic_crtc_set_property(struct drm_crtc *crtc,
>   	} else if (property == config->prop_vrr_enabled) {
>   		state->vrr_enabled = val;
>   	} else if (property == config->degamma_lut_property) {
> +		if (file_priv->crtc_color_pipeline) {
> +			drm_dbg_atomic(dev,
> +				"Setting DEGAMMA_LUT CRTC property not permitted with DRM_CLIENT_CAP_CRTC_COLOR_PIPELINE client cap\n");
> +			return -EINVAL;
> +		}
>   		ret = drm_property_replace_blob_from_id(dev,
>   					&state->degamma_lut,
>   					val,
> @@ -459,6 +469,11 @@ static int drm_atomic_crtc_set_property(struct drm_crtc *crtc,
>   		state->color_mgmt_changed |= replaced;
>   		return ret;
>   	} else if (property == config->ctm_property) {
> +		if (file_priv->crtc_color_pipeline) {
> +			drm_dbg_atomic(dev,
> +				"Setting CTM CRTC property not permitted with DRM_CLIENT_CAP_CRTC_COLOR_PIPELINE client cap\n");
> +			return -EINVAL;
> +		}
>   		ret = drm_property_replace_blob_from_id(dev,
>   					&state->ctm,
>   					val,
> @@ -467,6 +482,11 @@ static int drm_atomic_crtc_set_property(struct drm_crtc *crtc,
>   		state->color_mgmt_changed |= replaced;
>   		return ret;
>   	} else if (property == config->gamma_lut_property) {
> +		if (file_priv->crtc_color_pipeline) {
> +			drm_dbg_atomic(dev,
> +				"Setting GAMMA_LUT CRTC property not permitted with DRM_CLIENT_CAP_CRTC_COLOR_PIPELINE client cap\n");
> +			return -EINVAL;
> +		}
>   		ret = drm_property_replace_blob_from_id(dev,
>   					&state->gamma_lut,
>   					val,
> diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
> index 4d6dc9ebfdb5b..aec8a5c0d593a 100644
> --- a/drivers/gpu/drm/drm_connector.c
> +++ b/drivers/gpu/drm/drm_connector.c
> @@ -3440,6 +3440,7 @@ int drm_mode_getconnector(struct drm_device *dev, void *data,
>   	 */
>   	ret = drm_mode_object_get_properties(&connector->base, file_priv->atomic,
>   			file_priv->plane_color_pipeline,
> +			file_priv->crtc_color_pipeline,
>   			(uint32_t __user *)(unsigned long)(out_resp->props_ptr),
>   			(uint64_t __user *)(unsigned long)(out_resp->prop_values_ptr),
>   			&out_resp->count_props);
> diff --git a/drivers/gpu/drm/drm_crtc_internal.h b/drivers/gpu/drm/drm_crtc_internal.h
> index c094092296448..ab02e6295271d 100644
> --- a/drivers/gpu/drm/drm_crtc_internal.h
> +++ b/drivers/gpu/drm/drm_crtc_internal.h
> @@ -164,6 +164,7 @@ void drm_mode_object_unregister(struct drm_device *dev,
>   				struct drm_mode_object *object);
>   int drm_mode_object_get_properties(struct drm_mode_object *obj, bool atomic,
>   				   bool plane_color_pipeline,
> +				   bool crtc_color_pipeline,
>   				   uint32_t __user *prop_ptr,
>   				   uint64_t __user *prop_values,
>   				   uint32_t *arg_count_props);
> diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
> index 2884075660ddd..14746afd82783 100644
> --- a/drivers/gpu/drm/drm_ioctl.c
> +++ b/drivers/gpu/drm/drm_ioctl.c
> @@ -383,6 +383,15 @@ drm_setclientcap(struct drm_device *dev, void *data, struct drm_file *file_priv)
>   			return -EINVAL;
>   		file_priv->plane_color_pipeline = req->value;
>   		break;
> +	case DRM_CLIENT_CAP_CRTC_COLOR_PIPELINE:
> +		if (!file_priv->atomic)
> +			return -EINVAL;
> +		if (req->value > 1)
> +			return -EINVAL;
> +		if (!drm_core_check_feature(dev, DRIVER_CRTC_COLOR_PIPELINE))
> +			return -EINVAL;

For DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE we just solved the equivalent 
problem by checking if drivers actually expose pipelines (see 
https://lore.kernel.org/dri-devel/20260703073230.19982-1-robert.mader@collabora.com/ 
which just landed drm-misc-fixes and is marked for backporting). I 
initially went with the same approach of using a driver feature (see 
https://lore.kernel.org/dri-devel/20260630084229.529682-2-robert.mader@collabora.com/), 
however the explicit check turned out to be both sufficient and simpler. 
Using that approach would allow you to drop the patches 5, 17 and 21.

Regards

> +		file_priv->crtc_color_pipeline = req->value;
> +		break;
>   	default:
>   		return -EINVAL;
>   	}
> diff --git a/drivers/gpu/drm/drm_mode_object.c b/drivers/gpu/drm/drm_mode_object.c
> index b45d501b10c86..ea4508f6a09a6 100644
> --- a/drivers/gpu/drm/drm_mode_object.c
> +++ b/drivers/gpu/drm/drm_mode_object.c
> @@ -388,6 +388,7 @@ EXPORT_SYMBOL(drm_object_property_get_default_value);
>   /* helper for getconnector and getproperties ioctls */
>   int drm_mode_object_get_properties(struct drm_mode_object *obj, bool atomic,
>   				   bool plane_color_pipeline,
> +				   bool crtc_color_pipeline,
>   				   uint32_t __user *prop_ptr,
>   				   uint64_t __user *prop_values,
>   				   uint32_t *arg_count_props)
> @@ -416,6 +417,13 @@ int drm_mode_object_get_properties(struct drm_mode_object *obj, bool atomic,
>   				continue;
>   		}
>   
> +		if (!crtc_color_pipeline && obj->type == DRM_MODE_OBJECT_CRTC) {
> +			struct drm_crtc *crtc = obj_to_crtc(obj);
> +
> +			if (prop == crtc->color_pipeline_property)
> +				continue;
> +		}
> +
>   		if (*arg_count_props > count) {
>   			ret = __drm_object_property_get_value(obj, prop, &val);
>   			if (ret)
> @@ -475,6 +483,7 @@ int drm_mode_obj_get_properties_ioctl(struct drm_device *dev, void *data,
>   
>   	ret = drm_mode_object_get_properties(obj, file_priv->atomic,
>   			file_priv->plane_color_pipeline,
> +			file_priv->crtc_color_pipeline,
>   			(uint32_t __user *)(unsigned long)(arg->props_ptr),
>   			(uint64_t __user *)(unsigned long)(arg->prop_values_ptr),
>   			&arg->count_props);
> diff --git a/include/drm/drm_file.h b/include/drm/drm_file.h
> index 6ee70ad65e1fd..d0c323378ae46 100644
> --- a/include/drm/drm_file.h
> +++ b/include/drm/drm_file.h
> @@ -214,6 +214,13 @@ struct drm_file {
>   	 */
>   	bool plane_color_pipeline;
>   
> +	/**
> +	 * @crtc_color_pipeline:
> +	 *
> +	 * True if client understands CRTC (post-blend) color pipelines
> +	 */
> +	bool crtc_color_pipeline;
> +
>   	/**
>   	 * @was_master:
>   	 *
> diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h
> index d726828bdf408..991ef14c5377c 100644
> --- a/include/uapi/drm/drm.h
> +++ b/include/uapi/drm/drm.h
> @@ -927,6 +927,25 @@ struct drm_get_cap {
>    */
>   #define DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE	7
>   
> +/**
> + * DRM_CLIENT_CAP_CRTC_COLOR_PIPELINE
> + *
> + * If set to 1 the DRM core will allow setting the COLOR_PIPELINE
> + * property on a &drm_crtc, as well as drm_colorop properties.
> + *
> + * Setting of these crtc properties will be rejected when this client
> + * cap is set:
> + * - GAMMA_LUT
> + * - DEGAMMA_LUT
> + * - CTM
> + *
> + * The client must enable &DRM_CLIENT_CAP_ATOMIC first.
> + *
> + * This client cap can only be set if the driver sets the corresponding driver
> + * cap &DRM_CAP_CRTC_COLOR_PIPELINE.
> + */
> +#define DRM_CLIENT_CAP_CRTC_COLOR_PIPELINE	8
> +
>   /* DRM_IOCTL_SET_CLIENT_CAP ioctl argument type */
>   struct drm_set_client_cap {
>   	__u64 capability;
>
-- 
Robert Mader
Consultant Software Developer

Collabora Ltd.
Platinum Building, St John's Innovation Park, Cambridge CB4 0DS, UK
Registered in England & Wales, no. 5513718



  reply	other threads:[~2026-07-08  7:28 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-23 18:01 [PATCH v3 00/21] Introduce support for CRTC (post-blend) color pipeline Ariel D'Alessandro
2025-12-23 18:01 ` [PATCH v3 01/21] drm/crtc: Add color pipeline to CRTC state Ariel D'Alessandro
2025-12-23 18:01 ` [PATCH v3 02/21] drm/colorop: Allow parenting colorop to CRTC Ariel D'Alessandro
2025-12-23 18:01 ` [PATCH v3 03/21] drm: Factor out common color_pipeline property initialization code Ariel D'Alessandro
2025-12-23 18:01 ` [PATCH v3 04/21] drm/crtc: Add COLOR_PIPELINE property Ariel D'Alessandro
2025-12-23 18:01 ` [PATCH v3 05/21] drm: Introduce DRM_CAP_CRTC_COLOR_PIPELINE Ariel D'Alessandro
2025-12-23 18:01 ` [PATCH v3 06/21] drm: Introduce DRM_CLIENT_CAP_CRTC_COLOR_PIPELINE Ariel D'Alessandro
2026-07-08  7:28   ` Robert Mader [this message]
2025-12-23 18:01 ` [PATCH v3 07/21] drm/atomic: Pass crtc_color_pipeline client cap to atomic check Ariel D'Alessandro
2025-12-23 18:01 ` [PATCH v3 08/21] drm/atomic: Print the color pipeline as part of the CRTC state print Ariel D'Alessandro
2025-12-23 18:01 ` [PATCH v3 09/21] drm/colorop: Factor out common paths from colorops helpers Ariel D'Alessandro
2025-12-25  6:26   ` kernel test robot
2025-12-23 18:01 ` [PATCH v3 10/21] drm/colorop: Introduce colorop helpers for crtc Ariel D'Alessandro
2025-12-23 18:01 ` [PATCH v3 11/21] drm/crtc: Track crtc color pipeline client cap in drm_crtc_state Ariel D'Alessandro
2025-12-23 18:01 ` [PATCH v3 12/21] drm/mediatek: Support CRTC colorops for gamma and ctm Ariel D'Alessandro
2025-12-23 18:01 ` [PATCH v3 13/21] drm: Add helper to extract a 3x4 matrix from any CTM matrix dimensions Ariel D'Alessandro
2025-12-23 18:01 ` [PATCH v3 14/21] drm/mediatek: ccorr: Support CRTC color pipeline API Ariel D'Alessandro
2025-12-23 18:01 ` [PATCH v3 15/21] drm: Add helper to extract a LUT entry from either 16-bit or 32-bit LUT Ariel D'Alessandro
2025-12-23 18:01 ` [PATCH v3 16/21] drm/mediatek: gamma: Support CRTC color pipeline API Ariel D'Alessandro
2025-12-23 18:01 ` [PATCH v3 17/21] drm/mediatek: Set CRTC color pipeline driver cap Ariel D'Alessandro
2025-12-23 18:01 ` [PATCH v3 18/21] drm/vkms: Rename existing color pipeline helpers to contain "plane" Ariel D'Alessandro
2025-12-23 18:01 ` [PATCH v3 19/21] drm/vkms: Prepare pre_blend_color_transform() for CRTC color pipelines Ariel D'Alessandro
2025-12-23 18:01 ` [PATCH v3 20/21] drm/vkms: Introduce support for post-blend color pipeline Ariel D'Alessandro
2026-07-08 17:35   ` Robert Mader
2025-12-23 18:01 ` [PATCH v3 21/21] drm/vkms: Set CRTC color pipeline driver cap Ariel D'Alessandro

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=e8384d37-5fb6-442a-b17a-547506abd157@collabora.com \
    --to=robert.mader@collabora.com \
    --cc=airlied@gmail.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=ariel.dalessandro@collabora.com \
    --cc=chunkuang.hu@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hamohammed.sa@gmail.com \
    --cc=kernel@collabora.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=louis.chauvet@bootlin.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=matthias.bgg@gmail.com \
    --cc=melissa.srw@gmail.com \
    --cc=mripard@kernel.org \
    --cc=nfraprado@collabora.com \
    --cc=p.zabel@pengutronix.de \
    --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