Blame SOURCES/0002-Don-t-crash-X-server-if-GPU-acceleration-is-not-avai.patch

cfff6e
From c0eb5dbd9c1db6b6d5b1574bcd8c584170d7ab54 Mon Sep 17 00:00:00 2001
cfff6e
From: Alexey Sheplyakov <asheplyakov@altlinux.org>
cfff6e
Date: Wed, 27 Nov 2019 20:50:58 +0400
cfff6e
Subject: [PATCH 2/2] Don't crash X server if GPU acceleration is not available
cfff6e
MIME-Version: 1.0
cfff6e
Content-Type: text/plain; charset=UTF-8
cfff6e
Content-Transfer-Encoding: 8bit
cfff6e
cfff6e
Commit d1d8e3c8d0a0a0394d395eba171460501745209b causes X server
cfff6e
to fail on startup when GPU acceleration is not working (or is
cfff6e
disabled). The reason is that `radeon_get_pixmap_bo` function
cfff6e
gets called too early (before EXA has been initialized) and
cfff6e
fails with an assert:
cfff6e
cfff6e
 #0  __GI_raise (sig=<optimized out>) at ../sysdeps/unix/sysv/linux/raise.c:50
cfff6e
 #1  0x76ab1c6c in __GI_abort () at abort.c:79
cfff6e
 #2  0x76ac0b64 in __assert_fail_base (fmt=0x76bfbce4 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x7658c80c "key->initialized", file=<optimized out>, line=121,
cfff6e
     function=0x7658d040 <__PRETTY_FUNCTION__.10607> "dixGetPrivateAddr") at assert.c:92
cfff6e
 #3  0x76ac0c0c in __GI___assert_fail (assertion=0x7658c80c "key->initialized", file=0x7658c9d0 "../include/privates.h", line=121,
cfff6e
     function=0x7658d040 <__PRETTY_FUNCTION__.10607> "dixGetPrivateAddr") at assert.c:101
cfff6e
 #4  0x76579e6c in dixGetPrivateAddr (key=<optimized out>, key=<optimized out>, privates=<optimized out>) at ../include/privates.h:121
cfff6e
 #5  0x7657a954 in dixGetPrivateAddr (key=<optimized out>, key=<optimized out>, privates=<optimized out>) at exa.c:70
cfff6e
 #6  dixGetPrivate (key=<optimized out>, privates=<optimized out>) at ../include/privates.h:136
cfff6e
 #7  exaGetPixmapDriverPrivate (pPix=<optimized out>) at exa.c:68
cfff6e
 #8  0x7623d460 in radeon_get_pixmap_bo (pPix=0x71c1b8) at radeon.h:804
cfff6e
 #9  radeon_get_pixmap_handle (pixmap=0x71c1b8, handle=0x7fa22328) at radeon_bo_helper.c:357
cfff6e
 #10 0x76244458 in radeon_pixmap_get_fb (pix=0x71c1b8) at radeon.h:886
cfff6e
 #11 drmmode_set_mode_major (crtc=0x691860, mode=0x69191c, rotation=<optimized out>, x=<optimized out>, y=<optimized out>) at drmmode_display.c:918
cfff6e
 #12 0x762467e8 in drmmode_set_desired_modes (pScrn=0x67c678, drmmode=<optimized out>, set_hw=1) at drmmode_display.c:3128
cfff6e
 #13 0x0047bfa4 in MapWindow (client=0x669ec8, pWin=0x7206c0) at window.c:2722
cfff6e
 #14 MapWindow (pWin=0x7206c0, client=0x669ec8) at window.c:2665
cfff6e
 #15 0x00449650 in dix_main (argc=3, argv=0x7fa22604, envp=<optimized out>) at main.c:247
cfff6e
 #16 0x76ab2198 in __libc_start_main (main=0x42db10 <main>, argc=3, argv=0x7fa22604, init=<optimized out>, fini=0x606434 <__libc_csu_fini>, rtld_fini=0x77229930 <_dl_fini>,
cfff6e
     stack_end=0x7fa225e0) at libc-start.c:308
cfff6e
 #17 0x0042db80 in __start () at ../sysdeps/mips/start.S:110
cfff6e
cfff6e
Don't call `exaGetPixmapDriverPrivate` if the acceleration (EXA) is not
cfff6e
enabled [yet] to avoid the problem.
cfff6e
cfff6e
Closes: https://gitlab.freedesktop.org/xorg/driver/xf86-video-ati/issues/188
cfff6e
Closes: https://bugzilla.altlinux.org/show_bug.cgi?id=37539
cfff6e
Signed-off-by: Michel Dänzer <mdaenzer@redhat.com>
cfff6e
---
cfff6e
 src/radeon.h | 4 ++--
cfff6e
 1 file changed, 2 insertions(+), 2 deletions(-)
cfff6e
cfff6e
diff --git a/src/radeon.h b/src/radeon.h
cfff6e
index 8e964805..e4a2ba66 100644
cfff6e
--- a/src/radeon.h
cfff6e
+++ b/src/radeon.h
cfff6e
@@ -790,8 +790,8 @@ static inline Bool radeon_set_pixmap_bo(PixmapPtr pPix, struct radeon_buffer *bo
cfff6e
 
cfff6e
 static inline struct radeon_buffer *radeon_get_pixmap_bo(PixmapPtr pPix)
cfff6e
 {
cfff6e
-#ifdef USE_GLAMOR
cfff6e
     RADEONInfoPtr info = RADEONPTR(xf86ScreenToScrn(pPix->drawable.pScreen));
cfff6e
+#ifdef USE_GLAMOR
cfff6e
 
cfff6e
     if (info->use_glamor) {
cfff6e
 	struct radeon_pixmap *priv;
cfff6e
@@ -799,7 +799,7 @@ static inline struct radeon_buffer *radeon_get_pixmap_bo(PixmapPtr pPix)
cfff6e
 	return priv ? priv->bo : NULL;
cfff6e
     } else
cfff6e
 #endif
cfff6e
-    {
cfff6e
+    if (info->accelOn) {
cfff6e
 	struct radeon_exa_pixmap_priv *driver_priv;
cfff6e
 	driver_priv = exaGetPixmapDriverPrivate(pPix);
cfff6e
 	return driver_priv ? driver_priv->bo : NULL;
cfff6e
-- 
cfff6e
2.26.2
cfff6e