On 09/17/2025, Maxime Ripard wrote: > While the old and new state pointers are somewhat self-explanatory, the > state pointer and its relation to the other two really isn't. > > Now that we've cleaned up everything and it isn't used in any > modesetting path, we can document what it's still useful for: to free > the right state when we free the global state. > > Reviewed-by: Luca Ceresoli <[email protected]> > Reviewed-by: Ville Syrjälä <[email protected]> > Signed-off-by: Maxime Ripard <[email protected]> > --- > include/drm/drm_atomic.h | 17 ++++++++++++++++- > 1 file changed, 16 insertions(+), 1 deletion(-) > > diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h > index > 321c866d5b0a46df7a9adbbf5e4cabd1ff987aad..798d33b50ef7497ce938ce3dbabee32487dda2d6 > 100644 > --- a/include/drm/drm_atomic.h > +++ b/include/drm/drm_atomic.h > @@ -180,11 +180,26 @@ struct __drm_crtcs_state { > u64 last_vblank_count; > }; > > struct __drm_connnectors_state { > struct drm_connector *ptr; > - struct drm_connector_state *state, *old_state, *new_state; > + > + /** > + * @state: > + * > + * Used to track the @drm_connector_state we will need to free > + * when tearing down the associated &drm_atomic_state.
Sorry for joining the party late. Nit: to make reader's life easier, maybe mention ->atomic_destroy_state() in drm_atomic_state_default_clear() is the place to free the state. OFC, you probably may find better words. Same applies to CRTC, plane and private states. > + * > + * Before a commit, and the call to > + * drm_atomic_helper_swap_state() in particular, it points to > + * the same state than @new_state. After a commit, it points to > + * the same state than @old_state. > + */ > + struct drm_connector_state *state; > + > + struct drm_connector_state *old_state, *new_state; > + > /** > * @out_fence_ptr: > * > * User-provided pointer which the kernel uses to return a sync_file > * file descriptor. Used by writeback connectors to signal completion of > -- Regards, Liu Ying
