xserver: Branch 'master'

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jan 3 16:47:18 UTC 2020


 hw/xfree86/drivers/modesetting/driver.c          |   11 +++++++----
 hw/xfree86/drivers/modesetting/drmmode_display.c |    8 +++++++-
 hw/xfree86/drivers/modesetting/vblank.c          |    7 ++++++-
 3 files changed, 20 insertions(+), 6 deletions(-)

New commits:
commit 4226c6d0329df440551b7b91ae573a82c64a1ac9
Author: Aaron Plattner <aplattner at nvidia.com>
Date:   Thu Dec 26 13:40:17 2019 -0800

    modesetting: Check whether RandR was initialized before calling rrGetScrPriv
    
    Calling rrGetScrPriv when RandR isn't initialized causes an assertion
    failure that aborts the server:
    
     Xorg: ../include/privates.h:121: dixGetPrivateAddr: Assertion `key->initialized' failed.
    
     Thread 1 "Xorg" received signal SIGABRT, Aborted.
     0x00007ffff78a8f25 in raise () from /usr/lib/libc.so.6
     (gdb) bt
     #0  0x00007ffff78a8f25 in raise () from /usr/lib/libc.so.6
     #1  0x00007ffff7892897 in abort () from /usr/lib/libc.so.6
     #2  0x00007ffff7892767 in __assert_fail_base.cold () from /usr/lib/libc.so.6
     #3  0x00007ffff78a1526 in __assert_fail () from /usr/lib/libc.so.6
     #4  0x00007ffff7fb57c1 in dixGetPrivateAddr (privates=0x555555ab1b60, key=0x555555855720 <rrPrivKeyRec>) at ../include/privates.h:121
     #5  0x00007ffff7fb5822 in dixGetPrivate (privates=0x555555ab1b60, key=0x555555855720 <rrPrivKeyRec>) at ../include/privates.h:136
     #6  0x00007ffff7fb586a in dixLookupPrivate (privates=0x555555ab1b60, key=0x555555855720 <rrPrivKeyRec>) at ../include/privates.h:166
     #7  0x00007ffff7fb8445 in CreateScreenResources (pScreen=0x555555ab1790) at ../hw/xfree86/drivers/modesetting/driver.c:1335
     #8  0x000055555576c5e4 in xf86CrtcCreateScreenResources (screen=0x555555ab1790) at ../hw/xfree86/modes/xf86Crtc.c:744
     #9  0x00005555555d8bb6 in dix_main (argc=4, argv=0x7fffffffead8, envp=0x7fffffffeb00) at ../dix/main.c:214
     #10 0x00005555557a4f0b in main (argc=4, argv=0x7fffffffead8, envp=0x7fffffffeb00) at ../dix/stubmain.c:34
    
    This can happen, for example, if the server is configured with Xinerama
    and there is more than one X screen:
    
     Section "ServerLayout"
       Identifier "crash"
       Screen 0 "modesetting"
       Screen 1 "dummy" RightOf "modesetting"
       Option "Xinerama"
     EndSection
    
     Section "Device"
       Identifier "modesetting"
       Driver "modesetting"
     EndSection
    
     Section "Screen"
       Identifier "modesetting"
       Device "modesetting"
     EndSection
    
     Section "Device"
       Identifier "dummy"
       Driver "dummy"
     EndSection
    
     Section "Screen"
       Identifier "dummy"
       Device "dummy"
     EndSection
    
    The problem does not reproduce if there is only one X screen because of
    this code in xf86RandR12Init:
    
     #ifdef PANORAMIX
         /* XXX disable RandR when using Xinerama */
         if (!noPanoramiXExtension) {
             if (xf86NumScreens == 1)
                 noPanoramiXExtension = TRUE;
             else
                 return TRUE;
         }
     #endif
    
    Fix the problem by checking dixPrivateKeyRegistered(rrPrivKey) before
    calling rrGetScrPriv. This is similar to what the xf86-video-amdgpu
    driver does:
    https://gitlab.freedesktop.org/xorg/driver/xf86-video-amdgpu/blob/fd66f5c0bea2b7c22a47bfd5eb1f22d32d166d9c/src/amdgpu_kms.c#L388
    
    Signed-off-by: Aaron Plattner <aplattner at nvidia.com>
    Reviewed-by: Michel Dänzer <mdaenzer at redhat.com>

diff --git a/hw/xfree86/drivers/modesetting/driver.c b/hw/xfree86/drivers/modesetting/driver.c
index 149040e30..d00e4a739 100644
--- a/hw/xfree86/drivers/modesetting/driver.c
+++ b/hw/xfree86/drivers/modesetting/driver.c
@@ -1368,7 +1368,6 @@ static Bool
 CreateScreenResources(ScreenPtr pScreen)
 {
     ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
-    rrScrPrivPtr pScrPriv = rrGetScrPriv(pScreen);
     modesettingPtr ms = modesettingPTR(pScrn);
     PixmapPtr rootPixmap;
     Bool ret;
@@ -1434,10 +1433,14 @@ CreateScreenResources(ScreenPtr pScreen)
         }
     }
 
-    pScrPriv->rrEnableSharedPixmapFlipping = msEnableSharedPixmapFlipping;
-    pScrPriv->rrDisableSharedPixmapFlipping = msDisableSharedPixmapFlipping;
+    if (dixPrivateKeyRegistered(rrPrivKey)) {
+        rrScrPrivPtr pScrPriv = rrGetScrPriv(pScreen);
 
-    pScrPriv->rrStartFlippingPixmapTracking = msStartFlippingPixmapTracking;
+        pScrPriv->rrEnableSharedPixmapFlipping = msEnableSharedPixmapFlipping;
+        pScrPriv->rrDisableSharedPixmapFlipping = msDisableSharedPixmapFlipping;
+
+        pScrPriv->rrStartFlippingPixmapTracking = msStartFlippingPixmapTracking;
+    }
 
     return ret;
 }
diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.c b/hw/xfree86/drivers/modesetting/drmmode_display.c
index 9a6abc249..b826bee6a 100644
--- a/hw/xfree86/drivers/modesetting/drmmode_display.c
+++ b/hw/xfree86/drivers/modesetting/drmmode_display.c
@@ -3245,13 +3245,19 @@ static void
 drmmode_validate_leases(ScrnInfoPtr scrn)
 {
     ScreenPtr screen = scrn->pScreen;
-    rrScrPrivPtr scr_priv = rrGetScrPriv(screen);
+    rrScrPrivPtr scr_priv;
     modesettingPtr ms = modesettingPTR(scrn);
     drmmode_ptr drmmode = &ms->drmmode;
     drmModeLesseeListPtr lessees;
     RRLeasePtr lease, next;
     int l;
 
+    /* Bail out if RandR wasn't initialized. */
+    if (!dixPrivateKeyRegistered(rrPrivKey))
+        return;
+
+    scr_priv = rrGetScrPriv(screen);
+
     /* We can't talk to the kernel about leases when VT switched */
     if (!scrn->vtSema)
         return;
diff --git a/hw/xfree86/drivers/modesetting/vblank.c b/hw/xfree86/drivers/modesetting/vblank.c
index ac4c71e38..dec5cad97 100644
--- a/hw/xfree86/drivers/modesetting/vblank.c
+++ b/hw/xfree86/drivers/modesetting/vblank.c
@@ -220,7 +220,7 @@ static RRCrtcPtr
 ms_covering_randr_crtc(ScreenPtr pScreen, BoxPtr box, Bool screen_is_ms)
 {
     ScrnInfoPtr scrn = xf86ScreenToScrn(pScreen);
-    rrScrPrivPtr pScrPriv = rrGetScrPriv(pScreen);
+    rrScrPrivPtr pScrPriv;
     RRCrtcPtr crtc, best_crtc;
     int coverage, best_coverage;
     int c;
@@ -230,6 +230,11 @@ ms_covering_randr_crtc(ScreenPtr pScreen, BoxPtr box, Bool screen_is_ms)
     best_crtc = NULL;
     best_coverage = 0;
 
+    if (!dixPrivateKeyRegistered(rrPrivKey))
+        return NULL;
+
+    pScrPriv = rrGetScrPriv(pScreen);
+
     if (!pScrPriv)
         return NULL;
 


More information about the xorg-commit mailing list