On 09/07/26 08:51, Maxime Ripard wrote:
The plane reset implementation creates a custom state
subclass, but only initializes a pristine state without resetting any
hardware. This is equivalent to what atomic_create_state expects.
Convert to it.
The conversion was done using the following Coccinelle semantic patch:
[...]
Signed-off-by: Maxime Ripard <[email protected]>
Reviewed-by: Maíra Canal <[email protected]>
Best regards,
- Maíra
---
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
drivers/gpu/drm/vc4/vc4_plane.c | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/drivers/gpu/drm/vc4/vc4_plane.c b/drivers/gpu/drm/vc4/vc4_plane.c
index 6c433270214d..20c9fc9283a8 100644
--- a/drivers/gpu/drm/vc4/vc4_plane.c
+++ b/drivers/gpu/drm/vc4/vc4_plane.c
@@ -361,24 +361,21 @@ static void vc4_plane_destroy_state(struct drm_plane
*plane,
__drm_atomic_helper_plane_destroy_state(&vc4_state->base);
kfree(state);
}
/* Called during init to allocate the plane's atomic state. */
-static void vc4_plane_reset(struct drm_plane *plane)
+static struct drm_plane_state *vc4_plane_create_state(struct drm_plane *plane)
{
struct vc4_plane_state *vc4_state;
- if (plane->state)
- __drm_atomic_helper_plane_destroy_state(plane->state);
-
- kfree(plane->state);
-
vc4_state = kzalloc_obj(*vc4_state);
if (!vc4_state)
- return;
+ return ERR_PTR(-ENOMEM);
- __drm_atomic_helper_plane_reset(plane, &vc4_state->base);
+ __drm_atomic_helper_plane_state_init(&vc4_state->base, plane);
+
+ return &vc4_state->base;
}
static void vc4_dlist_counter_increment(struct vc4_plane_state *vc4_state)
{
if (vc4_state->dlist_count == vc4_state->dlist_size) {
@@ -2493,11 +2490,11 @@ static bool vc4_format_mod_supported(struct drm_plane
*plane,
}
static const struct drm_plane_funcs vc4_plane_funcs = {
.update_plane = drm_atomic_helper_update_plane,
.disable_plane = drm_atomic_helper_disable_plane,
- .reset = vc4_plane_reset,
+ .atomic_create_state = vc4_plane_create_state,
.atomic_duplicate_state = vc4_plane_duplicate_state,
.atomic_destroy_state = vc4_plane_destroy_state,
.format_mod_supported = vc4_format_mod_supported,
};