[PATCH 27/32] drm/i915: Implement hw state readout and checks for ultrajoiner
Ankit Nautiyal
ankit.k.nautiyal at intel.com
Wed Sep 4 08:45:38 UTC 2024
From: Stanislav Lisovskiy <stanislav.lisovskiy at intel.com>
Ultrajoiner mode has some new bits and states to be
read out from the hw. Lets make changes accordingly.
v2:
-Fix checkpatch warnings. (Ankit)
v3:
-Add separate functions for computing expected secondary_big/ultrajoiner
pipes. (Ankit)
-Remove references to master/slave in documentation. (Suraj)
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_display.c | 6 +-
drivers/gpu/drm/i915/display/intel_dss.c | 27 +++++
drivers/gpu/drm/i915/display/intel_dss.h | 3 +
drivers/gpu/drm/i915/display/intel_dss_regs.h | 2 +
drivers/gpu/drm/i915/display/intel_joiner.c | 110 ++++++++++++++----
drivers/gpu/drm/i915/display/intel_joiner.h | 8 +-
6 files changed, 127 insertions(+), 29 deletions(-)
diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index 9a591baf7174..45f9be8fe523 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -3441,6 +3441,7 @@ static u8 hsw_enabled_transcoders(struct intel_crtc *crtc)
enum transcoder cpu_transcoder;
u8 primary_pipes, secondary_pipes;
u8 enabled_transcoders = 0;
+ bool ultrajoiner_used;
/*
* XXX: Do intel_display_power_get_if_enabled before reading this (for
@@ -3492,10 +3493,11 @@ static u8 hsw_enabled_transcoders(struct intel_crtc *crtc)
enabled_transcoders |= BIT(cpu_transcoder);
/* joiner secondary -> consider the primary pipe's transcoder as well */
- intel_joiner_enabled_pipes(display, &primary_pipes, &secondary_pipes);
+ intel_joiner_enabled_pipes(display, &primary_pipes, &secondary_pipes, &ultrajoiner_used);
if (secondary_pipes & BIT(crtc->pipe)) {
cpu_transcoder = (enum transcoder)
- intel_joiner_find_primary_pipe(crtc->pipe, primary_pipes, secondary_pipes);
+ intel_joiner_find_primary_pipe(crtc->pipe, primary_pipes,
+ secondary_pipes, ultrajoiner_used);
if (transcoder_ddi_func_is_enabled(dev_priv, cpu_transcoder))
enabled_transcoders |= BIT(cpu_transcoder);
}
diff --git a/drivers/gpu/drm/i915/display/intel_dss.c b/drivers/gpu/drm/i915/display/intel_dss.c
index 68771a07993b..7feddbf99af0 100644
--- a/drivers/gpu/drm/i915/display/intel_dss.c
+++ b/drivers/gpu/drm/i915/display/intel_dss.c
@@ -264,3 +264,30 @@ void intel_dss_get_uncompressed_joiner_pipes(struct intel_crtc *crtc,
*secondary_pipes |= BIT(pipe);
}
}
+
+void intel_dss_get_ultrajoiner_pipes(struct intel_crtc *crtc,
+ u8 *primary_pipes,
+ u8 *secondary_pipes)
+{
+ struct intel_display *display = to_intel_display(crtc);
+ struct drm_i915_private *i915 = to_i915(display->drm);
+ enum intel_display_power_domain power_domain;
+ enum pipe pipe = crtc->pipe;
+ intel_wakeref_t wakeref;
+
+ if (DISPLAY_VER(i915) < 14)
+ return;
+
+ power_domain = intel_dsc_power_domain(crtc, (enum transcoder)pipe);
+ with_intel_display_power_if_enabled(i915, power_domain, wakeref) {
+ u32 tmp = intel_de_read(display, ICL_PIPE_DSS_CTL1(pipe));
+
+ if (!(tmp & ULTRA_JOINER_ENABLE))
+ continue;
+
+ if (tmp & PRIMARY_ULTRA_JOINER_ENABLE)
+ *primary_pipes |= BIT(pipe);
+ else
+ *secondary_pipes |= BIT(pipe);
+ }
+}
diff --git a/drivers/gpu/drm/i915/display/intel_dss.h b/drivers/gpu/drm/i915/display/intel_dss.h
index fd82c883c947..68605124f0ea 100644
--- a/drivers/gpu/drm/i915/display/intel_dss.h
+++ b/drivers/gpu/drm/i915/display/intel_dss.h
@@ -29,5 +29,8 @@ void intel_dss_get_compressed_joiner_pipes(struct intel_crtc *crtc,
void intel_dss_get_uncompressed_joiner_pipes(struct intel_crtc *crtc,
u8 *primary_pipes,
u8 *secondary_pipes);
+void intel_dss_get_ultrajoiner_pipes(struct intel_crtc *crtc,
+ u8 *primary_pipes,
+ u8 *secondary_pipes);
#endif /* __INTEL_DSS_H__ */
diff --git a/drivers/gpu/drm/i915/display/intel_dss_regs.h b/drivers/gpu/drm/i915/display/intel_dss_regs.h
index cd24eccb48ca..f71c195d12bd 100644
--- a/drivers/gpu/drm/i915/display/intel_dss_regs.h
+++ b/drivers/gpu/drm/i915/display/intel_dss_regs.h
@@ -36,6 +36,8 @@
#define SPLITTER_CONFIGURATION_MASK REG_GENMASK(26, 25)
#define SPLITTER_CONFIGURATION_2_SEGMENT REG_FIELD_PREP(SPLITTER_CONFIGURATION_MASK, 0)
#define SPLITTER_CONFIGURATION_4_SEGMENT REG_FIELD_PREP(SPLITTER_CONFIGURATION_MASK, 1)
+#define ULTRA_JOINER_ENABLE REG_BIT(23)
+#define PRIMARY_ULTRA_JOINER_ENABLE REG_BIT(22)
#define UNCOMPRESSED_JOINER_PRIMARY REG_BIT(21)
#define UNCOMPRESSED_JOINER_SECONDARY REG_BIT(20)
diff --git a/drivers/gpu/drm/i915/display/intel_joiner.c b/drivers/gpu/drm/i915/display/intel_joiner.c
index 6d65f4714754..15ce1fa5d189 100644
--- a/drivers/gpu/drm/i915/display/intel_joiner.c
+++ b/drivers/gpu/drm/i915/display/intel_joiner.c
@@ -120,17 +120,47 @@ static void enabled_bigjoiner_pipes(struct intel_display *display,
secondary_pipes);
}
-static u8 expected_secondary_pipes(u8 primary_pipes)
+static void enabled_ultrajoiner_pipes(struct intel_display *display,
+ u8 *primary_pipes, u8 *secondary_pipes)
{
+ struct drm_i915_private *i915 = to_i915(display->drm);
+ struct intel_crtc *crtc;
+
+ *primary_pipes = 0;
+ *secondary_pipes = 0;
+
+ for_each_intel_crtc_in_pipe_mask(&i915->drm, crtc,
+ intel_joiner_supported_pipes(display))
+ intel_dss_get_ultrajoiner_pipes(crtc,
+ primary_pipes,
+ secondary_pipes);
+}
+
+static u8 expected_secondary_bigjoiner_pipes(u8 primary_pipes)
+{
+ if (!primary_pipes)
+ return 0;
+
return primary_pipes << 1;
}
+static u8 expected_secondary_ultrajoiner_pipes(u8 primary_pipes)
+{
+ if (!primary_pipes)
+ return 0;
+
+ return GENMASK(2, primary_pipes);
+}
+
void intel_joiner_enabled_pipes(struct intel_display *display,
- u8 *primary_pipes, u8 *secondary_pipes)
+ u8 *primary_pipes, u8 *secondary_pipes,
+ bool *ultrajoiner_used)
{
u8 primary_uncompressed_joiner_pipes, primary_bigjoiner_pipes;
+ u8 primary_ultrajoiner_pipes;
u8 secondary_uncompressed_joiner_pipes, secondary_bigjoiner_pipes;
- u8 uncompressed_joiner_pipes, bigjoiner_pipes;
+ u8 secondary_ultrajoiner_pipes;
+ u8 uncompressed_joiner_pipes, bigjoiner_pipes, ultrajoiner_pipes;
enabled_uncompressed_joiner_pipes(display, &primary_uncompressed_joiner_pipes,
&secondary_uncompressed_joiner_pipes);
@@ -138,32 +168,49 @@ void intel_joiner_enabled_pipes(struct intel_display *display,
enabled_bigjoiner_pipes(display, &primary_bigjoiner_pipes,
&secondary_bigjoiner_pipes);
+ enabled_ultrajoiner_pipes(display, &primary_ultrajoiner_pipes,
+ &secondary_ultrajoiner_pipes);
+
uncompressed_joiner_pipes = primary_uncompressed_joiner_pipes |
secondary_uncompressed_joiner_pipes;
bigjoiner_pipes = primary_bigjoiner_pipes | secondary_bigjoiner_pipes;
+ ultrajoiner_pipes = primary_ultrajoiner_pipes | secondary_ultrajoiner_pipes;
+ *ultrajoiner_used = ultrajoiner_pipes != 0;
+
drm_WARN(display->drm, (uncompressed_joiner_pipes & bigjoiner_pipes) != 0,
"Uncomressed joiner pipes(%x) and bigjoiner pipes(%x) can't intersect\n",
uncompressed_joiner_pipes, bigjoiner_pipes);
+ drm_WARN(display->drm, (ultrajoiner_pipes & bigjoiner_pipes) != ultrajoiner_pipes,
+ "Ultrajoiner pipes(%x) should be bigjoiner pipes(%x)\n",
+ ultrajoiner_pipes, bigjoiner_pipes);
drm_WARN(display->drm, secondary_bigjoiner_pipes !=
- expected_secondary_pipes(primary_bigjoiner_pipes),
+ expected_secondary_bigjoiner_pipes(primary_bigjoiner_pipes),
"Wrong secondary bigjoiner pipes(expected %x, current %x)\n",
- expected_secondary_pipes(primary_bigjoiner_pipes),
+ expected_secondary_bigjoiner_pipes(primary_bigjoiner_pipes),
secondary_bigjoiner_pipes);
drm_WARN(display->drm, secondary_uncompressed_joiner_pipes !=
- expected_secondary_pipes(primary_uncompressed_joiner_pipes),
+ expected_secondary_bigjoiner_pipes(primary_uncompressed_joiner_pipes),
"Wrong secondary uncompressed joiner pipes(expected %x, current %x)\n",
- expected_secondary_pipes(primary_uncompressed_joiner_pipes),
+ expected_secondary_bigjoiner_pipes(primary_uncompressed_joiner_pipes),
secondary_uncompressed_joiner_pipes);
+ drm_WARN(display->drm, secondary_ultrajoiner_pipes !=
+ expected_secondary_ultrajoiner_pipes(primary_ultrajoiner_pipes),
+ "Wrong secondary ultrajoiner pipes(expected %x, current %x)\n",
+ expected_secondary_ultrajoiner_pipes(primary_ultrajoiner_pipes),
+ secondary_ultrajoiner_pipes);
*primary_pipes = 0;
*secondary_pipes = 0;
- *primary_pipes = primary_uncompressed_joiner_pipes | primary_bigjoiner_pipes;
- *secondary_pipes = secondary_uncompressed_joiner_pipes | secondary_bigjoiner_pipes;
+ *primary_pipes = primary_uncompressed_joiner_pipes | primary_bigjoiner_pipes |
+ primary_ultrajoiner_pipes;
+ *secondary_pipes = secondary_uncompressed_joiner_pipes | secondary_bigjoiner_pipes |
+ secondary_ultrajoiner_pipes;
}
-enum pipe intel_joiner_find_primary_pipe(enum pipe pipe, u8 primary_pipes, u8 secondary_pipes)
+enum pipe intel_joiner_find_primary_pipe(enum pipe pipe, u8 primary_pipes,
+ u8 secondary_pipes, bool ultrajoiner_used)
{
if ((secondary_pipes & BIT(pipe)) == 0)
return pipe;
@@ -171,27 +218,39 @@ enum pipe intel_joiner_find_primary_pipe(enum pipe pipe, u8 primary_pipes, u8 se
/* ignore everything above our pipe */
primary_pipes &= ~GENMASK(7, pipe);
- /* highest remaining bit should be our primary pipe */
- return fls(primary_pipes) - 1;
+ if (!ultrajoiner_used)
+ /* highest remaining bit should be our master pipe */
+ return fls(primary_pipes) - 1;
+
+ /* lowest remaining bit should be our primary master pipe */
+ return ffs(primary_pipes) - 1;
}
-u8 intel_joiner_find_secondary_pipes(enum pipe pipe, u8 primary_pipes, u8 secondary_pipes)
+u8 intel_joiner_find_secondary_pipes(enum pipe pipe, u8 primary_pipes,
+ u8 secondary_pipes, bool ultrajoiner_used)
{
enum pipe primary_pipe, next_primary_pipe;
- primary_pipe = intel_joiner_find_primary_pipe(pipe, primary_pipes, secondary_pipes);
+ primary_pipe = intel_joiner_find_primary_pipe(pipe,
+ primary_pipes,
+ secondary_pipes,
+ ultrajoiner_used);
if ((primary_pipes & BIT(primary_pipe)) == 0)
return 0;
- /* ignore our primary pipe and everything below it */
- primary_pipes &= ~GENMASK(primary_pipe, 0);
- /* make sure a high bit is set for the ffs() */
- primary_pipes |= BIT(7);
- /* lowest remaining bit should be the next primary pipe */
- next_primary_pipe = ffs(primary_pipes) - 1;
+ if (!ultrajoiner_used) {
+ /* ignore our primary pipe and everything below it */
+ primary_pipes &= ~GENMASK(primary_pipe, 0);
+ /* make sure a high bit is set for the ffs() */
+ primary_pipes |= BIT(7);
+ /* lowest remaining bit should be the next primary pipe */
+ next_primary_pipe = ffs(primary_pipes) - 1;
+
+ return secondary_pipes & GENMASK(next_primary_pipe - 1, primary_pipe);
+ }
- return secondary_pipes & GENMASK(next_primary_pipe - 1, primary_pipe);
+ return (secondary_pipes | primary_pipes) & ~BIT(primary_pipe);
}
void intel_joiner_get_config(struct intel_crtc_state *crtc_state)
@@ -199,16 +258,19 @@ void intel_joiner_get_config(struct intel_crtc_state *crtc_state)
struct intel_display *display = to_intel_display(crtc_state);
struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
u8 primary_pipes, secondary_pipes;
+ bool ultrajoiner_used;
enum pipe pipe = crtc->pipe;
- intel_joiner_enabled_pipes(display, &primary_pipes, &secondary_pipes);
+ intel_joiner_enabled_pipes(display, &primary_pipes, &secondary_pipes, &ultrajoiner_used);
if (((primary_pipes | secondary_pipes) & BIT(pipe)) == 0)
return;
crtc_state->joiner_pipes =
- BIT(intel_joiner_find_primary_pipe(pipe, primary_pipes, secondary_pipes)) |
- intel_joiner_find_secondary_pipes(pipe, primary_pipes, secondary_pipes);
+ BIT(intel_joiner_find_primary_pipe(pipe, primary_pipes,
+ secondary_pipes, ultrajoiner_used)) |
+ intel_joiner_find_secondary_pipes(pipe, primary_pipes,
+ secondary_pipes, ultrajoiner_used);
}
int intel_joiner_add_affected_planes(struct intel_atomic_state *state)
diff --git a/drivers/gpu/drm/i915/display/intel_joiner.h b/drivers/gpu/drm/i915/display/intel_joiner.h
index 787bfe1e6ee0..a01ff7ae3031 100644
--- a/drivers/gpu/drm/i915/display/intel_joiner.h
+++ b/drivers/gpu/drm/i915/display/intel_joiner.h
@@ -30,9 +30,11 @@ void intel_joiner_compute_pipe_src(struct intel_crtc_state *crtc_state);
void intel_joiner_adjust_pipe_src(struct intel_crtc_state *crtc_state);
u8 intel_joiner_supported_pipes(struct intel_display *display);
void intel_joiner_enabled_pipes(struct intel_display *display,
- u8 *primary_pipes, u8 *secondary_pipes);
-enum pipe intel_joiner_find_primary_pipe(enum pipe pipe, u8 primary_pipes, u8 secondary_pipes);
-u8 intel_joiner_find_secondary_pipes(enum pipe pipe, u8 primary_pipes, u8 secondary_pipes);
+ u8 *primary_pipes, u8 *secondary_pipes, bool *ultrajoiner_used);
+enum pipe intel_joiner_find_primary_pipe(enum pipe pipe, u8 primary_pipes,
+ u8 secondary_pipes, bool ultrajoiner_used);
+u8 intel_joiner_find_secondary_pipes(enum pipe pipe, u8 primary_pipes,
+ u8 secondary_pipes, bool ulrajoiner_used);
void intel_joiner_get_config(struct intel_crtc_state *crtc_state);
int intel_joiner_add_affected_planes(struct intel_atomic_state *state);
int intel_joiner_add_affected_crtcs(struct intel_atomic_state *state);
--
2.45.2
More information about the Intel-gfx-trybot
mailing list