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.

Signed-off-by: Maxime Ripard <[email protected]>
---
Cc: [email protected]
---
 drivers/gpu/drm/verisilicon/vs_cursor_plane.c  |  2 +-
 drivers/gpu/drm/verisilicon/vs_plane.c         | 14 +++++---------
 drivers/gpu/drm/verisilicon/vs_plane.h         |  2 +-
 drivers/gpu/drm/verisilicon/vs_primary_plane.c |  2 +-
 4 files changed, 8 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/verisilicon/vs_cursor_plane.c 
b/drivers/gpu/drm/verisilicon/vs_cursor_plane.c
index 05e7a04e614c..6a7fd9e179bb 100644
--- a/drivers/gpu/drm/verisilicon/vs_cursor_plane.c
+++ b/drivers/gpu/drm/verisilicon/vs_cursor_plane.c
@@ -229,14 +229,14 @@ static const struct drm_plane_helper_funcs 
vs_cursor_plane_helper_funcs = {
        .atomic_enable  = vs_cursor_plane_atomic_enable,
        .atomic_disable = vs_cursor_plane_atomic_disable,
 };
 
 static const struct drm_plane_funcs vs_cursor_plane_funcs = {
+       .atomic_create_state    = drm_atomic_helper_plane_create_state,
        .atomic_destroy_state   = drm_atomic_helper_plane_destroy_state,
        .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
        .disable_plane          = drm_atomic_helper_disable_plane,
-       .reset                  = drm_atomic_helper_plane_reset,
        .update_plane           = drm_atomic_helper_update_plane,
 };
 
 static const u32 vs_cursor_plane_formats[] = {
        DRM_FORMAT_ARGB8888,
diff --git a/drivers/gpu/drm/verisilicon/vs_plane.c 
b/drivers/gpu/drm/verisilicon/vs_plane.c
index 38b8b536eccb..864b54121b95 100644
--- a/drivers/gpu/drm/verisilicon/vs_plane.c
+++ b/drivers/gpu/drm/verisilicon/vs_plane.c
@@ -134,21 +134,17 @@ void vs_plane_destroy_state(struct drm_plane *plane,
        __drm_atomic_helper_plane_destroy_state(state);
        kfree(state);
 }
 
 /* Called during init to allocate the plane's atomic state. */
-void vs_plane_reset(struct drm_plane *plane)
+struct drm_plane_state *vs_plane_create_state(struct drm_plane *plane)
 {
        struct vs_plane_state *vs_state;
 
-       if (plane->state) {
-               __drm_atomic_helper_plane_destroy_state(plane->state);
-               kfree(plane->state);
-               plane->state = NULL;
-       }
-
        vs_state = kzalloc_obj(*vs_state, GFP_KERNEL);
        if (!vs_state)
-               return;
+               return ERR_PTR(-ENOMEM);
 
-       __drm_atomic_helper_plane_reset(plane, &vs_state->base);
+       __drm_atomic_helper_plane_state_init(&vs_state->base, plane);
+
+       return &vs_state->base;
 }
diff --git a/drivers/gpu/drm/verisilicon/vs_plane.h 
b/drivers/gpu/drm/verisilicon/vs_plane.h
index e4f82f1fc6e9..b4ce14098aa3 100644
--- a/drivers/gpu/drm/verisilicon/vs_plane.h
+++ b/drivers/gpu/drm/verisilicon/vs_plane.h
@@ -77,11 +77,11 @@ static inline struct vs_plane_state 
*to_vs_plane_state(struct drm_plane_state *s
 int drm_format_to_vs_format(u32 drm_format, struct vs_format *vs_format);
 
 struct drm_plane_state *vs_plane_duplicate_state(struct drm_plane *plane);
 void vs_plane_destroy_state(struct drm_plane *plane,
                            struct drm_plane_state *state);
-void vs_plane_reset(struct drm_plane *plane);
+struct drm_plane_state *vs_plane_create_state(struct drm_plane *plane);
 
 struct drm_plane *vs_primary_plane_init(struct drm_device *dev, struct vs_dc 
*dc);
 struct drm_plane *vs_cursor_plane_init(struct drm_device *dev, struct vs_dc 
*dc);
 
 #endif /* _VS_PLANE_H_ */
diff --git a/drivers/gpu/drm/verisilicon/vs_primary_plane.c 
b/drivers/gpu/drm/verisilicon/vs_primary_plane.c
index 2750016a7f2c..20a820f1ef30 100644
--- a/drivers/gpu/drm/verisilicon/vs_primary_plane.c
+++ b/drivers/gpu/drm/verisilicon/vs_primary_plane.c
@@ -158,14 +158,14 @@ static const struct drm_plane_helper_funcs 
vs_primary_plane_helper_funcs = {
        .atomic_enable  = vs_primary_plane_atomic_enable,
        .atomic_disable = vs_primary_plane_atomic_disable,
 };
 
 static const struct drm_plane_funcs vs_primary_plane_funcs = {
+       .atomic_create_state    = vs_plane_create_state,
        .atomic_destroy_state   = vs_plane_destroy_state,
        .atomic_duplicate_state = vs_plane_duplicate_state,
        .disable_plane          = drm_atomic_helper_disable_plane,
-       .reset                  = vs_plane_reset,
        .update_plane           = drm_atomic_helper_update_plane,
 };
 
 struct drm_plane *vs_primary_plane_init(struct drm_device *drm_dev, struct 
vs_dc *dc)
 {

-- 
2.55.0

Reply via email to