From patchwork Tue May 19 09:01:42 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 259 Return-Path: X-Original-To: noreply@patchwork.local Delivered-To: noreply@patchwork.local Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mxe881.netcup.net (Postfix) with ESMTPS id 05D741C021A for ; Tue, 19 May 2026 11:11:59 +0200 (CEST) Authentication-Results: mxe881; dkim=pass header.d=kernel.org; spf=pass (sender IP is 172.105.105.114) smtp.mailfrom=linux-sunxi+bounces-23552-noreply=patchwork.local@lists.linux.dev smtp.helo=tor.lore.kernel.org Received-SPF: pass (mxe881: domain of lists.linux.dev designates 172.105.105.114 as permitted sender) client-ip=172.105.105.114; envelope-from=linux-sunxi+bounces-23552-noreply=patchwork.local@lists.linux.dev; helo=tor.lore.kernel.org; Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1]) by tor.lore.kernel.org (Postfix) with ESMTP id 088853123931 for ; Tue, 19 May 2026 09:02:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 81F6B3F6C42; Tue, 19 May 2026 09:02:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Y1X9EXRT" X-Original-To: linux-sunxi@lists.linux.dev Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 59DFF3F660E; Tue, 19 May 2026 09:02:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779181322; cv=none; b=eZfUV0KV7XD+eHZ/w5yimMbWYQ0bqvXCOP7xg4twnao9f5vDVNRZ1Zkta0RWlOCJNkYyzyPHnYpSjwVLZEqqGAlI8c9fdisCzBUVTrmLzoJM6u9XrP+cAap2e7dBTgoXX/+XmufbIjNv8Sfhgnv1dJXFDunjgzp1qF49OlCIyQA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779181322; c=relaxed/simple; bh=DBIFCH1cyjEz//oJo5SEbw9KVoeReft6owR9CiWCBWE=; h=From:Subject:Date:Message-Id:MIME-Version:Content-Type:To:Cc; b=Ua7buADPzfbsrw6IiCFxnFUR1KUxZlkeqDjJYrlMzdn0Ga1psA2o1GV65tvLQTHlhJtVhoyCRMT+eFCyHExOQ8BuuX+nAZ6rZ8HJmGkGkggGpxky9gvQQz23pqokfPTQ3XqgdCH1bpOVOynuKhR7MIgaUnsPUt706le3zYBwSsw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Y1X9EXRT; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 84CDCC2BCC6; Tue, 19 May 2026 09:02:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1779181322; bh=DBIFCH1cyjEz//oJo5SEbw9KVoeReft6owR9CiWCBWE=; h=From:Subject:Date:To:Cc:From; b=Y1X9EXRTahEPgr2zSuhJs9c17S5jYxTLLiGu+iOrdX8ZfEte1822QcrrYUayj4jBP vmZs+qmfMCAZ3YKmfj3FzC/fKpdiial856eoB4PQqTDX/HBEKSDSLcws3SMP45rfze 11vPAcbRahaj3sVLg+7mqxcLf2ruQOb0fqnwA+eGFDykY40Ssn6mm4ILJssu7bzI7p hxua60gVxA9j8n90NXdtpoC5XwfMm3YvRhiKPXUkUCGMIQSgYHOeTap1EJ2VdoIoth zIbumNIHUcKfxeTOs+oAeQ9VvtDpFsBxgZTJZP07GfaEHIXyEEAxAWgoc6VoNqtWvT iBJr/twufoIEw== From: Maxime Ripard Subject: [PATCH v5 00/19] drm/atomic: Rework initial state allocation Date: Tue, 19 May 2026 11:01:42 +0200 Message-Id: <20260519-drm-mode-config-init-v5-0-388b03321e38@kernel.org> Precedence: bulk X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-B4-Tracking: v=1; b=H4sIAAAAAAAC/33Oy07DMBAF0F+JvGaQx488uuI/EIvaHqcWxCl2i Iqq/DtOuiioCss7o3tmrixTCpTZobqyRHPIYYwl6KeK2dMx9gTBlcwEFzWXyMGlAYbREdgx+tB DiGECJPRamEZpx1mpnhP5cNnY17dbTvT5VfTpNmTmmFdiGMJ0qDYzZAuRLhOsp4BrQMXW7inka Uzf24czbuX/n5kRyoYa2TW2JbT+5Z1SpI/nMfWbOItfithTRFFsLT2iVNTU9kGRd0UJtaPIorS mbl3nDHeteVDUXdEodhRVFN2h885aNL77oyzL8gOBd07SxwEAAA== X-Change-ID: 20260310-drm-mode-config-init-1e1f52b745d0 To: Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Jonathan Corbet , Shuah Khan , Dmitry Baryshkov , Jyri Sarha , Tomi Valkeinen , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Simon Ser , Harry Wentland , Melissa Wen , Sebastian Wick , Alex Hung , Jani Nikula , Rodrigo Vivi , Joonas Lahtinen , Tvrtko Ursulin , Chen-Yu Tsai , Samuel Holland , Dave Stevenson , =?utf-8?q?Ma=C3=ADra_Canal?= , Raspberry Pi Kernel Maintenance Cc: dri-devel@lists.freedesktop.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Daniel Stone , intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, Maxime Ripard , Laurent Pinchart , Laurent Pinchart X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=5807; i=mripard@kernel.org; h=from:subject:message-id; bh=DBIFCH1cyjEz//oJo5SEbw9KVoeReft6owR9CiWCBWE=; b=owGbwMvMwCmsHn9OcpHtvjLG02pJDFk8aj+Xs5/e6KAh99ytpPtUhZ/FhBs7mU/XZCpdnHZwd XK7sfz8jqksDMKcDLJiiixPZMJOL29fXOVgv/IHzBxWJpAhDFycAjCR5caMdYrv1m3rFszsrchY uPJ1ZHDKYZWS03EeNVsPO995yl/BlRRtNZtr9edeo72zch3nM8T8Z6wzfBaoYbPE/Vnijy9iWTs vnxFufHP/RMrmH+diLZ5pK07SPRfgqdShm/1hDXtXoolnYDwA X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-MORS-Enabled: yes X-MORS-DOMAIN: patchwork.local X-MORS-HOSTING: hosting172546 X-MORS-USER: hosting172546 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= 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 document the existing behaviour and fix a few cleanups and typos. Then, __drm_*_state_reset() helpers are renamed to __drm_*_state_init() to clarify that they initialize rather than reset state, and we add the new atomic_create_state callback to every other DRM object (planes, CRTCs, connectors, colorops). Next, we leverage those new callbacks to create a new helper, drm_mode_config_create_initial_state(), to create the initial state for all the objects of a driver, and update the driver skeleton to recommend it. Finally, we convert the tidss driver and the bridge_connector to the new pattern. 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 --- Changes in v5: - Address sashiko reviews - Improve the docs - Fix drmm_connector_hdmi_init - Drop drm/tidss: Switch to drm_mode_config_create_initial_state since not all possible bridges would have been converted to create_state - Link to v4: https://lore.kernel.org/r/20260512-drm-mode-config-init-v4-0-591dfdcc1bf9@kernel.org Changes in v4: - Rebased on current drm-misc-next - Update drm_atomic_state to drm_atomic_commit - Various doc impromvements - Don't call drm_crtc_vblank_reset in create_state - Prevent mem leak if states already have a state when drm_mode_config_reset or _create_initial_state are called - Link to v3: https://lore.kernel.org/r/20260424-drm-mode-config-init-v3-0-8b68d9db0d8b@kernel.org Changes in v3: - Reintroduce state documentation that was dropped by accident - Change name to drm_mode_config_create_initial_state() - Don't call drm_mode_config_create_initial_state() in drm_dev_register anymore - Drop __drm_atomic_helper_*_create_state - Improve documentation and commit messages where necessary - Collected tags - Link to v2: https://lore.kernel.org/r/20260320-drm-mode-config-init-v2-0-c63f1134e76c@kernel.org Changes in v2: - Change the _state_reset function names to _state_init - Change the colorop too - Various doc improvements - Link to v1: https://lore.kernel.org/r/20260310-drm-mode-config-init-v1-0-de7397c8e1cf@kernel.org --- Maxime Ripard (19): drm/atomic: Document atomic commit lifetime drm/colorop: Fix typos in the doc drm/atomic: Drop drm_private_obj.state assignment from create_state drm/atomic: Expand atomic_create_state expectations for drm_private_obj drm/mode-config: Document drm_private_obj exclusion from drm_mode_config_reset() drm/colorop: Rename __drm_colorop_state_reset() drm/colorop: Create drm_atomic_helper_colorop_create_state() drm/atomic-state-helper: Fix __drm_atomic_helper_plane_reset() doc typo drm/atomic-state-helper: Rename __drm_atomic_helper_plane_state_reset() drm/plane: Add new atomic_create_state callback drm/atomic-state-helper: Rename __drm_atomic_helper_crtc_state_reset() drm/crtc: Add new atomic_create_state callback drm/atomic-state-helper: Rename __drm_atomic_helper_connector_state_reset() drm/hdmi: Rename __drm_atomic_helper_connector_hdmi_reset() drm/connector: Add new atomic_create_state callback drm/mode-config: Create drm_mode_config_create_initial_state() drm/drv: Switch skeleton to drm_mode_config_create_initial_state() 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 | 17 +- drivers/gpu/drm/display/drm_hdmi_state_helper.c | 15 +- drivers/gpu/drm/drm_atomic.c | 67 ++++++++ drivers/gpu/drm/drm_atomic_state_helper.c | 114 ++++++++++--- drivers/gpu/drm/drm_colorop.c | 41 ++++- drivers/gpu/drm/drm_connector.c | 10 +- drivers/gpu/drm/drm_drv.c | 4 +- drivers/gpu/drm/drm_mode_config.c | 189 ++++++++++++++++++++- drivers/gpu/drm/i915/display/intel_crtc.c | 2 +- drivers/gpu/drm/i915/display/intel_plane.c | 2 +- drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c | 2 +- drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c | 2 +- drivers/gpu/drm/tidss/tidss_crtc.c | 17 +- drivers/gpu/drm/tidss/tidss_plane.c | 2 +- drivers/gpu/drm/vc4/vc4_hdmi.c | 2 +- include/drm/display/drm_hdmi_state_helper.h | 4 +- include/drm/drm_atomic.h | 5 +- include/drm/drm_atomic_state_helper.h | 12 +- include/drm/drm_colorop.h | 2 + include/drm/drm_connector.h | 16 ++ include/drm/drm_crtc.h | 16 ++ include/drm/drm_mode_config.h | 1 + include/drm/drm_plane.h | 16 ++ 24 files changed, 496 insertions(+), 68 deletions(-) --- base-commit: 69c95e4c529297c25503e60acba757fba24fdc95 change-id: 20260310-drm-mode-config-init-1e1f52b745d0 Best regards,