[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0f3cbb7c-d627-44ed-b400-3b26b2acbde5@bootlin.com>
Date: Fri, 19 Sep 2025 14:43:18 +0200
From: Louis Chauvet <louis.chauvet@...tlin.com>
To: Nícolas F. R. A. Prado <nfraprado@...labora.com>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <mripard@...nel.org>, Thomas Zimmermann <tzimmermann@...e.de>,
David Airlie <airlied@...il.com>, Simona Vetter <simona@...ll.ch>,
Chun-Kuang Hu <chunkuang.hu@...nel.org>,
Philipp Zabel <p.zabel@...gutronix.de>,
Matthias Brugger <matthias.bgg@...il.com>,
AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>,
Haneen Mohammed <hamohammed.sa@...il.com>,
Melissa Wen <melissa.srw@...il.com>
Cc: Alex Hung <alex.hung@....com>, wayland-devel@...ts.freedesktop.org,
harry.wentland@....com, leo.liu@....com, ville.syrjala@...ux.intel.com,
pekka.paalanen@...labora.com, contact@...rsion.fr, mwen@...lia.com,
jadahl@...hat.com, sebastian.wick@...hat.com, shashank.sharma@....com,
agoins@...dia.com, joshua@...ggi.es, mdaenzer@...hat.com, aleixpol@....org,
xaver.hugl@...il.com, victoria@...tem76.com, uma.shankar@...el.com,
quic_naseer@...cinc.com, quic_cbraga@...cinc.com, quic_abhinavk@...cinc.com,
marcan@...can.st, Liviu.Dudau@....com, sashamcintosh@...gle.com,
chaitanya.kumar.borah@...el.com, mcanal@...lia.com, kernel@...labora.com,
daniels@...labora.com, leandro.ribeiro@...labora.com,
dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
linux-mediatek@...ts.infradead.org, linux-arm-kernel@...ts.infradead.org,
Simona Vetter <simona.vetter@...ll.ch>
Subject: Re: [PATCH RFC v2 03/20] drm: Factor out common color_pipeline
property initialization code
Le 18/09/2025 à 02:43, Nícolas F. R. A. Prado a écrit :
> 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@...labora.com>
Reviewed-by: Louis Chauvet <louis.chauvet@...tlin.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)
> +{
> + 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);
>
--
--
Louis Chauvet, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
Powered by blists - more mailing lists