The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Simona Vetter <simona.vetter@ffwll.ch>
To: Maxime Ripard <mripard@kernel.org>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
	Andrzej Hajda <andrzej.hajda@intel.com>,
	Neil Armstrong <neil.armstrong@linaro.org>,
	Robert Foss <rfoss@kernel.org>,
	Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
	Jonas Karlman <jonas@kwiboo.se>,
	Jernej Skrabec <jernej.skrabec@gmail.com>,
	Douglas Anderson <dianders@chromium.org>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	Simona Vetter <simona.vetter@ffwll.ch>
Subject: Re: [PATCH v3 01/37] drm/atomic: Document history of drm_atomic_state
Date: Mon, 17 Feb 2025 17:33:09 +0100	[thread overview]
Message-ID: <Z7NkxTHVQzzSHv1B@phenom.ffwll.local> (raw)
In-Reply-To: <20250213-bridge-connector-v3-1-e71598f49c8f@kernel.org>

On Thu, Feb 13, 2025 at 03:43:20PM +0100, Maxime Ripard wrote:
> After some discussions on the mailing-list for an earlier revision of
> the series, it was suggested to document the evolution of
> drm_atomic_state and its use by drivers to explain some of the confusion
> one might still encounter when reading the framework code.
> 
> Suggested-by: Simona Vetter <simona.vetter@ffwll.ch>
> Link: https://lore.kernel.org/dri-devel/Z4jtKHY4qN3RNZNG@phenom.ffwll.local/
> Signed-off-by: Maxime Ripard <mripard@kernel.org>

Thanks for documenting that little bit of lore!

Reviewed-by: Simona Vetter <simona.vetter@ffwll.ch>

Cheers, Sima

> ---
>  include/drm/drm_atomic.h | 31 +++++++++++++++++++++++++++++++
>  1 file changed, 31 insertions(+)
> 
> diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h
> index 1ded9a8d4e84d7d9879d7f60a876ba9d69785766..4c673f0698fef6b60f77db980378d5e88e0e250e 100644
> --- a/include/drm/drm_atomic.h
> +++ b/include/drm/drm_atomic.h
> @@ -355,10 +355,41 @@ struct __drm_private_objs_state {
>   * these.
>   *
>   * States are added to an atomic update by calling drm_atomic_get_crtc_state(),
>   * drm_atomic_get_plane_state(), drm_atomic_get_connector_state(), or for
>   * private state structures, drm_atomic_get_private_obj_state().
> + *
> + * NOTE: struct drm_atomic_state first started as a single collection of
> + * entities state pointers (drm_plane_state, drm_crtc_state, etc.).
> + *
> + * At atomic_check time, you could get the state about to be committed
> + * from drm_atomic_state, and the one currently running from the
> + * entities state pointer (drm_crtc.state, for example). After the call
> + * to drm_atomic_helper_swap_state(), the entities state pointer would
> + * contain the state previously checked, and the drm_atomic_state
> + * structure the old state.
> + *
> + * Over time, and in order to avoid confusion, drm_atomic_state has
> + * grown to have both the old state (ie, the state we replace) and the
> + * new state (ie, the state we want to apply). Those names are stable
> + * during the commit process, which makes it easier to reason about.
> + *
> + * You can still find some traces of that evolution through some hooks
> + * or callbacks taking a drm_atomic_state parameter called names like
> + * "old_state". This doesn't necessarily mean that the previous
> + * drm_atomic_state is passed, but rather that this used to be the state
> + * collection we were replacing after drm_atomic_helper_swap_state(),
> + * but the variable name was never updated.
> + *
> + * Some atomic operations implementations followed a similar process. We
> + * first started to pass the entity state only. However, it was pretty
> + * cumbersome for drivers, and especially CRTCs, to retrieve the states
> + * of other components. Thus, we switched to passing the whole
> + * drm_atomic_state as a parameter to those operations. Similarly, the
> + * transition isn't complete yet, and one might still find atomic
> + * operations taking a drm_atomic_state pointer, or a component state
> + * pointer. The former is the preferred form.
>   */
>  struct drm_atomic_state {
>  	/**
>  	 * @ref:
>  	 *
> 
> -- 
> 2.48.0
> 

-- 
Simona Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

  reply	other threads:[~2025-02-17 16:33 UTC|newest]

Thread overview: 83+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-13 14:43 [PATCH v3 00/37] drm/bridge: Various quality of life improvements Maxime Ripard
2025-02-13 14:43 ` [PATCH v3 01/37] drm/atomic: Document history of drm_atomic_state Maxime Ripard
2025-02-17 16:33   ` Simona Vetter [this message]
2025-02-13 14:43 ` [PATCH v3 02/37] drm/bridge: Pass full state to atomic_pre_enable Maxime Ripard
2025-02-14 17:00   ` Doug Anderson
2025-02-13 14:43 ` [PATCH v3 03/37] drm/bridge: Pass full state to atomic_enable Maxime Ripard
2025-02-14 17:00   ` Doug Anderson
2025-02-13 14:43 ` [PATCH v3 04/37] drm/bridge: Pass full state to atomic_disable Maxime Ripard
2025-02-14 17:00   ` Doug Anderson
2025-02-13 14:43 ` [PATCH v3 05/37] drm/bridge: Pass full state to atomic_post_disable Maxime Ripard
2025-02-14 17:00   ` Doug Anderson
2025-02-13 14:43 ` [PATCH v3 06/37] drm/atomic-helper: Fix commit_tail state variable name Maxime Ripard
2025-02-13 14:43 ` [PATCH v3 07/37] drm/atomic-helper: Change parameter name of drm_atomic_helper_wait_for_dependencies() Maxime Ripard
2025-02-13 14:43 ` [PATCH v3 08/37] drm/atomic-helper: Change parameter name of drm_atomic_helper_commit_tail() Maxime Ripard
2025-02-13 14:43 ` [PATCH v3 09/37] drm/atomic-helper: Change parameter name of drm_atomic_helper_commit_tail_rpm() Maxime Ripard
2025-02-13 14:43 ` [PATCH v3 10/37] drm/atomic-helper: Change parameter name of drm_atomic_helper_modeset_disables() Maxime Ripard
2025-02-13 14:43 ` [PATCH v3 11/37] drm/atomic-helper: Change parameter name of disable_outputs() Maxime Ripard
2025-02-13 14:43 ` [PATCH v3 12/37] drm/bridge: Change parameter name of drm_atomic_bridge_chain_disable() Maxime Ripard
2025-02-13 14:43 ` [PATCH v3 13/37] drm/bridge: Change parameter name of drm_atomic_bridge_chain_post_disable() Maxime Ripard
2025-02-13 16:17   ` Dmitry Baryshkov
2025-02-13 14:43 ` [PATCH v3 14/37] drm/atomic-helper: Change parameter name of drm_atomic_helper_update_legacy_modeset_state() Maxime Ripard
2025-02-13 14:43 ` [PATCH v3 15/37] drm/atomic-helper: Change parameter name of crtc_set_mode() Maxime Ripard
2025-02-13 14:43 ` [PATCH v3 16/37] drm/atomic-helper: Change parameter name of drm_atomic_helper_commit_planes() Maxime Ripard
2025-02-13 16:18   ` Dmitry Baryshkov
2025-02-13 14:43 ` [PATCH v3 17/37] drm/atomic-helper: Change parameter name of drm_atomic_helper_commit_modeset_enables() Maxime Ripard
2025-02-13 16:40   ` Dmitry Baryshkov
2025-02-13 14:43 ` [PATCH v3 18/37] drm/bridge: Change parameter name of drm_atomic_bridge_chain_pre_enable() Maxime Ripard
2025-02-13 16:38   ` Dmitry Baryshkov
2025-02-13 14:43 ` [PATCH v3 19/37] drm/bridge: Change parameter name of drm_atomic_bridge_chain_enable() Maxime Ripard
2025-02-13 16:39   ` Dmitry Baryshkov
2025-02-13 14:43 ` [PATCH v3 20/37] drm/atomic-helper: Change parameter name of drm_atomic_helper_commit_writebacks() Maxime Ripard
2025-02-13 16:39   ` Dmitry Baryshkov
2025-02-13 14:43 ` [PATCH v3 21/37] drm/atomic-helper: Change parameter name of drm_atomic_helper_fake_vblank() Maxime Ripard
2025-02-13 16:40   ` Dmitry Baryshkov
2025-02-13 14:43 ` [PATCH v3 22/37] drm/atomic-helper: Change parameter name of drm_atomic_helper_commit_hw_done() Maxime Ripard
2025-02-13 16:40   ` Dmitry Baryshkov
2025-02-13 14:43 ` [PATCH v3 23/37] drm/atomic-helper: Change parameter name of drm_atomic_helper_wait_for_vblanks() Maxime Ripard
2025-02-13 16:40   ` Dmitry Baryshkov
2025-02-13 14:43 ` [PATCH v3 24/37] drm/atomic-helper: Change parameter name of drm_atomic_helper_cleanup_planes() Maxime Ripard
2025-02-13 16:40   ` Dmitry Baryshkov
2025-02-13 14:43 ` [PATCH v3 25/37] drm/atomic-helper: Change parameter name of drm_atomic_helper_commit_cleanup_done() Maxime Ripard
2025-02-13 16:41   ` Dmitry Baryshkov
2025-02-13 14:43 ` [PATCH v3 26/37] drm/atomic-helper: Change parameter name of drm_atomic_helper_wait_for_flip_done() Maxime Ripard
2025-02-13 16:41   ` Dmitry Baryshkov
2025-02-13 14:43 ` [PATCH v3 27/37] drm/bridge: Add encoder parameter to drm_bridge_funcs.attach Maxime Ripard
2025-02-14 17:00   ` Doug Anderson
2025-02-13 14:43 ` [PATCH v3 28/37] drm/bridge: Provide a helper to retrieve current bridge state Maxime Ripard
2025-02-13 16:24   ` Dmitry Baryshkov
2025-02-13 14:43 ` [PATCH v3 29/37] drm/bridge: Introduce drm_bridge_is_atomic() helper Maxime Ripard
2025-02-13 16:25   ` Dmitry Baryshkov
2025-02-13 14:43 ` [PATCH v3 30/37] drm/bridge: Assume that a bridge is atomic if it has atomic_reset Maxime Ripard
2025-02-13 16:29   ` Dmitry Baryshkov
2025-02-14 12:59     ` Maxime Ripard
2025-02-14 13:26       ` Dmitry Baryshkov
2025-02-13 14:43 ` [PATCH v3 31/37] drm/bridge: Provide pointers to the connector and crtc in bridge state Maxime Ripard
2025-02-13 16:32   ` Dmitry Baryshkov
2025-02-14 13:06     ` Maxime Ripard
2025-02-14 13:28       ` Dmitry Baryshkov
2025-02-17 16:41   ` Simona Vetter
2025-02-17 19:36     ` Dmitry Baryshkov
2025-02-19 13:37       ` Simona Vetter
2025-02-18 10:23     ` Maxime Ripard
2025-02-19 13:35       ` Simona Vetter
2025-02-19 15:56         ` Maxime Ripard
2025-02-20  9:49           ` Simona Vetter
2025-02-13 14:43 ` [PATCH v3 32/37] drm/bridge: Make encoder pointer deprecated Maxime Ripard
2025-02-13 16:35   ` Dmitry Baryshkov
2025-02-14 13:07     ` Maxime Ripard
2025-02-14 13:29       ` Dmitry Baryshkov
2025-02-17 16:38         ` Simona Vetter
2025-02-17 19:47           ` Dmitry Baryshkov
2025-02-25 16:37             ` Maxime Ripard
2025-02-13 14:43 ` [PATCH v3 33/37] drm/bridge: cdns-csi: Switch to atomic helpers Maxime Ripard
2025-02-13 16:38   ` Dmitry Baryshkov
2025-02-13 14:43 ` [PATCH v3 34/37] drm/bridge: tc358775: Switch to atomic commit Maxime Ripard
2025-02-13 16:38   ` Dmitry Baryshkov
2025-02-13 14:43 ` [PATCH v3 35/37] drm/bridge: tc358768: Stop disabling when failing to enable Maxime Ripard
2025-02-13 16:37   ` Dmitry Baryshkov
2025-02-13 14:43 ` [PATCH v3 36/37] drm/bridge: tc358768: Convert to atomic helpers Maxime Ripard
2025-02-13 16:37   ` Dmitry Baryshkov
2025-02-13 14:43 ` [PATCH v3 37/37] drm/bridge: ti-sn65dsi86: Use bridge_state crtc pointer Maxime Ripard
2025-02-14 16:38   ` Doug Anderson
2025-02-19 16:12 ` [PATCH v3 00/37] drm/bridge: Various quality of life improvements Maxime Ripard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z7NkxTHVQzzSHv1B@phenom.ffwll.local \
    --to=simona.vetter@ffwll.ch \
    --cc=Laurent.pinchart@ideasonboard.com \
    --cc=airlied@gmail.com \
    --cc=andrzej.hajda@intel.com \
    --cc=dianders@chromium.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jernej.skrabec@gmail.com \
    --cc=jonas@kwiboo.se \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=neil.armstrong@linaro.org \
    --cc=rfoss@kernel.org \
    --cc=simona@ffwll.ch \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox