[PATCH V10 13/46] drm/colorop: Add destroy functions for color pipeline
Nícolas F. R. A. Prado
nfraprado at collabora.com
Thu Jul 31 22:11:33 UTC 2025
On Mon, 2025-06-16 at 22:16 -0600, Alex Hung wrote:
> The functions are to clean up color pipeline when a device driver
> fails to create its color pipeline.
>
> Signed-off-by: Alex Hung <alex.hung at amd.com>
> Reviewed-by: Daniel Stone <daniels at collabora.com>
> Reviewed-by: Simon Ser <contact at emersion.fr>
> Reviewed-by: Melissa Wen <mwen at igalia.com>
> ---
> v9:
> - Move from from latest commit to here, and
> drm_colorop_pipeline_destroy
> is called in respective commits.
>
> drivers/gpu/drm/drm_colorop.c | 36
> +++++++++++++++++++++++++++++++++++
> include/drm/drm_colorop.h | 2 ++
> 2 files changed, 38 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_colorop.c
> b/drivers/gpu/drm/drm_colorop.c
> index 7b3ecf7ddd11..57a8c1063fdd 100644
> --- a/drivers/gpu/drm/drm_colorop.c
> +++ b/drivers/gpu/drm/drm_colorop.c
> @@ -135,6 +135,42 @@ static int drm_plane_colorop_init(struct
> drm_device *dev, struct drm_colorop *co
> return ret;
> }
>
> +/**
> + * drm_colorop_cleanup - Cleanup a drm_colorop object in
> color_pipeline
> + *
> + * @colorop: The drm_colorop object to be cleaned
> + */
> +static void drm_colorop_cleanup(struct drm_colorop *colorop)
> +{
> + struct drm_device *dev = colorop->dev;
> + struct drm_mode_config *config = &dev->mode_config;
> +
> + list_del(&colorop->head);
> + config->num_colorop--;
> +
> + kfree(colorop->state);
> +}
> +
> +/**
> + * drm_colorop_pipeline_destroy - Helper for color pipeline
> destruction
> + *
> + * @plane: - The drm_plane structure containing the color_pipeline
> + *
> + * Provides a default color pipeline destroy handler for a planes.
> + */
> +void drm_colorop_pipeline_destroy(struct drm_plane *plane)
> +{
This function implies it only cleans up the colorops in the color
pipeline of a specific plane, but it actually cleans up all colorops in
the drm_mode_config of a device.
--
Thanks,
Nícolas
> + struct drm_device *dev = plane->dev;
> + struct drm_mode_config *config = &dev->mode_config;
> + struct drm_colorop *colorop, *next;
> +
> + list_for_each_entry_safe(colorop, next, &config-
> >colorop_list, head) {
> + drm_colorop_cleanup(colorop);
> + kfree(colorop);
> + }
> +}
> +EXPORT_SYMBOL(drm_colorop_pipeline_destroy);
> +
More information about the dri-devel
mailing list