Skip to contentSkip to conversation

drm/connector: Convert all drivers to atomic_create_state and remove reset

PATCH Applied Maxime Ripard 3 participants 44 messages Oct 30 – Nov 5

Subsystems (29)
lore
Share & tools
lore

Maxime Ripard

author maintainer
#0 lore raw

v3 cover drm/connector: Convert all drivers to atomic_create_state and remove reset

This is a follow-up to the plane and CRTC reset removal series, and part of a larger effort to remove the reset hook from all KMS objects.

The connector reset hook is overloaded: it is called both at probe time to create the initial software state and during suspend/resume to reset hardware and software state. These two roles have different requirements, and the reset hook is not fallible, making error handling difficult for the initial state allocation path.

While reset has the semantics to reset both the software and hardware state, the vast majority of implementations and all the helpers only reset the software state, making them equivalent to atomic_create_state in practice. The atomic_create_state hook makes this explicit: it only allocates and initializes a pristine state without any side effect, and returns the state pointer or an ERR_PTR on failure.

This series converts all connector drivers tree-wide from the reset hook to atomic_create_state, then removes the reset hook from struct drm_connector_funcs entirely. The conversions were done using a combination of Coccinelle semantic patches, mechanical one-line replacements and manual adjustments.

---
Changes in v3:
- Fix error path in dw-hdmi
- Fix test error path for amdgpu kunit tests
- Fix nouveau legacy path
- Link to v2: https://lore.kernel.org/r/20261022-drm-no-more-connector-reset-v2-0-0b7e4e85b1e8@kernel.org

Changes in v2:
- Change the parameter order of __drm_atomic_helper_connector_hdmi_state_init
- Fixed state argument casing for drm_atomic_helper_connector_tv_margins_state_init and drm_atomic_helper_connector_tv_state_init
- Put atomic_create_state before atomic_duplicate_state
- Fix state allocation for MST and WB connectors
- Link to v1:
https://lore.kernel.org/r/20261014-drm-no-more-connector-reset-v1-0-586c9c026823@kernel.org

---
Maxime Ripard (37):
drm/amdgpu: vkms: Switch to drm_atomic_helper_connector_create_state drm/bridge: analogix-anx6345: Switch to drm_atomic_helper_connector_create_state drm/bridge: analogix-anx78xx: Switch to drm_atomic_helper_connector_create_state drm/bridge: chrontel-ch7033: Switch to drm_atomic_helper_connector_create_state drm/bridge: nxp-ptn3460: Switch to drm_atomic_helper_connector_create_state drm/panel: Switch to drm_atomic_helper_connector_create_state drm/bridge: synopsys: dw-hdmi: Switch to drm_atomic_helper_connector_create_state drm/bridge: tc358767: Switch to drm_atomic_helper_connector_create_state drm/bridge: tda998x: Switch to drm_atomic_helper_connector_create_state drm/bridge: ti-tfp410: Switch to drm_atomic_helper_connector_create_state drm/exynos: Switch to drm_atomic_helper_connector_create_state drm/fsl-dcu: Switch to drm_atomic_helper_connector_create_state drm/loongson: Switch to drm_atomic_helper_connector_create_state drm/mipi-dbi: Switch to drm_atomic_helper_connector_create_state drm/renesas: shmobile: Switch to drm_atomic_helper_connector_create_state drm/sitronix: st7571: Switch to drm_atomic_helper_connector_create_state drm/sti: Switch to drm_atomic_helper_connector_create_state drm/sun4i: Switch to drm_atomic_helper_connector_create_state drm/tegra: Switch to drm_atomic_helper_connector_create_state drm/tests: Switch to drm_atomic_helper_connector_create_state drm/tiny: arcpgu: Switch to drm_atomic_helper_connector_create_state drm/tiny: sharp: Switch to drm_atomic_helper_connector_create_state drm/virtio: Switch to drm_atomic_helper_connector_create_state drm/vkms: Switch to drm_atomic_helper_connector_create_state drm/xen: Switch to drm_atomic_helper_connector_create_state drm/bridge: synopsys: dw-hdmi: Convert to atomic_create_state drm/meson: Convert to atomic_create_state
drm/sun4i: hdmi: Convert to atomic_create_state
drm/sun4i: tv: Convert to atomic_create_state
drm/tests: hdmi: Convert to atomic_create_state
drm/connector: Remove drm_atomic_helper_connector_reset() drm/amdgpu: dm: Convert to atomic_create_state
drm/i915: Convert to atomic_create_state
drm/nouveau: Convert to atomic_create_state
drm/tegra: Convert to atomic_create_state
drm/connector: Remove __drm_atomic_helper_connector_reset() drm/connector: Remove reset

 drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c           |   2 +-
 .../amd/display/amdgpu_dm/amdgpu_dm_connector.c    |  32 ++---
 .../amd/display/amdgpu_dm/amdgpu_dm_connector.h    |   3 +-
 .../amd/display/amdgpu_dm/amdgpu_dm_mst_types.c    |  11 +-
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_wb.c   |  17 ++-
 .../amdgpu_dm/tests/amdgpu_dm_connector_test.c     | 102 +++++++++++-----
 drivers/gpu/drm/bridge/analogix/analogix-anx6345.c |   2 +-
 drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c |   2 +-
 drivers/gpu/drm/bridge/chrontel-ch7033.c           |   2 +-
 drivers/gpu/drm/bridge/nxp-ptn3460.c               |   2 +-
 drivers/gpu/drm/bridge/synopsys/dw-hdmi.c          |  14 ++-
 drivers/gpu/drm/bridge/tc358767.c                  |   2 +-
 drivers/gpu/drm/bridge/tda998x_drv.c               |   2 +-
 drivers/gpu/drm/bridge/ti-tfp410.c                 |   2 +-
 drivers/gpu/drm/display/drm_hdmi_state_helper.c    |   3 +-
 drivers/gpu/drm/drm_atomic_state_helper.c          |  43 -------
 drivers/gpu/drm/drm_connector.c                    |   8 --
 drivers/gpu/drm/drm_mode_config.c                  |   4 +-
 drivers/gpu/drm/drm_panel.c                        |   4 +-
 drivers/gpu/drm/exynos/exynos_drm_dpi.c            |   2 +-
 drivers/gpu/drm/exynos/exynos_drm_vidi.c           |   2 +-
 drivers/gpu/drm/exynos/exynos_hdmi.c               |   2 +-
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c          |   2 +-
 drivers/gpu/drm/i915/display/intel_connector.c     |   6 +-
 drivers/gpu/drm/i915/display/intel_sdvo.c          |   6 +-
 drivers/gpu/drm/loongson/lsdc_output_7a1000.c      |   2 +-
 drivers/gpu/drm/loongson/lsdc_output_7a2000.c      |   4 +-
 drivers/gpu/drm/meson/meson_encoder_hdmi.c         |  12 +-
 drivers/gpu/drm/nouveau/dispnv50/disp.c            |  25 ++--
 drivers/gpu/drm/nouveau/nouveau_connector.c        | 129 ++++++++++++++++-----
 drivers/gpu/drm/nouveau/nouveau_connector.h        |   3 +-
 drivers/gpu/drm/renesas/shmobile/shmob_drm_crtc.c  |   2 +-
 drivers/gpu/drm/sitronix/st7571.c                  |   2 +-
 drivers/gpu/drm/sti/sti_dvo.c                      |   2 +-
 drivers/gpu/drm/sti/sti_hda.c                      |   2 +-
 drivers/gpu/drm/sti/sti_hdmi.c                     |   2 +-
 drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c             |  16 ++-
 drivers/gpu/drm/sun4i/sun4i_lvds.c                 |   2 +-
 drivers/gpu/drm/sun4i/sun4i_rgb.c                  |   2 +-
 drivers/gpu/drm/sun4i/sun4i_tv.c                   |  16 ++-
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c             |   2 +-
 drivers/gpu/drm/tegra/dsi.c                        |  17 ++-
 drivers/gpu/drm/tegra/hdmi.c                       |   2 +-
 drivers/gpu/drm/tegra/sor.c                        |  13 +--
 drivers/gpu/drm/tests/drm_atomic_commit_test.c     |   2 +-
 drivers/gpu/drm/tests/drm_atomic_test.c            |   2 +-
 drivers/gpu/drm/tests/drm_connector_test.c         |   4 +-
 drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c |  16 ++-
 drivers/gpu/drm/tests/drm_probe_helper_test.c      |   2 +-
 drivers/gpu/drm/tiny/arcpgu.c                      |   2 +-
 drivers/gpu/drm/tiny/sharp-memory.c                |   2 +-
 drivers/gpu/drm/virtio/virtgpu_display.c           |   2 +-
 drivers/gpu/drm/vkms/vkms_connector.c              |   2 +-
 drivers/gpu/drm/vkms/vkms_writeback.c              |   2 +-
 drivers/gpu/drm/xen/xen_drm_front_conn.c           |   2 +-
 include/drm/drm_atomic_state_helper.h              |   3 -
 include/drm/drm_connector.h                        |  12 --
 include/drm/drm_mipi_dbi.h                         |   2 +-
 58 files changed, 351 insertions(+), 236 deletions(-)

---
base-commit: 91f52e99824b0beebb48cad51bbda81437af8664
change-id: 20260709-drm-no-more-connector-reset-45ee14d7c62c

Best regards,

Signature · 1 line
Maxime Ripard <[email protected]>
author maintainer
#1 lore raw

PATCH v3 1/37 drm/amdgpu: vkms: Switch to drm_atomic_helper_connector_create_state

The amdgpu: vkms connector implementation uses the deprecated drm_atomic_helper_connector_reset() as its reset hook.

Switch to drm_atomic_helper_connector_create_state() instead.

---
Cc: "Christian König" <[email protected]>
Cc: Alex Deucher <[email protected]>
Cc: [email protected]

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c +1 -1
index 5c5fdbec93c2..5c7e2172a372 100644
@@ -87,5 +87,5 @@ static const struct drm_connector_funcs amdgpu_vkms_connector_funcs = {
 	.fill_modes = drm_helper_probe_single_connector_modes,
 	.destroy = drm_connector_cleanup,
-	.reset = drm_atomic_helper_connector_reset,
+	.atomic_create_state = drm_atomic_helper_connector_create_state,
 	.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
 	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
Signature · 1 line
2.55.0
author maintainer
#2 lore raw

PATCH v3 2/37 drm/bridge: analogix-anx6345: Switch to drm_atomic_helper_connector_create_state

In reply to Maxime Ripard

The bridge: analogix-anx6345 connector implementation uses the deprecated drm_atomic_helper_connector_reset() as its reset hook.

Switch to drm_atomic_helper_connector_create_state() instead.

---
 drivers/gpu/drm/bridge/analogix/analogix-anx6345.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/bridge/analogix/analogix-anx6345.c +1 -1
index 407834a03b63..0cff9ff0265a 100644
@@ -484,5 +484,5 @@ static const struct drm_connector_funcs anx6345_connector_funcs = {
 	.fill_modes = drm_helper_probe_single_connector_modes,
 	.destroy = anx6345_connector_destroy,
-	.reset = drm_atomic_helper_connector_reset,
+	.atomic_create_state = drm_atomic_helper_connector_create_state,
 	.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
 	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
Signature · 1 line
2.55.0
author maintainer
#3 lore raw

PATCH v3 3/37 drm/bridge: analogix-anx78xx: Switch to drm_atomic_helper_connector_create_state

In reply to Maxime Ripard

The bridge: analogix-anx78xx connector implementation uses the deprecated drm_atomic_helper_connector_reset() as its reset hook.

Switch to drm_atomic_helper_connector_create_state() instead.

---
 drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c +1 -1
index 32186efa6f50..94f07a2317e1 100644
@@ -855,5 +855,5 @@ static const struct drm_connector_funcs anx78xx_connector_funcs = {
 	.detect = anx78xx_detect,
 	.destroy = drm_connector_cleanup,
-	.reset = drm_atomic_helper_connector_reset,
+	.atomic_create_state = drm_atomic_helper_connector_create_state,
 	.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
 	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
Signature · 1 line
2.55.0
author maintainer
#4 lore raw

PATCH v3 4/37 drm/bridge: chrontel-ch7033: Switch to drm_atomic_helper_connector_create_state

In reply to Maxime Ripard

The bridge: chrontel-ch7033 connector implementation uses the deprecated drm_atomic_helper_connector_reset() as its reset hook.

Switch to drm_atomic_helper_connector_create_state() instead.

---
 drivers/gpu/drm/bridge/chrontel-ch7033.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/bridge/chrontel-ch7033.c +1 -1
index 4bc64b2885f7..3d48b42c38a0 100644
@@ -219,8 +219,8 @@ static enum drm_connector_status ch7033_connector_detect(
 
 static const struct drm_connector_funcs ch7033_connector_funcs = {
-	.reset = drm_atomic_helper_connector_reset,
 	.fill_modes = drm_helper_probe_single_connector_modes,
 	.detect = ch7033_connector_detect,
 	.destroy = drm_connector_cleanup,
+	.atomic_create_state = drm_atomic_helper_connector_create_state,
 	.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
 	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
Signature · 1 line
2.55.0
author maintainer
#5 lore raw

PATCH v3 5/37 drm/bridge: nxp-ptn3460: Switch to drm_atomic_helper_connector_create_state

In reply to Maxime Ripard

The bridge: nxp-ptn3460 connector implementation uses the deprecated drm_atomic_helper_connector_reset() as its reset hook.

Switch to drm_atomic_helper_connector_create_state() instead.

---
 drivers/gpu/drm/bridge/nxp-ptn3460.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/bridge/nxp-ptn3460.c +1 -1
index f9eff8bfceb7..be6a06130ba9 100644
@@ -211,5 +211,5 @@ static const struct drm_connector_funcs ptn3460_connector_funcs = {
 	.fill_modes = drm_helper_probe_single_connector_modes,
 	.destroy = drm_connector_cleanup,
-	.reset = drm_atomic_helper_connector_reset,
+	.atomic_create_state = drm_atomic_helper_connector_create_state,
 	.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
 	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
Signature · 1 line
2.55.0
author maintainer
#6 lore raw

PATCH v3 6/37 drm/panel: Switch to drm_atomic_helper_connector_create_state

In reply to Maxime Ripard

The bridge: panel connector implementation uses the deprecated drm_atomic_helper_connector_reset() as its reset hook.

Switch to drm_atomic_helper_connector_create_state() instead.

---
 drivers/gpu/drm/drm_panel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_panel.c +1 -1
index 313053c123d1..760f074f947e 100644
@@ -71,7 +71,7 @@ panel_bridge_connector_helper_funcs = {
 
 static const struct drm_connector_funcs panel_bridge_connector_funcs = {
-	.reset = drm_atomic_helper_connector_reset,
 	.fill_modes = drm_helper_probe_single_connector_modes,
 	.destroy = drm_connector_cleanup,
+	.atomic_create_state = drm_atomic_helper_connector_create_state,
 	.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
 	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
Signature · 1 line
2.55.0
author maintainer
#7 lore raw

PATCH v3 7/37 drm/bridge: synopsys: dw-hdmi: Switch to drm_atomic_helper_connector_create_state

In reply to Maxime Ripard

The bridge: synopsys: dw-hdmi connector implementation uses the deprecated drm_atomic_helper_connector_reset() as its reset hook.

Switch to drm_atomic_helper_connector_create_state() instead.

---
 drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +1 -1
index 937d61c42b58..917cf764c9c5 100644
@@ -2570,5 +2570,5 @@ static const struct drm_connector_funcs dw_hdmi_connector_funcs = {
 	.destroy = drm_connector_cleanup,
 	.force = dw_hdmi_connector_force,
-	.reset = drm_atomic_helper_connector_reset,
+	.atomic_create_state = drm_atomic_helper_connector_create_state,
 	.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
 	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
Signature · 1 line
2.55.0
author maintainer
#8 lore raw

PATCH v3 8/37 drm/bridge: tc358767: Switch to drm_atomic_helper_connector_create_state

In reply to Maxime Ripard

The bridge: tc358767 connector implementation uses the deprecated drm_atomic_helper_connector_reset() as its reset hook.

Switch to drm_atomic_helper_connector_create_state() instead.

---
 drivers/gpu/drm/bridge/tc358767.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/bridge/tc358767.c +1 -1
index 51f4baa62a53..5ea6d3726bee 100644
@@ -1797,5 +1797,5 @@ static const struct drm_connector_funcs tc_connector_funcs = {
 	.fill_modes = drm_helper_probe_single_connector_modes,
 	.destroy = drm_connector_cleanup,
-	.reset = drm_atomic_helper_connector_reset,
+	.atomic_create_state = drm_atomic_helper_connector_create_state,
 	.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
 	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
Signature · 1 line
2.55.0
author maintainer
#9 lore raw

PATCH v3 9/37 drm/bridge: tda998x: Switch to drm_atomic_helper_connector_create_state

In reply to Maxime Ripard

The bridge: tda998x connector implementation uses the deprecated drm_atomic_helper_connector_reset() as its reset hook.

Switch to drm_atomic_helper_connector_create_state() instead.

---
Cc: Russell King <[email protected]>

---
 drivers/gpu/drm/bridge/tda998x_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/bridge/tda998x_drv.c +1 -1
index 9a4c47134fc4..54ef526a1133 100644
@@ -1210,8 +1210,8 @@ tda998x_connector_detect(struct drm_connector *connector, bool force)
 
 static const struct drm_connector_funcs tda998x_connector_funcs = {
-	.reset = drm_atomic_helper_connector_reset,
 	.fill_modes = drm_helper_probe_single_connector_modes,
 	.detect = tda998x_connector_detect,
 	.destroy = drm_connector_cleanup,
+	.atomic_create_state = drm_atomic_helper_connector_create_state,
 	.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
 	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
Signature · 1 line
2.55.0
author maintainer
#10 lore raw

PATCH v3 10/37 drm/bridge: ti-tfp410: Switch to drm_atomic_helper_connector_create_state

In reply to Maxime Ripard

The bridge: ti-tfp410 connector implementation uses the deprecated drm_atomic_helper_connector_reset() as its reset hook.

Switch to drm_atomic_helper_connector_create_state() instead.

---
 drivers/gpu/drm/bridge/ti-tfp410.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/bridge/ti-tfp410.c +1 -1
index 629ff7095e87..64a3d64e1f7b 100644
@@ -96,5 +96,5 @@ static const struct drm_connector_funcs tfp410_con_funcs = {
 	.fill_modes		= drm_helper_probe_single_connector_modes,
 	.destroy		= drm_connector_cleanup,
-	.reset			= drm_atomic_helper_connector_reset,
+	.atomic_create_state	= drm_atomic_helper_connector_create_state,
 	.atomic_duplicate_state	= drm_atomic_helper_connector_duplicate_state,
 	.atomic_destroy_state	= drm_atomic_helper_connector_destroy_state,
Signature · 1 line
2.55.0
author maintainer
#11 lore raw

PATCH v3 11/37 drm/exynos: Switch to drm_atomic_helper_connector_create_state

In reply to Maxime Ripard

The exynos connector implementation uses the deprecated drm_atomic_helper_connector_reset() as its reset hook.

Switch to drm_atomic_helper_connector_create_state() instead.

---
Cc: Alim Akhtar <[email protected]>
Cc: Inki Dae <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Cc: Kyungmin Park <[email protected]>
Cc: Peter Griffin <[email protected]>
Cc: Seung-Woo Kim <[email protected]>
Cc: [email protected]

---
 drivers/gpu/drm/exynos/exynos_drm_dpi.c  | 2 +-
 drivers/gpu/drm/exynos/exynos_drm_vidi.c | 2 +-
 drivers/gpu/drm/exynos/exynos_hdmi.c     | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_dpi.c +1 -1
index 74d3a2bebb74..42c48fd14050 100644
@@ -57,5 +57,5 @@ static const struct drm_connector_funcs exynos_dpi_connector_funcs = {
 	.fill_modes = drm_helper_probe_single_connector_modes,
 	.destroy = exynos_dpi_connector_destroy,
-	.reset = drm_atomic_helper_connector_reset,
+	.atomic_create_state = drm_atomic_helper_connector_create_state,
 	.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
 	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
drivers/gpu/drm/exynos/exynos_drm_vidi.c +1 -1
index 077571eae9d6..f3e8a2bc1182 100644
@@ -335,5 +335,5 @@ static const struct drm_connector_funcs vidi_connector_funcs = {
 	.detect = vidi_detect,
 	.destroy = vidi_connector_destroy,
-	.reset = drm_atomic_helper_connector_reset,
+	.atomic_create_state = drm_atomic_helper_connector_create_state,
 	.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
 	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
drivers/gpu/drm/exynos/exynos_hdmi.c +1 -1
index 055dc04f9b3e..654a8b1b4afc 100644
@@ -876,5 +876,5 @@ static const struct drm_connector_funcs hdmi_connector_funcs = {
 	.detect = hdmi_detect,
 	.destroy = hdmi_connector_destroy,
-	.reset = drm_atomic_helper_connector_reset,
+	.atomic_create_state = drm_atomic_helper_connector_create_state,
 	.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
 	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
Signature · 1 line
2.55.0
author maintainer
#12 lore raw

PATCH v3 12/37 drm/fsl-dcu: Switch to drm_atomic_helper_connector_create_state

In reply to Maxime Ripard

The fsl-dcu connector implementation uses the deprecated drm_atomic_helper_connector_reset() as its reset hook.

Switch to drm_atomic_helper_connector_create_state() instead.

---
Cc: Alison Wang <[email protected]>
Cc: Stefan Agner <[email protected]>

---
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c +1 -1
index c64264541fe2..9b5ca262d619 100644
@@ -51,9 +51,9 @@ static void fsl_dcu_drm_connector_destroy(struct drm_connector *connector)
 
 static const struct drm_connector_funcs fsl_dcu_drm_connector_funcs = {
+	.atomic_create_state = drm_atomic_helper_connector_create_state,
 	.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
 	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
 	.destroy = fsl_dcu_drm_connector_destroy,
 	.fill_modes = drm_helper_probe_single_connector_modes,
-	.reset = drm_atomic_helper_connector_reset,
 };
 
Signature · 1 line
2.55.0
author maintainer
#13 lore raw

PATCH v3 13/37 drm/loongson: Switch to drm_atomic_helper_connector_create_state

In reply to Maxime Ripard

The loongson connector implementation uses the deprecated drm_atomic_helper_connector_reset() as its reset hook.

Switch to drm_atomic_helper_connector_create_state() instead.

---
Cc: Huacai Chen <[email protected]>
Cc: Icenowy Zheng <[email protected]>
Cc: Jianmin Lv <[email protected]>
Cc: Mingcong Bai <[email protected]>
Cc: Qianhai Wu <[email protected]>
Cc: Xi Ruoyao <[email protected]>

---
 drivers/gpu/drm/loongson/lsdc_output_7a1000.c | 2 +-
 drivers/gpu/drm/loongson/lsdc_output_7a2000.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/loongson/lsdc_output_7a1000.c +1 -1
index 5c483baa3762..3d4562353578 100644
@@ -96,5 +96,5 @@ static const struct drm_connector_funcs ls7a1000_dpi_connector_funcs = {
 	.fill_modes = drm_helper_probe_single_connector_modes,
 	.destroy = drm_connector_cleanup,
-	.reset = drm_atomic_helper_connector_reset,
+	.atomic_create_state = drm_atomic_helper_connector_create_state,
 	.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
 	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state
drivers/gpu/drm/loongson/lsdc_output_7a2000.c +2 -2
index a9798b3dadee..e2255e6a0d32 100644
@@ -204,5 +204,5 @@ static const struct drm_connector_funcs ls7a2000_hdmi_connector_funcs[2] = {
 		.fill_modes = drm_helper_probe_single_connector_modes,
 		.destroy = drm_connector_cleanup,
-		.reset = drm_atomic_helper_connector_reset,
+		.atomic_create_state = drm_atomic_helper_connector_create_state,
 		.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
 		.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
@@ -213,5 +213,5 @@ static const struct drm_connector_funcs ls7a2000_hdmi_connector_funcs[2] = {
 		.fill_modes = drm_helper_probe_single_connector_modes,
 		.destroy = drm_connector_cleanup,
-		.reset = drm_atomic_helper_connector_reset,
+		.atomic_create_state = drm_atomic_helper_connector_create_state,
 		.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
 		.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
Signature · 1 line
2.55.0
author maintainer
#14 lore raw

PATCH v3 14/37 drm/mipi-dbi: Switch to drm_atomic_helper_connector_create_state

In reply to Maxime Ripard

The mipi-dbi connector implementation uses the deprecated drm_atomic_helper_connector_reset() as its reset hook.

Switch to drm_atomic_helper_connector_create_state() instead.

---
 include/drm/drm_mipi_dbi.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/drm/drm_mipi_dbi.h +1 -1
index d93e25fdc2e1..bb3296419910 100644
@@ -258,6 +258,6 @@ void drm_mipi_dbi_crtc_helper_atomic_disable(struct drm_crtc *crtc,
 
 #define DRM_MIPI_DBI_CONNECTOR_FUNCS \
-	.reset = drm_atomic_helper_connector_reset, \
 	.fill_modes = drm_helper_probe_single_connector_modes, \
+	.atomic_create_state = drm_atomic_helper_connector_create_state, \
 	.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, \
 	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state
Signature · 1 line
2.55.0
author maintainer
#15 lore raw

PATCH v3 15/37 drm/renesas: shmobile: Switch to drm_atomic_helper_connector_create_state

In reply to Maxime Ripard

The renesas: shmobile connector implementation uses the deprecated drm_atomic_helper_connector_reset() as its reset hook.

Switch to drm_atomic_helper_connector_create_state() instead.

---
Cc: Geert Uytterhoeven <[email protected]>
Cc: [email protected]

---
 drivers/gpu/drm/renesas/shmobile/shmob_drm_crtc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/renesas/shmobile/shmob_drm_crtc.c +1 -1
index 51bae2008cc6..d1a3e17f5bb1 100644
@@ -528,7 +528,7 @@ static void shmob_drm_connector_destroy(struct drm_connector *connector)
 
 static const struct drm_connector_funcs connector_funcs = {
-	.reset = drm_atomic_helper_connector_reset,
 	.fill_modes = drm_helper_probe_single_connector_modes,
 	.destroy = shmob_drm_connector_destroy,
+	.atomic_create_state = drm_atomic_helper_connector_create_state,
 	.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
 	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
Signature · 1 line
2.55.0
author maintainer
#16 lore raw

PATCH v3 16/37 drm/sitronix: st7571: Switch to drm_atomic_helper_connector_create_state

In reply to Maxime Ripard

The sitronix: st7571 connector implementation uses the deprecated drm_atomic_helper_connector_reset() as its reset hook.

Switch to drm_atomic_helper_connector_create_state() instead.

---
Cc: Marcus Folkesson <[email protected]>

---
 drivers/gpu/drm/sitronix/st7571.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/sitronix/st7571.c +1 -1
index 5e60c4685671..608d38eab0fc 100644
@@ -476,7 +476,7 @@ static const struct drm_encoder_helper_funcs st7571_encoder_helper_funcs = {
 
 static const struct drm_connector_funcs st7571_connector_funcs = {
-	.reset = drm_atomic_helper_connector_reset,
 	.fill_modes = drm_helper_probe_single_connector_modes,
 	.destroy = drm_connector_cleanup,
+	.atomic_create_state = drm_atomic_helper_connector_create_state,
 	.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
 	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
Signature · 1 line
2.55.0
author maintainer
#17 lore raw

PATCH v3 17/37 drm/sti: Switch to drm_atomic_helper_connector_create_state

In reply to Maxime Ripard

The sti connector implementation uses the deprecated drm_atomic_helper_connector_reset() as its reset hook.

Switch to drm_atomic_helper_connector_create_state() instead.

---
Cc: Alain Volmat <[email protected]>
Cc: Raphael Gallais-Pou <[email protected]>

---
 drivers/gpu/drm/sti/sti_dvo.c  | 2 +-
 drivers/gpu/drm/sti/sti_hda.c  | 2 +-
 drivers/gpu/drm/sti/sti_hdmi.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/sti/sti_dvo.c +1 -1
index cdb19b75f5e1..18c337ffa161 100644
@@ -421,5 +421,5 @@ static const struct drm_connector_funcs sti_dvo_connector_funcs = {
 	.detect = sti_dvo_connector_detect,
 	.destroy = drm_connector_cleanup,
-	.reset = drm_atomic_helper_connector_reset,
+	.atomic_create_state = drm_atomic_helper_connector_create_state,
 	.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
 	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
drivers/gpu/drm/sti/sti_hda.c +1 -1
index b4def2b25cec..204738807c86 100644
@@ -664,5 +664,5 @@ static const struct drm_connector_funcs sti_hda_connector_funcs = {
 	.fill_modes = drm_helper_probe_single_connector_modes,
 	.destroy = drm_connector_cleanup,
-	.reset = drm_atomic_helper_connector_reset,
+	.atomic_create_state = drm_atomic_helper_connector_create_state,
 	.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
 	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
drivers/gpu/drm/sti/sti_hdmi.c +1 -1
index 7ba9e0b7ba6c..9a810a89e6c0 100644
@@ -1147,5 +1147,5 @@ static const struct drm_connector_funcs sti_hdmi_connector_funcs = {
 	.detect = sti_hdmi_connector_detect,
 	.destroy = drm_connector_cleanup,
-	.reset = drm_atomic_helper_connector_reset,
+	.atomic_create_state = drm_atomic_helper_connector_create_state,
 	.atomic_set_property = sti_hdmi_connector_set_property,
 	.atomic_get_property = sti_hdmi_connector_get_property,
Signature · 1 line
2.55.0
author maintainer
#18 lore raw

PATCH v3 18/37 drm/sun4i: Switch to drm_atomic_helper_connector_create_state

In reply to Maxime Ripard

The sun4i connector implementation uses the deprecated drm_atomic_helper_connector_reset() as its reset hook.

Switch to drm_atomic_helper_connector_create_state() instead.

---
Cc: Chen-Yu Tsai <[email protected]>
Cc: Samuel Holland <[email protected]>
Cc: [email protected]

---
 drivers/gpu/drm/sun4i/sun4i_lvds.c     | 2 +-
 drivers/gpu/drm/sun4i/sun4i_rgb.c      | 2 +-
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/sun4i/sun4i_lvds.c +1 -1
index 6b98d20a8890..f3f035c9260f 100644
@@ -66,5 +66,5 @@ static const struct drm_connector_funcs sun4i_lvds_con_funcs = {
 	.fill_modes		= drm_helper_probe_single_connector_modes,
 	.destroy		= sun4i_lvds_connector_destroy,
-	.reset			= drm_atomic_helper_connector_reset,
+	.atomic_create_state	= drm_atomic_helper_connector_create_state,
 	.atomic_duplicate_state	= drm_atomic_helper_connector_duplicate_state,
 	.atomic_destroy_state	= drm_atomic_helper_connector_destroy_state,
drivers/gpu/drm/sun4i/sun4i_rgb.c +1 -1
index 3da9a9283c6e..c930dd899875 100644
@@ -157,5 +157,5 @@ static const struct drm_connector_funcs sun4i_rgb_con_funcs = {
 	.fill_modes		= drm_helper_probe_single_connector_modes,
 	.destroy		= sun4i_rgb_connector_destroy,
-	.reset			= drm_atomic_helper_connector_reset,
+	.atomic_create_state	= drm_atomic_helper_connector_create_state,
 	.atomic_duplicate_state	= drm_atomic_helper_connector_duplicate_state,
 	.atomic_destroy_state	= drm_atomic_helper_connector_destroy_state,
drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +1 -1
index d504ae583294..1b7ae9b327c1 100644
@@ -838,5 +838,5 @@ static const struct drm_connector_funcs sun6i_dsi_connector_funcs = {
 	.fill_modes		= drm_helper_probe_single_connector_modes,
 	.destroy		= drm_connector_cleanup,
-	.reset			= drm_atomic_helper_connector_reset,
+	.atomic_create_state	= drm_atomic_helper_connector_create_state,
 	.atomic_duplicate_state	= drm_atomic_helper_connector_duplicate_state,
 	.atomic_destroy_state	= drm_atomic_helper_connector_destroy_state,
Signature · 1 line
2.55.0
author maintainer
#19 lore raw

PATCH v3 19/37 drm/tegra: Switch to drm_atomic_helper_connector_create_state

In reply to Maxime Ripard

The tegra connector implementation uses the deprecated drm_atomic_helper_connector_reset() as its reset hook.

Switch to drm_atomic_helper_connector_create_state() instead.

---
Cc: Jonathan Hunter <[email protected]>
Cc: Mikko Perttunen <[email protected]>
Cc: Thierry Reding <[email protected]>
Cc: [email protected]

---
 drivers/gpu/drm/tegra/hdmi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/tegra/hdmi.c +1 -1
index 0d2c0ab0a63e..f414dd514543 100644
@@ -1131,8 +1131,8 @@ static void tegra_hdmi_early_unregister(struct drm_connector *connector)
 
 static const struct drm_connector_funcs tegra_hdmi_connector_funcs = {
-	.reset = drm_atomic_helper_connector_reset,
 	.detect = tegra_hdmi_connector_detect,
 	.fill_modes = drm_helper_probe_single_connector_modes,
 	.destroy = tegra_output_connector_destroy,
+	.atomic_create_state = drm_atomic_helper_connector_create_state,
 	.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
 	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
Signature · 1 line
2.55.0
author maintainer
#20 lore raw

PATCH v3 20/37 drm/tests: Switch to drm_atomic_helper_connector_create_state

In reply to Maxime Ripard

The tests connector implementation uses the deprecated drm_atomic_helper_connector_reset() as its reset hook.

Switch to drm_atomic_helper_connector_create_state() instead.

---
 drivers/gpu/drm/tests/drm_atomic_commit_test.c | 2 +-
 drivers/gpu/drm/tests/drm_atomic_test.c        | 2 +-
 drivers/gpu/drm/tests/drm_connector_test.c     | 4 ++--
 drivers/gpu/drm/tests/drm_probe_helper_test.c  | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/tests/drm_atomic_commit_test.c +1 -1
index ff69bade19b8..6ccb001f6264 100644
@@ -52,7 +52,7 @@ static const struct drm_encoder_helper_funcs drm_atomic_test_encoder_funcs = {
 
 static const struct drm_connector_funcs dummy_connector_funcs = {
+	.atomic_create_state	= drm_atomic_helper_connector_create_state,
 	.atomic_destroy_state	= drm_atomic_helper_connector_destroy_state,
 	.atomic_duplicate_state	= drm_atomic_helper_connector_duplicate_state,
-	.reset			= drm_atomic_helper_connector_reset,
 };
 
drivers/gpu/drm/tests/drm_atomic_test.c +1 -1
index ea91bec6569e..541a0062f143 100644
@@ -24,7 +24,7 @@ static const struct drm_connector_helper_funcs drm_atomic_init_connector_helper_
 
 static const struct drm_connector_funcs drm_atomic_init_connector_funcs = {
+	.atomic_create_state	= drm_atomic_helper_connector_create_state,
 	.atomic_destroy_state	= drm_atomic_helper_connector_destroy_state,
 	.atomic_duplicate_state	= drm_atomic_helper_connector_duplicate_state,
-	.reset			= drm_atomic_helper_connector_reset,
 };
 
drivers/gpu/drm/tests/drm_connector_test.c +2 -2
index 3368aedd4e66..2856294bafda 100644
@@ -49,7 +49,7 @@ static const struct drm_connector_hdmi_funcs dummy_hdmi_funcs = {
 
 static const struct drm_connector_funcs dummy_funcs = {
+	.atomic_create_state	= drm_atomic_helper_connector_create_state,
 	.atomic_destroy_state	= drm_atomic_helper_connector_destroy_state,
 	.atomic_duplicate_state	= drm_atomic_helper_connector_duplicate_state,
-	.reset			= drm_atomic_helper_connector_reset,
 };
 
@@ -203,7 +203,7 @@ static struct kunit_suite drmm_connector_init_test_suite = {
 
 static const struct drm_connector_funcs dummy_dynamic_init_funcs = {
+	.atomic_create_state	= drm_atomic_helper_connector_create_state,
 	.atomic_destroy_state	= drm_atomic_helper_connector_destroy_state,
 	.atomic_duplicate_state	= drm_atomic_helper_connector_duplicate_state,
-	.reset			= drm_atomic_helper_connector_reset,
 	.destroy		= drm_connector_cleanup,
 };
drivers/gpu/drm/tests/drm_probe_helper_test.c +1 -1
index db0e4f5df275..ebc0392585e7 100644
@@ -26,7 +26,7 @@ static const struct drm_connector_helper_funcs drm_probe_helper_connector_helper
 
 static const struct drm_connector_funcs drm_probe_helper_connector_funcs = {
+	.atomic_create_state	= drm_atomic_helper_connector_create_state,
 	.atomic_destroy_state	= drm_atomic_helper_connector_destroy_state,
 	.atomic_duplicate_state	= drm_atomic_helper_connector_duplicate_state,
-	.reset			= drm_atomic_helper_connector_reset,
 };
 
Signature · 1 line
2.55.0
author maintainer
#21 lore raw

PATCH v3 21/37 drm/tiny: arcpgu: Switch to drm_atomic_helper_connector_create_state

In reply to Maxime Ripard

The tiny: arcpgu connector implementation uses the deprecated drm_atomic_helper_connector_reset() as its reset hook.

Switch to drm_atomic_helper_connector_create_state() instead.

---
Cc: Alexey Brodkin <[email protected]>

---
 drivers/gpu/drm/tiny/arcpgu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/tiny/arcpgu.c +1 -1
index cdbf28db8fa1..32f6e98ba9c5 100644
@@ -99,7 +99,7 @@ arcpgu_drm_connector_helper_funcs = {
 
 static const struct drm_connector_funcs arcpgu_drm_connector_funcs = {
-	.reset = drm_atomic_helper_connector_reset,
 	.fill_modes = drm_helper_probe_single_connector_modes,
 	.destroy = drm_connector_cleanup,
+	.atomic_create_state = drm_atomic_helper_connector_create_state,
 	.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
 	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
Signature · 1 line
2.55.0
author maintainer
#22 lore raw

PATCH v3 22/37 drm/tiny: sharp: Switch to drm_atomic_helper_connector_create_state

In reply to Maxime Ripard

The tiny: sharp connector implementation uses the deprecated drm_atomic_helper_connector_reset() as its reset hook.

Switch to drm_atomic_helper_connector_create_state() instead.

---
Cc: Alex Lanzano <[email protected]>

---
 drivers/gpu/drm/tiny/sharp-memory.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/tiny/sharp-memory.c +1 -1
index 434e73bd25a5..b948e44544d6 100644
@@ -370,7 +370,7 @@ static const struct drm_connector_helper_funcs sharp_memory_connector_hfuncs = {
 
 static const struct drm_connector_funcs sharp_memory_connector_funcs = {
-	.reset = drm_atomic_helper_connector_reset,
 	.fill_modes = drm_helper_probe_single_connector_modes,
 	.destroy = drm_connector_cleanup,
+	.atomic_create_state = drm_atomic_helper_connector_create_state,
 	.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
 	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
Signature · 1 line
2.55.0
author maintainer
#23 lore raw

PATCH v3 23/37 drm/virtio: Switch to drm_atomic_helper_connector_create_state

In reply to Maxime Ripard

The virtio connector implementation uses the deprecated drm_atomic_helper_connector_reset() as its reset hook.

Switch to drm_atomic_helper_connector_create_state() instead.

---
Cc: Chia-I Wu <[email protected]>
Cc: David Airlie <[email protected]>
Cc: Dmitry Osipenko <[email protected]>
Cc: Gerd Hoffmann <[email protected]>
Cc: Gurchetan Singh <[email protected]>
Cc: [email protected]

---
 drivers/gpu/drm/virtio/virtgpu_display.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/virtio/virtgpu_display.c +1 -1
index b60aab07e78d..f0ed9bd27a91 100644
@@ -271,5 +271,5 @@ static const struct drm_connector_funcs virtio_gpu_connector_funcs = {
 	.fill_modes = drm_helper_probe_single_connector_modes,
 	.destroy = virtio_gpu_conn_destroy,
-	.reset = drm_atomic_helper_connector_reset,
+	.atomic_create_state = drm_atomic_helper_connector_create_state,
 	.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
 	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
Signature · 1 line
2.55.0
author maintainer
#24 lore raw

PATCH v3 24/37 drm/vkms: Switch to drm_atomic_helper_connector_create_state

In reply to Maxime Ripard

The vkms connector implementation uses the deprecated drm_atomic_helper_connector_reset() as its reset hook.

Switch to drm_atomic_helper_connector_create_state() instead.

---
Cc: Haneen Mohammed <[email protected]>
Cc: Louis Chauvet <[email protected]>
Cc: Melissa Wen <[email protected]>

---
 drivers/gpu/drm/vkms/vkms_connector.c | 2 +-
 drivers/gpu/drm/vkms/vkms_writeback.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/vkms/vkms_connector.c +1 -1
index b0a6b212d3f4..57138027966f 100644
@@ -38,5 +38,5 @@ static const struct drm_connector_funcs vkms_connector_funcs = {
 	.detect = vkms_connector_detect,
 	.fill_modes = drm_helper_probe_single_connector_modes,
-	.reset = drm_atomic_helper_connector_reset,
+	.atomic_create_state = drm_atomic_helper_connector_create_state,
 	.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
 	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
drivers/gpu/drm/vkms/vkms_writeback.c +1 -1
index ecf29a2c0c8e..858df1f89f66 100644
@@ -27,5 +27,5 @@ static const u32 vkms_wb_formats[] = {
 static const struct drm_connector_funcs vkms_wb_connector_funcs = {
 	.fill_modes = drm_helper_probe_single_connector_modes,
-	.reset = drm_atomic_helper_connector_reset,
+	.atomic_create_state = drm_atomic_helper_connector_create_state,
 	.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
 	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
Signature · 1 line
2.55.0
author maintainer
#25 lore raw

PATCH v3 25/37 drm/xen: Switch to drm_atomic_helper_connector_create_state

In reply to Maxime Ripard

The xen connector implementation uses the deprecated drm_atomic_helper_connector_reset() as its reset hook.

Switch to drm_atomic_helper_connector_create_state() instead.

---
Cc: Oleksandr Andrushchenko <[email protected]>

---
 drivers/gpu/drm/xen/xen_drm_front_conn.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/xen/xen_drm_front_conn.c +1 -1
index a1ba6d3d0568..8ceac0947be2 100644
@@ -95,5 +95,5 @@ static const struct drm_connector_funcs connector_funcs = {
 	.fill_modes = drm_helper_probe_single_connector_modes,
 	.destroy = drm_connector_cleanup,
-	.reset = drm_atomic_helper_connector_reset,
+	.atomic_create_state = drm_atomic_helper_connector_create_state,
 	.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
 	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
Signature · 1 line
2.55.0
author maintainer
#26 lore raw

PATCH v3 26/37 drm/bridge: synopsys: dw-hdmi: Convert to atomic_create_state

In reply to Maxime Ripard

The dw-hdmi driver calls drm_atomic_helper_connector_reset() during connector creation to allocate an initial connector state needed by drm_connector_attach_max_bpc_property(). However, the driver only needs to allocate a pristine state, which is exactly what atomic_create_state provides.

Convert to drm_atomic_helper_connector_create_state() with proper error handling.

---
 drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +11 -1
index 917cf764c9c5..2d49fa92b8e2 100644
@@ -2606,5 +2606,15 @@ static int dw_hdmi_connector_create(struct dw_hdmi *hdmi)
 	 * connector to have a state.
 	 */
-	drm_atomic_helper_connector_reset(connector);
+	if (!connector->state) {
+		struct drm_connector_state *conn_state;
+
+		conn_state = drm_atomic_helper_connector_create_state(connector);
+		if (IS_ERR(conn_state)) {
+			drm_connector_cleanup(connector);
+			return PTR_ERR(conn_state);
+		}
+
+		connector->state = conn_state;
+	}
 
 	drm_connector_attach_max_bpc_property(connector, 8, 16);
Signature · 1 line
2.55.0
author maintainer
#27 lore raw

PATCH v3 27/37 drm/meson: Convert to atomic_create_state

In reply to Maxime Ripard

The meson HDMI encoder calls drm_atomic_helper_connector_reset() during connector creation to allocate an initial connector state needed by drm_connector_attach_max_bpc_property(). However, the driver only needs to allocate a pristine state, which is exactly what atomic_create_state provides.

Convert to drm_atomic_helper_connector_create_state() with proper error handling.

---
Cc: Jerome Brunet <[email protected]>
Cc: Kevin Hilman <[email protected]>
Cc: Martin Blumenstingl <[email protected]>
Cc: [email protected]

---
 drivers/gpu/drm/meson/meson_encoder_hdmi.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/gpu/drm/meson/meson_encoder_hdmi.c +11 -1
index c4355c5cc340..eab2e969d791 100644
@@ -449,5 +449,15 @@ int meson_encoder_hdmi_probe(struct meson_drm *priv)
 	 * connector to have a state.
 	 */
-	drm_atomic_helper_connector_reset(meson_encoder_hdmi->connector);
+	if (!meson_encoder_hdmi->connector->state) {
+		struct drm_connector_state *conn_state;
+
+		conn_state = drm_atomic_helper_connector_create_state(meson_encoder_hdmi->connector);
+		if (IS_ERR(conn_state)) {
+			ret = PTR_ERR(conn_state);
+			goto err_put_node;
+		}
+
+		meson_encoder_hdmi->connector->state = conn_state;
+	}
 
 	if (meson_vpu_is_compatible(priv, VPU_COMPATIBLE_GXL) ||
Signature · 7 lines
2.55.0


_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic
reviewer Reviewed-by on v3 27/37
#28 lore raw

Re: [PATCH v3 27/37] drm/meson: Convert to atomic_create_state

Quoted 11 lines · Maxime Ripard

The meson HDMI encoder calls drm_atomic_helper_connector_reset() during connector creation to allocate an initial connector state needed by drm_connector_attach_max_bpc_property(). However, the driver only needs to allocate a pristine state, which is exactly what atomic_create_state provides.

Convert to drm_atomic_helper_connector_create_state() with proper error handling.

_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic

author maintainer
#29 lore raw

PATCH v3 28/37 drm/sun4i: hdmi: Convert to atomic_create_state

In reply to Maxime Ripard

The sun4i HDMI connector reset implementation creates a pristine state and initializes the HDMI state. It does not perform any hardware reset.

Since this is equivalent to what atomic_create_state expects, convert the reset function to an atomic_create_state hook that returns the initialized state.

---
Cc: Chen-Yu Tsai <[email protected]>
Cc: Samuel Holland <[email protected]>
Cc: [email protected]

---
 drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c +12 -4
index 3084f6570c29..58626d0562ae 100644
@@ -291,9 +291,17 @@ sun4i_hdmi_connector_detect(struct drm_connector *connector, bool force)
 }
 
-static void sun4i_hdmi_connector_reset(struct drm_connector *connector)
+static struct drm_connector_state *
+sun4i_hdmi_connector_create_state(struct drm_connector *connector)
 {
-	drm_atomic_helper_connector_reset(connector);
-	__drm_atomic_helper_connector_hdmi_state_init(connector->state,
+	struct drm_connector_state *connector_state;
+
+	connector_state = drm_atomic_helper_connector_create_state(connector);
+	if (IS_ERR(connector_state))
+		return connector_state;
+
+	__drm_atomic_helper_connector_hdmi_state_init(connector_state,
 						      connector);
+
+	return connector_state;
 }
 
@@ -302,5 +310,5 @@ static const struct drm_connector_funcs sun4i_hdmi_connector_funcs = {
 	.detect			= sun4i_hdmi_connector_detect,
 	.fill_modes		= drm_helper_probe_single_connector_modes,
-	.reset			= sun4i_hdmi_connector_reset,
+	.atomic_create_state	= sun4i_hdmi_connector_create_state,
 	.atomic_duplicate_state	= drm_atomic_helper_connector_duplicate_state,
 	.atomic_destroy_state	= drm_atomic_helper_connector_destroy_state,
Signature · 1 line
2.55.0
author maintainer
#30 lore raw

PATCH v3 29/37 drm/sun4i: tv: Convert to atomic_create_state

In reply to Maxime Ripard

The sun4i TV connector reset implementation creates a pristine state and initializes the analog TV properties. It does not perform any hardware reset.

Since this is equivalent to what atomic_create_state expects, convert the reset function to an atomic_create_state hook that returns the initialized state.

---
Cc: Chen-Yu Tsai <[email protected]>
Cc: Samuel Holland <[email protected]>
Cc: [email protected]

---
 drivers/gpu/drm/sun4i/sun4i_tv.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
drivers/gpu/drm/sun4i/sun4i_tv.c +12 -4
index ea86f8a6a35e..a68e5f7a03d2 100644
@@ -406,8 +406,16 @@ static const struct drm_connector_helper_funcs sun4i_tv_comp_connector_helper_fu
 };
 
-static void sun4i_tv_connector_reset(struct drm_connector *connector)
+static struct drm_connector_state *
+sun4i_tv_connector_create_state(struct drm_connector *connector)
 {
-	drm_atomic_helper_connector_reset(connector);
-	drm_atomic_helper_connector_tv_state_init(connector->state, connector);
+	struct drm_connector_state *connector_state;
+
+	connector_state = drm_atomic_helper_connector_create_state(connector);
+	if (IS_ERR(connector_state))
+		return connector_state;
+
+	drm_atomic_helper_connector_tv_state_init(connector_state, connector);
+
+	return connector_state;
 }
 
@@ -415,5 +423,5 @@ static const struct drm_connector_funcs sun4i_tv_comp_connector_funcs = {
 	.fill_modes		= drm_helper_probe_single_connector_modes,
 	.destroy		= drm_connector_cleanup,
-	.reset			= sun4i_tv_connector_reset,
+	.atomic_create_state	= sun4i_tv_connector_create_state,
 	.atomic_duplicate_state	= drm_atomic_helper_connector_duplicate_state,
 	.atomic_destroy_state	= drm_atomic_helper_connector_destroy_state,
Signature · 1 line
2.55.0
author maintainer
#31 lore raw

PATCH v3 30/37 drm/tests: hdmi: Convert to atomic_create_state

In reply to Maxime Ripard

The test HDMI connector reset implementation creates a pristine state and initializes the HDMI state. It does not perform any hardware reset.

Since this is equivalent to what atomic_create_state expects, convert the reset function to an atomic_create_state hook that returns the initialized state.

---
 drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c +12 -4
index 9953f5e661ce..336bb644cb7c 100644
@@ -200,16 +200,24 @@ static const struct drm_connector_helper_funcs dummy_connector_helper_funcs = {
 };
 
-static void dummy_hdmi_connector_reset(struct drm_connector *connector)
+static struct drm_connector_state *
+dummy_hdmi_connector_create_state(struct drm_connector *connector)
 {
-	drm_atomic_helper_connector_reset(connector);
-	__drm_atomic_helper_connector_hdmi_state_init(connector->state,
+	struct drm_connector_state *connector_state;
+
+	connector_state = drm_atomic_helper_connector_create_state(connector);
+	if (IS_ERR(connector_state))
+		return connector_state;
+
+	__drm_atomic_helper_connector_hdmi_state_init(connector_state,
 						      connector);
+
+	return connector_state;
 }
 
 static const struct drm_connector_funcs dummy_connector_funcs = {
+	.atomic_create_state	= dummy_hdmi_connector_create_state,
 	.atomic_destroy_state	= drm_atomic_helper_connector_destroy_state,
 	.atomic_duplicate_state	= drm_atomic_helper_connector_duplicate_state,
 	.fill_modes		= drm_helper_probe_single_connector_modes,
-	.reset			= dummy_hdmi_connector_reset,
 };
 
Signature · 1 line
2.55.0
#32 lore raw

Re: [PATCH v3 30/37] drm/tests: hdmi: Convert to atomic_create_state

Hi

Am 30.10.26 um 16:14 schrieb Maxime Ripard:
[...]

drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c static const struct drm_connector_helper_funcs dummy_connector_helper_funcs = { · line 209

Quoted 3 lines
drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c +3 -0
+	connector_state = drm_atomic_helper_connector_create_state(connector);
+	if (IS_ERR(connector_state))
+		return connector_state;

Somewhat unrelated to this series, this return statement made me think that we should consider requiring an ERR_CAST() in such situations. It documents what is happening and we're also not really returning a connector state.

Best regards
Thomas

Quoted 16 lines
drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c +5 -1
+
+	__drm_atomic_helper_connector_hdmi_state_init(connector_state,
  						      connector);
+
+	return connector_state;
  }
 
  static const struct drm_connector_funcs dummy_connector_funcs = {
+	.atomic_create_state	= dummy_hdmi_connector_create_state,
  	.atomic_destroy_state	= drm_atomic_helper_connector_destroy_state,
  	.atomic_duplicate_state	= drm_atomic_helper_connector_duplicate_state,
  	.fill_modes		= drm_helper_probe_single_connector_modes,
-	.reset			= dummy_hdmi_connector_reset,
  };
Signature · 6 lines
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Stefan Gaiser, Jochen Jaser, Abhinav Puri, (HRB 36809, AG Nürnberg)
author maintainer
#33 lore raw

PATCH v3 31/37 drm/connector: Remove drm_atomic_helper_connector_reset()

In reply to Maxime Ripard

All drivers implementing the connector reset hook with drm_atomic_helper_connector_reset() have been converted to atomic_create_state.

Remove drm_atomic_helper_connector_reset().

---
 drivers/gpu/drm/display/drm_hdmi_state_helper.c |  3 +--
 drivers/gpu/drm/drm_atomic_state_helper.c       | 20 --------------------
 include/drm/drm_atomic_state_helper.h           |  1 -
 include/drm/drm_connector.h                     |  2 +-
 4 files changed, 2 insertions(+), 24 deletions(-)
drivers/gpu/drm/display/drm_hdmi_state_helper.c +1 -2
index c63d439382bb..66ae678fc078 100644
@@ -315,6 +315,5 @@
  * Initializes all HDMI resources from a @drm_connector_state without
  * actually allocating it. This is useful for HDMI drivers, in
- * combination with __drm_atomic_helper_connector_state_init(),
- * drm_atomic_helper_connector_reset(), or
+ * combination with __drm_atomic_helper_connector_state_init(), or
  * drm_atomic_helper_connector_create_state().
  */
drivers/gpu/drm/drm_atomic_state_helper.c +0 -20
index 3534925636d5..5efda28bb2b0 100644
@@ -436,24 +436,4 @@ __drm_atomic_helper_connector_reset(struct drm_connector *connector,
 EXPORT_SYMBOL(__drm_atomic_helper_connector_reset);
 
-/**
- * drm_atomic_helper_connector_reset - default &drm_connector_funcs.reset hook for connectors
- * @connector: drm connector
- *
- * Resets the atomic state for @connector by freeing the state pointer (which
- * might be NULL, e.g. at driver load time) and allocating a new empty state
- * object.
- */
-void drm_atomic_helper_connector_reset(struct drm_connector *connector)
-{
-	struct drm_connector_state *conn_state = kzalloc_obj(*conn_state);
-
-	if (connector->state)
-		__drm_atomic_helper_connector_destroy_state(connector->state);
-
-	kfree(connector->state);
-	__drm_atomic_helper_connector_reset(connector, conn_state);
-}
-EXPORT_SYMBOL(drm_atomic_helper_connector_reset);
-
 /**
  * drm_atomic_helper_connector_create_state - default &drm_connector_funcs.atomic_create_state hook for connectors
include/drm/drm_atomic_state_helper.h +0 -1
index 5e8619aeef21..7bced7e9d860 100644
@@ -69,5 +69,4 @@ void __drm_atomic_helper_connector_state_init(struct drm_connector_state *conn_s
 void __drm_atomic_helper_connector_reset(struct drm_connector *connector,
 					 struct drm_connector_state *conn_state);
-void drm_atomic_helper_connector_reset(struct drm_connector *connector);
 struct drm_connector_state *
 drm_atomic_helper_connector_create_state(struct drm_connector *connector);
include/drm/drm_connector.h +1 -1
index 2ee7c59329aa..8b52360339e0 100644
@@ -1666,5 +1666,5 @@ struct drm_connector_funcs {
 	 * It's not a helper hook only for historical reasons.
 	 *
-	 * Atomic drivers can use drm_atomic_helper_connector_reset() to reset
+	 * Atomic drivers can use __drm_atomic_helper_connector_reset() to reset
 	 * atomic state using this hook.
 	 */
Signature · 1 line
2.55.0
author maintainer
#34 lore raw

PATCH v3 32/37 drm/amdgpu: dm: Convert to atomic_create_state

In reply to Maxime Ripard

The amdgpu_dm connector reset implementation creates a custom state subclass, but only initializes a pristine state without resetting any hardware. This is equivalent to what atomic_create_state expects. Convert to it.

---
Cc: "Christian König" <[email protected]>
Cc: Alex Deucher <[email protected]>
Cc: Harry Wentland <[email protected]>
Cc: Leo Li <[email protected]>
Cc: Rodrigo Siqueira <[email protected]>
Cc: [email protected]

---
 .../amd/display/amdgpu_dm/amdgpu_dm_connector.c    |  32 ++++---
 .../amd/display/amdgpu_dm/amdgpu_dm_connector.h    |   3 +-
 .../amd/display/amdgpu_dm/amdgpu_dm_mst_types.c    |  11 ++-
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_wb.c   |  17 +++-
 .../amdgpu_dm/tests/amdgpu_dm_connector_test.c     | 102 ++++++++++++++-------
 5 files changed, 113 insertions(+), 52 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c +18 -14
index 3a4e98b08ac1..e59595b5e39b 100644
@@ -1942,20 +1942,14 @@ STATIC_IFN_KUNIT void amdgpu_dm_connector_destroy(struct drm_connector *connecto
 EXPORT_IF_KUNIT(amdgpu_dm_connector_destroy);
 
-void amdgpu_dm_connector_funcs_reset(struct drm_connector *connector)
+struct drm_connector_state *
+amdgpu_dm_connector_atomic_create_state(struct drm_connector *connector)
 {
-	struct dm_connector_state *old_state =
-		to_dm_connector_state(connector->state);
 	struct dm_connector_state *state;
 
 	state = kzalloc_obj(*state);
 	if (!state)
-		return;
+		return ERR_PTR(-ENOMEM);
 
-	if (connector->state)
-		__drm_atomic_helper_connector_destroy_state(connector->state);
-
-	kfree(old_state);
-
-	__drm_atomic_helper_connector_reset(connector, &state->base);
+	__drm_atomic_helper_connector_state_init(&state->base, connector);
 
 	state->scaling = RMX_OFF;
@@ -1973,6 +1967,8 @@ void amdgpu_dm_connector_funcs_reset(struct drm_connector *connector)
 			state->abm_level = amdgpu_dm_abm_level;
 	}
+
+	return &state->base;
 }
-EXPORT_IF_KUNIT(amdgpu_dm_connector_funcs_reset);
+EXPORT_IF_KUNIT(amdgpu_dm_connector_atomic_create_state);
 
 struct drm_connector_state *
@@ -2073,8 +2069,8 @@ EXPORT_IF_KUNIT(amdgpu_dm_connector_funcs_force);
 
 static const struct drm_connector_funcs amdgpu_dm_connector_funcs = {
-	.reset = amdgpu_dm_connector_funcs_reset,
 	.detect = amdgpu_dm_connector_detect,
 	.fill_modes = drm_helper_probe_single_connector_modes,
 	.destroy = amdgpu_dm_connector_destroy,
+	.atomic_create_state = amdgpu_dm_connector_atomic_create_state,
 	.atomic_duplicate_state = amdgpu_dm_connector_atomic_duplicate_state,
 	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
@@ -3200,6 +3196,14 @@ void amdgpu_dm_connector_init_helper(struct amdgpu_display_manager *dm,
 	 * Allocate some default initial connector state with our reset helper.
 	 */
-	if (aconnector->base.funcs->reset)
-		aconnector->base.funcs->reset(&aconnector->base);
+	if (!aconnector->base.state &&
+	    aconnector->base.funcs->atomic_create_state) {
+		struct drm_connector_state *conn_state;
+
+		conn_state = aconnector->base.funcs->atomic_create_state(&aconnector->base);
+		if (IS_ERR(conn_state))
+			return;
+
+		aconnector->base.state = conn_state;
+	}
 
 	aconnector->connector_id = link_index;
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.h +2 -1
index 79698deacf61..4a73fc607f38 100644
@@ -51,5 +51,6 @@ struct drm_edid;
 struct drm_property;
 
-void amdgpu_dm_connector_funcs_reset(struct drm_connector *connector);
+struct drm_connector_state *
+amdgpu_dm_connector_atomic_create_state(struct drm_connector *connector);
 
 struct drm_connector_state *
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +9 -2
index a5b15bef8aa0..e28fbd1b6790 100644
@@ -259,5 +259,5 @@ static const struct drm_connector_funcs dm_dp_mst_connector_funcs = {
 	.fill_modes = drm_helper_probe_single_connector_modes,
 	.destroy = dm_dp_mst_connector_destroy,
-	.reset = amdgpu_dm_connector_funcs_reset,
+	.atomic_create_state = amdgpu_dm_connector_atomic_create_state,
 	.atomic_duplicate_state = amdgpu_dm_connector_atomic_duplicate_state,
 	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
@@ -672,4 +672,5 @@ dm_dp_add_mst_connector(struct drm_dp_mst_topology_mgr *mgr,
 	struct amdgpu_device *adev = drm_to_adev(dev);
 	struct amdgpu_dm_connector *aconnector;
+	struct drm_connector_state *conn_state;
 	struct drm_connector *connector;
 	int i;
@@ -739,5 +740,11 @@ dm_dp_add_mst_connector(struct drm_dp_mst_topology_mgr *mgr,
 	 * framebuffer lists
 	 */
-	amdgpu_dm_connector_funcs_reset(connector);
+	conn_state = amdgpu_dm_connector_atomic_create_state(connector);
+	if (!IS_ERR(conn_state)) {
+		if (connector->state)
+			connector->funcs->atomic_destroy_state(connector, connector->state);
+
+		connector->state = conn_state;
+	}
 
 	drm_dp_mst_get_port_malloc(port);
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_wb.c +14 -3
index 6f91a992d43f..39b7b3e49f6b 100644
@@ -226,5 +226,5 @@ static const struct drm_connector_funcs amdgpu_dm_wb_connector_funcs = {
 	.fill_modes = drm_helper_probe_single_connector_modes,
 	.destroy = drm_connector_cleanup,
-	.reset = amdgpu_dm_connector_funcs_reset,
+	.atomic_create_state = amdgpu_dm_connector_atomic_create_state,
 	.atomic_duplicate_state = amdgpu_dm_connector_atomic_duplicate_state,
 	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
@@ -241,4 +241,5 @@ int amdgpu_dm_wb_connector_init(struct amdgpu_display_manager *dm,
 				uint32_t link_index)
 {
+	struct drm_connector *connector;
 	struct dc *dc = dm->dc;
 	struct dc_link *link = dc_get_link_at_index(dc, link_index);
@@ -262,6 +263,16 @@ int amdgpu_dm_wb_connector_init(struct amdgpu_display_manager *dm,
 	 * Allocate some default initial connector state with our reset helper.
 	 */
-	if (wbcon->base.base.funcs->reset)
-		wbcon->base.base.funcs->reset(&wbcon->base.base);
+	connector = &wbcon->base.base;
+	if (connector->funcs->atomic_create_state) {
+		struct drm_connector_state *conn_state;
+
+		conn_state = amdgpu_dm_connector_atomic_create_state(connector);
+		if (!IS_ERR(conn_state)) {
+			if (connector->state)
+				connector->funcs->atomic_destroy_state(connector, connector->state);
+
+			connector->state = conn_state;
+		}
+	}
 
 	return 0;
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_connector_test.c +70 -32

222 lines not on this page · raw message

Signature · 1 line
2.55.0
author maintainer
#35 lore raw

PATCH v3 33/37 drm/i915: Convert to atomic_create_state

In reply to Maxime Ripard

The i915 connector initialization uses __drm_atomic_helper_connector_reset() to set up the initial state during connector allocation. However, it only needs to initialize the state, not reset it.

Switch to __drm_atomic_helper_connector_state_init() and assign connector->state explicitly, matching what atomic_create_state expects.

---
Cc: Jani Nikula <[email protected]>
Cc: Joonas Lahtinen <[email protected]>
Cc: Rodrigo Vivi <[email protected]>
Cc: Tvrtko Ursulin <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
 drivers/gpu/drm/i915/display/intel_connector.c | 6 ++++--
 drivers/gpu/drm/i915/display/intel_sdvo.c      | 6 ++++--
 2 files changed, 8 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/display/intel_connector.c +4 -2
index 7ef9338d67ab..ed38959b466d 100644
@@ -91,6 +91,8 @@ static int intel_connector_init(struct intel_connector *connector)
 		return -ENOMEM;
 
-	__drm_atomic_helper_connector_reset(&connector->base,
-					    &conn_state->base);
+	__drm_atomic_helper_connector_state_init(&conn_state->base,
+						 &connector->base);
+
+	connector->base.state = &conn_state->base;
 
 	intel_panel_init_alloc(connector);
drivers/gpu/drm/i915/display/intel_sdvo.c +4 -2
index 3075ef04df56..7b97f531acbf 100644
@@ -2791,6 +2791,8 @@ static struct intel_sdvo_connector *intel_sdvo_connector_alloc(void)
 	}
 
-	__drm_atomic_helper_connector_reset(&sdvo_connector->base.base,
-					    &conn_state->base.base);
+	__drm_atomic_helper_connector_state_init(&conn_state->base.base,
+						 &sdvo_connector->base.base);
+
+	sdvo_connector->base.base.state = &conn_state->base.base;
 
 	intel_panel_init_alloc(&sdvo_connector->base);
Signature · 1 line
2.55.0
author maintainer
#36 lore raw

PATCH v3 34/37 drm/nouveau: Convert to atomic_create_state

In reply to Maxime Ripard

The nouveau connector reset implementation creates a custom state subclass, but only initializes a pristine state and sets driver-specific defaults without resetting any hardware. This is equivalent to what atomic_create_state expects. Convert to it.

This is significantly harder than the other drivers though, since pre-nv50 display doesn't support atomic modesetting. Instead, its connectors keep their property state embedded in struct nouveau_connector, and drm_connector.state is left NULL.

Thus, only the atomic path needs to be converted, with the embedded state initialized at connector creation time for pre-nv50. Those connectors are also given connector funcs without atomic_create_state:
the DRM core would otherwise install the embedded state into drm_connector.state and eventually pass it to atomic_destroy_state, which frees it.

---
Cc: Danilo Krummrich <[email protected]>
Cc: Lyude Paul <[email protected]>
Cc: [email protected]

---
 drivers/gpu/drm/nouveau/dispnv50/disp.c     |  25 ++++--
 drivers/gpu/drm/nouveau/nouveau_connector.c | 129 +++++++++++++++++++++-------
 drivers/gpu/drm/nouveau/nouveau_connector.h |   3 +-
 3 files changed, 119 insertions(+), 38 deletions(-)
drivers/gpu/drm/nouveau/dispnv50/disp.c +18 -7
index e91130f93db6..98a5188f6523 100644
@@ -1249,7 +1249,7 @@ nv50_mstc_destroy(struct drm_connector *connector)
 static const struct drm_connector_funcs
 nv50_mstc = {
-	.reset = nouveau_conn_reset,
 	.fill_modes = drm_helper_probe_single_connector_modes,
 	.destroy = nv50_mstc_destroy,
+	.atomic_create_state = nouveau_conn_atomic_create_state,
 	.atomic_duplicate_state = nouveau_conn_atomic_duplicate_state,
 	.atomic_destroy_state = nouveau_conn_atomic_destroy_state,
@@ -1263,4 +1263,5 @@ nv50_mstc_new(struct nv50_mstm *mstm, struct drm_dp_mst_port *port,
 {
 	struct drm_device *dev = mstm->outp->base.base.dev;
+	struct drm_connector_state *conn_state;
 	struct drm_crtc *crtc;
 	struct nv50_mstc *mstc;
@@ -1274,13 +1275,16 @@ nv50_mstc_new(struct nv50_mstm *mstm, struct drm_dp_mst_port *port,
 	ret = drm_connector_dynamic_init(dev, &mstc->connector, &nv50_mstc,
 					 DRM_MODE_CONNECTOR_DisplayPort, NULL);
-	if (ret) {
-		kfree(*pmstc);
-		*pmstc = NULL;
-		return ret;
-	}
+	if (ret)
+		goto err_free;
 
 	drm_connector_helper_add(&mstc->connector, &nv50_mstc_help);
 
-	mstc->connector.funcs->reset(&mstc->connector);
+	conn_state = mstc->connector.funcs->atomic_create_state(&mstc->connector);
+	if (IS_ERR(conn_state)) {
+		ret = PTR_ERR(conn_state);
+		goto err_cleanup;
+	}
+	mstc->connector.state = conn_state;
+
 	nouveau_conn_attach_properties(&mstc->connector);
 
@@ -1298,4 +1302,11 @@ nv50_mstc_new(struct nv50_mstm *mstm, struct drm_dp_mst_port *port,
 	drm_dp_mst_get_port_malloc(port);
 	return 0;
+
+err_cleanup:
+	drm_connector_cleanup(&mstc->connector);
+err_free:
+	kfree(*pmstc);
+	*pmstc = NULL;
+	return ret;
 }
 
drivers/gpu/drm/nouveau/nouveau_connector.c +99 -30

168 lines not on this page · raw message

drivers/gpu/drm/nouveau/nouveau_connector.h +2 -1
index eb292d2ba4bc..02f843648eb8 100644
@@ -217,5 +217,6 @@ extern int nouveau_hdmimhz;
 
 void nouveau_conn_attach_properties(struct drm_connector *);
-void nouveau_conn_reset(struct drm_connector *);
+struct drm_connector_state *
+nouveau_conn_atomic_create_state(struct drm_connector *);
 struct drm_connector_state *
 nouveau_conn_atomic_duplicate_state(struct drm_connector *);
Signature · 1 line
2.55.0
#37 lore raw

Re: [PATCH v3 34/37] drm/nouveau: Convert to atomic_create_state

Hi

Am 30.10.26 um 16:14 schrieb Maxime Ripard:
[...]

drivers/gpu/drm/nouveau/nouveau_connector.c nouveau_conn_reset(struct drm_connector *connector) · line 274

Quoted 7 lines
drivers/gpu/drm/nouveau/nouveau_connector.c +7 -0
+struct drm_connector_state *
+nouveau_conn_atomic_create_state(struct drm_connector *connector)
+{
+	struct nouveau_conn_atom *asyc;
+
+	asyc = kzalloc_obj(*asyc);
+	if (WARN_ON(!asyc))

Since you're here anyway, please use drm_WARN_ON_ONCE(). Plain WARN_ON() doesn't seem a good fir here.

Best regards
Thomas

Quoted 152 lines
drivers/gpu/drm/nouveau/nouveau_connector.c +89 -12
+		return ERR_PTR(-ENOMEM);
+
+	__drm_atomic_helper_connector_state_init(&asyc->state, connector);
+	nouveau_conn_atom_init(connector, asyc);
+
+	return &asyc->state;
+}
+
  void
  nouveau_conn_attach_properties(struct drm_connector *connector)
@@ -1231,5 +1231,47 @@ static const struct drm_connector_funcs
  nouveau_connector_funcs = {
  	.dpms = drm_helper_connector_dpms,
-	.reset = nouveau_conn_reset,
+	.detect = nouveau_connector_detect,
+	.force = nouveau_connector_force,
+	.fill_modes = drm_helper_probe_single_connector_modes,
+	.set_property = nouveau_connector_set_property,
+	.destroy = nouveau_connector_destroy,
+	.atomic_create_state = nouveau_conn_atomic_create_state,
+	.atomic_duplicate_state = nouveau_conn_atomic_duplicate_state,
+	.atomic_destroy_state = nouveau_conn_atomic_destroy_state,
+	.atomic_set_property = nouveau_conn_atomic_set_property,
+	.atomic_get_property = nouveau_conn_atomic_get_property,
+	.late_register = nouveau_connector_late_register,
+	.early_unregister = nouveau_connector_early_unregister,
+};
+
+static const struct drm_connector_funcs
+nouveau_connector_funcs_lvds = {
+	.dpms = drm_helper_connector_dpms,
+	.detect = nouveau_connector_detect_lvds,
+	.force = nouveau_connector_force,
+	.fill_modes = drm_helper_probe_single_connector_modes,
+	.set_property = nouveau_connector_set_property,
+	.destroy = nouveau_connector_destroy,
+	.atomic_create_state = nouveau_conn_atomic_create_state,
+	.atomic_duplicate_state = nouveau_conn_atomic_duplicate_state,
+	.atomic_destroy_state = nouveau_conn_atomic_destroy_state,
+	.atomic_set_property = nouveau_conn_atomic_set_property,
+	.atomic_get_property = nouveau_conn_atomic_get_property,
+	.late_register = nouveau_connector_late_register,
+	.early_unregister = nouveau_connector_early_unregister,
+};
+
+/*
+ * Pre-nv50 doesn't support atomic modesetting: the connector property state
+ * lives in the embedded struct nouveau_connector.properties_state and
+ * drm_connector.state is left alone, as expected from a legacy driver.
+ *
+ * Those connectors must not expose atomic_create_state: the DRM core would
+ * then install the embedded state into drm_connector.state and eventually
+ * pass it to atomic_destroy_state, which frees it.
+ */
+static const struct drm_connector_funcs
+nouveau_connector_funcs_legacy = {
+	.dpms = drm_helper_connector_dpms,
  	.detect = nouveau_connector_detect,
  	.force = nouveau_connector_force,
@@ -1246,7 +1288,6 @@ nouveau_connector_funcs = {
 
  static const struct drm_connector_funcs
-nouveau_connector_funcs_lvds = {
+nouveau_connector_funcs_lvds_legacy = {
  	.dpms = drm_helper_connector_dpms,
-	.reset = nouveau_conn_reset,
  	.detect = nouveau_connector_detect_lvds,
  	.force = nouveau_connector_force,
@@ -1362,5 +1403,7 @@ nouveau_connector_create(struct drm_device *dev, int index)
  	struct nouveau_display *disp = nouveau_display(dev);
  	struct nouveau_connector *nv_connector = NULL;
+	struct drm_connector_state *conn_state;
  	struct drm_connector *connector;
+	const struct drm_connector_funcs *funcs;
  	struct drm_connector_list_iter conn_iter;
  	int type, ret = 0;
@@ -1459,8 +1502,17 @@ nouveau_connector_create(struct drm_device *dev, int index)
 
  	type = drm_conntype_from_dcb(nv_connector->type);
-	if (type == DRM_MODE_CONNECTOR_LVDS)
-		drm_connector_init(dev, connector, &nouveau_connector_funcs_lvds, type);
-	else
-		drm_connector_init(dev, connector, &nouveau_connector_funcs, type);
+	if (type == DRM_MODE_CONNECTOR_LVDS) {
+		if (drm_drv_uses_atomic_modeset(dev))
+			funcs = &nouveau_connector_funcs_lvds;
+		else
+			funcs = &nouveau_connector_funcs_lvds_legacy;
+	} else {
+		if (drm_drv_uses_atomic_modeset(dev))
+			funcs = &nouveau_connector_funcs;
+		else
+			funcs = &nouveau_connector_funcs_legacy;
+	}
+
+	drm_connector_init(dev, connector, funcs, type);
 
  	switch (type) {
@@ -1514,13 +1566,26 @@ nouveau_connector_create(struct drm_device *dev, int index)
  						   nouveau_connector_irq, NVIF_CONN_EVENT_V0_IRQ,
  						   &nv_connector->irq);
-			if (ret) {
-				nvif_event_dtor(&nv_connector->hpd);
-				nvif_conn_dtor(&nv_connector->conn);
+			if (ret)
  				goto drm_conn_err;
-			}
  		}
  	}
 
-	connector->funcs->reset(connector);
+	if (drm_drv_uses_atomic_modeset(dev)) {
+		conn_state = connector->funcs->atomic_create_state(connector);
+		if (IS_ERR(conn_state)) {
+			ret = PTR_ERR(conn_state);
+			goto drm_conn_err;
+		}
+		connector->state = conn_state;
+	} else {
+		/* Pre-nv50 keeps its property state embedded in struct
+		 * nouveau_connector: drm_connector.state must remain NULL,
+		 * the DRM core expects legacy drivers to use
+		 * drm_connector.encoder.
+		 */
+		nouveau_conn_atom_init(connector,
+				       &nv_connector->properties_state);
+	}
+
  	nouveau_conn_attach_properties(connector);
 
@@ -1567,4 +1632,8 @@ nouveau_connector_create(struct drm_device *dev, int index)
 
  drm_conn_err:
+	nvif_event_dtor(&nv_connector->irq);
+	nvif_event_dtor(&nv_connector->hpd);
+	cancel_work_sync(&nv_connector->irq_work);
+	nvif_conn_dtor(&nv_connector->conn);
  	drm_connector_cleanup(connector);
  	kfree(nv_connector);
drivers/gpu/drm/nouveau/nouveau_connector.h +2 -1
index eb292d2ba4bc..02f843648eb8 100644
@@ -217,5 +217,6 @@ extern int nouveau_hdmimhz;
 
  void nouveau_conn_attach_properties(struct drm_connector *);
-void nouveau_conn_reset(struct drm_connector *);
+struct drm_connector_state *
+nouveau_conn_atomic_create_state(struct drm_connector *);
  struct drm_connector_state *
  nouveau_conn_atomic_duplicate_state(struct drm_connector *);
Signature · 6 lines
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Stefan Gaiser, Jochen Jaser, Abhinav Puri, (HRB 36809, AG Nürnberg)
#38 lore raw

Re: [PATCH v3 34/37] drm/nouveau: Convert to atomic_create_state

In reply to Maxime Ripard

Hi

Am 30.10.26 um 16:14 schrieb Maxime Ripard:
[...]

drivers/gpu/drm/nouveau/nouveau_connector.c nouveau_conn_reset(struct drm_connector *connector) · line 274

Quoted 7 lines
drivers/gpu/drm/nouveau/nouveau_connector.c +7 -0
+struct drm_connector_state *
+nouveau_conn_atomic_create_state(struct drm_connector *connector)
+{
+	struct nouveau_conn_atom *asyc;
+
+	asyc = kzalloc_obj(*asyc);
+	if (WARN_ON(!asyc))

Since you're here anyway, please use drm_WARN_ON_ONCE(). Plain WARN_ON() doesn't seem a good fit here.

Best regards
Thomas

Quoted 152 lines
drivers/gpu/drm/nouveau/nouveau_connector.c +89 -12
+		return ERR_PTR(-ENOMEM);
+
+	__drm_atomic_helper_connector_state_init(&asyc->state, connector);
+	nouveau_conn_atom_init(connector, asyc);
+
+	return &asyc->state;
+}
+
  void
  nouveau_conn_attach_properties(struct drm_connector *connector)
@@ -1231,5 +1231,47 @@ static const struct drm_connector_funcs
  nouveau_connector_funcs = {
  	.dpms = drm_helper_connector_dpms,
-	.reset = nouveau_conn_reset,
+	.detect = nouveau_connector_detect,
+	.force = nouveau_connector_force,
+	.fill_modes = drm_helper_probe_single_connector_modes,
+	.set_property = nouveau_connector_set_property,
+	.destroy = nouveau_connector_destroy,
+	.atomic_create_state = nouveau_conn_atomic_create_state,
+	.atomic_duplicate_state = nouveau_conn_atomic_duplicate_state,
+	.atomic_destroy_state = nouveau_conn_atomic_destroy_state,
+	.atomic_set_property = nouveau_conn_atomic_set_property,
+	.atomic_get_property = nouveau_conn_atomic_get_property,
+	.late_register = nouveau_connector_late_register,
+	.early_unregister = nouveau_connector_early_unregister,
+};
+
+static const struct drm_connector_funcs
+nouveau_connector_funcs_lvds = {
+	.dpms = drm_helper_connector_dpms,
+	.detect = nouveau_connector_detect_lvds,
+	.force = nouveau_connector_force,
+	.fill_modes = drm_helper_probe_single_connector_modes,
+	.set_property = nouveau_connector_set_property,
+	.destroy = nouveau_connector_destroy,
+	.atomic_create_state = nouveau_conn_atomic_create_state,
+	.atomic_duplicate_state = nouveau_conn_atomic_duplicate_state,
+	.atomic_destroy_state = nouveau_conn_atomic_destroy_state,
+	.atomic_set_property = nouveau_conn_atomic_set_property,
+	.atomic_get_property = nouveau_conn_atomic_get_property,
+	.late_register = nouveau_connector_late_register,
+	.early_unregister = nouveau_connector_early_unregister,
+};
+
+/*
+ * Pre-nv50 doesn't support atomic modesetting: the connector property state
+ * lives in the embedded struct nouveau_connector.properties_state and
+ * drm_connector.state is left alone, as expected from a legacy driver.
+ *
+ * Those connectors must not expose atomic_create_state: the DRM core would
+ * then install the embedded state into drm_connector.state and eventually
+ * pass it to atomic_destroy_state, which frees it.
+ */
+static const struct drm_connector_funcs
+nouveau_connector_funcs_legacy = {
+	.dpms = drm_helper_connector_dpms,
  	.detect = nouveau_connector_detect,
  	.force = nouveau_connector_force,
@@ -1246,7 +1288,6 @@ nouveau_connector_funcs = {
 
  static const struct drm_connector_funcs
-nouveau_connector_funcs_lvds = {
+nouveau_connector_funcs_lvds_legacy = {
  	.dpms = drm_helper_connector_dpms,
-	.reset = nouveau_conn_reset,
  	.detect = nouveau_connector_detect_lvds,
  	.force = nouveau_connector_force,
@@ -1362,5 +1403,7 @@ nouveau_connector_create(struct drm_device *dev, int index)
  	struct nouveau_display *disp = nouveau_display(dev);
  	struct nouveau_connector *nv_connector = NULL;
+	struct drm_connector_state *conn_state;
  	struct drm_connector *connector;
+	const struct drm_connector_funcs *funcs;
  	struct drm_connector_list_iter conn_iter;
  	int type, ret = 0;
@@ -1459,8 +1502,17 @@ nouveau_connector_create(struct drm_device *dev, int index)
 
  	type = drm_conntype_from_dcb(nv_connector->type);
-	if (type == DRM_MODE_CONNECTOR_LVDS)
-		drm_connector_init(dev, connector, &nouveau_connector_funcs_lvds, type);
-	else
-		drm_connector_init(dev, connector, &nouveau_connector_funcs, type);
+	if (type == DRM_MODE_CONNECTOR_LVDS) {
+		if (drm_drv_uses_atomic_modeset(dev))
+			funcs = &nouveau_connector_funcs_lvds;
+		else
+			funcs = &nouveau_connector_funcs_lvds_legacy;
+	} else {
+		if (drm_drv_uses_atomic_modeset(dev))
+			funcs = &nouveau_connector_funcs;
+		else
+			funcs = &nouveau_connector_funcs_legacy;
+	}
+
+	drm_connector_init(dev, connector, funcs, type);
 
  	switch (type) {
@@ -1514,13 +1566,26 @@ nouveau_connector_create(struct drm_device *dev, int index)
  						   nouveau_connector_irq, NVIF_CONN_EVENT_V0_IRQ,
  						   &nv_connector->irq);
-			if (ret) {
-				nvif_event_dtor(&nv_connector->hpd);
-				nvif_conn_dtor(&nv_connector->conn);
+			if (ret)
  				goto drm_conn_err;
-			}
  		}
  	}
 
-	connector->funcs->reset(connector);
+	if (drm_drv_uses_atomic_modeset(dev)) {
+		conn_state = connector->funcs->atomic_create_state(connector);
+		if (IS_ERR(conn_state)) {
+			ret = PTR_ERR(conn_state);
+			goto drm_conn_err;
+		}
+		connector->state = conn_state;
+	} else {
+		/* Pre-nv50 keeps its property state embedded in struct
+		 * nouveau_connector: drm_connector.state must remain NULL,
+		 * the DRM core expects legacy drivers to use
+		 * drm_connector.encoder.
+		 */
+		nouveau_conn_atom_init(connector,
+				       &nv_connector->properties_state);
+	}
+
  	nouveau_conn_attach_properties(connector);
 
@@ -1567,4 +1632,8 @@ nouveau_connector_create(struct drm_device *dev, int index)
 
  drm_conn_err:
+	nvif_event_dtor(&nv_connector->irq);
+	nvif_event_dtor(&nv_connector->hpd);
+	cancel_work_sync(&nv_connector->irq_work);
+	nvif_conn_dtor(&nv_connector->conn);
  	drm_connector_cleanup(connector);
  	kfree(nv_connector);
drivers/gpu/drm/nouveau/nouveau_connector.h +2 -1
index eb292d2ba4bc..02f843648eb8 100644
@@ -217,5 +217,6 @@ extern int nouveau_hdmimhz;
 
  void nouveau_conn_attach_properties(struct drm_connector *);
-void nouveau_conn_reset(struct drm_connector *);
+struct drm_connector_state *
+nouveau_conn_atomic_create_state(struct drm_connector *);
  struct drm_connector_state *
  nouveau_conn_atomic_duplicate_state(struct drm_connector *);
Signature · 6 lines
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Stefan Gaiser, Jochen Jaser, Abhinav Puri, (HRB 36809, AG Nürnberg)
author maintainer
#39 lore raw

PATCH v3 35/37 drm/tegra: Convert to atomic_create_state

In reply to Maxime Ripard

The tegra DSI and SOR connector reset implementations create custom state subclasses, but only initialize a pristine state without resetting any hardware. This is equivalent to what atomic_create_state expects. Convert to it.

---
Cc: Jonathan Hunter <[email protected]>
Cc: Mikko Perttunen <[email protected]>
Cc: Thierry Reding <[email protected]>
Cc: [email protected]

---
 drivers/gpu/drm/tegra/dsi.c | 17 ++++++++---------
 drivers/gpu/drm/tegra/sor.c | 13 +++++--------
 2 files changed, 13 insertions(+), 17 deletions(-)
drivers/gpu/drm/tegra/dsi.c +8 -9
index 7b595310e737..206405770071 100644
@@ -786,17 +786,16 @@ static void tegra_dsi_soft_reset(struct tegra_dsi *dsi)
 }
 
-static void tegra_dsi_connector_reset(struct drm_connector *connector)
+static struct drm_connector_state *
+tegra_dsi_connector_create_state(struct drm_connector *connector)
 {
-	struct tegra_dsi_state *state = kzalloc_obj(*state);
+	struct tegra_dsi_state *state;
 
+	state = kzalloc_obj(*state);
 	if (!state)
-		return;
+		return ERR_PTR(-ENOMEM);
 
-	if (connector->state) {
-		__drm_atomic_helper_connector_destroy_state(connector->state);
-		kfree(connector->state);
-	}
+	__drm_atomic_helper_connector_state_init(&state->base, connector);
 
-	__drm_atomic_helper_connector_reset(connector, &state->base);
+	return &state->base;
 }
 
@@ -818,8 +817,8 @@ tegra_dsi_connector_duplicate_state(struct drm_connector *connector)
 
 static const struct drm_connector_funcs tegra_dsi_connector_funcs = {
-	.reset = tegra_dsi_connector_reset,
 	.detect = tegra_output_connector_detect,
 	.fill_modes = drm_helper_probe_single_connector_modes,
 	.destroy = tegra_output_connector_destroy,
+	.atomic_create_state = tegra_dsi_connector_create_state,
 	.atomic_duplicate_state = tegra_dsi_connector_duplicate_state,
 	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
drivers/gpu/drm/tegra/sor.c +5 -8
index e384cbd0cbf7..16a5ecefbe4f 100644
@@ -1721,5 +1721,5 @@ static void tegra_sor_early_unregister(struct drm_connector *connector)
 }
 
-static void tegra_sor_connector_reset(struct drm_connector *connector)
+static struct drm_connector_state *tegra_sor_connector_create_state(struct drm_connector *connector)
 {
 	struct tegra_sor_state *state;
@@ -1727,12 +1727,9 @@ static void tegra_sor_connector_reset(struct drm_connector *connector)
 	state = kzalloc_obj(*state);
 	if (!state)
-		return;
+		return ERR_PTR(-ENOMEM);
 
-	if (connector->state) {
-		__drm_atomic_helper_connector_destroy_state(connector->state);
-		kfree(connector->state);
-	}
+	__drm_atomic_helper_connector_state_init(&state->base, connector);
 
-	__drm_atomic_helper_connector_reset(connector, &state->base);
+	return &state->base;
 }
 
@@ -1765,8 +1762,8 @@ tegra_sor_connector_duplicate_state(struct drm_connector *connector)
 
 static const struct drm_connector_funcs tegra_sor_connector_funcs = {
-	.reset = tegra_sor_connector_reset,
 	.detect = tegra_sor_connector_detect,
 	.fill_modes = drm_helper_probe_single_connector_modes,
 	.destroy = tegra_output_connector_destroy,
+	.atomic_create_state = tegra_sor_connector_create_state,
 	.atomic_duplicate_state = tegra_sor_connector_duplicate_state,
 	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
Signature · 1 line
2.55.0
author maintainer
#40 lore raw

PATCH v3 36/37 drm/connector: Remove __drm_atomic_helper_connector_reset()

In reply to Maxime Ripard

All drivers implementing the connector reset hook using __drm_atomic_helper_connector_reset() have been converted to atomic_create_state.

Remove __drm_atomic_helper_connector_reset().

---
 drivers/gpu/drm/drm_atomic_state_helper.c | 23 -----------------------
 include/drm/drm_atomic_state_helper.h     |  2 --
 include/drm/drm_connector.h               |  3 ---
 3 files changed, 28 deletions(-)
drivers/gpu/drm/drm_atomic_state_helper.c +0 -23
index 5efda28bb2b0..267f44330629 100644
@@ -413,27 +413,4 @@ __drm_atomic_helper_connector_state_init(struct drm_connector_state *conn_state,
 EXPORT_SYMBOL(__drm_atomic_helper_connector_state_init);
 
-/**
- * __drm_atomic_helper_connector_reset - reset state on connector
- * @connector: drm connector
- * @conn_state: connector state to assign
- *
- * Initializes the newly allocated @conn_state and assigns it to
- * the &drm_connector->state pointer of @connector, usually required when
- * initializing the drivers or when called from the &drm_connector_funcs.reset
- * hook.
- *
- * This is useful for drivers that subclass the connector state.
- */
-void
-__drm_atomic_helper_connector_reset(struct drm_connector *connector,
-				    struct drm_connector_state *conn_state)
-{
-	if (conn_state)
-		__drm_atomic_helper_connector_state_init(conn_state, connector);
-
-	connector->state = conn_state;
-}
-EXPORT_SYMBOL(__drm_atomic_helper_connector_reset);
-
 /**
  * drm_atomic_helper_connector_create_state - default &drm_connector_funcs.atomic_create_state hook for connectors
include/drm/drm_atomic_state_helper.h +0 -2
index 7bced7e9d860..1a822179f2ec 100644
@@ -67,6 +67,4 @@ void drm_atomic_helper_plane_destroy_state(struct drm_plane *plane,
 void __drm_atomic_helper_connector_state_init(struct drm_connector_state *conn_state,
 					       struct drm_connector *connector);
-void __drm_atomic_helper_connector_reset(struct drm_connector *connector,
-					 struct drm_connector_state *conn_state);
 struct drm_connector_state *
 drm_atomic_helper_connector_create_state(struct drm_connector *connector);
include/drm/drm_connector.h +0 -3
index 8b52360339e0..a87cd13d0a45 100644
@@ -1665,7 +1665,4 @@ struct drm_connector_funcs {
 	 * called by the core directly, only through drm_mode_config_reset().
 	 * It's not a helper hook only for historical reasons.
-	 *
-	 * Atomic drivers can use __drm_atomic_helper_connector_reset() to reset
-	 * atomic state using this hook.
 	 */
 	void (*reset)(struct drm_connector *connector);
Signature · 1 line
2.55.0
author maintainer
#41 lore raw

PATCH v3 37/37 drm/connector: Remove reset

In reply to Maxime Ripard

All the drivers that used to implement the reset hook have been converted to use atomic_create_state instead.

Remove the reset hook from drm_connector_funcs, and the code calling it in drm_mode_config_reset(), drmm_connector_hdmi_init() and panel_bridge_attach().

---
 drivers/gpu/drm/drm_connector.c   | 8 --------
 drivers/gpu/drm/drm_mode_config.c | 4 +---
 drivers/gpu/drm/drm_panel.c       | 2 --
 include/drm/drm_connector.h       | 9 ---------
 4 files changed, 1 insertion(+), 22 deletions(-)
drivers/gpu/drm/drm_connector.c +0 -8
index 893716a9e489..d66188521881 100644
@@ -663,8 +663,4 @@ int drmm_connector_hdmi_init(struct drm_device *dev,
 
 		connector->state = state;
-	} else if (connector->funcs->reset) {
-		connector->funcs->reset(connector);
-		if (!connector->state)
-			return -ENOMEM;
 	}
 
@@ -771,8 +767,4 @@ int drmm_connector_hdmi_ini2(struct drm_device *dev,
 
 		connector->state = state;
-	} else if (connector->funcs->reset) {
-		connector->funcs->reset(connector);
-		if (!connector->state)
-			return -ENOMEM;
 	}
 
drivers/gpu/drm/drm_mode_config.c +1 -3
index 48a56f23dadb..c1e993a78702 100644
@@ -316,7 +316,5 @@ void drm_mode_config_reset(struct drm_device *dev)
 	drm_connector_list_iter_begin(dev, &conn_iter);
 	drm_for_each_connector_iter(connector, &conn_iter) {
-		if (connector->funcs->reset)
-			connector->funcs->reset(connector);
-		else if (connector->funcs->atomic_create_state)
+		if (connector->funcs->atomic_create_state)
 			drm_mode_config_connector_reset_with_create_state(connector);
 	}
drivers/gpu/drm/drm_panel.c +0 -2
index 760f074f947e..c70f09a7e3e1 100644
@@ -115,6 +115,4 @@ static int panel_bridge_attach(struct drm_bridge *bridge,
 
 			connector->state = conn_state;
-		} else if (connector->funcs->reset) {
-			connector->funcs->reset(connector);
 		}
 
include/drm/drm_connector.h +0 -9
index a87cd13d0a45..f656ed8324d3 100644
@@ -1659,13 +1659,4 @@ struct drm_connector_funcs {
 	int (*dpms)(struct drm_connector *connector, int mode);
 
-	/**
-	 * @reset:
-	 *
-	 * Reset connector hardware and software state to off. This function isn't
-	 * called by the core directly, only through drm_mode_config_reset().
-	 * It's not a helper hook only for historical reasons.
-	 */
-	void (*reset)(struct drm_connector *connector);
-
 	/**
 	 * @detect:
Signature · 1 line
2.55.0
maintainer Reviewed-by on the v3 series
#42 lore raw
In reply to Maxime Ripard

Hi Maxime

Am 30.10.26 um 16:13 schrieb Maxime Ripard:

Quoted 17 lines

This is a follow-up to the plane and CRTC reset removal series, and part of a larger effort to remove the reset hook from all KMS objects.

The connector reset hook is overloaded: it is called both at probe time to create the initial software state and during suspend/resume to reset hardware and software state. These two roles have different requirements, and the reset hook is not fallible, making error handling difficult for the initial state allocation path.

While reset has the semantics to reset both the software and hardware state, the vast majority of implementations and all the helpers only reset the software state, making them equivalent to atomic_create_state in practice. The atomic_create_state hook makes this explicit: it only allocates and initializes a pristine state without any side effect, and returns the state pointer or an ERR_PTR on failure.

Quoted 7 lines

This series converts all connector drivers tree-wide from the reset hook to atomic_create_state, then removes the reset hook from struct drm_connector_funcs entirely. The conversions were done using a combination of Coccinelle semantic patches, mechanical one-line replacements and manual adjustments.

for the entire series.

Best regards
Thomas

Quoted 120 lines

---
Changes in v3:
- Fix error path in dw-hdmi
- Fix test error path for amdgpu kunit tests
- Fix nouveau legacy path
- Link to v2: https://lore.kernel.org/r/20261022-drm-no-more-connector-reset-v2-0-0b7e4e85b1e8@kernel.org

Changes in v2:
- Change the parameter order of __drm_atomic_helper_connector_hdmi_state_init
- Fixed state argument casing for drm_atomic_helper_connector_tv_margins_state_init and drm_atomic_helper_connector_tv_state_init
- Put atomic_create_state before atomic_duplicate_state
- Fix state allocation for MST and WB connectors
- Link to v1:

   https://lore.kernel.org/r/20261014-drm-no-more-connector-reset-v1-0-586c9c026823@kernel.org

---
Maxime Ripard (37):
drm/amdgpu: vkms: Switch to drm_atomic_helper_connector_create_state drm/bridge: analogix-anx6345: Switch to drm_atomic_helper_connector_create_state drm/bridge: analogix-anx78xx: Switch to drm_atomic_helper_connector_create_state drm/bridge: chrontel-ch7033: Switch to drm_atomic_helper_connector_create_state drm/bridge: nxp-ptn3460: Switch to drm_atomic_helper_connector_create_state drm/panel: Switch to drm_atomic_helper_connector_create_state drm/bridge: synopsys: dw-hdmi: Switch to drm_atomic_helper_connector_create_state drm/bridge: tc358767: Switch to drm_atomic_helper_connector_create_state drm/bridge: tda998x: Switch to drm_atomic_helper_connector_create_state drm/bridge: ti-tfp410: Switch to drm_atomic_helper_connector_create_state drm/exynos: Switch to drm_atomic_helper_connector_create_state drm/fsl-dcu: Switch to drm_atomic_helper_connector_create_state drm/loongson: Switch to drm_atomic_helper_connector_create_state drm/mipi-dbi: Switch to drm_atomic_helper_connector_create_state drm/renesas: shmobile: Switch to drm_atomic_helper_connector_create_state drm/sitronix: st7571: Switch to drm_atomic_helper_connector_create_state drm/sti: Switch to drm_atomic_helper_connector_create_state drm/sun4i: Switch to drm_atomic_helper_connector_create_state drm/tegra: Switch to drm_atomic_helper_connector_create_state drm/tests: Switch to drm_atomic_helper_connector_create_state drm/tiny: arcpgu: Switch to drm_atomic_helper_connector_create_state drm/tiny: sharp: Switch to drm_atomic_helper_connector_create_state drm/virtio: Switch to drm_atomic_helper_connector_create_state drm/vkms: Switch to drm_atomic_helper_connector_create_state drm/xen: Switch to drm_atomic_helper_connector_create_state drm/bridge: synopsys: dw-hdmi: Convert to atomic_create_state drm/meson: Convert to atomic_create_state
drm/sun4i: hdmi: Convert to atomic_create_state
drm/sun4i: tv: Convert to atomic_create_state
drm/tests: hdmi: Convert to atomic_create_state
drm/connector: Remove drm_atomic_helper_connector_reset() drm/amdgpu: dm: Convert to atomic_create_state
drm/i915: Convert to atomic_create_state
drm/nouveau: Convert to atomic_create_state
drm/tegra: Convert to atomic_create_state
drm/connector: Remove __drm_atomic_helper_connector_reset() drm/connector: Remove reset

  drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c           |   2 +-
  .../amd/display/amdgpu_dm/amdgpu_dm_connector.c    |  32 ++---
  .../amd/display/amdgpu_dm/amdgpu_dm_connector.h    |   3 +-
  .../amd/display/amdgpu_dm/amdgpu_dm_mst_types.c    |  11 +-
  .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_wb.c   |  17 ++-
  .../amdgpu_dm/tests/amdgpu_dm_connector_test.c     | 102 +++++++++++-----
  drivers/gpu/drm/bridge/analogix/analogix-anx6345.c |   2 +-
  drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c |   2 +-
  drivers/gpu/drm/bridge/chrontel-ch7033.c           |   2 +-
  drivers/gpu/drm/bridge/nxp-ptn3460.c               |   2 +-
  drivers/gpu/drm/bridge/synopsys/dw-hdmi.c          |  14 ++-
  drivers/gpu/drm/bridge/tc358767.c                  |   2 +-
  drivers/gpu/drm/bridge/tda998x_drv.c               |   2 +-
  drivers/gpu/drm/bridge/ti-tfp410.c                 |   2 +-
  drivers/gpu/drm/display/drm_hdmi_state_helper.c    |   3 +-
  drivers/gpu/drm/drm_atomic_state_helper.c          |  43 -------
  drivers/gpu/drm/drm_connector.c                    |   8 --
  drivers/gpu/drm/drm_mode_config.c                  |   4 +-
  drivers/gpu/drm/drm_panel.c                        |   4 +-
  drivers/gpu/drm/exynos/exynos_drm_dpi.c            |   2 +-
  drivers/gpu/drm/exynos/exynos_drm_vidi.c           |   2 +-
  drivers/gpu/drm/exynos/exynos_hdmi.c               |   2 +-
  drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c          |   2 +-
  drivers/gpu/drm/i915/display/intel_connector.c     |   6 +-
  drivers/gpu/drm/i915/display/intel_sdvo.c          |   6 +-
  drivers/gpu/drm/loongson/lsdc_output_7a1000.c      |   2 +-
  drivers/gpu/drm/loongson/lsdc_output_7a2000.c      |   4 +-
  drivers/gpu/drm/meson/meson_encoder_hdmi.c         |  12 +-
  drivers/gpu/drm/nouveau/dispnv50/disp.c            |  25 ++--
  drivers/gpu/drm/nouveau/nouveau_connector.c        | 129 ++++++++++++++++-----
  drivers/gpu/drm/nouveau/nouveau_connector.h        |   3 +-
  drivers/gpu/drm/renesas/shmobile/shmob_drm_crtc.c  |   2 +-
  drivers/gpu/drm/sitronix/st7571.c                  |   2 +-
  drivers/gpu/drm/sti/sti_dvo.c                      |   2 +-
  drivers/gpu/drm/sti/sti_hda.c                      |   2 +-
  drivers/gpu/drm/sti/sti_hdmi.c                     |   2 +-
  drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c             |  16 ++-
  drivers/gpu/drm/sun4i/sun4i_lvds.c                 |   2 +-
  drivers/gpu/drm/sun4i/sun4i_rgb.c                  |   2 +-
  drivers/gpu/drm/sun4i/sun4i_tv.c                   |  16 ++-
  drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c             |   2 +-
  drivers/gpu/drm/tegra/dsi.c                        |  17 ++-
  drivers/gpu/drm/tegra/hdmi.c                       |   2 +-
  drivers/gpu/drm/tegra/sor.c                        |  13 +--
  drivers/gpu/drm/tests/drm_atomic_commit_test.c     |   2 +-
  drivers/gpu/drm/tests/drm_atomic_test.c            |   2 +-
  drivers/gpu/drm/tests/drm_connector_test.c         |   4 +-
  drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c |  16 ++-
  drivers/gpu/drm/tests/drm_probe_helper_test.c      |   2 +-
  drivers/gpu/drm/tiny/arcpgu.c                      |   2 +-
  drivers/gpu/drm/tiny/sharp-memory.c                |   2 +-
  drivers/gpu/drm/virtio/virtgpu_display.c           |   2 +-
  drivers/gpu/drm/vkms/vkms_connector.c              |   2 +-
  drivers/gpu/drm/vkms/vkms_writeback.c              |   2 +-
  drivers/gpu/drm/xen/xen_drm_front_conn.c           |   2 +-
  include/drm/drm_atomic_state_helper.h              |   3 -
  include/drm/drm_connector.h                        |  12 --
  include/drm/drm_mipi_dbi.h                         |   2 +-
  58 files changed, 351 insertions(+), 236 deletions(-)

---
base-commit: 91f52e99824b0beebb48cad51bbda81437af8664
change-id: 20260709-drm-no-more-connector-reset-45ee14d7c62c

Best regards,

Signature · 6 lines
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Stefan Gaiser, Jochen Jaser, Abhinav Puri, (HRB 36809, AG Nürnberg)
author maintainer Applied
#43 lore raw
In reply to Maxime Ripard
Quoted 17 lines · Maxime Ripard

This is a follow-up to the plane and CRTC reset removal series, and part of a larger effort to remove the reset hook from all KMS objects.

The connector reset hook is overloaded: it is called both at probe time to create the initial software state and during suspend/resume to reset hardware and software state. These two roles have different requirements, and the reset hook is not fallible, making error handling difficult for the initial state allocation path.

While reset has the semantics to reset both the software and hardware state, the vast majority of implementations and all the helpers only reset the software state, making them equivalent to atomic_create_state in practice. The atomic_create_state hook makes this explicit: it only allocates and initializes a pristine state without any side effect, and returns the state pointer or an ERR_PTR on failure.

Quoted 7 lines

This series converts all connector drivers tree-wide from the reset hook to atomic_create_state, then removes the reset hook from struct drm_connector_funcs entirely. The conversions were done using a combination of Coccinelle semantic patches, mechanical one-line replacements and manual adjustments.

Applied to drm-misc-next

Maxime