From: "Heiko Stübner" <heiko@sntech.de>
To: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
Maxime Ripard <mripard@kernel.org>
Cc: dri-devel@lists.freedesktop.org,
Maxime Ripard <mripard@kernel.org>,
andy.yan@rock-chips.com, hjc@rock-chips.com,
linux-rockchip@lists.infradead.org
Subject: Re: [PATCH v4 15/41] drm/rockchip: Convert to atomic_create_state
Date: Wed, 09 Sep 2026 12:00:07 +0200 [thread overview]
Message-ID: <10120529.VV5PYv0bhD@diego> (raw)
In-Reply-To: <20260908-drm-no-more-plane-reset-v4-15-a31b3fcfc989@kernel.org>
Am Dienstag, 8. September 2026, 16:46:46 Mitteleuropäische Sommerzeit schrieb Maxime Ripard:
> The plane only initializes a pristine state in its reset hook
> using drm_atomic_helper_plane_reset(), which is equivalent to what
> atomic_create_state expects. Convert to it.
>
> The conversion was done using the following Coccinelle semantic patch:
>
> @@
> identifier funcs;
> symbol drm_atomic_helper_plane_reset;
> symbol drm_atomic_helper_plane_create_state;
> @@
>
> struct drm_plane_funcs funcs = {
> ...,
> - .reset = drm_atomic_helper_plane_reset,
> + .atomic_create_state = drm_atomic_helper_plane_create_state,
> ...,
> };
>
> @match_struct_reset@
> identifier funcs, reset_func;
> @@
> struct drm_plane_funcs funcs = {
> ...,
> .reset = reset_func,
> ...,
> };
>
> @reset_uses_helpers depends on match_struct_reset@
> identifier match_struct_reset.reset_func;
> @@
>
> void reset_func(...)
> {
> <+...
> (
> __drm_atomic_helper_plane_reset(...);
> |
> __drm_gem_reset_shadow_plane(...);
> )
> ...+>
> }
>
> @match_struct_destroy@
> identifier funcs, destroy_func;
> @@
> struct drm_plane_funcs funcs = {
> ...,
> .atomic_destroy_state = destroy_func,
> ...,
> };
>
> @script:python renamed_func@
> old_name << match_struct_reset.reset_func;
> new_name;
> @@
> if old_name.endswith("_reset"):
> coccinelle.new_name = old_name.replace("_reset", "_create_state")
> else:
> coccinelle.new_name = old_name
>
> @update_struct depends on match_struct_reset && reset_uses_helpers@
> identifier match_struct_reset.funcs, match_struct_reset.reset_func;
> identifier renamed_func.new_name;
> @@
> struct drm_plane_funcs funcs = {
> ...,
> - .reset = reset_func,
> + .atomic_create_state = new_name,
> ...,
> };
>
> @drop_destroy depends on update_struct && match_struct_destroy@
> identifier match_struct_reset.reset_func;
> identifier match_struct_destroy.destroy_func;
> identifier container_func;
> identifier P;
> symbol drm_atomic_helper_plane_destroy_state;
> symbol __drm_atomic_helper_plane_destroy_state;
> @@
>
> void reset_func(struct drm_plane *P)
> {
> ...
> (
> - if (P->state) {
> - <+...
> (
> - drm_atomic_helper_plane_destroy_state(P, P->state);
> |
> - __drm_atomic_helper_plane_destroy_state(P->state);
> |
> - P->funcs->atomic_destroy_state(P, P->state);
> |
> - destroy_func(P, P->state);
> )
> - ...+>
> - }
> |
> - drm_WARN_ON_ONCE(P->dev, P->state);
> |
> - WARN_ON(P->state);
> )
> ...
> (
> - kfree(P->state);
> |
> - kfree(container_func(P->state));
> |
> // kfree is optional
> )
> (
> - P->state = NULL;
> |
> // plane->state clearing is optional
> )
> ...
> }
>
> @drop_destroy_mtk depends on update_struct@
> identifier P;
> symbol __drm_atomic_helper_plane_destroy_state;
> symbol to_mtk_plane_state;
> @@
>
> void mtk_plane_reset(struct drm_plane *P)
> {
> ...
> - if (P->state) {
> - __drm_atomic_helper_plane_destroy_state(P->state);
> - ...
> - } else {
> ...
> - }
> ...
> }
>
> @transform_nv50_wndw depends on update_struct@
> identifier S;
> @@
>
> void nv50_wndw_reset(...)
> {
> ...
> - if (WARN_ON(!(S = kzalloc_obj(*S))))
> + S = kzalloc_obj(*S);
> + if (WARN_ON(!S))
> return;
> ...
> }
>
> @transform_kzalloc depends on update_struct@
> identifier match_struct_reset.reset_func;
> identifier P, S;
> statement ST;
> statement list STL;
> @@
>
> void reset_func(struct drm_plane *P)
> {
> <...
> S = kzalloc_obj(*S);
> (
> - if (S)
> - {
> - STL
> - }
> + if (!S) return;
> +
> + STL
> |
> - if (S) ST
> + if (!S) return;
> +
> + ST
> )
> ...>
> }
>
> @transform_body depends on update_struct@
> identifier match_struct_reset.reset_func;
> identifier renamed_func.new_name;
> identifier S, P;
> expression PS;
> @@
> - void reset_func(struct drm_plane *P)
> + struct drm_plane_state *new_name(struct drm_plane *P)
> {
> ...
> S = kzalloc_obj(*S);
> ...
> (
> if (!S) {
> ...
> - return;
> + return ERR_PTR(-ENOMEM);
> }
> |
> if (WARN_ON(!S)) {
> ...
> - return;
> + return ERR_PTR(-ENOMEM);
> }
> |
> if (S == NULL) {
> ...
> - return;
> + return ERR_PTR(-ENOMEM);
> }
> )
> ...
> (
> - __drm_atomic_helper_plane_reset(P, PS);
> + __drm_atomic_helper_plane_state_init(PS, P);
> |
> - __drm_gem_reset_shadow_plane(P, PS);
> + __drm_gem_shadow_plane_state_init(P, PS);
> )
> ...
> }
>
> @update_early_return depends on update_struct@
> identifier match_struct_reset.reset_func;
> identifier renamed_func.new_name;
> identifier P;
> expression PS;
> @@
> struct drm_plane_state *new_name(struct drm_plane *P)
> {
> <+...
> - return;
> + return ERR_PTR(-EINVAL);
> ...+>
> }
>
> @update_return_plane depends on update_struct@
> identifier match_struct_reset.reset_func;
> identifier renamed_func.new_name;
> identifier P;
> expression PS;
> @@
> struct drm_plane_state *new_name(struct drm_plane *P)
> {
> ...
> __drm_atomic_helper_plane_state_init(PS, P);
> ...
> +
> + return PS;
> }
>
> @update_return_shadow depends on update_struct@
> identifier renamed_func.new_name;
> identifier P;
> expression PS;
> @@
> struct drm_plane_state *new_name(struct drm_plane *P)
> {
> ...
> __drm_gem_shadow_plane_state_init(P, PS);
> ...
> +
> + return &PS->base;
> }
>
> Signed-off-by: Maxime Ripard <mripard@kernel.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
WARNING: multiple messages have this Message-ID (diff)
From: "Heiko Stübner" <heiko@sntech.de>
To: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
Maxime Ripard <mripard@kernel.org>
Cc: dri-devel@lists.freedesktop.org,
Maxime Ripard <mripard@kernel.org>,
andy.yan@rock-chips.com, hjc@rock-chips.com,
linux-rockchip@lists.infradead.org
Subject: Re: [PATCH v4 15/41] drm/rockchip: Convert to atomic_create_state
Date: Wed, 09 Sep 2026 12:00:07 +0200 [thread overview]
Message-ID: <10120529.VV5PYv0bhD@diego> (raw)
In-Reply-To: <20260908-drm-no-more-plane-reset-v4-15-a31b3fcfc989@kernel.org>
Am Dienstag, 8. September 2026, 16:46:46 Mitteleuropäische Sommerzeit schrieb Maxime Ripard:
> The plane only initializes a pristine state in its reset hook
> using drm_atomic_helper_plane_reset(), which is equivalent to what
> atomic_create_state expects. Convert to it.
>
> The conversion was done using the following Coccinelle semantic patch:
>
> @@
> identifier funcs;
> symbol drm_atomic_helper_plane_reset;
> symbol drm_atomic_helper_plane_create_state;
> @@
>
> struct drm_plane_funcs funcs = {
> ...,
> - .reset = drm_atomic_helper_plane_reset,
> + .atomic_create_state = drm_atomic_helper_plane_create_state,
> ...,
> };
>
> @match_struct_reset@
> identifier funcs, reset_func;
> @@
> struct drm_plane_funcs funcs = {
> ...,
> .reset = reset_func,
> ...,
> };
>
> @reset_uses_helpers depends on match_struct_reset@
> identifier match_struct_reset.reset_func;
> @@
>
> void reset_func(...)
> {
> <+...
> (
> __drm_atomic_helper_plane_reset(...);
> |
> __drm_gem_reset_shadow_plane(...);
> )
> ...+>
> }
>
> @match_struct_destroy@
> identifier funcs, destroy_func;
> @@
> struct drm_plane_funcs funcs = {
> ...,
> .atomic_destroy_state = destroy_func,
> ...,
> };
>
> @script:python renamed_func@
> old_name << match_struct_reset.reset_func;
> new_name;
> @@
> if old_name.endswith("_reset"):
> coccinelle.new_name = old_name.replace("_reset", "_create_state")
> else:
> coccinelle.new_name = old_name
>
> @update_struct depends on match_struct_reset && reset_uses_helpers@
> identifier match_struct_reset.funcs, match_struct_reset.reset_func;
> identifier renamed_func.new_name;
> @@
> struct drm_plane_funcs funcs = {
> ...,
> - .reset = reset_func,
> + .atomic_create_state = new_name,
> ...,
> };
>
> @drop_destroy depends on update_struct && match_struct_destroy@
> identifier match_struct_reset.reset_func;
> identifier match_struct_destroy.destroy_func;
> identifier container_func;
> identifier P;
> symbol drm_atomic_helper_plane_destroy_state;
> symbol __drm_atomic_helper_plane_destroy_state;
> @@
>
> void reset_func(struct drm_plane *P)
> {
> ...
> (
> - if (P->state) {
> - <+...
> (
> - drm_atomic_helper_plane_destroy_state(P, P->state);
> |
> - __drm_atomic_helper_plane_destroy_state(P->state);
> |
> - P->funcs->atomic_destroy_state(P, P->state);
> |
> - destroy_func(P, P->state);
> )
> - ...+>
> - }
> |
> - drm_WARN_ON_ONCE(P->dev, P->state);
> |
> - WARN_ON(P->state);
> )
> ...
> (
> - kfree(P->state);
> |
> - kfree(container_func(P->state));
> |
> // kfree is optional
> )
> (
> - P->state = NULL;
> |
> // plane->state clearing is optional
> )
> ...
> }
>
> @drop_destroy_mtk depends on update_struct@
> identifier P;
> symbol __drm_atomic_helper_plane_destroy_state;
> symbol to_mtk_plane_state;
> @@
>
> void mtk_plane_reset(struct drm_plane *P)
> {
> ...
> - if (P->state) {
> - __drm_atomic_helper_plane_destroy_state(P->state);
> - ...
> - } else {
> ...
> - }
> ...
> }
>
> @transform_nv50_wndw depends on update_struct@
> identifier S;
> @@
>
> void nv50_wndw_reset(...)
> {
> ...
> - if (WARN_ON(!(S = kzalloc_obj(*S))))
> + S = kzalloc_obj(*S);
> + if (WARN_ON(!S))
> return;
> ...
> }
>
> @transform_kzalloc depends on update_struct@
> identifier match_struct_reset.reset_func;
> identifier P, S;
> statement ST;
> statement list STL;
> @@
>
> void reset_func(struct drm_plane *P)
> {
> <...
> S = kzalloc_obj(*S);
> (
> - if (S)
> - {
> - STL
> - }
> + if (!S) return;
> +
> + STL
> |
> - if (S) ST
> + if (!S) return;
> +
> + ST
> )
> ...>
> }
>
> @transform_body depends on update_struct@
> identifier match_struct_reset.reset_func;
> identifier renamed_func.new_name;
> identifier S, P;
> expression PS;
> @@
> - void reset_func(struct drm_plane *P)
> + struct drm_plane_state *new_name(struct drm_plane *P)
> {
> ...
> S = kzalloc_obj(*S);
> ...
> (
> if (!S) {
> ...
> - return;
> + return ERR_PTR(-ENOMEM);
> }
> |
> if (WARN_ON(!S)) {
> ...
> - return;
> + return ERR_PTR(-ENOMEM);
> }
> |
> if (S == NULL) {
> ...
> - return;
> + return ERR_PTR(-ENOMEM);
> }
> )
> ...
> (
> - __drm_atomic_helper_plane_reset(P, PS);
> + __drm_atomic_helper_plane_state_init(PS, P);
> |
> - __drm_gem_reset_shadow_plane(P, PS);
> + __drm_gem_shadow_plane_state_init(P, PS);
> )
> ...
> }
>
> @update_early_return depends on update_struct@
> identifier match_struct_reset.reset_func;
> identifier renamed_func.new_name;
> identifier P;
> expression PS;
> @@
> struct drm_plane_state *new_name(struct drm_plane *P)
> {
> <+...
> - return;
> + return ERR_PTR(-EINVAL);
> ...+>
> }
>
> @update_return_plane depends on update_struct@
> identifier match_struct_reset.reset_func;
> identifier renamed_func.new_name;
> identifier P;
> expression PS;
> @@
> struct drm_plane_state *new_name(struct drm_plane *P)
> {
> ...
> __drm_atomic_helper_plane_state_init(PS, P);
> ...
> +
> + return PS;
> }
>
> @update_return_shadow depends on update_struct@
> identifier renamed_func.new_name;
> identifier P;
> expression PS;
> @@
> struct drm_plane_state *new_name(struct drm_plane *P)
> {
> ...
> __drm_gem_shadow_plane_state_init(P, PS);
> ...
> +
> + return &PS->base;
> }
>
> Signed-off-by: Maxime Ripard <mripard@kernel.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
next prev parent reply other threads:[~2026-09-09 10:00 UTC|newest]
Thread overview: 60+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-08 14:46 [PATCH v4 00/41] drm/plane: Convert all drivers to atomic_create_state and remove reset Maxime Ripard
2026-09-08 14:46 ` Maxime Ripard
2026-09-08 14:46 ` [PATCH v4 01/41] drm/simple-kms: Remove unused reset_plane hook Maxime Ripard
2026-09-10 6:30 ` Thomas Zimmermann
2026-09-08 14:46 ` [PATCH v4 02/41] drm/vkms: Move frame_info into vkms_plane_state Maxime Ripard
2026-09-10 6:33 ` Thomas Zimmermann
2026-09-08 14:46 ` [PATCH v4 03/41] drm/vkms: Convert to atomic_create_state Maxime Ripard
2026-09-08 14:46 ` [PATCH v4 04/41] drm/gem-atomic-helper: Remove __drm_gem_reset_shadow_plane() Maxime Ripard
2026-09-08 14:46 ` [PATCH v4 05/41] drm/amdgpu: Convert to atomic_create_state Maxime Ripard
2026-09-08 14:46 ` [PATCH v4 06/41] drm/fsl-dcu: " Maxime Ripard
2026-09-08 14:46 ` [PATCH v4 07/41] drm/hisilicon/kirin: " Maxime Ripard
2026-09-08 14:46 ` [PATCH v4 08/41] drm/imx/dc: " Maxime Ripard
2026-09-08 14:46 ` [PATCH v4 09/41] drm/kmb: " Maxime Ripard
2026-09-08 14:46 ` [PATCH v4 10/41] drm/logicvc: " Maxime Ripard
2026-09-08 14:46 ` [PATCH v4 11/41] drm/loongson: " Maxime Ripard
2026-09-08 14:46 ` [PATCH v4 12/41] drm/lcdif: " Maxime Ripard
2026-09-08 14:46 ` [PATCH v4 13/41] drm/mxsfb: " Maxime Ripard
2026-09-08 14:46 ` [PATCH v4 14/41] drm/qxl: " Maxime Ripard
2026-09-08 14:46 ` [PATCH v4 15/41] drm/rockchip: " Maxime Ripard
2026-09-08 14:46 ` Maxime Ripard
2026-09-09 10:00 ` Heiko Stübner [this message]
2026-09-09 10:00 ` Heiko Stübner
2026-09-08 14:46 ` [PATCH v4 16/41] drm/sprd: " Maxime Ripard
2026-09-08 14:46 ` [PATCH v4 17/41] drm/sti: " Maxime Ripard
2026-09-08 14:46 ` [PATCH v4 18/41] drm/stm: " Maxime Ripard
2026-09-08 14:46 ` [PATCH v4 19/41] drm/tests: kunit: " Maxime Ripard
2026-09-08 14:46 ` [PATCH v4 20/41] drm/tilcdc: " Maxime Ripard
2026-09-08 14:46 ` [PATCH v4 21/41] drm/vboxvideo: " Maxime Ripard
2026-09-08 14:46 ` [PATCH v4 22/41] drm/verisilicon: " Maxime Ripard
2026-09-08 14:46 ` [PATCH v4 23/41] drm/virtio: " Maxime Ripard
2026-09-08 14:46 ` [PATCH v4 24/41] drm/xlnx: " Maxime Ripard
2026-09-08 14:46 ` [PATCH v4 25/41] drm/atomic-state-helper: Remove drm_atomic_helper_plane_reset() Maxime Ripard
2026-09-08 14:46 ` [PATCH v4 26/41] drm/amdgpu_dm: Convert to atomic_create_state Maxime Ripard
2026-09-10 16:31 ` Leo Li
2026-09-08 14:46 ` [PATCH v4 27/41] drm/armada: " Maxime Ripard
2026-09-08 14:46 ` [PATCH v4 28/41] drm/atmel-hlcdc: Drop spurious csc_init call from reset Maxime Ripard
2026-09-10 6:48 ` Thomas Zimmermann
2026-09-08 14:47 ` [PATCH v4 29/41] drm/atmel-hlcdc: Convert to atomic_create_state Maxime Ripard
2026-09-08 14:47 ` [PATCH v4 30/41] drm/exynos: " Maxime Ripard
2026-09-08 14:47 ` [PATCH v4 31/41] drm/imx/ipuv3: " Maxime Ripard
2026-09-08 14:47 ` [PATCH v4 32/41] drm/mediatek: " Maxime Ripard
2026-09-10 6:54 ` Thomas Zimmermann
2026-09-08 14:47 ` [PATCH v4 33/41] drm/nouveau: " Maxime Ripard
2026-09-08 14:47 ` Maxime Ripard
2026-09-10 6:55 ` Thomas Zimmermann
2026-09-10 6:55 ` Thomas Zimmermann
2026-09-08 14:47 ` [PATCH v4 34/41] drm/omap: " Maxime Ripard
2026-09-08 14:47 ` [PATCH v4 35/41] drm/rcar-du: " Maxime Ripard
2026-09-10 6:57 ` Thomas Zimmermann
2026-09-10 12:00 ` Laurent Pinchart
2026-09-08 14:47 ` [PATCH v4 36/41] drm/rz-du: " Maxime Ripard
2026-09-08 14:47 ` [PATCH v4 37/41] drm/shmobile: " Maxime Ripard
2026-09-10 6:58 ` Thomas Zimmermann
2026-09-08 14:47 ` [PATCH v4 38/41] drm/sun4i: layer: " Maxime Ripard
2026-09-08 14:47 ` [PATCH v4 39/41] drm/vmwgfx: " Maxime Ripard
2026-09-10 7:00 ` Thomas Zimmermann
2026-09-08 14:47 ` [PATCH v4 40/41] drm/atomic-state-helper: Remove __drm_atomic_helper_plane_reset() Maxime Ripard
2026-09-08 14:47 ` [PATCH v4 41/41] drm/plane: Remove reset Maxime Ripard
2026-09-10 7:03 ` [PATCH v4 00/41] drm/plane: Convert all drivers to atomic_create_state and remove reset Thomas Zimmermann
2026-09-10 7:03 ` Thomas Zimmermann
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=10120529.VV5PYv0bhD@diego \
--to=heiko@sntech.de \
--cc=airlied@gmail.com \
--cc=andy.yan@rock-chips.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=hjc@rock-chips.com \
--cc=linux-rockchip@lists.infradead.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=simona@ffwll.ch \
--cc=tzimmermann@suse.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.