From mboxrd@z Thu Jan 1 00:00:00 1970 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 E41D63C8714 for ; Thu, 23 Apr 2026 10:19:33 +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=1776939574; cv=none; b=WAKFgkHA3yJVxF3JDh3bVFuU+QMki2siAySI7L5FKKAzsOrMrAQqjvlDYYiITj3QGESiluPO8Gq/EaLWsoF6VzlO/k4e43oyrzQKgzl92QDQXtKIJIlaK8PjPekszncFY3CWXzEyy6zwKLA31DSaA8VXNDD63GtPEUv6j5dN2sU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776939574; c=relaxed/simple; bh=uB5xmdpILRqtr7ie2wAJSDfl4DRIQL7izi7RXOkv5fA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=gUAllJrCR9io44kXaxtq0Ac4piQZyfshIRX7EdZvIEBoD+ozpooX71HkpbF2wcxBJOBUQEPN9t7EIrn8MX8IOQJ/rrNoI6RlCZCaXDm8exTb2WyCOESCYewAoYgNQouVzUMGkWs/CIByPOinF6b0LcG/w/mOdMnsFxVav39Yr0E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=TsVQhUkU; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="TsVQhUkU" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4A43BC2BCAF; Thu, 23 Apr 2026 10:19:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1776939573; bh=uB5xmdpILRqtr7ie2wAJSDfl4DRIQL7izi7RXOkv5fA=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=TsVQhUkUoZathoW0Wn0YV2eikNrHH0cx9oZ2nshUi//d55NizWD711A6/gn4pkPfm ZYiLyFk3m1gheTDFAS1bG4F+vqwVVDOzQ8jpozHQn92y2lVrjlpbI11fifmO1EjzeM wgt5eWZwS2VvnLuNZuJgLIVuulg6kpQVxz9/82XdM/8pf9MeM72ZKRDzfyWw6Fsse8 M1cLUCQqahDUYE0YkpLRhwiUzxHwoqiFDYnTfYBdxstFkrv1DyI5bQL0KRvT6rAk5E d1twp5pBje/HXsrLkgapwm0erLtErbpoxpk8c8yVv3fyzuqR1hVVo3Kwyg+/7CcmW/ WUCCq8fTrqLXA== From: Maxime Ripard Date: Thu, 23 Apr 2026 12:18:35 +0200 Subject: [PATCH v2 22/28] drm/encoder: Create atomic_sro_get_current_crtc hook Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260423-drm-state-readout-v2-22-8549f87cb978@kernel.org> References: <20260423-drm-state-readout-v2-0-8549f87cb978@kernel.org> In-Reply-To: <20260423-drm-state-readout-v2-0-8549f87cb978@kernel.org> To: Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Jyri Sarha , Tomi Valkeinen Cc: Devarsh Thakkar , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Maxime Ripard X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=1998; i=mripard@kernel.org; h=from:subject:message-id; bh=uB5xmdpILRqtr7ie2wAJSDfl4DRIQL7izi7RXOkv5fA=; b=owGbwMvMwCmsHn9OcpHtvjLG02pJDJkvP34U/MduUMT/avoRPx7t9LUv/71LU4zO3XCg23GtF FP38in8HVNZGIQ5GWTFFFmeyISdXt6+uMrBfuUPmDmsTCBDGLg4BWAimd8YG5atXvJkpW8L6yTv Ox2tml3zS/03mZ8QvNkfn5a6s2p1o8NEqYV5pxY8X+49x6cz18dwE2N96pWoWwt9T/a+/CS/8fX vz9+lr2isrb3kdymW+Xd2wdH9fRUKzOLz92yp3bGPL/3oK/e/AA== X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D In order for drivers to implement drm_connectors atomic_state_readout hooks, they need to query the hardware and lookup the CRTC to set drm_connector_state.crtc. It should be easy enough for drivers that are tightly integrated from the CRTC to the connectors, but if the driver uses bridges, there's no coupling between the CRTC and encoder, and the bridge driver. The only thing the bridge has access to is the encoder, but the relationship between a CRTC and an encoder isn't a fixed mapping at the framework level, and thus the bridge can't deduce which CRTC is feeding its encoder. Create a new hook for encoders to implement to return the CRTC they are currently connected to. Signed-off-by: Maxime Ripard --- include/drm/drm_encoder.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/include/drm/drm_encoder.h b/include/drm/drm_encoder.h index eded7c34481a..7f41ec0a68dc 100644 --- a/include/drm/drm_encoder.h +++ b/include/drm/drm_encoder.h @@ -87,10 +87,28 @@ struct drm_encoder_funcs { * @debugfs_init: * * Allows encoders to create encoder-specific debugfs files. */ void (*debugfs_init)(struct drm_encoder *encoder, struct dentry *root); + + /** + * @atomic_sro_get_current_crtc: + * + * This optional hook is called during hardware state readout + * to determine which CRTC is currently driving this encoder. + * + * It is needed by the bridge connector readout code to + * establish the CRTC-encoder-connector association from the + * hardware state, since the relationship between a CRTC and + * an encoder is not a fixed mapping at the framework level. + * + * RETURNS: + * + * The CRTC currently associated with the encoder if enabled, + * NULL otherwise. + */ + struct drm_crtc *(*atomic_sro_get_current_crtc)(struct drm_encoder *encoder); }; /** * struct drm_encoder - central DRM encoder structure * @dev: parent DRM device -- 2.53.0