Linux-Media Archive mirror
 help / color / mirror / Atom feed
From: Maxime Ripard <mripard@kernel.org>
To: "Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"Thomas Zimmermann" <tzimmermann@suse.de>,
	"David Airlie" <airlied@gmail.com>,
	"Daniel Vetter" <daniel@ffwll.ch>,
	"Jonathan Corbet" <corbet@lwn.net>,
	"Sandy Huang" <hjc@rock-chips.com>,
	"Heiko Stübner" <heiko@sntech.de>, "Chen-Yu Tsai" <wens@csie.org>,
	"Jernej Skrabec" <jernej.skrabec@gmail.com>,
	"Samuel Holland" <samuel@sholland.org>,
	"Andy Yan" <andy.yan@rock-chips.com>
Cc: "Hans Verkuil" <hverkuil@xs4all.nl>,
	"Sebastian Wick" <sebastian.wick@redhat.com>,
	"Ville Syrjälä" <ville.syrjala@linux.intel.com>,
	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" <mripard@kernel.org>,
	"Dave Stevenson" <dave.stevenson@raspberrypi.com>,
	"Sui Jingfeng" <sui.jingfeng@linux.dev>
Subject: [PATCH v13 04/28] drm/connector: hdmi: Create an HDMI sub-state
Date: Tue, 07 May 2024 15:17:22 +0200	[thread overview]
Message-ID: <20240507-kms-hdmi-connector-state-v13-4-8fafc5efe8be@kernel.org> (raw)
In-Reply-To: <20240507-kms-hdmi-connector-state-v13-0-8fafc5efe8be@kernel.org>

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 <dave.stevenson@raspberrypi.com>
Reviewed-by: Sui Jingfeng <sui.jingfeng@linux.dev>
Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
 drivers/gpu/drm/display/Kconfig                 |  7 +++++
 drivers/gpu/drm/display/Makefile                |  2 ++
 drivers/gpu/drm/display/drm_hdmi_state_helper.c | 41 +++++++++++++++++++++++++
 include/drm/display/drm_hdmi_state_helper.h     | 16 ++++++++++
 include/drm/drm_connector.h                     |  7 +++++
 5 files changed, 73 insertions(+)

diff --git a/drivers/gpu/drm/display/Kconfig b/drivers/gpu/drm/display/Kconfig
index 864a6488bfdf..14114b597ef4 100644
--- a/drivers/gpu/drm/display/Kconfig
+++ b/drivers/gpu/drm/display/Kconfig
@@ -68,5 +68,12 @@ config DRM_DISPLAY_HDCP_HELPER
 config DRM_DISPLAY_HDMI_HELPER
 	bool
 	depends on DRM_DISPLAY_HELPER
 	help
 	  DRM display helpers for HDMI.
+
+config DRM_DISPLAY_HDMI_STATE_HELPER
+	bool
+	depends on DRM_DISPLAY_HELPER
+	depends on DRM_DISPLAY_HDMI_HELPER
+	help
+	  DRM KMS state helpers for HDMI.
diff --git a/drivers/gpu/drm/display/Makefile b/drivers/gpu/drm/display/Makefile
index 17d2cc73ff56..629df2f4d322 100644
--- a/drivers/gpu/drm/display/Makefile
+++ b/drivers/gpu/drm/display/Makefile
@@ -12,9 +12,11 @@ drm_display_helper-$(CONFIG_DRM_DISPLAY_DP_TUNNEL) += \
 	drm_dp_tunnel.o
 drm_display_helper-$(CONFIG_DRM_DISPLAY_HDCP_HELPER) += drm_hdcp_helper.o
 drm_display_helper-$(CONFIG_DRM_DISPLAY_HDMI_HELPER) += \
 	drm_hdmi_helper.o \
 	drm_scdc_helper.o
+drm_display_helper-$(CONFIG_DRM_DISPLAY_HDMI_STATE_HELPER) += \
+	drm_hdmi_state_helper.o
 drm_display_helper-$(CONFIG_DRM_DISPLAY_DP_AUX_CHARDEV) += drm_dp_aux_dev.o
 drm_display_helper-$(CONFIG_DRM_DISPLAY_DP_AUX_CEC) += drm_dp_cec.o
 
 obj-$(CONFIG_DRM_DISPLAY_HELPER) += drm_display_helper.o
diff --git a/drivers/gpu/drm/display/drm_hdmi_state_helper.c b/drivers/gpu/drm/display/drm_hdmi_state_helper.c
new file mode 100644
index 000000000000..1e92c1108d23
--- /dev/null
+++ b/drivers/gpu/drm/display/drm_hdmi_state_helper.c
@@ -0,0 +1,41 @@
+// SPDX-License-Identifier: MIT
+
+#include <drm/drm_atomic.h>
+#include <drm/drm_connector.h>
+
+#include <drm/display/drm_hdmi_state_helper.h>
+
+/**
+ * __drm_atomic_helper_connector_hdmi_reset() - Initializes all HDMI @drm_connector_state resources
+ * @connector: DRM connector
+ * @new_conn_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_conn_state)
+{
+}
+EXPORT_SYMBOL(__drm_atomic_helper_connector_hdmi_reset);
+
+/**
+ * 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);
diff --git a/include/drm/display/drm_hdmi_state_helper.h b/include/drm/display/drm_hdmi_state_helper.h
new file mode 100644
index 000000000000..6021983e2602
--- /dev/null
+++ b/include/drm/display/drm_hdmi_state_helper.h
@@ -0,0 +1,16 @@
+#/* SPDX-License-Identifier: MIT */
+
+#ifndef DRM_HDMI_STATE_HELPER_H_
+#define DRM_HDMI_STATE_HELPER_H_
+
+struct drm_atomic_state;
+struct drm_connector;
+struct drm_connector_state;
+
+void __drm_atomic_helper_connector_hdmi_reset(struct drm_connector *connector,
+					      struct drm_connector_state *new_conn_state);
+
+int drm_atomic_helper_connector_hdmi_check(struct drm_connector *connector,
+					   struct drm_atomic_state *state);
+
+#endif // DRM_HDMI_STATE_HELPER_H_
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.45.0


  parent reply	other threads:[~2024-05-07 13:17 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-07 13:17 [PATCH v13 00/28] drm/connector: Create HDMI Connector infrastructure Maxime Ripard
2024-05-07 13:17 ` [PATCH v13 01/28] drm/connector: Introduce an HDMI connector initialization function Maxime Ripard
2024-05-07 13:17 ` [PATCH v13 02/28] drm/mode_object: Export drm_mode_obj_find_prop_id for tests Maxime Ripard
2024-05-07 13:17 ` [PATCH v13 03/28] drm/tests: connector: Add tests for drmm_connector_hdmi_init Maxime Ripard
2024-05-07 13:17 ` Maxime Ripard [this message]
2024-05-07 13:17 ` [PATCH v13 05/28] drm/connector: hdmi: Add output BPC to the connector state Maxime Ripard
2024-05-07 13:17 ` [PATCH v13 06/28] drm/tests: Add output bpc tests Maxime Ripard
2024-05-07 13:17 ` [PATCH v13 07/28] drm/connector: hdmi: Add support for output format Maxime Ripard
2024-05-07 13:17 ` [PATCH v13 08/28] drm/tests: Add output formats tests Maxime Ripard
2024-05-07 13:17 ` [PATCH v13 09/28] drm/display: hdmi: Add HDMI compute clock helper Maxime Ripard
2024-05-07 13:17 ` [PATCH v13 10/28] drm/tests: Add HDMI TDMS character rate tests Maxime Ripard
2024-05-07 13:17 ` [PATCH v13 11/28] drm/connector: hdmi: Calculate TMDS character rate Maxime Ripard
2024-05-07 13:17 ` [PATCH v13 12/28] drm/tests: Add TDMS character rate connector state tests Maxime Ripard
2024-05-07 13:17 ` [PATCH v13 13/28] drm/connector: hdmi: Add custom hook to filter TMDS character rate Maxime Ripard
2024-05-07 13:17 ` [PATCH v13 14/28] drm/tests: Add HDMI connector rate filter hook tests Maxime Ripard
2024-05-07 13:17 ` [PATCH v13 15/28] drm/connector: hdmi: Compute bpc and format automatically Maxime Ripard
2024-05-12  8:18   ` Andy Yan
2024-05-16  9:45     ` [PATCH " Maxime Ripard
2024-05-07 13:17 ` [PATCH v13 16/28] drm/tests: Add HDMI connector bpc and format tests Maxime Ripard
2024-05-07 13:17 ` [PATCH v13 17/28] drm/connector: hdmi: Add Broadcast RGB property Maxime Ripard
2024-05-07 13:17 ` [PATCH v13 18/28] drm/tests: Add tests for " Maxime Ripard
2024-05-07 13:17 ` [PATCH v13 19/28] drm/connector: hdmi: Add RGB Quantization Range to the connector state Maxime Ripard
2024-05-07 13:17 ` [PATCH v13 20/28] drm/tests: Add RGB Quantization tests Maxime Ripard
2024-05-07 13:17 ` [PATCH v13 21/28] drm/connector: hdmi: Add Infoframes generation Maxime Ripard
2024-05-07 13:17 ` [PATCH v13 22/28] drm/tests: Add infoframes test Maxime Ripard
2024-05-07 13:17 ` [PATCH v13 23/28] drm/connector: hdmi: Create Infoframe DebugFS entries Maxime Ripard
2024-05-07 13:17 ` [PATCH v13 24/28] drm/vc4: hdmi: Switch to HDMI connector Maxime Ripard
2024-05-07 13:17 ` [PATCH v13 25/28] drm/vc4: tests: Remove vc4_dummy_plane structure Maxime Ripard
2024-05-07 13:17 ` [PATCH v13 26/28] drm/vc4: tests: Convert to plane creation helper Maxime Ripard
2024-05-07 13:17 ` [PATCH v13 27/28] drm/rockchip: inno_hdmi: Switch to HDMI connector Maxime Ripard
2024-05-12  8:29   ` Andy Yan
2024-05-16  9:36     ` [PATCH " Maxime Ripard
2024-05-07 13:17 ` [PATCH v13 28/28] drm/sun4i: hdmi: " Maxime Ripard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240507-kms-hdmi-connector-state-v13-4-8fafc5efe8be@kernel.org \
    --to=mripard@kernel.org \
    --cc=airlied@gmail.com \
    --cc=andy.yan@rock-chips.com \
    --cc=corbet@lwn.net \
    --cc=daniel@ffwll.ch \
    --cc=dave.stevenson@raspberrypi.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=heiko@sntech.de \
    --cc=hjc@rock-chips.com \
    --cc=hverkuil@xs4all.nl \
    --cc=jernej.skrabec@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=samuel@sholland.org \
    --cc=sebastian.wick@redhat.com \
    --cc=sui.jingfeng@linux.dev \
    --cc=tzimmermann@suse.de \
    --cc=ville.syrjala@linux.intel.com \
    --cc=wens@csie.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).