]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/i915/vrr: Configure VRR timings after enabling TRANS_DDI_FUNC_CTL
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Tue, 3 Mar 2026 09:54:14 +0000 (11:54 +0200)
committerTvrtko Ursulin <tursulin@ursulin.net>
Tue, 10 Mar 2026 08:11:29 +0000 (08:11 +0000)
Apparently ICL may hang with an MCE if we write TRANS_VRR_VMAX/FLIPLINE
before enabling TRANS_DDI_FUNC_CTL.

Personally I was only able to reproduce a hang (on an Dell XPS 7390
2-in-1) with an external display connected via a dock using a dodgy
type-C cable that made the link training fail. After the failed
link training the machine would hang. TGL seemed immune to the
problem for whatever reason.

BSpec does tell us to configure VRR after enabling TRANS_DDI_FUNC_CTL
as well. The DMC firmware also does the VRR restore in two stages:
- first stage seems to be unconditional and includes TRANS_VRR_CTL
  and a few other VRR registers, among other things
- second stage is conditional on the DDI being enabled,
  and includes TRANS_DDI_FUNC_CTL and TRANS_VRR_VMAX/VMIN/FLIPLINE,
  among other things

So let's reorder the steps to match to avoid the hang, and
toss in an extra WARN to make sure we don't screw this up later.

BSpec: 22243
Cc: stable@vger.kernel.org
Cc: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Reported-by: Benjamin Tissoires <bentiss@kernel.org>
Closes: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/15777
Tested-by: Benjamin Tissoires <bentiss@kernel.org>
Fixes: dda7dcd9da73 ("drm/i915/vrr: Use fixed timings for platforms that support VRR")
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patch.msgid.link/20260303095414.4331-1-ville.syrjala@linux.intel.com
Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
(cherry picked from commit 93f3a267c3dd4d811b224bb9e179a10d81456a74)
Signed-off-by: Tvrtko Ursulin <tursulin@ursulin.net>
drivers/gpu/drm/i915/display/intel_display.c
drivers/gpu/drm/i915/display/intel_vrr.c

index 3b8ba8ab76a1b21f9f8a419f79a12aca8c09a536..c4246481fc2fe942213f3db1bb13f753e42e2550 100644 (file)
@@ -1614,7 +1614,6 @@ static void hsw_configure_cpu_transcoder(const struct intel_crtc_state *crtc_sta
        }
 
        intel_set_transcoder_timings(crtc_state);
-       intel_vrr_set_transcoder_timings(crtc_state);
 
        if (cpu_transcoder != TRANSCODER_EDP)
                intel_de_write(display, TRANS_MULT(display, cpu_transcoder),
index db74744ddb31a927bbabcbb8ed3923de055b7c2f..bea00575232713ad24eaa82df39bcfe85c494602 100644 (file)
@@ -597,6 +597,18 @@ void intel_vrr_set_transcoder_timings(const struct intel_crtc_state *crtc_state)
        if (!HAS_VRR(display))
                return;
 
+       /*
+        * Bspec says:
+        * "(note: VRR needs to be programmed after
+        *  TRANS_DDI_FUNC_CTL and before TRANS_CONF)."
+        *
+        * In practice it turns out that ICL can hang if
+        * TRANS_VRR_VMAX/FLIPLINE are written before
+        * enabling TRANS_DDI_FUNC_CTL.
+        */
+       drm_WARN_ON(display->drm,
+                   !(intel_de_read(display, TRANS_DDI_FUNC_CTL(display, cpu_transcoder)) & TRANS_DDI_FUNC_ENABLE));
+
        /*
         * This bit seems to have two meanings depending on the platform:
         * TGL: generate VRR "safe window" for DSB vblank waits
@@ -939,6 +951,8 @@ void intel_vrr_transcoder_enable(const struct intel_crtc_state *crtc_state)
 {
        struct intel_display *display = to_intel_display(crtc_state);
 
+       intel_vrr_set_transcoder_timings(crtc_state);
+
        if (!intel_vrr_possible(crtc_state))
                return;