Skip to contentSkip to conversation

nouveau: use proper atomic accessor to get crtc state

PATCH In review Dave Airlie 2 participants 2 messages Nov 30, 2025 – Dec 3, 2025

Subsystems (3)
lore
Share & tools
lore

Dave Airlie

author maintainer
#0 lore raw

PATCH 1/1 nouveau: use proper atomic accessor to get crtc state

From: Dave Airlie <[email protected]>

This gets the crtc state from the current state, instead of trying to lookup or create a state.

atomic core started warning about this recently.

Fixes 0a0e79a2d9ed ("drm/atomic: WARN about invalid drm_foo_get_state() usage")
---
 drivers/gpu/drm/nouveau/dispnv50/atom.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/nouveau/dispnv50/atom.h +1 -1
index 93f8f4f64578..ada8fb6f1a9a 100644
@@ -151,7 +151,7 @@ struct nv50_head_atom {
 static inline struct nv50_head_atom *
 nv50_head_atom_get(struct drm_atomic_state *state, struct drm_crtc *crtc)
 {
-	struct drm_crtc_state *statec = drm_atomic_get_crtc_state(state, crtc);
+	struct drm_crtc_state *statec = drm_atomic_get_new_crtc_state(state, crtc);
 	if (IS_ERR(statec))
 		return (void *)statec;
 	return nv50_head_atom(statec);
Signature · 1 line
2.51.1
#1 lore raw
Quoted 18 lines · Dave Airlie

From: Dave Airlie <[email protected]>

This gets the crtc state from the current state, instead of trying to lookup or create a state.

atomic core started warning about this recently.

Fixes 0a0e79a2d9ed ("drm/atomic: WARN about invalid drm_foo_get_state() usage")
---
 drivers/gpu/drm/nouveau/dispnv50/atom.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/nouveau/dispnv50/atom.h +0 -0
index 93f8f4f64578..ada8fb6f1a9a 100644

drivers/gpu/drm/nouveau/dispnv50/atom.h struct nv50_head_atom { · line 155

Quoted 6 lines
drivers/gpu/drm/nouveau/dispnv50/atom.h +1 -1
@@ -151,7 +151,7 @@ struct nv50_head_atom {
 static inline struct nv50_head_atom *
 nv50_head_atom_get(struct drm_atomic_state *state, struct drm_crtc *crtc)
 {
-	struct drm_crtc_state *statec = drm_atomic_get_crtc_state(state, crtc);
+	struct drm_crtc_state *statec = drm_atomic_get_new_crtc_state(state, crtc);
 	if (IS_ERR(statec))

drm_atomic_get_new_crtc_state() will never return an error. It's either a valid pointer or NULL.

The somewhat oddball terminology used in the nouveau code makes it a bit hard to read, but to me it looks like this this is only used to get the crtc state for a plane's old/new crtc. Those should always be included in the atomic state along with the plane itself, so I *think* you could just nuke all the error checks in the callers and not bother with any NULL checks.

Quoted 4 lines
drivers/gpu/drm/nouveau/dispnv50/atom.h +0 -0
 		return (void *)statec;
 	return nv50_head_atom(statec);
Signature · 1 line
2.51.1
Signature · 2 lines
Ville Syrjälä
Intel