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 fa4f601dd0c8..a53ba72dd205 100644 --- a/drivers/gpu/drm/verisilicon/vs_cursor_plane.c +++ b/drivers/gpu/drm/verisilicon/vs_cursor_plane.c @@ -227,14 +227,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 d81f7b8f4c65..47e5df6c951a 100644 --- a/drivers/gpu/drm/verisilicon/vs_plane.c +++ b/drivers/gpu/drm/verisilicon/vs_plane.c @@ -154,21 +154,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 32ed1d70f3b8..5d97c59ea7a0 100644 --- a/drivers/gpu/drm/verisilicon/vs_plane.h +++ b/drivers/gpu/drm/verisilicon/vs_plane.h @@ -79,11 +79,11 @@ dma_addr_t vs_fb_get_dma_addr(struct drm_framebuffer *fb, const struct drm_rect *src_rect); 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 1f2be41ae496..4eef28d5ff2d 100644 --- a/drivers/gpu/drm/verisilicon/vs_primary_plane.c +++ b/drivers/gpu/drm/verisilicon/vs_primary_plane.c @@ -153,14 +153,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.54.0
