Blame SOURCES/0001-Don-t-set-up-black-scanout-buffer-if-LeaveVT-is-call.patch

678102
From 2cbbd8648cdd27db8076565943b932ef81337053 Mon Sep 17 00:00:00 2001
678102
From: =?UTF-8?q?Michel=20D=C3=A4nzer?= <mdaenzer@redhat.com>
678102
Date: Fri, 20 Sep 2019 18:47:02 +0200
678102
Subject: [PATCH xf86-video-ati] Don't set up black scanout buffer if LeaveVT
678102
 is called from CloseScreen
678102
678102
Avoids a crash described in
678102
https://gitlab.freedesktop.org/xorg/driver/xf86-video-amdgpu/merge_requests/43#note_223718
678102
678102
(Ported from amdgpu commit 5b8bc9fc505c551dcd9b0ed5ab835a49fa4f9fda)
678102
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
678102
---
678102
 src/radeon_kms.c | 10 +++++++++-
678102
 1 file changed, 9 insertions(+), 1 deletion(-)
678102
678102
diff --git a/src/radeon_kms.c b/src/radeon_kms.c
678102
index 777fc14e..107c1ce7 100644
678102
--- a/src/radeon_kms.c
678102
+++ b/src/radeon_kms.c
678102
@@ -2629,6 +2629,12 @@ void RADEONLeaveVT_KMS(ScrnInfoPtr pScrn)
678102
 	unsigned w = 0, h = 0;
678102
 	int i;
678102
 
678102
+	/* If we're called from CloseScreen, trying to clear the black
678102
+	 * scanout BO will likely crash and burn
678102
+	 */
678102
+	if (!pScreen->GCperDepth[0])
678102
+	    goto hide_cursors;
678102
+
678102
 	/* Compute maximum scanout dimensions of active CRTCs */
678102
 	for (i = 0; i < xf86_config->num_crtc; i++) {
678102
 	    crtc = xf86_config->crtc[i];
678102
@@ -2701,8 +2707,10 @@ void RADEONLeaveVT_KMS(ScrnInfoPtr pScrn)
678102
 	       pScrn->displayWidth * info->pixel_bytes * pScrn->virtualY);
678102
     }
678102
 
678102
-    TimerSet(NULL, 0, 1000, cleanup_black_fb, pScreen);
678102
+    if (pScreen->GCperDepth[0])
678102
+	TimerSet(NULL, 0, 1000, cleanup_black_fb, pScreen);
678102
 
678102
+ hide_cursors:
678102
     xf86_hide_cursors (pScrn);
678102
 
678102
     radeon_drop_drm_master(pScrn);
678102
-- 
678102
2.21.0
678102