Skip to content
/ linux Public

Commit 8a7d29b

Browse files
vsyrjalagregkh
authored andcommitted
drm/i915/vrr: Configure VRR timings after enabling TRANS_DDI_FUNC_CTL
[ Upstream commit 237aab5 ] 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: dda7dcd ("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> Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 1aa7745 commit 8a7d29b

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

drivers/gpu/drm/i915/display/intel_display.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1642,7 +1642,6 @@ static void hsw_configure_cpu_transcoder(const struct intel_crtc_state *crtc_sta
16421642
}
16431643

16441644
intel_set_transcoder_timings(crtc_state);
1645-
intel_vrr_set_transcoder_timings(crtc_state);
16461645

16471646
if (cpu_transcoder != TRANSCODER_EDP)
16481647
intel_de_write(display, TRANS_MULT(display, cpu_transcoder),

drivers/gpu/drm/i915/display/intel_vrr.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,18 @@ void intel_vrr_set_transcoder_timings(const struct intel_crtc_state *crtc_state)
464464
if (!HAS_VRR(display))
465465
return;
466466

467+
/*
468+
* Bspec says:
469+
* "(note: VRR needs to be programmed after
470+
* TRANS_DDI_FUNC_CTL and before TRANS_CONF)."
471+
*
472+
* In practice it turns out that ICL can hang if
473+
* TRANS_VRR_VMAX/FLIPLINE are written before
474+
* enabling TRANS_DDI_FUNC_CTL.
475+
*/
476+
drm_WARN_ON(display->drm,
477+
!(intel_de_read(display, TRANS_DDI_FUNC_CTL(display, cpu_transcoder)) & TRANS_DDI_FUNC_ENABLE));
478+
467479
/*
468480
* This bit seems to have two meanings depending on the platform:
469481
* TGL: generate VRR "safe window" for DSB vblank waits
@@ -658,6 +670,8 @@ void intel_vrr_transcoder_enable(const struct intel_crtc_state *crtc_state)
658670
if (!HAS_VRR(display))
659671
return;
660672

673+
intel_vrr_set_transcoder_timings(crtc_state);
674+
661675
if (!intel_vrr_possible(crtc_state))
662676
return;
663677

0 commit comments

Comments
 (0)