]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/i915: Add some essential functionality for joiners
authorStanislav Lisovskiy <stanislav.lisovskiy@intel.com>
Wed, 18 Sep 2024 06:30:15 +0000 (12:00 +0530)
committerAnkit Nautiyal <ankit.k.nautiyal@intel.com>
Thu, 19 Sep 2024 09:59:55 +0000 (15:29 +0530)
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: Fixed checkpatch warnings (Ankit)
v3: Introduce ultrajoiner helpers in next patch.
v4: Streamline the helpers and add few more. (Ville)
v5: Add comment to clarify that helpers apply to both bigjoiner and
uncompressed joiner configurations. (Ville)

Signed-off-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240918063016.2667721-2-ankit.k.nautiyal@intel.com
drivers/gpu/drm/i915/display/intel_display.c
drivers/gpu/drm/i915/display/intel_display.h
drivers/gpu/drm/i915/display/intel_vdsc.c

index 886abed1783b1884a230126aa15a77c3cf74417b..9f108d5e00ef58cd08210994c6bb409c7d3c2f22 100644 (file)
@@ -254,6 +254,51 @@ static enum pipe joiner_primary_pipe(const struct intel_crtc_state *crtc_state)
        return ffs(crtc_state->joiner_pipes) - 1;
 }
 
+/*
+ * The following helper functions, despite being named for bigjoiner,
+ * are applicable to both bigjoiner and uncompressed joiner configurations.
+ */
+static bool is_bigjoiner(const struct intel_crtc_state *crtc_state)
+{
+       return hweight8(crtc_state->joiner_pipes) >= 2;
+}
+
+static u8 bigjoiner_primary_pipes(const struct intel_crtc_state *crtc_state)
+{
+       if (!is_bigjoiner(crtc_state))
+               return 0;
+
+       return crtc_state->joiner_pipes & (0b01010101 << joiner_primary_pipe(crtc_state));
+}
+
+static unsigned int bigjoiner_secondary_pipes(const struct intel_crtc_state *crtc_state)
+{
+       if (!is_bigjoiner(crtc_state))
+               return 0;
+
+       return crtc_state->joiner_pipes & (0b10101010 << joiner_primary_pipe(crtc_state));
+}
+
+bool intel_crtc_is_bigjoiner_primary(const struct intel_crtc_state *crtc_state)
+{
+       struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
+
+       if (!is_bigjoiner(crtc_state))
+               return false;
+
+       return BIT(crtc->pipe) & bigjoiner_primary_pipes(crtc_state);
+}
+
+bool intel_crtc_is_bigjoiner_secondary(const struct intel_crtc_state *crtc_state)
+{
+       struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
+
+       if (!is_bigjoiner(crtc_state))
+               return false;
+
+       return BIT(crtc->pipe) & bigjoiner_secondary_pipes(crtc_state);
+}
+
 u8 intel_crtc_joiner_secondary_pipes(const struct intel_crtc_state *crtc_state)
 {
        if (crtc_state->joiner_pipes)
index e484614106320b38bbc04f78d1c3c41790a9a958..64ca0f1ae013e8329fd96f5e038bb7e4dd8ccd8b 100644 (file)
@@ -416,6 +416,8 @@ bool is_trans_port_sync_master(const struct intel_crtc_state *state);
 u8 intel_crtc_joined_pipe_mask(const struct intel_crtc_state *crtc_state);
 bool intel_crtc_is_joiner_secondary(const struct intel_crtc_state *crtc_state);
 bool intel_crtc_is_joiner_primary(const struct intel_crtc_state *crtc_state);
+bool intel_crtc_is_bigjoiner_primary(const struct intel_crtc_state *crtc_state);
+bool intel_crtc_is_bigjoiner_secondary(const struct intel_crtc_state *crtc_state);
 u8 intel_crtc_joiner_secondary_pipes(const struct intel_crtc_state *crtc_state);
 struct intel_crtc *intel_primary_crtc(const struct intel_crtc_state *crtc_state);
 bool intel_crtc_get_pipe_config(struct intel_crtc_state *crtc_state);
index 2e849b015e748b75420e573453a418da826d1020..8158e3702ed5b425c0c7df2a004e1064bbb3ec08 100644 (file)
@@ -742,7 +742,7 @@ void intel_uncompressed_joiner_enable(const struct intel_crtc_state *crtc_state)
        u32 dss_ctl1_val = 0;
 
        if (crtc_state->joiner_pipes && !crtc_state->dsc.compression_enable) {
-               if (intel_crtc_is_joiner_secondary(crtc_state))
+               if (intel_crtc_is_bigjoiner_secondary(crtc_state))
                        dss_ctl1_val |= UNCOMPRESSED_JOINER_SECONDARY;
                else
                        dss_ctl1_val |= UNCOMPRESSED_JOINER_PRIMARY;
@@ -771,7 +771,7 @@ void intel_dsc_enable(const struct intel_crtc_state *crtc_state)
        }
        if (crtc_state->joiner_pipes) {
                dss_ctl1_val |= BIG_JOINER_ENABLE;
-               if (!intel_crtc_is_joiner_secondary(crtc_state))
+               if (intel_crtc_is_bigjoiner_primary(crtc_state))
                        dss_ctl1_val |= PRIMARY_BIG_JOINER_ENABLE;
        }
        intel_de_write(dev_priv, dss_ctl1_reg(crtc, crtc_state->cpu_transcoder), dss_ctl1_val);