From 539660ab4749008a224766a47c614a96bd52f75e Mon Sep 17 00:00:00 2001 From: Maxime Ripard Date: Fri, 21 Aug 2026 16:39:33 +0200 Subject: [PATCH] drm/nouveau: Convert to atomic_create_state The nouveau nv50 head implementation provides a custom reset hook. However, this hook only allocates the state, initializes it with __drm_atomic_helper_crtc_reset(), and frees the previous state. It does not perform any hardware reset. Since this is exactly what the atomic_create_state hook is meant to do, minus the old state cleanup which the caller handles, convert the implementation to use atomic_create_state with __drm_atomic_helper_crtc_state_init() instead. Reviewed-by: Lyude Paul Reviewed-by: Thomas Zimmermann Link: https://patch.msgid.link/20260821-drm-no-more-crtc-reset-v1-57-fb793475c05a@kernel.org Signed-off-by: Maxime Ripard --- drivers/gpu/drm/nouveau/dispnv50/head.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/nouveau/dispnv50/head.c b/drivers/gpu/drm/nouveau/dispnv50/head.c index 1affa0378bd0..6a3a93de0cbf 100644 --- a/drivers/gpu/drm/nouveau/dispnv50/head.c +++ b/drivers/gpu/drm/nouveau/dispnv50/head.c @@ -491,18 +491,16 @@ nv50_head_atomic_duplicate_state(struct drm_crtc *crtc) return &asyh->state; } -static void -nv50_head_reset(struct drm_crtc *crtc) +static struct drm_crtc_state *nv50_head_create_state(struct drm_crtc *crtc) { struct nv50_head_atom *asyh; if (WARN_ON(!(asyh = kzalloc_obj(*asyh)))) - return; + return ERR_PTR(-ENOMEM); - if (crtc->state) - nv50_head_atomic_destroy_state(crtc, crtc->state); + __drm_atomic_helper_crtc_state_init(&asyh->state, crtc); - __drm_atomic_helper_crtc_reset(crtc, &asyh->state); + return &asyh->state; } static int @@ -525,7 +523,7 @@ nv50_head_destroy(struct drm_crtc *crtc) static const struct drm_crtc_funcs nv50_head_func = { - .reset = nv50_head_reset, + .atomic_create_state = nv50_head_create_state, .destroy = nv50_head_destroy, .set_config = drm_atomic_helper_set_config, .page_flip = drm_atomic_helper_page_flip, @@ -539,7 +537,7 @@ nv50_head_func = { static const struct drm_crtc_funcs nvd9_head_func = { - .reset = nv50_head_reset, + .atomic_create_state = nv50_head_create_state, .destroy = nv50_head_destroy, .set_config = drm_atomic_helper_set_config, .page_flip = drm_atomic_helper_page_flip,