* [PATCH v3 00/39] drm/atomic: Get rid of existing states (not really)
@ 2025-09-09 11:27 ` Maxime Ripard
0 siblings, 0 replies; 52+ messages in thread
From: Maxime Ripard @ 2025-09-09 11:27 UTC (permalink / raw)
To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter
Cc: dri-devel, Maxime Ripard, Luca Ceresoli, Dmitry Baryshkov,
Ville Syrjälä, Louis Chauvet, Haneen Mohammed,
Melissa Wen, Jyri Sarha, Tomi Valkeinen, Paul Cercueil,
linux-mips, Liviu Dudau, Russell King, Manikandan Muralidharan,
Dharma Balasubiramani, Nicolas Ferre, Alexandre Belloni,
Claudiu Beznea, linux-arm-kernel, Inki Dae, Seung-Woo Kim,
Kyungmin Park, Krzysztof Kozlowski, Alim Akhtar,
linux-samsung-soc, Liu Ying, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, imx, Laurentiu Palcu,
Lucas Stach, Philipp Zabel, Anitha Chrisanthus, Edmund Dea,
Paul Kocialkowski, Sui Jingfeng, Chun-Kuang Hu, Matthias Brugger,
AngeloGioacchino Del Regno, linux-mediatek, linux-kernel,
Rob Clark, Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang,
Sean Paul, Marijn Suijten, linux-arm-msm, freedreno, Sandy Huang,
Heiko Stübner, Andy Yan, linux-rockchip, Chen-Yu Tsai,
Jernej Skrabec, Samuel Holland, linux-sunxi, Thierry Reding,
Mikko Perttunen, Jonathan Hunter, linux-tegra, Hans de Goede,
Dave Stevenson, Maíra Canal, Raspberry Pi Kernel Maintenance
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 tested on tidss.
Let me know what you think,
Maxime
Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
Changes in v3:
- Added an armada rework patch
- Added an ingenic fix
- Collected tags
- Rebased on latest drm-misc-next tag
- Link to v2: https://lore.kernel.org/r/20250902-drm-no-more-existing-state-v2-0-de98fc5f6d66@kernel.org
Changes in v2:
- Dropped the first and second patches
- Reworked the recipient list to be nicer with SMTPs
- Link to v1: https://lore.kernel.org/r/20250825-drm-no-more-existing-state-v1-0-f08ccd9f85c9@kernel.org
---
Maxime Ripard (39):
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: Drop always true condition in atomic_check
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/ingenic: crtc: Switch to ingenic_drm_get_new_priv_state()
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 | 9 +-
drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c | 2 +-
drivers/gpu/drm/drm_atomic.c | 21 ++--
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 | 5 +-
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, 126 insertions(+), 141 deletions(-)
---
base-commit: 2a1eea8fd601db4c52f0d14f8871663b7b052c91
change-id: 20250825-drm-no-more-existing-state-9b3252c1a33b
Best regards,
--
Maxime Ripard <mripard@kernel.org>
^ permalink raw reply [flat|nested] 52+ messages in thread
* [PATCH v3 00/39] drm/atomic: Get rid of existing states (not really)
@ 2025-09-09 11:27 ` Maxime Ripard
0 siblings, 0 replies; 52+ messages in thread
From: Maxime Ripard @ 2025-09-09 11:27 UTC (permalink / raw)
To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter
Cc: dri-devel, Maxime Ripard, Luca Ceresoli, Dmitry Baryshkov,
Ville Syrjälä, Louis Chauvet, Haneen Mohammed,
Melissa Wen, Jyri Sarha, Tomi Valkeinen, Paul Cercueil,
linux-mips, Liviu Dudau, Russell King, Manikandan Muralidharan,
Dharma Balasubiramani, Nicolas Ferre, Alexandre Belloni,
Claudiu Beznea, linux-arm-kernel, Inki Dae, Seung-Woo Kim,
Kyungmin Park, Krzysztof Kozlowski, Alim Akhtar,
linux-samsung-soc, Liu Ying, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, imx, Laurentiu Palcu,
Lucas Stach, Philipp Zabel, Anitha Chrisanthus, Edmund Dea,
Paul Kocialkowski, Sui Jingfeng, Chun-Kuang Hu, Matthias Brugger,
AngeloGioacchino Del Regno, linux-mediatek, linux-kernel,
Rob Clark, Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang,
Sean Paul, Marijn Suijten, linux-arm-msm, freedreno, Sandy Huang,
Heiko Stübner, Andy Yan, linux-rockchip, Chen-Yu Tsai,
Jernej Skrabec, Samuel Holland, linux-sunxi, Thierry Reding,
Mikko Perttunen, Jonathan Hunter, linux-tegra, Hans de Goede,
Dave Stevenson, Maíra Canal, Raspberry Pi Kernel Maintenance
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 tested on tidss.
Let me know what you think,
Maxime
Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
Changes in v3:
- Added an armada rework patch
- Added an ingenic fix
- Collected tags
- Rebased on latest drm-misc-next tag
- Link to v2: https://lore.kernel.org/r/20250902-drm-no-more-existing-state-v2-0-de98fc5f6d66@kernel.org
Changes in v2:
- Dropped the first and second patches
- Reworked the recipient list to be nicer with SMTPs
- Link to v1: https://lore.kernel.org/r/20250825-drm-no-more-existing-state-v1-0-f08ccd9f85c9@kernel.org
---
Maxime Ripard (39):
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: Drop always true condition in atomic_check
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/ingenic: crtc: Switch to ingenic_drm_get_new_priv_state()
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 | 9 +-
drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c | 2 +-
drivers/gpu/drm/drm_atomic.c | 21 ++--
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 | 5 +-
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, 126 insertions(+), 141 deletions(-)
---
base-commit: 2a1eea8fd601db4c52f0d14f8871663b7b052c91
change-id: 20250825-drm-no-more-existing-state-9b3252c1a33b
Best regards,
--
Maxime Ripard <mripard@kernel.org>
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
^ permalink raw reply [flat|nested] 52+ messages in thread
* [PATCH v3 01/39] drm/atomic: Convert drm_atomic_get_connector_state() to use new connector state
2025-09-09 11:27 ` Maxime Ripard
(?)
@ 2025-09-09 11:27 ` Maxime Ripard
-1 siblings, 0 replies; 52+ messages in thread
From: Maxime Ripard @ 2025-09-09 11:27 UTC (permalink / raw)
To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter
Cc: dri-devel, Maxime Ripard, Luca Ceresoli, Dmitry Baryshkov,
Ville Syrjälä
The drm_atomic_get_connector_state() function calls a hand-rolled
implementation of 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().
Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Tested-by: Luca Ceresoli <luca.ceresoli@bootlin.com> # on imx8mp
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
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 cd15cf52f0c9144711da5879da57884674aea9e4..6d10a3e40b00c58030e4dc9fdf47bd252cac0189 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -1150,12 +1150,13 @@ 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 = drm_atomic_get_new_connector_state(state, connector);
+ if (connector_state)
+ return connector_state;
connector_state = connector->funcs->atomic_duplicate_state(connector);
if (!connector_state)
return ERR_PTR(-ENOMEM);
--
2.50.1
^ permalink raw reply related [flat|nested] 52+ messages in thread
* [PATCH v3 02/39] drm/atomic: Remove unused drm_atomic_get_existing_connector_state()
2025-09-09 11:27 ` Maxime Ripard
(?)
(?)
@ 2025-09-09 11:27 ` Maxime Ripard
-1 siblings, 0 replies; 52+ messages in thread
From: Maxime Ripard @ 2025-09-09 11:27 UTC (permalink / raw)
To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter
Cc: dri-devel, Maxime Ripard, Dmitry Baryshkov, Luca Ceresoli,
Ville Syrjälä
The drm_atomic_get_existing_connector_state() function is deprecated and
isn't used anymore, so let's remove it.
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Tested-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
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] 52+ messages in thread
* [PATCH v3 03/39] drm/atomic: Document __drm_connectors_state state pointer
2025-09-09 11:27 ` Maxime Ripard
` (2 preceding siblings ...)
(?)
@ 2025-09-09 11:27 ` Maxime Ripard
-1 siblings, 0 replies; 52+ messages in thread
From: Maxime Ripard @ 2025-09-09 11:27 UTC (permalink / raw)
To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter
Cc: dri-devel, Maxime Ripard, Luca Ceresoli, Ville Syrjälä
While the old and new state pointers are somewhat self-explanatory, the
state pointer and its relation to the other two really isn't.
Now that we've cleaned up everything and it isn't used in any
modesetting path, we can document what it's still useful for: to free
the right state when we free the global state.
Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
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] 52+ messages in thread
* [PATCH v3 04/39] drm/atomic: Convert __drm_atomic_get_current_plane_state() to modern accessor
2025-09-09 11:27 ` Maxime Ripard
` (3 preceding siblings ...)
(?)
@ 2025-09-09 11:27 ` Maxime Ripard
-1 siblings, 0 replies; 52+ messages in thread
From: Maxime Ripard @ 2025-09-09 11:27 UTC (permalink / raw)
To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter
Cc: dri-devel, Maxime Ripard, Ville Syrjälä
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.
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
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] 52+ messages in thread
* [PATCH v3 05/39] drm/atomic: Convert drm_atomic_get_plane_state() to use new plane state
2025-09-09 11:27 ` Maxime Ripard
` (4 preceding siblings ...)
(?)
@ 2025-09-09 11:27 ` Maxime Ripard
-1 siblings, 0 replies; 52+ messages in thread
From: Maxime Ripard @ 2025-09-09 11:27 UTC (permalink / raw)
To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter
Cc: dri-devel, Maxime Ripard, Ville Syrjälä
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().
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
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 6d10a3e40b00c58030e4dc9fdf47bd252cac0189..15584928f06a9175308c3ef8f1ecbe1b33b17f47 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] 52+ messages in thread
* [PATCH v3 06/39] drm/vkms: Convert vkms_crtc_atomic_check() to use new plane state
2025-09-09 11:27 ` Maxime Ripard
` (5 preceding siblings ...)
(?)
@ 2025-09-09 11:27 ` Maxime Ripard
-1 siblings, 0 replies; 52+ messages in thread
From: Maxime Ripard @ 2025-09-09 11:27 UTC (permalink / raw)
To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter
Cc: dri-devel, Maxime Ripard, Louis Chauvet, Ville Syrjälä,
Haneen Mohammed, Melissa Wen
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().
Reviewed-by: Louis Chauvet <louis.chauvet@bootlin.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
To: Louis Chauvet <louis.chauvet@bootlin.com>
Cc: Haneen Mohammed <hamohammed.sa@gmail.com>
Cc: Simona Vetter <simona@ffwll.ch>
Cc: Melissa Wen <melissa.srw@gmail.com>
Cc: dri-devel@lists.freedesktop.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] 52+ messages in thread
* [PATCH v3 07/39] drm/tilcdc: crtc: Use drm_atomic_helper_check_crtc_primary_plane()
2025-09-09 11:27 ` Maxime Ripard
` (6 preceding siblings ...)
(?)
@ 2025-09-09 11:27 ` Maxime Ripard
2025-09-12 9:43 ` Jyri Sarha
-1 siblings, 1 reply; 52+ messages in thread
From: Maxime Ripard @ 2025-09-09 11:27 UTC (permalink / raw)
To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter
Cc: dri-devel, Maxime Ripard, Ville Syrjälä, Jyri Sarha,
Tomi Valkeinen
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.
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
To: Jyri Sarha <jyri.sarha@iki.fi>
To: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Cc: dri-devel@lists.freedesktop.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] 52+ messages in thread
* [PATCH v3 08/39] drm/atomic: Remove unused drm_atomic_get_existing_plane_state()
2025-09-09 11:27 ` Maxime Ripard
` (7 preceding siblings ...)
(?)
@ 2025-09-09 11:27 ` Maxime Ripard
-1 siblings, 0 replies; 52+ messages in thread
From: Maxime Ripard @ 2025-09-09 11:27 UTC (permalink / raw)
To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter
Cc: dri-devel, Maxime Ripard, Ville Syrjälä
The drm_atomic_get_existing_plane_state() function is deprecated and
isn't used anymore, so let's remove it.
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
To: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
To: Maxime Ripard <mripard@kernel.org>
To: Thomas Zimmermann <tzimmermann@suse.de>
To: David Airlie <airlied@gmail.com>
To: Simona Vetter <simona@ffwll.ch>
Cc: dri-devel@lists.freedesktop.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] 52+ messages in thread
* [PATCH v3 09/39] drm/atomic: Document __drm_planes_state state pointer
2025-09-09 11:27 ` Maxime Ripard
` (8 preceding siblings ...)
(?)
@ 2025-09-09 11:27 ` Maxime Ripard
-1 siblings, 0 replies; 52+ messages in thread
From: Maxime Ripard @ 2025-09-09 11:27 UTC (permalink / raw)
To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter
Cc: dri-devel, Maxime Ripard, Luca Ceresoli, Ville Syrjälä
While the old and new state pointers are somewhat self-explanatory, the
state pointer and its relation to the other two really isn't.
Now that we've cleaned up everything and it isn't used in any
modesetting path, we can document what it's still useful for: to free
the right state when we free the global state.
Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
To: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
To: Maxime Ripard <mripard@kernel.org>
To: Thomas Zimmermann <tzimmermann@suse.de>
To: David Airlie <airlied@gmail.com>
To: Simona Vetter <simona@ffwll.ch>
Cc: dri-devel@lists.freedesktop.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] 52+ messages in thread
* [PATCH v3 10/39] drm/atomic: Convert drm_atomic_get_crtc_state() to use new connector state
2025-09-09 11:27 ` Maxime Ripard
` (9 preceding siblings ...)
(?)
@ 2025-09-09 11:27 ` Maxime Ripard
-1 siblings, 0 replies; 52+ messages in thread
From: Maxime Ripard @ 2025-09-09 11:27 UTC (permalink / raw)
To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter
Cc: dri-devel, Maxime Ripard, Ville Syrjälä
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().
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
To: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
To: Maxime Ripard <mripard@kernel.org>
To: Thomas Zimmermann <tzimmermann@suse.de>
---
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 15584928f06a9175308c3ef8f1ecbe1b33b17f47..435a93c83149e60e4a1bf4310ee5e865242cac7b 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] 52+ messages in thread
* [PATCH v3 11/39] drm/ingenic: ipu: Switch to drm_atomic_get_new_crtc_state()
2025-09-09 11:27 ` Maxime Ripard
` (10 preceding siblings ...)
(?)
@ 2025-09-09 11:27 ` Maxime Ripard
-1 siblings, 0 replies; 52+ messages in thread
From: Maxime Ripard @ 2025-09-09 11:27 UTC (permalink / raw)
To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter
Cc: dri-devel, Maxime Ripard, Paul Cercueil, Ville Syrjälä,
linux-mips
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.
Reviewed-by: Paul Cercueil <paul@crapouillou.net>
Tested-by: Paul Cercueil <paul@crapouillou.net>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
To: Paul Cercueil <paul@crapouillou.net>
Cc: linux-mips@vger.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] 52+ messages in thread
* [PATCH v3 12/39] drm/arm/malidp: Switch to drm_atomic_get_new_crtc_state()
2025-09-09 11:27 ` Maxime Ripard
` (11 preceding siblings ...)
(?)
@ 2025-09-09 11:27 ` Maxime Ripard
-1 siblings, 0 replies; 52+ messages in thread
From: Maxime Ripard @ 2025-09-09 11:27 UTC (permalink / raw)
To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter
Cc: dri-devel, Maxime Ripard, Liviu Dudau, Ville Syrjälä
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.
Reviewed-by: Liviu Dudau <liviu.dudau@arm.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
To: Liviu Dudau <liviu.dudau@arm.com>
---
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] 52+ messages in thread
* [PATCH v3 13/39] drm/armada: Drop always true condition in atomic_check
2025-09-09 11:27 ` Maxime Ripard
` (12 preceding siblings ...)
(?)
@ 2025-09-09 11:27 ` Maxime Ripard
2025-09-09 13:39 ` Ville Syrjälä
-1 siblings, 1 reply; 52+ messages in thread
From: Maxime Ripard @ 2025-09-09 11:27 UTC (permalink / raw)
To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter
Cc: dri-devel, Maxime Ripard, Ville Syrjälä, Russell King
The drm_atomic_state pointer passed to atomic_check is always valid, so
checking if it's NULL or not is pointless. Remove the check.
Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
To: Russell King <linux@armlinux.org.uk>
---
drivers/gpu/drm/armada/armada_plane.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/armada/armada_plane.c b/drivers/gpu/drm/armada/armada_plane.c
index cc47c032dbc151a463cbd0b0d048c74c2828f253..976b6a271c912421e3fec7525f77234e73a74212 100644
--- a/drivers/gpu/drm/armada/armada_plane.c
+++ b/drivers/gpu/drm/armada/armada_plane.c
@@ -83,25 +83,20 @@ int armada_drm_plane_atomic_check(struct drm_plane *plane,
{
struct drm_plane_state *new_plane_state = drm_atomic_get_new_plane_state(state,
plane);
struct armada_plane_state *st = to_armada_plane_state(new_plane_state);
struct drm_crtc *crtc = new_plane_state->crtc;
- struct drm_crtc_state *crtc_state;
+ struct drm_crtc_state *crtc_state =
+ drm_atomic_get_existing_crtc_state(state, crtc);
bool interlace;
int ret;
if (!new_plane_state->fb || WARN_ON(!new_plane_state->crtc)) {
new_plane_state->visible = false;
return 0;
}
- if (state)
- crtc_state = drm_atomic_get_existing_crtc_state(state,
- crtc);
- else
- crtc_state = crtc->state;
-
ret = drm_atomic_helper_check_plane_state(new_plane_state, crtc_state,
0,
INT_MAX, true, false);
if (ret)
return ret;
--
2.50.1
^ permalink raw reply related [flat|nested] 52+ messages in thread
* [PATCH v3 14/39] drm/armada: Switch to drm_atomic_get_new_crtc_state()
2025-09-09 11:27 ` Maxime Ripard
` (13 preceding siblings ...)
(?)
@ 2025-09-09 11:27 ` Maxime Ripard
-1 siblings, 0 replies; 52+ messages in thread
From: Maxime Ripard @ 2025-09-09 11:27 UTC (permalink / raw)
To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter
Cc: dri-devel, Maxime Ripard, Ville Syrjälä, Russell King
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.
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
To: Russell King <linux@armlinux.org.uk>
---
drivers/gpu/drm/armada/armada_plane.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/armada/armada_plane.c b/drivers/gpu/drm/armada/armada_plane.c
index 976b6a271c912421e3fec7525f77234e73a74212..d57f9ad6868fbd102afed2704dd9d411c49713ff 100644
--- a/drivers/gpu/drm/armada/armada_plane.c
+++ b/drivers/gpu/drm/armada/armada_plane.c
@@ -84,11 +84,11 @@ int armada_drm_plane_atomic_check(struct drm_plane *plane,
struct drm_plane_state *new_plane_state = drm_atomic_get_new_plane_state(state,
plane);
struct armada_plane_state *st = to_armada_plane_state(new_plane_state);
struct drm_crtc *crtc = new_plane_state->crtc;
struct drm_crtc_state *crtc_state =
- drm_atomic_get_existing_crtc_state(state, crtc);
+ drm_atomic_get_new_crtc_state(state, crtc);
bool interlace;
int ret;
if (!new_plane_state->fb || WARN_ON(!new_plane_state->crtc)) {
new_plane_state->visible = false;
--
2.50.1
^ permalink raw reply related [flat|nested] 52+ messages in thread
* [PATCH v3 15/39] drm/atmel-hlcdc: Switch to drm_atomic_get_new_crtc_state()
2025-09-09 11:27 ` Maxime Ripard
` (14 preceding siblings ...)
(?)
@ 2025-09-09 11:27 ` Maxime Ripard
2025-09-16 6:52 ` Manikandan.M
-1 siblings, 1 reply; 52+ messages in thread
From: Maxime Ripard @ 2025-09-09 11:27 UTC (permalink / raw)
To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter
Cc: dri-devel, Maxime Ripard, Ville Syrjälä,
Manikandan Muralidharan, Dharma Balasubiramani, Nicolas Ferre,
Alexandre Belloni, Claudiu Beznea, linux-arm-kernel
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.
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
To: Manikandan Muralidharan <manikandan.m@microchip.com>
To: Dharma Balasubiramani <dharma.b@microchip.com>
To: Nicolas Ferre <nicolas.ferre@microchip.com>
To: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: Claudiu Beznea <claudiu.beznea@tuxon.dev>
Cc: dri-devel@lists.freedesktop.org
Cc: linux-arm-kernel@lists.infradead.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] 52+ messages in thread
* [PATCH v3 16/39] drm/exynos: Switch to drm_atomic_get_new_crtc_state()
2025-09-09 11:27 ` Maxime Ripard
` (15 preceding siblings ...)
(?)
@ 2025-09-09 11:27 ` Maxime Ripard
-1 siblings, 0 replies; 52+ messages in thread
From: Maxime Ripard @ 2025-09-09 11:27 UTC (permalink / raw)
To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter
Cc: dri-devel, Maxime Ripard, Ville Syrjälä, Inki Dae,
Seung-Woo Kim, Kyungmin Park, Krzysztof Kozlowski, Alim Akhtar,
linux-arm-kernel, linux-samsung-soc
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.
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
To: Inki Dae <inki.dae@samsung.com>
To: Seung-Woo Kim <sw0312.kim@samsung.com>
To: Kyungmin Park <kyungmin.park@samsung.com>
To: Krzysztof Kozlowski <krzk@kernel.org>
Cc: Alim Akhtar <alim.akhtar@samsung.com>
Cc: dri-devel@lists.freedesktop.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-samsung-soc@vger.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] 52+ messages in thread
* [PATCH v3 17/39] drm/imx-dc: Switch to drm_atomic_get_new_crtc_state()
2025-09-09 11:27 ` Maxime Ripard
` (16 preceding siblings ...)
(?)
@ 2025-09-09 11:27 ` Maxime Ripard
-1 siblings, 0 replies; 52+ messages in thread
From: Maxime Ripard @ 2025-09-09 11:27 UTC (permalink / raw)
To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter
Cc: dri-devel, Maxime Ripard, Ville Syrjälä, Liu Ying,
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
imx, linux-arm-kernel
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.
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
To: Liu Ying <victor.liu@nxp.com>
To: Shawn Guo <shawnguo@kernel.org>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Pengutronix Kernel Team <kernel@pengutronix.de>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: dri-devel@lists.freedesktop.org
Cc: imx@lists.linux.dev
Cc: linux-arm-kernel@lists.infradead.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] 52+ messages in thread
* [PATCH v3 18/39] drm/imx-dcss: Switch to drm_atomic_get_new_crtc_state()
2025-09-09 11:27 ` Maxime Ripard
` (17 preceding siblings ...)
(?)
@ 2025-09-09 11:27 ` Maxime Ripard
-1 siblings, 0 replies; 52+ messages in thread
From: Maxime Ripard @ 2025-09-09 11:27 UTC (permalink / raw)
To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter
Cc: dri-devel, Maxime Ripard, Laurentiu Palcu,
Ville Syrjälä, Shawn Guo, Sascha Hauer, Lucas Stach,
Pengutronix Kernel Team, Fabio Estevam, imx, linux-arm-kernel
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.
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
To: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
To: Shawn Guo <shawnguo@kernel.org>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Lucas Stach <l.stach@pengutronix.de>
Cc: Pengutronix Kernel Team <kernel@pengutronix.de>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: dri-devel@lists.freedesktop.org
Cc: imx@lists.linux.dev
Cc: linux-arm-kernel@lists.infradead.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] 52+ messages in thread
* [PATCH v3 19/39] drm/imx-ipuv3: Switch to drm_atomic_get_new_crtc_state()
2025-09-09 11:27 ` Maxime Ripard
` (18 preceding siblings ...)
(?)
@ 2025-09-09 11:27 ` Maxime Ripard
-1 siblings, 0 replies; 52+ messages in thread
From: Maxime Ripard @ 2025-09-09 11:27 UTC (permalink / raw)
To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter
Cc: dri-devel, Maxime Ripard, Ville Syrjälä, Philipp Zabel,
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
imx, linux-arm-kernel
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.
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
To: Philipp Zabel <p.zabel@pengutronix.de>
To: Shawn Guo <shawnguo@kernel.org>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Pengutronix Kernel Team <kernel@pengutronix.de>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: dri-devel@lists.freedesktop.org
Cc: imx@lists.linux.dev
Cc: linux-arm-kernel@lists.infradead.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] 52+ messages in thread
* [PATCH v3 20/39] drm/ingenic: Switch to drm_atomic_get_new_crtc_state()
2025-09-09 11:27 ` Maxime Ripard
` (19 preceding siblings ...)
(?)
@ 2025-09-09 11:27 ` Maxime Ripard
-1 siblings, 0 replies; 52+ messages in thread
From: Maxime Ripard @ 2025-09-09 11:27 UTC (permalink / raw)
To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter
Cc: dri-devel, Maxime Ripard, Paul Cercueil, Ville Syrjälä,
linux-mips
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.
Reviewed-by: Paul Cercueil <paul@crapouillou.net>
Tested-by: Paul Cercueil <paul@crapouillou.net>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
To: Paul Cercueil <paul@crapouillou.net>
Cc: linux-mips@vger.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] 52+ messages in thread
* [PATCH v3 21/39] drm/kmb: Switch to drm_atomic_get_new_crtc_state()
2025-09-09 11:27 ` Maxime Ripard
` (20 preceding siblings ...)
(?)
@ 2025-09-09 11:27 ` Maxime Ripard
-1 siblings, 0 replies; 52+ messages in thread
From: Maxime Ripard @ 2025-09-09 11:27 UTC (permalink / raw)
To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter
Cc: dri-devel, Maxime Ripard, Ville Syrjälä,
Anitha Chrisanthus, Edmund Dea
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.
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
To: Anitha Chrisanthus <anitha.chrisanthus@intel.com>
To: Edmund Dea <edmund.j.dea@intel.com>
---
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] 52+ messages in thread
* [PATCH v3 22/39] drm/logicvc: Switch to drm_atomic_get_new_crtc_state()
2025-09-09 11:27 ` Maxime Ripard
` (21 preceding siblings ...)
(?)
@ 2025-09-09 11:27 ` Maxime Ripard
-1 siblings, 0 replies; 52+ messages in thread
From: Maxime Ripard @ 2025-09-09 11:27 UTC (permalink / raw)
To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter
Cc: dri-devel, Maxime Ripard, Ville Syrjälä,
Paul Kocialkowski
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.
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
To: Paul Kocialkowski <paulk@sys-base.io>
---
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] 52+ messages in thread
* [PATCH v3 23/39] drm/loongson: Switch to drm_atomic_get_new_crtc_state()
2025-09-09 11:27 ` Maxime Ripard
` (22 preceding siblings ...)
(?)
@ 2025-09-09 11:27 ` Maxime Ripard
-1 siblings, 0 replies; 52+ messages in thread
From: Maxime Ripard @ 2025-09-09 11:27 UTC (permalink / raw)
To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter
Cc: dri-devel, Maxime Ripard, Ville Syrjälä, Sui Jingfeng
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.
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
To: Sui Jingfeng <suijingfeng@loongson.cn>
Cc: dri-devel@lists.freedesktop.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] 52+ messages in thread
* [PATCH v3 24/39] drm/mediatek: Switch to drm_atomic_get_new_crtc_state()
2025-09-09 11:27 ` Maxime Ripard
` (23 preceding siblings ...)
(?)
@ 2025-09-09 11:27 ` Maxime Ripard
-1 siblings, 0 replies; 52+ messages in thread
From: Maxime Ripard @ 2025-09-09 11:27 UTC (permalink / raw)
To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter
Cc: dri-devel, Maxime Ripard, Ville Syrjälä, Chun-Kuang Hu,
Philipp Zabel, Matthias Brugger, AngeloGioacchino Del Regno,
linux-mediatek, linux-kernel, linux-arm-kernel
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.
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
To: Chun-Kuang Hu <chunkuang.hu@kernel.org>
To: Philipp Zabel <p.zabel@pengutronix.de>
To: Matthias Brugger <matthias.bgg@gmail.com>
To: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Cc: dri-devel@lists.freedesktop.org
Cc: linux-mediatek@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.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] 52+ messages in thread
* [PATCH v3 25/39] drm/msm/mdp5: Switch to drm_atomic_get_new_crtc_state()
2025-09-09 11:27 ` Maxime Ripard
` (24 preceding siblings ...)
(?)
@ 2025-09-09 11:27 ` Maxime Ripard
-1 siblings, 0 replies; 52+ messages in thread
From: Maxime Ripard @ 2025-09-09 11:27 UTC (permalink / raw)
To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter
Cc: dri-devel, Maxime Ripard, Dmitry Baryshkov,
Ville Syrjälä, Rob Clark, Dmitry Baryshkov,
Abhinav Kumar, Jessica Zhang, Sean Paul, Marijn Suijten,
linux-arm-msm, freedreno
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.
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Acked-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
To: Rob Clark <robin.clark@oss.qualcomm.com>
To: Dmitry Baryshkov <lumag@kernel.org>
Cc: Abhinav Kumar <abhinav.kumar@linux.dev>
Cc: Jessica Zhang <jessica.zhang@oss.qualcomm.com>
Cc: Sean Paul <sean@poorly.run>
Cc: Marijn Suijten <marijn.suijten@somainline.org>
Cc: linux-arm-msm@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Cc: freedreno@lists.freedesktop.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] 52+ messages in thread
* [PATCH v3 26/39] drm/omap: Switch to drm_atomic_get_new_crtc_state()
2025-09-09 11:27 ` Maxime Ripard
` (25 preceding siblings ...)
(?)
@ 2025-09-09 11:27 ` Maxime Ripard
-1 siblings, 0 replies; 52+ messages in thread
From: Maxime Ripard @ 2025-09-09 11:27 UTC (permalink / raw)
To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter
Cc: dri-devel, Maxime Ripard, Ville Syrjälä, Tomi Valkeinen
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.
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
To: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Cc: dri-devel@lists.freedesktop.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] 52+ messages in thread
* [PATCH v3 27/39] drm/rockchip: Switch to drm_atomic_get_new_crtc_state()
2025-09-09 11:27 ` Maxime Ripard
@ 2025-09-09 11:27 ` Maxime Ripard
-1 siblings, 0 replies; 52+ messages in thread
From: Maxime Ripard @ 2025-09-09 11:27 UTC (permalink / raw)
To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter
Cc: dri-devel, Maxime Ripard, Ville Syrjälä, Sandy Huang,
Heiko Stübner, Andy Yan, linux-arm-kernel, linux-rockchip
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.
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
To: Sandy Huang <hjc@rock-chips.com>
To: "Heiko Stübner" <heiko@sntech.de>
To: Andy Yan <andy.yan@rock-chips.com>
Cc: dri-devel@lists.freedesktop.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-rockchip@lists.infradead.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 186f6452a7d359f079662bc580850929632ea8fe..d83111815191d1694455ed3100e624fa0a81866d 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] 52+ messages in thread
* [PATCH v3 27/39] drm/rockchip: Switch to drm_atomic_get_new_crtc_state()
@ 2025-09-09 11:27 ` Maxime Ripard
0 siblings, 0 replies; 52+ messages in thread
From: Maxime Ripard @ 2025-09-09 11:27 UTC (permalink / raw)
To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter
Cc: dri-devel, Maxime Ripard, Ville Syrjälä, Sandy Huang,
Heiko Stübner, Andy Yan, linux-arm-kernel, linux-rockchip
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.
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
To: Sandy Huang <hjc@rock-chips.com>
To: "Heiko Stübner" <heiko@sntech.de>
To: Andy Yan <andy.yan@rock-chips.com>
Cc: dri-devel@lists.freedesktop.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-rockchip@lists.infradead.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 186f6452a7d359f079662bc580850929632ea8fe..d83111815191d1694455ed3100e624fa0a81866d 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
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
^ permalink raw reply related [flat|nested] 52+ messages in thread
* [PATCH v3 28/39] drm/sun4i: Switch to drm_atomic_get_new_crtc_state()
2025-09-09 11:27 ` Maxime Ripard
` (27 preceding siblings ...)
(?)
@ 2025-09-09 11:27 ` Maxime Ripard
-1 siblings, 0 replies; 52+ messages in thread
From: Maxime Ripard @ 2025-09-09 11:27 UTC (permalink / raw)
To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter
Cc: dri-devel, Maxime Ripard, Ville Syrjälä, Chen-Yu Tsai,
Jernej Skrabec, Samuel Holland, linux-arm-kernel, linux-sunxi
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.
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
To: Maxime Ripard <mripard@kernel.org>
To: Chen-Yu Tsai <wens@csie.org>
To: Jernej Skrabec <jernej.skrabec@gmail.com>
To: Samuel Holland <samuel@sholland.org>
Cc: Jernej Skrabec <jernej.skrabec@gmail.com>
Cc: dri-devel@lists.freedesktop.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-sunxi@lists.linux.dev
---
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] 52+ messages in thread
* [PATCH v3 29/39] drm/tegra: Switch to drm_atomic_get_new_crtc_state()
2025-09-09 11:27 ` Maxime Ripard
` (28 preceding siblings ...)
(?)
@ 2025-09-09 11:27 ` Maxime Ripard
-1 siblings, 0 replies; 52+ messages in thread
From: Maxime Ripard @ 2025-09-09 11:27 UTC (permalink / raw)
To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter
Cc: dri-devel, Maxime Ripard, Ville Syrjälä, Thierry Reding,
Mikko Perttunen, Jonathan Hunter, linux-tegra
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.
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
To: Thierry Reding <thierry.reding@gmail.com>
To: Mikko Perttunen <mperttunen@nvidia.com>
To: Jonathan Hunter <jonathanh@nvidia.com>
Cc: dri-devel@lists.freedesktop.org
Cc: linux-tegra@vger.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] 52+ messages in thread
* [PATCH v3 30/39] drm/tilcdc: Switch to drm_atomic_get_new_crtc_state()
2025-09-09 11:27 ` Maxime Ripard
` (29 preceding siblings ...)
(?)
@ 2025-09-09 11:27 ` Maxime Ripard
2025-09-12 9:47 ` Jyri Sarha
-1 siblings, 1 reply; 52+ messages in thread
From: Maxime Ripard @ 2025-09-09 11:27 UTC (permalink / raw)
To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter
Cc: dri-devel, Maxime Ripard, Ville Syrjälä, Jyri Sarha,
Tomi Valkeinen
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.
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
To: Jyri Sarha <jyri.sarha@iki.fi>
To: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Cc: dri-devel@lists.freedesktop.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] 52+ messages in thread
* [PATCH v3 31/39] drm/vboxvideo: Switch to drm_atomic_get_new_crtc_state()
2025-09-09 11:27 ` Maxime Ripard
` (30 preceding siblings ...)
(?)
@ 2025-09-09 11:27 ` Maxime Ripard
-1 siblings, 0 replies; 52+ messages in thread
From: Maxime Ripard @ 2025-09-09 11:27 UTC (permalink / raw)
To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter
Cc: dri-devel, Maxime Ripard, Hans de Goede, Ville Syrjälä
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.
Reviewed-by: Hans de Goede <hansg@kernel.org>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
To: Hans de Goede <hansg@kernel.org>
Cc: dri-devel@lists.freedesktop.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] 52+ messages in thread
* [PATCH v3 32/39] drm/vc4: Switch to drm_atomic_get_new_crtc_state()
2025-09-09 11:27 ` Maxime Ripard
` (31 preceding siblings ...)
(?)
@ 2025-09-09 11:27 ` Maxime Ripard
-1 siblings, 0 replies; 52+ messages in thread
From: Maxime Ripard @ 2025-09-09 11:27 UTC (permalink / raw)
To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter
Cc: dri-devel, Maxime Ripard, Ville Syrjälä, Dave Stevenson,
Maíra Canal, Raspberry Pi Kernel Maintenance
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.
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
To: Maxime Ripard <mripard@kernel.org>
To: Dave Stevenson <dave.stevenson@raspberrypi.com>
Cc: "Maíra Canal" <mcanal@igalia.com>
Cc: Raspberry Pi Kernel Maintenance <kernel-list@raspberrypi.com>
---
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] 52+ messages in thread
* [PATCH v3 33/39] drm/atomic: Switch to drm_atomic_get_new_crtc_state()
2025-09-09 11:27 ` Maxime Ripard
` (32 preceding siblings ...)
(?)
@ 2025-09-09 11:27 ` Maxime Ripard
-1 siblings, 0 replies; 52+ messages in thread
From: Maxime Ripard @ 2025-09-09 11:27 UTC (permalink / raw)
To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter
Cc: dri-devel, Maxime Ripard, Dmitry Baryshkov,
Ville Syrjälä
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.
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
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 435a93c83149e60e4a1bf4310ee5e865242cac7b..d6a53b678e7b52c0852b2e590d8bc041616cb80d 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] 52+ messages in thread
* [PATCH v3 34/39] drm/framebuffer: Switch to drm_atomic_get_new_crtc_state()
2025-09-09 11:27 ` Maxime Ripard
` (33 preceding siblings ...)
(?)
@ 2025-09-09 11:27 ` Maxime Ripard
-1 siblings, 0 replies; 52+ messages in thread
From: Maxime Ripard @ 2025-09-09 11:27 UTC (permalink / raw)
To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter
Cc: dri-devel, Maxime Ripard, Dmitry Baryshkov,
Ville Syrjälä
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.
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
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] 52+ messages in thread
* [PATCH v3 35/39] drm/atomic: Remove unused drm_atomic_get_existing_crtc_state()
2025-09-09 11:27 ` Maxime Ripard
` (34 preceding siblings ...)
(?)
@ 2025-09-09 11:27 ` Maxime Ripard
-1 siblings, 0 replies; 52+ messages in thread
From: Maxime Ripard @ 2025-09-09 11:27 UTC (permalink / raw)
To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter
Cc: dri-devel, Maxime Ripard, Dmitry Baryshkov,
Ville Syrjälä
The drm_atomic_get_existing_crtc_state() function is deprecated and
isn't used anymore, so let's remove it.
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
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] 52+ messages in thread
* [PATCH v3 36/39] drm/atomic: Document __drm_crtcs_state state pointer
2025-09-09 11:27 ` Maxime Ripard
` (35 preceding siblings ...)
(?)
@ 2025-09-09 11:27 ` Maxime Ripard
-1 siblings, 0 replies; 52+ messages in thread
From: Maxime Ripard @ 2025-09-09 11:27 UTC (permalink / raw)
To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter
Cc: dri-devel, Maxime Ripard, Ville Syrjälä
While the old and new state pointers are somewhat self-explanatory, the
state pointer and its relation to the other two really isn't.
Now that we've cleaned up everything and it isn't used in any
modesetting path, we can document what it's still useful for: to free
the right state when we free the global state.
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
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] 52+ messages in thread
* [PATCH v3 37/39] drm/ingenic: crtc: Switch to ingenic_drm_get_new_priv_state()
2025-09-09 11:27 ` Maxime Ripard
` (36 preceding siblings ...)
(?)
@ 2025-09-09 11:27 ` Maxime Ripard
2025-09-09 11:43 ` Paul Cercueil
2025-09-09 13:52 ` Ville Syrjälä
-1 siblings, 2 replies; 52+ messages in thread
From: Maxime Ripard @ 2025-09-09 11:27 UTC (permalink / raw)
To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter
Cc: dri-devel, Maxime Ripard, Dmitry Baryshkov,
Ville Syrjälä, Paul Cercueil, linux-mips
The ingenic CRTC atomic_enable() implementation will indirectly call
drm_atomic_get_private_obj_state() through ingenic_drm_get_priv_state().
drm_atomic_get_private_obj_state() will either return the new state for
the object in the global state if it exists, or will allocate a new one
and add it to the global state.
atomic_enable() however isn't allowed to modify the global state. So
what the implementation should use is the
drm_atomic_get_new_private_obj_state() helper to get the new state for
the CRTC, without performing an extra allocation.
The ingenic driver has a wrapper around that helper with
ingenic_drm_get_new_priv_state(), so let's use that instead.
Reported-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
To: Paul Cercueil <paul@crapouillou.net>
Cc: linux-mips@vger.kernel.org
---
drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
index 05faed933e5619c796f2a4fa1906e0eaa029ac68..a1b641d63fc500dc169d0b0e22f93168c343a242 100644
--- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
+++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
@@ -245,11 +245,11 @@ static void ingenic_drm_crtc_atomic_enable(struct drm_crtc *crtc,
{
struct ingenic_drm *priv = drm_crtc_get_priv(crtc);
struct ingenic_drm_private_state *priv_state;
unsigned int next_id;
- priv_state = ingenic_drm_get_priv_state(priv, state);
+ priv_state = ingenic_drm_get_new_priv_state(priv, state);
if (WARN_ON(IS_ERR(priv_state)))
return;
/* Set addresses of our DMA descriptor chains */
next_id = priv_state->use_palette ? HWDESC_PALETTE : 0;
--
2.50.1
^ permalink raw reply related [flat|nested] 52+ messages in thread
* [PATCH v3 38/39] drm/atomic: Convert drm_atomic_get_private_obj_state() to use new plane state
2025-09-09 11:27 ` Maxime Ripard
` (37 preceding siblings ...)
(?)
@ 2025-09-09 11:27 ` Maxime Ripard
-1 siblings, 0 replies; 52+ messages in thread
From: Maxime Ripard @ 2025-09-09 11:27 UTC (permalink / raw)
To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter
Cc: dri-devel, Maxime Ripard, Ville Syrjälä
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().
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
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 d6a53b678e7b52c0852b2e590d8bc041616cb80d..754981ead01ffa27434be55079e9f967eb576be5 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] 52+ messages in thread
* [PATCH v3 39/39] drm/atomic: Document __drm_private_objs_state state pointer
2025-09-09 11:27 ` Maxime Ripard
` (38 preceding siblings ...)
(?)
@ 2025-09-09 11:27 ` Maxime Ripard
-1 siblings, 0 replies; 52+ messages in thread
From: Maxime Ripard @ 2025-09-09 11:27 UTC (permalink / raw)
To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter
Cc: dri-devel, Maxime Ripard, Luca Ceresoli, Ville Syrjälä
While the old and new state pointers are somewhat self-explanatory, the
state pointer and its relation to the other two really isn't.
Now that we've cleaned up everything and it isn't used in any
modesetting path, we can document what it's still useful for: to free
the right state when we free the global state.
Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
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] 52+ messages in thread
* Re: [PATCH v3 37/39] drm/ingenic: crtc: Switch to ingenic_drm_get_new_priv_state()
2025-09-09 11:27 ` [PATCH v3 37/39] drm/ingenic: crtc: Switch to ingenic_drm_get_new_priv_state() Maxime Ripard
@ 2025-09-09 11:43 ` Paul Cercueil
2025-09-09 13:52 ` Ville Syrjälä
1 sibling, 0 replies; 52+ messages in thread
From: Paul Cercueil @ 2025-09-09 11:43 UTC (permalink / raw)
To: Maxime Ripard, Maarten Lankhorst, Thomas Zimmermann, David Airlie,
Simona Vetter
Cc: dri-devel, Dmitry Baryshkov, Ville Syrjälä, linux-mips
Hi Maxime,
Le mardi 09 septembre 2025 à 13:27 +0200, Maxime Ripard a écrit :
> The ingenic CRTC atomic_enable() implementation will indirectly call
> drm_atomic_get_private_obj_state() through
> ingenic_drm_get_priv_state().
>
> drm_atomic_get_private_obj_state() will either return the new state
> for
> the object in the global state if it exists, or will allocate a new
> one
> and add it to the global state.
>
> atomic_enable() however isn't allowed to modify the global state. So
> what the implementation should use is the
> drm_atomic_get_new_private_obj_state() helper to get the new state
> for
> the CRTC, without performing an extra allocation.
>
> The ingenic driver has a wrapper around that helper with
> ingenic_drm_get_new_priv_state(), so let's use that instead.
>
> Reported-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
> Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Maxime Ripard <mripard@kernel.org>
Reviewed-by: Paul Cercueil <paul@crapouillou.net>
Cheers,
-Paul
>
> ---
> To: Paul Cercueil <paul@crapouillou.net>
> Cc: linux-mips@vger.kernel.org
> ---
> drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> index
> 05faed933e5619c796f2a4fa1906e0eaa029ac68..a1b641d63fc500dc169d0b0e22f
> 93168c343a242 100644
> --- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> +++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> @@ -245,11 +245,11 @@ static void
> ingenic_drm_crtc_atomic_enable(struct drm_crtc *crtc,
> {
> struct ingenic_drm *priv = drm_crtc_get_priv(crtc);
> struct ingenic_drm_private_state *priv_state;
> unsigned int next_id;
>
> - priv_state = ingenic_drm_get_priv_state(priv, state);
> + priv_state = ingenic_drm_get_new_priv_state(priv, state);
> if (WARN_ON(IS_ERR(priv_state)))
> return;
>
> /* Set addresses of our DMA descriptor chains */
> next_id = priv_state->use_palette ? HWDESC_PALETTE : 0;
^ permalink raw reply [flat|nested] 52+ messages in thread
* Re: [PATCH v3 13/39] drm/armada: Drop always true condition in atomic_check
2025-09-09 11:27 ` [PATCH v3 13/39] drm/armada: Drop always true condition in atomic_check Maxime Ripard
@ 2025-09-09 13:39 ` Ville Syrjälä
0 siblings, 0 replies; 52+ messages in thread
From: Ville Syrjälä @ 2025-09-09 13:39 UTC (permalink / raw)
To: Maxime Ripard
Cc: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
dri-devel, Russell King
On Tue, Sep 09, 2025 at 01:27:32PM +0200, Maxime Ripard wrote:
> The drm_atomic_state pointer passed to atomic_check is always valid, so
> checking if it's NULL or not is pointless. Remove the check.
>
> Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Maxime Ripard <mripard@kernel.org>
>
> ---
> To: Russell King <linux@armlinux.org.uk>
> ---
> drivers/gpu/drm/armada/armada_plane.c | 9 ++-------
> 1 file changed, 2 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/armada/armada_plane.c b/drivers/gpu/drm/armada/armada_plane.c
> index cc47c032dbc151a463cbd0b0d048c74c2828f253..976b6a271c912421e3fec7525f77234e73a74212 100644
> --- a/drivers/gpu/drm/armada/armada_plane.c
> +++ b/drivers/gpu/drm/armada/armada_plane.c
> @@ -83,25 +83,20 @@ int armada_drm_plane_atomic_check(struct drm_plane *plane,
> {
> struct drm_plane_state *new_plane_state = drm_atomic_get_new_plane_state(state,
> plane);
> struct armada_plane_state *st = to_armada_plane_state(new_plane_state);
> struct drm_crtc *crtc = new_plane_state->crtc;
> - struct drm_crtc_state *crtc_state;
> + struct drm_crtc_state *crtc_state =
> + drm_atomic_get_existing_crtc_state(state, crtc);
new_plane_state->crtc might be NULL here.
> bool interlace;
> int ret;
>
> if (!new_plane_state->fb || WARN_ON(!new_plane_state->crtc)) {
> new_plane_state->visible = false;
> return 0;
> }
>
Here we know it's not NULL.
> - if (state)
> - crtc_state = drm_atomic_get_existing_crtc_state(state,
> - crtc);
> - else
> - crtc_state = crtc->state;
> -
> ret = drm_atomic_helper_check_plane_state(new_plane_state, crtc_state,
> 0,
> INT_MAX, true, false);
> if (ret)
> return ret;
>
> --
> 2.50.1
--
Ville Syrjälä
Intel
^ permalink raw reply [flat|nested] 52+ messages in thread
* Re: [PATCH v3 37/39] drm/ingenic: crtc: Switch to ingenic_drm_get_new_priv_state()
2025-09-09 11:27 ` [PATCH v3 37/39] drm/ingenic: crtc: Switch to ingenic_drm_get_new_priv_state() Maxime Ripard
2025-09-09 11:43 ` Paul Cercueil
@ 2025-09-09 13:52 ` Ville Syrjälä
2025-09-09 14:45 ` Paul Cercueil
1 sibling, 1 reply; 52+ messages in thread
From: Ville Syrjälä @ 2025-09-09 13:52 UTC (permalink / raw)
To: Maxime Ripard
Cc: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
dri-devel, Dmitry Baryshkov, Paul Cercueil, linux-mips
On Tue, Sep 09, 2025 at 01:27:56PM +0200, Maxime Ripard wrote:
> The ingenic CRTC atomic_enable() implementation will indirectly call
> drm_atomic_get_private_obj_state() through ingenic_drm_get_priv_state().
>
> drm_atomic_get_private_obj_state() will either return the new state for
> the object in the global state if it exists, or will allocate a new one
> and add it to the global state.
>
> atomic_enable() however isn't allowed to modify the global state. So
> what the implementation should use is the
> drm_atomic_get_new_private_obj_state() helper to get the new state for
> the CRTC, without performing an extra allocation.
>
> The ingenic driver has a wrapper around that helper with
> ingenic_drm_get_new_priv_state(), so let's use that instead.
>
> Reported-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
> Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Maxime Ripard <mripard@kernel.org>
>
> ---
> To: Paul Cercueil <paul@crapouillou.net>
> Cc: linux-mips@vger.kernel.org
> ---
> drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> index 05faed933e5619c796f2a4fa1906e0eaa029ac68..a1b641d63fc500dc169d0b0e22f93168c343a242 100644
> --- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> +++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> @@ -245,11 +245,11 @@ static void ingenic_drm_crtc_atomic_enable(struct drm_crtc *crtc,
> {
> struct ingenic_drm *priv = drm_crtc_get_priv(crtc);
> struct ingenic_drm_private_state *priv_state;
> unsigned int next_id;
>
> - priv_state = ingenic_drm_get_priv_state(priv, state);
> + priv_state = ingenic_drm_get_new_priv_state(priv, state);
> if (WARN_ON(IS_ERR(priv_state)))
get_new_state() will never return an error pointer. It's either
a valid pointer or NULL.
To me it looks like this could potentially be NULL here as the
get_pvi_state() call is done from the plane .atomic_check()
whereas this gets called for the crtc. So if the plane is
disabled there might not be any private state included in the
commit.
Not sure how this driver/hardware is supposed to work so not
sure what the proper fix for that is...
> return;
>
> /* Set addresses of our DMA descriptor chains */
> next_id = priv_state->use_palette ? HWDESC_PALETTE : 0;
>
> --
> 2.50.1
--
Ville Syrjälä
Intel
^ permalink raw reply [flat|nested] 52+ messages in thread
* Re: [PATCH v3 37/39] drm/ingenic: crtc: Switch to ingenic_drm_get_new_priv_state()
2025-09-09 13:52 ` Ville Syrjälä
@ 2025-09-09 14:45 ` Paul Cercueil
2025-09-10 11:26 ` Maxime Ripard
2025-09-10 12:19 ` Ville Syrjälä
0 siblings, 2 replies; 52+ messages in thread
From: Paul Cercueil @ 2025-09-09 14:45 UTC (permalink / raw)
To: Ville Syrjälä, Maxime Ripard
Cc: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
dri-devel, Dmitry Baryshkov, linux-mips
Hi Ville,
Le mardi 09 septembre 2025 à 16:52 +0300, Ville Syrjälä a écrit :
> On Tue, Sep 09, 2025 at 01:27:56PM +0200, Maxime Ripard wrote:
> > The ingenic CRTC atomic_enable() implementation will indirectly
> > call
> > drm_atomic_get_private_obj_state() through
> > ingenic_drm_get_priv_state().
> >
> > drm_atomic_get_private_obj_state() will either return the new state
> > for
> > the object in the global state if it exists, or will allocate a new
> > one
> > and add it to the global state.
> >
> > atomic_enable() however isn't allowed to modify the global state.
> > So
> > what the implementation should use is the
> > drm_atomic_get_new_private_obj_state() helper to get the new state
> > for
> > the CRTC, without performing an extra allocation.
> >
> > The ingenic driver has a wrapper around that helper with
> > ingenic_drm_get_new_priv_state(), so let's use that instead.
> >
> > Reported-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
> > Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > Signed-off-by: Maxime Ripard <mripard@kernel.org>
> >
> > ---
> > To: Paul Cercueil <paul@crapouillou.net>
> > Cc: linux-mips@vger.kernel.org
> > ---
> > drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> > b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> > index
> > 05faed933e5619c796f2a4fa1906e0eaa029ac68..a1b641d63fc500dc169d0b0e2
> > 2f93168c343a242 100644
> > --- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> > +++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> > @@ -245,11 +245,11 @@ static void
> > ingenic_drm_crtc_atomic_enable(struct drm_crtc *crtc,
> > {
> > struct ingenic_drm *priv = drm_crtc_get_priv(crtc);
> > struct ingenic_drm_private_state *priv_state;
> > unsigned int next_id;
> >
> > - priv_state = ingenic_drm_get_priv_state(priv, state);
> > + priv_state = ingenic_drm_get_new_priv_state(priv, state);
> > if (WARN_ON(IS_ERR(priv_state)))
>
> get_new_state() will never return an error pointer. It's either
> a valid pointer or NULL.
Good catch.
> To me it looks like this could potentially be NULL here as the
> get_pvi_state() call is done from the plane .atomic_check()
> whereas this gets called for the crtc. So if the plane is
> disabled there might not be any private state included in the
> commit.
>
> Not sure how this driver/hardware is supposed to work so not
> sure what the proper fix for that is...
Would it be just a matter of calling drm_atomic_get_private_obj_state()
in the crtc's .atomic_check() to make sure the object is created?
Cheers,
-Paul
>
> > return;
> >
> > /* Set addresses of our DMA descriptor chains */
> > next_id = priv_state->use_palette ? HWDESC_PALETTE : 0;
> >
> > --
> > 2.50.1
^ permalink raw reply [flat|nested] 52+ messages in thread
* Re: [PATCH v3 37/39] drm/ingenic: crtc: Switch to ingenic_drm_get_new_priv_state()
2025-09-09 14:45 ` Paul Cercueil
@ 2025-09-10 11:26 ` Maxime Ripard
2025-09-10 13:14 ` Paul Cercueil
2025-09-10 12:19 ` Ville Syrjälä
1 sibling, 1 reply; 52+ messages in thread
From: Maxime Ripard @ 2025-09-10 11:26 UTC (permalink / raw)
To: Paul Cercueil
Cc: Ville Syrjälä, Maarten Lankhorst, Thomas Zimmermann,
David Airlie, Simona Vetter, dri-devel, Dmitry Baryshkov,
linux-mips
[-- Attachment #1: Type: text/plain, Size: 3222 bytes --]
On Tue, Sep 09, 2025 at 04:45:27PM +0200, Paul Cercueil wrote:
> Hi Ville,
>
> Le mardi 09 septembre 2025 à 16:52 +0300, Ville Syrjälä a écrit :
> > On Tue, Sep 09, 2025 at 01:27:56PM +0200, Maxime Ripard wrote:
> > > The ingenic CRTC atomic_enable() implementation will indirectly
> > > call
> > > drm_atomic_get_private_obj_state() through
> > > ingenic_drm_get_priv_state().
> > >
> > > drm_atomic_get_private_obj_state() will either return the new state
> > > for
> > > the object in the global state if it exists, or will allocate a new
> > > one
> > > and add it to the global state.
> > >
> > > atomic_enable() however isn't allowed to modify the global state.
> > > So
> > > what the implementation should use is the
> > > drm_atomic_get_new_private_obj_state() helper to get the new state
> > > for
> > > the CRTC, without performing an extra allocation.
> > >
> > > The ingenic driver has a wrapper around that helper with
> > > ingenic_drm_get_new_priv_state(), so let's use that instead.
> > >
> > > Reported-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
> > > Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > > Signed-off-by: Maxime Ripard <mripard@kernel.org>
> > >
> > > ---
> > > To: Paul Cercueil <paul@crapouillou.net>
> > > Cc: linux-mips@vger.kernel.org
> > > ---
> > > drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> > > b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> > > index
> > > 05faed933e5619c796f2a4fa1906e0eaa029ac68..a1b641d63fc500dc169d0b0e2
> > > 2f93168c343a242 100644
> > > --- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> > > +++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> > > @@ -245,11 +245,11 @@ static void
> > > ingenic_drm_crtc_atomic_enable(struct drm_crtc *crtc,
> > > {
> > > struct ingenic_drm *priv = drm_crtc_get_priv(crtc);
> > > struct ingenic_drm_private_state *priv_state;
> > > unsigned int next_id;
> > >
> > > - priv_state = ingenic_drm_get_priv_state(priv, state);
> > > + priv_state = ingenic_drm_get_new_priv_state(priv, state);
> > > if (WARN_ON(IS_ERR(priv_state)))
> >
> > get_new_state() will never return an error pointer. It's either
> > a valid pointer or NULL.
>
> Good catch.
Yeah, thanks.
> > To me it looks like this could potentially be NULL here as the
> > get_pvi_state() call is done from the plane .atomic_check()
> > whereas this gets called for the crtc. So if the plane is
> > disabled there might not be any private state included in the
> > commit.
> >
> > Not sure how this driver/hardware is supposed to work so not
> > sure what the proper fix for that is...
>
> Would it be just a matter of calling drm_atomic_get_private_obj_state()
> in the crtc's .atomic_check() to make sure the object is created?
It's really not clear to me what that private object stores in the first
place. It looks like it's about toggling a bit in the crtc DMA
descriptors, but it's only set by planes?
Can you expand a bit on the hw design and why you're using a private
object to store that?
Maxime
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 273 bytes --]
^ permalink raw reply [flat|nested] 52+ messages in thread
* Re: [PATCH v3 37/39] drm/ingenic: crtc: Switch to ingenic_drm_get_new_priv_state()
2025-09-09 14:45 ` Paul Cercueil
2025-09-10 11:26 ` Maxime Ripard
@ 2025-09-10 12:19 ` Ville Syrjälä
1 sibling, 0 replies; 52+ messages in thread
From: Ville Syrjälä @ 2025-09-10 12:19 UTC (permalink / raw)
To: Paul Cercueil
Cc: Maxime Ripard, Maarten Lankhorst, Thomas Zimmermann, David Airlie,
Simona Vetter, dri-devel, Dmitry Baryshkov, linux-mips
On Tue, Sep 09, 2025 at 04:45:27PM +0200, Paul Cercueil wrote:
> Hi Ville,
>
> Le mardi 09 septembre 2025 à 16:52 +0300, Ville Syrjälä a écrit :
> > On Tue, Sep 09, 2025 at 01:27:56PM +0200, Maxime Ripard wrote:
> > > The ingenic CRTC atomic_enable() implementation will indirectly
> > > call
> > > drm_atomic_get_private_obj_state() through
> > > ingenic_drm_get_priv_state().
> > >
> > > drm_atomic_get_private_obj_state() will either return the new state
> > > for
> > > the object in the global state if it exists, or will allocate a new
> > > one
> > > and add it to the global state.
> > >
> > > atomic_enable() however isn't allowed to modify the global state.
> > > So
> > > what the implementation should use is the
> > > drm_atomic_get_new_private_obj_state() helper to get the new state
> > > for
> > > the CRTC, without performing an extra allocation.
> > >
> > > The ingenic driver has a wrapper around that helper with
> > > ingenic_drm_get_new_priv_state(), so let's use that instead.
> > >
> > > Reported-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
> > > Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > > Signed-off-by: Maxime Ripard <mripard@kernel.org>
> > >
> > > ---
> > > To: Paul Cercueil <paul@crapouillou.net>
> > > Cc: linux-mips@vger.kernel.org
> > > ---
> > > drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> > > b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> > > index
> > > 05faed933e5619c796f2a4fa1906e0eaa029ac68..a1b641d63fc500dc169d0b0e2
> > > 2f93168c343a242 100644
> > > --- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> > > +++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> > > @@ -245,11 +245,11 @@ static void
> > > ingenic_drm_crtc_atomic_enable(struct drm_crtc *crtc,
> > > {
> > > struct ingenic_drm *priv = drm_crtc_get_priv(crtc);
> > > struct ingenic_drm_private_state *priv_state;
> > > unsigned int next_id;
> > >
> > > - priv_state = ingenic_drm_get_priv_state(priv, state);
> > > + priv_state = ingenic_drm_get_new_priv_state(priv, state);
> > > if (WARN_ON(IS_ERR(priv_state)))
> >
> > get_new_state() will never return an error pointer. It's either
> > a valid pointer or NULL.
>
> Good catch.
>
> > To me it looks like this could potentially be NULL here as the
> > get_pvi_state() call is done from the plane .atomic_check()
> > whereas this gets called for the crtc. So if the plane is
> > disabled there might not be any private state included in the
> > commit.
> >
> > Not sure how this driver/hardware is supposed to work so not
> > sure what the proper fix for that is...
>
> Would it be just a matter of calling drm_atomic_get_private_obj_state()
> in the crtc's .atomic_check() to make sure the object is created?
Looks like this thing only has the one crtc, so yeah, seems
fine to it uncoditionally there. With multiple crtcs the
private object locking would start to hinder parallelism.
--
Ville Syrjälä
Intel
^ permalink raw reply [flat|nested] 52+ messages in thread
* Re: [PATCH v3 37/39] drm/ingenic: crtc: Switch to ingenic_drm_get_new_priv_state()
2025-09-10 11:26 ` Maxime Ripard
@ 2025-09-10 13:14 ` Paul Cercueil
0 siblings, 0 replies; 52+ messages in thread
From: Paul Cercueil @ 2025-09-10 13:14 UTC (permalink / raw)
To: Maxime Ripard
Cc: Ville Syrjälä, Maarten Lankhorst, Thomas Zimmermann,
David Airlie, Simona Vetter, dri-devel, Dmitry Baryshkov,
linux-mips
Hi Maxime,
Le mercredi 10 septembre 2025 à 13:26 +0200, Maxime Ripard a écrit :
> On Tue, Sep 09, 2025 at 04:45:27PM +0200, Paul Cercueil wrote:
> > Hi Ville,
> >
> > Le mardi 09 septembre 2025 à 16:52 +0300, Ville Syrjälä a écrit :
> > > On Tue, Sep 09, 2025 at 01:27:56PM +0200, Maxime Ripard wrote:
> > > > The ingenic CRTC atomic_enable() implementation will indirectly
> > > > call
> > > > drm_atomic_get_private_obj_state() through
> > > > ingenic_drm_get_priv_state().
> > > >
> > > > drm_atomic_get_private_obj_state() will either return the new
> > > > state
> > > > for
> > > > the object in the global state if it exists, or will allocate a
> > > > new
> > > > one
> > > > and add it to the global state.
> > > >
> > > > atomic_enable() however isn't allowed to modify the global
> > > > state.
> > > > So
> > > > what the implementation should use is the
> > > > drm_atomic_get_new_private_obj_state() helper to get the new
> > > > state
> > > > for
> > > > the CRTC, without performing an extra allocation.
> > > >
> > > > The ingenic driver has a wrapper around that helper with
> > > > ingenic_drm_get_new_priv_state(), so let's use that instead.
> > > >
> > > > Reported-by: Dmitry Baryshkov
> > > > <dmitry.baryshkov@oss.qualcomm.com>
> > > > Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > > > Signed-off-by: Maxime Ripard <mripard@kernel.org>
> > > >
> > > > ---
> > > > To: Paul Cercueil <paul@crapouillou.net>
> > > > Cc: linux-mips@vger.kernel.org
> > > > ---
> > > > drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 2 +-
> > > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > > >
> > > > diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> > > > b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> > > > index
> > > > 05faed933e5619c796f2a4fa1906e0eaa029ac68..a1b641d63fc500dc169d0
> > > > b0e2
> > > > 2f93168c343a242 100644
> > > > --- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> > > > +++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> > > > @@ -245,11 +245,11 @@ static void
> > > > ingenic_drm_crtc_atomic_enable(struct drm_crtc *crtc,
> > > > {
> > > > struct ingenic_drm *priv = drm_crtc_get_priv(crtc);
> > > > struct ingenic_drm_private_state *priv_state;
> > > > unsigned int next_id;
> > > >
> > > > - priv_state = ingenic_drm_get_priv_state(priv, state);
> > > > + priv_state = ingenic_drm_get_new_priv_state(priv,
> > > > state);
> > > > if (WARN_ON(IS_ERR(priv_state)))
> > >
> > > get_new_state() will never return an error pointer. It's either
> > > a valid pointer or NULL.
> >
> > Good catch.
>
> Yeah, thanks.
>
> > > To me it looks like this could potentially be NULL here as the
> > > get_pvi_state() call is done from the plane .atomic_check()
> > > whereas this gets called for the crtc. So if the plane is
> > > disabled there might not be any private state included in the
> > > commit.
> > >
> > > Not sure how this driver/hardware is supposed to work so not
> > > sure what the proper fix for that is...
> >
> > Would it be just a matter of calling
> > drm_atomic_get_private_obj_state()
> > in the crtc's .atomic_check() to make sure the object is created?
>
> It's really not clear to me what that private object stores in the
> first
> place. It looks like it's about toggling a bit in the crtc DMA
> descriptors, but it's only set by planes?
>
> Can you expand a bit on the hw design and why you're using a private
> object to store that?
The primary plane f0 supports paletted 8bpp, in which case the palette
needs to be DMA'd once per frame. The "use_palette" is set in the
plane's .atomic_check as it has access to the new frame's pixel format.
It is used in the plane's .atomic_update to configure the DMA chain of
the f0 plane to either transfer the frame data continuously (if non-
paletted) or alternate between transferring the frame data and the
palette. This field is also needed in the CRTC's .atomic_enable as
we're writing a different DMA descriptor chain address if the palette
is used (as the palette must be transferred before the frame).
Cheers,
-Paul
^ permalink raw reply [flat|nested] 52+ messages in thread
* Re: [PATCH v3 07/39] drm/tilcdc: crtc: Use drm_atomic_helper_check_crtc_primary_plane()
2025-09-09 11:27 ` [PATCH v3 07/39] drm/tilcdc: crtc: Use drm_atomic_helper_check_crtc_primary_plane() Maxime Ripard
@ 2025-09-12 9:43 ` Jyri Sarha
0 siblings, 0 replies; 52+ messages in thread
From: Jyri Sarha @ 2025-09-12 9:43 UTC (permalink / raw)
To: Maxime Ripard, Maarten Lankhorst, Thomas Zimmermann, David Airlie,
Simona Vetter
Cc: dri-devel, Maxime Ripard, Ville Syrjälä, Jyri Sarha,
Tomi Valkeinen
[-- Attachment #1: Type: text/plain, Size: 629 bytes --]
September 9, 2025 at 2:27 PM, "Maxime Ripard" <mripard@kernel.org mailto:mripard@kernel.org?to=%22Maxime%20Ripard%22%20%3Cmripard%40kernel.org%3E > wrote:
>
> 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.
>
> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Maxime Ripard <mripard@kernel.org>
>
Acked-by: Jyri Sarha <jyri.sarha@iki.fi>
Regards,
Jyri
[-- Attachment #2: Type: text/html, Size: 920 bytes --]
^ permalink raw reply [flat|nested] 52+ messages in thread
* Re: [PATCH v3 30/39] drm/tilcdc: Switch to drm_atomic_get_new_crtc_state()
2025-09-09 11:27 ` [PATCH v3 30/39] drm/tilcdc: " Maxime Ripard
@ 2025-09-12 9:47 ` Jyri Sarha
0 siblings, 0 replies; 52+ messages in thread
From: Jyri Sarha @ 2025-09-12 9:47 UTC (permalink / raw)
To: Maxime Ripard, Maarten Lankhorst, Thomas Zimmermann, David Airlie,
Simona Vetter
Cc: dri-devel, Maxime Ripard, Ville Syrjälä, Jyri Sarha,
Tomi Valkeinen
[-- Attachment #1: Type: text/plain, Size: 672 bytes --]
September 9, 2025 at 2:27 PM, "Maxime Ripard" <mripard@kernel.org mailto:mripard@kernel.org?to=%22Maxime%20Ripard%22%20%3Cmripard%40kernel.org%3E > wrote:
>
> 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.
>
> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Maxime Ripard <mripard@kernel.org>
>
Acked-by: Jyri Sarha <jyri.sarha@iki.fi>
Best regards,
Jyri
[-- Attachment #2: Type: text/html, Size: 939 bytes --]
^ permalink raw reply [flat|nested] 52+ messages in thread
* Re: [PATCH v3 15/39] drm/atmel-hlcdc: Switch to drm_atomic_get_new_crtc_state()
2025-09-09 11:27 ` [PATCH v3 15/39] drm/atmel-hlcdc: " Maxime Ripard
@ 2025-09-16 6:52 ` Manikandan.M
0 siblings, 0 replies; 52+ messages in thread
From: Manikandan.M @ 2025-09-16 6:52 UTC (permalink / raw)
To: mripard, maarten.lankhorst, tzimmermann, airlied, simona
Cc: dri-devel, ville.syrjala, Dharma.B, Nicolas.Ferre,
alexandre.belloni, claudiu.beznea, linux-arm-kernel
On 09/09/25 4:57 pm, Maxime Ripard wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>
> 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.
>
> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Maxime Ripard <mripard@kernel.org>
Reviewed-by: Manikandan Muralidharan <manikandan.m@microchip.com>
> ---
> To: Manikandan Muralidharan <manikandan.m@microchip.com>
> To: Dharma Balasubiramani <dharma.b@microchip.com>
> To: Nicolas Ferre <nicolas.ferre@microchip.com>
> To: Alexandre Belloni <alexandre.belloni@bootlin.com>
> To: Claudiu Beznea <claudiu.beznea@tuxon.dev>
> Cc: dri-devel@lists.freedesktop.org
> Cc: linux-arm-kernel@lists.infradead.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
>
--
Thanks and Regards,
Manikandan M.
^ permalink raw reply [flat|nested] 52+ messages in thread
end of thread, other threads:[~2025-10-20 12:04 UTC | newest]
Thread overview: 52+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-09 11:27 [PATCH v3 00/39] drm/atomic: Get rid of existing states (not really) Maxime Ripard
2025-09-09 11:27 ` Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 01/39] drm/atomic: Convert drm_atomic_get_connector_state() to use new connector state Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 02/39] drm/atomic: Remove unused drm_atomic_get_existing_connector_state() Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 03/39] drm/atomic: Document __drm_connectors_state state pointer Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 04/39] drm/atomic: Convert __drm_atomic_get_current_plane_state() to modern accessor Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 05/39] drm/atomic: Convert drm_atomic_get_plane_state() to use new plane state Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 06/39] drm/vkms: Convert vkms_crtc_atomic_check() " Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 07/39] drm/tilcdc: crtc: Use drm_atomic_helper_check_crtc_primary_plane() Maxime Ripard
2025-09-12 9:43 ` Jyri Sarha
2025-09-09 11:27 ` [PATCH v3 08/39] drm/atomic: Remove unused drm_atomic_get_existing_plane_state() Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 09/39] drm/atomic: Document __drm_planes_state state pointer Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 10/39] drm/atomic: Convert drm_atomic_get_crtc_state() to use new connector state Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 11/39] drm/ingenic: ipu: Switch to drm_atomic_get_new_crtc_state() Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 12/39] drm/arm/malidp: " Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 13/39] drm/armada: Drop always true condition in atomic_check Maxime Ripard
2025-09-09 13:39 ` Ville Syrjälä
2025-09-09 11:27 ` [PATCH v3 14/39] drm/armada: Switch to drm_atomic_get_new_crtc_state() Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 15/39] drm/atmel-hlcdc: " Maxime Ripard
2025-09-16 6:52 ` Manikandan.M
2025-09-09 11:27 ` [PATCH v3 16/39] drm/exynos: " Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 17/39] drm/imx-dc: " Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 18/39] drm/imx-dcss: " Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 19/39] drm/imx-ipuv3: " Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 20/39] drm/ingenic: " Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 21/39] drm/kmb: " Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 22/39] drm/logicvc: " Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 23/39] drm/loongson: " Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 24/39] drm/mediatek: " Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 25/39] drm/msm/mdp5: " Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 26/39] drm/omap: " Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 27/39] drm/rockchip: " Maxime Ripard
2025-09-09 11:27 ` Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 28/39] drm/sun4i: " Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 29/39] drm/tegra: " Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 30/39] drm/tilcdc: " Maxime Ripard
2025-09-12 9:47 ` Jyri Sarha
2025-09-09 11:27 ` [PATCH v3 31/39] drm/vboxvideo: " Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 32/39] drm/vc4: " Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 33/39] drm/atomic: " Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 34/39] drm/framebuffer: " Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 35/39] drm/atomic: Remove unused drm_atomic_get_existing_crtc_state() Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 36/39] drm/atomic: Document __drm_crtcs_state state pointer Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 37/39] drm/ingenic: crtc: Switch to ingenic_drm_get_new_priv_state() Maxime Ripard
2025-09-09 11:43 ` Paul Cercueil
2025-09-09 13:52 ` Ville Syrjälä
2025-09-09 14:45 ` Paul Cercueil
2025-09-10 11:26 ` Maxime Ripard
2025-09-10 13:14 ` Paul Cercueil
2025-09-10 12:19 ` Ville Syrjälä
2025-09-09 11:27 ` [PATCH v3 38/39] drm/atomic: Convert drm_atomic_get_private_obj_state() to use new plane state Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 39/39] drm/atomic: Document __drm_private_objs_state state pointer Maxime Ripard
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.