From patchwork Thu Dec 7 15:49:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 175223 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp4874586vqy; Thu, 7 Dec 2023 07:50:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IHfpmEm2zvEcT1/kDYkkjsFxpGdQPBj5dnniv8URyFNiEUJ66TBN+lbFMGqUt2uZTWtNrtt X-Received: by 2002:a05:6358:60c1:b0:16e:2740:7cfc with SMTP id i1-20020a05635860c100b0016e27407cfcmr2848566rwi.25.1701964240282; Thu, 07 Dec 2023 07:50:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701964240; cv=none; d=google.com; s=arc-20160816; b=MnX87BMkZJsw3ZuF4NX94lfsKRHmXZ4BfsOhmX/U1Mnh+bRXC0jVioZ9ibL0IxudM4 NzTbYuRuoT3N5u5pVDkbj9wnTDcUSBi3iwRx9jL0Pn5d0+QhLrYGRTd2fDzu7d98Q/XL S8WdU2QDtzuRdLDHxDQEzxSR+oCCp9Zi0rLk8PbvoMYUfazQ75lZBvjIw7lhH0EksO8u NhjT9z7iZECFoASAjwCASwPYX4Oh0TWo3gVsRhvaQgP4cEgBoWPaqiyeDsKGmhdcHAaT cG4f9ygXwLIzQ4vQeLDSaMtNf55SXJRRi7eoa9iTjZorx2MuirPTRzW9EMPDGCa2/oQU VeIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=yquYFsJPO/m3P6JAICVOSq83ktOE7iJjG4ZfP8uAB/8=; fh=e6/uyeFf2k7v8JUtB6fPyaAS5iN3eSA1hjtg35V2Rzw=; b=oj5e5HwHqSafwttGrhmNkCE9IvlWro660lRtIiFq9QpHipnfIb1nnCejQBT2A0XGa3 WaP6KsLdspFoBXRYOkflV8RWi9AAERLiDAJHbuUVDQ+2FTKgnmZa0HcycC1aBkgD9hOB pP7FIUXsrsFhQ+wJ0FbtBklU+v172GDkPNm0cfDPhPkpmOJpsI/rd0BUbSTjsevMc2C8 KxEdvXuKlCMInGAoWSeSKZCzP83oDJwc/va38JGi/kMc57obo9fiTtzxWGztJMZue6tX qtSMpSRkM9AHXtyKHiAr2oShL/324BvdFSw2VySRYzCmzVuag8E6GC6X5vGNmUHe3dZi xuFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=egxSGi53; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id n8-20020a654508000000b005c61d17e6aasi1379344pgq.122.2023.12.07.07.50.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 07:50:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=egxSGi53; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 8BE2E8055410; Thu, 7 Dec 2023 07:50:31 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1443576AbjLGPuB (ORCPT + 99 others); Thu, 7 Dec 2023 10:50:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1443608AbjLGPtv (ORCPT ); Thu, 7 Dec 2023 10:49:51 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50E281981 for ; Thu, 7 Dec 2023 07:49:52 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 55E63C433C7; Thu, 7 Dec 2023 15:49:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701964191; bh=KGKukXfB7s3mlDxM47tohFtnPMxsVG51/uuvRSTVjh8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=egxSGi53Y3ywFq3hSxoooL7gYemDAazoW1Y1/u3ffOY8Xijqt7G1ODX6ujMlMtfFQ GkzOmLSiPTLLP8hdRX/NHrzWSLd+/7N6H6GHAF7GdvXYuDkaQyPigT63DXcme/QlmI GGMfFZp0Pu9j+a5mYVJE6q0/L/3qKQ8zD9uS5pwvNtLnrbfrPYY/h2dybFEABSEgj9 ezEueTJtEl5GltTBv2RdLSR2MnuMNdPOE+N2I2du05LQYSvtQC7AAz8ToEcF3eeVAc hh06rR9YIva37iKtTuymk9NxxGKOongLpRHijVQ7EXifrWBUUpC6XJkYv9u9Z0dpy6 leZufNCQvfk4g== From: Maxime Ripard Date: Thu, 07 Dec 2023 16:49:30 +0100 Subject: [PATCH v5 07/44] drm/connector: hdmi: Create an HDMI sub-state MIME-Version: 1.0 Message-Id: <20231207-kms-hdmi-connector-state-v5-7-6538e19d634d@kernel.org> References: <20231207-kms-hdmi-connector-state-v5-0-6538e19d634d@kernel.org> In-Reply-To: <20231207-kms-hdmi-connector-state-v5-0-6538e19d634d@kernel.org> To: Maarten Lankhorst , Thomas Zimmermann , David Airlie , Daniel Vetter , Emma Anholt , Jonathan Corbet , Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland Cc: Hans Verkuil , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-sunxi@lists.linux.dev, Maxime Ripard X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=4194; i=mripard@kernel.org; h=from:subject:message-id; bh=KGKukXfB7s3mlDxM47tohFtnPMxsVG51/uuvRSTVjh8=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDKmFL1ujbgp3ZcqK79G2FzDZnlll+WqS89bI713r7u8M3 Hei0t2vo5SFQYyLQVZMkSVG2HxJ3KlZrzvZ+ObBzGFlAhnCwMUpABOxWcrwP3W7bvekuqxrTU+Z ryZbmMw7v2t/2FJ2pz+7GHenF9fyfWFkePDzs+PeuVrJdvWLEq/LZ19mqXrnmqRU8WfOUcP1y1O XMAMA X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Thu, 07 Dec 2023 07:50:31 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784638855301300484 X-GMAIL-MSGID: 1784638855301300484 The next features we will need to share across drivers will need to store some parameters for drivers to use, such as the selected output format. Let's create a new connector sub-state dedicated to HDMI controllers, that will eventually store everything we need. Signed-off-by: Maxime Ripard Reviewed-by: Dave Stevenson --- drivers/gpu/drm/drm_atomic_state_helper.c | 35 +++++++++++++++++++++++++++++++ include/drm/drm_atomic_state_helper.h | 4 ++++ include/drm/drm_connector.h | 7 +++++++ 3 files changed, 46 insertions(+) diff --git a/drivers/gpu/drm/drm_atomic_state_helper.c b/drivers/gpu/drm/drm_atomic_state_helper.c index 54975de44a0e..e69c0cc1c6da 100644 --- a/drivers/gpu/drm/drm_atomic_state_helper.c +++ b/drivers/gpu/drm/drm_atomic_state_helper.c @@ -570,6 +570,22 @@ void drm_atomic_helper_connector_tv_reset(struct drm_connector *connector) } EXPORT_SYMBOL(drm_atomic_helper_connector_tv_reset); +/** + * __drm_atomic_helper_connector_hdmi_reset() - Initializes all HDMI @drm_connector_state resources + * @connector: DRM connector + * @new_state: connector state to reset + * + * Initializes all HDMI resources from a @drm_connector_state without + * actually allocating it. This is useful for HDMI drivers, in + * combination with __drm_atomic_helper_connector_reset() or + * drm_atomic_helper_connector_reset(). + */ +void __drm_atomic_helper_connector_hdmi_reset(struct drm_connector *connector, + struct drm_connector_state *new_state) +{ +} +EXPORT_SYMBOL(__drm_atomic_helper_connector_hdmi_reset); + /** * drm_atomic_helper_connector_tv_check - Validate an analog TV connector state * @connector: DRM Connector @@ -619,6 +635,25 @@ int drm_atomic_helper_connector_tv_check(struct drm_connector *connector, } EXPORT_SYMBOL(drm_atomic_helper_connector_tv_check); +/** + * drm_atomic_helper_connector_hdmi_check() - Helper to check HDMI connector atomic state + * @connector: DRM Connector + * @state: the DRM State object + * + * Provides a default connector state check handler for HDMI connectors. + * Checks that a desired connector update is valid, and updates various + * fields of derived state. + * + * RETURNS: + * Zero on success, or an errno code otherwise. + */ +int drm_atomic_helper_connector_hdmi_check(struct drm_connector *connector, + struct drm_atomic_state *state) +{ + return 0; +} +EXPORT_SYMBOL(drm_atomic_helper_connector_hdmi_check); + /** * __drm_atomic_helper_connector_duplicate_state - copy atomic connector state * @connector: connector object diff --git a/include/drm/drm_atomic_state_helper.h b/include/drm/drm_atomic_state_helper.h index b9740edb2658..d59d2b3aef9a 100644 --- a/include/drm/drm_atomic_state_helper.h +++ b/include/drm/drm_atomic_state_helper.h @@ -71,7 +71,11 @@ void __drm_atomic_helper_connector_state_reset(struct drm_connector_state *conn_ void __drm_atomic_helper_connector_reset(struct drm_connector *connector, struct drm_connector_state *conn_state); void drm_atomic_helper_connector_reset(struct drm_connector *connector); +void __drm_atomic_helper_connector_hdmi_reset(struct drm_connector *connector, + struct drm_connector_state *new_state); void drm_atomic_helper_connector_tv_reset(struct drm_connector *connector); +int drm_atomic_helper_connector_hdmi_check(struct drm_connector *connector, + struct drm_atomic_state *state); int drm_atomic_helper_connector_tv_check(struct drm_connector *connector, struct drm_atomic_state *state); void drm_atomic_helper_connector_tv_margins_reset(struct drm_connector *connector); diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h index 4491c4c2fb6e..000a2a156619 100644 --- a/include/drm/drm_connector.h +++ b/include/drm/drm_connector.h @@ -1031,6 +1031,13 @@ struct drm_connector_state { * DRM blob property for HDR output metadata */ struct drm_property_blob *hdr_output_metadata; + + /** + * @hdmi: HDMI-related variable and properties. Filled by + * @drm_atomic_helper_connector_hdmi_check(). + */ + struct { + } hdmi; }; /**