From nobody Tue Feb 10 09:57:09 2026 Received: from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com [136.143.188.112]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ABE152E06ED for ; Tue, 23 Dec 2025 18:02:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.188.112 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766512973; cv=pass; b=cO+3NrjEHnIy/3R4/HVvSv9/v60j6SXzgv/KUj2+ye0p1+HYpIJfAr7AGXA48AjMzcJPizb1idFQ/TzrwDjgIXjMJt9KXwdqZhRenXc0FkUao3mfyAFCyDjFLmwsXlaiqx/1+8DmUw5AH4LOCFvHGJvSQc62pCeITRcuUWEKGVQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766512973; c=relaxed/simple; bh=AEHsX3Bvn+HfSxApeYHzLp67qwkxeLBZ+32gPAeCbcM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=KIpOrFWChphas0O6Nz6hLRh3a3zkrlfwQpAksor95EaIyKzAjnwS/La6RnK++yRJ0KFPi2gEjxXYXP/gECx+M3lKiFaIaYtNzMn7iyJn+fLT4CArfNCsdSW26GkyIJasxm4ayCzFQl1ZVSLbNPdklUSbyIDUQJ7y3ptf37AgQdM= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (1024-bit key) header.d=collabora.com header.i=ariel.dalessandro@collabora.com header.b=D7CEDoBu; arc=pass smtp.client-ip=136.143.188.112 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=collabora.com header.i=ariel.dalessandro@collabora.com header.b="D7CEDoBu" ARC-Seal: i=1; a=rsa-sha256; t=1766512948; cv=none; d=zohomail.com; s=zohoarc; b=NwKMu/TJ6gz3wJSoNZ26dhb8YJ5F/HsZNDa7poqN9h0YLFNJKZjLKlXAXF8J3PvicsEq6o2PgsPoGEjuoaihOMCRvySH6uGcZ1QTOIb7cHjA10U4Gb0XHJXqWwOM09CU4xNg8scRC/+MvVuPPWB6s9QPprnlc8gZY20kpe9b8oc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1766512948; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=v+3Nip5sOwFkY7TZUjZ8sTC7gjM7wYH8Py1KBE7AVLU=; b=fQ+zpPUQGHdENa87e8hbBqvm1x7hziSiBh/h8S1FUaY6ilh/ksX2YLgO57vhVq/qxQki+suzEaiZChdWAmP9v9TF46BMq2Jpp7rJlEQONhrDFhBHOV8lJcv2rHjn4CvnOiaDCM6vvpofIV+dLUDnVcarhTiVKJZ2l5wgDEl/wN4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=collabora.com; spf=pass smtp.mailfrom=ariel.dalessandro@collabora.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1766512948; s=zohomail; d=collabora.com; i=ariel.dalessandro@collabora.com; h=From:From:Date:Date:Subject:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Message-Id:References:In-Reply-To:To:To:Cc:Cc:Reply-To; bh=v+3Nip5sOwFkY7TZUjZ8sTC7gjM7wYH8Py1KBE7AVLU=; b=D7CEDoBuJiN8tsKyRBZdptlHiVXCJ6QDyvgzMQ4wRbxVjIpWPCk8T9sW0Fbg2rzd QsnnPtVeX4lUGXOlqCIAQDN4vJkisJDgcpmzcEpIC9pbotIZJjWrGyI4YUJTXS5ilrQ MBjcRMxz4mzEwbJCGPx6aYeJoPUNOE910BPqPV1s= Received: by mx.zohomail.com with SMTPS id 1766512946574653.5271210380862; Tue, 23 Dec 2025 10:02:26 -0800 (PST) From: Ariel D'Alessandro Date: Tue, 23 Dec 2025 15:01:26 -0300 Subject: [PATCH v3 06/21] drm: Introduce DRM_CLIENT_CAP_CRTC_COLOR_PIPELINE Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251223-mtk-post-blend-color-pipeline-v3-6-7d969f9a37a0@collabora.com> References: <20251223-mtk-post-blend-color-pipeline-v3-0-7d969f9a37a0@collabora.com> In-Reply-To: <20251223-mtk-post-blend-color-pipeline-v3-0-7d969f9a37a0@collabora.com> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Chun-Kuang Hu , Philipp Zabel , Matthias Brugger , AngeloGioacchino Del Regno , Louis Chauvet , Haneen Mohammed , Melissa Wen 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, =?utf-8?q?N=C3=ADcolas_F=2E_R=2E_A=2E_Prado?= , Ariel D'Alessandro X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1766512902; l=7784; i=ariel.dalessandro@collabora.com; s=20251223; h=from:subject:message-id; bh=fqIEVxRuDhlbZZQggPdeHf7nE1KjEiR2JRGFblrRdRw=; b=vvHwtG8UJ0+HhQ4FXXiOUxLBNsJc9qFqr8F82gLDkR8wDN0s83TA/BwSPHgKzfE0jsJtCWoDB iECu3QlxdO8CyzR/5N/1Pki/eWRegxWfrhhPrKjYahaH3wgVIQFR4y4 X-Developer-Key: i=ariel.dalessandro@collabora.com; a=ed25519; pk=QZRL9EsSBV3/FhDHi9L/7ZTz2dwa7iyqgl+y1UYaQXQ= X-ZohoMailClient: External From: "N=C3=ADcolas F. R. A. Prado" 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=C3=ADcolas F. R. A. Prado Co-developed-by: Ariel D'Alessandro Signed-off-by: Ariel D'Alessandro Reviewed-by: Louis Chauvet --- 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_crt= c *crtc, if (property =3D=3D config->prop_active) state->active =3D val; else if (property =3D=3D 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 =3D NULL; =20 @@ -451,6 +456,11 @@ static int drm_atomic_crtc_set_property(struct drm_crt= c *crtc, } else if (property =3D=3D config->prop_vrr_enabled) { state->vrr_enabled =3D val; } else if (property =3D=3D 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_C= RTC_COLOR_PIPELINE client cap\n"); + return -EINVAL; + } ret =3D drm_property_replace_blob_from_id(dev, &state->degamma_lut, val, @@ -459,6 +469,11 @@ static int drm_atomic_crtc_set_property(struct drm_crt= c *crtc, state->color_mgmt_changed |=3D replaced; return ret; } else if (property =3D=3D config->ctm_property) { + if (file_priv->crtc_color_pipeline) { + drm_dbg_atomic(dev, + "Setting CTM CRTC property not permitted with DRM_CLIENT_CAP_CRTC_COLO= R_PIPELINE client cap\n"); + return -EINVAL; + } ret =3D drm_property_replace_blob_from_id(dev, &state->ctm, val, @@ -467,6 +482,11 @@ static int drm_atomic_crtc_set_property(struct drm_crt= c *crtc, state->color_mgmt_changed |=3D replaced; return ret; } else if (property =3D=3D 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_CRT= C_COLOR_PIPELINE client cap\n"); + return -EINVAL; + } ret =3D 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_connecto= r.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, voi= d *data, */ ret =3D drm_mode_object_get_properties(&connector->base, file_priv->atomi= c, 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 atomi= c, 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, s= truct drm_file *file_priv) return -EINVAL; file_priv->plane_color_pipeline =3D 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; + file_priv->crtc_color_pipeline =3D req->value; + break; default: return -EINVAL; } diff --git a/drivers/gpu/drm/drm_mode_object.c b/drivers/gpu/drm/drm_mode_o= bject.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 atomi= c, 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_obj= ect *obj, bool atomic, continue; } =20 + if (!crtc_color_pipeline && obj->type =3D=3D DRM_MODE_OBJECT_CRTC) { + struct drm_crtc *crtc =3D obj_to_crtc(obj); + + if (prop =3D=3D crtc->color_pipeline_property) + continue; + } + if (*arg_count_props > count) { ret =3D __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, =20 ret =3D 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; =20 + /** + * @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 =20 +/** + * 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 dr= iver + * 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; --=20 2.51.0