All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v5 0/8] drm: writeback: clean up writeback connector initialization
@ 2026-05-05  0:24 Dmitry Baryshkov
  2026-05-05  0:24 ` [PATCH v5 1/8] drm/msm/dpu: don't mix devm and drmm functions Dmitry Baryshkov
                   ` (8 more replies)
  0 siblings, 9 replies; 22+ messages in thread
From: Dmitry Baryshkov @ 2026-05-05  0:24 UTC (permalink / raw)
  To: Jani Nikula, Kandpal, Suraj, Harry Wentland, Leo Li,
	Rodrigo Siqueira, Alex Deucher, Christian König,
	David Airlie, Simona Vetter, Liviu Dudau, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, Rob Clark, Dmitry Baryshkov,
	Abhinav Kumar, Sean Paul, Marijn Suijten, Laurent Pinchart,
	Tomi Valkeinen, Kieran Bingham, Geert Uytterhoeven, Magnus Damm,
	Dave Stevenson, Maíra Canal, Raspberry Pi Kernel Maintenance,
	Christophe JAILLET, Jessica Zhang, Louis Chauvet, Jessica Zhang
  Cc: amd-gfx, dri-devel, linux-kernel, linux-arm-msm, freedreno,
	linux-renesas-soc

Drivers using drm_writeback_connector_init() / _with_encoder() don't
perform cleanup in a manner similar to drmm_writeback_connector_init()
(see drm_writeback_connector_cleanup()). Migrate all existing drivers
to use drmm_writeback_connector_init(), drop
drm_writeback_connector_init() and drm_writeback_connector::encoder
(it's unused afterwards).

This series leaves former drm_writeback_connector_init_with_encoder()
(renamed to drm_writeback_connector_init as a non-managed counterpart
for drmm_writeback_connector_init()). It is supposed to be used by
drivers which can not use drmm functions (like Intel). However I think
it would be better to drop it completely.

Note: Christophe pointed out that AMDGPU driver leaks connector memory.
As it's not related to this series (and as I don't have enough
proficiency in the driver) I'm not going to fix those in this series.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
---
Changes in v5:
- Rebased on top of drm-misc-next
- Expanded commit message for msm patch, describing devm vs drmm issues (Laurent)
- Expanded commit messages, describing why the drivers are converted to
  drmm_writeback_connector_init() (Laurent)
- Link to v4: https://lore.kernel.org/r/20251228-wb-drop-encoder-v4-0-58d28e668901@oss.qualcomm.com

Changes in v4:
- Rebase on top of drm-misc-next, dropping applied patch.
- Added a note regarding memory leak in the AMDGPU driver.
- Fixed a devm vs drmm issue in the msm/dpu driver.
- Link to v3: https://lore.kernel.org/r/20250819-wb-drop-encoder-v3-0-b48a6af7903b@oss.qualcomm.com

Changes in v3:
- Fixed subject prefix for the rcar-du patch (Jessica Zhang)
- Link to v2: https://lore.kernel.org/r/20250816-wb-drop-encoder-v2-0-f951de04f4f9@oss.qualcomm.com

Changes in v2:
- Switched to drm_crtc_mask() where applicable (Louis Chauvet)
- Link to v1: https://lore.kernel.org/r/20250801-wb-drop-encoder-v1-0-824646042f7d@oss.qualcomm.com

---
Dmitry Baryshkov (8):
      drm/msm/dpu: don't mix devm and drmm functions
      drm/amd/display: use drmm_writeback_connector_init()
      drm/komeda: use drmm_writeback_connector_init()
      drm/mali: use drmm_writeback_connector_init()
      drm: renesas: rcar-du: use drmm_writeback_connector_init()
      drm/vc4: use drmm_writeback_connector_init()
      drm: writeback: drop excess connector initialization functions
      drm: writeback: rename drm_writeback_connector_init_with_encoder()

 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c  |  2 +-
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_wb.c   | 18 ++++--
 .../drm/arm/display/komeda/komeda_wb_connector.c   | 30 ++++++----
 drivers/gpu/drm/arm/malidp_mw.c                    | 25 ++++----
 drivers/gpu/drm/drm_writeback.c                    | 69 +++-------------------
 drivers/gpu/drm/msm/disp/dpu1/dpu_writeback.c      |  3 +-
 .../gpu/drm/renesas/rcar-du/rcar_du_writeback.c    | 22 ++++---
 drivers/gpu/drm/vc4/vc4_txp.c                      |  9 ++-
 include/drm/drm_writeback.h                        | 22 +------
 9 files changed, 75 insertions(+), 125 deletions(-)
---
base-commit: d4c14903bf5e28e740516c4fbb7db01e0dedf3af
change-id: 20250801-wb-drop-encoder-97a0c75bd5d7

Best regards,
--  
With best wishes
Dmitry


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

* [PATCH v5 1/8] drm/msm/dpu: don't mix devm and drmm functions
  2026-05-05  0:24 [PATCH v5 0/8] drm: writeback: clean up writeback connector initialization Dmitry Baryshkov
@ 2026-05-05  0:24 ` Dmitry Baryshkov
  2026-05-05 18:35   ` John Harrison
  2026-05-05 21:49   ` Rob Clark
  2026-05-05  0:24 ` [PATCH v5 2/8] drm/amd/display: use drmm_writeback_connector_init() Dmitry Baryshkov
                   ` (7 subsequent siblings)
  8 siblings, 2 replies; 22+ messages in thread
From: Dmitry Baryshkov @ 2026-05-05  0:24 UTC (permalink / raw)
  To: Jani Nikula, Kandpal, Suraj, Harry Wentland, Leo Li,
	Rodrigo Siqueira, Alex Deucher, Christian König,
	David Airlie, Simona Vetter, Liviu Dudau, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, Rob Clark, Dmitry Baryshkov,
	Abhinav Kumar, Sean Paul, Marijn Suijten, Laurent Pinchart,
	Tomi Valkeinen, Kieran Bingham, Geert Uytterhoeven, Magnus Damm,
	Dave Stevenson, Maíra Canal, Raspberry Pi Kernel Maintenance,
	Christophe JAILLET, Jessica Zhang, Louis Chauvet, Jessica Zhang
  Cc: amd-gfx, dri-devel, linux-kernel, linux-arm-msm, freedreno,
	linux-renesas-soc

Mixing devm and drmm functions will result in a use-after-free on msm
driver teardown if userspace keeps a reference on the drm device:
The WB connector data will be destroyed because of the use of
devm_kzalloc()), while the usersoace still can try interacting with the
WB connector (which uses drmm_ functions).

Change dpu_writeback_init() to use drmm_.

Fixes: 0b37ac63fc9d ("drm/msm/dpu: use drmm_writeback_connector_init()")
Reported-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Closes: https://lore.kernel.org/r/78c764b8-44cf-4db5-88e7-807a85954518@wanadoo.fr
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_writeback.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_writeback.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_writeback.c
index 7545c0293efb..6f2370c9dd98 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_writeback.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_writeback.c
@@ -5,6 +5,7 @@
 
 #include <drm/drm_edid.h>
 #include <drm/drm_framebuffer.h>
+#include <drm/drm_managed.h>
 
 #include "dpu_writeback.h"
 
@@ -125,7 +126,7 @@ int dpu_writeback_init(struct drm_device *dev, struct drm_encoder *enc,
 	struct dpu_wb_connector *dpu_wb_conn;
 	int rc = 0;
 
-	dpu_wb_conn = devm_kzalloc(dev->dev, sizeof(*dpu_wb_conn), GFP_KERNEL);
+	dpu_wb_conn = drmm_kzalloc(dev, sizeof(*dpu_wb_conn), GFP_KERNEL);
 	if (!dpu_wb_conn)
 		return -ENOMEM;
 

-- 
2.47.3


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

* [PATCH v5 2/8] drm/amd/display: use drmm_writeback_connector_init()
  2026-05-05  0:24 [PATCH v5 0/8] drm: writeback: clean up writeback connector initialization Dmitry Baryshkov
  2026-05-05  0:24 ` [PATCH v5 1/8] drm/msm/dpu: don't mix devm and drmm functions Dmitry Baryshkov
@ 2026-05-05  0:24 ` Dmitry Baryshkov
  2026-05-26 18:46   ` Alex Hung
  2026-05-05  0:25 ` [PATCH v5 3/8] drm/komeda: " Dmitry Baryshkov
                   ` (6 subsequent siblings)
  8 siblings, 1 reply; 22+ messages in thread
From: Dmitry Baryshkov @ 2026-05-05  0:24 UTC (permalink / raw)
  To: Jani Nikula, Kandpal, Suraj, Harry Wentland, Leo Li,
	Rodrigo Siqueira, Alex Deucher, Christian König,
	David Airlie, Simona Vetter, Liviu Dudau, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, Rob Clark, Dmitry Baryshkov,
	Abhinav Kumar, Sean Paul, Marijn Suijten, Laurent Pinchart,
	Tomi Valkeinen, Kieran Bingham, Geert Uytterhoeven, Magnus Damm,
	Dave Stevenson, Maíra Canal, Raspberry Pi Kernel Maintenance,
	Christophe JAILLET, Jessica Zhang, Louis Chauvet, Jessica Zhang
  Cc: amd-gfx, dri-devel, linux-kernel, linux-arm-msm, freedreno,
	linux-renesas-soc

The driver uses drm_writeback_connector_init() instead of its drmm
counterpart, but it doesn't perform the job queue cleanup (neither
manually nor by calling drm_writeback_connector_cleanup()). On the
contrary, the drmm_writeback_connector_init() function ensures the
proper cleanup of the job queue.

Use drmm_plain_encoder_alloc() to allocate simple encoder and
drmm_writeback_connector_init() in order to initialize writeback
connector instance.

Reviewed-by: Louis Chauvet <louis.chauvet@bootlin.com>
Reviewed-by: Suraj Kandpal <suraj.kandpal@intel.com>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c    |  2 +-
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_wb.c | 18 +++++++++++++-----
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index e96a12ff2d31..2ac64495cdb7 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -10683,7 +10683,7 @@ static void dm_set_writeback(struct amdgpu_display_manager *dm,
 		return;
 	}
 
-	acrtc = to_amdgpu_crtc(wb_conn->encoder.crtc);
+	acrtc = to_amdgpu_crtc(crtc_state->base.crtc);
 	if (!acrtc) {
 		drm_err(adev_to_drm(adev), "no amdgpu_crtc found\n");
 		kfree(wb_info);
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_wb.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_wb.c
index 110f0173eee6..fdc3da40452f 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_wb.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_wb.c
@@ -169,7 +169,6 @@ static const struct drm_encoder_helper_funcs amdgpu_dm_wb_encoder_helper_funcs =
 
 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_duplicate_state = amdgpu_dm_connector_atomic_duplicate_state,
 	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
@@ -188,17 +187,26 @@ int amdgpu_dm_wb_connector_init(struct amdgpu_display_manager *dm,
 	struct dc *dc = dm->dc;
 	struct dc_link *link = dc_get_link_at_index(dc, link_index);
 	int res = 0;
+	struct drm_encoder *encoder;
+
+	encoder = drmm_plain_encoder_alloc(&dm->adev->ddev, NULL,
+					   DRM_MODE_ENCODER_VIRTUAL, NULL);
+	if (IS_ERR(encoder))
+		return PTR_ERR(encoder);
+
+	drm_encoder_helper_add(encoder, &amdgpu_dm_wb_encoder_helper_funcs);
+
+	encoder->possible_crtcs = amdgpu_dm_get_encoder_crtc_mask(dm->adev);
 
 	wbcon->link = link;
 
 	drm_connector_helper_add(&wbcon->base.base, &amdgpu_dm_wb_conn_helper_funcs);
 
-	res = drm_writeback_connector_init(&dm->adev->ddev, &wbcon->base,
+	res = drmm_writeback_connector_init(&dm->adev->ddev, &wbcon->base,
 					    &amdgpu_dm_wb_connector_funcs,
-					    &amdgpu_dm_wb_encoder_helper_funcs,
+					    encoder,
 					    amdgpu_dm_wb_formats,
-					    ARRAY_SIZE(amdgpu_dm_wb_formats),
-					    amdgpu_dm_get_encoder_crtc_mask(dm->adev));
+					    ARRAY_SIZE(amdgpu_dm_wb_formats));
 
 	if (res)
 		return res;

-- 
2.47.3


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

* [PATCH v5 3/8] drm/komeda: use drmm_writeback_connector_init()
  2026-05-05  0:24 [PATCH v5 0/8] drm: writeback: clean up writeback connector initialization Dmitry Baryshkov
  2026-05-05  0:24 ` [PATCH v5 1/8] drm/msm/dpu: don't mix devm and drmm functions Dmitry Baryshkov
  2026-05-05  0:24 ` [PATCH v5 2/8] drm/amd/display: use drmm_writeback_connector_init() Dmitry Baryshkov
@ 2026-05-05  0:25 ` Dmitry Baryshkov
  2026-06-02 10:32   ` Liviu Dudau
  2026-05-05  0:25 ` [PATCH v5 4/8] drm/mali: " Dmitry Baryshkov
                   ` (5 subsequent siblings)
  8 siblings, 1 reply; 22+ messages in thread
From: Dmitry Baryshkov @ 2026-05-05  0:25 UTC (permalink / raw)
  To: Jani Nikula, Kandpal, Suraj, Harry Wentland, Leo Li,
	Rodrigo Siqueira, Alex Deucher, Christian König,
	David Airlie, Simona Vetter, Liviu Dudau, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, Rob Clark, Dmitry Baryshkov,
	Abhinav Kumar, Sean Paul, Marijn Suijten, Laurent Pinchart,
	Tomi Valkeinen, Kieran Bingham, Geert Uytterhoeven, Magnus Damm,
	Dave Stevenson, Maíra Canal, Raspberry Pi Kernel Maintenance,
	Christophe JAILLET, Jessica Zhang, Louis Chauvet, Jessica Zhang
  Cc: amd-gfx, dri-devel, linux-kernel, linux-arm-msm, freedreno,
	linux-renesas-soc

The driver uses drm_writeback_connector_init() instead of its drmm
counterpart, but it doesn't perform the job queue cleanup (neither
manually nor by calling drm_writeback_connector_cleanup()). On the
contrary, the drmm_writeback_connector_init() function ensures the
proper cleanup of the job queue.

Use drmm_plain_encoder_alloc() to allocate simple encoder and
drmm_writeback_connector_init() in order to initialize writeback
connector instance.

Reviewed-by: Suraj Kandpal <suraj.kandpal@intel.com>
Reviewed-by: Louis Chauvet <louis.chauvet@bootlin.com>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
---
 .../drm/arm/display/komeda/komeda_wb_connector.c   | 30 ++++++++++++----------
 1 file changed, 17 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_wb_connector.c b/drivers/gpu/drm/arm/display/komeda/komeda_wb_connector.c
index 41cc3e080dc9..bcc53d4015f1 100644
--- a/drivers/gpu/drm/arm/display/komeda/komeda_wb_connector.c
+++ b/drivers/gpu/drm/arm/display/komeda/komeda_wb_connector.c
@@ -5,6 +5,7 @@
  *
  */
 #include <drm/drm_framebuffer.h>
+#include <drm/drm_managed.h>
 #include "komeda_dev.h"
 #include "komeda_kms.h"
 
@@ -121,17 +122,10 @@ komeda_wb_connector_fill_modes(struct drm_connector *connector,
 	return 0;
 }
 
-static void komeda_wb_connector_destroy(struct drm_connector *connector)
-{
-	drm_connector_cleanup(connector);
-	kfree(to_kconn(to_wb_conn(connector)));
-}
-
 static const struct drm_connector_funcs komeda_wb_connector_funcs = {
 	.reset			= drm_atomic_helper_connector_reset,
 	.detect			= komeda_wb_connector_detect,
 	.fill_modes		= komeda_wb_connector_fill_modes,
-	.destroy		= komeda_wb_connector_destroy,
 	.atomic_duplicate_state	= drm_atomic_helper_connector_duplicate_state,
 	.atomic_destroy_state	= drm_atomic_helper_connector_destroy_state,
 };
@@ -143,13 +137,15 @@ static int komeda_wb_connector_add(struct komeda_kms_dev *kms,
 	struct komeda_wb_connector *kwb_conn;
 	struct drm_writeback_connector *wb_conn;
 	struct drm_display_info *info;
+	struct drm_encoder *encoder;
+
 	u32 *formats, n_formats = 0;
 	int err;
 
 	if (!kcrtc->master->wb_layer)
 		return 0;
 
-	kwb_conn = kzalloc_obj(*kwb_conn);
+	kwb_conn = drmm_kzalloc(&kms->base, sizeof(*kwb_conn), GFP_KERNEL);
 	if (!kwb_conn)
 		return -ENOMEM;
 
@@ -165,11 +161,19 @@ static int komeda_wb_connector_add(struct komeda_kms_dev *kms,
 		return -ENOMEM;
 	}
 
-	err = drm_writeback_connector_init(&kms->base, wb_conn,
-					   &komeda_wb_connector_funcs,
-					   &komeda_wb_encoder_helper_funcs,
-					   formats, n_formats,
-					   BIT(drm_crtc_index(&kcrtc->base)));
+	encoder = drmm_plain_encoder_alloc(&kms->base, NULL,
+					   DRM_MODE_ENCODER_VIRTUAL, NULL);
+	if (IS_ERR(encoder))
+		return PTR_ERR(encoder);
+
+	drm_encoder_helper_add(encoder, &komeda_wb_encoder_helper_funcs);
+
+	encoder->possible_crtcs = drm_crtc_mask(&kcrtc->base);
+
+	err = drmm_writeback_connector_init(&kms->base, wb_conn,
+					    &komeda_wb_connector_funcs,
+					    encoder,
+					    formats, n_formats);
 	komeda_put_fourcc_list(formats);
 	if (err) {
 		kfree(kwb_conn);

-- 
2.47.3


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

* [PATCH v5 4/8] drm/mali: use drmm_writeback_connector_init()
  2026-05-05  0:24 [PATCH v5 0/8] drm: writeback: clean up writeback connector initialization Dmitry Baryshkov
                   ` (2 preceding siblings ...)
  2026-05-05  0:25 ` [PATCH v5 3/8] drm/komeda: " Dmitry Baryshkov
@ 2026-05-05  0:25 ` Dmitry Baryshkov
  2026-06-02 10:33   ` Liviu Dudau
  2026-05-05  0:25 ` [PATCH v5 5/8] drm: renesas: rcar-du: " Dmitry Baryshkov
                   ` (4 subsequent siblings)
  8 siblings, 1 reply; 22+ messages in thread
From: Dmitry Baryshkov @ 2026-05-05  0:25 UTC (permalink / raw)
  To: Jani Nikula, Kandpal, Suraj, Harry Wentland, Leo Li,
	Rodrigo Siqueira, Alex Deucher, Christian König,
	David Airlie, Simona Vetter, Liviu Dudau, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, Rob Clark, Dmitry Baryshkov,
	Abhinav Kumar, Sean Paul, Marijn Suijten, Laurent Pinchart,
	Tomi Valkeinen, Kieran Bingham, Geert Uytterhoeven, Magnus Damm,
	Dave Stevenson, Maíra Canal, Raspberry Pi Kernel Maintenance,
	Christophe JAILLET, Jessica Zhang, Louis Chauvet, Jessica Zhang
  Cc: amd-gfx, dri-devel, linux-kernel, linux-arm-msm, freedreno,
	linux-renesas-soc

The driver uses drm_writeback_connector_init() instead of its drmm
counterpart, but it doesn't perform the job queue cleanup (neither
manually nor by calling drm_writeback_connector_cleanup()). On the
contrary, the drmm_writeback_connector_init() function ensures the
proper cleanup of the job queue.

Use drmm_plain_encoder_alloc() to allocate simple encoder and
drmm_writeback_connector_init() in order to initialize writeback
connector instance.

Reviewed-by: Suraj Kandpal <suraj.kandpal@intel.com>
Reviewed-by: Louis Chauvet <louis.chauvet@bootlin.com>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
---
 drivers/gpu/drm/arm/malidp_mw.c | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/arm/malidp_mw.c b/drivers/gpu/drm/arm/malidp_mw.c
index fad343842038..6e0c78e998aa 100644
--- a/drivers/gpu/drm/arm/malidp_mw.c
+++ b/drivers/gpu/drm/arm/malidp_mw.c
@@ -84,11 +84,6 @@ malidp_mw_connector_detect(struct drm_connector *connector, bool force)
 	return connector_status_connected;
 }
 
-static void malidp_mw_connector_destroy(struct drm_connector *connector)
-{
-	drm_connector_cleanup(connector);
-}
-
 static struct drm_connector_state *
 malidp_mw_connector_duplicate_state(struct drm_connector *connector)
 {
@@ -114,7 +109,6 @@ static const struct drm_connector_funcs malidp_mw_connector_funcs = {
 	.reset = malidp_mw_connector_reset,
 	.detect = malidp_mw_connector_detect,
 	.fill_modes = drm_helper_probe_single_connector_modes,
-	.destroy = malidp_mw_connector_destroy,
 	.atomic_duplicate_state = malidp_mw_connector_duplicate_state,
 	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
 };
@@ -211,6 +205,7 @@ static u32 *get_writeback_formats(struct malidp_drm *malidp, int *n_formats)
 int malidp_mw_connector_init(struct drm_device *drm)
 {
 	struct malidp_drm *malidp = drm_to_malidp(drm);
+	struct drm_encoder *encoder;
 	u32 *formats;
 	int ret, n_formats;
 
@@ -224,11 +219,19 @@ int malidp_mw_connector_init(struct drm_device *drm)
 	if (!formats)
 		return -ENOMEM;
 
-	ret = drm_writeback_connector_init(drm, &malidp->mw_connector,
-					   &malidp_mw_connector_funcs,
-					   &malidp_mw_encoder_helper_funcs,
-					   formats, n_formats,
-					   1 << drm_crtc_index(&malidp->crtc));
+	encoder = drmm_plain_encoder_alloc(drm, NULL, DRM_MODE_ENCODER_VIRTUAL,
+					   NULL);
+	if (IS_ERR(encoder))
+		return PTR_ERR(encoder);
+
+	drm_encoder_helper_add(encoder, &malidp_mw_encoder_helper_funcs);
+
+	encoder->possible_crtcs = drm_crtc_mask(&malidp->crtc);
+
+	ret = drmm_writeback_connector_init(drm, &malidp->mw_connector,
+					    &malidp_mw_connector_funcs,
+					    encoder,
+					    formats, n_formats);
 	kfree(formats);
 	if (ret)
 		return ret;

-- 
2.47.3


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

* [PATCH v5 5/8] drm: renesas: rcar-du: use drmm_writeback_connector_init()
  2026-05-05  0:24 [PATCH v5 0/8] drm: writeback: clean up writeback connector initialization Dmitry Baryshkov
                   ` (3 preceding siblings ...)
  2026-05-05  0:25 ` [PATCH v5 4/8] drm/mali: " Dmitry Baryshkov
@ 2026-05-05  0:25 ` Dmitry Baryshkov
  2026-05-05  0:25 ` [PATCH v5 6/8] drm/vc4: " Dmitry Baryshkov
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 22+ messages in thread
From: Dmitry Baryshkov @ 2026-05-05  0:25 UTC (permalink / raw)
  To: Jani Nikula, Kandpal, Suraj, Harry Wentland, Leo Li,
	Rodrigo Siqueira, Alex Deucher, Christian König,
	David Airlie, Simona Vetter, Liviu Dudau, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, Rob Clark, Dmitry Baryshkov,
	Abhinav Kumar, Sean Paul, Marijn Suijten, Laurent Pinchart,
	Tomi Valkeinen, Kieran Bingham, Geert Uytterhoeven, Magnus Damm,
	Dave Stevenson, Maíra Canal, Raspberry Pi Kernel Maintenance,
	Christophe JAILLET, Jessica Zhang, Louis Chauvet, Jessica Zhang
  Cc: amd-gfx, dri-devel, linux-kernel, linux-arm-msm, freedreno,
	linux-renesas-soc

The driver uses drm_writeback_connector_init() instead of its drmm
counterpart, but it doesn't perform the job queue cleanup (neither
manually nor by calling drm_writeback_connector_cleanup()). On the
contrary, the drmm_writeback_connector_init() function ensures the
proper cleanup of the job queue.

Use drmm_plain_encoder_alloc() to allocate simple encoder and
drmm_writeback_connector_init() in order to initialize writeback
connector instance.

Reviewed-by: Suraj Kandpal <suraj.kandpal@intel.com>
Reviewed-by: Louis Chauvet <louis.chauvet@bootlin.com>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
---
 .../gpu/drm/renesas/rcar-du/rcar_du_writeback.c    | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/renesas/rcar-du/rcar_du_writeback.c b/drivers/gpu/drm/renesas/rcar-du/rcar_du_writeback.c
index e5e6e6a156aa..ecfd4fc1f210 100644
--- a/drivers/gpu/drm/renesas/rcar-du/rcar_du_writeback.c
+++ b/drivers/gpu/drm/renesas/rcar-du/rcar_du_writeback.c
@@ -134,7 +134,6 @@ static void rcar_du_wb_conn_reset(struct drm_connector *connector)
 static const struct drm_connector_funcs rcar_du_wb_conn_funcs = {
 	.reset = rcar_du_wb_conn_reset,
 	.fill_modes = drm_helper_probe_single_connector_modes,
-	.destroy = drm_connector_cleanup,
 	.atomic_duplicate_state = rcar_du_wb_conn_duplicate_state,
 	.atomic_destroy_state = rcar_du_wb_conn_destroy_state,
 };
@@ -201,16 +200,25 @@ int rcar_du_writeback_init(struct rcar_du_device *rcdu,
 			   struct rcar_du_crtc *rcrtc)
 {
 	struct drm_writeback_connector *wb_conn = &rcrtc->writeback;
+	struct drm_encoder *encoder;
+
+	encoder = drmm_plain_encoder_alloc(&rcdu->ddev, NULL,
+					   DRM_MODE_ENCODER_VIRTUAL, NULL);
+	if (IS_ERR(encoder))
+		return PTR_ERR(encoder);
+
+	drm_encoder_helper_add(encoder, &rcar_du_wb_enc_helper_funcs);
+
+	encoder->possible_crtcs = drm_crtc_mask(&rcrtc->crtc);
 
 	drm_connector_helper_add(&wb_conn->base,
 				 &rcar_du_wb_conn_helper_funcs);
 
-	return drm_writeback_connector_init(&rcdu->ddev, wb_conn,
-					    &rcar_du_wb_conn_funcs,
-					    &rcar_du_wb_enc_helper_funcs,
-					    writeback_formats,
-					    ARRAY_SIZE(writeback_formats),
-					    1 << drm_crtc_index(&rcrtc->crtc));
+	return drmm_writeback_connector_init(&rcdu->ddev, wb_conn,
+					     &rcar_du_wb_conn_funcs,
+					     encoder,
+					     writeback_formats,
+					     ARRAY_SIZE(writeback_formats));
 }
 
 void rcar_du_writeback_setup(struct rcar_du_crtc *rcrtc,

-- 
2.47.3


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

* [PATCH v5 6/8] drm/vc4: use drmm_writeback_connector_init()
  2026-05-05  0:24 [PATCH v5 0/8] drm: writeback: clean up writeback connector initialization Dmitry Baryshkov
                   ` (4 preceding siblings ...)
  2026-05-05  0:25 ` [PATCH v5 5/8] drm: renesas: rcar-du: " Dmitry Baryshkov
@ 2026-05-05  0:25 ` Dmitry Baryshkov
  2026-05-05  0:25 ` [PATCH v5 7/8] drm: writeback: drop excess connector initialization functions Dmitry Baryshkov
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 22+ messages in thread
From: Dmitry Baryshkov @ 2026-05-05  0:25 UTC (permalink / raw)
  To: Jani Nikula, Kandpal, Suraj, Harry Wentland, Leo Li,
	Rodrigo Siqueira, Alex Deucher, Christian König,
	David Airlie, Simona Vetter, Liviu Dudau, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, Rob Clark, Dmitry Baryshkov,
	Abhinav Kumar, Sean Paul, Marijn Suijten, Laurent Pinchart,
	Tomi Valkeinen, Kieran Bingham, Geert Uytterhoeven, Magnus Damm,
	Dave Stevenson, Maíra Canal, Raspberry Pi Kernel Maintenance,
	Christophe JAILLET, Jessica Zhang, Louis Chauvet, Jessica Zhang
  Cc: amd-gfx, dri-devel, linux-kernel, linux-arm-msm, freedreno,
	linux-renesas-soc

The driver uses drm_writeback_connector_init() instead of its drmm
counterpart, but it doesn't perform the job queue cleanup (neither
manually nor by calling drm_writeback_connector_cleanup()). On the
contrary, the drmm_writeback_connector_init() function ensures the
proper cleanup of the job queue.

Use drmm_plain_encoder_alloc() to allocate simple encoder and
drmm_writeback_connector_init() in order to initialize writeback
connector instance.

Reviewed-by: Louis Chauvet <louis.chauvet@bootlin.com>
Reviewed-by: Suraj Kandpal <suraj.kandpal@intel.com>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
---
 drivers/gpu/drm/vc4/vc4_txp.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/vc4/vc4_txp.c b/drivers/gpu/drm/vc4/vc4_txp.c
index 9082902100e4..befdb094c173 100644
--- a/drivers/gpu/drm/vc4/vc4_txp.c
+++ b/drivers/gpu/drm/vc4/vc4_txp.c
@@ -378,7 +378,6 @@ vc4_txp_connector_detect(struct drm_connector *connector, bool force)
 static const struct drm_connector_funcs vc4_txp_connector_funcs = {
 	.detect = vc4_txp_connector_detect,
 	.fill_modes = drm_helper_probe_single_connector_modes,
-	.destroy = drm_connector_cleanup,
 	.reset = drm_atomic_helper_connector_reset,
 	.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
 	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
@@ -602,10 +601,10 @@ static int vc4_txp_bind(struct device *dev, struct device *master, void *data)
 
 	drm_connector_helper_add(&txp->connector.base,
 				 &vc4_txp_connector_helper_funcs);
-	ret = drm_writeback_connector_init_with_encoder(drm, &txp->connector,
-							encoder,
-							&vc4_txp_connector_funcs,
-							drm_fmts, ARRAY_SIZE(drm_fmts));
+	ret = drmm_writeback_connector_init(drm, &txp->connector,
+					    &vc4_txp_connector_funcs,
+					    encoder,
+					    drm_fmts, ARRAY_SIZE(drm_fmts));
 	if (ret)
 		return ret;
 

-- 
2.47.3


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

* [PATCH v5 7/8] drm: writeback: drop excess connector initialization functions
  2026-05-05  0:24 [PATCH v5 0/8] drm: writeback: clean up writeback connector initialization Dmitry Baryshkov
                   ` (5 preceding siblings ...)
  2026-05-05  0:25 ` [PATCH v5 6/8] drm/vc4: " Dmitry Baryshkov
@ 2026-05-05  0:25 ` Dmitry Baryshkov
  2026-05-05  0:25 ` [PATCH v5 8/8] drm: writeback: rename drm_writeback_connector_init_with_encoder() Dmitry Baryshkov
  2026-05-16 15:25 ` [PATCH v5 0/8] drm: writeback: clean up writeback connector initialization Dmitry Baryshkov
  8 siblings, 0 replies; 22+ messages in thread
From: Dmitry Baryshkov @ 2026-05-05  0:25 UTC (permalink / raw)
  To: Jani Nikula, Kandpal, Suraj, Harry Wentland, Leo Li,
	Rodrigo Siqueira, Alex Deucher, Christian König,
	David Airlie, Simona Vetter, Liviu Dudau, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, Rob Clark, Dmitry Baryshkov,
	Abhinav Kumar, Sean Paul, Marijn Suijten, Laurent Pinchart,
	Tomi Valkeinen, Kieran Bingham, Geert Uytterhoeven, Magnus Damm,
	Dave Stevenson, Maíra Canal, Raspberry Pi Kernel Maintenance,
	Christophe JAILLET, Jessica Zhang, Louis Chauvet, Jessica Zhang
  Cc: amd-gfx, dri-devel, linux-kernel, linux-arm-msm, freedreno,
	linux-renesas-soc

Now as all drivers have been converted to
drmm_writeback_connector_init(), drop drm_writeback_connector_init() and
drm_writeback_connector::encoder field, they are unused now.

Reviewed-by: Suraj Kandpal <suraj.kandpal@intel.com>
Reviewed-by: Louis Chauvet <louis.chauvet@bootlin.com>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
---
 drivers/gpu/drm/drm_writeback.c | 55 -----------------------------------------
 include/drm/drm_writeback.h     | 18 --------------
 2 files changed, 73 deletions(-)

diff --git a/drivers/gpu/drm/drm_writeback.c b/drivers/gpu/drm/drm_writeback.c
index 4da5d6094721..9fc15168c34f 100644
--- a/drivers/gpu/drm/drm_writeback.c
+++ b/drivers/gpu/drm/drm_writeback.c
@@ -142,61 +142,6 @@ static int create_writeback_properties(struct drm_device *dev)
 	return 0;
 }
 
-static const struct drm_encoder_funcs drm_writeback_encoder_funcs = {
-	.destroy = drm_encoder_cleanup,
-};
-
-/**
- * drm_writeback_connector_init - Initialize a writeback connector and its properties
- * @dev: DRM device
- * @wb_connector: Writeback connector to initialize
- * @con_funcs: Connector funcs vtable
- * @enc_helper_funcs: Encoder helper funcs vtable to be used by the internal encoder
- * @formats: Array of supported pixel formats for the writeback engine
- * @n_formats: Length of the formats array
- * @possible_crtcs: possible crtcs for the internal writeback encoder
- *
- * This function creates the writeback-connector-specific properties if they
- * have not been already created, initializes the connector as
- * type DRM_MODE_CONNECTOR_WRITEBACK, and correctly initializes the property
- * values. It will also create an internal encoder associated with the
- * drm_writeback_connector and set it to use the @enc_helper_funcs vtable for
- * the encoder helper.
- *
- * Drivers should always use this function instead of drm_connector_init() to
- * set up writeback connectors.
- *
- * Returns: 0 on success, or a negative error code
- */
-int drm_writeback_connector_init(struct drm_device *dev,
-				 struct drm_writeback_connector *wb_connector,
-				 const struct drm_connector_funcs *con_funcs,
-				 const struct drm_encoder_helper_funcs *enc_helper_funcs,
-				 const u32 *formats, int n_formats,
-				 u32 possible_crtcs)
-{
-	int ret = 0;
-
-	drm_encoder_helper_add(&wb_connector->encoder, enc_helper_funcs);
-
-	wb_connector->encoder.possible_crtcs = possible_crtcs;
-
-	ret = drm_encoder_init(dev, &wb_connector->encoder,
-			       &drm_writeback_encoder_funcs,
-			       DRM_MODE_ENCODER_VIRTUAL, NULL);
-	if (ret)
-		return ret;
-
-	ret = drm_writeback_connector_init_with_encoder(dev, wb_connector, &wb_connector->encoder,
-			con_funcs, formats, n_formats);
-
-	if (ret)
-		drm_encoder_cleanup(&wb_connector->encoder);
-
-	return ret;
-}
-EXPORT_SYMBOL(drm_writeback_connector_init);
-
 static void delete_writeback_properties(struct drm_device *dev)
 {
 	if (dev->mode_config.writeback_pixel_formats_property) {
diff --git a/include/drm/drm_writeback.h b/include/drm/drm_writeback.h
index c380a7b8f55a..879ca103320c 100644
--- a/include/drm/drm_writeback.h
+++ b/include/drm/drm_writeback.h
@@ -24,17 +24,6 @@ struct drm_writeback_connector {
 	 */
 	struct drm_connector base;
 
-	/**
-	 * @encoder: Internal encoder used by the connector to fulfill
-	 * the DRM framework requirements. The users of the
-	 * @drm_writeback_connector control the behaviour of the @encoder
-	 * by passing the @enc_funcs parameter to drm_writeback_connector_init()
-	 * function.
-	 * For users of drm_writeback_connector_init_with_encoder(), this field
-	 * is not valid as the encoder is managed within their drivers.
-	 */
-	struct drm_encoder encoder;
-
 	/**
 	 * @pixel_formats_blob_ptr:
 	 *
@@ -148,13 +137,6 @@ drm_connector_to_writeback(struct drm_connector *connector)
 	return container_of(connector, struct drm_writeback_connector, base);
 }
 
-int drm_writeback_connector_init(struct drm_device *dev,
-				 struct drm_writeback_connector *wb_connector,
-				 const struct drm_connector_funcs *con_funcs,
-				 const struct drm_encoder_helper_funcs *enc_helper_funcs,
-				 const u32 *formats, int n_formats,
-				 u32 possible_crtcs);
-
 int drm_writeback_connector_init_with_encoder(struct drm_device *dev,
 				struct drm_writeback_connector *wb_connector,
 				struct drm_encoder *enc,

-- 
2.47.3


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

* [PATCH v5 8/8] drm: writeback: rename drm_writeback_connector_init_with_encoder()
  2026-05-05  0:24 [PATCH v5 0/8] drm: writeback: clean up writeback connector initialization Dmitry Baryshkov
                   ` (6 preceding siblings ...)
  2026-05-05  0:25 ` [PATCH v5 7/8] drm: writeback: drop excess connector initialization functions Dmitry Baryshkov
@ 2026-05-05  0:25 ` Dmitry Baryshkov
  2026-05-16 15:25 ` [PATCH v5 0/8] drm: writeback: clean up writeback connector initialization Dmitry Baryshkov
  8 siblings, 0 replies; 22+ messages in thread
From: Dmitry Baryshkov @ 2026-05-05  0:25 UTC (permalink / raw)
  To: Jani Nikula, Kandpal, Suraj, Harry Wentland, Leo Li,
	Rodrigo Siqueira, Alex Deucher, Christian König,
	David Airlie, Simona Vetter, Liviu Dudau, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, Rob Clark, Dmitry Baryshkov,
	Abhinav Kumar, Sean Paul, Marijn Suijten, Laurent Pinchart,
	Tomi Valkeinen, Kieran Bingham, Geert Uytterhoeven, Magnus Damm,
	Dave Stevenson, Maíra Canal, Raspberry Pi Kernel Maintenance,
	Christophe JAILLET, Jessica Zhang, Louis Chauvet, Jessica Zhang
  Cc: amd-gfx, dri-devel, linux-kernel, linux-arm-msm, freedreno,
	linux-renesas-soc

Rename drm_writeback_connector_init_with_encoder() to
drm_writeback_connector_init() and adapt its interface to follow
drmm_writeback_connector_init().

Reviewed-by: Suraj Kandpal <suraj.kandpal@intel.com>
Reviewed-by: Louis Chauvet <louis.chauvet@bootlin.com>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
---
 drivers/gpu/drm/drm_writeback.c | 14 +++++++-------
 include/drm/drm_writeback.h     | 10 +++++-----
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/drm_writeback.c b/drivers/gpu/drm/drm_writeback.c
index 9fc15168c34f..68fdac745f42 100644
--- a/drivers/gpu/drm/drm_writeback.c
+++ b/drivers/gpu/drm/drm_writeback.c
@@ -235,7 +235,7 @@ static int __drm_writeback_connector_init(struct drm_device *dev,
 }
 
 /**
- * drm_writeback_connector_init_with_encoder - Initialize a writeback connector with
+ * drm_writeback_connector_init - Initialize a writeback connector with
  * a custom encoder
  *
  * @dev: DRM device
@@ -263,11 +263,11 @@ static int __drm_writeback_connector_init(struct drm_device *dev,
  *
  * Returns: 0 on success, or a negative error code
  */
-int drm_writeback_connector_init_with_encoder(struct drm_device *dev,
-					      struct drm_writeback_connector *wb_connector,
-					      struct drm_encoder *enc,
-					      const struct drm_connector_funcs *con_funcs,
-					      const u32 *formats, int n_formats)
+int drm_writeback_connector_init(struct drm_device *dev,
+				 struct drm_writeback_connector *wb_connector,
+				 const struct drm_connector_funcs *con_funcs,
+				 struct drm_encoder *enc,
+				 const u32 *formats, int n_formats)
 {
 	struct drm_connector *connector = &wb_connector->base;
 	int ret;
@@ -284,7 +284,7 @@ int drm_writeback_connector_init_with_encoder(struct drm_device *dev,
 
 	return ret;
 }
-EXPORT_SYMBOL(drm_writeback_connector_init_with_encoder);
+EXPORT_SYMBOL(drm_writeback_connector_init);
 
 /**
  * drm_writeback_connector_cleanup - Cleanup the writeback connector
diff --git a/include/drm/drm_writeback.h b/include/drm/drm_writeback.h
index 879ca103320c..958466a05e60 100644
--- a/include/drm/drm_writeback.h
+++ b/include/drm/drm_writeback.h
@@ -137,11 +137,11 @@ drm_connector_to_writeback(struct drm_connector *connector)
 	return container_of(connector, struct drm_writeback_connector, base);
 }
 
-int drm_writeback_connector_init_with_encoder(struct drm_device *dev,
-				struct drm_writeback_connector *wb_connector,
-				struct drm_encoder *enc,
-				const struct drm_connector_funcs *con_funcs, const u32 *formats,
-				int n_formats);
+int drm_writeback_connector_init(struct drm_device *dev,
+				 struct drm_writeback_connector *wb_connector,
+				 const struct drm_connector_funcs *con_funcs,
+				 struct drm_encoder *enc,
+				 const u32 *formats, int n_formats);
 
 int drmm_writeback_connector_init(struct drm_device *dev,
 				  struct drm_writeback_connector *wb_connector,

-- 
2.47.3


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

* Re: [PATCH v5 1/8] drm/msm/dpu: don't mix devm and drmm functions
  2026-05-05  0:24 ` [PATCH v5 1/8] drm/msm/dpu: don't mix devm and drmm functions Dmitry Baryshkov
@ 2026-05-05 18:35   ` John Harrison
  2026-05-05 21:49   ` Rob Clark
  1 sibling, 0 replies; 22+ messages in thread
From: John Harrison @ 2026-05-05 18:35 UTC (permalink / raw)
  To: Dmitry Baryshkov, Jani Nikula, Kandpal, Suraj, Harry Wentland,
	Leo Li, Rodrigo Siqueira, Alex Deucher, Christian König,
	David Airlie, Simona Vetter, Liviu Dudau, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, Rob Clark, Dmitry Baryshkov,
	Abhinav Kumar, Sean Paul, Marijn Suijten, Laurent Pinchart,
	Tomi Valkeinen, Kieran Bingham, Geert Uytterhoeven, Magnus Damm,
	Dave Stevenson, Maíra Canal, Raspberry Pi Kernel Maintenance,
	Christophe JAILLET, Jessica Zhang, Louis Chauvet
  Cc: amd-gfx, dri-devel, linux-kernel, linux-arm-msm, freedreno,
	linux-renesas-soc, kernel-dev

On 5/4/26 17:24, Dmitry Baryshkov wrote:
> Mixing devm and drmm functions will result in a use-after-free on msm
> driver teardown if userspace keeps a reference on the drm device:
> The WB connector data will be destroyed because of the use of
> devm_kzalloc()), while the usersoace still can try interacting with the
extra ) on devm_kzalloc())
typo: userspace

Otherwise the description looks good to me and the two typos can be 
fixed when merging, so:
Reviewed-by: John.Harrison@Igalia.com

But should wait for at least an ack from Laurent as the person 
originally requesting an extended description.

John.

> WB connector (which uses drmm_ functions).
>
> Change dpu_writeback_init() to use drmm_.
>
> Fixes: 0b37ac63fc9d ("drm/msm/dpu: use drmm_writeback_connector_init()")
> Reported-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> Closes: https://lore.kernel.org/r/78c764b8-44cf-4db5-88e7-807a85954518@wanadoo.fr
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
> ---
>   drivers/gpu/drm/msm/disp/dpu1/dpu_writeback.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_writeback.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_writeback.c
> index 7545c0293efb..6f2370c9dd98 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_writeback.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_writeback.c
> @@ -5,6 +5,7 @@
>   
>   #include <drm/drm_edid.h>
>   #include <drm/drm_framebuffer.h>
> +#include <drm/drm_managed.h>
>   
>   #include "dpu_writeback.h"
>   
> @@ -125,7 +126,7 @@ int dpu_writeback_init(struct drm_device *dev, struct drm_encoder *enc,
>   	struct dpu_wb_connector *dpu_wb_conn;
>   	int rc = 0;
>   
> -	dpu_wb_conn = devm_kzalloc(dev->dev, sizeof(*dpu_wb_conn), GFP_KERNEL);
> +	dpu_wb_conn = drmm_kzalloc(dev, sizeof(*dpu_wb_conn), GFP_KERNEL);
>   	if (!dpu_wb_conn)
>   		return -ENOMEM;
>   
>


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

* Re: [PATCH v5 1/8] drm/msm/dpu: don't mix devm and drmm functions
  2026-05-05  0:24 ` [PATCH v5 1/8] drm/msm/dpu: don't mix devm and drmm functions Dmitry Baryshkov
  2026-05-05 18:35   ` John Harrison
@ 2026-05-05 21:49   ` Rob Clark
  2026-05-07 16:14     ` John Harrison
  2026-05-07 16:28     ` John Harrison
  1 sibling, 2 replies; 22+ messages in thread
From: Rob Clark @ 2026-05-05 21:49 UTC (permalink / raw)
  To: Dmitry Baryshkov
  Cc: Jani Nikula, Kandpal, Suraj, Harry Wentland, Leo Li,
	Rodrigo Siqueira, Alex Deucher, Christian König,
	David Airlie, Simona Vetter, Liviu Dudau, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, Dmitry Baryshkov, Abhinav Kumar,
	Sean Paul, Marijn Suijten, Laurent Pinchart, Tomi Valkeinen,
	Kieran Bingham, Geert Uytterhoeven, Magnus Damm, Dave Stevenson,
	Maíra Canal, Raspberry Pi Kernel Maintenance,
	Christophe JAILLET, Jessica Zhang, Louis Chauvet, amd-gfx,
	dri-devel, linux-kernel, linux-arm-msm, freedreno,
	linux-renesas-soc

On Mon, May 4, 2026 at 5:25 PM Dmitry Baryshkov
<dmitry.baryshkov@oss.qualcomm.com> wrote:
>
> Mixing devm and drmm functions will result in a use-after-free on msm
> driver teardown if userspace keeps a reference on the drm device:
> The WB connector data will be destroyed because of the use of
> devm_kzalloc()), while the usersoace still can try interacting with the
> WB connector (which uses drmm_ functions).
>
> Change dpu_writeback_init() to use drmm_.

From [1] it doesn't sound like userspace holding the drm device open
is the issue (if that were possible, it seems like it would go badly),
but rather the order of managed cleanup?

[1] https://web.git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/drivers/gpu/drm/xe/xe_hwmon.c?id=3a13c2de442d6bfaef9c102cd1092e6cae22b753

> Fixes: 0b37ac63fc9d ("drm/msm/dpu: use drmm_writeback_connector_init()")
> Reported-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> Closes: https://lore.kernel.org/r/78c764b8-44cf-4db5-88e7-807a85954518@wanadoo.fr
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
> ---
>  drivers/gpu/drm/msm/disp/dpu1/dpu_writeback.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_writeback.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_writeback.c
> index 7545c0293efb..6f2370c9dd98 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_writeback.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_writeback.c
> @@ -5,6 +5,7 @@
>
>  #include <drm/drm_edid.h>
>  #include <drm/drm_framebuffer.h>
> +#include <drm/drm_managed.h>
>
>  #include "dpu_writeback.h"
>
> @@ -125,7 +126,7 @@ int dpu_writeback_init(struct drm_device *dev, struct drm_encoder *enc,
>         struct dpu_wb_connector *dpu_wb_conn;
>         int rc = 0;
>
> -       dpu_wb_conn = devm_kzalloc(dev->dev, sizeof(*dpu_wb_conn), GFP_KERNEL);
> +       dpu_wb_conn = drmm_kzalloc(dev, sizeof(*dpu_wb_conn), GFP_KERNEL);
>         if (!dpu_wb_conn)
>                 return -ENOMEM;
>
>
> --
> 2.47.3
>

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

* Re: [PATCH v5 1/8] drm/msm/dpu: don't mix devm and drmm functions
  2026-05-05 21:49   ` Rob Clark
@ 2026-05-07 16:14     ` John Harrison
  2026-05-07 16:28     ` John Harrison
  1 sibling, 0 replies; 22+ messages in thread
From: John Harrison @ 2026-05-07 16:14 UTC (permalink / raw)
  To: rob.clark, Dmitry Baryshkov
  Cc: Jani Nikula, Kandpal, Suraj, Harry Wentland, Leo Li,
	Rodrigo Siqueira, Alex Deucher, Christian König,
	David Airlie, Simona Vetter, Liviu Dudau, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, Dmitry Baryshkov, Abhinav Kumar,
	Sean Paul, Marijn Suijten, Laurent Pinchart, Tomi Valkeinen,
	Kieran Bingham, Geert Uytterhoeven, Magnus Damm, Dave Stevenson,
	Maíra Canal, Raspberry Pi Kernel Maintenance,
	Christophe JAILLET, Jessica Zhang, Louis Chauvet, amd-gfx,
	dri-devel, linux-kernel, linux-arm-msm, freedreno,
	linux-renesas-soc, kernel-dev

[-- Attachment #1: Type: text/plain, Size: 2593 bytes --]

On 5/5/26 14:49, Rob Clark wrote:
> On Mon, May 4, 2026 at 5:25 PM Dmitry Baryshkov
> <dmitry.baryshkov@oss.qualcomm.com> wrote:
>> Mixing devm and drmm functions will result in a use-after-free on msm
>> driver teardown if userspace keeps a reference on the drm device:
>> The WB connector data will be destroyed because of the use of
>> devm_kzalloc()), while the usersoace still can try interacting with the
>> WB connector (which uses drmm_ functions).
>>
>> Change dpu_writeback_init() to use drmm_.
>  From [1] it doesn't sound like userspace holding the drm device open
> is the issue (if that were possible, it seems like it would go badly),
> but rather the order of managed cleanup?
>
> [1]https://web.git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/drivers/gpu/drm/xe/xe_hwmon.c?id=3a13c2de442d6bfaef9c102cd1092e6cae22b753
So is this not an actual issue that has been seen in the wild? It is 
just a theoretical issue based on code observation?

If so, then maybe the comment should just be something like:

    dpu_writeback_init() was mixing devm and drmm functions - allocating
    using devm and then passing to drmm to manage. This creates the
    potential for a use-after-free bug as drmm and devm have different
    lifetimes. Fix that by consistently using drmm management.


John.


>
>> Fixes: 0b37ac63fc9d ("drm/msm/dpu: use drmm_writeback_connector_init()")
>> Reported-by: Christophe JAILLET<christophe.jaillet@wanadoo.fr>
>> Closes:https://lore.kernel.org/r/78c764b8-44cf-4db5-88e7-807a85954518@wanadoo.fr
>> Signed-off-by: Dmitry Baryshkov<dmitry.baryshkov@oss.qualcomm.com>
>> ---
>>   drivers/gpu/drm/msm/disp/dpu1/dpu_writeback.c | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_writeback.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_writeback.c
>> index 7545c0293efb..6f2370c9dd98 100644
>> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_writeback.c
>> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_writeback.c
>> @@ -5,6 +5,7 @@
>>
>>   #include <drm/drm_edid.h>
>>   #include <drm/drm_framebuffer.h>
>> +#include <drm/drm_managed.h>
>>
>>   #include "dpu_writeback.h"
>>
>> @@ -125,7 +126,7 @@ int dpu_writeback_init(struct drm_device *dev, struct drm_encoder *enc,
>>          struct dpu_wb_connector *dpu_wb_conn;
>>          int rc = 0;
>>
>> -       dpu_wb_conn = devm_kzalloc(dev->dev, sizeof(*dpu_wb_conn), GFP_KERNEL);
>> +       dpu_wb_conn = drmm_kzalloc(dev, sizeof(*dpu_wb_conn), GFP_KERNEL);
>>          if (!dpu_wb_conn)
>>                  return -ENOMEM;
>>
>>
>> --
>> 2.47.3
>>

[-- Attachment #2: Type: text/html, Size: 3957 bytes --]

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

* Re: [PATCH v5 1/8] drm/msm/dpu: don't mix devm and drmm functions
  2026-05-05 21:49   ` Rob Clark
  2026-05-07 16:14     ` John Harrison
@ 2026-05-07 16:28     ` John Harrison
  2026-05-07 16:30       ` Rob Clark
  1 sibling, 1 reply; 22+ messages in thread
From: John Harrison @ 2026-05-07 16:28 UTC (permalink / raw)
  To: rob.clark, Dmitry Baryshkov
  Cc: Jani Nikula, Kandpal, Suraj, Harry Wentland, Leo Li,
	Rodrigo Siqueira, Alex Deucher, Christian König,
	David Airlie, Simona Vetter, Liviu Dudau, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, Dmitry Baryshkov, Abhinav Kumar,
	Sean Paul, Marijn Suijten, Laurent Pinchart, Tomi Valkeinen,
	Kieran Bingham, Geert Uytterhoeven, Magnus Damm, Dave Stevenson,
	Maíra Canal, Raspberry Pi Kernel Maintenance,
	Christophe JAILLET, Jessica Zhang, Louis Chauvet, amd-gfx,
	dri-devel, linux-kernel, linux-arm-msm, freedreno,
	linux-renesas-soc

Resending because apparently it got sent as HTML and was rejected by the 
mailing lists...

On 5/5/26 14:49, Rob Clark wrote:
> On Mon, May 4, 2026 at 5:25 PM Dmitry Baryshkov
> <dmitry.baryshkov@oss.qualcomm.com> wrote:
>> Mixing devm and drmm functions will result in a use-after-free on msm
>> driver teardown if userspace keeps a reference on the drm device:
>> The WB connector data will be destroyed because of the use of
>> devm_kzalloc()), while the usersoace still can try interacting with the
>> WB connector (which uses drmm_ functions).
>>
>> Change dpu_writeback_init() to use drmm_.
>  From [1] it doesn't sound like userspace holding the drm device open
> is the issue (if that were possible, it seems like it would go badly),
> but rather the order of managed cleanup?
>
> [1] https://web.git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/drivers/gpu/drm/xe/xe_hwmon.c?id=3a13c2de442d6bfaef9c102cd1092e6cae22b753
So is this not an actual issue that has been seen in the wild? It is 
just a theoretical issue based on code observation?

If so, then maybe the comment should just be something like:

    dpu_writeback_init() was mixing devm and drmm functions - allocating
    using devm and then passing to drmm to manage. This creates the
    potential for a use-after-free bug as drmm and devm have different
    lifetimes. Fix that by consistently using drmm management.


John.

>
>> Fixes: 0b37ac63fc9d ("drm/msm/dpu: use drmm_writeback_connector_init()")
>> Reported-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
>> Closes: https://lore.kernel.org/r/78c764b8-44cf-4db5-88e7-807a85954518@wanadoo.fr
>> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
>> ---
>>   drivers/gpu/drm/msm/disp/dpu1/dpu_writeback.c | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_writeback.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_writeback.c
>> index 7545c0293efb..6f2370c9dd98 100644
>> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_writeback.c
>> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_writeback.c
>> @@ -5,6 +5,7 @@
>>
>>   #include <drm/drm_edid.h>
>>   #include <drm/drm_framebuffer.h>
>> +#include <drm/drm_managed.h>
>>
>>   #include "dpu_writeback.h"
>>
>> @@ -125,7 +126,7 @@ int dpu_writeback_init(struct drm_device *dev, struct drm_encoder *enc,
>>          struct dpu_wb_connector *dpu_wb_conn;
>>          int rc = 0;
>>
>> -       dpu_wb_conn = devm_kzalloc(dev->dev, sizeof(*dpu_wb_conn), GFP_KERNEL);
>> +       dpu_wb_conn = drmm_kzalloc(dev, sizeof(*dpu_wb_conn), GFP_KERNEL);
>>          if (!dpu_wb_conn)
>>                  return -ENOMEM;
>>
>>
>> --
>> 2.47.3
>>


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

* Re: [PATCH v5 1/8] drm/msm/dpu: don't mix devm and drmm functions
  2026-05-07 16:28     ` John Harrison
@ 2026-05-07 16:30       ` Rob Clark
  2026-05-08 12:07         ` Dmitry Baryshkov
  0 siblings, 1 reply; 22+ messages in thread
From: Rob Clark @ 2026-05-07 16:30 UTC (permalink / raw)
  To: John Harrison
  Cc: Dmitry Baryshkov, Jani Nikula, Kandpal, Suraj, Harry Wentland,
	Leo Li, Rodrigo Siqueira, Alex Deucher, Christian König,
	David Airlie, Simona Vetter, Liviu Dudau, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, Dmitry Baryshkov, Abhinav Kumar,
	Sean Paul, Marijn Suijten, Laurent Pinchart, Tomi Valkeinen,
	Kieran Bingham, Geert Uytterhoeven, Magnus Damm, Dave Stevenson,
	Maíra Canal, Raspberry Pi Kernel Maintenance,
	Christophe JAILLET, Jessica Zhang, Louis Chauvet, amd-gfx,
	dri-devel, linux-kernel, linux-arm-msm, freedreno,
	linux-renesas-soc

On Thu, May 7, 2026 at 9:29 AM John Harrison <John.Harrison@igalia.com> wrote:
>
> Resending because apparently it got sent as HTML and was rejected by the
> mailing lists...
>
> On 5/5/26 14:49, Rob Clark wrote:
> > On Mon, May 4, 2026 at 5:25 PM Dmitry Baryshkov
> > <dmitry.baryshkov@oss.qualcomm.com> wrote:
> >> Mixing devm and drmm functions will result in a use-after-free on msm
> >> driver teardown if userspace keeps a reference on the drm device:
> >> The WB connector data will be destroyed because of the use of
> >> devm_kzalloc()), while the usersoace still can try interacting with the
> >> WB connector (which uses drmm_ functions).
> >>
> >> Change dpu_writeback_init() to use drmm_.
> >  From [1] it doesn't sound like userspace holding the drm device open
> > is the issue (if that were possible, it seems like it would go badly),
> > but rather the order of managed cleanup?
> >
> > [1] https://web.git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/drivers/gpu/drm/xe/xe_hwmon.c?id=3a13c2de442d6bfaef9c102cd1092e6cae22b753
> So is this not an actual issue that has been seen in the wild? It is
> just a theoretical issue based on code observation?
>
> If so, then maybe the comment should just be something like:
>
>     dpu_writeback_init() was mixing devm and drmm functions - allocating
>     using devm and then passing to drmm to manage. This creates the
>     potential for a use-after-free bug as drmm and devm have different
>     lifetimes. Fix that by consistently using drmm management.
>

I've not seen this issue myself, but I guess Dmitry has.  That comment
sounds more in-line with what I _think_ is happening..

BR,
-R

>
> John.
>
> >
> >> Fixes: 0b37ac63fc9d ("drm/msm/dpu: use drmm_writeback_connector_init()")
> >> Reported-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> >> Closes: https://lore.kernel.org/r/78c764b8-44cf-4db5-88e7-807a85954518@wanadoo.fr
> >> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
> >> ---
> >>   drivers/gpu/drm/msm/disp/dpu1/dpu_writeback.c | 3 ++-
> >>   1 file changed, 2 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_writeback.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_writeback.c
> >> index 7545c0293efb..6f2370c9dd98 100644
> >> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_writeback.c
> >> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_writeback.c
> >> @@ -5,6 +5,7 @@
> >>
> >>   #include <drm/drm_edid.h>
> >>   #include <drm/drm_framebuffer.h>
> >> +#include <drm/drm_managed.h>
> >>
> >>   #include "dpu_writeback.h"
> >>
> >> @@ -125,7 +126,7 @@ int dpu_writeback_init(struct drm_device *dev, struct drm_encoder *enc,
> >>          struct dpu_wb_connector *dpu_wb_conn;
> >>          int rc = 0;
> >>
> >> -       dpu_wb_conn = devm_kzalloc(dev->dev, sizeof(*dpu_wb_conn), GFP_KERNEL);
> >> +       dpu_wb_conn = drmm_kzalloc(dev, sizeof(*dpu_wb_conn), GFP_KERNEL);
> >>          if (!dpu_wb_conn)
> >>                  return -ENOMEM;
> >>
> >>
> >> --
> >> 2.47.3
> >>
>

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

* Re: [PATCH v5 1/8] drm/msm/dpu: don't mix devm and drmm functions
  2026-05-07 16:30       ` Rob Clark
@ 2026-05-08 12:07         ` Dmitry Baryshkov
  0 siblings, 0 replies; 22+ messages in thread
From: Dmitry Baryshkov @ 2026-05-08 12:07 UTC (permalink / raw)
  To: Rob Clark
  Cc: John Harrison, Jani Nikula, Kandpal, Suraj, Harry Wentland,
	Leo Li, Rodrigo Siqueira, Alex Deucher, Christian König,
	David Airlie, Simona Vetter, Liviu Dudau, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, Dmitry Baryshkov, Abhinav Kumar,
	Sean Paul, Marijn Suijten, Laurent Pinchart, Tomi Valkeinen,
	Kieran Bingham, Geert Uytterhoeven, Magnus Damm, Dave Stevenson,
	Maíra Canal, Raspberry Pi Kernel Maintenance,
	Christophe JAILLET, Jessica Zhang, Louis Chauvet, amd-gfx,
	dri-devel, linux-kernel, linux-arm-msm, freedreno,
	linux-renesas-soc

On Thu, May 07, 2026 at 09:30:44AM -0700, Rob Clark wrote:
> On Thu, May 7, 2026 at 9:29 AM John Harrison <John.Harrison@igalia.com> wrote:
> >
> > Resending because apparently it got sent as HTML and was rejected by the
> > mailing lists...
> >
> > On 5/5/26 14:49, Rob Clark wrote:
> > > On Mon, May 4, 2026 at 5:25 PM Dmitry Baryshkov
> > > <dmitry.baryshkov@oss.qualcomm.com> wrote:
> > >> Mixing devm and drmm functions will result in a use-after-free on msm
> > >> driver teardown if userspace keeps a reference on the drm device:
> > >> The WB connector data will be destroyed because of the use of
> > >> devm_kzalloc()), while the usersoace still can try interacting with the
> > >> WB connector (which uses drmm_ functions).
> > >>
> > >> Change dpu_writeback_init() to use drmm_.
> > >  From [1] it doesn't sound like userspace holding the drm device open
> > > is the issue (if that were possible, it seems like it would go badly),
> > > but rather the order of managed cleanup?
> > >
> > > [1] https://web.git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/drivers/gpu/drm/xe/xe_hwmon.c?id=3a13c2de442d6bfaef9c102cd1092e6cae22b753
> > So is this not an actual issue that has been seen in the wild? It is
> > just a theoretical issue based on code observation?
> >
> > If so, then maybe the comment should just be something like:
> >
> >     dpu_writeback_init() was mixing devm and drmm functions - allocating
> >     using devm and then passing to drmm to manage. This creates the
> >     potential for a use-after-free bug as drmm and devm have different
> >     lifetimes. Fix that by consistently using drmm management.
> >
> 
> I've not seen this issue myself, but I guess Dmitry has.  That comment
> sounds more in-line with what I _think_ is happening..

No, I also haven't seen it. It's a teoretical issue from my PoV.


-- 
With best wishes
Dmitry

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

* Re: [PATCH v5 0/8] drm: writeback: clean up writeback connector initialization
  2026-05-05  0:24 [PATCH v5 0/8] drm: writeback: clean up writeback connector initialization Dmitry Baryshkov
                   ` (7 preceding siblings ...)
  2026-05-05  0:25 ` [PATCH v5 8/8] drm: writeback: rename drm_writeback_connector_init_with_encoder() Dmitry Baryshkov
@ 2026-05-16 15:25 ` Dmitry Baryshkov
  2026-05-19 16:59   ` John Harrison
  8 siblings, 1 reply; 22+ messages in thread
From: Dmitry Baryshkov @ 2026-05-16 15:25 UTC (permalink / raw)
  To: Jani Nikula, Kandpal, Suraj, Harry Wentland, Leo Li,
	Rodrigo Siqueira, Alex Deucher, Christian König,
	David Airlie, Simona Vetter, Liviu Dudau, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, Rob Clark, Dmitry Baryshkov,
	Abhinav Kumar, Sean Paul, Marijn Suijten, Laurent Pinchart,
	Tomi Valkeinen, Kieran Bingham, Geert Uytterhoeven, Magnus Damm,
	Dave Stevenson, Maíra Canal, Raspberry Pi Kernel Maintenance,
	Christophe JAILLET, Jessica Zhang, Louis Chauvet,
	Dmitry Baryshkov
  Cc: amd-gfx, dri-devel, linux-kernel, linux-arm-msm, freedreno,
	linux-renesas-soc

On Tue, 05 May 2026 03:24:57 +0300, Dmitry Baryshkov wrote:
> Drivers using drm_writeback_connector_init() / _with_encoder() don't
> perform cleanup in a manner similar to drmm_writeback_connector_init()
> (see drm_writeback_connector_cleanup()). Migrate all existing drivers
> to use drmm_writeback_connector_init(), drop
> drm_writeback_connector_init() and drm_writeback_connector::encoder
> (it's unused afterwards).
> 
> [...]

Applied to msm-fixes, thanks!

[1/8] drm/msm/dpu: don't mix devm and drmm functions
      https://gitlab.freedesktop.org/lumag/msm/-/commit/c0c70a11365c

Best regards,
-- 
With best wishes
Dmitry



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

* Re: [PATCH v5 0/8] drm: writeback: clean up writeback connector initialization
  2026-05-16 15:25 ` [PATCH v5 0/8] drm: writeback: clean up writeback connector initialization Dmitry Baryshkov
@ 2026-05-19 16:59   ` John Harrison
  2026-05-20 13:04     ` Dmitry Baryshkov
  0 siblings, 1 reply; 22+ messages in thread
From: John Harrison @ 2026-05-19 16:59 UTC (permalink / raw)
  To: Dmitry Baryshkov, Jani Nikula, Kandpal, Suraj, Harry Wentland,
	Leo Li, Rodrigo Siqueira, Alex Deucher, Christian König,
	David Airlie, Simona Vetter, Liviu Dudau, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, Rob Clark, Dmitry Baryshkov,
	Abhinav Kumar, Sean Paul, Marijn Suijten, Laurent Pinchart,
	Tomi Valkeinen, Kieran Bingham, Geert Uytterhoeven, Magnus Damm,
	Dave Stevenson, Maíra Canal, Raspberry Pi Kernel Maintenance,
	Christophe JAILLET, Jessica Zhang, Louis Chauvet
  Cc: amd-gfx, dri-devel, linux-kernel, linux-arm-msm, freedreno,
	linux-renesas-soc

On 5/16/26 08:25, Dmitry Baryshkov wrote:
> On Tue, 05 May 2026 03:24:57 +0300, Dmitry Baryshkov wrote:
>> Drivers using drm_writeback_connector_init() / _with_encoder() don't
>> perform cleanup in a manner similar to drmm_writeback_connector_init()
>> (see drm_writeback_connector_cleanup()). Migrate all existing drivers
>> to use drmm_writeback_connector_init(), drop
>> drm_writeback_connector_init() and drm_writeback_connector::encoder
>> (it's unused afterwards).
>>
>> [...]
> Applied to msm-fixes, thanks!
>
> [1/8] drm/msm/dpu: don't mix devm and drmm functions
>        https://gitlab.freedesktop.org/lumag/msm/-/commit/c0c70a11365c
>
> Best regards,
That is only the first patch of the series, yes?

What is happening with the rest? Can they all be merged to drm-next now? 
As I understand it, only the first patch was still being discussed, the 
others have all been reviewed some time ago.

Thanks,
John.


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

* Re: [PATCH v5 0/8] drm: writeback: clean up writeback connector initialization
  2026-05-19 16:59   ` John Harrison
@ 2026-05-20 13:04     ` Dmitry Baryshkov
  2026-05-20 22:50       ` Rodrigo Siqueira
  0 siblings, 1 reply; 22+ messages in thread
From: Dmitry Baryshkov @ 2026-05-20 13:04 UTC (permalink / raw)
  To: John Harrison
  Cc: Jani Nikula, Kandpal, Suraj, Harry Wentland, Leo Li,
	Rodrigo Siqueira, Alex Deucher, Christian König,
	David Airlie, Simona Vetter, Liviu Dudau, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, Rob Clark, Dmitry Baryshkov,
	Abhinav Kumar, Sean Paul, Marijn Suijten, Laurent Pinchart,
	Tomi Valkeinen, Kieran Bingham, Geert Uytterhoeven, Magnus Damm,
	Dave Stevenson, Maíra Canal, Raspberry Pi Kernel Maintenance,
	Christophe JAILLET, Jessica Zhang, Louis Chauvet, amd-gfx,
	dri-devel, linux-kernel, linux-arm-msm, freedreno,
	linux-renesas-soc

On Tue, May 19, 2026 at 09:59:00AM -0700, John Harrison wrote:
> On 5/16/26 08:25, Dmitry Baryshkov wrote:
> > On Tue, 05 May 2026 03:24:57 +0300, Dmitry Baryshkov wrote:
> > > Drivers using drm_writeback_connector_init() / _with_encoder() don't
> > > perform cleanup in a manner similar to drmm_writeback_connector_init()
> > > (see drm_writeback_connector_cleanup()). Migrate all existing drivers
> > > to use drmm_writeback_connector_init(), drop
> > > drm_writeback_connector_init() and drm_writeback_connector::encoder
> > > (it's unused afterwards).
> > > 
> > > [...]
> > Applied to msm-fixes, thanks!
> > 
> > [1/8] drm/msm/dpu: don't mix devm and drmm functions
> >        https://gitlab.freedesktop.org/lumag/msm/-/commit/c0c70a11365c
> > 
> > Best regards,
> That is only the first patch of the series, yes?

Yes, correct.

> 
> What is happening with the rest? Can they all be merged to drm-next now? As
> I understand it, only the first patch was still being discussed, the others
> have all been reviewed some time ago.

At least we need an ack from the AMD maintainers. I can pick up patches
3-6 to drm-misc-next, but it doesn't really help because the rest of the
patches are blocked by the AMD change.

-- 
With best wishes
Dmitry

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

* Re: [PATCH v5 0/8] drm: writeback: clean up writeback connector initialization
  2026-05-20 13:04     ` Dmitry Baryshkov
@ 2026-05-20 22:50       ` Rodrigo Siqueira
  0 siblings, 0 replies; 22+ messages in thread
From: Rodrigo Siqueira @ 2026-05-20 22:50 UTC (permalink / raw)
  To: Alex Hung, Harry Wentland
  Cc: John Harrison, Jani Nikula, Kandpal, Suraj, Harry Wentland,
	Leo Li, Alex Deucher, Christian König, David Airlie,
	Simona Vetter, Liviu Dudau, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, Rob Clark, Dmitry Baryshkov, Abhinav Kumar,
	Sean Paul, Marijn Suijten, Laurent Pinchart, Tomi Valkeinen,
	Kieran Bingham, Geert Uytterhoeven, Magnus Damm, Dave Stevenson,
	Maíra Canal, Raspberry Pi Kernel Maintenance,
	Christophe JAILLET, Jessica Zhang, Louis Chauvet,
	Dmitry Baryshkov, amd-gfx, dri-devel, linux-kernel, linux-arm-msm,
	freedreno, linux-renesas-soc

On 05/20, Dmitry Baryshkov wrote:
> On Tue, May 19, 2026 at 09:59:00AM -0700, John Harrison wrote:
> > On 5/16/26 08:25, Dmitry Baryshkov wrote:
> > > On Tue, 05 May 2026 03:24:57 +0300, Dmitry Baryshkov wrote:
> > > > Drivers using drm_writeback_connector_init() / _with_encoder() don't
> > > > perform cleanup in a manner similar to drmm_writeback_connector_init()
> > > > (see drm_writeback_connector_cleanup()). Migrate all existing drivers
> > > > to use drmm_writeback_connector_init(), drop
> > > > drm_writeback_connector_init() and drm_writeback_connector::encoder
> > > > (it's unused afterwards).
> > > > 
> > > > [...]
> > > Applied to msm-fixes, thanks!
> > > 
> > > [1/8] drm/msm/dpu: don't mix devm and drmm functions
> > >        https://gitlab.freedesktop.org/lumag/msm/-/commit/c0c70a11365c
> > > 
> > > Best regards,
> > That is only the first patch of the series, yes?
> 
> Yes, correct.
> 
> > 
> > What is happening with the rest? Can they all be merged to drm-next now? As
> > I understand it, only the first patch was still being discussed, the others
> > have all been reviewed some time ago.
> 
> At least we need an ack from the AMD maintainers. I can pick up patches
> 3-6 to drm-misc-next, but it doesn't really help because the rest of the
> patches are blocked by the AMD change.


Hi Alex, Harry,

Could we have your acked-by for this series? I tested it with a DCN
4.0.1 and the kms_writeback test; everything looks fine. This series
should not cause regressions because the AMD modifications are
restricted to the writeback functions; if you want to be sure and cover
more hardware, it can be useful to run it through AMD CI (you just need
to make a few minor adjustments when applying it to the
amd-staging-drm-next).

Anyway, this series was

Tested-by: Rodrigo Siqueira <siqueira@igalia.com>

Thanks

> 
> -- 
> With best wishes
> Dmitry

-- 
Rodrigo Siqueira

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

* Re: [PATCH v5 2/8] drm/amd/display: use drmm_writeback_connector_init()
  2026-05-05  0:24 ` [PATCH v5 2/8] drm/amd/display: use drmm_writeback_connector_init() Dmitry Baryshkov
@ 2026-05-26 18:46   ` Alex Hung
  0 siblings, 0 replies; 22+ messages in thread
From: Alex Hung @ 2026-05-26 18:46 UTC (permalink / raw)
  To: Dmitry Baryshkov, Jani Nikula, Kandpal, Suraj, Harry Wentland,
	Leo Li, Rodrigo Siqueira, Alex Deucher, Christian König,
	David Airlie, Simona Vetter, Liviu Dudau, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, Rob Clark, Dmitry Baryshkov,
	Abhinav Kumar, Sean Paul, Marijn Suijten, Laurent Pinchart,
	Tomi Valkeinen, Kieran Bingham, Geert Uytterhoeven, Magnus Damm,
	Dave Stevenson, Maíra Canal, Raspberry Pi Kernel Maintenance,
	Christophe JAILLET, Jessica Zhang, Louis Chauvet
  Cc: amd-gfx, dri-devel, linux-kernel, linux-arm-msm, freedreno,
	linux-renesas-soc

Will allocating wbcon with drmm_kzalloc before calling 
amdgpu_dm_wb_connector_init be more memory-safe as below?


@@ -5790,7 +5791,8 @@ static int amdgpu_dm_initialize_drm_device(struct 
amdgpu_device *adev)
  		link = dc_get_link_at_index(dm->dc, i);

  		if (link->connector_signal == SIGNAL_TYPE_VIRTUAL) {
-			struct amdgpu_dm_wb_connector *wbcon = kzalloc_obj(*wbcon);
+			struct amdgpu_dm_wb_connector *wbcon =
+				drmm_kzalloc(adev_to_drm(adev), sizeof(*wbcon), GFP_KERNEL);

  			if (!wbcon) {
  				drm_err(adev_to_drm(adev), "KMS: Failed to allocate writeback 
connector\n");
@@ -5799,7 +5801,6 @@ static int amdgpu_dm_initialize_drm_device(struct 
amdgpu_device *adev)

  			if (amdgpu_dm_wb_connector_init(dm, wbcon, i)) {
  				drm_err(adev_to_drm(adev), "KMS: Failed to initialize writeback 
connector\n");
-				kfree(wbcon);
  				continue;
  			}

On 5/4/26 18:24, Dmitry Baryshkov wrote:
> The driver uses drm_writeback_connector_init() instead of its drmm
> counterpart, but it doesn't perform the job queue cleanup (neither
> manually nor by calling drm_writeback_connector_cleanup()). On the
> contrary, the drmm_writeback_connector_init() function ensures the
> proper cleanup of the job queue.
> 
> Use drmm_plain_encoder_alloc() to allocate simple encoder and
> drmm_writeback_connector_init() in order to initialize writeback
> connector instance.
> 
> Reviewed-by: Louis Chauvet <louis.chauvet@bootlin.com>
> Reviewed-by: Suraj Kandpal <suraj.kandpal@intel.com>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
> ---
>   drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c    |  2 +-
>   drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_wb.c | 18 +++++++++++++-----
>   2 files changed, 14 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index e96a12ff2d31..2ac64495cdb7 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -10683,7 +10683,7 @@ static void dm_set_writeback(struct amdgpu_display_manager *dm,
>   		return;
>   	}
>   
> -	acrtc = to_amdgpu_crtc(wb_conn->encoder.crtc);
> +	acrtc = to_amdgpu_crtc(crtc_state->base.crtc);
>   	if (!acrtc) {
>   		drm_err(adev_to_drm(adev), "no amdgpu_crtc found\n");
>   		kfree(wb_info);
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_wb.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_wb.c
> index 110f0173eee6..fdc3da40452f 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_wb.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_wb.c
> @@ -169,7 +169,6 @@ static const struct drm_encoder_helper_funcs amdgpu_dm_wb_encoder_helper_funcs =
>   
>   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_duplicate_state = amdgpu_dm_connector_atomic_duplicate_state,
>   	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
> @@ -188,17 +187,26 @@ int amdgpu_dm_wb_connector_init(struct amdgpu_display_manager *dm,
>   	struct dc *dc = dm->dc;
>   	struct dc_link *link = dc_get_link_at_index(dc, link_index);
>   	int res = 0;
> +	struct drm_encoder *encoder;
> +
> +	encoder = drmm_plain_encoder_alloc(&dm->adev->ddev, NULL,
> +					   DRM_MODE_ENCODER_VIRTUAL, NULL);
> +	if (IS_ERR(encoder))
> +		return PTR_ERR(encoder);
> +
> +	drm_encoder_helper_add(encoder, &amdgpu_dm_wb_encoder_helper_funcs);
> +
> +	encoder->possible_crtcs = amdgpu_dm_get_encoder_crtc_mask(dm->adev);
>   
>   	wbcon->link = link;
>   
>   	drm_connector_helper_add(&wbcon->base.base, &amdgpu_dm_wb_conn_helper_funcs);
>   
> -	res = drm_writeback_connector_init(&dm->adev->ddev, &wbcon->base,
> +	res = drmm_writeback_connector_init(&dm->adev->ddev, &wbcon->base,
>   					    &amdgpu_dm_wb_connector_funcs,
> -					    &amdgpu_dm_wb_encoder_helper_funcs,
> +					    encoder,
>   					    amdgpu_dm_wb_formats,
> -					    ARRAY_SIZE(amdgpu_dm_wb_formats),
> -					    amdgpu_dm_get_encoder_crtc_mask(dm->adev));
> +					    ARRAY_SIZE(amdgpu_dm_wb_formats));
>   
>   	if (res)
>   		return res;
> 


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

* Re: [PATCH v5 3/8] drm/komeda: use drmm_writeback_connector_init()
  2026-05-05  0:25 ` [PATCH v5 3/8] drm/komeda: " Dmitry Baryshkov
@ 2026-06-02 10:32   ` Liviu Dudau
  0 siblings, 0 replies; 22+ messages in thread
From: Liviu Dudau @ 2026-06-02 10:32 UTC (permalink / raw)
  To: Dmitry Baryshkov
  Cc: Jani Nikula, Kandpal, Suraj, Harry Wentland, Leo Li,
	Rodrigo Siqueira, Alex Deucher, Christian König,
	David Airlie, Simona Vetter, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, Rob Clark, Dmitry Baryshkov, Abhinav Kumar,
	Sean Paul, Marijn Suijten, Laurent Pinchart, Tomi Valkeinen,
	Kieran Bingham, Geert Uytterhoeven, Magnus Damm, Dave Stevenson,
	Maíra Canal, Raspberry Pi Kernel Maintenance,
	Christophe JAILLET, Jessica Zhang, Louis Chauvet, amd-gfx,
	dri-devel, linux-kernel, linux-arm-msm, freedreno,
	linux-renesas-soc

On Tue, May 05, 2026 at 03:25:00AM +0300, Dmitry Baryshkov wrote:
> The driver uses drm_writeback_connector_init() instead of its drmm
> counterpart, but it doesn't perform the job queue cleanup (neither
> manually nor by calling drm_writeback_connector_cleanup()). On the
> contrary, the drmm_writeback_connector_init() function ensures the
> proper cleanup of the job queue.
> 
> Use drmm_plain_encoder_alloc() to allocate simple encoder and
> drmm_writeback_connector_init() in order to initialize writeback
> connector instance.
> 
> Reviewed-by: Suraj Kandpal <suraj.kandpal@intel.com>
> Reviewed-by: Louis Chauvet <louis.chauvet@bootlin.com>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>

Reviewed-by: Liviu Dudau <liviu.dudau@arm.com>

Best regards,
Liviu

> ---
>  .../drm/arm/display/komeda/komeda_wb_connector.c   | 30 ++++++++++++----------
>  1 file changed, 17 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_wb_connector.c b/drivers/gpu/drm/arm/display/komeda/komeda_wb_connector.c
> index 41cc3e080dc9..bcc53d4015f1 100644
> --- a/drivers/gpu/drm/arm/display/komeda/komeda_wb_connector.c
> +++ b/drivers/gpu/drm/arm/display/komeda/komeda_wb_connector.c
> @@ -5,6 +5,7 @@
>   *
>   */
>  #include <drm/drm_framebuffer.h>
> +#include <drm/drm_managed.h>
>  #include "komeda_dev.h"
>  #include "komeda_kms.h"
>  
> @@ -121,17 +122,10 @@ komeda_wb_connector_fill_modes(struct drm_connector *connector,
>  	return 0;
>  }
>  
> -static void komeda_wb_connector_destroy(struct drm_connector *connector)
> -{
> -	drm_connector_cleanup(connector);
> -	kfree(to_kconn(to_wb_conn(connector)));
> -}
> -
>  static const struct drm_connector_funcs komeda_wb_connector_funcs = {
>  	.reset			= drm_atomic_helper_connector_reset,
>  	.detect			= komeda_wb_connector_detect,
>  	.fill_modes		= komeda_wb_connector_fill_modes,
> -	.destroy		= komeda_wb_connector_destroy,
>  	.atomic_duplicate_state	= drm_atomic_helper_connector_duplicate_state,
>  	.atomic_destroy_state	= drm_atomic_helper_connector_destroy_state,
>  };
> @@ -143,13 +137,15 @@ static int komeda_wb_connector_add(struct komeda_kms_dev *kms,
>  	struct komeda_wb_connector *kwb_conn;
>  	struct drm_writeback_connector *wb_conn;
>  	struct drm_display_info *info;
> +	struct drm_encoder *encoder;
> +
>  	u32 *formats, n_formats = 0;
>  	int err;
>  
>  	if (!kcrtc->master->wb_layer)
>  		return 0;
>  
> -	kwb_conn = kzalloc_obj(*kwb_conn);
> +	kwb_conn = drmm_kzalloc(&kms->base, sizeof(*kwb_conn), GFP_KERNEL);
>  	if (!kwb_conn)
>  		return -ENOMEM;
>  
> @@ -165,11 +161,19 @@ static int komeda_wb_connector_add(struct komeda_kms_dev *kms,
>  		return -ENOMEM;
>  	}
>  
> -	err = drm_writeback_connector_init(&kms->base, wb_conn,
> -					   &komeda_wb_connector_funcs,
> -					   &komeda_wb_encoder_helper_funcs,
> -					   formats, n_formats,
> -					   BIT(drm_crtc_index(&kcrtc->base)));
> +	encoder = drmm_plain_encoder_alloc(&kms->base, NULL,
> +					   DRM_MODE_ENCODER_VIRTUAL, NULL);
> +	if (IS_ERR(encoder))
> +		return PTR_ERR(encoder);
> +
> +	drm_encoder_helper_add(encoder, &komeda_wb_encoder_helper_funcs);
> +
> +	encoder->possible_crtcs = drm_crtc_mask(&kcrtc->base);
> +
> +	err = drmm_writeback_connector_init(&kms->base, wb_conn,
> +					    &komeda_wb_connector_funcs,
> +					    encoder,
> +					    formats, n_formats);
>  	komeda_put_fourcc_list(formats);
>  	if (err) {
>  		kfree(kwb_conn);
> 
> -- 
> 2.47.3
> 

-- 
====================
| I would like to |
| fix the world,  |
| but they're not |
| giving me the   |
 \ source code!  /
  ---------------
    ¯\_(ツ)_/¯

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

* Re: [PATCH v5 4/8] drm/mali: use drmm_writeback_connector_init()
  2026-05-05  0:25 ` [PATCH v5 4/8] drm/mali: " Dmitry Baryshkov
@ 2026-06-02 10:33   ` Liviu Dudau
  0 siblings, 0 replies; 22+ messages in thread
From: Liviu Dudau @ 2026-06-02 10:33 UTC (permalink / raw)
  To: Dmitry Baryshkov
  Cc: Jani Nikula, Kandpal, Suraj, Harry Wentland, Leo Li,
	Rodrigo Siqueira, Alex Deucher, Christian König,
	David Airlie, Simona Vetter, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, Rob Clark, Dmitry Baryshkov, Abhinav Kumar,
	Sean Paul, Marijn Suijten, Laurent Pinchart, Tomi Valkeinen,
	Kieran Bingham, Geert Uytterhoeven, Magnus Damm, Dave Stevenson,
	Maíra Canal, Raspberry Pi Kernel Maintenance,
	Christophe JAILLET, Jessica Zhang, Louis Chauvet, amd-gfx,
	dri-devel, linux-kernel, linux-arm-msm, freedreno,
	linux-renesas-soc

On Tue, May 05, 2026 at 03:25:01AM +0300, Dmitry Baryshkov wrote:
> The driver uses drm_writeback_connector_init() instead of its drmm
> counterpart, but it doesn't perform the job queue cleanup (neither
> manually nor by calling drm_writeback_connector_cleanup()). On the
> contrary, the drmm_writeback_connector_init() function ensures the
> proper cleanup of the job queue.
> 
> Use drmm_plain_encoder_alloc() to allocate simple encoder and
> drmm_writeback_connector_init() in order to initialize writeback
> connector instance.
> 
> Reviewed-by: Suraj Kandpal <suraj.kandpal@intel.com>
> Reviewed-by: Louis Chauvet <louis.chauvet@bootlin.com>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>

Reviewed-by: Liviu Dudau <liviu.dudau@arm.com>

Best regards,
Liviu

> ---
>  drivers/gpu/drm/arm/malidp_mw.c | 25 ++++++++++++++-----------
>  1 file changed, 14 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/gpu/drm/arm/malidp_mw.c b/drivers/gpu/drm/arm/malidp_mw.c
> index fad343842038..6e0c78e998aa 100644
> --- a/drivers/gpu/drm/arm/malidp_mw.c
> +++ b/drivers/gpu/drm/arm/malidp_mw.c
> @@ -84,11 +84,6 @@ malidp_mw_connector_detect(struct drm_connector *connector, bool force)
>  	return connector_status_connected;
>  }
>  
> -static void malidp_mw_connector_destroy(struct drm_connector *connector)
> -{
> -	drm_connector_cleanup(connector);
> -}
> -
>  static struct drm_connector_state *
>  malidp_mw_connector_duplicate_state(struct drm_connector *connector)
>  {
> @@ -114,7 +109,6 @@ static const struct drm_connector_funcs malidp_mw_connector_funcs = {
>  	.reset = malidp_mw_connector_reset,
>  	.detect = malidp_mw_connector_detect,
>  	.fill_modes = drm_helper_probe_single_connector_modes,
> -	.destroy = malidp_mw_connector_destroy,
>  	.atomic_duplicate_state = malidp_mw_connector_duplicate_state,
>  	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
>  };
> @@ -211,6 +205,7 @@ static u32 *get_writeback_formats(struct malidp_drm *malidp, int *n_formats)
>  int malidp_mw_connector_init(struct drm_device *drm)
>  {
>  	struct malidp_drm *malidp = drm_to_malidp(drm);
> +	struct drm_encoder *encoder;
>  	u32 *formats;
>  	int ret, n_formats;
>  
> @@ -224,11 +219,19 @@ int malidp_mw_connector_init(struct drm_device *drm)
>  	if (!formats)
>  		return -ENOMEM;
>  
> -	ret = drm_writeback_connector_init(drm, &malidp->mw_connector,
> -					   &malidp_mw_connector_funcs,
> -					   &malidp_mw_encoder_helper_funcs,
> -					   formats, n_formats,
> -					   1 << drm_crtc_index(&malidp->crtc));
> +	encoder = drmm_plain_encoder_alloc(drm, NULL, DRM_MODE_ENCODER_VIRTUAL,
> +					   NULL);
> +	if (IS_ERR(encoder))
> +		return PTR_ERR(encoder);
> +
> +	drm_encoder_helper_add(encoder, &malidp_mw_encoder_helper_funcs);
> +
> +	encoder->possible_crtcs = drm_crtc_mask(&malidp->crtc);
> +
> +	ret = drmm_writeback_connector_init(drm, &malidp->mw_connector,
> +					    &malidp_mw_connector_funcs,
> +					    encoder,
> +					    formats, n_formats);
>  	kfree(formats);
>  	if (ret)
>  		return ret;
> 
> -- 
> 2.47.3
> 

-- 
====================
| I would like to |
| fix the world,  |
| but they're not |
| giving me the   |
 \ source code!  /
  ---------------
    ¯\_(ツ)_/¯

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

end of thread, other threads:[~2026-06-02 10:34 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-05  0:24 [PATCH v5 0/8] drm: writeback: clean up writeback connector initialization Dmitry Baryshkov
2026-05-05  0:24 ` [PATCH v5 1/8] drm/msm/dpu: don't mix devm and drmm functions Dmitry Baryshkov
2026-05-05 18:35   ` John Harrison
2026-05-05 21:49   ` Rob Clark
2026-05-07 16:14     ` John Harrison
2026-05-07 16:28     ` John Harrison
2026-05-07 16:30       ` Rob Clark
2026-05-08 12:07         ` Dmitry Baryshkov
2026-05-05  0:24 ` [PATCH v5 2/8] drm/amd/display: use drmm_writeback_connector_init() Dmitry Baryshkov
2026-05-26 18:46   ` Alex Hung
2026-05-05  0:25 ` [PATCH v5 3/8] drm/komeda: " Dmitry Baryshkov
2026-06-02 10:32   ` Liviu Dudau
2026-05-05  0:25 ` [PATCH v5 4/8] drm/mali: " Dmitry Baryshkov
2026-06-02 10:33   ` Liviu Dudau
2026-05-05  0:25 ` [PATCH v5 5/8] drm: renesas: rcar-du: " Dmitry Baryshkov
2026-05-05  0:25 ` [PATCH v5 6/8] drm/vc4: " Dmitry Baryshkov
2026-05-05  0:25 ` [PATCH v5 7/8] drm: writeback: drop excess connector initialization functions Dmitry Baryshkov
2026-05-05  0:25 ` [PATCH v5 8/8] drm: writeback: rename drm_writeback_connector_init_with_encoder() Dmitry Baryshkov
2026-05-16 15:25 ` [PATCH v5 0/8] drm: writeback: clean up writeback connector initialization Dmitry Baryshkov
2026-05-19 16:59   ` John Harrison
2026-05-20 13:04     ` Dmitry Baryshkov
2026-05-20 22:50       ` Rodrigo Siqueira

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.