Skip to contentSkip to conversation

Don't set up black scanout buffer if LeaveVT is called from CloseScreen

PATCH In review Michel Dänzer 2 participants 2 messages Sep 20, 2019 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Don't set up black scanout buffer if LeaveVT is called from CloseScreen

From: Michel Dänzer <[email protected]>

Avoids a crash described in
https://gitlab.freedesktop.org/xorg/driver/xf86-video-amdgpu/merge_requests/43#note_223718

(Ported from amdgpu commit 5b8bc9fc505c551dcd9b0ed5ab835a49fa4f9fda)

---
 src/radeon_kms.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
src/radeon_kms.c +9 -1
index 777fc14ee..107c1ce71 100644
@@ -2629,6 +2629,12 @@ void RADEONLeaveVT_KMS(ScrnInfoPtr pScrn)
 	unsigned w = 0, h = 0;
 	int i;
 
+	/* If we're called from CloseScreen, trying to clear the black
+	 * scanout BO will likely crash and burn
+	 */
+	if (!pScreen->GCperDepth[0])
+	    goto hide_cursors;
+
 	/* Compute maximum scanout dimensions of active CRTCs */
 	for (i = 0; i < xf86_config->num_crtc; i++) {
 	    crtc = xf86_config->crtc[i];
@@ -2701,8 +2707,10 @@ void RADEONLeaveVT_KMS(ScrnInfoPtr pScrn)
 	       pScrn->displayWidth * info->pixel_bytes * pScrn->virtualY);
     }
 
-    TimerSet(NULL, 0, 1000, cleanup_black_fb, pScreen);
+    if (pScreen->GCperDepth[0])
+	TimerSet(NULL, 0, 1000, cleanup_black_fb, pScreen);
 
+ hide_cursors:
     xf86_hide_cursors (pScrn);
 
     radeon_drop_drm_master(pScrn);
Signature · 6 lines
2.23.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 20190920170059.5465-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org

Reviewed-by
#2 lore raw
Quoted 9 lines · Michel Dänzer

From: Michel Dänzer <[email protected]>

Avoids a crash described in
https://gitlab.freedesktop.org/xorg/driver/xf86-video-amdgpu/merge_requests/43#note_223718

(Ported from amdgpu commit 5b8bc9fc505c551dcd9b0ed5ab835a49fa4f9fda)

Quoted 36 lines
---
 src/radeon_kms.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
src/radeon_kms.c +9 -2
index 777fc14ee..107c1ce71 100644
@@ -2629,6 +2629,12 @@ void RADEONLeaveVT_KMS(ScrnInfoPtr pScrn)
        unsigned w = 0, h = 0;
        int i;
 
+       /* If we're called from CloseScreen, trying to clear the black
+        * scanout BO will likely crash and burn
+        */
+       if (!pScreen->GCperDepth[0])
+           goto hide_cursors;
+
        /* Compute maximum scanout dimensions of active CRTCs */
        for (i = 0; i < xf86_config->num_crtc; i++) {
            crtc = xf86_config->crtc[i];
@@ -2701,8 +2707,10 @@ void RADEONLeaveVT_KMS(ScrnInfoPtr pScrn)
               pScrn->displayWidth * info->pixel_bytes * pScrn->virtualY);
     }
 
-    TimerSet(NULL, 0, 1000, cleanup_black_fb, pScreen);
+    if (pScreen->GCperDepth[0])
+       TimerSet(NULL, 0, 1000, cleanup_black_fb, pScreen);
 
+ hide_cursors:
     xf86_hide_cursors (pScrn);
 
     radeon_drop_drm_master(pScrn);
--

2.23.0

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx