All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nouveau: use proper atomic accessor to get crtc state
@ 2025-11-30 21:42 Dave Airlie
  2025-12-03 12:27 ` Ville Syrjälä
  0 siblings, 1 reply; 2+ messages in thread
From: Dave Airlie @ 2025-11-30 21:42 UTC (permalink / raw)
  To: dri-devel; +Cc: nouveau

From: Dave Airlie <airlied@redhat.com>

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")
Signed-off-by: Dave Airlie <airlied@redhat.com>
---
 drivers/gpu/drm/nouveau/dispnv50/atom.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/dispnv50/atom.h b/drivers/gpu/drm/nouveau/dispnv50/atom.h
index 93f8f4f64578..ada8fb6f1a9a 100644
--- a/drivers/gpu/drm/nouveau/dispnv50/atom.h
+++ b/drivers/gpu/drm/nouveau/dispnv50/atom.h
@@ -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);
-- 
2.51.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] nouveau: use proper atomic accessor to get crtc state
  2025-11-30 21:42 [PATCH] nouveau: use proper atomic accessor to get crtc state Dave Airlie
@ 2025-12-03 12:27 ` Ville Syrjälä
  0 siblings, 0 replies; 2+ messages in thread
From: Ville Syrjälä @ 2025-12-03 12:27 UTC (permalink / raw)
  To: Dave Airlie; +Cc: dri-devel, nouveau

On Mon, Dec 01, 2025 at 07:42:06AM +1000, Dave Airlie wrote:
> From: Dave Airlie <airlied@redhat.com>
> 
> 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")
> Signed-off-by: Dave Airlie <airlied@redhat.com>
> ---
>  drivers/gpu/drm/nouveau/dispnv50/atom.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/nouveau/dispnv50/atom.h b/drivers/gpu/drm/nouveau/dispnv50/atom.h
> index 93f8f4f64578..ada8fb6f1a9a 100644
> --- a/drivers/gpu/drm/nouveau/dispnv50/atom.h
> +++ b/drivers/gpu/drm/nouveau/dispnv50/atom.h
> @@ -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.

>  		return (void *)statec;
>  	return nv50_head_atom(statec);
> -- 
> 2.51.1

-- 
Ville Syrjälä
Intel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-12-03 12:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-30 21:42 [PATCH] nouveau: use proper atomic accessor to get crtc state Dave Airlie
2025-12-03 12:27 ` Ville Syrjälä

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.