drm_simple_kms_plane_reset() handled three cases: delegating to reset_plane, using create_plane_state with manual teardown, or falling back to the default helper. This complexity existed to bridge the old reset hook with the new create_plane_state hook during the transition.
Now that all simple-kms drivers implement create_plane_state instead of reset_plane, replace drm_simple_kms_plane_reset() with drm_simple_kms_plane_create_state() which only dispatches between create_plane_state and drm_atomic_helper_plane_create_state(). Wire it to .atomic_create_state instead of .reset. Signed-off-by: Maxime Ripard <[email protected]> --- drivers/gpu/drm/drm_simple_kms_helper.c | 30 ++++++------------------------ 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/drivers/gpu/drm/drm_simple_kms_helper.c b/drivers/gpu/drm/drm_simple_kms_helper.c index efb643ab6448..c99ff74dca92 100644 --- a/drivers/gpu/drm/drm_simple_kms_helper.c +++ b/drivers/gpu/drm/drm_simple_kms_helper.c @@ -279,38 +279,20 @@ static const struct drm_plane_helper_funcs drm_simple_kms_plane_helper_funcs = { .end_fb_access = drm_simple_kms_plane_end_fb_access, .atomic_check = drm_simple_kms_plane_atomic_check, .atomic_update = drm_simple_kms_plane_atomic_update, }; -static void drm_simple_kms_plane_reset(struct drm_plane *plane) +static struct drm_plane_state * +drm_simple_kms_plane_create_state(struct drm_plane *plane) { struct drm_simple_display_pipe *pipe; pipe = container_of(plane, struct drm_simple_display_pipe, plane); - if (!pipe->funcs) - return drm_atomic_helper_plane_reset(plane); + if (!pipe->funcs || !pipe->funcs->create_plane_state) + return drm_atomic_helper_plane_create_state(plane); - if (pipe->funcs->reset_plane) - return pipe->funcs->reset_plane(pipe); - - if (pipe->funcs->create_plane_state) { - struct drm_plane_state *state; - - if (plane->state) { - pipe->funcs->destroy_plane_state(pipe, plane->state); - plane->state = NULL; - } - - state = pipe->funcs->create_plane_state(pipe); - if (WARN_ON(IS_ERR(state))) - return; - - plane->state = state; - return; - } - - return drm_atomic_helper_plane_reset(plane); + return pipe->funcs->create_plane_state(pipe); } static struct drm_plane_state *drm_simple_kms_plane_duplicate_state(struct drm_plane *plane) { struct drm_simple_display_pipe *pipe; @@ -336,11 +318,11 @@ static void drm_simple_kms_plane_destroy_state(struct drm_plane *plane, static const struct drm_plane_funcs drm_simple_kms_plane_funcs = { .update_plane = drm_atomic_helper_update_plane, .disable_plane = drm_atomic_helper_disable_plane, .destroy = drm_plane_cleanup, - .reset = drm_simple_kms_plane_reset, + .atomic_create_state = drm_simple_kms_plane_create_state, .atomic_duplicate_state = drm_simple_kms_plane_duplicate_state, .atomic_destroy_state = drm_simple_kms_plane_destroy_state, .format_mod_supported = drm_simple_kms_format_mod_supported, }; -- 2.54.0
