mbox series

[v4,00/13] drm/msm/dpu: use managed memory allocations

Message ID 20231201211845.1026967-1-dmitry.baryshkov@linaro.org (mailing list archive)
Headers show
Series drm/msm/dpu: use managed memory allocations | expand

Message

Dmitry Baryshkov Dec. 1, 2023, 9:18 p.m. UTC
In a lots of places in DPU driver memory is allocated by using the
kzalloc and then manually freed using kfree. However thes memory chunks
have a well-defined life cycle. They are either a part of the driver's
runtime and can be devm_kzalloc'ed or are exposed to userspace via the
DRM objects and thus can be drmm_alloc'ed. Implement corresponding
runtime resource manangement for the DPU driver.

Changes since v3:
- Rebased on top of msm-next

Changes since v2:
- Added missing dependencies to the cover letter (Jessica)
- Fixed commit message for patch 4 (Jessica)

Changes since v1:
- Fix error handling for some of drmm_foo_alloc() functions, which
  return error pointer in case of an error rather than typical NULL.

Dmitry Baryshkov (13):
  drm/msm/dpu: cleanup dpu_kms_hw_init error path
  drm/msm/dpu: remove IS_ERR_OR_NULL for dpu_hw_intr_init() error
    handling
  drm/msm/dpu: use devres-managed allocation for interrupts data
  drm/msm/dpu: use devres-managed allocation for VBIF data
  drm/msm/dpu: use devres-managed allocation for MDP TOP
  drm/msm/dpu: use devres-managed allocation for HW blocks
  drm/msm/dpu: drop unused dpu_plane::lock
  drm/msm/dpu: remove QoS teardown on plane destruction
  drm/msm/dpu: use drmm-managed allocation for dpu_plane
  drm/msm/dpu: use drmm-managed allocation for dpu_crtc
  drm/msm/dpu: use drmm-managed allocation for dpu_encoder_phys
  drm/msm/dpu: drop dpu_encoder_phys_ops::destroy
  drm/msm/dpu: use drmm-managed allocation for dpu_encoder_virt

 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c      | 25 ++----
 drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c   | 77 ++++------------
 .../gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h  | 10 +--
 .../drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c  | 15 +---
 .../drm/msm/disp/dpu1/dpu_encoder_phys_vid.c  | 13 +--
 .../drm/msm/disp/dpu1/dpu_encoder_phys_wb.c   | 21 +----
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c    | 19 ++--
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.h    | 16 ++--
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dsc.c    | 12 ++-
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dsc.h    | 10 ++-
 .../gpu/drm/msm/disp/dpu1/dpu_hw_dsc_1_2.c    |  7 +-
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dspp.c   | 16 ++--
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dspp.h   | 12 +--
 .../gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c | 14 ++-
 .../gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h | 11 +--
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c   | 16 ++--
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.h   | 13 ++-
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c     | 14 ++-
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.h     | 12 +--
 .../gpu/drm/msm/disp/dpu1/dpu_hw_merge3d.c    | 14 ++-
 .../gpu/drm/msm/disp/dpu1/dpu_hw_merge3d.h    | 13 +--
 .../gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c   | 15 ++--
 .../gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.h   | 14 ++-
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c   | 17 ++--
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h   | 16 ++--
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_top.c    | 17 ++--
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_top.h    |  8 +-
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_vbif.c   | 14 ++-
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_vbif.h   |  8 +-
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.c     | 15 ++--
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.h     | 13 ++-
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c       | 55 ++++--------
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h       |  1 -
 drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c     | 59 +++---------
 drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c        | 90 +++----------------
 drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h        | 11 +--
 36 files changed, 226 insertions(+), 487 deletions(-)

Comments

Dmitry Baryshkov Dec. 6, 2023, 9:37 a.m. UTC | #1
On Sat, 02 Dec 2023 00:18:32 +0300, Dmitry Baryshkov wrote:
> In a lots of places in DPU driver memory is allocated by using the
> kzalloc and then manually freed using kfree. However thes memory chunks
> have a well-defined life cycle. They are either a part of the driver's
> runtime and can be devm_kzalloc'ed or are exposed to userspace via the
> DRM objects and thus can be drmm_alloc'ed. Implement corresponding
> runtime resource manangement for the DPU driver.
> 
> [...]

Applied, thanks!

[01/13] drm/msm/dpu: cleanup dpu_kms_hw_init error path
        https://gitlab.freedesktop.org/lumag/msm/-/commit/134c78c96227
[02/13] drm/msm/dpu: remove IS_ERR_OR_NULL for dpu_hw_intr_init() error handling
        https://gitlab.freedesktop.org/lumag/msm/-/commit/b830b06f0087
[03/13] drm/msm/dpu: use devres-managed allocation for interrupts data
        https://gitlab.freedesktop.org/lumag/msm/-/commit/b19e6f7dd2e7
[04/13] drm/msm/dpu: use devres-managed allocation for VBIF data
        https://gitlab.freedesktop.org/lumag/msm/-/commit/bdfa47d9b17a
[05/13] drm/msm/dpu: use devres-managed allocation for MDP TOP
        https://gitlab.freedesktop.org/lumag/msm/-/commit/1e897dcc4c67
[06/13] drm/msm/dpu: use devres-managed allocation for HW blocks
        https://gitlab.freedesktop.org/lumag/msm/-/commit/a106ed98af68
[07/13] drm/msm/dpu: drop unused dpu_plane::lock
        https://gitlab.freedesktop.org/lumag/msm/-/commit/b0311c1c4e06
[08/13] drm/msm/dpu: remove QoS teardown on plane destruction
        https://gitlab.freedesktop.org/lumag/msm/-/commit/bcc54a4c063a
[09/13] drm/msm/dpu: use drmm-managed allocation for dpu_plane
        https://gitlab.freedesktop.org/lumag/msm/-/commit/0e00f9af95bb
[10/13] drm/msm/dpu: use drmm-managed allocation for dpu_crtc
        https://gitlab.freedesktop.org/lumag/msm/-/commit/3637af92de2b
[11/13] drm/msm/dpu: use drmm-managed allocation for dpu_encoder_phys
        https://gitlab.freedesktop.org/lumag/msm/-/commit/73169b45e1ed
[12/13] drm/msm/dpu: drop dpu_encoder_phys_ops::destroy
        https://gitlab.freedesktop.org/lumag/msm/-/commit/3285f4acb23c
[13/13] drm/msm/dpu: use drmm-managed allocation for dpu_encoder_virt
        https://gitlab.freedesktop.org/lumag/msm/-/commit/cd42c56d9c0b

Best regards,