[PATCH 24/32] drm/i915/joiner: Add some essential functionality for joiners

Ankit Nautiyal ankit.k.nautiyal at intel.com
Wed Sep 4 08:45:35 UTC 2024


From: Stanislav Lisovskiy <stanislav.lisovskiy at intel.com>

In most of the cases we now try to avoid mentioning things like
"bigjoiner" or "ultrajoiner" trying to unify the API and refer
mostly to all this functionality as "joiner".
In majority cases that should be way to go.
However in some cases we still need to distinguish between
bigjoiner primaries and secondaries(such as DSC register programming).

Create correspondent helper functions and start using them,
in order be prepared for adding ultrajoiner functionality.

v2: Fix checkpatch warnings (Ankit)
v3: Move new functions to intel_joiner files. (Ankit)

Signed-off-by: Stanislav Lisovskiy <stanislav.lisovskiy at intel.com>
Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal at intel.com>
---
 drivers/gpu/drm/i915/display/intel_joiner.c | 62 +++++++++++++++++++++
 drivers/gpu/drm/i915/display/intel_joiner.h |  7 +++
 2 files changed, 69 insertions(+)

diff --git a/drivers/gpu/drm/i915/display/intel_joiner.c b/drivers/gpu/drm/i915/display/intel_joiner.c
index 072a22119788..90a2871ef6ff 100644
--- a/drivers/gpu/drm/i915/display/intel_joiner.c
+++ b/drivers/gpu/drm/i915/display/intel_joiner.c
@@ -274,3 +274,65 @@ struct intel_crtc *intel_joiner_primary_crtc(const struct intel_crtc_state *crtc
 	else
 		return to_intel_crtc(crtc_state->uapi.crtc);
 }
+
+bool intel_joiner_is_bigjoiner(const struct intel_crtc_state *crtc_state)
+{
+	return intel_joiner_get_num_pipes(crtc_state) == INTEL_JOINER_BIG_JOINER_PIPES;
+}
+
+bool intel_joiner_is_ultrajoiner(const struct intel_crtc_state *crtc_state)
+{
+	return intel_joiner_get_num_pipes(crtc_state) == INTEL_JOINER_ULTRA_JOINER_PIPES;
+}
+
+static bool is_joiner(const struct intel_crtc_state *crtc_state)
+{
+	return intel_joiner_get_num_pipes(crtc_state) > 1;
+}
+
+u8 intel_joiner_bigjoiner_primary_pipes(const struct intel_crtc_state *crtc_state)
+{
+	int lsb = ffs(crtc_state->joiner_pipes) - 1;
+	int msb = fls(crtc_state->joiner_pipes) - 1;
+	int i;
+	u8 bigjoiner_primary_mask = 0;
+
+	for (i = lsb; i < msb; i += 4) {
+		/*
+		 * Regardless of how joiner_pipes mask is set, currently
+		 * we always assume, that primary pipe bit goes before secondary
+		 * pipe bit. So in each set of 2 bits, least significant bit is
+		 * bigjoiner primary pipe and most significant bit is secondary pipe.
+		 */
+		bigjoiner_primary_mask |=
+			((BIT(0) | BIT(2)) << i) & crtc_state->joiner_pipes;
+	}
+
+	return bigjoiner_primary_mask;
+}
+
+bool intel_joiner_is_bigjoiner_primary(const struct intel_crtc_state *crtc_state)
+{
+	struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
+
+	if (!is_joiner(crtc_state))
+		return false;
+
+	return BIT(crtc->pipe) & intel_joiner_bigjoiner_primary_pipes(crtc_state);
+}
+
+bool intel_joiner_is_bigjoiner_secondary(const struct intel_crtc_state *crtc_state)
+{
+	if (!is_joiner(crtc_state))
+		return false;
+
+	return !intel_joiner_is_bigjoiner_primary(crtc_state);
+}
+
+bool intel_joiner_is_ultrajoiner_primary(const struct intel_crtc_state *crtc_state)
+{
+	struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
+
+	return intel_joiner_is_ultrajoiner(crtc_state) &&
+		(crtc->pipe == intel_joiner_get_primary_pipe(crtc_state));
+}
diff --git a/drivers/gpu/drm/i915/display/intel_joiner.h b/drivers/gpu/drm/i915/display/intel_joiner.h
index 0092124b9442..787bfe1e6ee0 100644
--- a/drivers/gpu/drm/i915/display/intel_joiner.h
+++ b/drivers/gpu/drm/i915/display/intel_joiner.h
@@ -11,6 +11,7 @@
 enum intel_joiner_pipe_count {
 	INTEL_JOINER_NO_JOINER_PIPES = 0,
 	INTEL_JOINER_BIG_JOINER_PIPES = 2,
+	INTEL_JOINER_ULTRA_JOINER_PIPES = 4,
 	INTEL_JOINER_INVALID_JOINER_PIPES,
 };
 
@@ -40,5 +41,11 @@ bool intel_joiner_crtc_is_joiner_primary(const struct intel_crtc_state *crtc_sta
 bool intel_joiner_crtc_is_joiner_secondary(const struct intel_crtc_state *crtc_state);
 u8 intel_joiner_crtc_joiner_secondary_pipes(const struct intel_crtc_state *crtc_state);
 struct intel_crtc *intel_joiner_primary_crtc(const struct intel_crtc_state *crtc_state);
+bool intel_joiner_is_bigjoiner(const struct intel_crtc_state *crtc_state);
+bool intel_joiner_is_ultrajoiner(const struct intel_crtc_state *crtc_state);
+u8 intel_joiner_bigjoiner_primary_pipes(const struct intel_crtc_state *crtc_state);
+bool intel_joiner_is_bigjoiner_primary(const struct intel_crtc_state *crtc_state);
+bool intel_joiner_is_bigjoiner_secondary(const struct intel_crtc_state *crtc_state);
+bool intel_joiner_is_ultrajoiner_primary(const struct intel_crtc_state *crtc_state);
 
 #endif/* __INTEL_JOINER_H__ */
-- 
2.45.2



More information about the Intel-gfx-trybot mailing list