]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/i915/vrr: Add function to check if DC Balance Possible
authorMitul Golani <mitulkumar.ajitkumar.golani@intel.com>
Tue, 23 Dec 2025 10:45:30 +0000 (16:15 +0530)
committerAnkit Nautiyal <ankit.k.nautiyal@intel.com>
Tue, 30 Dec 2025 04:30:25 +0000 (10:00 +0530)
Add a function that checks if DC Balance enabling is possible on the
requested PIPE. Apart from the DISPLAY_VER check, account for current
firmware limitations, which only allow DC Balance on PIPE A and PIPE B.

v2: Rephrased commit message. (Ankit)

Signed-off-by: Mitul Golani <mitulkumar.ajitkumar.golani@intel.com>
Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Link: https://patch.msgid.link/20251223104542.2688548-9-mitulkumar.ajitkumar.golani@intel.com
drivers/gpu/drm/i915/display/intel_vrr.c

index 952e3c31bacca3c3e99dd8eae3b6a1eb9a17c548..dbfe56e8973dc7a01af80d04a747b81279a62a8d 100644 (file)
@@ -351,13 +351,28 @@ int intel_vrr_compute_vmax(struct intel_connector *connector,
        return vmax;
 }
 
+static bool intel_vrr_dc_balance_possible(const 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);
+       enum pipe pipe = crtc->pipe;
+
+       /*
+        * FIXME: Currently Firmware supports DC Balancing on PIPE A
+        * and PIPE B. Account those limitation while computing DC
+        * Balance parameters.
+        */
+       return (HAS_VRR_DC_BALANCE(display) &&
+               ((pipe == PIPE_A) || (pipe == PIPE_B)));
+}
+
 static void
 intel_vrr_dc_balance_compute_config(struct intel_crtc_state *crtc_state)
 {
        int guardband_usec, adjustment_usec;
        struct drm_display_mode *adjusted_mode = &crtc_state->hw.adjusted_mode;
 
-       if (!HAS_VRR_DC_BALANCE(display) || !crtc_state->vrr.enable)
+       if (!intel_vrr_dc_balance_possible(crtc_state) || !crtc_state->vrr.enable)
                return;
 
        crtc_state->vrr.dc_balance.vmax = crtc_state->vrr.vmax;
@@ -839,7 +854,7 @@ void intel_vrr_get_dc_balance_config(struct intel_crtc_state *crtc_state)
        struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
        enum pipe pipe = crtc->pipe;
 
-       if (!HAS_VRR_DC_BALANCE(display))
+       if (!intel_vrr_dc_balance_possible(crtc_state))
                return;
 
        reg_val = intel_de_read(display, PIPEDMC_DCB_VMIN(pipe));