From patchwork Thu Feb 22 18:13:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 204950 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp124733dyb; Thu, 22 Feb 2024 10:20:44 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWxNlCvFpHXqR/zAqf3P0BoadxbbfLIwyUt2cbExht1VgUcRmyk8jnSJFG6X1m24U5VR9g50uTWZuW6x30cNS8FXigzQQ== X-Google-Smtp-Source: AGHT+IHYIirmc67YMgaT5Ln77UV5ExJiyKqkLrshObAYosHLkFGwXdKs2Qg9f4DR89e1TzP6eAdR X-Received: by 2002:a17:90a:ff15:b0:299:63cf:4cfb with SMTP id ce21-20020a17090aff1500b0029963cf4cfbmr11497746pjb.1.1708626043957; Thu, 22 Feb 2024 10:20:43 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708626043; cv=pass; d=google.com; s=arc-20160816; b=Mb1uCnfHs9TIAQ7YvYBnU0t5dcVoxvSlJGVBUgVcC9hDmfHXXoQX/q05tkC5sPnhZg Qscl1o4aB4jGHW+l3UnRIyLw5+JEKbW5rG7dE908I87N7HSCn8ghkBpEhtEBPvPfi5sh IiezmL6qJFH3pq5ujylkPIO8z/VCoJrsCI/0Qtu/uZW9e6ftvTXOIvQEfb0fQ1Xqcv/L 2qPb6deQbGD3Pzk1tBKUouDj4NBJzAGvy7s5GwQ/hOwj8c/NbLqjndgmnhH9QVEE725U RgLx4nbvWURpZJCd4hNJqPk601b/DEtns8XOOy3svEyrOObrlSt4PwCJL6DOiM/sSs8w 4Nhg== 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=dVJUyGsT9fgyDE15RLqQu2zYooaguPtq+TCmSztn/KE=; fh=8wcoxKk21hICD+6obVirG13fsSSMhKa/pufykSf87d0=; b=LbL7Vfp/z9ed2LorIGIX1fp4je/O9O9U+BqtjUiMzmI4tk3HtW6uXjBc56nkgXpC53 zX8xAjUthGifgy4cPcXUYejqrPNr3bekL4yoFqgvkLxDfud2h1HxnA1aMthTI676fTJL /sbkyeDieJuAb0uYTRvqOIJXnvFTcbQXCX8YpmXqpXH47kLiuZCwoaS6llMuAKzvkGF3 /dorzfWUV74zgI5QC5K5J7eULQtgC3PfUnQQZWl3o5MlV+0Oxsc0Cx+1gaG1JWx8dEna QjVayP7/2KlyGCrbQVMGip+CKP6kMRz5oBmT7L1fuZeg1teXOKgm0tTtO6or/cOjskXZ VwUQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="HwC0Q/lZ"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-77079-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-77079-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id y8-20020a17090a784800b002993349c774si3994853pjl.113.2024.02.22.10.20.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 10:20:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-77079-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="HwC0Q/lZ"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-77079-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-77079-ouuuleilei=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id BE8DB281950 for ; Thu, 22 Feb 2024 18:20:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6E38E548F3; Thu, 22 Feb 2024 18:14:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="HwC0Q/lZ" 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 56A9A15DBC7; Thu, 22 Feb 2024 18:14:51 +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=1708625691; cv=none; b=YNVGZrN5dAiufydCBL5hnuaDRl9GUAsE6TcQRTC7aCdOLG5aYXg/FrpxbcT5Fkxo8MVU8mtOqL0Vwx7TgdKZDuJxuDQvviDT7FAknt/SW3BCZmg8CFdYEKdXvfua/aX5F6tKeW6BLGU2rfXExcQqZ221LPZVmqiOELIdKhA6sK0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708625691; c=relaxed/simple; bh=dIHdoNoMMYJJWCyQW9ADJIPyW+T8ZvZzWQOUCZiYfEQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=YMHTmYVNUDp8IF/hkXTh69gHc92qV0ND643YUCWmTQ0FnGjPw2Qex+T/ynPJeSMLOCAmKAzttm54EDjwhrAjljzQGZV9lhpFRviuByJjvnIgRDa6ddkuwRLAjeMySM69JQsYa8jczNGLFq9OCN4sl/dJXkR37rQzTPlZ7vkiiiE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=HwC0Q/lZ; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id A58DAC43390; Thu, 22 Feb 2024 18:14:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708625691; bh=dIHdoNoMMYJJWCyQW9ADJIPyW+T8ZvZzWQOUCZiYfEQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=HwC0Q/lZEjQ3YqAzTLwrczFmYfdq8ge73ARsPl1kYq0atRkSuUHeMnkXhaNKO+Wm+ /Zm4LZIC9PLvgQzpLgpmvjmnSEBojMf51CCVmmBoZvW23V5W7ryI8qCMchIloBl9tD e/h+xfcNdl7i5XnfbLKc54rVrCmptYUTzC1UiB/GeDdXNdXSw1OIog5q34xYmrkyJa 2YQZtdXvKQribnPtSpLzBS1TwHJ9yM9hSGMkoFv9KSnyncaFsQJEeMhb5SML+9xqfF Vv70bXiS/oKlKOYNobrZZS9G4x40SM9xWa8xtTIBXp1IJNx6VvwLq2S5C1szNg0xdT Et6Dcy4NBac3g== From: Maxime Ripard Date: Thu, 22 Feb 2024 19:13:54 +0100 Subject: [PATCH v7 08/36] 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 Message-Id: <20240222-kms-hdmi-connector-state-v7-8-8f4af575fce2@kernel.org> References: <20240222-kms-hdmi-connector-state-v7-0-8f4af575fce2@kernel.org> In-Reply-To: <20240222-kms-hdmi-connector-state-v7-0-8f4af575fce2@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?b?VmlsbGUgU3lyasOkbMOk?= , 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=4256; i=mripard@kernel.org; h=from:subject:message-id; bh=dIHdoNoMMYJJWCyQW9ADJIPyW+T8ZvZzWQOUCZiYfEQ=; b=kA0DAAoW4+8Nb2cYUcUByyZiAGXXju7IbNNjjO09fnav5cAV9V6W3b1QeU5yob2RoehN5JTRy 4h1BAAWCgAdFiEEXBM3pF7KmuuJBg6e4+8Nb2cYUcUFAmXXju4ACgkQ4+8Nb2cYUcUaBAD7BWDD jOrbPJYJ24RkduFyarqX48f+aoSKn2IGT0fNcvwA/RV6Mbbi89dJA/lIu1FpOW+hUMgiox8t/0U b63z/kP8B X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791624262651147225 X-GMAIL-MSGID: 1791624262651147225 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 @@ -571,6 +571,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 @@ -620,6 +636,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; }; /**