linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/39] drm/atomic: Get rid of existing states (not really)
@ 2025-08-25 13:43 Maxime Ripard
  2025-08-25 13:43 ` [PATCH 01/39] drm/atomic: Make drm_atomic_get_connector_state() early return consistent Maxime Ripard
                   ` (38 more replies)
  0 siblings, 39 replies; 44+ messages in thread
From: Maxime Ripard @ 2025-08-25 13:43 UTC (permalink / raw)
  To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
	Louis Chauvet, Haneen Mohammed, Melissa Wen, Jyri Sarha,
	Tomi Valkeinen, Paul Cercueil, Liviu Dudau, Russell King,
	Manikandan Muralidharan, Dharma Balasubiramani, Nicolas Ferre,
	Alexandre Belloni, Claudiu Beznea, Inki Dae, Seung-Woo Kim,
	Kyungmin Park, Krzysztof Kozlowski, Alim Akhtar, Liu Ying,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Laurentiu Palcu, Lucas Stach, Philipp Zabel, Anitha Chrisanthus,
	Edmund Dea, Paul Kocialkowski, Sui Jingfeng, Chun-Kuang Hu,
	Matthias Brugger, AngeloGioacchino Del Regno, Rob Clark,
	Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang, Sean Paul,
	Marijn Suijten, Sandy Huang, Heiko Stübner, Andy Yan,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Thierry Reding,
	Mikko Perttunen, Jonathan Hunter, Hans de Goede, Dave Stevenson,
	Maíra Canal, Raspberry Pi Kernel Maintenance
  Cc: dri-devel, linux-kernel, linux-mips, linux-arm-kernel,
	linux-samsung-soc, imx, linux-mediatek, linux-arm-msm, freedreno,
	linux-rockchip, linux-sunxi, linux-tegra, Maxime Ripard

Hi,

Here's a series to get rid of the drm_atomic_helper_get_existing_*_state
accessors.

The initial intent was to remove the __drm_*_state->state pointer to
only rely on old and new states, but we still need it now to know which
of the two we need to free: if a state has not been committed (either
dropped or checked only), then we need to free the new one, if it has
been committed we need to free the old state. 

Thus, the state pointer is kept (and documented) only to point to the
state we should free eventually.

All users have been converted to the relevant old or new state
accessors.  

This was build tested only.

Let me know what you think,
Maxime

Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
Maxime Ripard (39):
      drm/atomic: Make drm_atomic_get_connector_state() early return consistent
      drm/atomic: Convert drm_atomic_get_connector_state() to state accessor
      drm/atomic: Convert drm_atomic_get_connector_state() to use new connector state
      drm/atomic: Remove unused drm_atomic_get_existing_connector_state()
      drm/atomic: Document __drm_connectors_state state pointer
      drm/atomic: Convert __drm_atomic_get_current_plane_state() to modern accessor
      drm/atomic: Convert drm_atomic_get_plane_state() to use new plane state
      drm/vkms: Convert vkms_crtc_atomic_check() to use new plane state
      drm/tilcdc: crtc: Use drm_atomic_helper_check_crtc_primary_plane()
      drm/atomic: Remove unused drm_atomic_get_existing_plane_state()
      drm/atomic: Document __drm_planes_state state pointer
      drm/atomic: Convert drm_atomic_get_crtc_state() to use new connector state
      drm/ingenic: ipu: Switch to drm_atomic_get_new_crtc_state()
      drm/arm/malidp: Switch to drm_atomic_get_new_crtc_state()
      drm/armada: Switch to drm_atomic_get_new_crtc_state()
      drm/atmel-hlcdc: Switch to drm_atomic_get_new_crtc_state()
      drm/exynos: Switch to drm_atomic_get_new_crtc_state()
      drm/imx-dc: Switch to drm_atomic_get_new_crtc_state()
      drm/imx-dcss: Switch to drm_atomic_get_new_crtc_state()
      drm/imx-ipuv3: Switch to drm_atomic_get_new_crtc_state()
      drm/ingenic: Switch to drm_atomic_get_new_crtc_state()
      drm/kmb: Switch to drm_atomic_get_new_crtc_state()
      drm/logicvc: Switch to drm_atomic_get_new_crtc_state()
      drm/loongson: Switch to drm_atomic_get_new_crtc_state()
      drm/mediatek: Switch to drm_atomic_get_new_crtc_state()
      drm/msm/mdp5: Switch to drm_atomic_get_new_crtc_state()
      drm/omap: Switch to drm_atomic_get_new_crtc_state()
      drm/rockchip: Switch to drm_atomic_get_new_crtc_state()
      drm/sun4i: Switch to drm_atomic_get_new_crtc_state()
      drm/tegra: Switch to drm_atomic_get_new_crtc_state()
      drm/tilcdc: Switch to drm_atomic_get_new_crtc_state()
      drm/vboxvideo: Switch to drm_atomic_get_new_crtc_state()
      drm/vc4: Switch to drm_atomic_get_new_crtc_state()
      drm/atomic: Switch to drm_atomic_get_new_crtc_state()
      drm/framebuffer: Switch to drm_atomic_get_new_crtc_state()
      drm/atomic: Remove unused drm_atomic_get_existing_crtc_state()
      drm/atomic: Document __drm_crtcs_state state pointer
      drm/atomic: Convert drm_atomic_get_private_obj_state() to use new plane state
      drm/atomic: Document __drm_private_objs_state state pointer

 drivers/gpu/drm/arm/malidp_planes.c             |   2 +-
 drivers/gpu/drm/armada/armada_plane.c           |   3 +-
 drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c |   2 +-
 drivers/gpu/drm/drm_atomic.c                    |  23 ++--
 drivers/gpu/drm/drm_framebuffer.c               |   2 +-
 drivers/gpu/drm/exynos/exynos_drm_plane.c       |   2 +-
 drivers/gpu/drm/imx/dc/dc-plane.c               |   2 +-
 drivers/gpu/drm/imx/dcss/dcss-plane.c           |   4 +-
 drivers/gpu/drm/imx/ipuv3/ipuv3-plane.c         |   3 +-
 drivers/gpu/drm/ingenic/ingenic-drm-drv.c       |   3 +-
 drivers/gpu/drm/ingenic/ingenic-ipu.c           |   4 +-
 drivers/gpu/drm/kmb/kmb_plane.c                 |   3 +-
 drivers/gpu/drm/logicvc/logicvc_layer.c         |   4 +-
 drivers/gpu/drm/loongson/lsdc_plane.c           |   2 +-
 drivers/gpu/drm/mediatek/mtk_plane.c            |   3 +-
 drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c      |   7 +-
 drivers/gpu/drm/omapdrm/omap_plane.c            |   2 +-
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c     |   6 +-
 drivers/gpu/drm/rockchip/rockchip_drm_vop2.c    |   2 +-
 drivers/gpu/drm/sun4i/sun8i_ui_layer.c          |   3 +-
 drivers/gpu/drm/sun4i/sun8i_vi_layer.c          |   3 +-
 drivers/gpu/drm/tegra/dc.c                      |   2 +-
 drivers/gpu/drm/tilcdc/tilcdc_crtc.c            |   9 +-
 drivers/gpu/drm/tilcdc/tilcdc_plane.c           |   3 +-
 drivers/gpu/drm/vboxvideo/vbox_mode.c           |   8 +-
 drivers/gpu/drm/vc4/vc4_plane.c                 |   6 +-
 drivers/gpu/drm/vkms/vkms_crtc.c                |   4 +-
 include/drm/drm_atomic.h                        | 144 ++++++++++++------------
 28 files changed, 125 insertions(+), 136 deletions(-)
---
base-commit: 7fa4d8dc380fbd81a9d702a855c50690c9c6442c
change-id: 20250825-drm-no-more-existing-state-9b3252c1a33b

Best regards,
-- 
Maxime Ripard <mripard@kernel.org>


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

* [PATCH 01/39] drm/atomic: Make drm_atomic_get_connector_state() early return consistent
  2025-08-25 13:43 [PATCH 00/39] drm/atomic: Get rid of existing states (not really) Maxime Ripard
@ 2025-08-25 13:43 ` Maxime Ripard
  2025-08-27 17:40   ` Dmitry Baryshkov
  2025-08-25 13:43 ` [PATCH 02/39] drm/atomic: Convert drm_atomic_get_connector_state() to state accessor Maxime Ripard
                   ` (37 subsequent siblings)
  38 siblings, 1 reply; 44+ messages in thread
From: Maxime Ripard @ 2025-08-25 13:43 UTC (permalink / raw)
  To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
	Louis Chauvet, Haneen Mohammed, Melissa Wen, Jyri Sarha,
	Tomi Valkeinen, Paul Cercueil, Liviu Dudau, Russell King,
	Manikandan Muralidharan, Dharma Balasubiramani, Nicolas Ferre,
	Alexandre Belloni, Claudiu Beznea, Inki Dae, Seung-Woo Kim,
	Kyungmin Park, Krzysztof Kozlowski, Alim Akhtar, Liu Ying,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Laurentiu Palcu, Lucas Stach, Philipp Zabel, Anitha Chrisanthus,
	Edmund Dea, Paul Kocialkowski, Sui Jingfeng, Chun-Kuang Hu,
	Matthias Brugger, AngeloGioacchino Del Regno, Rob Clark,
	Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang, Sean Paul,
	Marijn Suijten, Sandy Huang, Heiko Stübner, Andy Yan,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Thierry Reding,
	Mikko Perttunen, Jonathan Hunter, Hans de Goede, Dave Stevenson,
	Maíra Canal, Raspberry Pi Kernel Maintenance
  Cc: dri-devel, linux-kernel, linux-mips, linux-arm-kernel,
	linux-samsung-soc, imx, linux-mediatek, linux-arm-msm, freedreno,
	linux-rockchip, linux-sunxi, linux-tegra, Maxime Ripard

The drm_atomic_get_connector_state() tries to lookup if a connector
state was already allocated in the global state to return early if it
was the case. drm_atomic_get_plane_state() and
drm_atomic_get_crtc_state() behave similarly.

However, and unlike the other two, drm_atomic_get_connector_state() will
do that lookup after having called drm_modeset_lock(), when the others
will do it before.

Let's move the early return before the lock to make it consistent.

Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
 drivers/gpu/drm/drm_atomic.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index cd15cf52f0c9144711da5879da57884674aea9e4..fe21f154e0fa030f85fb3d6d35e2684adcf36e26 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -1128,10 +1128,13 @@ drm_atomic_get_connector_state(struct drm_atomic_state *state,
 	struct drm_mode_config *config = &connector->dev->mode_config;
 	struct drm_connector_state *connector_state;
 
 	WARN_ON(!state->acquire_ctx);
 
+	if (state->connectors[index].state)
+		return state->connectors[index].state;
+
 	ret = drm_modeset_lock(&config->connection_mutex, state->acquire_ctx);
 	if (ret)
 		return ERR_PTR(ret);
 
 	index = drm_connector_index(connector);
@@ -1150,13 +1153,10 @@ drm_atomic_get_connector_state(struct drm_atomic_state *state,
 		       sizeof(*state->connectors) * (alloc - state->num_connector));
 
 		state->num_connector = alloc;
 	}
 
-	if (state->connectors[index].state)
-		return state->connectors[index].state;
-
 	connector_state = connector->funcs->atomic_duplicate_state(connector);
 	if (!connector_state)
 		return ERR_PTR(-ENOMEM);
 
 	drm_connector_get(connector);

-- 
2.50.1


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

* [PATCH 02/39] drm/atomic: Convert drm_atomic_get_connector_state() to state accessor
  2025-08-25 13:43 [PATCH 00/39] drm/atomic: Get rid of existing states (not really) Maxime Ripard
  2025-08-25 13:43 ` [PATCH 01/39] drm/atomic: Make drm_atomic_get_connector_state() early return consistent Maxime Ripard
@ 2025-08-25 13:43 ` Maxime Ripard
  2025-08-25 13:43 ` [PATCH 03/39] drm/atomic: Convert drm_atomic_get_connector_state() to use new connector state Maxime Ripard
                   ` (36 subsequent siblings)
  38 siblings, 0 replies; 44+ messages in thread
From: Maxime Ripard @ 2025-08-25 13:43 UTC (permalink / raw)
  To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
	Louis Chauvet, Haneen Mohammed, Melissa Wen, Jyri Sarha,
	Tomi Valkeinen, Paul Cercueil, Liviu Dudau, Russell King,
	Manikandan Muralidharan, Dharma Balasubiramani, Nicolas Ferre,
	Alexandre Belloni, Claudiu Beznea, Inki Dae, Seung-Woo Kim,
	Kyungmin Park, Krzysztof Kozlowski, Alim Akhtar, Liu Ying,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Laurentiu Palcu, Lucas Stach, Philipp Zabel, Anitha Chrisanthus,
	Edmund Dea, Paul Kocialkowski, Sui Jingfeng, Chun-Kuang Hu,
	Matthias Brugger, AngeloGioacchino Del Regno, Rob Clark,
	Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang, Sean Paul,
	Marijn Suijten, Sandy Huang, Heiko Stübner, Andy Yan,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Thierry Reding,
	Mikko Perttunen, Jonathan Hunter, Hans de Goede, Dave Stevenson,
	Maíra Canal, Raspberry Pi Kernel Maintenance
  Cc: dri-devel, linux-kernel, linux-mips, linux-arm-kernel,
	linux-samsung-soc, imx, linux-mediatek, linux-arm-msm, freedreno,
	linux-rockchip, linux-sunxi, linux-tegra, Maxime Ripard

The drm_atomic_get_existing_connector_state() looks up if a connector
state was already allocated in the global state before trying to
allocate a new one.

It does so using a hand-crafted version of
drm_atomic_get_existing_connector_state(), so let's convert to that
helper, even though it's currently deprecated.

Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
 drivers/gpu/drm/drm_atomic.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index fe21f154e0fa030f85fb3d6d35e2684adcf36e26..660b081ff5d8c39061cebfb5ea122ac1e51677ad 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -1128,12 +1128,13 @@ drm_atomic_get_connector_state(struct drm_atomic_state *state,
 	struct drm_mode_config *config = &connector->dev->mode_config;
 	struct drm_connector_state *connector_state;
 
 	WARN_ON(!state->acquire_ctx);
 
-	if (state->connectors[index].state)
-		return state->connectors[index].state;
+	connector_state = drm_atomic_get_existing_connector_state(state, connector);
+	if (connector_state)
+		return connector_state;
 
 	ret = drm_modeset_lock(&config->connection_mutex, state->acquire_ctx);
 	if (ret)
 		return ERR_PTR(ret);
 

-- 
2.50.1


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

* [PATCH 03/39] drm/atomic: Convert drm_atomic_get_connector_state() to use new connector state
  2025-08-25 13:43 [PATCH 00/39] drm/atomic: Get rid of existing states (not really) Maxime Ripard
  2025-08-25 13:43 ` [PATCH 01/39] drm/atomic: Make drm_atomic_get_connector_state() early return consistent Maxime Ripard
  2025-08-25 13:43 ` [PATCH 02/39] drm/atomic: Convert drm_atomic_get_connector_state() to state accessor Maxime Ripard
@ 2025-08-25 13:43 ` Maxime Ripard
  2025-08-27 22:27   ` Dmitry Baryshkov
  2025-08-25 13:43 ` [PATCH 04/39] drm/atomic: Remove unused drm_atomic_get_existing_connector_state() Maxime Ripard
                   ` (35 subsequent siblings)
  38 siblings, 1 reply; 44+ messages in thread
From: Maxime Ripard @ 2025-08-25 13:43 UTC (permalink / raw)
  To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
	Louis Chauvet, Haneen Mohammed, Melissa Wen, Jyri Sarha,
	Tomi Valkeinen, Paul Cercueil, Liviu Dudau, Russell King,
	Manikandan Muralidharan, Dharma Balasubiramani, Nicolas Ferre,
	Alexandre Belloni, Claudiu Beznea, Inki Dae, Seung-Woo Kim,
	Kyungmin Park, Krzysztof Kozlowski, Alim Akhtar, Liu Ying,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Laurentiu Palcu, Lucas Stach, Philipp Zabel, Anitha Chrisanthus,
	Edmund Dea, Paul Kocialkowski, Sui Jingfeng, Chun-Kuang Hu,
	Matthias Brugger, AngeloGioacchino Del Regno, Rob Clark,
	Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang, Sean Paul,
	Marijn Suijten, Sandy Huang, Heiko Stübner, Andy Yan,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Thierry Reding,
	Mikko Perttunen, Jonathan Hunter, Hans de Goede, Dave Stevenson,
	Maíra Canal, Raspberry Pi Kernel Maintenance
  Cc: dri-devel, linux-kernel, linux-mips, linux-arm-kernel,
	linux-samsung-soc, imx, linux-mediatek, linux-arm-msm, freedreno,
	linux-rockchip, linux-sunxi, linux-tegra, Maxime Ripard

The drm_atomic_get_connector_state() function calls the deprecated
drm_atomic_get_existing_connector_state() helper to get find if a
connector state had already been allocated and was part of the given
drm_atomic_state.

At the point in time where drm_atomic_get_connector_state() can be
called (ie, during atomic_check), the existing state is the new state
and drm_atomic_get_existing_connector_state() can thus be replaced by
drm_atomic_get_new_connector_state().

Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
 drivers/gpu/drm/drm_atomic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index 660b081ff5d8c39061cebfb5ea122ac1e51677ad..30b7ec05a1af07075e40cd2822ecfd67df004ba2 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -1128,11 +1128,11 @@ drm_atomic_get_connector_state(struct drm_atomic_state *state,
 	struct drm_mode_config *config = &connector->dev->mode_config;
 	struct drm_connector_state *connector_state;
 
 	WARN_ON(!state->acquire_ctx);
 
-	connector_state = drm_atomic_get_existing_connector_state(state, connector);
+	connector_state = drm_atomic_get_new_connector_state(state, connector);
 	if (connector_state)
 		return connector_state;
 
 	ret = drm_modeset_lock(&config->connection_mutex, state->acquire_ctx);
 	if (ret)

-- 
2.50.1


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

* [PATCH 04/39] drm/atomic: Remove unused drm_atomic_get_existing_connector_state()
  2025-08-25 13:43 [PATCH 00/39] drm/atomic: Get rid of existing states (not really) Maxime Ripard
                   ` (2 preceding siblings ...)
  2025-08-25 13:43 ` [PATCH 03/39] drm/atomic: Convert drm_atomic_get_connector_state() to use new connector state Maxime Ripard
@ 2025-08-25 13:43 ` Maxime Ripard
  2025-08-27 22:28   ` Dmitry Baryshkov
  2025-08-25 13:43 ` [PATCH 05/39] drm/atomic: Document __drm_connectors_state state pointer Maxime Ripard
                   ` (34 subsequent siblings)
  38 siblings, 1 reply; 44+ messages in thread
From: Maxime Ripard @ 2025-08-25 13:43 UTC (permalink / raw)
  To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
	Louis Chauvet, Haneen Mohammed, Melissa Wen, Jyri Sarha,
	Tomi Valkeinen, Paul Cercueil, Liviu Dudau, Russell King,
	Manikandan Muralidharan, Dharma Balasubiramani, Nicolas Ferre,
	Alexandre Belloni, Claudiu Beznea, Inki Dae, Seung-Woo Kim,
	Kyungmin Park, Krzysztof Kozlowski, Alim Akhtar, Liu Ying,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Laurentiu Palcu, Lucas Stach, Philipp Zabel, Anitha Chrisanthus,
	Edmund Dea, Paul Kocialkowski, Sui Jingfeng, Chun-Kuang Hu,
	Matthias Brugger, AngeloGioacchino Del Regno, Rob Clark,
	Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang, Sean Paul,
	Marijn Suijten, Sandy Huang, Heiko Stübner, Andy Yan,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Thierry Reding,
	Mikko Perttunen, Jonathan Hunter, Hans de Goede, Dave Stevenson,
	Maíra Canal, Raspberry Pi Kernel Maintenance
  Cc: dri-devel, linux-kernel, linux-mips, linux-arm-kernel,
	linux-samsung-soc, imx, linux-mediatek, linux-arm-msm, freedreno,
	linux-rockchip, linux-sunxi, linux-tegra, Maxime Ripard

The drm_atomic_get_existing_connector_state() function is deprecated and
isn't used anymore, so let's remove it.

Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
 include/drm/drm_atomic.h | 23 -----------------------
 1 file changed, 23 deletions(-)

diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h
index 38636a593c9d98cadda85ccd67326cb152f0dd27..321c866d5b0a46df7a9adbbf5e4cabd1ff987aad 100644
--- a/include/drm/drm_atomic.h
+++ b/include/drm/drm_atomic.h
@@ -729,33 +729,10 @@ drm_atomic_get_new_plane_state(const struct drm_atomic_state *state,
 			       struct drm_plane *plane)
 {
 	return state->planes[drm_plane_index(plane)].new_state;
 }
 
-/**
- * drm_atomic_get_existing_connector_state - get connector state, if it exists
- * @state: global atomic state object
- * @connector: connector to grab
- *
- * This function returns the connector state for the given connector,
- * or NULL if the connector is not part of the global atomic state.
- *
- * This function is deprecated, @drm_atomic_get_old_connector_state or
- * @drm_atomic_get_new_connector_state should be used instead.
- */
-static inline struct drm_connector_state *
-drm_atomic_get_existing_connector_state(const struct drm_atomic_state *state,
-					struct drm_connector *connector)
-{
-	int index = drm_connector_index(connector);
-
-	if (index >= state->num_connector)
-		return NULL;
-
-	return state->connectors[index].state;
-}
-
 /**
  * drm_atomic_get_old_connector_state - get connector state, if it exists
  * @state: global atomic state object
  * @connector: connector to grab
  *

-- 
2.50.1


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

* [PATCH 05/39] drm/atomic: Document __drm_connectors_state state pointer
  2025-08-25 13:43 [PATCH 00/39] drm/atomic: Get rid of existing states (not really) Maxime Ripard
                   ` (3 preceding siblings ...)
  2025-08-25 13:43 ` [PATCH 04/39] drm/atomic: Remove unused drm_atomic_get_existing_connector_state() Maxime Ripard
@ 2025-08-25 13:43 ` Maxime Ripard
  2025-08-25 13:43 ` [PATCH 06/39] drm/atomic: Convert __drm_atomic_get_current_plane_state() to modern accessor Maxime Ripard
                   ` (33 subsequent siblings)
  38 siblings, 0 replies; 44+ messages in thread
From: Maxime Ripard @ 2025-08-25 13:43 UTC (permalink / raw)
  To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
	Louis Chauvet, Haneen Mohammed, Melissa Wen, Jyri Sarha,
	Tomi Valkeinen, Paul Cercueil, Liviu Dudau, Russell King,
	Manikandan Muralidharan, Dharma Balasubiramani, Nicolas Ferre,
	Alexandre Belloni, Claudiu Beznea, Inki Dae, Seung-Woo Kim,
	Kyungmin Park, Krzysztof Kozlowski, Alim Akhtar, Liu Ying,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Laurentiu Palcu, Lucas Stach, Philipp Zabel, Anitha Chrisanthus,
	Edmund Dea, Paul Kocialkowski, Sui Jingfeng, Chun-Kuang Hu,
	Matthias Brugger, AngeloGioacchino Del Regno, Rob Clark,
	Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang, Sean Paul,
	Marijn Suijten, Sandy Huang, Heiko Stübner, Andy Yan,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Thierry Reding,
	Mikko Perttunen, Jonathan Hunter, Hans de Goede, Dave Stevenson,
	Maíra Canal, Raspberry Pi Kernel Maintenance
  Cc: dri-devel, linux-kernel, linux-mips, linux-arm-kernel,
	linux-samsung-soc, imx, linux-mediatek, linux-arm-msm, freedreno,
	linux-rockchip, linux-sunxi, linux-tegra, Maxime Ripard

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.

Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
 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.
+	 *
+	 * 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

-- 
2.50.1


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

* [PATCH 06/39] drm/atomic: Convert __drm_atomic_get_current_plane_state() to modern accessor
  2025-08-25 13:43 [PATCH 00/39] drm/atomic: Get rid of existing states (not really) Maxime Ripard
                   ` (4 preceding siblings ...)
  2025-08-25 13:43 ` [PATCH 05/39] drm/atomic: Document __drm_connectors_state state pointer Maxime Ripard
@ 2025-08-25 13:43 ` Maxime Ripard
  2025-08-25 13:43 ` [PATCH 07/39] drm/atomic: Convert drm_atomic_get_plane_state() to use new plane state Maxime Ripard
                   ` (32 subsequent siblings)
  38 siblings, 0 replies; 44+ messages in thread
From: Maxime Ripard @ 2025-08-25 13:43 UTC (permalink / raw)
  To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
	Louis Chauvet, Haneen Mohammed, Melissa Wen, Jyri Sarha,
	Tomi Valkeinen, Paul Cercueil, Liviu Dudau, Russell King,
	Manikandan Muralidharan, Dharma Balasubiramani, Nicolas Ferre,
	Alexandre Belloni, Claudiu Beznea, Inki Dae, Seung-Woo Kim,
	Kyungmin Park, Krzysztof Kozlowski, Alim Akhtar, Liu Ying,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Laurentiu Palcu, Lucas Stach, Philipp Zabel, Anitha Chrisanthus,
	Edmund Dea, Paul Kocialkowski, Sui Jingfeng, Chun-Kuang Hu,
	Matthias Brugger, AngeloGioacchino Del Regno, Rob Clark,
	Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang, Sean Paul,
	Marijn Suijten, Sandy Huang, Heiko Stübner, Andy Yan,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Thierry Reding,
	Mikko Perttunen, Jonathan Hunter, Hans de Goede, Dave Stevenson,
	Maíra Canal, Raspberry Pi Kernel Maintenance
  Cc: dri-devel, linux-kernel, linux-mips, linux-arm-kernel,
	linux-samsung-soc, imx, linux-mediatek, linux-arm-msm, freedreno,
	linux-rockchip, linux-sunxi, linux-tegra, Maxime Ripard

The __drm_atomic_get_current_plane_state() function tries to get and
return the existing plane state, and if it doesn't exist returns the one
stored in the drm_plane->state field.

Using the current nomenclature, it tries to get the existing plane state
with an ad-hoc implementation of drm_atomic_get_existing_plane_state(),
and falls back to either the old or new plane state, depending on
whether it is called before or after drm_atomic_helper_swap_state().

The existing plane state itself is deprecated, because it also changes
when swapping states from the new state to the old state.

Fortunately for us, we can simplify things. Indeed,
__drm_atomic_get_current_plane_state() is only used in two macros:
intel_atomic_crtc_state_for_each_plane_state and
drm_atomic_crtc_state_for_each_plane_state().

The intel variant is only used through the intel_wm_compute() function
that is only ever called in intel_crtc_atomic_check().

The generic variant is more widely used, and can be found in the malidp,
msm, tegra and vc4 drivers. All of these call sites though are during
atomic_check(), so we end up in the same situation than Intel's.

Thus, we only ever use the existing state as the new state, and
plane->state is always going to be the old state. Any plane isn't
guaranteed to be part of the state though, so we can't rely on
drm_atomic_get_old_plane_state() and we still need to use plane->state.

Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
 include/drm/drm_atomic.h | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h
index 798d33b50ef7497ce938ce3dbabee32487dda2d6..82e74d9444c4fa7f02ee0e472c8c68f7bc44cc6a 100644
--- a/include/drm/drm_atomic.h
+++ b/include/drm/drm_atomic.h
@@ -789,15 +789,15 @@ drm_atomic_get_new_connector_state(const struct drm_atomic_state *state,
 /**
  * __drm_atomic_get_current_plane_state - get current plane state
  * @state: global atomic state object
  * @plane: plane to grab
  *
- * This function returns the plane state for the given plane, either from
- * @state, or if the plane isn't part of the atomic state update, from @plane.
- * This is useful in atomic check callbacks, when drivers need to peek at, but
- * not change, state of other planes, since it avoids threading an error code
- * back up the call chain.
+ * This function returns the plane state for the given plane, either the
+ * new plane state from @state, or if the plane isn't part of the atomic
+ * state update, from @plane. This is useful in atomic check callbacks,
+ * when drivers need to peek at, but not change, state of other planes,
+ * since it avoids threading an error code back up the call chain.
  *
  * WARNING:
  *
  * Note that this function is in general unsafe since it doesn't check for the
  * required locking for access state structures. Drivers must ensure that it is
@@ -814,13 +814,19 @@ drm_atomic_get_new_connector_state(const struct drm_atomic_state *state,
  */
 static inline const struct drm_plane_state *
 __drm_atomic_get_current_plane_state(const struct drm_atomic_state *state,
 				     struct drm_plane *plane)
 {
-	if (state->planes[drm_plane_index(plane)].state)
-		return state->planes[drm_plane_index(plane)].state;
+	struct drm_plane_state *plane_state;
 
+	plane_state = drm_atomic_get_new_plane_state(state, plane);
+	if (plane_state)
+		return plane_state;
+
+	/*
+	 * If the plane isn't part of the state, fallback to the currently active one.
+	 */
 	return plane->state;
 }
 
 int __must_check
 drm_atomic_add_encoder_bridges(struct drm_atomic_state *state,

-- 
2.50.1


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

* [PATCH 07/39] drm/atomic: Convert drm_atomic_get_plane_state() to use new plane state
  2025-08-25 13:43 [PATCH 00/39] drm/atomic: Get rid of existing states (not really) Maxime Ripard
                   ` (5 preceding siblings ...)
  2025-08-25 13:43 ` [PATCH 06/39] drm/atomic: Convert __drm_atomic_get_current_plane_state() to modern accessor Maxime Ripard
@ 2025-08-25 13:43 ` Maxime Ripard
  2025-08-25 13:43 ` [PATCH 08/39] drm/vkms: Convert vkms_crtc_atomic_check() " Maxime Ripard
                   ` (31 subsequent siblings)
  38 siblings, 0 replies; 44+ messages in thread
From: Maxime Ripard @ 2025-08-25 13:43 UTC (permalink / raw)
  To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
	Louis Chauvet, Haneen Mohammed, Melissa Wen, Jyri Sarha,
	Tomi Valkeinen, Paul Cercueil, Liviu Dudau, Russell King,
	Manikandan Muralidharan, Dharma Balasubiramani, Nicolas Ferre,
	Alexandre Belloni, Claudiu Beznea, Inki Dae, Seung-Woo Kim,
	Kyungmin Park, Krzysztof Kozlowski, Alim Akhtar, Liu Ying,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Laurentiu Palcu, Lucas Stach, Philipp Zabel, Anitha Chrisanthus,
	Edmund Dea, Paul Kocialkowski, Sui Jingfeng, Chun-Kuang Hu,
	Matthias Brugger, AngeloGioacchino Del Regno, Rob Clark,
	Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang, Sean Paul,
	Marijn Suijten, Sandy Huang, Heiko Stübner, Andy Yan,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Thierry Reding,
	Mikko Perttunen, Jonathan Hunter, Hans de Goede, Dave Stevenson,
	Maíra Canal, Raspberry Pi Kernel Maintenance
  Cc: dri-devel, linux-kernel, linux-mips, linux-arm-kernel,
	linux-samsung-soc, imx, linux-mediatek, linux-arm-msm, freedreno,
	linux-rockchip, linux-sunxi, linux-tegra, Maxime Ripard

The drm_atomic_get_plane_state() function calls the deprecated
drm_atomic_get_existing_plane_state() helper to get find if a plane
state had already been allocated and was part of the given
drm_atomic_state.

At the point in time where drm_atomic_get_plane_state() can be called
(ie, during atomic_check), the existing state is the new state and
drm_atomic_get_existing_plane_state() can thus be replaced by
drm_atomic_get_new_plane_state().

Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
 drivers/gpu/drm/drm_atomic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index 30b7ec05a1af07075e40cd2822ecfd67df004ba2..a9d1265e34602c454866869b81b8837b2c0a97a4 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -532,11 +532,11 @@ drm_atomic_get_plane_state(struct drm_atomic_state *state,
 	/* the legacy pointers should never be set */
 	WARN_ON(plane->fb);
 	WARN_ON(plane->old_fb);
 	WARN_ON(plane->crtc);
 
-	plane_state = drm_atomic_get_existing_plane_state(state, plane);
+	plane_state = drm_atomic_get_new_plane_state(state, plane);
 	if (plane_state)
 		return plane_state;
 
 	ret = drm_modeset_lock(&plane->mutex, state->acquire_ctx);
 	if (ret)

-- 
2.50.1


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

* [PATCH 08/39] drm/vkms: Convert vkms_crtc_atomic_check() to use new plane state
  2025-08-25 13:43 [PATCH 00/39] drm/atomic: Get rid of existing states (not really) Maxime Ripard
                   ` (6 preceding siblings ...)
  2025-08-25 13:43 ` [PATCH 07/39] drm/atomic: Convert drm_atomic_get_plane_state() to use new plane state Maxime Ripard
@ 2025-08-25 13:43 ` Maxime Ripard
  2025-08-25 13:43 ` [PATCH 09/39] drm/tilcdc: crtc: Use drm_atomic_helper_check_crtc_primary_plane() Maxime Ripard
                   ` (30 subsequent siblings)
  38 siblings, 0 replies; 44+ messages in thread
From: Maxime Ripard @ 2025-08-25 13:43 UTC (permalink / raw)
  To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
	Louis Chauvet, Haneen Mohammed, Melissa Wen, Jyri Sarha,
	Tomi Valkeinen, Paul Cercueil, Liviu Dudau, Russell King,
	Manikandan Muralidharan, Dharma Balasubiramani, Nicolas Ferre,
	Alexandre Belloni, Claudiu Beznea, Inki Dae, Seung-Woo Kim,
	Kyungmin Park, Krzysztof Kozlowski, Alim Akhtar, Liu Ying,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Laurentiu Palcu, Lucas Stach, Philipp Zabel, Anitha Chrisanthus,
	Edmund Dea, Paul Kocialkowski, Sui Jingfeng, Chun-Kuang Hu,
	Matthias Brugger, AngeloGioacchino Del Regno, Rob Clark,
	Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang, Sean Paul,
	Marijn Suijten, Sandy Huang, Heiko Stübner, Andy Yan,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Thierry Reding,
	Mikko Perttunen, Jonathan Hunter, Hans de Goede, Dave Stevenson,
	Maíra Canal, Raspberry Pi Kernel Maintenance
  Cc: dri-devel, linux-kernel, linux-mips, linux-arm-kernel,
	linux-samsung-soc, imx, linux-mediatek, linux-arm-msm, freedreno,
	linux-rockchip, linux-sunxi, linux-tegra, Maxime Ripard

The vkms_crtc_atomic_check() function calls the deprecated
drm_atomic_get_existing_plane_state() helper for its internal mode
checking logic.

During atomic_check, the existing state is the new state and
drm_atomic_get_existing_plane_state() can thus be replaced by
drm_atomic_get_new_plane_state().

Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
 drivers/gpu/drm/vkms/vkms_crtc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/vkms/vkms_crtc.c b/drivers/gpu/drm/vkms/vkms_crtc.c
index e60573e0f3e9510252e1f198b00e28bcc7987620..48237f32ac3b8f78b1495e8fbcc630be863ec7e4 100644
--- a/drivers/gpu/drm/vkms/vkms_crtc.c
+++ b/drivers/gpu/drm/vkms/vkms_crtc.c
@@ -183,11 +183,11 @@ static int vkms_crtc_atomic_check(struct drm_crtc *crtc,
 	ret = drm_atomic_add_affected_planes(crtc_state->state, crtc);
 	if (ret < 0)
 		return ret;
 
 	drm_for_each_plane_mask(plane, crtc->dev, crtc_state->plane_mask) {
-		plane_state = drm_atomic_get_existing_plane_state(crtc_state->state, plane);
+		plane_state = drm_atomic_get_new_plane_state(crtc_state->state, plane);
 		WARN_ON(!plane_state);
 
 		if (!plane_state->visible)
 			continue;
 
@@ -199,11 +199,11 @@ static int vkms_crtc_atomic_check(struct drm_crtc *crtc,
 		return -ENOMEM;
 	vkms_state->num_active_planes = i;
 
 	i = 0;
 	drm_for_each_plane_mask(plane, crtc->dev, crtc_state->plane_mask) {
-		plane_state = drm_atomic_get_existing_plane_state(crtc_state->state, plane);
+		plane_state = drm_atomic_get_new_plane_state(crtc_state->state, plane);
 
 		if (!plane_state->visible)
 			continue;
 
 		vkms_state->active_planes[i++] =

-- 
2.50.1


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

* [PATCH 09/39] drm/tilcdc: crtc: Use drm_atomic_helper_check_crtc_primary_plane()
  2025-08-25 13:43 [PATCH 00/39] drm/atomic: Get rid of existing states (not really) Maxime Ripard
                   ` (7 preceding siblings ...)
  2025-08-25 13:43 ` [PATCH 08/39] drm/vkms: Convert vkms_crtc_atomic_check() " Maxime Ripard
@ 2025-08-25 13:43 ` Maxime Ripard
  2025-08-25 13:43 ` [PATCH 10/39] drm/atomic: Remove unused drm_atomic_get_existing_plane_state() Maxime Ripard
                   ` (29 subsequent siblings)
  38 siblings, 0 replies; 44+ messages in thread
From: Maxime Ripard @ 2025-08-25 13:43 UTC (permalink / raw)
  To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
	Louis Chauvet, Haneen Mohammed, Melissa Wen, Jyri Sarha,
	Tomi Valkeinen, Paul Cercueil, Liviu Dudau, Russell King,
	Manikandan Muralidharan, Dharma Balasubiramani, Nicolas Ferre,
	Alexandre Belloni, Claudiu Beznea, Inki Dae, Seung-Woo Kim,
	Kyungmin Park, Krzysztof Kozlowski, Alim Akhtar, Liu Ying,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Laurentiu Palcu, Lucas Stach, Philipp Zabel, Anitha Chrisanthus,
	Edmund Dea, Paul Kocialkowski, Sui Jingfeng, Chun-Kuang Hu,
	Matthias Brugger, AngeloGioacchino Del Regno, Rob Clark,
	Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang, Sean Paul,
	Marijn Suijten, Sandy Huang, Heiko Stübner, Andy Yan,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Thierry Reding,
	Mikko Perttunen, Jonathan Hunter, Hans de Goede, Dave Stevenson,
	Maíra Canal, Raspberry Pi Kernel Maintenance
  Cc: dri-devel, linux-kernel, linux-mips, linux-arm-kernel,
	linux-samsung-soc, imx, linux-mediatek, linux-arm-msm, freedreno,
	linux-rockchip, linux-sunxi, linux-tegra, Maxime Ripard

In the tilcdc_crtc_atomic_check(), the tilcdc driver hand-crafts its own
implementation of drm_atomic_helper_check_crtc_primary_plane(). And it
does so by accessing the state pointer in drm_atomic_state->planes which
is deprecated.

Let's use the right helper here.

Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
 drivers/gpu/drm/tilcdc/tilcdc_crtc.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
index b5f60b2b2d0e72ae8ec0f3f4e5e85bc5004e6e5b..5718d9d83a49f38081aabbc9860847bdc83cf773 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
@@ -674,18 +674,11 @@ static int tilcdc_crtc_atomic_check(struct drm_crtc *crtc,
 									  crtc);
 	/* If we are not active we don't care */
 	if (!crtc_state->active)
 		return 0;
 
-	if (state->planes[0].ptr != crtc->primary ||
-	    state->planes[0].state == NULL ||
-	    state->planes[0].state->crtc != crtc) {
-		dev_dbg(crtc->dev->dev, "CRTC primary plane must be present");
-		return -EINVAL;
-	}
-
-	return 0;
+	return drm_atomic_helper_check_crtc_primary_plane(crtc_state);
 }
 
 static int tilcdc_crtc_enable_vblank(struct drm_crtc *crtc)
 {
 	struct tilcdc_crtc *tilcdc_crtc = to_tilcdc_crtc(crtc);

-- 
2.50.1


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

* [PATCH 10/39] drm/atomic: Remove unused drm_atomic_get_existing_plane_state()
  2025-08-25 13:43 [PATCH 00/39] drm/atomic: Get rid of existing states (not really) Maxime Ripard
                   ` (8 preceding siblings ...)
  2025-08-25 13:43 ` [PATCH 09/39] drm/tilcdc: crtc: Use drm_atomic_helper_check_crtc_primary_plane() Maxime Ripard
@ 2025-08-25 13:43 ` Maxime Ripard
  2025-08-25 13:43 ` [PATCH 11/39] drm/atomic: Document __drm_planes_state state pointer Maxime Ripard
                   ` (28 subsequent siblings)
  38 siblings, 0 replies; 44+ messages in thread
From: Maxime Ripard @ 2025-08-25 13:43 UTC (permalink / raw)
  To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
	Louis Chauvet, Haneen Mohammed, Melissa Wen, Jyri Sarha,
	Tomi Valkeinen, Paul Cercueil, Liviu Dudau, Russell King,
	Manikandan Muralidharan, Dharma Balasubiramani, Nicolas Ferre,
	Alexandre Belloni, Claudiu Beznea, Inki Dae, Seung-Woo Kim,
	Kyungmin Park, Krzysztof Kozlowski, Alim Akhtar, Liu Ying,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Laurentiu Palcu, Lucas Stach, Philipp Zabel, Anitha Chrisanthus,
	Edmund Dea, Paul Kocialkowski, Sui Jingfeng, Chun-Kuang Hu,
	Matthias Brugger, AngeloGioacchino Del Regno, Rob Clark,
	Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang, Sean Paul,
	Marijn Suijten, Sandy Huang, Heiko Stübner, Andy Yan,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Thierry Reding,
	Mikko Perttunen, Jonathan Hunter, Hans de Goede, Dave Stevenson,
	Maíra Canal, Raspberry Pi Kernel Maintenance
  Cc: dri-devel, linux-kernel, linux-mips, linux-arm-kernel,
	linux-samsung-soc, imx, linux-mediatek, linux-arm-msm, freedreno,
	linux-rockchip, linux-sunxi, linux-tegra, Maxime Ripard

The drm_atomic_get_existing_plane_state() function is deprecated and
isn't used anymore, so let's remove it.

Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
 include/drm/drm_atomic.h | 18 ------------------
 1 file changed, 18 deletions(-)

diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h
index 82e74d9444c4fa7f02ee0e472c8c68f7bc44cc6a..2f2c92fc4c20ee4e6abd6911bd574969d9cabbbb 100644
--- a/include/drm/drm_atomic.h
+++ b/include/drm/drm_atomic.h
@@ -696,28 +696,10 @@ drm_atomic_get_new_crtc_state(const struct drm_atomic_state *state,
 			      struct drm_crtc *crtc)
 {
 	return state->crtcs[drm_crtc_index(crtc)].new_state;
 }
 
-/**
- * drm_atomic_get_existing_plane_state - get plane state, if it exists
- * @state: global atomic state object
- * @plane: plane to grab
- *
- * This function returns the plane state for the given plane, or NULL
- * if the plane is not part of the global atomic state.
- *
- * This function is deprecated, @drm_atomic_get_old_plane_state or
- * @drm_atomic_get_new_plane_state should be used instead.
- */
-static inline struct drm_plane_state *
-drm_atomic_get_existing_plane_state(const struct drm_atomic_state *state,
-				    struct drm_plane *plane)
-{
-	return state->planes[drm_plane_index(plane)].state;
-}
-
 /**
  * drm_atomic_get_old_plane_state - get plane state, if it exists
  * @state: global atomic state object
  * @plane: plane to grab
  *

-- 
2.50.1


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

* [PATCH 11/39] drm/atomic: Document __drm_planes_state state pointer
  2025-08-25 13:43 [PATCH 00/39] drm/atomic: Get rid of existing states (not really) Maxime Ripard
                   ` (9 preceding siblings ...)
  2025-08-25 13:43 ` [PATCH 10/39] drm/atomic: Remove unused drm_atomic_get_existing_plane_state() Maxime Ripard
@ 2025-08-25 13:43 ` Maxime Ripard
  2025-08-25 13:43 ` [PATCH 12/39] drm/atomic: Convert drm_atomic_get_crtc_state() to use new connector state Maxime Ripard
                   ` (27 subsequent siblings)
  38 siblings, 0 replies; 44+ messages in thread
From: Maxime Ripard @ 2025-08-25 13:43 UTC (permalink / raw)
  To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
	Louis Chauvet, Haneen Mohammed, Melissa Wen, Jyri Sarha,
	Tomi Valkeinen, Paul Cercueil, Liviu Dudau, Russell King,
	Manikandan Muralidharan, Dharma Balasubiramani, Nicolas Ferre,
	Alexandre Belloni, Claudiu Beznea, Inki Dae, Seung-Woo Kim,
	Kyungmin Park, Krzysztof Kozlowski, Alim Akhtar, Liu Ying,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Laurentiu Palcu, Lucas Stach, Philipp Zabel, Anitha Chrisanthus,
	Edmund Dea, Paul Kocialkowski, Sui Jingfeng, Chun-Kuang Hu,
	Matthias Brugger, AngeloGioacchino Del Regno, Rob Clark,
	Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang, Sean Paul,
	Marijn Suijten, Sandy Huang, Heiko Stübner, Andy Yan,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Thierry Reding,
	Mikko Perttunen, Jonathan Hunter, Hans de Goede, Dave Stevenson,
	Maíra Canal, Raspberry Pi Kernel Maintenance
  Cc: dri-devel, linux-kernel, linux-mips, linux-arm-kernel,
	linux-samsung-soc, imx, linux-mediatek, linux-arm-msm, freedreno,
	linux-rockchip, linux-sunxi, linux-tegra, Maxime Ripard

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.

Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
 include/drm/drm_atomic.h | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h
index 2f2c92fc4c20ee4e6abd6911bd574969d9cabbbb..89c9a059b36763205fc2fc764283423cbea62679 100644
--- a/include/drm/drm_atomic.h
+++ b/include/drm/drm_atomic.h
@@ -157,11 +157,25 @@ struct drm_crtc_commit {
 	bool abort_completion;
 };
 
 struct __drm_planes_state {
 	struct drm_plane *ptr;
-	struct drm_plane_state *state, *old_state, *new_state;
+
+	/**
+	 * @state:
+	 *
+	 * Used to track the @drm_plane_state we will need to free
+	 * when tearing down the associated &drm_atomic_state.
+	 *
+	 * 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_plane_state *state;
+
+	struct drm_plane_state *old_state, *new_state;
 };
 
 struct __drm_crtcs_state {
 	struct drm_crtc *ptr;
 	struct drm_crtc_state *state, *old_state, *new_state;

-- 
2.50.1


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

* [PATCH 12/39] drm/atomic: Convert drm_atomic_get_crtc_state() to use new connector state
  2025-08-25 13:43 [PATCH 00/39] drm/atomic: Get rid of existing states (not really) Maxime Ripard
                   ` (10 preceding siblings ...)
  2025-08-25 13:43 ` [PATCH 11/39] drm/atomic: Document __drm_planes_state state pointer Maxime Ripard
@ 2025-08-25 13:43 ` Maxime Ripard
  2025-08-25 13:43 ` [PATCH 13/39] drm/ingenic: ipu: Switch to drm_atomic_get_new_crtc_state() Maxime Ripard
                   ` (26 subsequent siblings)
  38 siblings, 0 replies; 44+ messages in thread
From: Maxime Ripard @ 2025-08-25 13:43 UTC (permalink / raw)
  To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
	Louis Chauvet, Haneen Mohammed, Melissa Wen, Jyri Sarha,
	Tomi Valkeinen, Paul Cercueil, Liviu Dudau, Russell King,
	Manikandan Muralidharan, Dharma Balasubiramani, Nicolas Ferre,
	Alexandre Belloni, Claudiu Beznea, Inki Dae, Seung-Woo Kim,
	Kyungmin Park, Krzysztof Kozlowski, Alim Akhtar, Liu Ying,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Laurentiu Palcu, Lucas Stach, Philipp Zabel, Anitha Chrisanthus,
	Edmund Dea, Paul Kocialkowski, Sui Jingfeng, Chun-Kuang Hu,
	Matthias Brugger, AngeloGioacchino Del Regno, Rob Clark,
	Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang, Sean Paul,
	Marijn Suijten, Sandy Huang, Heiko Stübner, Andy Yan,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Thierry Reding,
	Mikko Perttunen, Jonathan Hunter, Hans de Goede, Dave Stevenson,
	Maíra Canal, Raspberry Pi Kernel Maintenance
  Cc: dri-devel, linux-kernel, linux-mips, linux-arm-kernel,
	linux-samsung-soc, imx, linux-mediatek, linux-arm-msm, freedreno,
	linux-rockchip, linux-sunxi, linux-tegra, Maxime Ripard

The drm_atomic_get_crtc_state() function calls the deprecated
drm_atomic_get_existing_crtc_state() helper to get find if a crtc state
had already been allocated and was part of the given drm_atomic_state.

At the point in time where drm_atomic_get_crtc_state() can be
called (ie, during atomic_check), the existing state is the new state
and drm_atomic_get_existing_crtc_state() can thus be replaced by
drm_atomic_get_new_crtc_state().

Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
 drivers/gpu/drm/drm_atomic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index a9d1265e34602c454866869b81b8837b2c0a97a4..1147fa890a03ef2c3283972c816796d8de6307c9 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -347,11 +347,11 @@ drm_atomic_get_crtc_state(struct drm_atomic_state *state,
 	int ret, index = drm_crtc_index(crtc);
 	struct drm_crtc_state *crtc_state;
 
 	WARN_ON(!state->acquire_ctx);
 
-	crtc_state = drm_atomic_get_existing_crtc_state(state, crtc);
+	crtc_state = drm_atomic_get_new_crtc_state(state, crtc);
 	if (crtc_state)
 		return crtc_state;
 
 	ret = drm_modeset_lock(&crtc->mutex, state->acquire_ctx);
 	if (ret)

-- 
2.50.1


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

* [PATCH 13/39] drm/ingenic: ipu: Switch to drm_atomic_get_new_crtc_state()
  2025-08-25 13:43 [PATCH 00/39] drm/atomic: Get rid of existing states (not really) Maxime Ripard
                   ` (11 preceding siblings ...)
  2025-08-25 13:43 ` [PATCH 12/39] drm/atomic: Convert drm_atomic_get_crtc_state() to use new connector state Maxime Ripard
@ 2025-08-25 13:43 ` Maxime Ripard
  2025-08-25 13:43 ` [PATCH 14/39] drm/arm/malidp: " Maxime Ripard
                   ` (25 subsequent siblings)
  38 siblings, 0 replies; 44+ messages in thread
From: Maxime Ripard @ 2025-08-25 13:43 UTC (permalink / raw)
  To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
	Louis Chauvet, Haneen Mohammed, Melissa Wen, Jyri Sarha,
	Tomi Valkeinen, Paul Cercueil, Liviu Dudau, Russell King,
	Manikandan Muralidharan, Dharma Balasubiramani, Nicolas Ferre,
	Alexandre Belloni, Claudiu Beznea, Inki Dae, Seung-Woo Kim,
	Kyungmin Park, Krzysztof Kozlowski, Alim Akhtar, Liu Ying,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Laurentiu Palcu, Lucas Stach, Philipp Zabel, Anitha Chrisanthus,
	Edmund Dea, Paul Kocialkowski, Sui Jingfeng, Chun-Kuang Hu,
	Matthias Brugger, AngeloGioacchino Del Regno, Rob Clark,
	Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang, Sean Paul,
	Marijn Suijten, Sandy Huang, Heiko Stübner, Andy Yan,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Thierry Reding,
	Mikko Perttunen, Jonathan Hunter, Hans de Goede, Dave Stevenson,
	Maíra Canal, Raspberry Pi Kernel Maintenance
  Cc: dri-devel, linux-kernel, linux-mips, linux-arm-kernel,
	linux-samsung-soc, imx, linux-mediatek, linux-arm-msm, freedreno,
	linux-rockchip, linux-sunxi, linux-tegra, Maxime Ripard

The ingenic IPU atomic_set_property implementation uses the deprecated
drm_atomic_get_existing_crtc_state() helper.

This hook is called during the state building process, before
atomic_check, and thus before the states are swapped. The existing state
thus points to the new state, and we can use
drm_atomic_get_new_crtc_state() instead.

Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
 drivers/gpu/drm/ingenic/ingenic-ipu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/ingenic/ingenic-ipu.c b/drivers/gpu/drm/ingenic/ingenic-ipu.c
index 26ebf424d63ec21ccee80221745c3e8bcc6b3d7f..2574a4b4d40a2c27cb212114117829d9f6ab3ddb 100644
--- a/drivers/gpu/drm/ingenic/ingenic-ipu.c
+++ b/drivers/gpu/drm/ingenic/ingenic-ipu.c
@@ -703,11 +703,11 @@ ingenic_ipu_plane_atomic_set_property(struct drm_plane *plane,
 
 	mode_changed = val != ipu->sharpness;
 	ipu->sharpness = val;
 
 	if (state->crtc) {
-		crtc_state = drm_atomic_get_existing_crtc_state(state->state, state->crtc);
+		crtc_state = drm_atomic_get_new_crtc_state(state->state, state->crtc);
 		if (WARN_ON(!crtc_state))
 			return -EINVAL;
 
 		crtc_state->mode_changed |= mode_changed;
 	}

-- 
2.50.1


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

* [PATCH 14/39] drm/arm/malidp: Switch to drm_atomic_get_new_crtc_state()
  2025-08-25 13:43 [PATCH 00/39] drm/atomic: Get rid of existing states (not really) Maxime Ripard
                   ` (12 preceding siblings ...)
  2025-08-25 13:43 ` [PATCH 13/39] drm/ingenic: ipu: Switch to drm_atomic_get_new_crtc_state() Maxime Ripard
@ 2025-08-25 13:43 ` Maxime Ripard
  2025-08-25 13:43 ` [PATCH 15/39] drm/armada: " Maxime Ripard
                   ` (24 subsequent siblings)
  38 siblings, 0 replies; 44+ messages in thread
From: Maxime Ripard @ 2025-08-25 13:43 UTC (permalink / raw)
  To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
	Louis Chauvet, Haneen Mohammed, Melissa Wen, Jyri Sarha,
	Tomi Valkeinen, Paul Cercueil, Liviu Dudau, Russell King,
	Manikandan Muralidharan, Dharma Balasubiramani, Nicolas Ferre,
	Alexandre Belloni, Claudiu Beznea, Inki Dae, Seung-Woo Kim,
	Kyungmin Park, Krzysztof Kozlowski, Alim Akhtar, Liu Ying,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Laurentiu Palcu, Lucas Stach, Philipp Zabel, Anitha Chrisanthus,
	Edmund Dea, Paul Kocialkowski, Sui Jingfeng, Chun-Kuang Hu,
	Matthias Brugger, AngeloGioacchino Del Regno, Rob Clark,
	Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang, Sean Paul,
	Marijn Suijten, Sandy Huang, Heiko Stübner, Andy Yan,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Thierry Reding,
	Mikko Perttunen, Jonathan Hunter, Hans de Goede, Dave Stevenson,
	Maíra Canal, Raspberry Pi Kernel Maintenance
  Cc: dri-devel, linux-kernel, linux-mips, linux-arm-kernel,
	linux-samsung-soc, imx, linux-mediatek, linux-arm-msm, freedreno,
	linux-rockchip, linux-sunxi, linux-tegra, Maxime Ripard

The malidp atomic_check implementation uses the deprecated
drm_atomic_get_existing_crtc_state() helper.

This hook is called as part of the global atomic_check, thus before the
states are swapped. The existing state thus points to the new state, and
we can use drm_atomic_get_new_crtc_state() instead.

Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
 drivers/gpu/drm/arm/malidp_planes.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/arm/malidp_planes.c b/drivers/gpu/drm/arm/malidp_planes.c
index 87f2e5ee87907403fac5386042bd6f313397ba03..f1a5014bcfa1058072e13f1ad8e84c85f52fb156 100644
--- a/drivers/gpu/drm/arm/malidp_planes.c
+++ b/drivers/gpu/drm/arm/malidp_planes.c
@@ -261,11 +261,11 @@ static const struct drm_plane_funcs malidp_de_plane_funcs = {
 
 static int malidp_se_check_scaling(struct malidp_plane *mp,
 				   struct drm_plane_state *state)
 {
 	struct drm_crtc_state *crtc_state =
-		drm_atomic_get_existing_crtc_state(state->state, state->crtc);
+		drm_atomic_get_new_crtc_state(state->state, state->crtc);
 	struct malidp_crtc_state *mc;
 	u32 src_w, src_h;
 	int ret;
 
 	if (!crtc_state)

-- 
2.50.1


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

* [PATCH 15/39] drm/armada: Switch to drm_atomic_get_new_crtc_state()
  2025-08-25 13:43 [PATCH 00/39] drm/atomic: Get rid of existing states (not really) Maxime Ripard
                   ` (13 preceding siblings ...)
  2025-08-25 13:43 ` [PATCH 14/39] drm/arm/malidp: " Maxime Ripard
@ 2025-08-25 13:43 ` Maxime Ripard
  2025-08-25 13:43 ` [PATCH 16/39] drm/atmel-hlcdc: " Maxime Ripard
                   ` (23 subsequent siblings)
  38 siblings, 0 replies; 44+ messages in thread
From: Maxime Ripard @ 2025-08-25 13:43 UTC (permalink / raw)
  To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
	Louis Chauvet, Haneen Mohammed, Melissa Wen, Jyri Sarha,
	Tomi Valkeinen, Paul Cercueil, Liviu Dudau, Russell King,
	Manikandan Muralidharan, Dharma Balasubiramani, Nicolas Ferre,
	Alexandre Belloni, Claudiu Beznea, Inki Dae, Seung-Woo Kim,
	Kyungmin Park, Krzysztof Kozlowski, Alim Akhtar, Liu Ying,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Laurentiu Palcu, Lucas Stach, Philipp Zabel, Anitha Chrisanthus,
	Edmund Dea, Paul Kocialkowski, Sui Jingfeng, Chun-Kuang Hu,
	Matthias Brugger, AngeloGioacchino Del Regno, Rob Clark,
	Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang, Sean Paul,
	Marijn Suijten, Sandy Huang, Heiko Stübner, Andy Yan,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Thierry Reding,
	Mikko Perttunen, Jonathan Hunter, Hans de Goede, Dave Stevenson,
	Maíra Canal, Raspberry Pi Kernel Maintenance
  Cc: dri-devel, linux-kernel, linux-mips, linux-arm-kernel,
	linux-samsung-soc, imx, linux-mediatek, linux-arm-msm, freedreno,
	linux-rockchip, linux-sunxi, linux-tegra, Maxime Ripard

The armada atomic_check implementation uses the deprecated
drm_atomic_get_existing_crtc_state() helper.

This hook is called as part of the global atomic_check, thus before the
states are swapped. The existing state thus points to the new state, and
we can use drm_atomic_get_new_crtc_state() instead.

Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
 drivers/gpu/drm/armada/armada_plane.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/armada/armada_plane.c b/drivers/gpu/drm/armada/armada_plane.c
index cc47c032dbc151a463cbd0b0d048c74c2828f253..786bcce0dc20eadab14c5bee97593ae3e05732b1 100644
--- a/drivers/gpu/drm/armada/armada_plane.c
+++ b/drivers/gpu/drm/armada/armada_plane.c
@@ -93,12 +93,11 @@ int armada_drm_plane_atomic_check(struct drm_plane *plane,
 		new_plane_state->visible = false;
 		return 0;
 	}
 
 	if (state)
-		crtc_state = drm_atomic_get_existing_crtc_state(state,
-								crtc);
+		crtc_state = drm_atomic_get_new_crtc_state(state, crtc);
 	else
 		crtc_state = crtc->state;
 
 	ret = drm_atomic_helper_check_plane_state(new_plane_state, crtc_state,
 						  0,

-- 
2.50.1


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

* [PATCH 16/39] drm/atmel-hlcdc: Switch to drm_atomic_get_new_crtc_state()
  2025-08-25 13:43 [PATCH 00/39] drm/atomic: Get rid of existing states (not really) Maxime Ripard
                   ` (14 preceding siblings ...)
  2025-08-25 13:43 ` [PATCH 15/39] drm/armada: " Maxime Ripard
@ 2025-08-25 13:43 ` Maxime Ripard
  2025-08-25 13:43 ` [PATCH 17/39] drm/exynos: " Maxime Ripard
                   ` (22 subsequent siblings)
  38 siblings, 0 replies; 44+ messages in thread
From: Maxime Ripard @ 2025-08-25 13:43 UTC (permalink / raw)
  To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
	Louis Chauvet, Haneen Mohammed, Melissa Wen, Jyri Sarha,
	Tomi Valkeinen, Paul Cercueil, Liviu Dudau, Russell King,
	Manikandan Muralidharan, Dharma Balasubiramani, Nicolas Ferre,
	Alexandre Belloni, Claudiu Beznea, Inki Dae, Seung-Woo Kim,
	Kyungmin Park, Krzysztof Kozlowski, Alim Akhtar, Liu Ying,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Laurentiu Palcu, Lucas Stach, Philipp Zabel, Anitha Chrisanthus,
	Edmund Dea, Paul Kocialkowski, Sui Jingfeng, Chun-Kuang Hu,
	Matthias Brugger, AngeloGioacchino Del Regno, Rob Clark,
	Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang, Sean Paul,
	Marijn Suijten, Sandy Huang, Heiko Stübner, Andy Yan,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Thierry Reding,
	Mikko Perttunen, Jonathan Hunter, Hans de Goede, Dave Stevenson,
	Maíra Canal, Raspberry Pi Kernel Maintenance
  Cc: dri-devel, linux-kernel, linux-mips, linux-arm-kernel,
	linux-samsung-soc, imx, linux-mediatek, linux-arm-msm, freedreno,
	linux-rockchip, linux-sunxi, linux-tegra, Maxime Ripard

The atmel-hlcdc atomic_check implementation uses the deprecated
drm_atomic_get_existing_crtc_state() helper.

This hook is called as part of the global atomic_check, thus before the
states are swapped. The existing state thus points to the new state, and
we can use drm_atomic_get_new_crtc_state() instead.

Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
 drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
index 4a7ba0918eca19eca3fd8febd1db1b2d3a8a6e14..59be5f64c058e2be398f207ad436f922135a5ad0 100644
--- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
+++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
@@ -712,11 +712,11 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p,
 	int i;
 
 	if (!hstate->base.crtc || WARN_ON(!fb))
 		return 0;
 
-	crtc_state = drm_atomic_get_existing_crtc_state(state, s->crtc);
+	crtc_state = drm_atomic_get_new_crtc_state(state, s->crtc);
 	mode = &crtc_state->adjusted_mode;
 
 	ret = drm_atomic_helper_check_plane_state(s, crtc_state,
 						  (1 << 16) / 2048,
 						  INT_MAX, true, true);

-- 
2.50.1


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

* [PATCH 17/39] drm/exynos: Switch to drm_atomic_get_new_crtc_state()
  2025-08-25 13:43 [PATCH 00/39] drm/atomic: Get rid of existing states (not really) Maxime Ripard
                   ` (15 preceding siblings ...)
  2025-08-25 13:43 ` [PATCH 16/39] drm/atmel-hlcdc: " Maxime Ripard
@ 2025-08-25 13:43 ` Maxime Ripard
  2025-08-25 13:43 ` [PATCH 18/39] drm/imx-dc: " Maxime Ripard
                   ` (21 subsequent siblings)
  38 siblings, 0 replies; 44+ messages in thread
From: Maxime Ripard @ 2025-08-25 13:43 UTC (permalink / raw)
  To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
	Louis Chauvet, Haneen Mohammed, Melissa Wen, Jyri Sarha,
	Tomi Valkeinen, Paul Cercueil, Liviu Dudau, Russell King,
	Manikandan Muralidharan, Dharma Balasubiramani, Nicolas Ferre,
	Alexandre Belloni, Claudiu Beznea, Inki Dae, Seung-Woo Kim,
	Kyungmin Park, Krzysztof Kozlowski, Alim Akhtar, Liu Ying,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Laurentiu Palcu, Lucas Stach, Philipp Zabel, Anitha Chrisanthus,
	Edmund Dea, Paul Kocialkowski, Sui Jingfeng, Chun-Kuang Hu,
	Matthias Brugger, AngeloGioacchino Del Regno, Rob Clark,
	Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang, Sean Paul,
	Marijn Suijten, Sandy Huang, Heiko Stübner, Andy Yan,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Thierry Reding,
	Mikko Perttunen, Jonathan Hunter, Hans de Goede, Dave Stevenson,
	Maíra Canal, Raspberry Pi Kernel Maintenance
  Cc: dri-devel, linux-kernel, linux-mips, linux-arm-kernel,
	linux-samsung-soc, imx, linux-mediatek, linux-arm-msm, freedreno,
	linux-rockchip, linux-sunxi, linux-tegra, Maxime Ripard

The exynos atomic_check implementation uses the deprecated
drm_atomic_get_existing_crtc_state() helper.

This hook is called as part of the global atomic_check, thus before the
states are swapped. The existing state thus points to the new state, and
we can use drm_atomic_get_new_crtc_state() instead.

Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
 drivers/gpu/drm/exynos/exynos_drm_plane.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c b/drivers/gpu/drm/exynos/exynos_drm_plane.c
index 7c3aa77186d3431d7020db4dec70332c0cfccb5d..6400070a4c9bcc00ecd0f21cbce1b5aafe1bff48 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_plane.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c
@@ -56,11 +56,11 @@ static int exynos_plane_get_size(int start, unsigned length, unsigned last)
 static void exynos_plane_mode_set(struct exynos_drm_plane_state *exynos_state)
 {
 	struct drm_plane_state *state = &exynos_state->base;
 	struct drm_crtc *crtc = state->crtc;
 	struct drm_crtc_state *crtc_state =
-			drm_atomic_get_existing_crtc_state(state->state, crtc);
+		drm_atomic_get_new_crtc_state(state->state, crtc);
 	struct drm_display_mode *mode = &crtc_state->adjusted_mode;
 	int crtc_x, crtc_y;
 	unsigned int crtc_w, crtc_h;
 	unsigned int src_x, src_y;
 	unsigned int src_w, src_h;

-- 
2.50.1


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

* [PATCH 18/39] drm/imx-dc: Switch to drm_atomic_get_new_crtc_state()
  2025-08-25 13:43 [PATCH 00/39] drm/atomic: Get rid of existing states (not really) Maxime Ripard
                   ` (16 preceding siblings ...)
  2025-08-25 13:43 ` [PATCH 17/39] drm/exynos: " Maxime Ripard
@ 2025-08-25 13:43 ` Maxime Ripard
  2025-08-25 13:43 ` [PATCH 19/39] drm/imx-dcss: " Maxime Ripard
                   ` (20 subsequent siblings)
  38 siblings, 0 replies; 44+ messages in thread
From: Maxime Ripard @ 2025-08-25 13:43 UTC (permalink / raw)
  To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
	Louis Chauvet, Haneen Mohammed, Melissa Wen, Jyri Sarha,
	Tomi Valkeinen, Paul Cercueil, Liviu Dudau, Russell King,
	Manikandan Muralidharan, Dharma Balasubiramani, Nicolas Ferre,
	Alexandre Belloni, Claudiu Beznea, Inki Dae, Seung-Woo Kim,
	Kyungmin Park, Krzysztof Kozlowski, Alim Akhtar, Liu Ying,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Laurentiu Palcu, Lucas Stach, Philipp Zabel, Anitha Chrisanthus,
	Edmund Dea, Paul Kocialkowski, Sui Jingfeng, Chun-Kuang Hu,
	Matthias Brugger, AngeloGioacchino Del Regno, Rob Clark,
	Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang, Sean Paul,
	Marijn Suijten, Sandy Huang, Heiko Stübner, Andy Yan,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Thierry Reding,
	Mikko Perttunen, Jonathan Hunter, Hans de Goede, Dave Stevenson,
	Maíra Canal, Raspberry Pi Kernel Maintenance
  Cc: dri-devel, linux-kernel, linux-mips, linux-arm-kernel,
	linux-samsung-soc, imx, linux-mediatek, linux-arm-msm, freedreno,
	linux-rockchip, linux-sunxi, linux-tegra, Maxime Ripard

The imx-dc atomic_check implementation uses the deprecated
drm_atomic_get_existing_crtc_state() helper.

This hook is called as part of the global atomic_check, thus before the
states are swapped. The existing state thus points to the new state, and
we can use drm_atomic_get_new_crtc_state() instead.

Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
 drivers/gpu/drm/imx/dc/dc-plane.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/imx/dc/dc-plane.c b/drivers/gpu/drm/imx/dc/dc-plane.c
index d8b946fb90de638da2bf4667307f11b06f4e77f5..e40d5d66c5c1f0d579a7a1019c0f2e00489ce15e 100644
--- a/drivers/gpu/drm/imx/dc/dc-plane.c
+++ b/drivers/gpu/drm/imx/dc/dc-plane.c
@@ -104,11 +104,11 @@ dc_plane_atomic_check(struct drm_plane *plane, struct drm_atomic_state *state)
 		dc_plane_dbg(plane, "no CRTC in plane state\n");
 		return -EINVAL;
 	}
 
 	crtc_state =
-		drm_atomic_get_existing_crtc_state(state, plane_state->crtc);
+		drm_atomic_get_new_crtc_state(state, plane_state->crtc);
 	if (WARN_ON(!crtc_state))
 		return -EINVAL;
 
 	ret = drm_atomic_helper_check_plane_state(plane_state, crtc_state,
 						  DRM_PLANE_NO_SCALING,

-- 
2.50.1


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

* [PATCH 19/39] drm/imx-dcss: Switch to drm_atomic_get_new_crtc_state()
  2025-08-25 13:43 [PATCH 00/39] drm/atomic: Get rid of existing states (not really) Maxime Ripard
                   ` (17 preceding siblings ...)
  2025-08-25 13:43 ` [PATCH 18/39] drm/imx-dc: " Maxime Ripard
@ 2025-08-25 13:43 ` Maxime Ripard
  2025-08-25 13:43 ` [PATCH 20/39] drm/imx-ipuv3: " Maxime Ripard
                   ` (19 subsequent siblings)
  38 siblings, 0 replies; 44+ messages in thread
From: Maxime Ripard @ 2025-08-25 13:43 UTC (permalink / raw)
  To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
	Louis Chauvet, Haneen Mohammed, Melissa Wen, Jyri Sarha,
	Tomi Valkeinen, Paul Cercueil, Liviu Dudau, Russell King,
	Manikandan Muralidharan, Dharma Balasubiramani, Nicolas Ferre,
	Alexandre Belloni, Claudiu Beznea, Inki Dae, Seung-Woo Kim,
	Kyungmin Park, Krzysztof Kozlowski, Alim Akhtar, Liu Ying,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Laurentiu Palcu, Lucas Stach, Philipp Zabel, Anitha Chrisanthus,
	Edmund Dea, Paul Kocialkowski, Sui Jingfeng, Chun-Kuang Hu,
	Matthias Brugger, AngeloGioacchino Del Regno, Rob Clark,
	Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang, Sean Paul,
	Marijn Suijten, Sandy Huang, Heiko Stübner, Andy Yan,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Thierry Reding,
	Mikko Perttunen, Jonathan Hunter, Hans de Goede, Dave Stevenson,
	Maíra Canal, Raspberry Pi Kernel Maintenance
  Cc: dri-devel, linux-kernel, linux-mips, linux-arm-kernel,
	linux-samsung-soc, imx, linux-mediatek, linux-arm-msm, freedreno,
	linux-rockchip, linux-sunxi, linux-tegra, Maxime Ripard

The imx-dcss atomic_check implementation uses the deprecated
drm_atomic_get_existing_crtc_state() helper.

This hook is called as part of the global atomic_check, thus before the
states are swapped. The existing state thus points to the new state, and
we can use drm_atomic_get_new_crtc_state() instead.

Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
 drivers/gpu/drm/imx/dcss/dcss-plane.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/imx/dcss/dcss-plane.c b/drivers/gpu/drm/imx/dcss/dcss-plane.c
index ab6d32bad756d080e1c56d7574403febceff94f4..3a063a53c8dfa6bc5bbbf9afc7ff6519199c2f19 100644
--- a/drivers/gpu/drm/imx/dcss/dcss-plane.c
+++ b/drivers/gpu/drm/imx/dcss/dcss-plane.c
@@ -157,12 +157,12 @@ static int dcss_plane_atomic_check(struct drm_plane *plane,
 		return 0;
 
 	dma_obj = drm_fb_dma_get_gem_obj(fb, 0);
 	WARN_ON(!dma_obj);
 
-	crtc_state = drm_atomic_get_existing_crtc_state(state,
-							new_plane_state->crtc);
+	crtc_state = drm_atomic_get_new_crtc_state(state,
+						   new_plane_state->crtc);
 
 	hdisplay = crtc_state->adjusted_mode.hdisplay;
 	vdisplay = crtc_state->adjusted_mode.vdisplay;
 
 	if (!dcss_plane_is_source_size_allowed(new_plane_state->src_w >> 16,

-- 
2.50.1


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

* [PATCH 20/39] drm/imx-ipuv3: Switch to drm_atomic_get_new_crtc_state()
  2025-08-25 13:43 [PATCH 00/39] drm/atomic: Get rid of existing states (not really) Maxime Ripard
                   ` (18 preceding siblings ...)
  2025-08-25 13:43 ` [PATCH 19/39] drm/imx-dcss: " Maxime Ripard
@ 2025-08-25 13:43 ` Maxime Ripard
  2025-08-25 13:43 ` [PATCH 21/39] drm/ingenic: " Maxime Ripard
                   ` (18 subsequent siblings)
  38 siblings, 0 replies; 44+ messages in thread
From: Maxime Ripard @ 2025-08-25 13:43 UTC (permalink / raw)
  To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
	Louis Chauvet, Haneen Mohammed, Melissa Wen, Jyri Sarha,
	Tomi Valkeinen, Paul Cercueil, Liviu Dudau, Russell King,
	Manikandan Muralidharan, Dharma Balasubiramani, Nicolas Ferre,
	Alexandre Belloni, Claudiu Beznea, Inki Dae, Seung-Woo Kim,
	Kyungmin Park, Krzysztof Kozlowski, Alim Akhtar, Liu Ying,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Laurentiu Palcu, Lucas Stach, Philipp Zabel, Anitha Chrisanthus,
	Edmund Dea, Paul Kocialkowski, Sui Jingfeng, Chun-Kuang Hu,
	Matthias Brugger, AngeloGioacchino Del Regno, Rob Clark,
	Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang, Sean Paul,
	Marijn Suijten, Sandy Huang, Heiko Stübner, Andy Yan,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Thierry Reding,
	Mikko Perttunen, Jonathan Hunter, Hans de Goede, Dave Stevenson,
	Maíra Canal, Raspberry Pi Kernel Maintenance
  Cc: dri-devel, linux-kernel, linux-mips, linux-arm-kernel,
	linux-samsung-soc, imx, linux-mediatek, linux-arm-msm, freedreno,
	linux-rockchip, linux-sunxi, linux-tegra, Maxime Ripard

The imx-ipuv3 atomic_check implementation uses the deprecated
drm_atomic_get_existing_crtc_state() helper.

This hook is called as part of the global atomic_check, thus before the
states are swapped. The existing state thus points to the new state, and
we can use drm_atomic_get_new_crtc_state() instead.

Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
 drivers/gpu/drm/imx/ipuv3/ipuv3-plane.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/imx/ipuv3/ipuv3-plane.c b/drivers/gpu/drm/imx/ipuv3/ipuv3-plane.c
index 704c549750f950c3f0ce5d6c6f637d9d7b53fb69..df19560e41b4f5b0dce97ae03947abeaf99e0883 100644
--- a/drivers/gpu/drm/imx/ipuv3/ipuv3-plane.c
+++ b/drivers/gpu/drm/imx/ipuv3/ipuv3-plane.c
@@ -384,12 +384,11 @@ static int ipu_plane_atomic_check(struct drm_plane *plane,
 
 	if (WARN_ON(!new_state->crtc))
 		return -EINVAL;
 
 	crtc_state =
-		drm_atomic_get_existing_crtc_state(state,
-						   new_state->crtc);
+		drm_atomic_get_new_crtc_state(state, new_state->crtc);
 	if (WARN_ON(!crtc_state))
 		return -EINVAL;
 
 	ret = drm_atomic_helper_check_plane_state(new_state, crtc_state,
 						  DRM_PLANE_NO_SCALING,

-- 
2.50.1


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

* [PATCH 21/39] drm/ingenic: Switch to drm_atomic_get_new_crtc_state()
  2025-08-25 13:43 [PATCH 00/39] drm/atomic: Get rid of existing states (not really) Maxime Ripard
                   ` (19 preceding siblings ...)
  2025-08-25 13:43 ` [PATCH 20/39] drm/imx-ipuv3: " Maxime Ripard
@ 2025-08-25 13:43 ` Maxime Ripard
  2025-08-25 13:43 ` [PATCH 22/39] drm/kmb: " Maxime Ripard
                   ` (17 subsequent siblings)
  38 siblings, 0 replies; 44+ messages in thread
From: Maxime Ripard @ 2025-08-25 13:43 UTC (permalink / raw)
  To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
	Louis Chauvet, Haneen Mohammed, Melissa Wen, Jyri Sarha,
	Tomi Valkeinen, Paul Cercueil, Liviu Dudau, Russell King,
	Manikandan Muralidharan, Dharma Balasubiramani, Nicolas Ferre,
	Alexandre Belloni, Claudiu Beznea, Inki Dae, Seung-Woo Kim,
	Kyungmin Park, Krzysztof Kozlowski, Alim Akhtar, Liu Ying,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Laurentiu Palcu, Lucas Stach, Philipp Zabel, Anitha Chrisanthus,
	Edmund Dea, Paul Kocialkowski, Sui Jingfeng, Chun-Kuang Hu,
	Matthias Brugger, AngeloGioacchino Del Regno, Rob Clark,
	Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang, Sean Paul,
	Marijn Suijten, Sandy Huang, Heiko Stübner, Andy Yan,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Thierry Reding,
	Mikko Perttunen, Jonathan Hunter, Hans de Goede, Dave Stevenson,
	Maíra Canal, Raspberry Pi Kernel Maintenance
  Cc: dri-devel, linux-kernel, linux-mips, linux-arm-kernel,
	linux-samsung-soc, imx, linux-mediatek, linux-arm-msm, freedreno,
	linux-rockchip, linux-sunxi, linux-tegra, Maxime Ripard

The ingenic atomic_check implementation uses the deprecated
drm_atomic_get_existing_crtc_state() helper.

This hook is called as part of the global atomic_check, thus before the
states are swapped. The existing state thus points to the new state, and
we can use drm_atomic_get_new_crtc_state() instead.

Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
 drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 3 +--
 drivers/gpu/drm/ingenic/ingenic-ipu.c     | 2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
index 9db1ceaed5188a4ef0897280dc72108eb3815b5f..05faed933e5619c796f2a4fa1906e0eaa029ac68 100644
--- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
+++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
@@ -469,12 +469,11 @@ static int ingenic_drm_plane_atomic_check(struct drm_plane *plane,
 		return 0;
 
 	if (priv->soc_info->plane_f0_not_working && plane == &priv->f0)
 		return -EINVAL;
 
-	crtc_state = drm_atomic_get_existing_crtc_state(state,
-							crtc);
+	crtc_state = drm_atomic_get_new_crtc_state(state, crtc);
 	if (WARN_ON(!crtc_state))
 		return -EINVAL;
 
 	priv_state = ingenic_drm_get_priv_state(priv, state);
 	if (IS_ERR(priv_state))
diff --git a/drivers/gpu/drm/ingenic/ingenic-ipu.c b/drivers/gpu/drm/ingenic/ingenic-ipu.c
index 2574a4b4d40a2c27cb212114117829d9f6ab3ddb..32638a713241abbd4eaed09f0aaec2b790650cc9 100644
--- a/drivers/gpu/drm/ingenic/ingenic-ipu.c
+++ b/drivers/gpu/drm/ingenic/ingenic-ipu.c
@@ -578,11 +578,11 @@ static int ingenic_ipu_plane_atomic_check(struct drm_plane *plane,
 	struct ingenic_ipu_private_state *ipu_state;
 
 	if (!crtc)
 		return 0;
 
-	crtc_state = drm_atomic_get_existing_crtc_state(state, crtc);
+	crtc_state = drm_atomic_get_new_crtc_state(state, crtc);
 	if (WARN_ON(!crtc_state))
 		return -EINVAL;
 
 	ipu_state = ingenic_ipu_get_priv_state(ipu, state);
 	if (IS_ERR(ipu_state))

-- 
2.50.1


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

* [PATCH 22/39] drm/kmb: Switch to drm_atomic_get_new_crtc_state()
  2025-08-25 13:43 [PATCH 00/39] drm/atomic: Get rid of existing states (not really) Maxime Ripard
                   ` (20 preceding siblings ...)
  2025-08-25 13:43 ` [PATCH 21/39] drm/ingenic: " Maxime Ripard
@ 2025-08-25 13:43 ` Maxime Ripard
  2025-08-25 13:43 ` [PATCH 23/39] drm/logicvc: " Maxime Ripard
                   ` (16 subsequent siblings)
  38 siblings, 0 replies; 44+ messages in thread
From: Maxime Ripard @ 2025-08-25 13:43 UTC (permalink / raw)
  To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
	Louis Chauvet, Haneen Mohammed, Melissa Wen, Jyri Sarha,
	Tomi Valkeinen, Paul Cercueil, Liviu Dudau, Russell King,
	Manikandan Muralidharan, Dharma Balasubiramani, Nicolas Ferre,
	Alexandre Belloni, Claudiu Beznea, Inki Dae, Seung-Woo Kim,
	Kyungmin Park, Krzysztof Kozlowski, Alim Akhtar, Liu Ying,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Laurentiu Palcu, Lucas Stach, Philipp Zabel, Anitha Chrisanthus,
	Edmund Dea, Paul Kocialkowski, Sui Jingfeng, Chun-Kuang Hu,
	Matthias Brugger, AngeloGioacchino Del Regno, Rob Clark,
	Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang, Sean Paul,
	Marijn Suijten, Sandy Huang, Heiko Stübner, Andy Yan,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Thierry Reding,
	Mikko Perttunen, Jonathan Hunter, Hans de Goede, Dave Stevenson,
	Maíra Canal, Raspberry Pi Kernel Maintenance
  Cc: dri-devel, linux-kernel, linux-mips, linux-arm-kernel,
	linux-samsung-soc, imx, linux-mediatek, linux-arm-msm, freedreno,
	linux-rockchip, linux-sunxi, linux-tegra, Maxime Ripard

The kmb atomic_check implementation uses the deprecated
drm_atomic_get_existing_crtc_state() helper.

This hook is called as part of the global atomic_check, thus before the
states are swapped. The existing state thus points to the new state, and
we can use drm_atomic_get_new_crtc_state() instead.

Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
 drivers/gpu/drm/kmb/kmb_plane.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/kmb/kmb_plane.c b/drivers/gpu/drm/kmb/kmb_plane.c
index 9e0562aa2bcb5ab4e2cbd71940ef4c147a7aa5ad..9562fe6711ffe2c5ad377e9973fcfdb76bf04daa 100644
--- a/drivers/gpu/drm/kmb/kmb_plane.c
+++ b/drivers/gpu/drm/kmb/kmb_plane.c
@@ -127,12 +127,11 @@ static int kmb_plane_atomic_check(struct drm_plane *plane,
 		drm_dbg(&kmb->drm, "Cannot change plane height or width after initial configuration");
 		return -EINVAL;
 	}
 	can_position = (plane->type == DRM_PLANE_TYPE_OVERLAY);
 	crtc_state =
-		drm_atomic_get_existing_crtc_state(state,
-						   new_plane_state->crtc);
+		drm_atomic_get_new_crtc_state(state, new_plane_state->crtc);
 	return drm_atomic_helper_check_plane_state(new_plane_state,
 						   crtc_state,
 						   DRM_PLANE_NO_SCALING,
 						   DRM_PLANE_NO_SCALING,
 						   can_position, true);

-- 
2.50.1


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

* [PATCH 23/39] drm/logicvc: Switch to drm_atomic_get_new_crtc_state()
  2025-08-25 13:43 [PATCH 00/39] drm/atomic: Get rid of existing states (not really) Maxime Ripard
                   ` (21 preceding siblings ...)
  2025-08-25 13:43 ` [PATCH 22/39] drm/kmb: " Maxime Ripard
@ 2025-08-25 13:43 ` Maxime Ripard
  2025-08-25 13:43 ` [PATCH 24/39] drm/loongson: " Maxime Ripard
                   ` (15 subsequent siblings)
  38 siblings, 0 replies; 44+ messages in thread
From: Maxime Ripard @ 2025-08-25 13:43 UTC (permalink / raw)
  To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
	Louis Chauvet, Haneen Mohammed, Melissa Wen, Jyri Sarha,
	Tomi Valkeinen, Paul Cercueil, Liviu Dudau, Russell King,
	Manikandan Muralidharan, Dharma Balasubiramani, Nicolas Ferre,
	Alexandre Belloni, Claudiu Beznea, Inki Dae, Seung-Woo Kim,
	Kyungmin Park, Krzysztof Kozlowski, Alim Akhtar, Liu Ying,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Laurentiu Palcu, Lucas Stach, Philipp Zabel, Anitha Chrisanthus,
	Edmund Dea, Paul Kocialkowski, Sui Jingfeng, Chun-Kuang Hu,
	Matthias Brugger, AngeloGioacchino Del Regno, Rob Clark,
	Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang, Sean Paul,
	Marijn Suijten, Sandy Huang, Heiko Stübner, Andy Yan,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Thierry Reding,
	Mikko Perttunen, Jonathan Hunter, Hans de Goede, Dave Stevenson,
	Maíra Canal, Raspberry Pi Kernel Maintenance
  Cc: dri-devel, linux-kernel, linux-mips, linux-arm-kernel,
	linux-samsung-soc, imx, linux-mediatek, linux-arm-msm, freedreno,
	linux-rockchip, linux-sunxi, linux-tegra, Maxime Ripard

The logicvc atomic_check implementation uses the deprecated
drm_atomic_get_existing_crtc_state() helper.

This hook is called as part of the global atomic_check, thus before the
states are swapped. The existing state thus points to the new state, and
we can use drm_atomic_get_new_crtc_state() instead.

Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
 drivers/gpu/drm/logicvc/logicvc_layer.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/logicvc/logicvc_layer.c b/drivers/gpu/drm/logicvc/logicvc_layer.c
index 464000aea765378894002fdb02dab16d197c27b1..eab4d773f92b66a9edb9770aa7a95349d665ec18 100644
--- a/drivers/gpu/drm/logicvc/logicvc_layer.c
+++ b/drivers/gpu/drm/logicvc/logicvc_layer.c
@@ -94,12 +94,12 @@ static int logicvc_plane_atomic_check(struct drm_plane *drm_plane,
 	int ret;
 
 	if (!new_state->crtc)
 		return 0;
 
-	crtc_state = drm_atomic_get_existing_crtc_state(new_state->state,
-							new_state->crtc);
+	crtc_state = drm_atomic_get_new_crtc_state(new_state->state,
+						   new_state->crtc);
 	if (WARN_ON(!crtc_state))
 		return -EINVAL;
 
 	if (new_state->crtc_x < 0 || new_state->crtc_y < 0) {
 		drm_err(drm_dev,

-- 
2.50.1


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

* [PATCH 24/39] drm/loongson: Switch to drm_atomic_get_new_crtc_state()
  2025-08-25 13:43 [PATCH 00/39] drm/atomic: Get rid of existing states (not really) Maxime Ripard
                   ` (22 preceding siblings ...)
  2025-08-25 13:43 ` [PATCH 23/39] drm/logicvc: " Maxime Ripard
@ 2025-08-25 13:43 ` Maxime Ripard
  2025-08-25 13:43 ` [PATCH 25/39] drm/mediatek: " Maxime Ripard
                   ` (14 subsequent siblings)
  38 siblings, 0 replies; 44+ messages in thread
From: Maxime Ripard @ 2025-08-25 13:43 UTC (permalink / raw)
  To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
	Louis Chauvet, Haneen Mohammed, Melissa Wen, Jyri Sarha,
	Tomi Valkeinen, Paul Cercueil, Liviu Dudau, Russell King,
	Manikandan Muralidharan, Dharma Balasubiramani, Nicolas Ferre,
	Alexandre Belloni, Claudiu Beznea, Inki Dae, Seung-Woo Kim,
	Kyungmin Park, Krzysztof Kozlowski, Alim Akhtar, Liu Ying,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Laurentiu Palcu, Lucas Stach, Philipp Zabel, Anitha Chrisanthus,
	Edmund Dea, Paul Kocialkowski, Sui Jingfeng, Chun-Kuang Hu,
	Matthias Brugger, AngeloGioacchino Del Regno, Rob Clark,
	Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang, Sean Paul,
	Marijn Suijten, Sandy Huang, Heiko Stübner, Andy Yan,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Thierry Reding,
	Mikko Perttunen, Jonathan Hunter, Hans de Goede, Dave Stevenson,
	Maíra Canal, Raspberry Pi Kernel Maintenance
  Cc: dri-devel, linux-kernel, linux-mips, linux-arm-kernel,
	linux-samsung-soc, imx, linux-mediatek, linux-arm-msm, freedreno,
	linux-rockchip, linux-sunxi, linux-tegra, Maxime Ripard

The loongson atomic_check implementation uses the deprecated
drm_atomic_get_existing_crtc_state() helper.

This hook is called as part of the global atomic_check, thus before the
states are swapped. The existing state thus points to the new state, and
we can use drm_atomic_get_new_crtc_state() instead.

Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
 drivers/gpu/drm/loongson/lsdc_plane.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/loongson/lsdc_plane.c b/drivers/gpu/drm/loongson/lsdc_plane.c
index aa9a97f9c4dc28eea3098507ce52e6aa6caa46eb..2967a5cca06936d5d2480fac258b01e11f8d28e1 100644
--- a/drivers/gpu/drm/loongson/lsdc_plane.c
+++ b/drivers/gpu/drm/loongson/lsdc_plane.c
@@ -194,11 +194,11 @@ static int lsdc_cursor_plane_atomic_async_check(struct drm_plane *plane,
 		drm_dbg(plane->dev, "unsupported cursor size: %ux%u\n",
 			new_state->crtc_w, new_state->crtc_h);
 		return -EINVAL;
 	}
 
-	crtc_state = drm_atomic_get_existing_crtc_state(state, new_state->crtc);
+	crtc_state = drm_atomic_get_new_crtc_state(state, new_state->crtc);
 	if (!crtc_state->active)
 		return -EINVAL;
 
 	if (plane->state->crtc != new_state->crtc ||
 	    plane->state->src_w != new_state->src_w ||

-- 
2.50.1


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

* [PATCH 25/39] drm/mediatek: Switch to drm_atomic_get_new_crtc_state()
  2025-08-25 13:43 [PATCH 00/39] drm/atomic: Get rid of existing states (not really) Maxime Ripard
                   ` (23 preceding siblings ...)
  2025-08-25 13:43 ` [PATCH 24/39] drm/loongson: " Maxime Ripard
@ 2025-08-25 13:43 ` Maxime Ripard
  2025-08-25 13:43 ` [PATCH 26/39] drm/msm/mdp5: " Maxime Ripard
                   ` (13 subsequent siblings)
  38 siblings, 0 replies; 44+ messages in thread
From: Maxime Ripard @ 2025-08-25 13:43 UTC (permalink / raw)
  To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
	Louis Chauvet, Haneen Mohammed, Melissa Wen, Jyri Sarha,
	Tomi Valkeinen, Paul Cercueil, Liviu Dudau, Russell King,
	Manikandan Muralidharan, Dharma Balasubiramani, Nicolas Ferre,
	Alexandre Belloni, Claudiu Beznea, Inki Dae, Seung-Woo Kim,
	Kyungmin Park, Krzysztof Kozlowski, Alim Akhtar, Liu Ying,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Laurentiu Palcu, Lucas Stach, Philipp Zabel, Anitha Chrisanthus,
	Edmund Dea, Paul Kocialkowski, Sui Jingfeng, Chun-Kuang Hu,
	Matthias Brugger, AngeloGioacchino Del Regno, Rob Clark,
	Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang, Sean Paul,
	Marijn Suijten, Sandy Huang, Heiko Stübner, Andy Yan,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Thierry Reding,
	Mikko Perttunen, Jonathan Hunter, Hans de Goede, Dave Stevenson,
	Maíra Canal, Raspberry Pi Kernel Maintenance
  Cc: dri-devel, linux-kernel, linux-mips, linux-arm-kernel,
	linux-samsung-soc, imx, linux-mediatek, linux-arm-msm, freedreno,
	linux-rockchip, linux-sunxi, linux-tegra, Maxime Ripard

The mediatek atomic_check implementation uses the deprecated
drm_atomic_get_existing_crtc_state() helper.

This hook is called as part of the global atomic_check, thus before the
states are swapped. The existing state thus points to the new state, and
we can use drm_atomic_get_new_crtc_state() instead.

Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
 drivers/gpu/drm/mediatek/mtk_plane.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_plane.c b/drivers/gpu/drm/mediatek/mtk_plane.c
index cbc4f37da8ba81ff9c8b3b58f66363837ffc21ec..d4486a63a6e01f02b6777522440dee8e39d51bf1 100644
--- a/drivers/gpu/drm/mediatek/mtk_plane.c
+++ b/drivers/gpu/drm/mediatek/mtk_plane.c
@@ -120,11 +120,12 @@ static int mtk_plane_atomic_async_check(struct drm_plane *plane,
 	ret = mtk_crtc_plane_check(new_plane_state->crtc, plane,
 				   to_mtk_plane_state(new_plane_state));
 	if (ret)
 		return ret;
 
-	crtc_state = drm_atomic_get_existing_crtc_state(state, new_plane_state->crtc);
+	crtc_state = drm_atomic_get_new_crtc_state(state,
+						   new_plane_state->crtc);
 
 	return drm_atomic_helper_check_plane_state(plane->state, crtc_state,
 						   DRM_PLANE_NO_SCALING,
 						   DRM_PLANE_NO_SCALING,
 						   true, true);

-- 
2.50.1


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

* [PATCH 26/39] drm/msm/mdp5: Switch to drm_atomic_get_new_crtc_state()
  2025-08-25 13:43 [PATCH 00/39] drm/atomic: Get rid of existing states (not really) Maxime Ripard
                   ` (24 preceding siblings ...)
  2025-08-25 13:43 ` [PATCH 25/39] drm/mediatek: " Maxime Ripard
@ 2025-08-25 13:43 ` Maxime Ripard
  2025-08-27  1:50   ` Dmitry Baryshkov
  2025-08-25 13:43 ` [PATCH 27/39] drm/omap: " Maxime Ripard
                   ` (12 subsequent siblings)
  38 siblings, 1 reply; 44+ messages in thread
From: Maxime Ripard @ 2025-08-25 13:43 UTC (permalink / raw)
  To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
	Louis Chauvet, Haneen Mohammed, Melissa Wen, Jyri Sarha,
	Tomi Valkeinen, Paul Cercueil, Liviu Dudau, Russell King,
	Manikandan Muralidharan, Dharma Balasubiramani, Nicolas Ferre,
	Alexandre Belloni, Claudiu Beznea, Inki Dae, Seung-Woo Kim,
	Kyungmin Park, Krzysztof Kozlowski, Alim Akhtar, Liu Ying,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Laurentiu Palcu, Lucas Stach, Philipp Zabel, Anitha Chrisanthus,
	Edmund Dea, Paul Kocialkowski, Sui Jingfeng, Chun-Kuang Hu,
	Matthias Brugger, AngeloGioacchino Del Regno, Rob Clark,
	Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang, Sean Paul,
	Marijn Suijten, Sandy Huang, Heiko Stübner, Andy Yan,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Thierry Reding,
	Mikko Perttunen, Jonathan Hunter, Hans de Goede, Dave Stevenson,
	Maíra Canal, Raspberry Pi Kernel Maintenance
  Cc: dri-devel, linux-kernel, linux-mips, linux-arm-kernel,
	linux-samsung-soc, imx, linux-mediatek, linux-arm-msm, freedreno,
	linux-rockchip, linux-sunxi, linux-tegra, Maxime Ripard

The msm atomic_check implementation uses the deprecated
drm_atomic_get_existing_crtc_state() helper.

This hook is called as part of the global atomic_check, thus before the
states are swapped. The existing state thus points to the new state, and
we can use drm_atomic_get_new_crtc_state() instead.

Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
 drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c
index 7c790406d533fbabb330c438419efb18204cc4b7..4ca183fb61a95af60ef5a2c011ae6b2a0df963f0 100644
--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c
+++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c
@@ -334,12 +334,11 @@ static int mdp5_plane_atomic_check(struct drm_plane *plane,
 
 	crtc = new_plane_state->crtc ? new_plane_state->crtc : old_plane_state->crtc;
 	if (!crtc)
 		return 0;
 
-	crtc_state = drm_atomic_get_existing_crtc_state(state,
-							crtc);
+	crtc_state = drm_atomic_get_new_crtc_state(state, crtc);
 	if (WARN_ON(!crtc_state))
 		return -EINVAL;
 
 	return mdp5_plane_atomic_check_with_state(crtc_state, new_plane_state);
 }
@@ -371,12 +370,12 @@ static int mdp5_plane_atomic_async_check(struct drm_plane *plane,
 	struct mdp5_plane_state *mdp5_state = to_mdp5_plane_state(new_plane_state);
 	struct drm_crtc_state *crtc_state;
 	int min_scale, max_scale;
 	int ret;
 
-	crtc_state = drm_atomic_get_existing_crtc_state(state,
-							new_plane_state->crtc);
+	crtc_state = drm_atomic_get_new_crtc_state(state,
+						   new_plane_state->crtc);
 	if (WARN_ON(!crtc_state))
 		return -EINVAL;
 
 	if (!crtc_state->active)
 		return -EINVAL;

-- 
2.50.1


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

* [PATCH 27/39] drm/omap: Switch to drm_atomic_get_new_crtc_state()
  2025-08-25 13:43 [PATCH 00/39] drm/atomic: Get rid of existing states (not really) Maxime Ripard
                   ` (25 preceding siblings ...)
  2025-08-25 13:43 ` [PATCH 26/39] drm/msm/mdp5: " Maxime Ripard
@ 2025-08-25 13:43 ` Maxime Ripard
  2025-08-25 13:43 ` [PATCH 28/39] drm/rockchip: " Maxime Ripard
                   ` (11 subsequent siblings)
  38 siblings, 0 replies; 44+ messages in thread
From: Maxime Ripard @ 2025-08-25 13:43 UTC (permalink / raw)
  To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
	Louis Chauvet, Haneen Mohammed, Melissa Wen, Jyri Sarha,
	Tomi Valkeinen, Paul Cercueil, Liviu Dudau, Russell King,
	Manikandan Muralidharan, Dharma Balasubiramani, Nicolas Ferre,
	Alexandre Belloni, Claudiu Beznea, Inki Dae, Seung-Woo Kim,
	Kyungmin Park, Krzysztof Kozlowski, Alim Akhtar, Liu Ying,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Laurentiu Palcu, Lucas Stach, Philipp Zabel, Anitha Chrisanthus,
	Edmund Dea, Paul Kocialkowski, Sui Jingfeng, Chun-Kuang Hu,
	Matthias Brugger, AngeloGioacchino Del Regno, Rob Clark,
	Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang, Sean Paul,
	Marijn Suijten, Sandy Huang, Heiko Stübner, Andy Yan,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Thierry Reding,
	Mikko Perttunen, Jonathan Hunter, Hans de Goede, Dave Stevenson,
	Maíra Canal, Raspberry Pi Kernel Maintenance
  Cc: dri-devel, linux-kernel, linux-mips, linux-arm-kernel,
	linux-samsung-soc, imx, linux-mediatek, linux-arm-msm, freedreno,
	linux-rockchip, linux-sunxi, linux-tegra, Maxime Ripard

The omap atomic_check implementation uses the deprecated
drm_atomic_get_existing_crtc_state() helper.

This hook is called as part of the global atomic_check, thus before the
states are swapped. The existing state thus points to the new state, and
we can use drm_atomic_get_new_crtc_state() instead.

Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
 drivers/gpu/drm/omapdrm/omap_plane.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/omapdrm/omap_plane.c b/drivers/gpu/drm/omapdrm/omap_plane.c
index 24a2ded08b454c4f2225e84f7b0ed09ed733d6b7..d74ef6694c10995c7393217a4d81275b36e00e2b 100644
--- a/drivers/gpu/drm/omapdrm/omap_plane.c
+++ b/drivers/gpu/drm/omapdrm/omap_plane.c
@@ -227,11 +227,11 @@ static int omap_plane_atomic_check(struct drm_plane *plane,
 
 	crtc = new_plane_state->crtc ? new_plane_state->crtc : plane->state->crtc;
 	if (!crtc)
 		return 0;
 
-	crtc_state = drm_atomic_get_existing_crtc_state(state, crtc);
+	crtc_state = drm_atomic_get_new_crtc_state(state, crtc);
 	/* we should have a crtc state if the plane is attached to a crtc */
 	if (WARN_ON(!crtc_state))
 		return 0;
 
 	/*

-- 
2.50.1


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

* [PATCH 28/39] drm/rockchip: Switch to drm_atomic_get_new_crtc_state()
  2025-08-25 13:43 [PATCH 00/39] drm/atomic: Get rid of existing states (not really) Maxime Ripard
                   ` (26 preceding siblings ...)
  2025-08-25 13:43 ` [PATCH 27/39] drm/omap: " Maxime Ripard
@ 2025-08-25 13:43 ` Maxime Ripard
  2025-08-25 13:43 ` [PATCH 29/39] drm/sun4i: " Maxime Ripard
                   ` (10 subsequent siblings)
  38 siblings, 0 replies; 44+ messages in thread
From: Maxime Ripard @ 2025-08-25 13:43 UTC (permalink / raw)
  To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
	Louis Chauvet, Haneen Mohammed, Melissa Wen, Jyri Sarha,
	Tomi Valkeinen, Paul Cercueil, Liviu Dudau, Russell King,
	Manikandan Muralidharan, Dharma Balasubiramani, Nicolas Ferre,
	Alexandre Belloni, Claudiu Beznea, Inki Dae, Seung-Woo Kim,
	Kyungmin Park, Krzysztof Kozlowski, Alim Akhtar, Liu Ying,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Laurentiu Palcu, Lucas Stach, Philipp Zabel, Anitha Chrisanthus,
	Edmund Dea, Paul Kocialkowski, Sui Jingfeng, Chun-Kuang Hu,
	Matthias Brugger, AngeloGioacchino Del Regno, Rob Clark,
	Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang, Sean Paul,
	Marijn Suijten, Sandy Huang, Heiko Stübner, Andy Yan,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Thierry Reding,
	Mikko Perttunen, Jonathan Hunter, Hans de Goede, Dave Stevenson,
	Maíra Canal, Raspberry Pi Kernel Maintenance
  Cc: dri-devel, linux-kernel, linux-mips, linux-arm-kernel,
	linux-samsung-soc, imx, linux-mediatek, linux-arm-msm, freedreno,
	linux-rockchip, linux-sunxi, linux-tegra, Maxime Ripard

The rockchip atomic_check implementation uses the deprecated
drm_atomic_get_existing_crtc_state() helper.

This hook is called as part of the global atomic_check, thus before the
states are swapped. The existing state thus points to the new state, and
we can use drm_atomic_get_new_crtc_state() instead.

Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c  | 6 +++---
 drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
index ba6b0528d1e5a493cdef85dd1ea258e70c31ccd5..5369b77ea434c794ed7d509802fa29c39d2bfa7a 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
@@ -824,12 +824,11 @@ static int vop_plane_atomic_check(struct drm_plane *plane,
 					DRM_PLANE_NO_SCALING;
 
 	if (!crtc || WARN_ON(!fb))
 		return 0;
 
-	crtc_state = drm_atomic_get_existing_crtc_state(state,
-							crtc);
+	crtc_state = drm_atomic_get_new_crtc_state(state, crtc);
 	if (WARN_ON(!crtc_state))
 		return -EINVAL;
 
 	ret = drm_atomic_helper_check_plane_state(new_plane_state, crtc_state,
 						  min_scale, max_scale,
@@ -1090,11 +1089,12 @@ static int vop_plane_atomic_async_check(struct drm_plane *plane,
 		return -EINVAL;
 
 	if (!plane->state->fb)
 		return -EINVAL;
 
-	crtc_state = drm_atomic_get_existing_crtc_state(state, new_plane_state->crtc);
+	crtc_state = drm_atomic_get_new_crtc_state(state,
+						   new_plane_state->crtc);
 
 	/* Special case for asynchronous cursor updates. */
 	if (!crtc_state)
 		crtc_state = plane->crtc->state;
 
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
index b50927a824b4020a7ffd57974070ed202cd8b838..4556cf7a33641529c673b8d7842115dc739dede2 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
@@ -1011,11 +1011,11 @@ static int vop2_plane_atomic_check(struct drm_plane *plane,
 
 	vp = to_vop2_video_port(crtc);
 	vop2 = vp->vop2;
 	vop2_data = vop2->data;
 
-	cstate = drm_atomic_get_existing_crtc_state(pstate->state, crtc);
+	cstate = drm_atomic_get_new_crtc_state(pstate->state, crtc);
 	if (WARN_ON(!cstate))
 		return -EINVAL;
 
 	ret = drm_atomic_helper_check_plane_state(pstate, cstate,
 						  min_scale, max_scale,

-- 
2.50.1


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

* [PATCH 29/39] drm/sun4i: Switch to drm_atomic_get_new_crtc_state()
  2025-08-25 13:43 [PATCH 00/39] drm/atomic: Get rid of existing states (not really) Maxime Ripard
                   ` (27 preceding siblings ...)
  2025-08-25 13:43 ` [PATCH 28/39] drm/rockchip: " Maxime Ripard
@ 2025-08-25 13:43 ` Maxime Ripard
  2025-08-25 13:43 ` [PATCH 30/39] drm/tegra: " Maxime Ripard
                   ` (9 subsequent siblings)
  38 siblings, 0 replies; 44+ messages in thread
From: Maxime Ripard @ 2025-08-25 13:43 UTC (permalink / raw)
  To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
	Louis Chauvet, Haneen Mohammed, Melissa Wen, Jyri Sarha,
	Tomi Valkeinen, Paul Cercueil, Liviu Dudau, Russell King,
	Manikandan Muralidharan, Dharma Balasubiramani, Nicolas Ferre,
	Alexandre Belloni, Claudiu Beznea, Inki Dae, Seung-Woo Kim,
	Kyungmin Park, Krzysztof Kozlowski, Alim Akhtar, Liu Ying,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Laurentiu Palcu, Lucas Stach, Philipp Zabel, Anitha Chrisanthus,
	Edmund Dea, Paul Kocialkowski, Sui Jingfeng, Chun-Kuang Hu,
	Matthias Brugger, AngeloGioacchino Del Regno, Rob Clark,
	Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang, Sean Paul,
	Marijn Suijten, Sandy Huang, Heiko Stübner, Andy Yan,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Thierry Reding,
	Mikko Perttunen, Jonathan Hunter, Hans de Goede, Dave Stevenson,
	Maíra Canal, Raspberry Pi Kernel Maintenance
  Cc: dri-devel, linux-kernel, linux-mips, linux-arm-kernel,
	linux-samsung-soc, imx, linux-mediatek, linux-arm-msm, freedreno,
	linux-rockchip, linux-sunxi, linux-tegra, Maxime Ripard

The sun4i atomic_check implementation uses the deprecated
drm_atomic_get_existing_crtc_state() helper.

This hook is called as part of the global atomic_check, thus before the
states are swapped. The existing state thus points to the new state, and
we can use drm_atomic_get_new_crtc_state() instead.

Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
 drivers/gpu/drm/sun4i/sun8i_ui_layer.c | 3 +--
 drivers/gpu/drm/sun4i/sun8i_vi_layer.c | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/sun4i/sun8i_ui_layer.c b/drivers/gpu/drm/sun4i/sun8i_ui_layer.c
index f97be0040aab29cb4e138fcceb20e90c72db0252..94ac6ad6f30688a048e594811d2ae72aaa44376d 100644
--- a/drivers/gpu/drm/sun4i/sun8i_ui_layer.c
+++ b/drivers/gpu/drm/sun4i/sun8i_ui_layer.c
@@ -204,12 +204,11 @@ static int sun8i_ui_layer_atomic_check(struct drm_plane *plane,
 	int min_scale, max_scale;
 
 	if (!crtc)
 		return 0;
 
-	crtc_state = drm_atomic_get_existing_crtc_state(state,
-							crtc);
+	crtc_state = drm_atomic_get_new_crtc_state(state, crtc);
 	if (WARN_ON(!crtc_state))
 		return -EINVAL;
 
 	min_scale = DRM_PLANE_NO_SCALING;
 	max_scale = DRM_PLANE_NO_SCALING;
diff --git a/drivers/gpu/drm/sun4i/sun8i_vi_layer.c b/drivers/gpu/drm/sun4i/sun8i_vi_layer.c
index a09ee4097537fca8b653f34a833b36b69e343ea5..1f77e1d2984548e746805f8323f537f3b4d93198 100644
--- a/drivers/gpu/drm/sun4i/sun8i_vi_layer.c
+++ b/drivers/gpu/drm/sun4i/sun8i_vi_layer.c
@@ -325,12 +325,11 @@ static int sun8i_vi_layer_atomic_check(struct drm_plane *plane,
 	int min_scale, max_scale;
 
 	if (!crtc)
 		return 0;
 
-	crtc_state = drm_atomic_get_existing_crtc_state(state,
-							crtc);
+	crtc_state = drm_atomic_get_new_crtc_state(state, crtc);
 	if (WARN_ON(!crtc_state))
 		return -EINVAL;
 
 	min_scale = DRM_PLANE_NO_SCALING;
 	max_scale = DRM_PLANE_NO_SCALING;

-- 
2.50.1


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

* [PATCH 30/39] drm/tegra: Switch to drm_atomic_get_new_crtc_state()
  2025-08-25 13:43 [PATCH 00/39] drm/atomic: Get rid of existing states (not really) Maxime Ripard
                   ` (28 preceding siblings ...)
  2025-08-25 13:43 ` [PATCH 29/39] drm/sun4i: " Maxime Ripard
@ 2025-08-25 13:43 ` Maxime Ripard
  2025-08-25 13:43 ` [PATCH 31/39] drm/tilcdc: " Maxime Ripard
                   ` (8 subsequent siblings)
  38 siblings, 0 replies; 44+ messages in thread
From: Maxime Ripard @ 2025-08-25 13:43 UTC (permalink / raw)
  To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
	Louis Chauvet, Haneen Mohammed, Melissa Wen, Jyri Sarha,
	Tomi Valkeinen, Paul Cercueil, Liviu Dudau, Russell King,
	Manikandan Muralidharan, Dharma Balasubiramani, Nicolas Ferre,
	Alexandre Belloni, Claudiu Beznea, Inki Dae, Seung-Woo Kim,
	Kyungmin Park, Krzysztof Kozlowski, Alim Akhtar, Liu Ying,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Laurentiu Palcu, Lucas Stach, Philipp Zabel, Anitha Chrisanthus,
	Edmund Dea, Paul Kocialkowski, Sui Jingfeng, Chun-Kuang Hu,
	Matthias Brugger, AngeloGioacchino Del Regno, Rob Clark,
	Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang, Sean Paul,
	Marijn Suijten, Sandy Huang, Heiko Stübner, Andy Yan,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Thierry Reding,
	Mikko Perttunen, Jonathan Hunter, Hans de Goede, Dave Stevenson,
	Maíra Canal, Raspberry Pi Kernel Maintenance
  Cc: dri-devel, linux-kernel, linux-mips, linux-arm-kernel,
	linux-samsung-soc, imx, linux-mediatek, linux-arm-msm, freedreno,
	linux-rockchip, linux-sunxi, linux-tegra, Maxime Ripard

The tegra atomic_check implementation uses the deprecated
drm_atomic_get_existing_crtc_state() helper.

This hook is called as part of the global atomic_check, thus before the
states are swapped. The existing state thus points to the new state, and
we can use drm_atomic_get_new_crtc_state() instead.

Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
 drivers/gpu/drm/tegra/dc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c
index 59d5c1ba145a82f62c1835da574867084da98106..0f80da3544c9b3a239c43740c05f007711bc728b 100644
--- a/drivers/gpu/drm/tegra/dc.c
+++ b/drivers/gpu/drm/tegra/dc.c
@@ -1031,11 +1031,11 @@ static int tegra_cursor_atomic_async_check(struct drm_plane *plane, struct drm_a
 	struct drm_plane_state *new_state = drm_atomic_get_new_plane_state(state, plane);
 	struct drm_crtc_state *crtc_state;
 	int min_scale, max_scale;
 	int err;
 
-	crtc_state = drm_atomic_get_existing_crtc_state(state, new_state->crtc);
+	crtc_state = drm_atomic_get_new_crtc_state(state, new_state->crtc);
 	if (WARN_ON(!crtc_state))
 		return -EINVAL;
 
 	if (!crtc_state->active)
 		return -EINVAL;

-- 
2.50.1


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

* [PATCH 31/39] drm/tilcdc: Switch to drm_atomic_get_new_crtc_state()
  2025-08-25 13:43 [PATCH 00/39] drm/atomic: Get rid of existing states (not really) Maxime Ripard
                   ` (29 preceding siblings ...)
  2025-08-25 13:43 ` [PATCH 30/39] drm/tegra: " Maxime Ripard
@ 2025-08-25 13:43 ` Maxime Ripard
  2025-08-25 13:43 ` [PATCH 32/39] drm/vboxvideo: " Maxime Ripard
                   ` (7 subsequent siblings)
  38 siblings, 0 replies; 44+ messages in thread
From: Maxime Ripard @ 2025-08-25 13:43 UTC (permalink / raw)
  To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
	Louis Chauvet, Haneen Mohammed, Melissa Wen, Jyri Sarha,
	Tomi Valkeinen, Paul Cercueil, Liviu Dudau, Russell King,
	Manikandan Muralidharan, Dharma Balasubiramani, Nicolas Ferre,
	Alexandre Belloni, Claudiu Beznea, Inki Dae, Seung-Woo Kim,
	Kyungmin Park, Krzysztof Kozlowski, Alim Akhtar, Liu Ying,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Laurentiu Palcu, Lucas Stach, Philipp Zabel, Anitha Chrisanthus,
	Edmund Dea, Paul Kocialkowski, Sui Jingfeng, Chun-Kuang Hu,
	Matthias Brugger, AngeloGioacchino Del Regno, Rob Clark,
	Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang, Sean Paul,
	Marijn Suijten, Sandy Huang, Heiko Stübner, Andy Yan,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Thierry Reding,
	Mikko Perttunen, Jonathan Hunter, Hans de Goede, Dave Stevenson,
	Maíra Canal, Raspberry Pi Kernel Maintenance
  Cc: dri-devel, linux-kernel, linux-mips, linux-arm-kernel,
	linux-samsung-soc, imx, linux-mediatek, linux-arm-msm, freedreno,
	linux-rockchip, linux-sunxi, linux-tegra, Maxime Ripard

The tilcdc atomic_check implementation uses the deprecated
drm_atomic_get_existing_crtc_state() helper.

This hook is called as part of the global atomic_check, thus before the
states are swapped. The existing state thus points to the new state, and
we can use drm_atomic_get_new_crtc_state() instead.

Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
 drivers/gpu/drm/tilcdc/tilcdc_plane.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/tilcdc/tilcdc_plane.c b/drivers/gpu/drm/tilcdc/tilcdc_plane.c
index cf77a8ce7398040814ec20eeffc6da960e36dfc0..aa72ca679598b6617366e89ffb3838ed8b323f2f 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_plane.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_plane.c
@@ -40,12 +40,11 @@ static int tilcdc_plane_atomic_check(struct drm_plane *plane,
 		dev_err(plane->dev->dev, "%s: crtc position must be zero.",
 			__func__);
 		return -EINVAL;
 	}
 
-	crtc_state = drm_atomic_get_existing_crtc_state(state,
-							new_state->crtc);
+	crtc_state = drm_atomic_get_new_crtc_state(state, new_state->crtc);
 	/* we should have a crtc state if the plane is attached to a crtc */
 	if (WARN_ON(!crtc_state))
 		return 0;
 
 	if (crtc_state->mode.hdisplay != new_state->crtc_w ||

-- 
2.50.1


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

* [PATCH 32/39] drm/vboxvideo: Switch to drm_atomic_get_new_crtc_state()
  2025-08-25 13:43 [PATCH 00/39] drm/atomic: Get rid of existing states (not really) Maxime Ripard
                   ` (30 preceding siblings ...)
  2025-08-25 13:43 ` [PATCH 31/39] drm/tilcdc: " Maxime Ripard
@ 2025-08-25 13:43 ` Maxime Ripard
  2025-08-25 13:43 ` [PATCH 33/39] drm/vc4: " Maxime Ripard
                   ` (6 subsequent siblings)
  38 siblings, 0 replies; 44+ messages in thread
From: Maxime Ripard @ 2025-08-25 13:43 UTC (permalink / raw)
  To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
	Louis Chauvet, Haneen Mohammed, Melissa Wen, Jyri Sarha,
	Tomi Valkeinen, Paul Cercueil, Liviu Dudau, Russell King,
	Manikandan Muralidharan, Dharma Balasubiramani, Nicolas Ferre,
	Alexandre Belloni, Claudiu Beznea, Inki Dae, Seung-Woo Kim,
	Kyungmin Park, Krzysztof Kozlowski, Alim Akhtar, Liu Ying,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Laurentiu Palcu, Lucas Stach, Philipp Zabel, Anitha Chrisanthus,
	Edmund Dea, Paul Kocialkowski, Sui Jingfeng, Chun-Kuang Hu,
	Matthias Brugger, AngeloGioacchino Del Regno, Rob Clark,
	Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang, Sean Paul,
	Marijn Suijten, Sandy Huang, Heiko Stübner, Andy Yan,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Thierry Reding,
	Mikko Perttunen, Jonathan Hunter, Hans de Goede, Dave Stevenson,
	Maíra Canal, Raspberry Pi Kernel Maintenance
  Cc: dri-devel, linux-kernel, linux-mips, linux-arm-kernel,
	linux-samsung-soc, imx, linux-mediatek, linux-arm-msm, freedreno,
	linux-rockchip, linux-sunxi, linux-tegra, Maxime Ripard

The vboxvideo atomic_check implementation uses the deprecated
drm_atomic_get_existing_crtc_state() helper.

This hook is called as part of the global atomic_check, thus before the
states are swapped. The existing state thus points to the new state, and
we can use drm_atomic_get_new_crtc_state() instead.

Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
 drivers/gpu/drm/vboxvideo/vbox_mode.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/vboxvideo/vbox_mode.c b/drivers/gpu/drm/vboxvideo/vbox_mode.c
index 9ff3bade979577df0bc2e6e9653b3fb8fd486062..aa0dded595b6e00a9aa2027b36ca11711ccc0439 100644
--- a/drivers/gpu/drm/vboxvideo/vbox_mode.c
+++ b/drivers/gpu/drm/vboxvideo/vbox_mode.c
@@ -260,12 +260,12 @@ static int vbox_primary_atomic_check(struct drm_plane *plane,
 	struct drm_plane_state *new_state = drm_atomic_get_new_plane_state(state,
 									   plane);
 	struct drm_crtc_state *crtc_state = NULL;
 
 	if (new_state->crtc) {
-		crtc_state = drm_atomic_get_existing_crtc_state(state,
-								new_state->crtc);
+		crtc_state = drm_atomic_get_new_crtc_state(state,
+							   new_state->crtc);
 		if (WARN_ON(!crtc_state))
 			return -EINVAL;
 	}
 
 	return drm_atomic_helper_check_plane_state(new_state, crtc_state,
@@ -342,12 +342,12 @@ static int vbox_cursor_atomic_check(struct drm_plane *plane,
 	u32 width = new_state->crtc_w;
 	u32 height = new_state->crtc_h;
 	int ret;
 
 	if (new_state->crtc) {
-		crtc_state = drm_atomic_get_existing_crtc_state(state,
-								new_state->crtc);
+		crtc_state = drm_atomic_get_new_crtc_state(state,
+							   new_state->crtc);
 		if (WARN_ON(!crtc_state))
 			return -EINVAL;
 	}
 
 	ret = drm_atomic_helper_check_plane_state(new_state, crtc_state,

-- 
2.50.1


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

* [PATCH 33/39] drm/vc4: Switch to drm_atomic_get_new_crtc_state()
  2025-08-25 13:43 [PATCH 00/39] drm/atomic: Get rid of existing states (not really) Maxime Ripard
                   ` (31 preceding siblings ...)
  2025-08-25 13:43 ` [PATCH 32/39] drm/vboxvideo: " Maxime Ripard
@ 2025-08-25 13:43 ` Maxime Ripard
  2025-08-25 13:43 ` [PATCH 34/39] drm/atomic: " Maxime Ripard
                   ` (5 subsequent siblings)
  38 siblings, 0 replies; 44+ messages in thread
From: Maxime Ripard @ 2025-08-25 13:43 UTC (permalink / raw)
  To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
	Louis Chauvet, Haneen Mohammed, Melissa Wen, Jyri Sarha,
	Tomi Valkeinen, Paul Cercueil, Liviu Dudau, Russell King,
	Manikandan Muralidharan, Dharma Balasubiramani, Nicolas Ferre,
	Alexandre Belloni, Claudiu Beznea, Inki Dae, Seung-Woo Kim,
	Kyungmin Park, Krzysztof Kozlowski, Alim Akhtar, Liu Ying,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Laurentiu Palcu, Lucas Stach, Philipp Zabel, Anitha Chrisanthus,
	Edmund Dea, Paul Kocialkowski, Sui Jingfeng, Chun-Kuang Hu,
	Matthias Brugger, AngeloGioacchino Del Regno, Rob Clark,
	Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang, Sean Paul,
	Marijn Suijten, Sandy Huang, Heiko Stübner, Andy Yan,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Thierry Reding,
	Mikko Perttunen, Jonathan Hunter, Hans de Goede, Dave Stevenson,
	Maíra Canal, Raspberry Pi Kernel Maintenance
  Cc: dri-devel, linux-kernel, linux-mips, linux-arm-kernel,
	linux-samsung-soc, imx, linux-mediatek, linux-arm-msm, freedreno,
	linux-rockchip, linux-sunxi, linux-tegra, Maxime Ripard

The vc4 atomic_check implementation uses the deprecated
drm_atomic_get_existing_crtc_state() helper.

This hook is called as part of the global atomic_check, thus before the
states are swapped. The existing state thus points to the new state, and
we can use drm_atomic_get_new_crtc_state() instead.

Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
 drivers/gpu/drm/vc4/vc4_plane.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/vc4/vc4_plane.c b/drivers/gpu/drm/vc4/vc4_plane.c
index 056d344c5411db0eae975b0fa52c0de7418306f1..b4a53f68865bc18f6cb1fa92b1057890d3fe0382 100644
--- a/drivers/gpu/drm/vc4/vc4_plane.c
+++ b/drivers/gpu/drm/vc4/vc4_plane.c
@@ -495,12 +495,11 @@ static int vc4_plane_setup_clipping_and_scaling(struct drm_plane_state *state)
 	struct drm_crtc_state *crtc_state;
 	u32 h_subsample = fb->format->hsub;
 	u32 v_subsample = fb->format->vsub;
 	int ret;
 
-	crtc_state = drm_atomic_get_existing_crtc_state(state->state,
-							state->crtc);
+	crtc_state = drm_atomic_get_new_crtc_state(state->state, state->crtc);
 	if (!crtc_state) {
 		DRM_DEBUG_KMS("Invalid crtc state\n");
 		return -EINVAL;
 	}
 
@@ -873,12 +872,11 @@ static void vc4_plane_calc_load(struct drm_plane_state *state)
 	struct vc4_plane_state *vc4_state;
 	struct drm_crtc_state *crtc_state;
 	unsigned int vscale_factor;
 
 	vc4_state = to_vc4_plane_state(state);
-	crtc_state = drm_atomic_get_existing_crtc_state(state->state,
-							state->crtc);
+	crtc_state = drm_atomic_get_new_crtc_state(state->state, state->crtc);
 	vrefresh = drm_mode_vrefresh(&crtc_state->adjusted_mode);
 
 	/* The HVS is able to process 2 pixels/cycle when scaling the source,
 	 * 4 pixels/cycle otherwise.
 	 * Alpha blending step seems to be pipelined and it's always operating

-- 
2.50.1


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

* [PATCH 34/39] drm/atomic: Switch to drm_atomic_get_new_crtc_state()
  2025-08-25 13:43 [PATCH 00/39] drm/atomic: Get rid of existing states (not really) Maxime Ripard
                   ` (32 preceding siblings ...)
  2025-08-25 13:43 ` [PATCH 33/39] drm/vc4: " Maxime Ripard
@ 2025-08-25 13:43 ` Maxime Ripard
  2025-08-25 13:43 ` [PATCH 35/39] drm/framebuffer: " Maxime Ripard
                   ` (4 subsequent siblings)
  38 siblings, 0 replies; 44+ messages in thread
From: Maxime Ripard @ 2025-08-25 13:43 UTC (permalink / raw)
  To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
	Louis Chauvet, Haneen Mohammed, Melissa Wen, Jyri Sarha,
	Tomi Valkeinen, Paul Cercueil, Liviu Dudau, Russell King,
	Manikandan Muralidharan, Dharma Balasubiramani, Nicolas Ferre,
	Alexandre Belloni, Claudiu Beznea, Inki Dae, Seung-Woo Kim,
	Kyungmin Park, Krzysztof Kozlowski, Alim Akhtar, Liu Ying,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Laurentiu Palcu, Lucas Stach, Philipp Zabel, Anitha Chrisanthus,
	Edmund Dea, Paul Kocialkowski, Sui Jingfeng, Chun-Kuang Hu,
	Matthias Brugger, AngeloGioacchino Del Regno, Rob Clark,
	Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang, Sean Paul,
	Marijn Suijten, Sandy Huang, Heiko Stübner, Andy Yan,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Thierry Reding,
	Mikko Perttunen, Jonathan Hunter, Hans de Goede, Dave Stevenson,
	Maíra Canal, Raspberry Pi Kernel Maintenance
  Cc: dri-devel, linux-kernel, linux-mips, linux-arm-kernel,
	linux-samsung-soc, imx, linux-mediatek, linux-arm-msm, freedreno,
	linux-rockchip, linux-sunxi, linux-tegra, Maxime Ripard

The drm_atomic_connector_check() function uses the deprecated
drm_atomic_get_existing_crtc_state() helper.

This hook is called as part of the global atomic_check, thus before the
states are swapped. The existing state thus points to the new state, and
we can use drm_atomic_get_new_crtc_state() instead.

Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
 drivers/gpu/drm/drm_atomic.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index 1147fa890a03ef2c3283972c816796d8de6307c9..6d92f13d489f299aea5cd14f900ae766588462da 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -478,12 +478,12 @@ static int drm_atomic_connector_check(struct drm_connector *connector,
 			       connector->base.id, connector->name);
 		return -EINVAL;
 	}
 
 	if (state->crtc)
-		crtc_state = drm_atomic_get_existing_crtc_state(state->state,
-								state->crtc);
+		crtc_state = drm_atomic_get_new_crtc_state(state->state,
+							   state->crtc);
 
 	if (writeback_job->fb && !crtc_state->active) {
 		drm_dbg_atomic(connector->dev,
 			       "[CONNECTOR:%d:%s] has framebuffer, but [CRTC:%d] is off\n",
 			       connector->base.id, connector->name,

-- 
2.50.1


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

* [PATCH 35/39] drm/framebuffer: Switch to drm_atomic_get_new_crtc_state()
  2025-08-25 13:43 [PATCH 00/39] drm/atomic: Get rid of existing states (not really) Maxime Ripard
                   ` (33 preceding siblings ...)
  2025-08-25 13:43 ` [PATCH 34/39] drm/atomic: " Maxime Ripard
@ 2025-08-25 13:43 ` Maxime Ripard
  2025-08-25 13:43 ` [PATCH 36/39] drm/atomic: Remove unused drm_atomic_get_existing_crtc_state() Maxime Ripard
                   ` (3 subsequent siblings)
  38 siblings, 0 replies; 44+ messages in thread
From: Maxime Ripard @ 2025-08-25 13:43 UTC (permalink / raw)
  To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
	Louis Chauvet, Haneen Mohammed, Melissa Wen, Jyri Sarha,
	Tomi Valkeinen, Paul Cercueil, Liviu Dudau, Russell King,
	Manikandan Muralidharan, Dharma Balasubiramani, Nicolas Ferre,
	Alexandre Belloni, Claudiu Beznea, Inki Dae, Seung-Woo Kim,
	Kyungmin Park, Krzysztof Kozlowski, Alim Akhtar, Liu Ying,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Laurentiu Palcu, Lucas Stach, Philipp Zabel, Anitha Chrisanthus,
	Edmund Dea, Paul Kocialkowski, Sui Jingfeng, Chun-Kuang Hu,
	Matthias Brugger, AngeloGioacchino Del Regno, Rob Clark,
	Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang, Sean Paul,
	Marijn Suijten, Sandy Huang, Heiko Stübner, Andy Yan,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Thierry Reding,
	Mikko Perttunen, Jonathan Hunter, Hans de Goede, Dave Stevenson,
	Maíra Canal, Raspberry Pi Kernel Maintenance
  Cc: dri-devel, linux-kernel, linux-mips, linux-arm-kernel,
	linux-samsung-soc, imx, linux-mediatek, linux-arm-msm, freedreno,
	linux-rockchip, linux-sunxi, linux-tegra, Maxime Ripard

The atomic_remove_fb() function uses the deprecated
drm_atomic_get_existing_crtc_state() helper.

Despite its name, this function builds and commit a new
drm_atomic_state, and the call to drm_atomic_get_existing_crtc_state()
is part of the state building, thus happening before the states are
swapped.

As such, the existing state points to the new state, and we can use
drm_atomic_get_new_crtc_state() instead.

Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
 drivers/gpu/drm/drm_framebuffer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c
index adbb73f00d68b8fb7c1d99a4209d5b4e91ec5f8d..18e753ade0011b87d0728bdb27d26ea37d75c213 100644
--- a/drivers/gpu/drm/drm_framebuffer.c
+++ b/drivers/gpu/drm/drm_framebuffer.c
@@ -1046,11 +1046,11 @@ static int atomic_remove_fb(struct drm_framebuffer *fb)
 			drm_dbg_kms(dev,
 				    "Disabling [CRTC:%d:%s] because [FB:%d] is removed\n",
 				    plane_state->crtc->base.id,
 				    plane_state->crtc->name, fb->base.id);
 
-			crtc_state = drm_atomic_get_existing_crtc_state(state, plane_state->crtc);
+			crtc_state = drm_atomic_get_new_crtc_state(state, plane_state->crtc);
 
 			ret = drm_atomic_add_affected_connectors(state, plane_state->crtc);
 			if (ret)
 				goto unlock;
 

-- 
2.50.1


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

* [PATCH 36/39] drm/atomic: Remove unused drm_atomic_get_existing_crtc_state()
  2025-08-25 13:43 [PATCH 00/39] drm/atomic: Get rid of existing states (not really) Maxime Ripard
                   ` (34 preceding siblings ...)
  2025-08-25 13:43 ` [PATCH 35/39] drm/framebuffer: " Maxime Ripard
@ 2025-08-25 13:43 ` Maxime Ripard
  2025-08-25 13:43 ` [PATCH 37/39] drm/atomic: Document __drm_crtcs_state state pointer Maxime Ripard
                   ` (2 subsequent siblings)
  38 siblings, 0 replies; 44+ messages in thread
From: Maxime Ripard @ 2025-08-25 13:43 UTC (permalink / raw)
  To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
	Louis Chauvet, Haneen Mohammed, Melissa Wen, Jyri Sarha,
	Tomi Valkeinen, Paul Cercueil, Liviu Dudau, Russell King,
	Manikandan Muralidharan, Dharma Balasubiramani, Nicolas Ferre,
	Alexandre Belloni, Claudiu Beznea, Inki Dae, Seung-Woo Kim,
	Kyungmin Park, Krzysztof Kozlowski, Alim Akhtar, Liu Ying,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Laurentiu Palcu, Lucas Stach, Philipp Zabel, Anitha Chrisanthus,
	Edmund Dea, Paul Kocialkowski, Sui Jingfeng, Chun-Kuang Hu,
	Matthias Brugger, AngeloGioacchino Del Regno, Rob Clark,
	Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang, Sean Paul,
	Marijn Suijten, Sandy Huang, Heiko Stübner, Andy Yan,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Thierry Reding,
	Mikko Perttunen, Jonathan Hunter, Hans de Goede, Dave Stevenson,
	Maíra Canal, Raspberry Pi Kernel Maintenance
  Cc: dri-devel, linux-kernel, linux-mips, linux-arm-kernel,
	linux-samsung-soc, imx, linux-mediatek, linux-arm-msm, freedreno,
	linux-rockchip, linux-sunxi, linux-tegra, Maxime Ripard

The drm_atomic_get_existing_crtc_state() function is deprecated and
isn't used anymore, so let's remove it.

Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
 include/drm/drm_atomic.h | 18 ------------------
 1 file changed, 18 deletions(-)

diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h
index 89c9a059b36763205fc2fc764283423cbea62679..cba63857e920515b48b75fc3c2d5239fc1ae59c1 100644
--- a/include/drm/drm_atomic.h
+++ b/include/drm/drm_atomic.h
@@ -663,28 +663,10 @@ drm_atomic_get_old_crtc_for_encoder(struct drm_atomic_state *state,
 					 struct drm_encoder *encoder);
 struct drm_crtc *
 drm_atomic_get_new_crtc_for_encoder(struct drm_atomic_state *state,
 					 struct drm_encoder *encoder);
 
-/**
- * drm_atomic_get_existing_crtc_state - get CRTC state, if it exists
- * @state: global atomic state object
- * @crtc: CRTC to grab
- *
- * This function returns the CRTC state for the given CRTC, or NULL
- * if the CRTC is not part of the global atomic state.
- *
- * This function is deprecated, @drm_atomic_get_old_crtc_state or
- * @drm_atomic_get_new_crtc_state should be used instead.
- */
-static inline struct drm_crtc_state *
-drm_atomic_get_existing_crtc_state(const struct drm_atomic_state *state,
-				   struct drm_crtc *crtc)
-{
-	return state->crtcs[drm_crtc_index(crtc)].state;
-}
-
 /**
  * drm_atomic_get_old_crtc_state - get old CRTC state, if it exists
  * @state: global atomic state object
  * @crtc: CRTC to grab
  *

-- 
2.50.1


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

* [PATCH 37/39] drm/atomic: Document __drm_crtcs_state state pointer
  2025-08-25 13:43 [PATCH 00/39] drm/atomic: Get rid of existing states (not really) Maxime Ripard
                   ` (35 preceding siblings ...)
  2025-08-25 13:43 ` [PATCH 36/39] drm/atomic: Remove unused drm_atomic_get_existing_crtc_state() Maxime Ripard
@ 2025-08-25 13:43 ` Maxime Ripard
  2025-08-25 13:43 ` [PATCH 38/39] drm/atomic: Convert drm_atomic_get_private_obj_state() to use new plane state Maxime Ripard
  2025-08-25 13:43 ` [PATCH 39/39] drm/atomic: Document __drm_private_objs_state state pointer Maxime Ripard
  38 siblings, 0 replies; 44+ messages in thread
From: Maxime Ripard @ 2025-08-25 13:43 UTC (permalink / raw)
  To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
	Louis Chauvet, Haneen Mohammed, Melissa Wen, Jyri Sarha,
	Tomi Valkeinen, Paul Cercueil, Liviu Dudau, Russell King,
	Manikandan Muralidharan, Dharma Balasubiramani, Nicolas Ferre,
	Alexandre Belloni, Claudiu Beznea, Inki Dae, Seung-Woo Kim,
	Kyungmin Park, Krzysztof Kozlowski, Alim Akhtar, Liu Ying,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Laurentiu Palcu, Lucas Stach, Philipp Zabel, Anitha Chrisanthus,
	Edmund Dea, Paul Kocialkowski, Sui Jingfeng, Chun-Kuang Hu,
	Matthias Brugger, AngeloGioacchino Del Regno, Rob Clark,
	Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang, Sean Paul,
	Marijn Suijten, Sandy Huang, Heiko Stübner, Andy Yan,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Thierry Reding,
	Mikko Perttunen, Jonathan Hunter, Hans de Goede, Dave Stevenson,
	Maíra Canal, Raspberry Pi Kernel Maintenance
  Cc: dri-devel, linux-kernel, linux-mips, linux-arm-kernel,
	linux-samsung-soc, imx, linux-mediatek, linux-arm-msm, freedreno,
	linux-rockchip, linux-sunxi, linux-tegra, Maxime Ripard

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.

Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
 include/drm/drm_atomic.h | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h
index cba63857e920515b48b75fc3c2d5239fc1ae59c1..e8edf33ab260c03c81e16917a6a5a7d9648d46c9 100644
--- a/include/drm/drm_atomic.h
+++ b/include/drm/drm_atomic.h
@@ -176,11 +176,25 @@ struct __drm_planes_state {
 	struct drm_plane_state *old_state, *new_state;
 };
 
 struct __drm_crtcs_state {
 	struct drm_crtc *ptr;
-	struct drm_crtc_state *state, *old_state, *new_state;
+
+	/**
+	 * @state:
+	 *
+	 * Used to track the @drm_crtc_state we will need to free
+	 * when tearing down the associated &drm_atomic_state.
+	 *
+	 * 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_crtc_state *state;
+
+	struct drm_crtc_state *old_state, *new_state;
 
 	/**
 	 * @commit:
 	 *
 	 * A reference to the CRTC commit object that is kept for use by

-- 
2.50.1


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

* [PATCH 38/39] drm/atomic: Convert drm_atomic_get_private_obj_state() to use new plane state
  2025-08-25 13:43 [PATCH 00/39] drm/atomic: Get rid of existing states (not really) Maxime Ripard
                   ` (36 preceding siblings ...)
  2025-08-25 13:43 ` [PATCH 37/39] drm/atomic: Document __drm_crtcs_state state pointer Maxime Ripard
@ 2025-08-25 13:43 ` Maxime Ripard
  2025-08-25 13:43 ` [PATCH 39/39] drm/atomic: Document __drm_private_objs_state state pointer Maxime Ripard
  38 siblings, 0 replies; 44+ messages in thread
From: Maxime Ripard @ 2025-08-25 13:43 UTC (permalink / raw)
  To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
	Louis Chauvet, Haneen Mohammed, Melissa Wen, Jyri Sarha,
	Tomi Valkeinen, Paul Cercueil, Liviu Dudau, Russell King,
	Manikandan Muralidharan, Dharma Balasubiramani, Nicolas Ferre,
	Alexandre Belloni, Claudiu Beznea, Inki Dae, Seung-Woo Kim,
	Kyungmin Park, Krzysztof Kozlowski, Alim Akhtar, Liu Ying,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Laurentiu Palcu, Lucas Stach, Philipp Zabel, Anitha Chrisanthus,
	Edmund Dea, Paul Kocialkowski, Sui Jingfeng, Chun-Kuang Hu,
	Matthias Brugger, AngeloGioacchino Del Regno, Rob Clark,
	Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang, Sean Paul,
	Marijn Suijten, Sandy Huang, Heiko Stübner, Andy Yan,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Thierry Reding,
	Mikko Perttunen, Jonathan Hunter, Hans de Goede, Dave Stevenson,
	Maíra Canal, Raspberry Pi Kernel Maintenance
  Cc: dri-devel, linux-kernel, linux-mips, linux-arm-kernel,
	linux-samsung-soc, imx, linux-mediatek, linux-arm-msm, freedreno,
	linux-rockchip, linux-sunxi, linux-tegra, Maxime Ripard

The drm_atomic_get_private_obj_state() function tries to find if a
private_obj had already been allocated and was part of the given
drm_atomic_state. If one is found, it returns the existing state
pointer.

At the point in time where drm_atomic_get_private_obj_state() can be
called (ie, during atomic_check), the existing state is the new state
and we can thus replace the hand-crafted logic by a call to
drm_atomic_get_new_private_obj_state().

Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
 drivers/gpu/drm/drm_atomic.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index 6d92f13d489f299aea5cd14f900ae766588462da..b7bef44e2d42eb56446a5a05f851c7503daeaa1f 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -829,18 +829,18 @@ EXPORT_SYMBOL(drm_atomic_private_obj_fini);
  */
 struct drm_private_state *
 drm_atomic_get_private_obj_state(struct drm_atomic_state *state,
 				 struct drm_private_obj *obj)
 {
-	int index, num_objs, i, ret;
+	int index, num_objs, ret;
 	size_t size;
 	struct __drm_private_objs_state *arr;
 	struct drm_private_state *obj_state;
 
-	for (i = 0; i < state->num_private_objs; i++)
-		if (obj == state->private_objs[i].ptr)
-			return state->private_objs[i].state;
+	obj_state = drm_atomic_get_new_private_obj_state(state, obj);
+	if (obj_state)
+		return obj_state;
 
 	ret = drm_modeset_lock(&obj->lock, state->acquire_ctx);
 	if (ret)
 		return ERR_PTR(ret);
 

-- 
2.50.1


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

* [PATCH 39/39] drm/atomic: Document __drm_private_objs_state state pointer
  2025-08-25 13:43 [PATCH 00/39] drm/atomic: Get rid of existing states (not really) Maxime Ripard
                   ` (37 preceding siblings ...)
  2025-08-25 13:43 ` [PATCH 38/39] drm/atomic: Convert drm_atomic_get_private_obj_state() to use new plane state Maxime Ripard
@ 2025-08-25 13:43 ` Maxime Ripard
  38 siblings, 0 replies; 44+ messages in thread
From: Maxime Ripard @ 2025-08-25 13:43 UTC (permalink / raw)
  To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
	Louis Chauvet, Haneen Mohammed, Melissa Wen, Jyri Sarha,
	Tomi Valkeinen, Paul Cercueil, Liviu Dudau, Russell King,
	Manikandan Muralidharan, Dharma Balasubiramani, Nicolas Ferre,
	Alexandre Belloni, Claudiu Beznea, Inki Dae, Seung-Woo Kim,
	Kyungmin Park, Krzysztof Kozlowski, Alim Akhtar, Liu Ying,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Laurentiu Palcu, Lucas Stach, Philipp Zabel, Anitha Chrisanthus,
	Edmund Dea, Paul Kocialkowski, Sui Jingfeng, Chun-Kuang Hu,
	Matthias Brugger, AngeloGioacchino Del Regno, Rob Clark,
	Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang, Sean Paul,
	Marijn Suijten, Sandy Huang, Heiko Stübner, Andy Yan,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Thierry Reding,
	Mikko Perttunen, Jonathan Hunter, Hans de Goede, Dave Stevenson,
	Maíra Canal, Raspberry Pi Kernel Maintenance
  Cc: dri-devel, linux-kernel, linux-mips, linux-arm-kernel,
	linux-samsung-soc, imx, linux-mediatek, linux-arm-msm, freedreno,
	linux-rockchip, linux-sunxi, linux-tegra, Maxime Ripard

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.

Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
 include/drm/drm_atomic.h | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h
index e8edf33ab260c03c81e16917a6a5a7d9648d46c9..a7e75bb0bdc6a38eb83c07b844dd97af48006f0f 100644
--- a/include/drm/drm_atomic.h
+++ b/include/drm/drm_atomic.h
@@ -383,11 +383,25 @@ struct drm_private_state {
 	struct drm_private_obj *obj;
 };
 
 struct __drm_private_objs_state {
 	struct drm_private_obj *ptr;
-	struct drm_private_state *state, *old_state, *new_state;
+
+	/**
+	 * @state:
+	 *
+	 * Used to track the @drm_private_state we will need to free
+	 * when tearing down the associated &drm_atomic_state.
+	 *
+	 * 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_private_state *state;
+
+	struct drm_private_state *old_state, *new_state;
 };
 
 /**
  * struct drm_atomic_state - Atomic commit structure
  *

-- 
2.50.1


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

* Re: [PATCH 26/39] drm/msm/mdp5: Switch to drm_atomic_get_new_crtc_state()
  2025-08-25 13:43 ` [PATCH 26/39] drm/msm/mdp5: " Maxime Ripard
@ 2025-08-27  1:50   ` Dmitry Baryshkov
  0 siblings, 0 replies; 44+ messages in thread
From: Dmitry Baryshkov @ 2025-08-27  1:50 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
	Louis Chauvet, Haneen Mohammed, Melissa Wen, Jyri Sarha,
	Tomi Valkeinen, Paul Cercueil, Liviu Dudau, Russell King,
	Manikandan Muralidharan, Dharma Balasubiramani, Nicolas Ferre,
	Alexandre Belloni, Claudiu Beznea, Inki Dae, Seung-Woo Kim,
	Kyungmin Park, Krzysztof Kozlowski, Alim Akhtar, Liu Ying,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Laurentiu Palcu, Lucas Stach, Philipp Zabel, Anitha Chrisanthus,
	Edmund Dea, Paul Kocialkowski, Sui Jingfeng, Chun-Kuang Hu,
	Matthias Brugger, AngeloGioacchino Del Regno, Rob Clark,
	Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang, Sean Paul,
	Marijn Suijten, Sandy Huang, Heiko Stübner, Andy Yan,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Thierry Reding,
	Mikko Perttunen, Jonathan Hunter, Hans de Goede, Dave Stevenson,
	Maíra Canal, Raspberry Pi Kernel Maintenance, dri-devel,
	linux-kernel, linux-mips, linux-arm-kernel, linux-samsung-soc,
	imx, linux-mediatek, linux-arm-msm, freedreno, linux-rockchip,
	linux-sunxi, linux-tegra

On Mon, Aug 25, 2025 at 03:43:31PM +0200, Maxime Ripard wrote:
> The msm atomic_check implementation uses the deprecated
> drm_atomic_get_existing_crtc_state() helper.
> 
> This hook is called as part of the global atomic_check, thus before the
> states are swapped. The existing state thus points to the new state, and
> we can use drm_atomic_get_new_crtc_state() instead.
> 
> Signed-off-by: Maxime Ripard <mripard@kernel.org>
> ---
>  drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>

To merge through drm-misc-next:

Acked-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>


-- 
With best wishes
Dmitry

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

* Re: [PATCH 01/39] drm/atomic: Make drm_atomic_get_connector_state() early return consistent
  2025-08-25 13:43 ` [PATCH 01/39] drm/atomic: Make drm_atomic_get_connector_state() early return consistent Maxime Ripard
@ 2025-08-27 17:40   ` Dmitry Baryshkov
  0 siblings, 0 replies; 44+ messages in thread
From: Dmitry Baryshkov @ 2025-08-27 17:40 UTC (permalink / raw)
  To: Maxime Ripard, Maarten Lankhorst, Thomas Zimmermann, David Airlie,
	Simona Vetter, Louis Chauvet, Haneen Mohammed, Melissa Wen,
	Jyri Sarha, Tomi Valkeinen, Paul Cercueil, Liviu Dudau,
	Russell King, Manikandan Muralidharan, Dharma Balasubiramani,
	Nicolas Ferre, Alexandre Belloni, Claudiu Beznea, Inki Dae,
	Seung-Woo Kim, Kyungmin Park, Krzysztof Kozlowski, Alim Akhtar,
	Liu Ying, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team,
	Fabio Estevam, Laurentiu Palcu, Lucas Stach, Philipp Zabel,
	Anitha Chrisanthus, Edmund Dea, Paul Kocialkowski, Sui Jingfeng,
	Chun-Kuang Hu, Matthias Brugger, AngeloGioacchino Del Regno,
	Rob Clark, Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang,
	Sean Paul, Marijn Suijten, Sandy Huang, Heiko Stübner,
	Andy Yan, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
	Thierry Reding, Mikko Perttunen, Jonathan Hunter, Hans de Goede,
	Dave Stevenson, Maíra Canal, Raspberry Pi Kernel Maintenance
  Cc: dri-devel, linux-kernel, linux-mips, linux-arm-kernel,
	linux-samsung-soc, imx, linux-mediatek, linux-arm-msm, freedreno,
	linux-rockchip, linux-sunxi, linux-tegra

On 25 August 2025 16.43.06 EEST, Maxime Ripard <mripard@kernel.org> wrote:
>The drm_atomic_get_connector_state() tries to lookup if a connector
>state was already allocated in the global state to return early if it
>was the case. drm_atomic_get_plane_state() and
>drm_atomic_get_crtc_state() behave similarly.
>
>However, and unlike the other two, drm_atomic_get_connector_state() will
>do that lookup after having called drm_modeset_lock(), when the others
>will do it before.
>
>Let's move the early return before the lock to make it consistent.
>
>Signed-off-by: Maxime Ripard <mripard@kernel.org>
>---
> drivers/gpu/drm/drm_atomic.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
>diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
>index cd15cf52f0c9144711da5879da57884674aea9e4..fe21f154e0fa030f85fb3d6d35e2684adcf36e26 100644
>--- a/drivers/gpu/drm/drm_atomic.c
>+++ b/drivers/gpu/drm/drm_atomic.c
>@@ -1128,10 +1128,13 @@ drm_atomic_get_connector_state(struct drm_atomic_state *state,
> 	struct drm_mode_config *config = &connector->dev->mode_config;
> 	struct drm_connector_state *connector_state;
> 
> 	WARN_ON(!state->acquire_ctx);
> 
>+	if (state->connectors[index].state)
>+		return state->connectors[index].state;

Unlike other DRM objects, connectors are dynamic. There is no guarantee that at this point this array entry exists and it's valid. You might be tampering with the unallocated memory.

>+
> 	ret = drm_modeset_lock(&config->connection_mutex, state->acquire_ctx);
> 	if (ret)
> 		return ERR_PTR(ret);
> 
> 	index = drm_connector_index(connector);
>@@ -1150,13 +1153,10 @@ drm_atomic_get_connector_state(struct drm_atomic_state *state,
> 		       sizeof(*state->connectors) * (alloc - state->num_connector));
> 
> 		state->num_connector = alloc;
> 	}
> 
>-	if (state->connectors[index].state)
>-		return state->connectors[index].state;
>-
> 	connector_state = connector->funcs->atomic_duplicate_state(connector);
> 	if (!connector_state)
> 		return ERR_PTR(-ENOMEM);
> 
> 	drm_connector_get(connector);
>


With best wishes 
Dmitry

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

* Re: [PATCH 03/39] drm/atomic: Convert drm_atomic_get_connector_state() to use new connector state
  2025-08-25 13:43 ` [PATCH 03/39] drm/atomic: Convert drm_atomic_get_connector_state() to use new connector state Maxime Ripard
@ 2025-08-27 22:27   ` Dmitry Baryshkov
  0 siblings, 0 replies; 44+ messages in thread
From: Dmitry Baryshkov @ 2025-08-27 22:27 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
	Louis Chauvet, Haneen Mohammed, Melissa Wen, Jyri Sarha,
	Tomi Valkeinen, Paul Cercueil, Liviu Dudau, Russell King,
	Manikandan Muralidharan, Dharma Balasubiramani, Nicolas Ferre,
	Alexandre Belloni, Claudiu Beznea, Inki Dae, Seung-Woo Kim,
	Kyungmin Park, Krzysztof Kozlowski, Alim Akhtar, Liu Ying,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Laurentiu Palcu, Lucas Stach, Philipp Zabel, Anitha Chrisanthus,
	Edmund Dea, Paul Kocialkowski, Sui Jingfeng, Chun-Kuang Hu,
	Matthias Brugger, AngeloGioacchino Del Regno, Rob Clark,
	Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang, Sean Paul,
	Marijn Suijten, Sandy Huang, Heiko Stübner, Andy Yan,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Thierry Reding,
	Mikko Perttunen, Jonathan Hunter, Hans de Goede, Dave Stevenson,
	Maíra Canal, Raspberry Pi Kernel Maintenance, dri-devel,
	linux-kernel, linux-mips, linux-arm-kernel, linux-samsung-soc,
	imx, linux-mediatek, linux-arm-msm, freedreno, linux-rockchip,
	linux-sunxi, linux-tegra

On Mon, Aug 25, 2025 at 03:43:08PM +0200, Maxime Ripard wrote:
> The drm_atomic_get_connector_state() function calls the deprecated
> drm_atomic_get_existing_connector_state() helper to get find if a
> connector state had already been allocated and was part of the given
> drm_atomic_state.
> 
> At the point in time where drm_atomic_get_connector_state() can be
> called (ie, during atomic_check), the existing state is the new state
> and drm_atomic_get_existing_connector_state() can thus be replaced by
> drm_atomic_get_new_connector_state().
> 
> Signed-off-by: Maxime Ripard <mripard@kernel.org>
> ---
>  drivers/gpu/drm/drm_atomic.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
> index 660b081ff5d8c39061cebfb5ea122ac1e51677ad..30b7ec05a1af07075e40cd2822ecfd67df004ba2 100644
> --- a/drivers/gpu/drm/drm_atomic.c
> +++ b/drivers/gpu/drm/drm_atomic.c
> @@ -1128,11 +1128,11 @@ drm_atomic_get_connector_state(struct drm_atomic_state *state,
>  	struct drm_mode_config *config = &connector->dev->mode_config;
>  	struct drm_connector_state *connector_state;
>  
>  	WARN_ON(!state->acquire_ctx);
>  
> -	connector_state = drm_atomic_get_existing_connector_state(state, connector);
> +	connector_state = drm_atomic_get_new_connector_state(state, connector);

I'd say, drop patches 1-2 and use this function directly as is now.

>  	if (connector_state)
>  		return connector_state;
>  
>  	ret = drm_modeset_lock(&config->connection_mutex, state->acquire_ctx);
>  	if (ret)
> 
> -- 
> 2.50.1
> 

-- 
With best wishes
Dmitry

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

* Re: [PATCH 04/39] drm/atomic: Remove unused drm_atomic_get_existing_connector_state()
  2025-08-25 13:43 ` [PATCH 04/39] drm/atomic: Remove unused drm_atomic_get_existing_connector_state() Maxime Ripard
@ 2025-08-27 22:28   ` Dmitry Baryshkov
  0 siblings, 0 replies; 44+ messages in thread
From: Dmitry Baryshkov @ 2025-08-27 22:28 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
	Louis Chauvet, Haneen Mohammed, Melissa Wen, Jyri Sarha,
	Tomi Valkeinen, Paul Cercueil, Liviu Dudau, Russell King,
	Manikandan Muralidharan, Dharma Balasubiramani, Nicolas Ferre,
	Alexandre Belloni, Claudiu Beznea, Inki Dae, Seung-Woo Kim,
	Kyungmin Park, Krzysztof Kozlowski, Alim Akhtar, Liu Ying,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Laurentiu Palcu, Lucas Stach, Philipp Zabel, Anitha Chrisanthus,
	Edmund Dea, Paul Kocialkowski, Sui Jingfeng, Chun-Kuang Hu,
	Matthias Brugger, AngeloGioacchino Del Regno, Rob Clark,
	Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang, Sean Paul,
	Marijn Suijten, Sandy Huang, Heiko Stübner, Andy Yan,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Thierry Reding,
	Mikko Perttunen, Jonathan Hunter, Hans de Goede, Dave Stevenson,
	Maíra Canal, Raspberry Pi Kernel Maintenance, dri-devel,
	linux-kernel, linux-mips, linux-arm-kernel, linux-samsung-soc,
	imx, linux-mediatek, linux-arm-msm, freedreno, linux-rockchip,
	linux-sunxi, linux-tegra

On Mon, Aug 25, 2025 at 03:43:09PM +0200, Maxime Ripard wrote:
> The drm_atomic_get_existing_connector_state() function is deprecated and
> isn't used anymore, so let's remove it.
> 
> Signed-off-by: Maxime Ripard <mripard@kernel.org>
> ---
>  include/drm/drm_atomic.h | 23 -----------------------
>  1 file changed, 23 deletions(-)
> 

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>


-- 
With best wishes
Dmitry

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

end of thread, other threads:[~2025-08-27 22:28 UTC | newest]

Thread overview: 44+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-25 13:43 [PATCH 00/39] drm/atomic: Get rid of existing states (not really) Maxime Ripard
2025-08-25 13:43 ` [PATCH 01/39] drm/atomic: Make drm_atomic_get_connector_state() early return consistent Maxime Ripard
2025-08-27 17:40   ` Dmitry Baryshkov
2025-08-25 13:43 ` [PATCH 02/39] drm/atomic: Convert drm_atomic_get_connector_state() to state accessor Maxime Ripard
2025-08-25 13:43 ` [PATCH 03/39] drm/atomic: Convert drm_atomic_get_connector_state() to use new connector state Maxime Ripard
2025-08-27 22:27   ` Dmitry Baryshkov
2025-08-25 13:43 ` [PATCH 04/39] drm/atomic: Remove unused drm_atomic_get_existing_connector_state() Maxime Ripard
2025-08-27 22:28   ` Dmitry Baryshkov
2025-08-25 13:43 ` [PATCH 05/39] drm/atomic: Document __drm_connectors_state state pointer Maxime Ripard
2025-08-25 13:43 ` [PATCH 06/39] drm/atomic: Convert __drm_atomic_get_current_plane_state() to modern accessor Maxime Ripard
2025-08-25 13:43 ` [PATCH 07/39] drm/atomic: Convert drm_atomic_get_plane_state() to use new plane state Maxime Ripard
2025-08-25 13:43 ` [PATCH 08/39] drm/vkms: Convert vkms_crtc_atomic_check() " Maxime Ripard
2025-08-25 13:43 ` [PATCH 09/39] drm/tilcdc: crtc: Use drm_atomic_helper_check_crtc_primary_plane() Maxime Ripard
2025-08-25 13:43 ` [PATCH 10/39] drm/atomic: Remove unused drm_atomic_get_existing_plane_state() Maxime Ripard
2025-08-25 13:43 ` [PATCH 11/39] drm/atomic: Document __drm_planes_state state pointer Maxime Ripard
2025-08-25 13:43 ` [PATCH 12/39] drm/atomic: Convert drm_atomic_get_crtc_state() to use new connector state Maxime Ripard
2025-08-25 13:43 ` [PATCH 13/39] drm/ingenic: ipu: Switch to drm_atomic_get_new_crtc_state() Maxime Ripard
2025-08-25 13:43 ` [PATCH 14/39] drm/arm/malidp: " Maxime Ripard
2025-08-25 13:43 ` [PATCH 15/39] drm/armada: " Maxime Ripard
2025-08-25 13:43 ` [PATCH 16/39] drm/atmel-hlcdc: " Maxime Ripard
2025-08-25 13:43 ` [PATCH 17/39] drm/exynos: " Maxime Ripard
2025-08-25 13:43 ` [PATCH 18/39] drm/imx-dc: " Maxime Ripard
2025-08-25 13:43 ` [PATCH 19/39] drm/imx-dcss: " Maxime Ripard
2025-08-25 13:43 ` [PATCH 20/39] drm/imx-ipuv3: " Maxime Ripard
2025-08-25 13:43 ` [PATCH 21/39] drm/ingenic: " Maxime Ripard
2025-08-25 13:43 ` [PATCH 22/39] drm/kmb: " Maxime Ripard
2025-08-25 13:43 ` [PATCH 23/39] drm/logicvc: " Maxime Ripard
2025-08-25 13:43 ` [PATCH 24/39] drm/loongson: " Maxime Ripard
2025-08-25 13:43 ` [PATCH 25/39] drm/mediatek: " Maxime Ripard
2025-08-25 13:43 ` [PATCH 26/39] drm/msm/mdp5: " Maxime Ripard
2025-08-27  1:50   ` Dmitry Baryshkov
2025-08-25 13:43 ` [PATCH 27/39] drm/omap: " Maxime Ripard
2025-08-25 13:43 ` [PATCH 28/39] drm/rockchip: " Maxime Ripard
2025-08-25 13:43 ` [PATCH 29/39] drm/sun4i: " Maxime Ripard
2025-08-25 13:43 ` [PATCH 30/39] drm/tegra: " Maxime Ripard
2025-08-25 13:43 ` [PATCH 31/39] drm/tilcdc: " Maxime Ripard
2025-08-25 13:43 ` [PATCH 32/39] drm/vboxvideo: " Maxime Ripard
2025-08-25 13:43 ` [PATCH 33/39] drm/vc4: " Maxime Ripard
2025-08-25 13:43 ` [PATCH 34/39] drm/atomic: " Maxime Ripard
2025-08-25 13:43 ` [PATCH 35/39] drm/framebuffer: " Maxime Ripard
2025-08-25 13:43 ` [PATCH 36/39] drm/atomic: Remove unused drm_atomic_get_existing_crtc_state() Maxime Ripard
2025-08-25 13:43 ` [PATCH 37/39] drm/atomic: Document __drm_crtcs_state state pointer Maxime Ripard
2025-08-25 13:43 ` [PATCH 38/39] drm/atomic: Convert drm_atomic_get_private_obj_state() to use new plane state Maxime Ripard
2025-08-25 13:43 ` [PATCH 39/39] drm/atomic: Document __drm_private_objs_state state pointer Maxime Ripard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).