Hi, Userspace currently has no atomic way to bring a display pipeline back to a pristine state. A compositor that wants to start from a known baseline must explicitly set every property on every KMS object to its default value, which requires tracking which properties exist and what their defaults are. This is fragile and must be updated every time a new property is added to the kernel.
This series introduces a new DRM_MODE_ATOMIC_RESET flag for the atomic ioctl. When set, the kernel fills the commit with default states for all KMS objects before applying the properties supplied in the request. Properties not explicitly included remain at their defaults (CRTCs inactive, planes disabled, connectors unbound, and so on). This allows userspace to describe the desired end state declaratively, without having to care about the current state or the full set of properties. The first patch is a small cleanup aligning __drm_colorops_state with the naming convention used by the other atomic state tracking structures. Patches 2 through 6 extract the state insertion logic from each drm_atomic_get_*_state() function into standalone helpers. This is needed because the new fill_with_defaults path creates states through atomic_create_state() rather than atomic_duplicate_state(), so it cannot go through the existing drm_atomic_get_*_state() functions. Patch 7 adds drm_atomic_commit_fill_with_defaults(), which uses those helpers to populate a commit with pristine states for every object in the device. Patch 8 wires it all up by adding DRM_MODE_ATOMIC_RESET to the atomic ioctl. This series is untested and relies on all drivers implementing the atomic_create_state hook, which is not yet the case. The conversion is actively in progress but not complete, so this will not work as-is today. Sending it now to get early feedback on the approach. Signed-off-by: Maxime Ripard <[email protected]> --- Changes in v2: - Fix bisection - Add capability to let userspace know if it can reset the state - Link to v1: https://lore.kernel.org/r/[email protected] --- Maxime Ripard (8): drm/atomic: colorop: Rename state to state_to_destroy drm/atomic: Create function to insert CRTC state into a commit drm/atomic: Create function to insert plane state into a commit drm/atomic: Create function to insert colorop state into a commit drm/atomic: Create function to insert private obj state into a commit drm/atomic: Create function to insert connector state into a commit drm/atomic: Add drm_atomic_can_create_state() helper drm/atomic: Allow filling a commit with pristine object states Sebastian Wick (1): drm/atomic-uapi: Add DRM_MODE_ATOMIC_RESET flag drivers/gpu/drm/drm_atomic.c | 388 ++++++++++++++++++++++++++++++------ drivers/gpu/drm/drm_atomic_helper.c | 2 +- drivers/gpu/drm/drm_atomic_uapi.c | 13 ++ drivers/gpu/drm/drm_ioctl.c | 4 + include/drm/drm_atomic.h | 21 +- include/uapi/drm/drm.h | 10 + include/uapi/drm/drm_mode.h | 14 +- 7 files changed, 384 insertions(+), 68 deletions(-) --- base-commit: bd4f284df04d76fd65e57141cb1e6e7a49e4c3cb change-id: 20260708-drm-reset-state-flag-2fb2b5711f97 Best regards, -- Maxime Ripard <[email protected]>
