From nobody Thu Oct 2 11:49:07 2025 Received: from bali.collaboradmins.com (bali.collaboradmins.com [148.251.105.195]) (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 5C3D9218580 for ; Thu, 18 Sep 2025 00:44:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.251.105.195 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758156278; cv=none; b=VeV1Dec9GBXylEExcM6uXWAJdLodV7epo8EF8Li4frh8/1Q0wfxm+dCwA8PryOILbeF6b9mjRQJUOzA8TkIQNr4i4CSd1U+omD5d1L/HoqfFsn6YkQtTREB6KAQuBDQgs0jUHO70PDRv8JkqfL73fnuOQ67/brABLu3AzXOC5fE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758156278; c=relaxed/simple; bh=OxWLj5jfPrUF57pe227+c8Mwkg2BLt4f9isetceWqR4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=iid0qfs4bSLDkWzFaMYaSjPBaEQX2MxoABduBvucpKeGv1ccoxm2F5TOKUt7ujC8E+ZYCwUWK1ZlCCHIi8Lj8+nTfuFFSc8dktcaGiINdEfaD9vV40VRYPuBfhb7dwAr2+CBCrxgvpq04114H81Yj6fjclV/0oc1m1DIfIjQTZM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=PE8e4h3j; arc=none smtp.client-ip=148.251.105.195 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 (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="PE8e4h3j" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1758156274; bh=OxWLj5jfPrUF57pe227+c8Mwkg2BLt4f9isetceWqR4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=PE8e4h3jHf5dUGwYCWBIriCbcq2MygFYpoxC3HHe2ExfkesRWWa9LVl5qIgzhLPQf hgT6oAMiGLVaOT28ZYTlQamdH6Q3xRh1ynjFShkLVRnzmcHn9/Q9C5Gu1a0BCjZXPu Zr5vxgRrdwZKM1IEw3U1eoxNOjUHEe2D5z/T+arftp/6n/BGhDzoHlY5912JrwlG6V CPEJdjoDt0jMSlhU2GenQSbT8MMCLt8YdDrFJqy1WlPxL7L6JHU29qmh6R8D+SiWRy VotWwsDDgaOxsng7hhlmdeTjNmVnZ4pvq9naVB51LY58g9MsnCLG4zdJAJMcydd7gu 5KEriZYMEsquQ== Received: from [127.0.1.1] (unknown [IPv6:2600:4041:5b1a:9400:62f0:406e:ac79:4a96]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: nfraprado) by bali.collaboradmins.com (Postfix) with ESMTPSA id EC06E17E0EB8; Thu, 18 Sep 2025 02:44:27 +0200 (CEST) From: =?utf-8?q?N=C3=ADcolas_F=2E_R=2E_A=2E_Prado?= Date: Wed, 17 Sep 2025 20:43:19 -0400 Subject: [PATCH RFC v2 10/20] drm/colorop: Introduce colorop helpers for crtc 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: <20250917-mtk-post-blend-color-pipeline-v2-10-ac4471b44758@collabora.com> References: <20250917-mtk-post-blend-color-pipeline-v2-0-ac4471b44758@collabora.com> In-Reply-To: <20250917-mtk-post-blend-color-pipeline-v2-0-ac4471b44758@collabora.com> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Chun-Kuang Hu , Philipp Zabel , Matthias Brugger , AngeloGioacchino Del Regno , Haneen Mohammed , Melissa Wen Cc: Alex Hung , wayland-devel@lists.freedesktop.org, harry.wentland@amd.com, leo.liu@amd.com, ville.syrjala@linux.intel.com, pekka.paalanen@collabora.com, contact@emersion.fr, mwen@igalia.com, jadahl@redhat.com, sebastian.wick@redhat.com, shashank.sharma@amd.com, agoins@nvidia.com, joshua@froggi.es, mdaenzer@redhat.com, aleixpol@kde.org, xaver.hugl@gmail.com, victoria@system76.com, uma.shankar@intel.com, quic_naseer@quicinc.com, quic_cbraga@quicinc.com, quic_abhinavk@quicinc.com, marcan@marcan.st, Liviu.Dudau@arm.com, sashamcintosh@google.com, chaitanya.kumar.borah@intel.com, louis.chauvet@bootlin.com, mcanal@igalia.com, kernel@collabora.com, daniels@collabora.com, leandro.ribeiro@collabora.com, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, =?utf-8?q?N=C3=ADcolas_F=2E_R=2E_A=2E_Prado?= , Simona Vetter X-Mailer: b4 0.14.2 Introduce colorop helper counterparts for post-blend color pipelines that take a CRTC instead of a plane. Signed-off-by: N=C3=ADcolas F. R. A. Prado Reviewed-by: Louis Chauvet --- drivers/gpu/drm/drm_colorop.c | 73 +++++++++++++++++++++++++++++++++++++++= ++++ include/drm/drm_colorop.h | 8 +++++ 2 files changed, 81 insertions(+) diff --git a/drivers/gpu/drm/drm_colorop.c b/drivers/gpu/drm/drm_colorop.c index db137169effa6cd9e6d5805f65bdfd1cc6882075..b0c3216f4dac22f3408cbd537a2= 0f38d03abc0a7 100644 --- a/drivers/gpu/drm/drm_colorop.c +++ b/drivers/gpu/drm/drm_colorop.c @@ -168,6 +168,20 @@ static int drm_plane_colorop_init(struct drm_device *d= ev, return ret; } =20 +static int drm_crtc_colorop_init(struct drm_device *dev, + struct drm_colorop *colorop, + struct drm_crtc *crtc, + enum drm_colorop_type type, uint32_t flags) +{ + int ret; + + ret =3D drm_common_colorop_init(dev, colorop, type, flags); + + colorop->crtc =3D crtc; + + return ret; +} + /** * drm_colorop_cleanup - Cleanup a drm_colorop object in color_pipeline * @@ -293,6 +307,23 @@ int drm_plane_colorop_curve_1d_init(struct drm_device = *dev, struct drm_colorop * } EXPORT_SYMBOL(drm_plane_colorop_curve_1d_init); =20 +int drm_crtc_colorop_curve_1d_init(struct drm_device *dev, struct drm_colo= rop *colorop, + struct drm_crtc *crtc, u64 supported_tfs, uint32_t flags) +{ + int ret; + + ret =3D drm_colorop_has_supported_tf(dev, &crtc->base, crtc->name, suppor= ted_tfs); + if (ret) + return ret; + + ret =3D drm_crtc_colorop_init(dev, colorop, crtc, DRM_COLOROP_1D_CURVE, f= lags); + if (ret) + return ret; + + return drm_common_colorop_curve_1d_init(dev, colorop, supported_tfs, flag= s); +} +EXPORT_SYMBOL(drm_crtc_colorop_curve_1d_init); + static int drm_colorop_create_data_prop(struct drm_device *dev, struct drm= _colorop *colorop) { struct drm_property *prop; @@ -381,6 +412,35 @@ drm_plane_colorop_curve_1d_lut_init(struct drm_device = *dev, struct drm_colorop * } EXPORT_SYMBOL(drm_plane_colorop_curve_1d_lut_init); =20 +/** + * drm_crtc_colorop_curve_1d_lut_init - Initialize a DRM_COLOROP_1D_LUT + * + * @dev: DRM device + * @colorop: The drm_colorop object to initialize + * @crtc: The associated drm_crtc + * @lut_size: LUT size supported by driver + * @lut1d_interpolation: 1D LUT interpolation type + * @flags: bitmask of misc, see DRM_COLOROP_FLAG_* defines. + * @return zero on success, -E value on failure + */ +int +drm_crtc_colorop_curve_1d_lut_init(struct drm_device *dev, + struct drm_colorop *colorop, + struct drm_crtc *crtc, uint32_t lut_size, + enum drm_colorop_lut1d_interpolation_type lut1d_interpolation, + uint32_t flags) +{ + int ret; + + ret =3D drm_crtc_colorop_init(dev, colorop, crtc, DRM_COLOROP_1D_LUT, fla= gs); + if (ret) + return ret; + + return drm_common_colorop_curve_1d_lut_init(dev, colorop, lut_size, + lut1d_interpolation, flags); +} +EXPORT_SYMBOL(drm_crtc_colorop_curve_1d_lut_init); + static int drm_common_colorop_ctm_3x4_init(struct drm_device *dev, struct = drm_colorop *colorop, uint32_t flags) { @@ -408,6 +468,19 @@ int drm_plane_colorop_ctm_3x4_init(struct drm_device *= dev, struct drm_colorop *c } EXPORT_SYMBOL(drm_plane_colorop_ctm_3x4_init); =20 +int drm_crtc_colorop_ctm_3x4_init(struct drm_device *dev, struct drm_color= op *colorop, + struct drm_crtc *crtc, uint32_t flags) +{ + int ret; + + ret =3D drm_crtc_colorop_init(dev, colorop, crtc, DRM_COLOROP_CTM_3X4, fl= ags); + if (ret) + return ret; + + return drm_common_colorop_ctm_3x4_init(dev, colorop, flags); +} +EXPORT_SYMBOL(drm_crtc_colorop_ctm_3x4_init); + /** * drm_plane_colorop_mult_init - Initialize a DRM_COLOROP_MULTIPLIER * diff --git a/include/drm/drm_colorop.h b/include/drm/drm_colorop.h index 3e223f3b3597978c5d702ce7622ae30b8aa9dddb..e7d1e5e95a901b1bd91fd8580e2= fcb367c0253ce 100644 --- a/include/drm/drm_colorop.h +++ b/include/drm/drm_colorop.h @@ -377,14 +377,22 @@ static inline struct drm_colorop *drm_colorop_find(st= ruct drm_device *dev, =20 void drm_colorop_pipeline_destroy(struct drm_device *dev); =20 +int drm_crtc_colorop_curve_1d_lut_init(struct drm_device *dev, struct drm_= colorop *colorop, + struct drm_crtc *crtc, uint32_t lut_size, + enum drm_colorop_lut1d_interpolation_type lut1d_interpolation, + uint32_t flags); int drm_plane_colorop_curve_1d_init(struct drm_device *dev, struct drm_col= orop *colorop, struct drm_plane *plane, u64 supported_tfs, uint32_t flags); +int drm_crtc_colorop_curve_1d_init(struct drm_device *dev, struct drm_colo= rop *colorop, + struct drm_crtc *crtc, u64 supported_tfs, uint32_t flags); int drm_plane_colorop_curve_1d_lut_init(struct drm_device *dev, struct drm= _colorop *colorop, struct drm_plane *plane, uint32_t lut_size, enum drm_colorop_lut1d_interpolation_type lut1d_interpolation, uint32_t flags); int drm_plane_colorop_ctm_3x4_init(struct drm_device *dev, struct drm_colo= rop *colorop, struct drm_plane *plane, uint32_t flags); +int drm_crtc_colorop_ctm_3x4_init(struct drm_device *dev, struct drm_color= op *colorop, + struct drm_crtc *crtc, uint32_t flags); int drm_plane_colorop_mult_init(struct drm_device *dev, struct drm_colorop= *colorop, struct drm_plane *plane, uint32_t flags); int drm_plane_colorop_3dlut_init(struct drm_device *dev, struct drm_coloro= p *colorop, --=20 2.50.1