[PATCH 00/14] drm/atomic: Rework initial state allocation

Maxime Ripard posted 14 patches 4 weeks ago
There is a newer version of this series
Documentation/gpu/drm-kms.rst                  |   6 ++
drivers/gpu/drm/display/drm_bridge_connector.c |  15 ++-
drivers/gpu/drm/drm_atomic.c                   |  67 ++++++++++--
drivers/gpu/drm/drm_atomic_state_helper.c      | 128 +++++++++++++++++++++-
drivers/gpu/drm/drm_drv.c                      |   6 +-
drivers/gpu/drm/drm_mode_config.c              | 141 +++++++++++++++++++++++++
drivers/gpu/drm/tidss/tidss_crtc.c             |  17 ++-
drivers/gpu/drm/tidss/tidss_kms.c              |   2 -
drivers/gpu/drm/tidss/tidss_plane.c            |   2 +-
include/drm/drm_atomic_state_helper.h          |  12 +++
include/drm/drm_connector.h                    |  13 +++
include/drm/drm_crtc.h                         |  13 +++
include/drm/drm_mode_config.h                  |   1 +
include/drm/drm_plane.h                        |  13 +++
14 files changed, 408 insertions(+), 28 deletions(-)
[PATCH 00/14] drm/atomic: Rework initial state allocation
Posted by Maxime Ripard 4 weeks ago
Hi,

This series started from my work on the hardware state readout[1], and
more specifically a discussion with Thomas[2].

This series expands the work that has been merged recently to make
drm_private_obj and drm_private_state allocation a bit more consistent
and ended up creating a new atomic_create_state callback to allocate a
new state with no side effect.

The first patches are a documentation of the existing behaviour and some
random cleanups.

Then, we add the new atomic_create_state callback to every other DRM
object. Next, we leverage those new callbacks to create a new helper,
drm_mode_config_create_state() to create the initial state for all the
objects of a driver.

Finally, we hook that new helper in drm_dev_register and start
converting a few drivers.

This was tested on a TI SK-AM62, with the tidss driver.

Let me know what you think,
Maxime

1: https://lore.kernel.org/dri-devel/20250902-drm-state-readout-v1-0-14ad5315da3f@kernel.org/
2: https://lore.kernel.org/dri-devel/5920ffe5-b6b1-484b-b320-332b9eb9db82@suse.de/

Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
Maxime Ripard (14):
      drm/atomic: Document atomic state lifetime
      drm/atomic: Drop drm_private_state.obj assignment from create_state
      drm/mode-config: Mention drm_mode_config_reset() culprits
      drm/atomic-state-helper: Fix __drm_atomic_helper_plane_reset() doc typo
      drm/plane: Add new atomic_create_state callback
      drm/crtc: Add new atomic_create_state callback
      drm/connector: Add new atomic_create_state callback
      drm/mode-config: Create drm_mode_config_create_state()
      drm/drv: Call drm_mode_config_create_state() by default
      drm/atomic: Drop private obj state allocation
      drm/drv: Drop drm_mode_config_reset() from our skeleton
      drm/tidss: Drop call to drm_mode_config_reset at probe time
      drm/tidss: Convert to atomic_create_state
      drm/bridge_connector: Convert to atomic_create_state

 Documentation/gpu/drm-kms.rst                  |   6 ++
 drivers/gpu/drm/display/drm_bridge_connector.c |  15 ++-
 drivers/gpu/drm/drm_atomic.c                   |  67 ++++++++++--
 drivers/gpu/drm/drm_atomic_state_helper.c      | 128 +++++++++++++++++++++-
 drivers/gpu/drm/drm_drv.c                      |   6 +-
 drivers/gpu/drm/drm_mode_config.c              | 141 +++++++++++++++++++++++++
 drivers/gpu/drm/tidss/tidss_crtc.c             |  17 ++-
 drivers/gpu/drm/tidss/tidss_kms.c              |   2 -
 drivers/gpu/drm/tidss/tidss_plane.c            |   2 +-
 include/drm/drm_atomic_state_helper.h          |  12 +++
 include/drm/drm_connector.h                    |  13 +++
 include/drm/drm_crtc.h                         |  13 +++
 include/drm/drm_mode_config.h                  |   1 +
 include/drm/drm_plane.h                        |  13 +++
 14 files changed, 408 insertions(+), 28 deletions(-)
---
base-commit: 7b80021b1f0daed917ecc7f75077df799a8a698c
change-id: 20260310-drm-mode-config-init-1e1f52b745d0
prerequisite-change-id: 20251008-drm-private-obj-reset-ae1e2741027a:v5
prerequisite-patch-id: 9684f0ca4b16455c1340409561e8fb32f98b327a
prerequisite-patch-id: e177eb92b269436a94d7ef603d44436799be7469
prerequisite-patch-id: fef6d20ab33358c1db6cd9d21aa8ec0990cae758
prerequisite-patch-id: 2dcc96d43f34d8f6237829ed29d0087c092954d1

Best regards,
-- 
Maxime Ripard <mripard@kernel.org>