Linux-mediatek Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Harry Wentland <harry.wentland@amd.com>
To: "Nícolas F. R. A. Prado" <nfraprado@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>,
	"Haneen Mohammed" <hamohammed.sa@gmail.com>,
	"Melissa Wen" <melissa.srw@gmail.com>
Cc: Alex Hung <alex.hung@amd.com>,
	wayland-devel@lists.freedesktop.org, 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,
	Simona Vetter <simona.vetter@ffwll.ch>
Subject: Re: [PATCH RFC v2 03/20] drm: Factor out common color_pipeline property initialization code
Date: Mon, 29 Sep 2025 04:53:15 -0400	[thread overview]
Message-ID: <3c24d55c-76d1-4ba4-9942-fd5d85f9daca@amd.com> (raw)
In-Reply-To: <20250917-mtk-post-blend-color-pipeline-v2-3-ac4471b44758@collabora.com>



On 2025-09-17 20:43, Nícolas F. R. A. Prado wrote:
> In preparation for sharing the initialization code for the color
> pipeline property between pre- and post-blend color pipelines, factor
> out the common initialization to a separate function.
> 
> Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
> ---
>   drivers/gpu/drm/drm_crtc.c          | 44 +++++++++++++++++++++++++++++++++++++
>   drivers/gpu/drm/drm_crtc_internal.h |  5 +++++
>   drivers/gpu/drm/drm_plane.c         | 36 +++++-------------------------
>   3 files changed, 54 insertions(+), 31 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index 46655339003db2a1b43441434839e26f61d79b4e..94e60cffd29972aa979ac2f1932be7a6a97f3ada 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -959,3 +959,47 @@ bool drm_crtc_in_clone_mode(struct drm_crtc_state *crtc_state)
>   	return hweight32(crtc_state->encoder_mask) > 1;
>   }
>   EXPORT_SYMBOL(drm_crtc_in_clone_mode);
> +
> +struct drm_property *
> +drm_common_create_color_pipeline_property(struct drm_device *dev, struct drm_mode_object *obj,
> +					  const struct drm_prop_enum_list *pipelines,
> +					  int num_pipelines)

All other functions I see in drm_crtc seem to be quite crtc
specific. Would there be a better place to put this? Possibly
a new file if nothing else seems to fit?

Not a blocker in any way, though.

Harry

> +{
> +	struct drm_prop_enum_list *all_pipelines;
> +	struct drm_property *prop;
> +	int len = 0;
> +	int i;
> +
> +	all_pipelines = kcalloc(num_pipelines + 1,
> +				sizeof(*all_pipelines),
> +				GFP_KERNEL);
> +
> +	if (!all_pipelines) {
> +		drm_err(dev, "failed to allocate color pipeline\n");
> +		return ERR_PTR(-ENOMEM);
> +	}
> +
> +	/* Create default Bypass color pipeline */
> +	all_pipelines[len].type = 0;
> +	all_pipelines[len].name = "Bypass";
> +	len++;
> +
> +	/* Add all other color pipelines */
> +	for (i = 0; i < num_pipelines; i++, len++) {
> +		all_pipelines[len].type = pipelines[i].type;
> +		all_pipelines[len].name = pipelines[i].name;
> +	}
> +
> +	prop = drm_property_create_enum(dev, DRM_MODE_PROP_ATOMIC,
> +					"COLOR_PIPELINE",
> +					all_pipelines, len);
> +	if (IS_ERR(prop)) {
> +		kfree(all_pipelines);
> +		return prop;
> +	}
> +
> +	drm_object_attach_property(obj, prop, 0);
> +
> +	kfree(all_pipelines);
> +	return prop;
> +}
> diff --git a/drivers/gpu/drm/drm_crtc_internal.h b/drivers/gpu/drm/drm_crtc_internal.h
> index c094092296448093c5cd192ecdc8ea9a50769c90..e3dbdcbfa385b940ec0b5476adde6146fe4afde1 100644
> --- a/drivers/gpu/drm/drm_crtc_internal.h
> +++ b/drivers/gpu/drm/drm_crtc_internal.h
> @@ -35,6 +35,7 @@
>   #ifndef __DRM_CRTC_INTERNAL_H__
>   #define __DRM_CRTC_INTERNAL_H__
>   
> +#include <drm/drm_property.h>
>   #include <linux/err.h>
>   #include <linux/types.h>
>   
> @@ -79,6 +80,10 @@ int drm_crtc_check_viewport(const struct drm_crtc *crtc,
>   int drm_crtc_register_all(struct drm_device *dev);
>   void drm_crtc_unregister_all(struct drm_device *dev);
>   int drm_crtc_force_disable(struct drm_crtc *crtc);
> +struct drm_property *
> +drm_common_create_color_pipeline_property(struct drm_device *dev, struct drm_mode_object *obj,
> +					  const struct drm_prop_enum_list *pipelines,
> +					  int num_pipelines);
>   
>   struct dma_fence *drm_crtc_create_fence(struct drm_crtc *crtc);
>   
> diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
> index f6cfa8ac090c7bc49c7f276993bba7e9800da140..60dbfcab495600dd44c15260a1fa6135db59c6e2 100644
> --- a/drivers/gpu/drm/drm_plane.c
> +++ b/drivers/gpu/drm/drm_plane.c
> @@ -1839,43 +1839,17 @@ int drm_plane_create_color_pipeline_property(struct drm_plane *plane,
>   					     const struct drm_prop_enum_list *pipelines,
>   					     int num_pipelines)
>   {
> -	struct drm_prop_enum_list *all_pipelines;
>   	struct drm_property *prop;
> -	int len = 0;
> -	int i;
> -
> -	all_pipelines = kcalloc(num_pipelines + 1,
> -				sizeof(*all_pipelines),
> -				GFP_KERNEL);
> -
> -	if (!all_pipelines) {
> -		drm_err(plane->dev, "failed to allocate color pipeline\n");
> -		return -ENOMEM;
> -	}
>   
> -	/* Create default Bypass color pipeline */
> -	all_pipelines[len].type = 0;
> -	all_pipelines[len].name = "Bypass";
> -	len++;
> -
> -	/* Add all other color pipelines */
> -	for (i = 0; i < num_pipelines; i++, len++) {
> -		all_pipelines[len].type = pipelines[i].type;
> -		all_pipelines[len].name = pipelines[i].name;
> -	}
> -
> -	prop = drm_property_create_enum(plane->dev, DRM_MODE_PROP_ATOMIC,
> -					"COLOR_PIPELINE",
> -					all_pipelines, len);
> -	if (IS_ERR(prop)) {
> -		kfree(all_pipelines);
> +	prop = drm_common_create_color_pipeline_property(plane->dev,
> +							 &plane->base,
> +							 pipelines,
> +							 num_pipelines);
> +	if (IS_ERR(prop))
>   		return PTR_ERR(prop);
> -	}
>   
> -	drm_object_attach_property(&plane->base, prop, 0);
>   	plane->color_pipeline_property = prop;
>   
> -	kfree(all_pipelines);
>   	return 0;
>   }
>   EXPORT_SYMBOL(drm_plane_create_color_pipeline_property);
> 



  parent reply	other threads:[~2025-09-29  8:54 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-18  0:43 [PATCH RFC v2 00/20] Introduce support for post-blend color pipeline Nícolas F. R. A. Prado
2025-09-18  0:43 ` [PATCH RFC v2 01/20] drm/crtc: Add color pipeline to CRTC state Nícolas F. R. A. Prado
2025-09-19 12:45   ` Louis Chauvet
2025-09-18  0:43 ` [PATCH RFC v2 02/20] drm/colorop: Allow parenting colorop to CRTC Nícolas F. R. A. Prado
2025-09-19 12:44   ` Louis Chauvet
2025-12-10 20:49     ` Ariel D'Alessandro
2025-09-18  0:43 ` [PATCH RFC v2 03/20] drm: Factor out common color_pipeline property initialization code Nícolas F. R. A. Prado
2025-09-19 12:43   ` Louis Chauvet
2025-09-29  8:53   ` Harry Wentland [this message]
2025-12-10 20:19     ` Ariel D'Alessandro
2025-09-18  0:43 ` [PATCH RFC v2 04/20] drm/crtc: Add COLOR_PIPELINE property Nícolas F. R. A. Prado
2025-09-19 12:43   ` Louis Chauvet
2025-12-10 21:00     ` Ariel D'Alessandro
2025-09-18  0:43 ` [PATCH RFC v2 05/20] drm: Introduce DRM_CAP_POST_BLEND_COLOR_PIPELINE Nícolas F. R. A. Prado
2025-09-19 12:42   ` Louis Chauvet
2025-09-29  9:40     ` Harry Wentland
2025-09-29 16:00       ` Nícolas F. R. A. Prado
2025-09-18  0:43 ` [PATCH RFC v2 06/20] drm: Introduce DRM_CLIENT_CAP_POST_BLEND_COLOR_PIPELINE Nícolas F. R. A. Prado
2025-09-19 12:42   ` Louis Chauvet
2025-09-29  9:48   ` Harry Wentland
2025-12-11 15:26     ` Ariel D'Alessandro
2025-09-18  0:43 ` [PATCH RFC v2 07/20] drm/atomic: Pass post_blend_color_pipeline client cap to atomic check Nícolas F. R. A. Prado
2025-09-19 12:41   ` Louis Chauvet
2025-09-29  9:50   ` Harry Wentland
2025-12-11 15:16     ` Ariel D'Alessandro
2025-09-18  0:43 ` [PATCH RFC v2 08/20] drm/atomic: Print the color pipeline as part of the CRTC state print Nícolas F. R. A. Prado
2025-09-19 12:50   ` Louis Chauvet
2025-09-18  0:43 ` [PATCH RFC v2 09/20] drm/colorop: Factor out common paths from colorops helpers Nícolas F. R. A. Prado
2025-09-19 12:51   ` Louis Chauvet
2025-09-18  0:43 ` [PATCH RFC v2 10/20] drm/colorop: Introduce colorop helpers for crtc Nícolas F. R. A. Prado
2025-09-19 12:44   ` Louis Chauvet
2025-09-18  0:43 ` [PATCH RFC v2 11/20] drm/colorop: Export drm_colorop_cleanup() so drivers can extend it Nícolas F. R. A. Prado
2025-09-18  0:43 ` [PATCH RFC v2 12/20] drm/crtc: Track post-blend color pipeline client cap in drm_crtc_state Nícolas F. R. A. Prado
2025-09-19 12:51   ` Louis Chauvet
2025-09-18  0:43 ` [PATCH RFC v2 13/20] drm/mediatek: Support post-blend colorops for gamma and ctm Nícolas F. R. A. Prado
2025-09-18  0:43 ` [PATCH RFC v2 14/20] drm/mediatek: ccorr: Support post-blend color pipeline API Nícolas F. R. A. Prado
2025-09-18  0:43 ` [PATCH RFC v2 15/20] drm/mediatek: gamma: " Nícolas F. R. A. Prado
2025-09-18  0:43 ` [PATCH RFC v2 16/20] drm/mediatek: Set post-blend color pipeline driver cap Nícolas F. R. A. Prado
2025-09-19 12:50   ` Louis Chauvet
2025-09-18  0:43 ` [PATCH RFC v2 17/20] drm/vkms: Rename existing color pipeline helpers to contain "pre_blend" Nícolas F. R. A. Prado
2025-09-19 12:45   ` Louis Chauvet
2025-09-18  0:43 ` [PATCH RFC v2 18/20] drm/vkms: Prepare pre_blend_color_transform() for post-blend pipelines Nícolas F. R. A. Prado
2025-09-19 12:48   ` Louis Chauvet
2025-09-18  0:43 ` [PATCH RFC v2 19/20] drm/vkms: Introduce support for post-blend color pipeline Nícolas F. R. A. Prado
2025-09-19 12:50   ` Louis Chauvet
2025-12-10 21:15     ` Ariel D'Alessandro
2025-09-18  0:43 ` [PATCH RFC v2 20/20] drm/vkms: Set post-blend color pipeline driver cap Nícolas F. R. A. Prado
2025-09-19 12:49   ` Louis Chauvet
2025-09-29 10:22 ` [PATCH RFC v2 00/20] Introduce support for post-blend color pipeline Harry Wentland
2025-09-29 12:05 ` Melissa Wen
2025-09-29 14:25   ` Harry Wentland

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=3c24d55c-76d1-4ba4-9942-fd5d85f9daca@amd.com \
    --to=harry.wentland@amd.com \
    --cc=Liviu.Dudau@arm.com \
    --cc=agoins@nvidia.com \
    --cc=airlied@gmail.com \
    --cc=aleixpol@kde.org \
    --cc=alex.hung@amd.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=chaitanya.kumar.borah@intel.com \
    --cc=chunkuang.hu@kernel.org \
    --cc=contact@emersion.fr \
    --cc=daniels@collabora.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hamohammed.sa@gmail.com \
    --cc=jadahl@redhat.com \
    --cc=joshua@froggi.es \
    --cc=kernel@collabora.com \
    --cc=leandro.ribeiro@collabora.com \
    --cc=leo.liu@amd.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=marcan@marcan.st \
    --cc=matthias.bgg@gmail.com \
    --cc=mcanal@igalia.com \
    --cc=mdaenzer@redhat.com \
    --cc=melissa.srw@gmail.com \
    --cc=mripard@kernel.org \
    --cc=mwen@igalia.com \
    --cc=nfraprado@collabora.com \
    --cc=p.zabel@pengutronix.de \
    --cc=pekka.paalanen@collabora.com \
    --cc=quic_abhinavk@quicinc.com \
    --cc=quic_cbraga@quicinc.com \
    --cc=quic_naseer@quicinc.com \
    --cc=sashamcintosh@google.com \
    --cc=sebastian.wick@redhat.com \
    --cc=shashank.sharma@amd.com \
    --cc=simona.vetter@ffwll.ch \
    --cc=simona@ffwll.ch \
    --cc=tzimmermann@suse.de \
    --cc=uma.shankar@intel.com \
    --cc=victoria@system76.com \
    --cc=ville.syrjala@linux.intel.com \
    --cc=wayland-devel@lists.freedesktop.org \
    --cc=xaver.hugl@gmail.com \
    /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