Skip to contentSkip to conversation

fix 2D OpenGL hang regression (Radeon RX 6700 XT)

PATCH New Corey Hickey 1 participant 2 messages Mar 11

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix 2D OpenGL hang regression (Radeon RX 6700 XT)

This fixes a regression I reported earlier:
https://gitlab.freedesktop.org/drm/amd/-/issues/4663

I tested this revert applied on top of a kernel built from 58a261bfc96763 (the commit which introduced the issue) and I did not find any problems in about 4.5 months of operation.

Today, I tested b4f0dd314b39 (Linus' tree's latest commit) and confirmed that the original problem still happens. I then applied the revert, and confirmed that the revert still fixes the original problem.

Other than that, though, I can't say whether a revert is a good fix or not. If you have a different fix that you would like me to test instead, please let me know.

Thanks,
Corey

#1 lore raw

PATCH 1/1 Revert "drm/amd/display: use a more lax vblank enable policy for older ASICs""

From: Corey Hickey <[email protected]>

This reverts commit 58a261bfc96763a851cb48b203ed57da37e157b8, largely done by hand--a 'git revert' no longer cleanly applies, due to significant changes to the file that happened in the interim.

This revert fixes a reproducible issue on a Radeon RX 6700 XT card: 2D OpenGL programs often hang.

Fixes 58a261bfc967 ("drm/amd/display: use a more lax vblank enable policy for older ASICs")
---
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 87 ++++++++++---------
 1 file changed, 45 insertions(+), 42 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +45 -42
index b3d6f2cd8ab6..a8aa610f2c83 100644
@@ -9323,53 +9323,56 @@ static void manage_dm_interrupts(struct amdgpu_device *adev,
 	int offdelay;
 
 	if (acrtc_state) {
-		timing = &acrtc_state->stream->timing;
+		if (amdgpu_ip_version(adev, DCE_HWIP, 0) <
+		    IP_VERSION(3, 5, 0)) {
+			drm_crtc_vblank_on(&acrtc->base);
+		} else {
+			timing = &acrtc_state->stream->timing;
 
-		/*
-		 * Depending on when the HW latching event of double-buffered
-		 * registers happen relative to the PSR SDP deadline, and how
-		 * bad the Panel clock has drifted since the last ALPM off
-		 * event, there can be up to 3 frames of delay between sending
-		 * the PSR exit cmd to DMUB fw, and when the panel starts
-		 * displaying live frames.
-		 *
-		 * We can set:
-		 *
-		 * 20/100 * offdelay_ms = 3_frames_ms
-		 * => offdelay_ms = 5 * 3_frames_ms
-		 *
-		 * This ensures that `3_frames_ms` will only be experienced as a
-		 * 20% delay on top how long the display has been static, and
-		 * thus make the delay less perceivable.
-		 */
-		if (acrtc_state->stream->link->psr_settings.psr_version <
-		    DC_PSR_VERSION_UNSUPPORTED) {
-			offdelay = DIV64_U64_ROUND_UP((u64)5 * 3 * 10 *
-						      timing->v_total *
-						      timing->h_total,
-						      timing->pix_clk_100hz);
-			config.offdelay_ms = offdelay ?: 30;
-		} else if (amdgpu_ip_version(adev, DCE_HWIP, 0) <
-			   IP_VERSION(3, 5, 0) ||
-			   !(adev->flags & AMD_IS_APU)) {
 			/*
-			 * Older HW and DGPU have issues with instant off;
-			 * use a 2 frame offdelay.
+			 * Depending on when the HW latching event of double-buffered
+			 * registers happen relative to the PSR SDP deadline, and how
+			 * bad the Panel clock has drifted since the last ALPM off
+			 * event, there can be up to 3 frames of delay between sending
+			 * the PSR exit cmd to DMUB fw, and when the panel starts
+			 * displaying live frames.
+			 *
+			 * We can set:
+			 *
+			 * 20/100 * offdelay_ms = 3_frames_ms
+			 * => offdelay_ms = 5 * 3_frames_ms
+			 *
+			 * This ensures that `3_frames_ms` will only be experienced as a
+			 * 20% delay on top how long the display has been static, and
+			 * thus make the delay less perceivable.
 			 */
-			offdelay = DIV64_U64_ROUND_UP((u64)20 *
-						      timing->v_total *
-						      timing->h_total,
-						      timing->pix_clk_100hz);
+			if (acrtc_state->stream->link->psr_settings.psr_version <
+				DC_PSR_VERSION_UNSUPPORTED) {
+				offdelay = DIV64_U64_ROUND_UP((u64)5 * 3 * 10 *
+								  timing->v_total *
+								  timing->h_total,
+								  timing->pix_clk_100hz);
+				config.offdelay_ms = offdelay ?: 30;
+			} else if (!(adev->flags & AMD_IS_APU)) {
+				/*
+				 * DGPU has issues with instant off;
+				 * use a 2 frame offdelay.
+				 */
+				offdelay = DIV64_U64_ROUND_UP((u64)20 *
+								  timing->v_total *
+								  timing->h_total,
+								  timing->pix_clk_100hz);
 
-			config.offdelay_ms = offdelay ?: 30;
-		} else {
-			/* offdelay_ms = 0 will never disable vblank */
-			config.offdelay_ms = 1;
-			config.disable_immediate = true;
-		}
+				config.offdelay_ms = offdelay ?: 30;
+			} else {
+				/* offdelay_ms = 0 will never disable vblank */
+				config.offdelay_ms = 1;
+				config.disable_immediate = true;
+			}
 
-		drm_crtc_vblank_on_config(&acrtc->base,
-					  &config);
+			drm_crtc_vblank_on_config(&acrtc->base,
+						  &config);
+		}
 		/* Allow RX6xxx, RX7700, RX7800 GPUs to call amdgpu_irq_get.*/
 		switch (amdgpu_ip_version(adev, DCE_HWIP, 0)) {
 		case IP_VERSION(3, 0, 0):
Signature · 1 line
2.51.0