Received: by 2002:ab2:788f:0:b0:1ee:8f2e:70ae with SMTP id b15csp561695lqi; Thu, 7 Mar 2024 05:40:38 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXry8YVAnWdNYXBSCLbrx6XjErPZOd9+MjXtLo1MjlvQil78DZgOJ0Qd2fSf4rrb3mFtBRX2pqieEdc8lCLC6GVoB8BwyoF+GTn/MUdVA== X-Google-Smtp-Source: AGHT+IFLp2zF/yvXHSfdv7gO8aNmp2YiN3UA8dbxSO/OUbWreoq1xjDz9KI51xG0C5gT23034nYr X-Received: by 2002:a05:6402:2315:b0:565:6c72:40a9 with SMTP id l21-20020a056402231500b005656c7240a9mr12805328eda.28.1709818838514; Thu, 07 Mar 2024 05:40:38 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709818838; cv=pass; d=google.com; s=arc-20160816; b=hDBr4CIusLpd5H0ZsHkGN1Np8z10eTmwjs5KQ66SPQyA/UBrCnW6Lvq7XHlpdFt2DE rkr8AWzcb4JqH0qS7DKD9g/OmusLHi1lUnNhprm42z5lVjUcR/GH/gplv2ukAxRE3r2R HDF1C7/tnos2fFPU70z3JN371ri3TlaCWRRO/ptBlWCOeUJwfWz9AqalC+lDl8FqVqxG dQN9mGTOeK8yiml8BDmVvGFkKwEDb8ai9+MMiVjC5XCZRkHCCy1fAW18RRIxPlM3YNYZ ldXoEbMaNrhWk+I+x9uVnwpDB9WqLZDONZaIfhoOfmTt3zIPRp5Ru+LgBg1/W9i9kDua 1QnA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=qaXcejQ2/anVmdcQQ3gMwQWYnCCG3NczRiyeGj5cyeQ=; fh=8wcoxKk21hICD+6obVirG13fsSSMhKa/pufykSf87d0=; b=XiZ+E/W8iyQ2Q69S3sHlGK4G2f0T+q/RF9d92uKLODvv7hXvF2HbrEDRhPXbFy55BY FErPq/dUsH2Owu1KeqlmcuAlpqOnyeu7lGOvVvsYeemFeT8Ot6tRX+IebWBLQ6y7z9xU JAiOzEdiHPvVgoWhN2VtakxGPtQExYAhz4OusTV+SbxuAQ0W7DhpElzmv91DEC6UcIVK lOHa6lErvkWTAClJoUFAplVediT5iG9cUwg6bR1DtemycNuRobGD0dTCPF3oBTB1vhCr 72CaETAK0KeiYkdF1yAk9100atcGJRad7O3ZYHp9UGSCD0Iaz/qlkOitoCsZim7qHo0O RMzw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jqhG4P0O; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-95622-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-95622-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id 11-20020a508e0b000000b00567140fec8asi4801094edw.477.2024.03.07.05.40.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Mar 2024 05:40:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-95622-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jqhG4P0O; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-95622-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-95622-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 002F21F23B3A for ; Thu, 7 Mar 2024 13:40:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5E4CE12F385; Thu, 7 Mar 2024 13:39:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="jqhG4P0O" 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 43AB412F36E; Thu, 7 Mar 2024 13:39:04 +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=1709818745; cv=none; b=nasbcNY0W4EFKfwJTeZYOTk+kgHdNQb7tpw1wW+vG2FH4o4b1kAMIYcvBBztHgHCsn3bAUSopMXAHTmd1YfkuuRokSmzOZ2yf9e7uzPq3vFFmcxjqXio40tLIxinvF+/qJ18VOEg8ush1vCxkauA71gAy6f/3jnaguY3Po5a9a0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709818745; c=relaxed/simple; bh=eZw9702RagXmh2VG3XD3rGSR1PJvIZ11Csaq049mV+s=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=W5UgYX2SeLhUb3032ae3OGrxIpeanrFFEiZ7J/viS8wswDvSX0zihWiEM1Uyn3dOGlVCKL4Vj0H91TLX79IZQnNJKb8Ha+QEEDylb3RQ3VOsh1HK2RLQT5CMOevqQA7109AZJTG0sOnPOy2FzzoxLpk9R/Q0huj2KOOEPGZm6aI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=jqhG4P0O; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7B9C6C433F1; Thu, 7 Mar 2024 13:39:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709818744; bh=eZw9702RagXmh2VG3XD3rGSR1PJvIZ11Csaq049mV+s=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=jqhG4P0ObP+KqdiojfDNV+2oGs/DH5tq1agBwN9bFxdGC6ZvC3UszTB63QBcgXUU6 mG+0NDwSItY/obj0EibnixdgQQVzDm1YW+JAMFsPRT9O2CDrhRe+TWJrz6E3MwZ6o2 BoenKFP6aFTG5EPv7VtRhkS/pvi+GExNqbIAjvT+wSJ0Lgb5ZBDlOL0KwNrG3kZAgp x4zrY26WNEd5OR07Rd7K5SL/ThU5c4Uu9o2ctjct72waZFNIEhmb+iPLZVmltXpMUN /4oil/+piwkQ94wwn+CObo0BR+zfl+pvbiX7nwWovwSPxRQMFBRNFUUUjzbteWVIIj H33589+Ggp3yg== From: Maxime Ripard Date: Thu, 07 Mar 2024 14:38:30 +0100 Subject: [PATCH v8 03/27] drm/connector: hdmi: Create an HDMI sub-state 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: <20240307-kms-hdmi-connector-state-v8-3-ef6a6f31964b@kernel.org> References: <20240307-kms-hdmi-connector-state-v8-0-ef6a6f31964b@kernel.org> In-Reply-To: <20240307-kms-hdmi-connector-state-v8-0-ef6a6f31964b@kernel.org> To: Maarten Lankhorst , Thomas Zimmermann , David Airlie , Daniel Vetter , Jonathan Corbet , Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland Cc: Hans Verkuil , Sebastian Wick , =?utf-8?q?Ville_Syrj=C3=A4l=C3=A4?= , 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 , Dave Stevenson X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=4742; i=mripard@kernel.org; h=from:subject:message-id; bh=eZw9702RagXmh2VG3XD3rGSR1PJvIZ11Csaq049mV+s=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDKkvD8e43bhw1Je58kVm8tn12vk+rxZpL1EUXthxQH/+d PePK7WXd5SyMIhxMciKKbLECJsviTs163UnG988mDmsTCBDGLg4BWAiP7sZGbZf5N3e5fagIKF4 +0HB6PNVD9vzzKwjUl/rfvB/lZsYe4HhF1OIcWL/t/me52etyu1zup00N7jqyaoXLxTFVkbKfUh 34gcA X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D 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. Reviewed-by: Dave Stevenson 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 | 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 519228eb1095..7ad1dffe66d9 100644 --- a/drivers/gpu/drm/drm_atomic_state_helper.c +++ b/drivers/gpu/drm/drm_atomic_state_helper.c @@ -569,10 +569,26 @@ void drm_atomic_helper_connector_tv_reset(struct drm_connector *connector) drm_atomic_helper_connector_tv_margins_reset(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 * @state: the DRM State object * @@ -618,10 +634,29 @@ int drm_atomic_helper_connector_tv_check(struct drm_connector *connector, return 0; } 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 * @state: atomic connector state * 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 @@ -69,11 +69,15 @@ void drm_atomic_helper_plane_destroy_state(struct drm_plane *plane, void __drm_atomic_helper_connector_state_reset(struct drm_connector_state *conn_state, struct drm_connector *connector); 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); void __drm_atomic_helper_connector_duplicate_state(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 @@ -1029,10 +1029,17 @@ struct drm_connector_state { /** * @hdr_output_metadata: * 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; }; /** * struct drm_connector_funcs - control connectors on a given device * -- 2.43.2