From patchwork Tue Oct 31 16:48:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 160245 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b90f:0:b0:403:3b70:6f57 with SMTP id t15csp373234vqg; Tue, 31 Oct 2023 09:50:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEzSmZPv73lABtMPhnwAfbQGNbiFFr2mv3MN8vzEPbzkRTG9FNjJTTXjt2x+zgFugs37Uou X-Received: by 2002:a17:902:f093:b0:1cc:2f9d:6e9b with SMTP id p19-20020a170902f09300b001cc2f9d6e9bmr7154448pla.20.1698771002894; Tue, 31 Oct 2023 09:50:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698771002; cv=none; d=google.com; s=arc-20160816; b=bm8MpedvAzuhCsNBPC0vEbzD5b3WsiAeizmaq5icU8Yfoq+gYG7d/R/D0WLvrIoA+W R1lCxdeEBGLq2on4lZDtR7u2CSMiKjA59oUC+DEZVhDj1TjJwNLb8cCvQ96Bb+fbtsqM K3gMYRFD749dTiaSSQQRX5hXVyFaFpnCF4WA+LIMlOuSM9UklGQvFkJtx/jH4Unc40su KdE5VCK+GELQ9QhI6krLOf1X7TNksWROQ3Fclw1kGIuDu7pff3Uv5IFij2WP0Qj+a6K7 esnz9XNuOUnva+0vaK40lg7aBXWRLwSf6RLoIzNRGfhGGMSX/Paq7ALjtrsHia50yKU2 kLDg== 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=Iycie9/eHZX4LhBDG2pzszhE3E+g75w6or5BKkNnECM=; fh=e6/uyeFf2k7v8JUtB6fPyaAS5iN3eSA1hjtg35V2Rzw=; b=AaF+hjaTyzb3tdkTLB2tLEW4l56tnUMj4lJA/aBY4m++Il5NzMeaKwUNWKg9N3tWJx /IIiTLNMf0wcSbpQmF2/6VwfgQ6w1SXs44hJT45oVtXcVhkTimiDnuKbyrOZyhPz6f9N JdHvHQzHp/FCHrxo2Qi+ed2/aGnJ2KbIFKcVhIyoM9kcg4cQxdxssRbQ1ose1s3wbHj6 yr+vrVS+IHP6ARhfLND/IJOXsPTcltpSDlw83+Cm+Gb9pcjotKj56cGbrpnXYZxARsB/ m6FnyGEcIpJjuekoudiaLKlmq7CZoiJ05YD2kKnwP4F7ldzM3CeJNgbHukrxP4NvM3K5 YJHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="MI4z/2Kz"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id c12-20020a170902724c00b001cc15d1ac7csi1156786pll.563.2023.10.31.09.50.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 09:50:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="MI4z/2Kz"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 groat.vger.email (Postfix) with ESMTP id 309F7804442F; Tue, 31 Oct 2023 09:49:54 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346420AbjJaQsr (ORCPT + 33 others); Tue, 31 Oct 2023 12:48:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346080AbjJaQsn (ORCPT ); Tue, 31 Oct 2023 12:48:43 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35931DA; Tue, 31 Oct 2023 09:48:40 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 35C7FC433C9; Tue, 31 Oct 2023 16:48:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1698770920; bh=CAcs4O/o+PBiLY0PT/kHw+LK8BKStaQ0lNJbZ4whT7A=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=MI4z/2KzWWgmobRF9N6WdI+jEw6W/ozqZgoJ9OYn0hFdd9MaQARXYB4WCEtn5Y36i 0l3A/4gF6W9mo7flMDvUsRvrsCt2ljWfYJzt2mqYlcy4iDUtYk0WTWJ36PvxeAn/XC ScFQZrCXQxqSC6jeqVucGQbJUfHapfpQOvnB2e1vHZdTwPbXsprFrgoOA2xfrhnFgJ MCOVOEzB6MfNNt+XNoqarH1KLJsAUn3pKIOD969mmKff92LYFq1ZPn3CTjgcCgiI7b +P3BeZ9NWm9Hj6teit8tcw3Tb4LF4kdx45jfpclNrc5Utm9eDVSaoCBuV0/PUBFS27 gTmpXUI7IxDqA== From: Maxime Ripard Date: Tue, 31 Oct 2023 17:48:15 +0100 Subject: [PATCH RFC v3 02/37] drm/connector: hdmi: Create a custom state MIME-Version: 1.0 Message-Id: <20231031-kms-hdmi-connector-state-v3-2-328b0fae43a7@kernel.org> References: <20231031-kms-hdmi-connector-state-v3-0-328b0fae43a7@kernel.org> In-Reply-To: <20231031-kms-hdmi-connector-state-v3-0-328b0fae43a7@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=4061; i=mripard@kernel.org; h=from:subject:message-id; bh=CAcs4O/o+PBiLY0PT/kHw+LK8BKStaQ0lNJbZ4whT7A=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDKmO+ndddjOZ2Z1qr5pnvy1qTu3+wLUTtge9eeny9sUvH vWktSsqOkpZGMS4GGTFFFlihM2XxJ2a9bqTjW8ezBxWJpAhDFycAjCRFXsZGU4Kmx9g/Ol579mF CPFz+xexHV+Xntv+2Fbu1r3An9UXTkxhZPj/rDC38/Ejrsp9wfwn9ojP/pLHwmG5w3SWXJjIpem /WLgB X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-Spam-Status: No, score=-1.7 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 groat.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 (groat.vger.email [0.0.0.0]); Tue, 31 Oct 2023 09:49:54 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781290503009143243 X-GMAIL-MSGID: 1781290503009143243 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 state dedicated to HDMI controllers, that will eventually store everything we need. Signed-off-by: Maxime Ripard --- drivers/gpu/drm/drm_atomic_state_helper.c | 35 +++++++++++++++++++++++++++++++ include/drm/drm_atomic_state_helper.h | 4 ++++ include/drm/drm_connector.h | 3 +++ 3 files changed, 42 insertions(+) diff --git a/drivers/gpu/drm/drm_atomic_state_helper.c b/drivers/gpu/drm/drm_atomic_state_helper.c index 784e63d70a42..29cb64e9cf28 100644 --- a/drivers/gpu/drm/drm_atomic_state_helper.c +++ b/drivers/gpu/drm/drm_atomic_state_helper.c @@ -556,6 +556,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 @@ -605,6 +621,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 c86cd363d652..5961f2ad48b1 100644 --- a/include/drm/drm_connector.h +++ b/include/drm/drm_connector.h @@ -1022,6 +1022,9 @@ struct drm_connector_state { * DRM blob property for HDR output metadata */ struct drm_property_blob *hdr_output_metadata; + + struct { + } hdmi; }; /**