Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/nouveau/dispnv50: Don't call drm_atomic_get_crtc_state() in prepare_fb

Since we recently started warning about uses of this function after the
atomic check phase completes, we've started getting warnings about this in
nouveau. It appears a misplaced drm_atomic_get_crtc_state() call has been
hiding in our .prepare_fb callback for a while.

So, fix this by adding a new nv50_head_atom_get_new() function and use that
in our .prepare_fb callback instead.

Signed-off-by: Lyude Paul <lyude@redhat.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Fixes: 1590700d94ac ("drm/nouveau/kms/nv50-: split each resource type into their own source files")
Cc: <stable@vger.kernel.org> # v4.18+
Link: https://patch.msgid.link/20251211190256.396742-1-lyude@redhat.com

+14 -1
+13
drivers/gpu/drm/nouveau/dispnv50/atom.h
··· 152 152 nv50_head_atom_get(struct drm_atomic_state *state, struct drm_crtc *crtc) 153 153 { 154 154 struct drm_crtc_state *statec = drm_atomic_get_crtc_state(state, crtc); 155 + 155 156 if (IS_ERR(statec)) 156 157 return (void *)statec; 158 + 159 + return nv50_head_atom(statec); 160 + } 161 + 162 + static inline struct nv50_head_atom * 163 + nv50_head_atom_get_new(struct drm_atomic_state *state, struct drm_crtc *crtc) 164 + { 165 + struct drm_crtc_state *statec = drm_atomic_get_new_crtc_state(state, crtc); 166 + 167 + if (!statec) 168 + return NULL; 169 + 157 170 return nv50_head_atom(statec); 158 171 } 159 172
+1 -1
drivers/gpu/drm/nouveau/dispnv50/wndw.c
··· 583 583 asyw->image.offset[0] = nvbo->offset; 584 584 585 585 if (wndw->func->prepare) { 586 - asyh = nv50_head_atom_get(asyw->state.state, asyw->state.crtc); 586 + asyh = nv50_head_atom_get_new(asyw->state.state, asyw->state.crtc); 587 587 if (IS_ERR(asyh)) 588 588 return PTR_ERR(asyh); 589 589