[PATCH v5 0/8] drm: writeback: clean up writeback connector initialization

Dmitry Baryshkov posted 8 patches 1 month, 1 week ago
There is a newer version of this series
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(-)
[PATCH v5 0/8] drm: writeback: clean up writeback connector initialization
Posted by Dmitry Baryshkov 1 month, 1 week ago
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
Re: [PATCH v5 0/8] drm: writeback: clean up writeback connector initialization
Posted by Dmitry Baryshkov 4 weeks ago
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
Re: [PATCH v5 0/8] drm: writeback: clean up writeback connector initialization
Posted by John Harrison 3 weeks, 4 days ago
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.
Re: [PATCH v5 0/8] drm: writeback: clean up writeback connector initialization
Posted by Dmitry Baryshkov 3 weeks, 3 days ago
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
Re: [PATCH v5 0/8] drm: writeback: clean up writeback connector initialization
Posted by Rodrigo Siqueira 3 weeks, 3 days ago
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