Hi,

The diff below update the X server to version 1.20.6.
See ChangeLog for changes.

Testing and oks are welcome.

Index: ChangeLog
===================================================================
RCS file: /cvs/OpenBSD/xenocara/xserver/ChangeLog,v
retrieving revision 1.33
diff -u -p -u -r1.33 ChangeLog
--- ChangeLog   27 Jul 2019 07:57:06 -0000      1.33
+++ ChangeLog   23 Nov 2019 11:51:22 -0000
@@ -1,3 +1,929 @@
+commit 6b3fafa9bfa94b9b04a1a44dc52afb7c4bc250ce
+Author: Matt Turner <matts...@gmail.com>
+Date:   Fri Nov 22 17:52:04 2019 -0500
+
+    xserver 1.20.6
+    
+    Signed-off-by: Matt Turner <matts...@gmail.com>
+
+commit 88f12aa74bf4fea25d5b8d8002b3088432feb405
+Author: Matt Turner <matts...@gmail.com>
+Date:   Thu Nov 21 11:23:18 2019 -0500
+
+    xfree86: Test presence of isastream()
+    
+    isastream() was never more than a stub in glibc, and was removed in
+    glibc-2.30 by commit a0a0dc83173c ("Remove obsolete, never-implemented
+    XSI STREAMS declarations").
+    
+    Bug: https://bugs.gentoo.org/700838
+    Reviewed-by: Julien Cristau <jcris...@debian.org>
+    Signed-off-by: Matt Turner <matts...@gmail.com>
+    (cherry picked from commit e6ab7f9f342f463092c45226f3294074351fdd5e)
+
+commit 0e60139064b84b856c59e5a456e26c60710b1b69
+Author: Olivier Fourdan <ofour...@redhat.com>
+Date:   Mon Nov 18 17:28:45 2019 +0100
+
+    present/wnmd: Relax assertion on CRTC on abort_vblank()
+    
+    Currently, the function `present_wnmd_abort_vblank()` would fail if the
+    given `crtc` is NULL.
+    
+    However, `xwl_present_get_crtc()` can return `NULL` under some
+    circumstances, which would cause an unexpected termination of Xwayland
+    in such a case, caused by the assertion failure being triggered.
+    
+    Remove the assertion, considering that the `crtc` isn't actually used in
+    neither `present_wnmd_abort_vblank()` nor `xwl_present_abort_vblank()`.
+    
+    Signed-off-by: Olivier Fourdan <ofour...@redhat.com>
+    Reviewed-by: Michel Dänzer <mdaen...@redhat.com>
+    Closes: https://gitlab.freedesktop.org/xorg/xserver/issues/937
+    (cherry picked from commit 4f984fc06bd57cabfa38f6191f10714878dc8969)
+
+commit 2edadf26f1f8deddbe171115fa502337ac62df02
+Author: Aaron Plattner <aplatt...@nvidia.com>
+Date:   Tue Nov 19 10:08:51 2019 -0800
+
+    os: Don't crash in AttendClient if the client is gone
+    
+    If a client is in the process of being closed down, then its 
client->osPrivate
+    pointer will be set to NULL by CloseDownConnection. This can cause a crash 
if
+    freeing the client's resources results in a call to AttendClient. For 
example,
+    if the client has a pending sync fence:
+    
+     Thread 1 "X" received signal SIGSEGV, Segmentation fault.
+     AttendClient (client=0x5571c4aed9a0) at ../os/connection.c:942
+     (gdb) bt
+     #0  AttendClient (client=0x5571c4aed9a0) at ../os/connection.c:942
+     #1  0x00005571c3dbb865 in SyncAwaitTriggerFired (pTrigger=<optimized 
out>) at ../Xext/sync.c:694
+     #2  0x00005571c3dd5749 in miSyncDestroyFence (pFence=0x5571c5063980) at 
../miext/sync/misync.c:120
+     #3  0x00005571c3dbbc69 in FreeFence (obj=<optimized out>, id=<optimized 
out>) at ../Xext/sync.c:1909
+     #4  0x00005571c3d7a01d in doFreeResource (res=0x5571c506e3d0, 
skip=skip@entry=0) at ../dix/resource.c:880
+     #5  0x00005571c3d7b1dc in FreeClientResources (client=0x5571c4aed9a0) at 
../dix/resource.c:1146
+     #6  FreeClientResources (client=0x5571c4aed9a0) at ../dix/resource.c:1109
+     #7  0x00005571c3d5525f in CloseDownClient (client=0x5571c4aed9a0) at 
../dix/dispatch.c:3473
+     #8  0x00005571c3d55eeb in Dispatch () at ../dix/dispatch.c:492
+     #9  0x00005571c3d59e96 in dix_main (argc=3, argv=0x7ffe7854bc28, 
envp=<optimized out>) at ../dix/main.c:276
+     #10 0x00007fea4837cb6b in __libc_start_main (main=0x5571c3d1d060 <main>, 
argc=3, argv=0x7ffe7854bc28, init=<optimized out>, fini=<optimized out>, 
rtld_fini=<optimized out>, stack_end=0x7ffe7854bc18) at ../csu/libc-start.c:308
+     #11 0x00005571c3d1d09a in _start () at ../Xext/sync.c:2378
+     (gdb) print client->osPrivate
+     $1 = (void *) 0x0
+    
+    Since the client is about to be freed, its ignore count doesn't matter and
+    AttendClient can simply be a no-op. Check for client->clientGone in 
AttendClient
+    and remove similar checks from two callers that had them.
+    
+    Signed-off-by: Aaron Plattner <aplatt...@nvidia.com>
+    (cherry picked from commit 4308f5d3d1fbd0f5dce81e22c0c3f08c65a7c9d8)
+
+commit 68cfee97bc59580724d594c82f5ee55a980dadf0
+Author: Adam Jackson <a...@redhat.com>
+Date:   Wed Oct 9 11:57:18 2019 -0400
+
+    dix: Call SourceValidate before GetImage
+    
+    This ensures that any prep work for the drawable we're about to read
+    from is already done before we call down to GetImage. This should be no
+    functional change as most of the callers with a non-trivial
+    SourceValidate are already wrapping GetImage and doing the equivalent
+    thing, but we'll be simplifying that shortly.
+    
+    More importantly this ensures that if any of that prep work would
+    generate events - like automatic compositing flushing rendering to a
+    parent pixmap which then triggers damage - then it happens entirely
+    before we start writing the GetImage reply header.
+    
+    Note that we do not do the same for GetSpans, but that's okay. The only
+    way to get to GetSpans is through miCopyArea or miCopyPlane - where the
+    callers must already call SourceValidate - or miGetImage - which this
+    commit now protects with SourceValidate.
+    
+    Fixes: xorg/xserver#902
+    Reviewed-by: Michel Dänzer <mdaen...@redhat.com>
+    (cherry picked from commit 516e75dbb6bbf97c7af9c2226242ffd9259fec11)
+
+commit 2320fd4b52a60411714170d516fc58e6ec516353
+Author: Adam Jackson <a...@redhat.com>
+Date:   Wed Oct 9 11:27:12 2019 -0400
+
+    mi: Add a default no-op miSourceValidate
+    
+    Slightly simplifies the callers since they don't need to check for
+    non-NULL anymore.
+    
+    I do extremely hate the workarounds here to suppress misprite taking the
+    cursor down though. Surely there's a better way.
+    
+    [1.20: Do not in fact simplify the callers as above, since it would
+    change the ABI. - ajax]
+    
+    Reviewed-by: Michel Dänzer <mdaen...@redhat.com>
+    (cherry picked from commit ff310903f34ac34c916ad74e919d1ac12aea4715)
+
+commit 07efd81b819f21046afc0bb7e19a6cdf7f3c7ea9
+Author: Olivier Fourdan <ofour...@redhat.com>
+Date:   Mon Jul 1 13:20:39 2019 +0200
+
+    compiler.h: Do not include sys/io.h on ARM with glibc
+    
+    <sys/io.h> on ARM hasn't worked for a long, long time, so it was removed
+    it from glibc upstream.
+    
+    Remove the include to avoid a compilation failure on ARM with glibc.
+    
+    Signed-off-by: Olivier Fourdan <ofour...@redhat.com>
+    Closes: https://gitlab.freedesktop.org/xorg/xserver/issues/840
+    (cherry picked from commit fe4cd0e7f5c58fa94db36326aadc1bd4e6d73eba)
+
+commit 03b91e17ce72649b2d6946213f5a7d152bfe7098
+Author: Aaron Plattner <aplatt...@nvidia.com>
+Date:   Wed Nov 6 10:45:43 2019 -0800
+
+    xfree86: Call ScreenInit for protocol screens before GPU screens
+    
+    During startup, the xfree86 DDX's InitOutput() calls PreInit for
+    protocol screens first, and then GPU screens. On teardown, dix_main()
+    calls CloseScreen in the reverse order: GPU screens first starting with
+    the last one and then working backwards, and then protocol screens also
+    in reverse order.
+    
+    InitOutput() calls ScreenInit in the wrong order: for GPU screens first 
and then
+    for protocol screens. This causes a problem for drivers that have global 
state
+    that is tied to the first screen that calls ScreenInit.
+    
+    Fix this by simply re-ordering the for loops to call PreInit for
+    protocol screens first and then for GPU screens second.
+    
+    (cherry picked from commit e5e9a8ca91d1c087edd8788a110251ad940dbc94)
+
+commit 325f694e97a117aec47aa2e1a9b2b28c3c47994e
+Author: Alex Goins <ago...@nvidia.com>
+Date:   Tue Sep 17 18:36:35 2019 -0500
+
+    modesetting: Implement ms_covering_randr_crtc() for ms_present_get_crtc()
+    
+    ms_present_get_crtc() returns an RRCrtcPtr, but derives it from a 
xf86CrtcPtr
+    found via ms_dri2_crtc_covering_drawable()=>ms_covering_crtc(). As a 
result, it
+    depends on all associated DIX ScreenRecs having an xf86CrtcConfigPtr DDX
+    private.
+    
+    Some DIX ScreenRecs don't have an xf86CrtcConfigPtr DDX private, but do 
have an
+    rrScrPrivPtr DDX private. Given that we can derive all of the information 
we
+    need from RandR, we can support these screens by avoiding the use of 
xf86Crtc.
+    This change implements an RandR-based path for ms_present_get_crtc(), 
allowing
+    drawables to successfully fall back to syncing to the primary output, even 
if
+    the slave doesn't have an xf86CrtcConfigPtr DDX private.
+    
+    Without this change, if a slave doesn't have an xf86CrtcConfigPtr DDX 
private,
+    drawables will fall back to 1 FPS if they overlap an output on that slave.
+    
+    Signed-off-by: Alex Goins <ago...@nvidia.com>
+    (cherry picked from commit 562c7888be538c4d043ec1f374a9d9afa0b305a4)
+
+commit aa43dce15f69624ce939bb69bafc3df5a9b78dbb
+Author: Alex Goins <ago...@nvidia.com>
+Date:   Tue Sep 17 18:03:34 2019 -0500
+
+    modesetting: Fix ms_covering_crtc() segfault with non-xf86Crtc slave
+    
+    DIX ScreenRecs don't necessarily have an xf86CrtcConfigPtr DDX private.
+    ms_covering_crtc() assumes that they do, which can result in a segfault.
+    
+    Update ms_covering_crtc() to check the XF86_CRTC_CONFIG_PTR() returned 
pointer
+    before dereferencing it. This will still mean that ms_covering_crtc() 
can't fall
+    back to the primary output when a drawable overlaps a slave output (going 
to the
+    1 FPS default instead), but it won't segfault.
+    
+    Signed-off-by: Alex Goins <ago...@nvidia.com>
+    (cherry picked from commit 797e7a0ceb673fe2870c673e248835526a84d000)
+
+commit 341a4787157c68597951727d5d11a2813a31ec7e
+Author: Alex Goins <ago...@nvidia.com>
+Date:   Wed Aug 28 18:24:16 2019 -0500
+
+    modesetting: Fix ms_covering_crtc() segfault with non-modesetting slave 
primary
+    
+    ms_covering_crtc() uses RRFirstOutput() to determine a primary output to 
fall
+    back to if a drawable is overlapping a slave output.
+    
+    If the primary output is a slave output, RRFirstOutput() will return a 
slave
+    output even if passed a master ScreenPtr. ms_covering_crtc() dereferences 
the
+    output's devPrivate, which is invalid for non-modesetting outputs, and can
+    crash.
+    
+    Changing RRFirstOutput() could have unintended side effects for other 
callers,
+    so this change replaces the call to RRFirstOutput() with ms_first_output().
+    ms_first_output() ignores the primary output if it doesn't match the given
+    ScreenPtr, choosing the first connected output instead.
+    
+    Signed-off-by: Alex Goins <ago...@nvidia.com>
+    (cherry picked from commit 3ef9029ace4245d9f8929aa71e22bc6a6f40b7b3)
+
+commit 2dd9dfc8d9a5dc906ee06d667a756ab267f55e64
+Author: Alex Goins <ago...@nvidia.com>
+Date:   Wed Sep 4 12:25:31 2019 -0500
+
+    randr: Fix RRCrtcDetachScanoutPixmap() segfault during server teardown
+    
+    During server teardown, mrootdraw is NULL, which can cause segfaults if
+    master->Stop{,Flipping}PixmapTracking() don't do NULL checking. In this 
case we
+    shouldn't need to do master->Stop{,Flipping}PixmapTracking() anyway, so 
just
+    skip it.
+    
+    Signed-off-by: Alex Goins <ago...@nvidia.com>
+    (cherry picked from commit c82f814313a813d7e1a2d7d3b1f7561810446b34)
+
+commit 642c1f83b9ed2452ceb20457a4423a8f52a7a8c4
+Author: Hans de Goede <hdego...@redhat.com>
+Date:   Mon Nov 4 20:03:17 2019 +0100
+
+    glamor/xwayland: Define EGL_NO_X11
+    
+    Define EGL_NO_X11 everywhere were we also define MESA_EGL_NO_X11_HEADERS,
+    EGL_NO_X11 is the MESA_EGL_NO_X11_HEADERS equivalent for the egl headers
+    shipped with libglvnd.
+    
+    This fixes the xserver not building with the libglvnd-1.2.0 headers:
+    
+    In file included from /usr/include/EGL/eglplatform.h:128,
+                     from /usr/include/epoxy/egl_generated.h:11,
+                     from /usr/include/epoxy/egl.h:46,
+                     from glamor_priv.h:43,
+                     from glamor_composite_glyphs.c:25:
+    /usr/include/X11/Xlib.h:222:2: error: conflicting types for 'GC'
+      222 | *GC;
+          |  ^~
+    In file included from glamor.h:34,
+                     from glamor_priv.h:32,
+                     from glamor_composite_glyphs.c:25:
+    ../include/gcstruct.h:282:3: note: previous declaration of 'GC' was here
+      282 | } GC;
+          |   ^~
+    
+    Signed-off-by: Hans de Goede <hdego...@redhat.com>
+    (cherry picked from commit 741bd73429e337071f49509ddcc5fb392e20b0f6)
+
+commit 2f55e8dc270fb65e8ff013c5e846a1a510c761e0
+Author: Adam Jackson <a...@redhat.com>
+Date:   Wed Oct 9 16:03:17 2019 -0400
+
+    meson: Apparently 1.2 is < 1.2.0
+    
+    Siiiigh.
+    
+    (cherry picked from commit 3340ddf37743fdf197dfc16a97107435ff53c6e4)
+
+commit e16eb696f2238796827794d2d3b23f268cf4daf0
+Author: Adam Jackson <a...@redhat.com>
+Date:   Wed Oct 9 15:17:47 2019 -0400
+
+    meson: Fix another reference to "gl" 9.2.0
+    
+    Previous commit e6ef2b12 missed a spot.
+    
+    (cherry picked from commit c7486613b0dc586f93f6ba293d9b55c69995b05c)
+
+commit a57729d3180ee4bc3ae012cfd03fe5188d858a83
+Author: Marvin Schmidt <m...@exherbo.org>
+Date:   Tue Sep 24 09:58:43 2019 +0200
+
+    build: glx: Lower gl version to work with libglvnd
+    
+    When using mesa with libglvnd support, mesa will no longer install the
+    gl, glx, egl pkg-config files but instead let libglvnd provide them.
+    libglvnd maintainers decided to change the versioning as it was
+    mesa-specific previously. Now the libraries have versions of the API
+    they expose[1].
+    This causes problems when building the X server:
+    
+      checking for glproto >= 1.4.17 gl >= 9.2.0... no
+      configure: error: Package requirements (glproto >= 1.4.17 gl >= 9.2.0) 
were not met:
+    
+      Requested 'gl >= 9.2.0' but version of gl is 1.2
+    
+    Lower the version requirement to 1.2 to allow building against libglvnd
+    provided libraries
+    
+    [1] 
https://github.com/NVIDIA/libglvnd/commit/0dfaea2bcb7cdcc785f95e244223bd004a2d7fba
+    
+    (cherry picked from commit e6ef2b12404dfec7f23592a3524d2a63d9d25802)
+
+commit 3491f1dc5c701656e2f69f74b459dfcaef9451d6
+Author: Sven Joachim <svenj...@gmx.de>
+Date:   Wed Oct 2 18:26:07 2019 +0200
+
+    modesetting: Fix broken manpage in autoconf build
+    
+    The autoconf build for the modesetting driver still relied on
+    xorg-macros.m4 for string replacements and did not include the
+    top-level manpages.am.  As a result, no substitutions took place after
+    commit 2e497bf887aca832dc0dd30d071c5288ab5c1e15.
+    
+    This should be a candidate for the 1.20 branch.
+    
+    Reviewed-by: Michel Dänzer <mdaen...@redhat.com>
+    (cherry picked from commit de0d39f825cce7422986011ee9d5db91f15e2987)
+
+commit df1f8f691d7550a18d2076a44c109b1cb6da05ae
+Author: Alexander Tsoy <alexan...@tsoy.me>
+Date:   Mon Sep 23 18:23:40 2019 +0300
+
+    configure: Set libdrm flags correctly if only XORG is enabled
+    
+    This fixes modesetting driver build failure which can be triggered with
+    the following configure options:
+    
+    $ ./configure --disable-dri --disable-dri2 --disable-dri3
+    --disable-config-udev --enable-xorg
+    
+    Bugzilla: https://bugs.gentoo.org/689768
+    Signed-off-by: Alexander Tsoy <alexan...@tsoy.me>
+    Reviewed-by: Emil Velikov <emil.veli...@collabora.com>
+    (cherry picked from commit 334f1107146a2e6ebf6f7743b77aec2ad5c46f75)
+
+commit fada61e89dd1f20fe8e2e0fb9e4baefb45b4b848
+Author: Matt Turner <matts...@gmail.com>
+Date:   Fri Aug 9 20:22:29 2019 -0700
+
+    dix: Assert noPanoramiXExtension is false in PanoramiX code
+    
+    When compiling with link time optimization, GCC thinks it's discovered
+    undefined behavior:
+    
+    events.c: In function 'XineramaConfineCursorToWindow':
+    events.c:609:13: warning: iteration 2147483647 invokes undefined behavior 
[-Waggressive-loop-optimizations]
+    events.c:609:11: note: within this loop
+    events.c:605:49: warning: array subscript -1 is below array bounds of 
'struct _Window *[16]' [-Warray-bounds]
+    events.c:606:31: warning: array subscript -1 is below array bounds of 
'struct _Screen *[16]' [-Warray-bounds]
+    events.c:610:39: warning: array subscript -2 is below array bounds of 
'struct _Screen *[16]' [-Warray-bounds]
+    events.c:617:38: warning: array subscript -2 is below array bounds of 
'struct _Window *[16]' [-Warray-bounds]
+    events.c:619:35: warning: array subscript -2 is below array bounds of 
'struct _Screen *[16]' [-Warray-bounds]
+    
+    This results from
+    
+        i = PanoramiXNumScreens - 1;
+    
+        RegionCopy(&pSprite->Reg1, &pSprite->windows[i]->borderSize);
+        off_x = screenInfo.screens[i]->x;
+        off_y = screenInfo.screens[i]->y;
+    
+    where GCC believes that PanoramiXNumScreens might be 0. Unfortunately
+    GCC is just smart enough to be an annoyance because this case is not
+    actually possible: XineramaConfineCursorToWindow() is only called when
+    noPanoramiXExtension is false, and if noPanoramiXExtension is false then
+    PanoramiXNumScreens must be >1 (see PanoramiXExtensionInit()).
+    
+    So, add an assert(!noPanoramiXExtension), which to my surprise provides
+    GCC with information even in release builds and lets GCC understand that
+    the code is not doing anything that is undefined behavior.
+    
+    I chose this solution instead of the proposed assert(i >= 0) because the
+    same pattern occurs in CheckVirtualMotion() but is inside an
+    'if (!noPanoramiXExtension)' and does not generate any warnings.
+    
+    Fixes: xorg/xserver#590
+    Signed-off-by: Matt Turner <matts...@gmail.com>
+    (cherry picked from commit 61aa40aeb3d4efefda47f245ed4b83a1a19b1d4c)
+
+commit e815db543450c38d1d4ec03184b8e82fa0a37498
+Author: Alexander Volkov <a.vol...@rusbitech.ru>
+Date:   Mon Feb 11 18:54:10 2019 +0300
+
+    shm: Use memfd_create when possible
+    
+    It doesn't require shared memory dir and thus allows
+    to avoid cases when this dir is detected incorrectly,
+    as in https://bugreports.qt.io/browse/QTBUG-71440
+    
+    Signed-off-by: Alexander Volkov <a.vol...@rusbitech.ru>
+    (cherry picked from commit f6753c117ef0f83499d5e2d6dda226fec9ddf803)
+
+commit 05c5b970136f0a11fffa16692744bdf5a23963e8
+Author: Eric Anholt <e...@anholt.net>
+Date:   Wed Sep 19 13:28:06 2018 -0700
+
+    shm: Pick the shm dir at run time, not build time.
+    
+    Prodding the builder's filesystem for tmp dirs doesn't necessarily
+    tell you anything about what the actual host's filesystem is going to
+    look like, so we should just try the dirs at runtime.
+    
+    Signed-off-by: Eric Anholt <e...@anholt.net>
+    (cherry picked from commit 19f6cb570becbc4e355807199c6e251fc7935132)
+
+commit 9ee4e35bfe084fa942c2b2ce46405e048eb335a8
+Author: Eric Anholt <e...@anholt.net>
+Date:   Wed Sep 19 13:20:12 2018 -0700
+
+    shm: reindent shm_tmpfile to follow our standards.
+    
+    Signed-off-by: Eric Anholt <e...@anholt.net>
+    (cherry picked from commit 804a9b4f57107fa2d0ed1ae0becda5bebaffe6e1)
+
+commit b6ee04e774af1fc2e2560583c95dfac688494c2a
+Author: Samuel Thibault <samuel.thiba...@ens-lyon.org>
+Date:   Mon Jul 1 02:31:02 2019 +0200
+
+    Fix crash on XkbSetMap
+    
+    Some devices may not have keyboard information.
+    
+    Fixes #574
+    
+    (cherry picked from commit 8469bfead9515ab3644f1769a1ff51466ba8ffee)
+
+commit 616b3e1dd19d51688e4cba380394bd93c62b50d4
+Author: Samuel Thibault <samuel.thiba...@ens-lyon.org>
+Date:   Mon Jul 1 02:33:26 2019 +0200
+
+    Fix crash on XkbSetMap
+    
+    Since group_info and width are used for the key actions allocations,
+    when modifying them we need to take care of reallocation key actions if
+    needed.
+    
+    (cherry picked from commit fabc4219622f3c0b41b1cb897c46e092377059e3)
+
+commit c747dbb250c11c6a02641b253e7322145dc9b913
+Author: Michel Dänzer <mdaen...@redhat.com>
+Date:   Mon Sep 23 18:35:41 2019 +0200
+
+    miext/sync: Make struct _SyncObject::initialized fully ABI compatible
+    
+    With a 32-bit build, putting the initialized field at the end of the
+    struct bumped the struct size from 20 bytes to 24, changing the layout
+    of other structs embedding struct _SyncObject. While this would be
+    acceptable on master, it caused crashes with 1.20.
+    
+    Making the initialized field a char and putting it in the hole before
+    the beingDestroyed field restores the 32-bit ABI as well.
+    
+    Fixes https://gitlab.freedesktop.org/xorg/xserver/issues/892
+    
+    Reviewed-by: Aaron Plattner <aplatt...@nvidia.com>
+    Reviewed-by: Alex Goins <ago...@nvidia.com>
+    (cherry picked from commit 0d8cc7bb180468fee72330f40d87f6e9db7b42c0)
+
+commit 5aadaac9499c71ebf88c0e5fc658d9d56c8a7e16
+Author: Andres Rodriguez <andre...@gmail.com>
+Date:   Fri Sep 6 18:32:44 2019 -0400
+
+    xf86: Disable unused crtc functions when a lease is revoked
+    
+    This fixes 'non-desktop' displays staying powered on after their lease
+    has been revoked.
+    
+    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=111620
+    Cc: Keith Packard <kei...@keithp.com>
+    Signed-off-by: Andres Rodriguez <andre...@gmail.com>
+
+commit 63346c74393e1df4555f84367529802a67578ef6
+Author: Carlos Garnacho <carl...@gnome.org>
+Date:   Mon Jan 7 15:33:35 2019 +0100
+
+    xwayland: Handle the case of windows being realized before redirection
+    
+    If Xwayland gets to realize a window meant for composition before the
+    compositor redirected windows (i.e. redirect mode is not RedirectDrawManual
+    yet), the window would stay "invisible" as we wouldn't create a
+    wl_surface/wl_shell_surface for it at any later point.
+    
+    This scenario may happen if the wayland compositor sets up a X11 socket
+    upfront, but waits to raise Xwayland until there are X11 clients. In this
+    case the first data on the socket is the client's, the compositor can 
hardly
+    beat that in order to redirect subwindows before the client realizes a
+    Window.
+    
+    In order to jump across this hurdle, allow the late creation of a matching
+    (shell) surface for the WindowPtr on SetWindowPixmapProc, so it is ensured
+    to be created after the compositor set up redirection.
+    
+    Signed-off-by: Carlos Garnacho <carl...@gnome.org>
+    Reviewed-by: Michel Dänzer <mdaen...@redhat.com>
+    Reviewed-by: Olivier Fourdan <ofour...@redhat.com>
+    (cherry picked from commit 78cc8b6f9613fc71f6ecc7e8848d54364a250634)
+
+commit 12db645c7fc0539752a881df7ac2bcd09e3cb17b
+Author: Carlos Garnacho <carl...@gnome.org>
+Date:   Mon Jan 7 15:33:31 2019 +0100
+
+    xwayland: Refactor surface creation into a separate function
+    
+    This is just called from xwl_window_realize() ATM, but will be useful in
+    future commits.
+    
+    Signed-off-by: Carlos Garnacho <carl...@gnome.org>
+    (cherry picked from commit c2e8ae964052944312c5023ca7ea5c41a92990e5)
+
+commit e0af09061f9e8397ca564ec3bbedea51974455d4
+Author: Carlos Garnacho <carl...@gnome.org>
+Date:   Mon Jan 7 15:20:05 2019 +0100
+
+    xwayland: Separate DamagePtr into separate window data
+    
+    This will be dissociated in future commits to handle the cases
+    where windows are being realized before there is a compositor
+    handling redirection.
+    
+    In that case, we still want the DamagePtr to be registered upfront
+    on RealizeWindowProc before a corresponding xwl_window might be
+    created. Most notably, it cannot be lazily created on
+    SetWindowPixmapProc as damage accounting gets broken.
+    
+    Signed-off-by: Carlos Garnacho <carl...@gnome.org>
+    (cherry picked from commit 4e50440ae20c537d6a4edf356cda67dd33d4e5a8)
+
+commit 045add84927051a33569ed701097e1fd514bf0ca
+Author: Adam Jackson <a...@redhat.com>
+Date:   Fri Aug 16 14:56:19 2019 -0400
+
+    glx: Fix previous context validation in xorgGlxMakeCurrent
+    
+    vnd has already verified that the context tag is valid before this gets
+    called, and we only set the context tag private data to non-null for
+    indirect clients. Mesa happens to be buggy and doesn't send MakeCurrent
+    requests nearly as much as it should for direct contexts, but if you fix
+    that, then unbinding a direct context would fail here with
+    GLXBadContextTag.
+    
+    Sadly Mesa will still need to carry a workaround here for broken
+    servers, but we should still fix the server.
+    
+    (cherry picked from commit 95dcc81cb122e5a4c5b38e84ef46eb872b2e1431)
+
+commit 8449c8623d6208b77e76596e8b10250817d3e8ab
+Author: Adam Jackson <a...@redhat.com>
+Date:   Mon Aug 19 14:27:54 2019 -0400
+
+    miext/sync: Fix needless ABI change
+    
+    The initialized field was added in:
+    
+        commit 82f01ad7869e3f2be51e41a8246dab5982bbc36a
+        Author: Alex Goins <ago...@nvidia.com>
+        Date:   Wed Apr 10 13:48:02 2019 -0500
+    
+            xsync: Add resource inside of SyncCreate, export SyncCreate
+    
+    But it added this field not at the end of SyncObject. It may not have
+    been _usefully_ possible to create those from another extension prior to
+    that commit, but that's still an ABI-incompatible change.
+    
+    (cherry picked from commit 194ba38728b34a76885275dae153057c8afaf72e)
+
+commit 39b3005c329bc63676df72c43529d641bf305bcd
+Author: Aaron Plattner <aplatt...@nvidia.com>
+Date:   Tue May 21 10:50:42 2019 -0700
+
+    GLX: Set GlxServerExports::{major,minor}Version
+    
+    Commit 56c0a71fdd94a008e5d746261f70a713c4767f93 incremented the
+    GLXSERVER_VENDOR_ABI_MINOR_VERSION define, but this define was not actually
+    being used to set glxServer.minorVersion.
+    
+    Update the initializer for glxServer to use the correct version numbers.
+    
+    Signed-off-by: Aaron Plattner <aplatt...@nvidia.com>
+    (cherry picked from commit b4231d69028adc8123801a7552b40a15ea928d1b)
+
+commit d3034ef2f5121d85ae766a73fda4e523399043a9
+Author: Kyle Brenneman <kbrenne...@nvidia.com>
+Date:   Thu May 2 07:17:21 2019 -0600
+
+    GLX: Add a function to change a clients vendor list.
+    
+    Add a new function, GlxServerExports::setClientScreenVendor, which will 
change
+    the vendor that handles GLX requests for a screen, but only for requests 
from
+    a specific client.
+    
+    v2: Increment the GLXVND minor version number.
+    v3: Note the GLXVND version requirement for setClientScreenVendor.
+    
+    Signed-off-by: Aaron Plattner <aplatt...@nvidia.com>
+    Reviewed-by: Aaron Plattner <aplatt...@nvidia.com>
+    Reviewed-by: Adam Jackson <a...@redhat.com>
+    (cherry picked from commit 56c0a71fdd94a008e5d746261f70a713c4767f93)
+
+commit abeae4a6d356653d50026707ecc2afceac83631e
+Author: Kyle Brenneman <kbrenne...@nvidia.com>
+Date:   Wed May 8 08:44:54 2019 -0600
+
+    GLX: Use the sending client for looking up XID's
+    
+    When GlxGetXIDMap looks up an unknown XID, it will now look up a vendor 
based
+    on the screen number for the XID and the client that sent the current 
request.
+    
+    In GlxGetXIDMap, if the XID is for a regular X window, then it won't be in 
the
+    (XID -> vendor) mapping, so we have to look up a vendor by screen number.
+    
+    With this change, GlxGetXIDMap will use the (screen -> vendor) map for
+    whichever client sent the current request, instead of using the global
+    (screen -> vendor) map.
+    
+    Since GlxGetXIDMap doesn't take a ClientPtr argument, GlxDispatchRequest 
will
+    store the client for the current request in a global variable. That way, 
the
+    ABI for GLXVND doesn't need to change.
+    
+    v2: Fix an error check in GlxDispatchRequest.
+    
+    Signed-off-by: Aaron Plattner <aplatt...@nvidia.com>
+    Reviewed-by: Aaron Plattner <aplatt...@nvidia.com>
+    Reviewed-by: Adam Jackson <a...@redhat.com>
+    (cherry picked from commit 8b67ec7cc6fda243480a5a8ca118b66242f3eb2c)
+
+commit 1fdb7cbce538f0b37304a3cfc9fae4ff2fe9ece9
+Author: Kyle Brenneman <kbrenne...@nvidia.com>
+Date:   Thu Oct 19 15:14:51 2017 -0600
+
+    GLX: Add a per-client vendor mapping.
+    
+    Each client now has its own (screen, vendor) mapping.
+    
+    Currently, it's just a copy of the global mapping, but later changes will 
allow
+    it to change.
+    
+    Signed-off-by: Aaron Plattner <aplatt...@nvidia.com>
+    Reviewed-by: Aaron Plattner <aplatt...@nvidia.com>
+    Reviewed-by: Adam Jackson <a...@redhat.com>
+    (cherry picked from commit 37a36a6b5b887d5c5a17a6931ceba8ad5d1bb6d5)
+
+commit 82f01ad7869e3f2be51e41a8246dab5982bbc36a
+Author: Alex Goins <ago...@nvidia.com>
+Date:   Wed Apr 10 13:48:02 2019 -0500
+
+    xsync: Add resource inside of SyncCreate, export SyncCreate
+    
+    As shown by DRI3 adding the SyncCreateFenceFromFD() function, extensions 
may
+    want to create a fence, then initialize it in their own way. This currently
+    can't be done without adding a function directly to Xext/sync.c due to the 
fact
+    that the RTFence resource type is private and there is no external 
interface to
+    add to it.
+    
+    To facilitate other X extensions creating fences and initializing them, 
this
+    change exports SyncCreate() and adds the resource directly within it. 
Callers no
+    longer need to call AddResource() after SyncCreate(), they only need to
+    initialize the SyncObject.
+    
+    To prevent FreeFence() and FreeCounter() from segfaulting if the call to
+    AddResource() fails before the sync object is initialized, this adds a new
+    'initialized' parameter to SyncObject that, when FALSE, causes FreeFence() 
and
+    FreeCounter() to skip de-initialization and simply free the object.
+    Initialization after adding the resource shouldn't otherwise be a problem 
due to
+    the single-threaded nature of X.
+    
+    Signed-off-by: Alex Goins <ago...@nvidia.com>
+    Reviewed-by: James Jones <jajo...@nvidia.com>
+    Signed-off-by: Aaron Plattner <aplatt...@nvidia.com>
+    (cherry picked from commit 7f962c70b6d9c346477f23f6c15211e749110078)
+
+commit dfd51be3ca2a244bbca27a95310b60e0c14940df
+Author: Olivier Fourdan <ofour...@redhat.com>
+Date:   Tue Jul 23 11:01:47 2019 +0200
+
+    xwayland: Do not free a NULL GBM bo
+    
+    Both `gbm_bo_create()` and `gbm_bo_create_with_modifiers()` can fail and
+    return `NULL`.
+    
+    If that occurs, `xwl_glamor_gbm_create_pixmap()` will not create a
+    pixmap for the (NULL) GBM bo, but would still try to free the bo which
+    leads to a crash in mesa:
+    
+      [...]
+      #7  <signal handler called>
+      #8  in gbm_bo_destroy (bo=0x0) at ../src/gbm/main/gbm.c:439
+      #9  in xwl_glamor_gbm_create_pixmap () at xwayland-glamor-gbm.c:245
+      #10 in ProcCreatePixmap () at dispatch.c:1440
+      #11 in Dispatch () at dispatch.c:478
+      #12 in dix_main () at main.c:276
+    
+    To avoid the crash, only free the GBM bo if not `NULL`.
+    
+    Signed-off-by: Olivier Fourdan <ofour...@redhat.com>
+    Reviewed-by: Michel Dänzer <michel.daen...@amd.com>
+    Bugzilla: https://bugzilla.redhat.com/1729925
+    (cherry picked from commit d9ec525059dbe96fc893c73c0362be2a6dd73e85)
+
+commit df7ee10d9812897b297c67fde29f0b134ffba3ec
+Author: Adam Jackson <a...@redhat.com>
+Date:   Mon Jul 15 11:38:44 2019 -0400
+
+    xwayland: Expand the RANDR screen size limits
+    
+    There's not really a good way to query this from the wayland server, so
+    just set the maximum to the X11 protocol limits. While we're at it,
+    lower the minimum screen size to something implausibly small too, just
+    in case.
+    
+    Fixes: xorg/xserver#850
+    Reviewed-by: Michel Dänzer <michel.daen...@amd.com>
+    (cherry picked from commit d0850241c6218f61127c45c2f95d6e791c3fea44)
+
+commit 44c693f45d6abd6f7f3bd2f756d35811db143af7
+Author: Olivier Fourdan <ofour...@redhat.com>
+Date:   Fri Jun 28 16:55:11 2019 +0200
+
+    xwayland: Update screen pixmap on output resize
+    
+    Running Xwayland non-rootless and resizing the output would lead to a
+    crash while trying to update the larger areas of the root window.
+    
+    Make sure we resize the backing pixmap according to the new output size
+    to avoid the crash.
+    
+    Signed-off-by: Olivier Fourdan <ofour...@redhat.com>
+    Closes: https://gitlab.freedesktop.org/xorg/xserver/issues/834
+    Reviewed-by: Michel Dänzer <michel.daen...@amd.com>
+    (cherry picked from commit ce9455b5ee389b100a9b7da76b79690d97211b7a)
+
+commit 1804e7327113d128ac9a759da55fd3de0b9f8c35
+Author: Matt Roper <matthew.d.ro...@intel.com>
+Date:   Wed Jun 26 09:34:46 2019 -0700
+
+    dri2: Sync i965_pci_ids.h from mesa
+    
+    Copied from Mesa with no modifications.
+    
+    This update brings in a significant number of new platform ID's.
+    
+    Syncs with mesa up to commit e334a595e ("intel/icl: Add new ICL
+    PCI-IDs").
+    
+    Signed-off-by: Matt Roper <matthew.d.ro...@intel.com>
+    (cherry picked from commit a8d9ebeb43583e8d8ef182ac15adbdce256d4867)
+
+commit 98e3db2ac43d4a3f13475cb160c8ce0155ac7d61
+Author: Marco Trevisan (Treviño) <m...@3v1n0.net>
+Date:   Fri Oct 26 19:52:49 2018 +0200
+
+    Xi: Use current device active grab to deliver touch events if any
+    
+    When Retrieving touch delivery data we need to check if we have an active
+    grab on such device, and in that case use it to delivery events.
+    If we don't do this, when rejecting the touch events in 
DeactivatePointerGrab,
+    we will end-up in creating an implicit grab that will change the device
+    deviceGrab's state, causing a recursion during TouchEndTouch.
+    
+    Fixes #7
+    
+    https://bugs.freedesktop.org/show_bug.cgi?id=96536
+    (cherry picked from commit 35e5a76cc1d02801fadd49d12e60664b02e4bebc)
+
+commit 26b6ba5347953ed5f60b7fb9454b45754b145c6f
+Author: Michel Dänzer <michel.daen...@amd.com>
+Date:   Wed Jul 3 11:53:56 2019 +0200
+
+    Revert "present/scmd: Check that the flip and screen pixmap pitches match"
+    
+    This reverts commit ef91da2757050652c724f6e674e8b1acf5d0cb31.
+    
+    I thought this couldn't work under any circumstances, but I was wrong,
+    and drivers are already checking for cases that really cannot work.
+    
+    Fixes issue #839.
+    
+    (cherry picked from commit 2f0dd1816d556eef8c4b691330d39f13e1ed93f0)
+
+commit c86222d4bd94892f3bf3c5947c19793ca18bd9e2
+Author: Carlos Garnacho <carl...@gnome.org>
+Date:   Wed May 22 17:51:04 2019 +0200
+
+    xwayland: Reset scheduled frames after hiding tablet cursor
+    
+    Hiding the tablet tool cursor results in it being hidden forever after.
+    This is due to the stale frame callback that will neither be disposed
+    or replaced. This can be reproduced in krita (X11) as the pointer
+    cursor is hidden while over the canvas.
+    
+    Clearing the frame callback ensures the correct behavior in future
+    xwl_tablet_tool_set_cursor() calls (i.e. a new cursor surface being
+    displayed, and a new frame callback created), and is 1:1
+    with xwl_seat_set_cursor() for pointers.
+    
+    Signed-off-by: Carlos Garnacho <carl...@gnome.org>
+    (cherry picked from commit dea4a74621294391ce5901bb3339e1b8e7151efc)
+
+commit 6e199e4613e149cd5d5ce69cdd6a259744b6cb44
+Author: Olivier Fourdan <ofour...@redhat.com>
+Date:   Fri Apr 26 13:37:09 2019 +0200
+
+    glamor: Make pixmap exportable from `gbm_bo_from_pixmap()`
+    
+    If a pixmap is not exportable, `glamor_gbm_bo_from_pixmap()` would fail
+    and the modesettings driver would consequently fail to do its page flip,
+    which both prevents Present from working and also fill up the logs with
+    error messages such as:
+    
+      (EE) modeset(0): Failed to get GBM bo for flip to new front.
+      (EE) modeset(0): present flip failed
+    
+    Refactor the code so that `glamor_gbm_bo_from_pixmap()` takes care of
+    making the pixmap exportable.
+    
+    Signed-off-by: Olivier Fourdan <ofour...@redhat.com>
+    Signed-off-by: Yuxuan Shui ys...@hadean.com
+    See-also: https://gitlab.freedesktop.org/xorg/xserver/merge_requests/131
+    Closes: https://gitlab.freedesktop.org/xorg/xserver/issues/68
+    Fixes: 86b2d8740a "glamor: Reallocate pixmap storage without modifiers
+           if necessary"
+    (cherry picked from commit 26fe29f4fa53cbb7d51892e2cf397c084093812f)
+
+commit 34ad57e570f96dfe4bc493f14726b7a0ae6d45f9
+Author: Olivier Fourdan <ofour...@redhat.com>
+Date:   Tue Mar 12 15:38:03 2019 +0100
+
+    xwayland: Check status in GBM pixmap creation
+    
+    The current code in `xwl_glamor_gbm_create_pixmap_for_bo()` may fail in
+    several cases that are not checked for:
+    
+     - `eglCreateImageKHR()` may have failed to create the image,
+     - `glEGLImageTargetTexture2DOES()` may fail and set an error,
+     - `glamor_set_pixmap_texture()` may fail for very large pixmaps
+        because the corresponding FBO could not be created.
+    
+    Trying to upload content to a pixmap with no texture will crash Mesa,
+    glamor and Xwayland, e.g.:
+    
+      XXX fail to create fbo.
+      (EE)
+      (EE) Backtrace:
+      (EE) 0: Xwayland (OsSigHandler+0x29)
+      (EE) 1: libpthread.so.0 (funlockfile+0x50)
+      (EE) 2: libc.so.6 (__memmove_avx_unaligned_erms+0x215)
+      (EE) 3: dri/i965_dri.so (_mesa_format_convert+0xab3)
+      (EE) 4: dri/i965_dri.so (_mesa_texstore+0x205)
+      (EE) 5: dri/i965_dri.so (store_texsubimage+0x28c)
+      (EE) 6: dri/i965_dri.so (intel_upload_tex+0x13b)
+      (EE) 7: dri/i965_dri.so (texture_sub_image+0x134)
+      (EE) 8: dri/i965_dri.so (texsubimage_err+0x150)
+      (EE) 9: dri/i965_dri.so (_mesa_TexSubImage2D+0x48)
+      (EE) 10: Xwayland (glamor_upload_boxes+0x246)
+      (EE) 11: Xwayland (glamor_copy+0x4d1)
+      (EE) 12: Xwayland (miCopyRegion+0x96)
+      (EE) 13: Xwayland (miDoCopy+0x43c)
+      (EE) 14: Xwayland (glamor_copy_area+0x24)
+      (EE) 15: Xwayland (damageCopyArea+0xba)
+      (EE) 16: Xwayland (compCopyWindow+0x31c)
+      (EE) 17: Xwayland (damageCopyWindow+0xd3)
+      (EE) 18: Xwayland (miResizeWindow+0x7b7)
+      (EE) 19: Xwayland (compResizeWindow+0x3a)
+      (EE) 20: Xwayland (ConfigureWindow+0xa96)
+      (EE) 21: Xwayland (ProcConfigureWindow+0x7d)
+      (EE) 22: Xwayland (Dispatch+0x320)
+      (EE) 23: Xwayland (dix_main+0x366)
+      (EE) 24: libc.so.6 (__libc_start_main+0xf3)
+      (EE) 25: Xwayland (_start+0x2e)
+      (EE)
+      Fatal server error:
+      (EE) Caught signal 11 (Segmentation fault). Server aborting
+      (EE)
+    
+    Check for the possible cases of failure above and fallback to the
+    regular glamor pixmap creation when an error is detected.
+    
+    Signed-off-by: Olivier Fourdan <ofour...@redhat.com>
+    Closes: https://gitlab.freedesktop.org/xorg/xserver/issues/661
+    (cherry picked from commit fc6380a11be4c6202ed72f241dd9ee8c7c24671d)
+
+commit 6711b5c6fdf0581c77150306fff909d7bc63b8a4
+Author: Olivier Fourdan <ofour...@redhat.com>
+Date:   Thu May 9 10:36:19 2019 +0200
+
+    xwayland: Avoid a crash on pointer enter with a grab
+    
+    On pointer enter notification, Xwayland checks for an existing pointer
+    warp with a `NULL` sprite.
+    
+    In turn, `xwl_pointer_warp_emulator_maybe_lock()` checks for an existing
+    grab and the destination window using `XYToWindow()` which does not
+    check for the actual sprite not being `NULL`.
+    
+    So, in some cases, when the pointer enters the surface and there is an
+    existing X11 grab which is not an ownerEvents grab, Xwayland would crash
+    trying to dereference the `NULL` sprite pointer:
+    
+      #0  __GI_raise ()
+      #1  __GI_abort () at abort.c:79
+      #2  OsAbort () at utils.c:1351
+      #3  AbortServer () at log.c:879
+      #4  FatalError () at log.c:1017
+      #5  OsSigHandler () at osinit.c:156
+      #6  OsSigHandler () at osinit.c:110
+      #7  <signal handler called>
+      #8  XYToWindow (pSprite=0x0, x=0, y=0) at events.c:2880
+      #9  xwl_pointer_warp_emulator_maybe_lock () at xwayland-input.c:2673
+      #10 pointer_handle_enter () at xwayland-input.c:434
+    
+    Avoid the crash by simply checking for the sprite being not `NULL` in
+    `xwl_pointer_warp_emulator_maybe_lock()`
+    
+    Signed-off-by: Olivier Fourdan <ofour...@redhat.com>
+    Bugzilla: https://bugzilla.redhat.com/1708119
+    (cherry picked from commit 0a07446318f248b65fcbc8ab8a73ead51153f09e)
+
 commit fbbdd5613122f0f7d74471f240c28e4c3b796065
 Author: Adam Jackson <a...@redhat.com>
 Date:   Thu May 30 14:07:06 2019 -0400
Index: configure
===================================================================
RCS file: /cvs/OpenBSD/xenocara/xserver/configure,v
retrieving revision 1.71
diff -u -p -u -r1.71 configure
--- configure   27 Jul 2019 07:57:07 -0000      1.71
+++ configure   23 Nov 2019 11:51:22 -0000
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for xorg-server 1.20.5.
+# Generated by GNU Autoconf 2.69 for xorg-server 1.20.6.
 #
 # Report bugs to <https://gitlab.freedesktop.org/xorg/xserver/issues>.
 #
@@ -651,8 +651,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='xorg-server'
 PACKAGE_TARNAME='xorg-server'
-PACKAGE_VERSION='1.20.5'
-PACKAGE_STRING='xorg-server 1.20.5'
+PACKAGE_VERSION='1.20.6'
+PACKAGE_STRING='xorg-server 1.20.6'
 PACKAGE_BUGREPORT='https://gitlab.freedesktop.org/xorg/xserver/issues'
 PACKAGE_URL=''
 
@@ -1397,7 +1397,6 @@ enable_local_transport
 enable_secure_rpc
 enable_input_thread
 with_systemd_daemon
-with_shared_memory_dir
 enable_xtrans_send_fds
 with_xkb_bin_directory
 with_sha1
@@ -2046,7 +2045,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures xorg-server 1.20.5 to adapt to many kinds of systems.
+\`configure' configures xorg-server 1.20.6 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -2116,7 +2115,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of xorg-server 1.20.5:";;
+     short | recursive ) echo "Configuration of xorg-server 1.20.6:";;
    esac
   cat <<\_ACEOF
 
@@ -2311,10 +2310,10 @@ Optional Packages:
                           org.x)
   --with-bundle-version=VERSION
                           Version to use for X11.app's CFBundleVersion
-                          (default: 1.20.5)
+                          (default: 1.20.6)
   --with-bundle-version-string=VERSION
                           Version to use for X11.app's
-                          CFBundleShortVersionString (default: 1.20.5)
+                          CFBundleShortVersionString (default: 1.20.6)
   --with-sparkle-feed-url=URL
                           URL for the Sparkle feed (default:
                           https://www.xquartz.org/releases/sparkle/release.xml)
@@ -2322,10 +2321,6 @@ Optional Packages:
                           Path to Khronos OpenGL registry database files
                           (default: auto)
   --with-systemd-daemon   support systemd socket activation (default: auto)
-  --with-shared-memory-dir=PATH
-                          Path to directory in a world-writable temporary
-                          directory for anonymous shared memory (default:
-                          auto)
   --with-xkb-bin-directory=DIR
                           Directory containing xkbcomp program (default: auto)
   
--with-sha1=libc|libmd|libnettle|libgcrypt|libcrypto|libsha1|CommonCrypto|CryptoAPI
@@ -2573,7 +2568,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-xorg-server configure 1.20.5
+xorg-server configure 1.20.6
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -3282,7 +3277,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by xorg-server $as_me 1.20.5, which was
+It was created by xorg-server $as_me 1.20.6, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -3630,8 +3625,8 @@ ac_link='$CC -o conftest$ac_exeext $CFLA
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
-RELEASE_DATE="2019-05-30"
-RELEASE_NAME="Red Lentil Dal"
+RELEASE_DATE="2019-11-22"
+RELEASE_NAME="Enchiladas de Queso"
 
 
 am__api_version='1.12'
@@ -4110,7 +4105,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='xorg-server'
- VERSION='1.20.5'
+ VERSION='1.20.6'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -21936,7 +21931,7 @@ fi
 for ac_func in backtrace geteuid getuid issetugid getresuid \
        getdtablesize getifaddrs getpeereid getpeerucred getprogname getzoneid \
        mmap posix_fallocate seteuid shmctl64 strncasecmp vasprintf vsnprintf \
-       walkcontext setitimer poll epoll_create1 mkostemp
+       walkcontext setitimer poll epoll_create1 mkostemp memfd_create isastream
 do :
   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
 ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
@@ -23039,7 +23034,7 @@ _ACEOF
 if test "${with_bundle_version+set}" = set; then :
   withval=$with_bundle_version;  BUNDLE_VERSION="${withval}"
 else
-   BUNDLE_VERSION="1.20.5"
+   BUNDLE_VERSION="1.20.6"
 fi
 
 
@@ -24130,7 +24125,7 @@ LIBDRI="dri >= 7.8.0"
 LIBDRM="libdrm >= 2.4.89"
 LIBEGL="egl"
 LIBGBM="gbm >= 10.2.0"
-LIBGL="gl >= 7.1.0"
+LIBGL="gl >= 1.2"
 LIBXEXT="xext >= 1.0.99.4"
 LIBXFONT="xfont2 >= 2.0.0"
 LIBXI="xi >= 1.2.99.1"
@@ -25855,7 +25850,7 @@ case "$DRI2,$HAVE_DRI2PROTO" in
 $as_echo "#define DRI2 1" >>confdefs.h
 
                DRI2=yes
-               LIBGL="gl >= 9.2.0"
+               LIBGL="gl >= 1.2"
                SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $DRI2PROTO"
                ;;
 esac
@@ -25868,55 +25863,6 @@ else
 fi
 
 
-
-
-# Check whether --with-shared-memory-dir was given.
-if test "${with_shared_memory_dir+set}" = set; then :
-  withval=$with_shared_memory_dir;
-else
-  with_shared_memory_dir=yes
-fi
-
-
-shmdirs="/run/shm /var/tmp /tmp"
-
-case x"$with_shared_memory_dir" in
-xyes)
-       for dir in $shmdirs; do
-               case x"$with_shared_memory_dir" in
-               xyes)
-                       echo Checking temp dir "$dir"
-                       if test -d "$dir"; then
-                               with_shared_memory_dir="$dir"
-                       fi
-                       ;;
-               esac
-       done
-       ;;
-x/*)
-       ;;
-xno)
-       ;;
-*)
-       as_fn_error $? "Invalid directory specified for 
--with-shared-memory-dir: $with_shared_memory_dir" "$LINENO" 5
-       ;;
-esac
-
-case x"$with_shared_memory_dir" in
-xyes)
-       as_fn_error $? "No directory found for shared memory temp files." 
"$LINENO" 5
-       ;;
-xno)
-       ;;
-*)
-
-cat >>confdefs.h <<_ACEOF
-#define SHMDIR "$with_shared_memory_dir"
-_ACEOF
-
-       ;;
-esac
-
 # Check whether --enable-xtrans-send-fds was given.
 if test "${enable_xtrans_send_fds+set}" = set; then :
   enableval=$enable_xtrans_send_fds; XTRANS_SEND_FDS=$enableval
@@ -26223,7 +26169,7 @@ else
 fi
 
 
-if test "x$DRI" = xyes || test "x$DRI2" = xyes || test "x$DRI3" = xyes || test 
"x$CONFIG_UDEV_KMS" = xyes; then
+if test "x$DRI" = xyes || test "x$DRI2" = xyes || test "x$DRI3" = xyes || test 
"x$CONFIG_UDEV_KMS" = xyes || test "x$XORG" = xyes; then
        if test "x$DRM" = xyes; then
 
 $as_echo "#define WITH_LIBDRM 1" >>confdefs.h
@@ -33004,7 +32950,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_wri
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by xorg-server $as_me 1.20.5, which was
+This file was extended by xorg-server $as_me 1.20.6, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -33070,7 +33016,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; 
s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-xorg-server config.status 1.20.5
+xorg-server config.status 1.20.6
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
Index: configure.ac
===================================================================
RCS file: /cvs/OpenBSD/xenocara/xserver/configure.ac,v
retrieving revision 1.66
diff -u -p -u -r1.66 configure.ac
--- configure.ac        27 Jul 2019 07:57:07 -0000      1.66
+++ configure.ac        23 Nov 2019 11:51:22 -0000
@@ -26,9 +26,9 @@ dnl
 dnl Process this file with autoconf to create configure.
 
 AC_PREREQ(2.60)
-AC_INIT([xorg-server], 1.20.5, 
[https://gitlab.freedesktop.org/xorg/xserver/issues], xorg-server)
-RELEASE_DATE="2019-05-30"
-RELEASE_NAME="Red Lentil Dal"
+AC_INIT([xorg-server], 1.20.6, 
[https://gitlab.freedesktop.org/xorg/xserver/issues], xorg-server)
+RELEASE_DATE="2019-11-22"
+RELEASE_NAME="Enchiladas de Queso"
 AC_CONFIG_SRCDIR([Makefile.am])
 AC_CONFIG_MACRO_DIR([m4])
 AM_INIT_AUTOMAKE([foreign dist-bzip2])
@@ -159,7 +159,7 @@ dnl Checks for library functions.
 AC_CHECK_FUNCS([backtrace geteuid getuid issetugid getresuid \
        getdtablesize getifaddrs getpeereid getpeerucred getprogname getzoneid \
        mmap posix_fallocate seteuid shmctl64 strncasecmp vasprintf vsnprintf \
-       walkcontext setitimer poll epoll_create1 mkostemp])
+       walkcontext setitimer poll epoll_create1 mkostemp memfd_create 
isastream])
 AC_CONFIG_LIBOBJ_DIR([os])
 AC_REPLACE_FUNCS([reallocarray strcasecmp strcasestr strlcat strlcpy strndup\
        timingsafe_memcmp])
@@ -802,7 +802,7 @@ LIBDRI="dri >= 7.8.0"
 LIBDRM="libdrm >= 2.4.89"
 LIBEGL="egl"
 LIBGBM="gbm >= 10.2.0"
-LIBGL="gl >= 7.1.0"
+LIBGL="gl >= 1.2"
 LIBXEXT="xext >= 1.0.99.4"
 LIBXFONT="xfont2 >= 2.0.0"
 LIBXI="xi >= 1.2.99.1"
@@ -1157,55 +1157,12 @@ case "$DRI2,$HAVE_DRI2PROTO" in
        yes,yes | auto,yes)
                AC_DEFINE(DRI2, 1, [Build DRI2 extension])
                DRI2=yes
-               LIBGL="gl >= 9.2.0"
+               LIBGL="gl >= 1.2"
                SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $DRI2PROTO"
                ;;
 esac
 AM_CONDITIONAL(DRI2, test "x$DRI2" = xyes)
 
-dnl
-dnl Locate a suitable tmp file system for creating shared memeory files
-dnl
-
-AC_ARG_WITH(shared-memory-dir, AS_HELP_STRING([--with-shared-memory-dir=PATH], 
[Path to directory in a world-writable temporary directory for anonymous shared 
memory (default: auto)]),
-[],
-[with_shared_memory_dir=yes])
-
-shmdirs="/run/shm /var/tmp /tmp"
-
-case x"$with_shared_memory_dir" in
-xyes)
-       for dir in $shmdirs; do
-               case x"$with_shared_memory_dir" in
-               xyes)
-                       echo Checking temp dir "$dir"
-                       if test -d "$dir"; then
-                               with_shared_memory_dir="$dir"
-                       fi
-                       ;;
-               esac
-       done
-       ;;
-x/*)
-       ;;
-xno)
-       ;;
-*)
-       AC_MSG_ERROR([Invalid directory specified for --with-shared-memory-dir: 
$with_shared_memory_dir])
-       ;;
-esac
-
-case x"$with_shared_memory_dir" in
-xyes)
-       AC_MSG_ERROR([No directory found for shared memory temp files.])
-       ;;
-xno)
-       ;;
-*)
-       AC_DEFINE_UNQUOTED(SHMDIR, ["$with_shared_memory_dir"], [Directory for 
shared memory temp files])
-       ;;
-esac
-
 AC_ARG_ENABLE(xtrans-send-fds, AS_HELP_STRING([--disable-xtrans-send-fds], 
[Use Xtrans support for fd passing (default: auto)]), 
[XTRANS_SEND_FDS=$enableval], [XTRANS_SEND_FDS=auto])
 
 case "x$XTRANS_SEND_FDS" in
@@ -1322,7 +1279,7 @@ esac
 
 AM_CONDITIONAL(DRI3, test "x$DRI3" = xyes)
 
-if test "x$DRI" = xyes || test "x$DRI2" = xyes || test "x$DRI3" = xyes || test 
"x$CONFIG_UDEV_KMS" = xyes; then
+if test "x$DRI" = xyes || test "x$DRI2" = xyes || test "x$DRI3" = xyes || test 
"x$CONFIG_UDEV_KMS" = xyes || test "x$XORG" = xyes; then
        if test "x$DRM" = xyes; then
                AC_DEFINE(WITH_LIBDRM, 1, [Building with libdrm support])
                PKG_CHECK_MODULES([LIBDRM], $LIBDRM)
Index: Xext/panoramiXprocs.c
===================================================================
RCS file: /cvs/OpenBSD/xenocara/xserver/Xext/panoramiXprocs.c,v
retrieving revision 1.14
diff -u -p -u -r1.14 panoramiXprocs.c
--- Xext/panoramiXprocs.c       8 Dec 2017 15:01:59 -0000       1.14
+++ Xext/panoramiXprocs.c       23 Nov 2019 11:51:22 -0000
@@ -1105,6 +1105,10 @@ PanoramiXCopyArea(ClientPtr client)
                                    DixGetAttrAccess);
             if (rc != Success)
                 return rc;
+            drawables[j]->pScreen->SourceValidate(drawables[j], 0, 0,
+                                                  drawables[j]->width,
+                                                  drawables[j]->height,
+                                                  IncludeInferiors);
         }
 
         pitch = PixmapBytePad(width, drawables[0]->depth);
@@ -2006,6 +2010,12 @@ PanoramiXGetImage(ClientPtr client)
                                DixGetAttrAccess);
         if (rc != Success)
             return rc;
+    }
+    FOR_NSCREENS_FORWARD(i) {
+        drawables[i]->pScreen->SourceValidate(drawables[i], 0, 0,
+                                              drawables[i]->width,
+                                              drawables[i]->height,
+                                              IncludeInferiors);
     }
 
     xgi = (xGetImageReply) {
Index: Xext/shm.c
===================================================================
RCS file: /cvs/OpenBSD/xenocara/xserver/Xext/shm.c,v
retrieving revision 1.28
diff -u -p -u -r1.28 shm.c
--- Xext/shm.c  27 Jul 2019 07:57:07 -0000      1.28
+++ Xext/shm.c  23 Nov 2019 11:51:22 -0000
@@ -35,6 +35,9 @@ in this Software without prior written a
 #include <sys/types.h>
 #include <sys/ipc.h>
 #include <sys/shm.h>
+#ifdef HAVE_MEMFD_CREATE
+#include <sys/mman.h>
+#endif
 #include <unistd.h>
 #include <sys/stat.h>
 #include <fcntl.h>
@@ -652,6 +655,9 @@ ProcShmGetImage(ClientPtr client)
         visual = wVisual(((WindowPtr) pDraw));
         if (pDraw->type == DRAWABLE_WINDOW)
             pVisibleRegion = &((WindowPtr) pDraw)->borderClip;
+        pDraw->pScreen->SourceValidate(pDraw, stuff->x, stuff->y,
+                                       stuff->width, stuff->height,
+                                       IncludeInferiors);
     }
     else {
         if (stuff->x < 0 ||
@@ -860,6 +866,12 @@ ProcPanoramiXShmGetImage(ClientPtr clien
             return rc;
         }
     }
+    FOR_NSCREENS_FORWARD(i) {
+        drawables[i]->pScreen->SourceValidate(drawables[i], 0, 0,
+                                              drawables[i]->width,
+                                              drawables[i]->height,
+                                              IncludeInferiors);
+    }
 
     xgi = (xShmGetImageReply) {
         .type = X_Reply,
@@ -1194,36 +1206,55 @@ ProcShmAttachFd(ClientPtr client)
 static int
 shm_tmpfile(void)
 {
-#ifdef SHMDIR
-       int     fd;
-       char    template[] = SHMDIR "/shmfd-XXXXXX";
+    const char *shmdirs[] = {
+        "/run/shm",
+        "/var/tmp",
+        "/tmp",
+    };
+    int        fd;
+
+#ifdef HAVE_MEMFD_CREATE
+    fd = memfd_create("xorg", MFD_CLOEXEC|MFD_ALLOW_SEALING);
+    if (fd != -1) {
+        fcntl(fd, F_ADD_SEALS, F_SEAL_SHRINK);
+        DebugF ("Using memfd_create\n");
+        return fd;
+    }
+#endif
+
 #ifdef O_TMPFILE
-       fd = open(SHMDIR, O_TMPFILE|O_RDWR|O_CLOEXEC|O_EXCL, 0666);
-       if (fd >= 0) {
-               DebugF ("Using O_TMPFILE\n");
-               return fd;
-       }
-       ErrorF ("Not using O_TMPFILE\n");
+    for (int i = 0; i < ARRAY_SIZE(shmdirs); i++) {
+        fd = open(shmdirs[i], O_TMPFILE|O_RDWR|O_CLOEXEC|O_EXCL, 0666);
+        if (fd >= 0) {
+            DebugF ("Using O_TMPFILE\n");
+            return fd;
+        }
+    }
+    ErrorF ("Not using O_TMPFILE\n");
 #endif
+
+    for (int i = 0; i < ARRAY_SIZE(shmdirs); i++) {
+        char template[PATH_MAX];
+        snprintf(template, ARRAY_SIZE(template), "%s/shmfd-XXXXXXXXXX", 
shmdirs[i]);
 #ifdef HAVE_MKOSTEMP
-       fd = mkostemp(template, O_CLOEXEC);
+        fd = mkostemp(template, O_CLOEXEC);
 #else
-       fd = mkstemp(template);
+        fd = mkstemp(template);
 #endif
-       if (fd < 0)
-               return -1;
-       unlink(template);
+        if (fd < 0)
+            continue;
+        unlink(template);
 #ifndef HAVE_MKOSTEMP
-       int flags = fcntl(fd, F_GETFD);
-       if (flags != -1) {
-               flags |= FD_CLOEXEC;
-               (void) fcntl(fd, F_SETFD, &flags);
-       }
-#endif
-       return fd;
-#else
-        return -1;
+        int flags = fcntl(fd, F_GETFD);
+        if (flags != -1) {
+            flags |= FD_CLOEXEC;
+            (void) fcntl(fd, F_SETFD, &flags);
+        }
 #endif
+        return fd;
+    }
+
+    return -1;
 }
 
 static int
Index: Xext/sleepuntil.c
===================================================================
RCS file: /cvs/OpenBSD/xenocara/xserver/Xext/sleepuntil.c,v
retrieving revision 1.6
diff -u -p -u -r1.6 sleepuntil.c
--- Xext/sleepuntil.c   8 Dec 2017 15:01:59 -0000       1.6
+++ Xext/sleepuntil.c   23 Nov 2019 11:51:22 -0000
@@ -125,8 +125,7 @@ ClientSleepUntil(ClientPtr client,
 static void
 ClientAwaken(ClientPtr client, void *closure)
 {
-    if (!client->clientGone)
-        AttendClient(client);
+    AttendClient(client);
 }
 
 static int
Index: Xext/sync.c
===================================================================
RCS file: /cvs/OpenBSD/xenocara/xserver/Xext/sync.c,v
retrieving revision 1.19
diff -u -p -u -r1.19 sync.c
--- Xext/sync.c 27 Jul 2019 07:57:07 -0000      1.19
+++ Xext/sync.c 23 Nov 2019 11:51:22 -0000
@@ -881,18 +881,21 @@ SyncChangeAlarmAttributes(ClientPtr clie
     return Success;
 }
 
-static SyncObject *
+SyncObject *
 SyncCreate(ClientPtr client, XID id, unsigned char type)
 {
     SyncObject *pSync;
+    RESTYPE resType;
 
     switch (type) {
     case SYNC_COUNTER:
         pSync = malloc(sizeof(SyncCounter));
+        resType = RTCounter;
         break;
     case SYNC_FENCE:
         pSync = (SyncObject *) dixAllocateObjectWithPrivates(SyncFence,
                                                              
PRIVATE_SYNC_FENCE);
+        resType = RTFence;
         break;
     default:
         return NULL;
@@ -901,6 +904,11 @@ SyncCreate(ClientPtr client, XID id, uns
     if (!pSync)
         return NULL;
 
+    pSync->initialized = FALSE;
+
+    if (!AddResource(id, resType, (void *) pSync))
+        return NULL;
+
     pSync->client = client;
     pSync->id = id;
     pSync->pTriglist = NULL;
@@ -923,13 +931,10 @@ SyncCreateFenceFromFD(ClientPtr client, 
 
     status = miSyncInitFenceFromFD(pDraw, pFence, fd, initially_triggered);
     if (status != Success) {
-        dixFreeObjectWithPrivates(pFence, PRIVATE_SYNC_FENCE);
+        FreeResource(pFence->sync.id, RT_NONE);
         return status;
     }
 
-    if (!AddResource(id, RTFence, (void *) pFence))
-        return BadAlloc;
-
     return Success;
 #else
     return BadImplementation;
@@ -957,8 +962,7 @@ SyncCreateCounter(ClientPtr client, XSyn
     pCounter->value = initialvalue;
     pCounter->pSysCounterInfo = NULL;
 
-    if (!AddResource(id, RTCounter, (void *) pCounter))
-        return NULL;
+    pCounter->sync.initialized = TRUE;
 
     return pCounter;
 }
@@ -1137,21 +1141,26 @@ static int
 FreeCounter(void *env, XID id)
 {
     SyncCounter *pCounter = (SyncCounter *) env;
-    SyncTriggerList *ptl, *pnext;
 
     pCounter->sync.beingDestroyed = TRUE;
-    /* tell all the counter's triggers that the counter has been destroyed */
-    for (ptl = pCounter->sync.pTriglist; ptl; ptl = pnext) {
-        (*ptl->pTrigger->CounterDestroyed) (ptl->pTrigger);
-        pnext = ptl->next;
-        free(ptl);              /* destroy the trigger list as we go */
-    }
-    if (IsSystemCounter(pCounter)) {
-        xorg_list_del(&pCounter->pSysCounterInfo->entry);
-        free(pCounter->pSysCounterInfo->name);
-        free(pCounter->pSysCounterInfo->private);
-        free(pCounter->pSysCounterInfo);
+
+    if (pCounter->sync.initialized) {
+        SyncTriggerList *ptl, *pnext;
+
+        /* tell all the counter's triggers that counter has been destroyed */
+        for (ptl = pCounter->sync.pTriglist; ptl; ptl = pnext) {
+            (*ptl->pTrigger->CounterDestroyed) (ptl->pTrigger);
+            pnext = ptl->next;
+            free(ptl); /* destroy the trigger list as we go */
+        }
+        if (IsSystemCounter(pCounter)) {
+            xorg_list_del(&pCounter->pSysCounterInfo->entry);
+            free(pCounter->pSysCounterInfo->name);
+            free(pCounter->pSysCounterInfo->private);
+            free(pCounter->pSysCounterInfo);
+        }
     }
+
     free(pCounter);
     return Success;
 }
@@ -1888,9 +1897,6 @@ ProcSyncCreateFence(ClientPtr client)
         return BadAlloc;
 
     miSyncInitFence(pDraw->pScreen, pFence, stuff->initially_triggered);
-
-    if (!AddResource(stuff->fid, RTFence, (void *) pFence))
-        return BadAlloc;
 
     return Success;
 }
Index: Xext/syncsdk.h
===================================================================
RCS file: /cvs/OpenBSD/xenocara/xserver/Xext/syncsdk.h,v
retrieving revision 1.2
diff -u -p -u -r1.2 syncsdk.h
--- Xext/syncsdk.h      10 Jun 2012 13:21:20 -0000      1.2
+++ Xext/syncsdk.h      23 Nov 2019 11:51:22 -0000
@@ -29,6 +29,9 @@
 extern _X_EXPORT int
  SyncVerifyFence(SyncFence ** ppFence, XID fid, ClientPtr client, Mask mode);
 
+extern _X_EXPORT SyncObject*
+ SyncCreate(ClientPtr client, XID id, unsigned char type);
+
 #define VERIFY_SYNC_FENCE(pFence, fid, client, mode)                   \
     do {                                                               \
        int rc;                                                         \
Index: Xi/exevents.c
===================================================================
RCS file: /cvs/OpenBSD/xenocara/xserver/Xi/exevents.c,v
retrieving revision 1.22
diff -u -p -u -r1.22 exevents.c
--- Xi/exevents.c       8 Dec 2017 15:01:59 -0000       1.22
+++ Xi/exevents.c       23 Nov 2019 11:51:22 -0000
@@ -1293,14 +1293,21 @@ RetrieveTouchDeliveryData(DeviceIntPtr d
     int rc;
     InputClients *iclients = NULL;
     *mask = NULL;
+    *grab = NULL;
 
     if (listener->type == LISTENER_GRAB ||
         listener->type == LISTENER_POINTER_GRAB) {
-
         *grab = listener->grab;
 
         BUG_RETURN_VAL(!*grab, FALSE);
+    }
+    else if (ti->emulate_pointer && dev->deviceGrab.grab &&
+             !dev->deviceGrab.fromPassiveGrab) {
+        /* There may be an active pointer grab on the device */
+        *grab = dev->deviceGrab.grab;
+    }
 
+    if (*grab) {
         *client = rClient(*grab);
         *win = (*grab)->window;
         *mask = (*grab)->xi2mask;
@@ -1357,8 +1364,6 @@ RetrieveTouchDeliveryData(DeviceIntPtr d
             /* if owner selected, oclients is NULL */
             *client = oclients ? rClient(oclients) : wClient(*win);
         }
-
-        *grab = NULL;
     }
 
     return TRUE;
@@ -1497,16 +1502,6 @@ DeliverEmulatedMotionEvent(DeviceIntPtr 
                                        &ti->listeners[0], &client, &win, &grab,
                                        &mask))
             return;
-
-        /* There may be a pointer grab on the device */
-        if (!grab) {
-            grab = dev->deviceGrab.grab;
-            if (grab) {
-                win = grab->window;
-                mask = grab->xi2mask;
-                client = rClient(grab);
-            }
-        }
 
         DeliverTouchEmulatedEvent(dev, ti, (InternalEvent*)&motion, 
&ti->listeners[0], client,
                                   win, grab, mask);
Index: dix/dispatch.c
===================================================================
RCS file: /cvs/OpenBSD/xenocara/xserver/dix/dispatch.c,v
retrieving revision 1.20
diff -u -p -u -r1.20 dispatch.c
--- dix/dispatch.c      27 Jul 2019 07:57:09 -0000      1.20
+++ dix/dispatch.c      23 Nov 2019 11:51:22 -0000
@@ -2196,8 +2196,11 @@ DoGetImage(ClientPtr client, int format,
         return BadAlloc;
     WriteReplyToClient(client, sizeof(xGetImageReply), &xgi);
 
-    if (pDraw->type == DRAWABLE_WINDOW)
+    if (pDraw->type == DRAWABLE_WINDOW) {
         pVisibleRegion = &((WindowPtr) pDraw)->borderClip;
+        pDraw->pScreen->SourceValidate(pDraw, x, y, width, height,
+                                       IncludeInferiors);
+    }
 
     if (linesPerBuf == 0) {
         /* nothing to do */
Index: dix/dixutils.c
===================================================================
RCS file: /cvs/OpenBSD/xenocara/xserver/dix/dixutils.c,v
retrieving revision 1.15
diff -u -p -u -r1.15 dixutils.c
--- dix/dixutils.c      27 Jul 2019 07:57:09 -0000      1.15
+++ dix/dixutils.c      23 Nov 2019 11:51:22 -0000
@@ -662,14 +662,7 @@ ClientWakeup(ClientPtr client)
         if (q->client == client) {
             *prev = q->next;
             free(q);
-            if (client->clientGone)
-                /* Oops -- new zombie cleanup code ensures this only
-                 * happens from inside CloseDownClient; don't want to
-                 * recurse here...
-                 */
-                /* CloseDownClient(client) */ ;
-            else
-                AttendClient(client);
+            AttendClient(client);
             break;
         }
         prev = &q->next;
Index: dix/events.c
===================================================================
RCS file: /cvs/OpenBSD/xenocara/xserver/dix/events.c,v
retrieving revision 1.19
diff -u -p -u -r1.19 events.c
--- dix/events.c        27 Jul 2019 07:57:09 -0000      1.19
+++ dix/events.c        23 Nov 2019 11:51:22 -0000
@@ -597,6 +597,8 @@ XineramaConfineCursorToWindow(DeviceIntP
 
     int x, y, off_x, off_y, i;
 
+    assert(!noPanoramiXExtension);
+
     if (!XineramaSetWindowPntrs(pDev, pWin))
         return;
 
Index: dix/pixmap.c
===================================================================
RCS file: /cvs/OpenBSD/xenocara/xserver/dix/pixmap.c,v
retrieving revision 1.13
diff -u -p -u -r1.13 pixmap.c
--- dix/pixmap.c        27 Jul 2019 07:57:09 -0000      1.13
+++ dix/pixmap.c        23 Nov 2019 11:51:22 -0000
@@ -32,6 +32,7 @@ from The Open Group.
 
 #include <X11/X.h>
 #include "scrnintstr.h"
+#include "mi.h"
 #include "misc.h"
 #include "os.h"
 #include "windowstr.h"
@@ -395,7 +396,7 @@ Bool PixmapSyncDirtyHelper(PixmapDirtyUp
      * leaves the software cursor in place
      */
     SourceValidate = pScreen->SourceValidate;
-    pScreen->SourceValidate = NULL;
+    pScreen->SourceValidate = miSourceValidate;
 
     RegionTranslate(&pixregion, dirty->x, dirty->y);
     RegionIntersect(&pixregion, &pixregion, region);
Index: doc/Xserver-spec.xml
===================================================================
RCS file: /cvs/OpenBSD/xenocara/xserver/doc/Xserver-spec.xml,v
retrieving revision 1.7
diff -u -p -u -r1.7 Xserver-spec.xml
--- doc/Xserver-spec.xml        27 Jul 2019 07:57:09 -0000      1.7
+++ doc/Xserver-spec.xml        23 Nov 2019 11:51:22 -0000
@@ -2930,8 +2930,8 @@ The sample server implementation is in X
                unsigned int subWindowMode;
 
 </programlisting></blockquote>
-SourceValidate should be called by CopyArea/CopyPlane primitives when
-the SourceValidate function pointer in the screen is non-null.  If you know 
that
+SourceValidate should be called by any primitive that reads from pDrawable.
+If you know that
 you will never need SourceValidate, you can avoid this check.  Currently,
 SourceValidate is used by the mi software cursor code to remove the cursor
 from the screen when the source rectangle overlaps the cursor position.
Index: glamor/glamor_egl.c
===================================================================
RCS file: /cvs/OpenBSD/xenocara/xserver/glamor/glamor_egl.c,v
retrieving revision 1.7
diff -u -p -u -r1.7 glamor_egl.c
--- glamor/glamor_egl.c 27 Jul 2019 07:57:10 -0000      1.7
+++ glamor/glamor_egl.c 23 Nov 2019 11:51:22 -0000
@@ -355,8 +355,8 @@ glamor_make_pixmap_exportable(PixmapPtr 
     return TRUE;
 }
 
-struct gbm_bo *
-glamor_gbm_bo_from_pixmap(ScreenPtr screen, PixmapPtr pixmap)
+static struct gbm_bo *
+glamor_gbm_bo_from_pixmap_internal(ScreenPtr screen, PixmapPtr pixmap)
 {
     struct glamor_egl_screen_private *glamor_egl =
         glamor_egl_get_screen_private(xf86ScreenToScrn(screen));
@@ -370,6 +370,15 @@ glamor_gbm_bo_from_pixmap(ScreenPtr scre
                          pixmap_priv->image, 0);
 }
 
+struct gbm_bo *
+glamor_gbm_bo_from_pixmap(ScreenPtr screen, PixmapPtr pixmap)
+{
+    if (!glamor_make_pixmap_exportable(pixmap, TRUE))
+        return NULL;
+
+    return glamor_gbm_bo_from_pixmap_internal(screen, pixmap);
+}
+
 int
 glamor_egl_fds_from_pixmap(ScreenPtr screen, PixmapPtr pixmap, int *fds,
                            uint32_t *strides, uint32_t *offsets,
@@ -385,7 +394,7 @@ glamor_egl_fds_from_pixmap(ScreenPtr scr
     if (!glamor_make_pixmap_exportable(pixmap, TRUE))
         return 0;
 
-    bo = glamor_gbm_bo_from_pixmap(screen, pixmap);
+    bo = glamor_gbm_bo_from_pixmap_internal(screen, pixmap);
     if (!bo)
         return 0;
 
@@ -423,7 +432,7 @@ glamor_egl_fd_from_pixmap(ScreenPtr scre
     if (!glamor_make_pixmap_exportable(pixmap, FALSE))
         return -1;
 
-    bo = glamor_gbm_bo_from_pixmap(screen, pixmap);
+    bo = glamor_gbm_bo_from_pixmap_internal(screen, pixmap);
     if (!bo)
         return -1;
 
@@ -452,7 +461,7 @@ glamor_egl_fd_name_from_pixmap(ScreenPtr
     if (!glamor_make_pixmap_exportable(pixmap, FALSE))
         goto failure;
 
-    bo = glamor_gbm_bo_from_pixmap(screen, pixmap);
+    bo = glamor_gbm_bo_from_pixmap_internal(screen, pixmap);
     if (!bo)
         goto failure;
 
Index: glamor/glamor_egl.h
===================================================================
RCS file: /cvs/OpenBSD/xenocara/xserver/glamor/glamor_egl.h,v
retrieving revision 1.2
diff -u -p -u -r1.2 glamor_egl.h
--- glamor/glamor_egl.h 27 Jul 2019 07:57:10 -0000      1.2
+++ glamor/glamor_egl.h 23 Nov 2019 11:51:22 -0000
@@ -28,6 +28,7 @@
 #define GLAMOR_EGL_H
 
 #define MESA_EGL_NO_X11_HEADERS
+#define EGL_NO_X11
 #include <epoxy/gl.h>
 #include <epoxy/egl.h>
 #include <glamor_egl_ext.h>
Index: glamor/glamor_priv.h
===================================================================
RCS file: /cvs/OpenBSD/xenocara/xserver/glamor/glamor_priv.h,v
retrieving revision 1.6
diff -u -p -u -r1.6 glamor_priv.h
--- glamor/glamor_priv.h        27 Jul 2019 07:57:10 -0000      1.6
+++ glamor/glamor_priv.h        23 Nov 2019 11:51:22 -0000
@@ -40,6 +40,7 @@
 #include <epoxy/gl.h>
 #ifdef GLAMOR_HAS_GBM
 #define MESA_EGL_NO_X11_HEADERS
+#define EGL_NO_X11
 #include <epoxy/egl.h>
 #endif
 
Index: glx/glxcmds.c
===================================================================
RCS file: /cvs/OpenBSD/xenocara/xserver/glx/glxcmds.c,v
retrieving revision 1.17
diff -u -p -u -r1.17 glxcmds.c
--- glx/glxcmds.c       27 Jul 2019 07:57:10 -0000      1.17
+++ glx/glxcmds.c       23 Nov 2019 11:51:22 -0000
@@ -574,10 +574,8 @@ xorgGlxMakeCurrent(ClientPtr client, GLX
     /* Look up old context. If we have one, it must be in a usable state. */
     if (tag != 0) {
         prevglxc = glxServer.getContextTagPrivate(client, tag);
-        if (!prevglxc)
-            return __glXError(GLXBadContextTag);
 
-        if (prevglxc->renderMode != GL_RENDER) {
+        if (prevglxc && prevglxc->renderMode != GL_RENDER) {
             /* Oops.  Not in render mode render. */
             client->errorValue = prevglxc->id;
             return __glXError(GLXBadContextState);
Index: glx/glxdriswrast.c
===================================================================
RCS file: /cvs/OpenBSD/xenocara/xserver/glx/glxdriswrast.c,v
retrieving revision 1.17
diff -u -p -u -r1.17 glxdriswrast.c
--- glx/glxdriswrast.c  27 Jul 2019 07:57:10 -0000      1.17
+++ glx/glxdriswrast.c  23 Nov 2019 11:51:22 -0000
@@ -324,6 +324,7 @@ swrastGetImage(__DRIdrawable * draw,
     ScreenPtr pScreen = pDraw->pScreen;
     __GLXcontext *cx = lastGLContext;
 
+    pScreen->SourceValidate(pDraw, x, y, w, h, IncludeInferiors);
     pScreen->GetImage(pDraw, x, y, w, h, ZPixmap, ~0L, data);
     if (cx != lastGLContext) {
         lastGLContext = cx;
Index: glx/vndcmds.c
===================================================================
RCS file: /cvs/OpenBSD/xenocara/xserver/glx/vndcmds.c,v
retrieving revision 1.1
diff -u -p -u -r1.1 vndcmds.c
--- glx/vndcmds.c       27 Jul 2019 07:57:10 -0000      1.1
+++ glx/vndcmds.c       23 Nov 2019 11:51:22 -0000
@@ -468,15 +468,24 @@ void GlxDispatchReset(void)
 int GlxDispatchRequest(ClientPtr client)
 {
     REQUEST(xReq);
+    int result;
+
     if (GlxExtensionEntry->base == 0)
         return BadRequest;
+
+    GlxSetRequestClient(client);
+
     if (stuff->data < OPCODE_ARRAY_LEN) {
         if (dispatchFuncs[stuff->data] == NULL) {
             // Try to find a dispatch stub.
             dispatchFuncs[stuff->data] = GetVendorDispatchFunc(stuff->data, 0);
         }
-        return dispatchFuncs[stuff->data](client);
+        result = dispatchFuncs[stuff->data](client);
     } else {
-        return dispatch_GLXSingle(client);
+        result = dispatch_GLXSingle(client);
     }
+
+    GlxSetRequestClient(NULL);
+
+    return result;
 }
Index: glx/vndext.c
===================================================================
RCS file: /cvs/OpenBSD/xenocara/xserver/glx/vndext.c,v
retrieving revision 1.1
diff -u -p -u -r1.1 vndext.c
--- glx/vndext.c        27 Jul 2019 07:57:10 -0000      1.1
+++ glx/vndext.c        23 Nov 2019 11:51:22 -0000
@@ -139,8 +139,17 @@ GlxGetClientData(ClientPtr client)
 {
     GlxClientPriv *cl = xglvGetClientPrivate(client);
     if (cl == NULL) {
-        cl = calloc(1, sizeof(GlxClientPriv));
+        cl = calloc(1, sizeof(GlxClientPriv)
+                + screenInfo.numScreens * sizeof(GlxServerVendor *));
         if (cl != NULL) {
+            int i;
+
+            cl->vendors = (GlxServerVendor **) (cl + 1);
+            for (i=0; i<screenInfo.numScreens; i++)
+            {
+                cl->vendors[i] = GlxGetVendorForScreen(NULL, 
screenInfo.screens[i]);
+            }
+
             xglvSetClientPrivate(client, cl);
         }
     }
@@ -295,8 +304,8 @@ GlxFreeServerImports(GlxServerImports *i
 }
 
 _X_EXPORT const GlxServerExports glxServer = {
-    .majorVersion = 0,
-    .minorVersion = 0,
+    .majorVersion = GLXSERVER_VENDOR_ABI_MAJOR_VERSION,
+    .minorVersion = GLXSERVER_VENDOR_ABI_MINOR_VERSION,
 
     .extensionInitCallback = &vndInitCallbackListPtr,
 
@@ -315,6 +324,7 @@ _X_EXPORT const GlxServerExports glxServ
     .getContextTagPrivate = GlxGetContextTagPrivate,
     .getVendorForScreen = GlxGetVendorForScreen,
     .forwardRequest =  GlxForwardRequest,
+    .setClientScreenVendor = GlxSetClientScreenVendor,
 };
 
 const GlxServerExports *
Index: glx/vndserver.h
===================================================================
RCS file: /cvs/OpenBSD/xenocara/xserver/glx/vndserver.h,v
retrieving revision 1.1
diff -u -p -u -r1.1 vndserver.h
--- glx/vndserver.h     27 Jul 2019 07:57:10 -0000      1.1
+++ glx/vndserver.h     23 Nov 2019 11:51:22 -0000
@@ -57,6 +57,11 @@ typedef struct GlxContextTagInfoRec {
 typedef struct GlxClientPrivRec {
     GlxContextTagInfo *contextTags;
     unsigned int contextTagCount;
+
+    /**
+     * The vendor handles for each screen.
+     */
+    GlxServerVendor **vendors;
 } GlxClientPriv;
 
 extern int GlxErrorBase;
@@ -90,11 +95,19 @@ Bool GlxAddXIDMap(XID id, GlxServerVendo
 GlxServerVendor * GlxGetXIDMap(XID id);
 void GlxRemoveXIDMap(XID id);
 
+/**
+ * Records the client that sent the current request. This is needed in
+ * GlxGetXIDMap to know which client's (screen -> vendor) mapping to use for a
+ * regular X window.
+ */
+void GlxSetRequestClient(ClientPtr client);
+
 GlxContextTagInfo *GlxAllocContextTag(ClientPtr client, GlxServerVendor 
*vendor);
 GlxContextTagInfo *GlxLookupContextTag(ClientPtr client, GLXContextTag tag);
 void GlxFreeContextTag(GlxContextTagInfo *tagInfo);
 
 Bool GlxSetScreenVendor(ScreenPtr screen, GlxServerVendor *vendor);
+Bool GlxSetClientScreenVendor(ClientPtr client, ScreenPtr screen, 
GlxServerVendor *vendor);
 GlxScreenPriv *GlxGetScreen(ScreenPtr pScreen);
 GlxServerVendor *GlxGetVendorForScreen(ClientPtr client, ScreenPtr screen);
 
Index: glx/vndservermapping.c
===================================================================
RCS file: /cvs/OpenBSD/xenocara/xserver/glx/vndservermapping.c,v
retrieving revision 1.1
diff -u -p -u -r1.1 vndservermapping.c
--- glx/vndservermapping.c      27 Jul 2019 07:57:10 -0000      1.1
+++ glx/vndservermapping.c      23 Nov 2019 11:51:22 -0000
@@ -33,6 +33,13 @@
 
 #include "vndservervendor.h"
 
+static ClientPtr requestClient = NULL;
+
+void GlxSetRequestClient(ClientPtr client)
+{
+    requestClient = client;
+}
+
 static GlxServerVendor *LookupXIDMapResource(XID id)
 {
     void *ptr = NULL;
@@ -59,10 +66,7 @@ GlxServerVendor *GlxGetXIDMap(XID id)
                                          DixGetAttrAccess);
         if (rv == Success && ptr != NULL) {
             DrawablePtr draw = (DrawablePtr) ptr;
-            GlxScreenPriv *screenPriv = GlxGetScreen(draw->pScreen);
-            if (screenPriv != NULL) {
-                vendor = screenPriv->vendor;
-            }
+            vendor = GlxGetVendorForScreen(requestClient, draw->pScreen);
         }
     }
     return vendor;
@@ -185,12 +189,44 @@ Bool GlxSetScreenVendor(ScreenPtr screen
     return TRUE;
 }
 
+Bool GlxSetClientScreenVendor(ClientPtr client, ScreenPtr screen, 
GlxServerVendor *vendor)
+{
+    GlxClientPriv *cl;
+
+    if (screen == NULL || screen->isGPU) {
+        return FALSE;
+    }
+
+    cl = GlxGetClientData(client);
+    if (cl == NULL) {
+        return FALSE;
+    }
+
+    if (vendor != NULL) {
+        cl->vendors[screen->myNum] = vendor;
+    } else {
+        cl->vendors[screen->myNum] = GlxGetVendorForScreen(NULL, screen);
+    }
+    return TRUE;
+}
+
 GlxServerVendor *GlxGetVendorForScreen(ClientPtr client, ScreenPtr screen)
 {
-    GlxScreenPriv *priv = GlxGetScreen(screen);
-    if (priv != NULL) {
-        return priv->vendor;
+    // Note that the client won't be sending GPU screen numbers, so we don't
+    // need per-client mappings for them.
+    if (client != NULL && !screen->isGPU) {
+        GlxClientPriv *cl = GlxGetClientData(client);
+        if (cl != NULL) {
+            return cl->vendors[screen->myNum];
+        } else {
+            return NULL;
+        }
     } else {
-        return NULL;
+        GlxScreenPriv *priv = GlxGetScreen(screen);
+        if (priv != NULL) {
+            return priv->vendor;
+        } else {
+            return NULL;
+        }
     }
 }
Index: hw/xfree86/common/compiler.h
===================================================================
RCS file: /cvs/OpenBSD/xenocara/xserver/hw/xfree86/common/compiler.h,v
retrieving revision 1.18
diff -u -p -u -r1.18 compiler.h
--- hw/xfree86/common/compiler.h        27 Jul 2019 07:57:14 -0000      1.18
+++ hw/xfree86/common/compiler.h        23 Nov 2019 11:51:23 -0000
@@ -758,36 +758,6 @@ inl(unsigned short port)
     return xf86ReadMmio32Le((void *) ioBase, port);
 }
 
-#elif defined(__arm__) && defined(__linux__)
-
-/* for Linux on ARM, we use the LIBC inx/outx routines */
-/* note that the appropriate setup via "ioperm" needs to be done */
-/*  *before* any inx/outx is done. */
-
-#include <sys/io.h>
-
-static __inline__ void
-xf_outb(unsigned short port, unsigned char val)
-{
-    outb(val, port);
-}
-
-static __inline__ void
-xf_outw(unsigned short port, unsigned short val)
-{
-    outw(val, port);
-}
-
-static __inline__ void
-xf_outl(unsigned short port, unsigned int val)
-{
-    outl(val, port);
-}
-
-#define outb xf_outb
-#define outw xf_outw
-#define outl xf_outl
-
 #elif defined(__nds32__)
 
 /*
Index: hw/xfree86/common/xf86Init.c
===================================================================
RCS file: /cvs/OpenBSD/xenocara/xserver/hw/xfree86/common/xf86Init.c,v
retrieving revision 1.28
diff -u -p -u -r1.28 xf86Init.c
--- hw/xfree86/common/xf86Init.c        27 Jul 2019 07:57:14 -0000      1.28
+++ hw/xfree86/common/xf86Init.c        23 Nov 2019 11:51:23 -0000
@@ -686,36 +686,6 @@ InitOutput(ScreenInfo * pScreenInfo, int
     if (!dixRegisterPrivateKey(&xf86ScreenKeyRec, PRIVATE_SCREEN, 0))
         FatalError("Cannot register DDX private keys");
 
-    for (i = 0; i < xf86NumGPUScreens; i++) {
-        ScrnInfoPtr pScrn = xf86GPUScreens[i];
-        xf86VGAarbiterLock(pScrn);
-
-        /*
-         * Almost everything uses these defaults, and many of those that
-         * don't, will wrap them.
-         */
-        pScrn->EnableDisableFBAccess = xf86EnableDisableFBAccess;
-#ifdef XFreeXDGA
-        pScrn->SetDGAMode = xf86SetDGAMode;
-#endif
-        pScrn->DPMSSet = NULL;
-        pScrn->LoadPalette = NULL;
-        pScrn->SetOverscan = NULL;
-        pScrn->DriverFunc = NULL;
-        pScrn->pScreen = NULL;
-        scr_index = AddGPUScreen(xf86ScreenInit, argc, argv);
-        xf86VGAarbiterUnlock(pScrn);
-        if (scr_index == i) {
-            dixSetPrivate(&screenInfo.gpuscreens[scr_index]->devPrivates,
-                          xf86ScreenKey, xf86GPUScreens[i]);
-            pScrn->pScreen = screenInfo.gpuscreens[scr_index];
-            /* The driver should set this, but make sure it is set anyway */
-            pScrn->vtSema = TRUE;
-        } else {
-            FatalError("AddScreen/ScreenInit failed for gpu driver %d %d\n", 
i, scr_index);
-        }
-    }
-
     for (i = 0; i < xf86NumScreens; i++) {
         xf86VGAarbiterLock(xf86Screens[i]);
         /*
@@ -769,6 +739,36 @@ InitOutput(ScreenInfo * pScreenInfo, int
          * fallback support.
          */
         xf86EnsureRANDR(xf86Screens[i]->pScreen);
+    }
+
+    for (i = 0; i < xf86NumGPUScreens; i++) {
+        ScrnInfoPtr pScrn = xf86GPUScreens[i];
+        xf86VGAarbiterLock(pScrn);
+
+        /*
+         * Almost everything uses these defaults, and many of those that
+         * don't, will wrap them.
+         */
+        pScrn->EnableDisableFBAccess = xf86EnableDisableFBAccess;
+#ifdef XFreeXDGA
+        pScrn->SetDGAMode = xf86SetDGAMode;
+#endif
+        pScrn->DPMSSet = NULL;
+        pScrn->LoadPalette = NULL;
+        pScrn->SetOverscan = NULL;
+        pScrn->DriverFunc = NULL;
+        pScrn->pScreen = NULL;
+        scr_index = AddGPUScreen(xf86ScreenInit, argc, argv);
+        xf86VGAarbiterUnlock(pScrn);
+        if (scr_index == i) {
+            dixSetPrivate(&screenInfo.gpuscreens[scr_index]->devPrivates,
+                          xf86ScreenKey, xf86GPUScreens[i]);
+            pScrn->pScreen = screenInfo.gpuscreens[scr_index];
+            /* The driver should set this, but make sure it is set anyway */
+            pScrn->vtSema = TRUE;
+        } else {
+            FatalError("AddScreen/ScreenInit failed for gpu driver %d %d\n", 
i, scr_index);
+        }
     }
 
     for (i = 0; i < xf86NumGPUScreens; i++)
Index: hw/xfree86/drivers/modesetting/Makefile.am
===================================================================
RCS file: 
/cvs/OpenBSD/xenocara/xserver/hw/xfree86/drivers/modesetting/Makefile.am,v
retrieving revision 1.4
diff -u -p -u -r1.4 Makefile.am
--- hw/xfree86/drivers/modesetting/Makefile.am  27 Jul 2019 07:57:15 -0000      
1.4
+++ hw/xfree86/drivers/modesetting/Makefile.am  23 Nov 2019 11:51:23 -0000
@@ -24,6 +24,8 @@
 # _ladir passes a dummy rpath to libtool so the thing will actually link
 # TODO: -nostdlib/-Bstatic/-lgcc platform magic, not installing the .a, etc.
 
+include $(top_srcdir)/manpages.am
+
 AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) $(LIBDRM_CFLAGS) $(UDEV_CFLAGS) 
$(CWARNFLAGS)
 
 AM_CPPFLAGS = \
@@ -62,9 +64,3 @@ driverman_DATA = $(driverman_PRE:man=@DR
 EXTRA_DIST = modesetting.man
 
 CLEANFILES = $(driverman_DATA)
-
-# String replacements in MAN_SUBSTS now come from xorg-macros.m4 via configure
-SUFFIXES = .$(DRIVER_MAN_SUFFIX) .man
-
-.man.$(DRIVER_MAN_SUFFIX):
-       $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@
Index: hw/xfree86/drivers/modesetting/Makefile.in
===================================================================
RCS file: 
/cvs/OpenBSD/xenocara/xserver/hw/xfree86/drivers/modesetting/Makefile.in,v
retrieving revision 1.6
diff -u -p -u -r1.6 Makefile.in
--- hw/xfree86/drivers/modesetting/Makefile.in  27 Jul 2019 07:57:15 -0000      
1.6
+++ hw/xfree86/drivers/modesetting/Makefile.in  23 Nov 2019 11:51:23 -0000
@@ -77,9 +77,9 @@ PRE_UNINSTALL = :
 POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
-subdir = hw/xfree86/drivers/modesetting
 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
-       $(top_srcdir)/depcomp
+       $(top_srcdir)/depcomp $(top_srcdir)/manpages.am
+subdir = hw/xfree86/drivers/modesetting
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \
        $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \
@@ -127,7 +127,8 @@ am__uninstall_files_from_dir = { \
          $(am__cd) "$$dir" && rm -f $$files; }; \
   }
 am__installdirs = "$(DESTDIR)$(modesetting_drv_ladir)" \
-       "$(DESTDIR)$(drivermandir)"
+       "$(DESTDIR)$(appmandir)" "$(DESTDIR)$(drivermandir)" \
+       "$(DESTDIR)$(filemandir)"
 LTLIBRARIES = $(modesetting_drv_la_LTLIBRARIES)
 am__DEPENDENCIES_1 =
 modesetting_drv_la_DEPENDENCIES = $(am__DEPENDENCIES_1)
@@ -183,7 +184,7 @@ am__can_run_installinfo = \
     n|no|NO) false;; \
     *) (install-info --version) >/dev/null 2>&1;; \
   esac
-DATA = $(driverman_DATA)
+DATA = $(appman_DATA) $(driverman_DATA) $(fileman_DATA)
 ETAGS = etags
 CTAGS = ctags
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -327,7 +328,38 @@ MAINT = @MAINT@
 MAIN_LIB = @MAIN_LIB@
 MAKEINFO = @MAKEINFO@
 MANIFEST_TOOL = @MANIFEST_TOOL@
-MAN_SUBSTS = @MAN_SUBSTS@
+
+# xorg-macros.m4 has these bracketed by double underscores, but meson
+# wants ats.
+
+# Add server specific man pages string substitution from XORG_MANPAGE_SECTIONS
+# 's|/,|/, |g' will add a space to help font path formatting
+MAN_SUBSTS = @MAN_SUBSTS@ -e 's|@vendorversion@|"$(PACKAGE_STRING)" \
+       "$(XORG_MAN_PAGE)"|' -e 's|@xorgversion@|"$(PACKAGE_STRING)" \
+       "$(XORG_MAN_PAGE)"|' -e 's|@xservername@|Xorg|g' -e \
+       's|@xconfigfile@|xorg.conf|g' -e 's|@projectroot@|$(prefix)|g' \
+       -e 's|@apploaddir@|$(appdefaultdir)|g' -e \
+       's|@appmansuffix@|$(APP_MAN_SUFFIX)|g' -e \
+       's|@drivermansuffix@|$(DRIVER_MAN_SUFFIX)|g' -e \
+       's|@adminmansuffix@|$(ADMIN_MAN_SUFFIX)|g' -e \
+       's|@libmansuffix@|$(LIB_MAN_SUFFIX)|g' -e \
+       's|@miscmansuffix@|$(MISC_MAN_SUFFIX)|g' -e \
+       's|@filemansuffix@|$(FILE_MAN_SUFFIX)|g' -e \
+       's|[@]logdir[@]|$(logdir)|g' -e 's|[@]datadir[@]|$(datadir)|g' \
+       -e 's|[@]mandir[@]|$(mandir)|g' -e \
+       's|[@]sysconfdir[@]|$(sysconfdir)|g' -e \
+       's|[@]xconfigdir[@]|$(XCONFIGDIR)|g' -e \
+       's|[@]xkbdir[@]|$(XKB_BASE_DIRECTORY)|g' -e \
+       's|[@]XKB_DFLT_RULES[@]|$(XKB_DFLT_RULES)|g' -e \
+       's|[@]XKB_DFLT_MODEL[@]|$(XKB_DFLT_MODEL)|g' -e \
+       's|[@]XKB_DFLT_LAYOUT[@]|$(XKB_DFLT_LAYOUT)|g' -e \
+       's|[@]XKB_DFLT_VARIANT[@]|$(XKB_DFLT_VARIANT)|g' -e \
+       's|[@]XKB_DFLT_OPTIONS[@]|$(XKB_DFLT_OPTIONS)|g' -e \
+       's|[@]bundle_id_prefix[@]|$(BUNDLE_ID_PREFIX)|g' -e \
+       's|[@]modulepath[@]|$(DEFAULT_MODULE_PATH)|g' -e \
+       's|[@]suid_wrapper_dir[@]|$(SUID_WRAPPER_DIR)|g' -e \
+       's|[@]default_font_path[@]|$(COMPILEDDEFAULTFONTPATH)|g' -e \
+       '\|$(COMPILEDDEFAULTFONTPATH)| s|/,|/, |g'
 MISC_MAN_DIR = @MISC_MAN_DIR@
 MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
 MKDIR_P = @MKDIR_P@
@@ -545,6 +577,17 @@ target_alias = @target_alias@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
+appmandir = $(APP_MAN_DIR)
+#appman_PRE = list of application man page files set by calling Makefile.am
+appman_DATA = $(appman_PRE:man=$(APP_MAN_SUFFIX))
+drivermandir = $(DRIVER_MAN_DIR)
+driverman_DATA = $(driverman_PRE:man=@DRIVER_MAN_SUFFIX@)
+filemandir = $(FILE_MAN_DIR)
+#fileman_PRE = list of file man page files set by calling Makefile.am
+fileman_DATA = $(fileman_PRE:man=$(FILE_MAN_SUFFIX))
+EXTRA_DIST = modesetting.man
+CLEANFILES = $(driverman_DATA)
+SUFFIXES = .$(APP_MAN_SUFFIX) .$(DRIVER_MAN_SUFFIX) .$(FILE_MAN_SUFFIX) .man
 AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) $(LIBDRM_CFLAGS) $(UDEV_CFLAGS) 
$(CWARNFLAGS)
 AM_CPPFLAGS = \
        $(XORG_INCS) \
@@ -574,19 +617,12 @@ modesetting_drv_la_SOURCES = \
         pageflip.c \
         $(NULL)
 
-drivermandir = $(DRIVER_MAN_DIR)
 driverman_PRE = modesetting.man
-driverman_DATA = $(driverman_PRE:man=@DRIVER_MAN_SUFFIX@)
-EXTRA_DIST = modesetting.man
-CLEANFILES = $(driverman_DATA)
-
-# String replacements in MAN_SUBSTS now come from xorg-macros.m4 via configure
-SUFFIXES = .$(DRIVER_MAN_SUFFIX) .man
 all: all-am
 
 .SUFFIXES:
-.SUFFIXES: .$(DRIVER_MAN_SUFFIX) .man .c .lo .o .obj
-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  
$(am__configure_deps)
+.SUFFIXES: .$(APP_MAN_SUFFIX) .$(DRIVER_MAN_SUFFIX) .$(FILE_MAN_SUFFIX) .man 
.c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am 
$(top_srcdir)/manpages.am $(am__configure_deps)
        @for dep in $?; do \
          case '$(am__configure_deps)' in \
            *$$dep*) \
@@ -607,6 +643,7 @@ Makefile: $(srcdir)/Makefile.in $(top_bu
            echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ 
$(am__depfiles_maybe)'; \
            cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ 
$(am__depfiles_maybe);; \
        esac;
+$(top_srcdir)/manpages.am:
 
 $(top_builddir)/config.status: $(top_srcdir)/configure 
$(CONFIG_STATUS_DEPENDENCIES)
        cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
@@ -693,6 +730,27 @@ mostlyclean-libtool:
 
 clean-libtool:
        -rm -rf .libs _libs
+install-appmanDATA: $(appman_DATA)
+       @$(NORMAL_INSTALL)
+       @list='$(appman_DATA)'; test -n "$(appmandir)" || list=; \
+       if test -n "$$list"; then \
+         echo " $(MKDIR_P) '$(DESTDIR)$(appmandir)'"; \
+         $(MKDIR_P) "$(DESTDIR)$(appmandir)" || exit 1; \
+       fi; \
+       for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         echo "$$d$$p"; \
+       done | $(am__base_list) | \
+       while read files; do \
+         echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(appmandir)'"; \
+         $(INSTALL_DATA) $$files "$(DESTDIR)$(appmandir)" || exit $$?; \
+       done
+
+uninstall-appmanDATA:
+       @$(NORMAL_UNINSTALL)
+       @list='$(appman_DATA)'; test -n "$(appmandir)" || list=; \
+       files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+       dir='$(DESTDIR)$(appmandir)'; $(am__uninstall_files_from_dir)
 install-drivermanDATA: $(driverman_DATA)
        @$(NORMAL_INSTALL)
        @list='$(driverman_DATA)'; test -n "$(drivermandir)" || list=; \
@@ -714,6 +772,27 @@ uninstall-drivermanDATA:
        @list='$(driverman_DATA)'; test -n "$(drivermandir)" || list=; \
        files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
        dir='$(DESTDIR)$(drivermandir)'; $(am__uninstall_files_from_dir)
+install-filemanDATA: $(fileman_DATA)
+       @$(NORMAL_INSTALL)
+       @list='$(fileman_DATA)'; test -n "$(filemandir)" || list=; \
+       if test -n "$$list"; then \
+         echo " $(MKDIR_P) '$(DESTDIR)$(filemandir)'"; \
+         $(MKDIR_P) "$(DESTDIR)$(filemandir)" || exit 1; \
+       fi; \
+       for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         echo "$$d$$p"; \
+       done | $(am__base_list) | \
+       while read files; do \
+         echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(filemandir)'"; \
+         $(INSTALL_DATA) $$files "$(DESTDIR)$(filemandir)" || exit $$?; \
+       done
+
+uninstall-filemanDATA:
+       @$(NORMAL_UNINSTALL)
+       @list='$(fileman_DATA)'; test -n "$(filemandir)" || list=; \
+       files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+       dir='$(DESTDIR)$(filemandir)'; $(am__uninstall_files_from_dir)
 
 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
        list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
@@ -815,7 +894,7 @@ check-am: all-am
 check: check-am
 all-am: Makefile $(LTLIBRARIES) $(DATA)
 installdirs:
-       for dir in "$(DESTDIR)$(modesetting_drv_ladir)" 
"$(DESTDIR)$(drivermandir)"; do \
+       for dir in "$(DESTDIR)$(modesetting_drv_ladir)" 
"$(DESTDIR)$(appmandir)" "$(DESTDIR)$(drivermandir)" "$(DESTDIR)$(filemandir)"; 
do \
          test -z "$$dir" || $(MKDIR_P) "$$dir"; \
        done
 install: install-am
@@ -872,8 +951,8 @@ info: info-am
 
 info-am:
 
-install-data-am: install-drivermanDATA \
-       install-modesetting_drv_laLTLIBRARIES
+install-data-am: install-appmanDATA install-drivermanDATA \
+       install-filemanDATA install-modesetting_drv_laLTLIBRARIES
 
 install-dvi: install-dvi-am
 
@@ -919,8 +998,8 @@ ps: ps-am
 
 ps-am:
 
-uninstall-am: uninstall-drivermanDATA \
-       uninstall-modesetting_drv_laLTLIBRARIES
+uninstall-am: uninstall-appmanDATA uninstall-drivermanDATA \
+       uninstall-filemanDATA uninstall-modesetting_drv_laLTLIBRARIES
 
 .MAKE: install-am install-strip
 
@@ -928,20 +1007,26 @@ uninstall-am: uninstall-drivermanDATA \
        clean-libtool clean-modesetting_drv_laLTLIBRARIES cscopelist \
        ctags distclean distclean-compile distclean-generic \
        distclean-libtool distclean-tags distdir dvi dvi-am html \
-       html-am info info-am install install-am install-data \
-       install-data-am install-drivermanDATA install-dvi \
-       install-dvi-am install-exec install-exec-am install-html \
-       install-html-am install-info install-info-am install-man \
+       html-am info info-am install install-am install-appmanDATA \
+       install-data install-data-am install-drivermanDATA install-dvi \
+       install-dvi-am install-exec install-exec-am \
+       install-filemanDATA install-html install-html-am install-info \
+       install-info-am install-man \
        install-modesetting_drv_laLTLIBRARIES install-pdf \
        install-pdf-am install-ps install-ps-am install-strip \
        installcheck installcheck-am installdirs maintainer-clean \
        maintainer-clean-generic mostlyclean mostlyclean-compile \
        mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
-       tags uninstall uninstall-am uninstall-drivermanDATA \
+       tags uninstall uninstall-am uninstall-appmanDATA \
+       uninstall-drivermanDATA uninstall-filemanDATA \
        uninstall-modesetting_drv_laLTLIBRARIES
 
 
+.man.$(APP_MAN_SUFFIX):
+       $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@
 .man.$(DRIVER_MAN_SUFFIX):
+       $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@
+.man.$(FILE_MAN_SUFFIX):
        $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
Index: hw/xfree86/drivers/modesetting/driver.h
===================================================================
RCS file: 
/cvs/OpenBSD/xenocara/xserver/hw/xfree86/drivers/modesetting/driver.h,v
retrieving revision 1.4
diff -u -p -u -r1.4 driver.h
--- hw/xfree86/drivers/modesetting/driver.h     27 Jul 2019 07:57:15 -0000      
1.4
+++ hw/xfree86/drivers/modesetting/driver.h     23 Nov 2019 11:51:23 -0000
@@ -147,6 +147,7 @@ void ms_drm_abort_seq(ScrnInfoPtr scrn, 
 Bool ms_crtc_on(xf86CrtcPtr crtc);
 
 xf86CrtcPtr ms_dri2_crtc_covering_drawable(DrawablePtr pDraw);
+RRCrtcPtr   ms_randr_crtc_covering_drawable(DrawablePtr pDraw);
 
 int ms_get_crtc_ust_msc(xf86CrtcPtr crtc, CARD64 *ust, CARD64 *msc);
 
Index: hw/xfree86/drivers/modesetting/present.c
===================================================================
RCS file: 
/cvs/OpenBSD/xenocara/xserver/hw/xfree86/drivers/modesetting/present.c,v
retrieving revision 1.5
diff -u -p -u -r1.5 present.c
--- hw/xfree86/drivers/modesetting/present.c    27 Jul 2019 07:57:15 -0000      
1.5
+++ hw/xfree86/drivers/modesetting/present.c    23 Nov 2019 11:51:23 -0000
@@ -59,8 +59,7 @@ struct ms_present_vblank_event {
 static RRCrtcPtr
 ms_present_get_crtc(WindowPtr window)
 {
-    xf86CrtcPtr xf86_crtc = ms_dri2_crtc_covering_drawable(&window->drawable);
-    return xf86_crtc ? xf86_crtc->randr_crtc : NULL;
+    return ms_randr_crtc_covering_drawable(&window->drawable);
 }
 
 static int
Index: hw/xfree86/drivers/modesetting/vblank.c
===================================================================
RCS file: 
/cvs/OpenBSD/xenocara/xserver/hw/xfree86/drivers/modesetting/vblank.c,v
retrieving revision 1.4
diff -u -p -u -r1.4 vblank.c
--- hw/xfree86/drivers/modesetting/vblank.c     27 Jul 2019 07:57:15 -0000      
1.4
+++ hw/xfree86/drivers/modesetting/vblank.c     23 Nov 2019 11:51:23 -0000
@@ -77,6 +77,28 @@ static void ms_crtc_box(xf86CrtcPtr crtc
         crtc_box->x1 = crtc_box->x2 = crtc_box->y1 = crtc_box->y2 = 0;
 }
 
+static void ms_randr_crtc_box(RRCrtcPtr crtc, BoxPtr crtc_box)
+{
+    if (crtc->mode) {
+        crtc_box->x1 = crtc->x;
+        crtc_box->y1 = crtc->y;
+        switch (crtc->rotation) {
+            case RR_Rotate_0:
+            case RR_Rotate_180:
+            default:
+                crtc_box->x2 = crtc->x + crtc->mode->mode.width;
+                crtc_box->y2 = crtc->y + crtc->mode->mode.height;
+                break;
+            case RR_Rotate_90:
+            case RR_Rotate_270:
+                crtc_box->x2 = crtc->x + crtc->mode->mode.height;
+                crtc_box->y2 = crtc->y + crtc->mode->mode.width;
+                break;
+        }
+    } else
+        crtc_box->x1 = crtc_box->x2 = crtc_box->y1 = crtc_box->y2 = 0;
+}
+
 static int ms_box_area(BoxPtr box)
 {
     return (int)(box->x2 - box->x1) * (int)(box->y2 - box->y1);
@@ -91,12 +113,45 @@ ms_crtc_on(xf86CrtcPtr crtc)
 }
 
 /*
+ * Return the first output which is connected to an active CRTC on this screen.
+ *
+ * RRFirstOutput() will return an output from a slave screen if it is primary,
+ * which is not the behavior that ms_covering_crtc() wants.
+ */
+
+static RROutputPtr ms_first_output(ScreenPtr pScreen)
+{
+    rrScrPriv(pScreen);
+    RROutputPtr output;
+    int i, j;
+
+    if (!pScrPriv)
+        return NULL;
+
+    if (pScrPriv->primaryOutput && pScrPriv->primaryOutput->crtc &&
+        (pScrPriv->primaryOutput->pScreen == pScreen)) {
+        return pScrPriv->primaryOutput;
+    }
+
+    for (i = 0; i < pScrPriv->numCrtcs; i++) {
+        RRCrtcPtr crtc = pScrPriv->crtcs[i];
+
+        for (j = 0; j < pScrPriv->numOutputs; j++) {
+            output = pScrPriv->outputs[j];
+            if (output->crtc == crtc)
+                return output;
+        }
+    }
+    return NULL;
+}
+
+/*
  * Return the crtc covering 'box'. If two crtcs cover a portion of
  * 'box', then prefer the crtc with greater coverage.
  */
 
 static xf86CrtcPtr
-ms_covering_crtc(ScreenPtr pScreen, BoxPtr box, Bool screen_is_ms)
+ms_covering_xf86_crtc(ScreenPtr pScreen, BoxPtr box, Bool screen_is_ms)
 {
     ScrnInfoPtr scrn = xf86ScreenToScrn(pScreen);
     xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
@@ -108,6 +163,10 @@ ms_covering_crtc(ScreenPtr pScreen, BoxP
 
     best_crtc = NULL;
     best_coverage = 0;
+
+    if (!xf86_config)
+        return NULL;
+
     for (c = 0; c < xf86_config->num_crtc; c++) {
         crtc = xf86_config->crtc[c];
 
@@ -135,7 +194,7 @@ ms_covering_crtc(ScreenPtr pScreen, BoxP
         ScreenPtr slave;
 
         if (dixPrivateKeyRegistered(rrPrivKey))
-            primary_output = RRFirstOutput(scrn->pScreen);
+            primary_output = ms_first_output(scrn->pScreen);
         if (!primary_output || !primary_output->crtc)
             return NULL;
 
@@ -147,7 +206,74 @@ ms_covering_crtc(ScreenPtr pScreen, BoxP
             if (!slave->is_output_slave)
                 continue;
 
-            if (ms_covering_crtc(slave, box, FALSE)) {
+            if (ms_covering_xf86_crtc(slave, box, FALSE)) {
+                /* The drawable is on a slave output, return primary crtc */
+                return crtc;
+            }
+        }
+    }
+
+    return best_crtc;
+}
+
+static RRCrtcPtr
+ms_covering_randr_crtc(ScreenPtr pScreen, BoxPtr box, Bool screen_is_ms)
+{
+    ScrnInfoPtr scrn = xf86ScreenToScrn(pScreen);
+    rrScrPrivPtr pScrPriv = rrGetScrPriv(pScreen);
+    RRCrtcPtr crtc, best_crtc;
+    int coverage, best_coverage;
+    int c;
+    BoxRec crtc_box, cover_box;
+    Bool crtc_on;
+
+    best_crtc = NULL;
+    best_coverage = 0;
+
+    if (!pScrPriv)
+        return NULL;
+
+    for (c = 0; c < pScrPriv->numCrtcs; c++) {
+        crtc = pScrPriv->crtcs[c];
+
+        if (screen_is_ms) {
+            crtc_on = ms_crtc_on((xf86CrtcPtr) crtc->devPrivate);
+        } else {
+            crtc_on = !!crtc->mode;
+        }
+
+        /* If the CRTC is off, treat it as not covering */
+        if (!crtc_on)
+            continue;
+
+        ms_randr_crtc_box(crtc, &crtc_box);
+        ms_box_intersect(&cover_box, &crtc_box, box);
+        coverage = ms_box_area(&cover_box);
+        if (coverage > best_coverage) {
+            best_crtc = crtc;
+            best_coverage = coverage;
+        }
+    }
+
+    /* Fallback to primary crtc for drawable's on slave outputs */
+    if (best_crtc == NULL && !pScreen->isGPU) {
+        RROutputPtr primary_output = NULL;
+        ScreenPtr slave;
+
+        if (dixPrivateKeyRegistered(rrPrivKey))
+            primary_output = ms_first_output(scrn->pScreen);
+        if (!primary_output || !primary_output->crtc)
+            return NULL;
+
+        crtc = primary_output->crtc;
+        if (!ms_crtc_on((xf86CrtcPtr) crtc->devPrivate))
+            return NULL;
+
+        xorg_list_for_each_entry(slave, &pScreen->slave_list, slave_head) {
+            if (!slave->is_output_slave)
+                continue;
+
+            if (ms_covering_randr_crtc(slave, box, FALSE)) {
                 /* The drawable is on a slave output, return primary crtc */
                 return crtc;
             }
@@ -168,7 +294,21 @@ ms_dri2_crtc_covering_drawable(DrawableP
     box.x2 = box.x1 + pDraw->width;
     box.y2 = box.y1 + pDraw->height;
 
-    return ms_covering_crtc(pScreen, &box, TRUE);
+    return ms_covering_xf86_crtc(pScreen, &box, TRUE);
+}
+
+RRCrtcPtr
+ms_randr_crtc_covering_drawable(DrawablePtr pDraw)
+{
+    ScreenPtr pScreen = pDraw->pScreen;
+    BoxRec box;
+
+    box.x1 = pDraw->x;
+    box.y1 = pDraw->y;
+    box.x2 = box.x1 + pDraw->width;
+    box.y2 = box.y1 + pDraw->height;
+
+    return ms_covering_randr_crtc(pScreen, &box, TRUE);
 }
 
 static Bool
Index: hw/xfree86/modes/xf86RandR12.c
===================================================================
RCS file: /cvs/OpenBSD/xenocara/xserver/hw/xfree86/modes/xf86RandR12.c,v
retrieving revision 1.20
diff -u -p -u -r1.20 xf86RandR12.c
--- hw/xfree86/modes/xf86RandR12.c      27 Jul 2019 07:57:17 -0000      1.20
+++ hw/xfree86/modes/xf86RandR12.c      23 Nov 2019 11:51:23 -0000
@@ -2227,6 +2227,7 @@ xf86CrtcLeaseTerminated(RRLeasePtr lease
 {
     int c;
     int o;
+    ScrnInfoPtr scrn = xf86ScreenToScrn(lease->screen);
 
     RRLeaseTerminated(lease);
     /*
@@ -2257,6 +2258,10 @@ xf86CrtcLeaseTerminated(RRLeasePtr lease
             xf86CrtcCheckReset(crtc);
         }
     }
+
+    /* Power off if necessary */
+    xf86DisableUnusedFunctions(scrn);
+
     RRLeaseFree(lease);
 }
 
Index: hw/xfree86/modes/xf86Rotate.c
===================================================================
RCS file: /cvs/OpenBSD/xenocara/xserver/hw/xfree86/modes/xf86Rotate.c,v
retrieving revision 1.17
diff -u -p -u -r1.17 xf86Rotate.c
--- hw/xfree86/modes/xf86Rotate.c       27 Jul 2019 07:57:17 -0000      1.17
+++ hw/xfree86/modes/xf86Rotate.c       23 Nov 2019 11:51:23 -0000
@@ -28,7 +28,7 @@
 #include <stddef.h>
 #include <string.h>
 #include <stdio.h>
-
+#include "mi.h"
 #include "xf86.h"
 #include "xf86DDC.h"
 #include "windowstr.h"
@@ -191,7 +191,7 @@ xf86RotateRedisplay(ScreenPtr pScreen)
          * leaves the software cursor in place
          */
         SourceValidate = pScreen->SourceValidate;
-        pScreen->SourceValidate = NULL;
+        pScreen->SourceValidate = miSourceValidate;
 
         for (c = 0; c < xf86_config->num_crtc; c++) {
             xf86CrtcPtr crtc = xf86_config->crtc[c];
Index: hw/xfree86/os-support/shared/sigio.c
===================================================================
RCS file: /cvs/OpenBSD/xenocara/xserver/hw/xfree86/os-support/shared/sigio.c,v
retrieving revision 1.11
diff -u -p -u -r1.11 sigio.c
--- hw/xfree86/os-support/shared/sigio.c        8 Dec 2017 15:02:01 -0000       
1.11
+++ hw/xfree86/os-support/shared/sigio.c        23 Nov 2019 11:51:23 -0000
@@ -208,7 +208,8 @@ xf86InstallSIGIOHandler(int fd, void (*f
                 }
             }
 #endif
-#ifdef I_SETSIG                 /* System V Streams - used on Solaris for 
input devices */
+#if defined(I_SETSIG) && defined(HAVE_ISASTREAM)
+            /* System V Streams - used on Solaris for input devices */
             if (!installed && isastream(fd)) {
                 if (ioctl(fd, I_SETSIG, S_INPUT | S_ERROR | S_HANGUP) == -1) {
                     xf86Msg(X_WARNING, "fcntl(%d, I_SETSIG): %s\n",
@@ -279,7 +280,7 @@ xf86RemoveSIGIOHandler(int fd)
 #ifdef O_ASYNC
         fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) & ~O_ASYNC);
 #endif
-#ifdef I_SETSIG
+#if defined(I_SETSIG) && defined(HAVE_ISASTREAM)
         if (isastream(fd)) {
             if (ioctl(fd, I_SETSIG, 0) == -1) {
                 xf86Msg(X_WARNING, "fcntl(%d, I_SETSIG, 0): %s\n",
Index: hw/xnest/Screen.c
===================================================================
RCS file: /cvs/OpenBSD/xenocara/xserver/hw/xnest/Screen.c,v
retrieving revision 1.10
diff -u -p -u -r1.10 Screen.c
--- hw/xnest/Screen.c   27 Jul 2019 07:57:20 -0000      1.10
+++ hw/xnest/Screen.c   23 Nov 2019 11:51:24 -0000
@@ -263,7 +263,6 @@ xnestOpenScreen(ScreenPtr pScreen, int a
     pScreen->SaveScreen = xnestSaveScreen;
     pScreen->GetImage = xnestGetImage;
     pScreen->GetSpans = xnestGetSpans;
-    pScreen->SourceValidate = NULL;
 
     /* Window Procedures */
 
Index: hw/xwayland/xwayland-cursor.c
===================================================================
RCS file: /cvs/OpenBSD/xenocara/xserver/hw/xwayland/xwayland-cursor.c,v
retrieving revision 1.7
diff -u -p -u -r1.7 xwayland-cursor.c
--- hw/xwayland/xwayland-cursor.c       27 Jul 2019 07:57:21 -0000      1.7
+++ hw/xwayland/xwayland-cursor.c       23 Nov 2019 11:51:24 -0000
@@ -188,6 +188,8 @@ xwl_tablet_tool_set_cursor(struct xwl_ta
         zwp_tablet_tool_v2_set_cursor(xwl_tablet_tool->tool,
                                       xwl_tablet_tool->proximity_in_serial,
                                       NULL, 0, 0);
+        clear_cursor_frame_callback(xwl_cursor);
+        xwl_cursor->needs_update = FALSE;
         return;
     }
 
Index: hw/xwayland/xwayland-glamor-eglstream.c
===================================================================
RCS file: 
/cvs/OpenBSD/xenocara/xserver/hw/xwayland/xwayland-glamor-eglstream.c,v
retrieving revision 1.1
diff -u -p -u -r1.1 xwayland-glamor-eglstream.c
--- hw/xwayland/xwayland-glamor-eglstream.c     27 Jul 2019 07:57:21 -0000      
1.1
+++ hw/xwayland/xwayland-glamor-eglstream.c     23 Nov 2019 11:51:24 -0000
@@ -33,6 +33,7 @@
 #include "wayland-eglstream-controller-client-protocol.h"
 
 #define MESA_EGL_NO_X11_HEADERS
+#define EGL_NO_X11
 #include <glamor_egl.h>
 #include <glamor.h>
 #include <glamor_transform.h>
Index: hw/xwayland/xwayland-glamor-gbm.c
===================================================================
RCS file: /cvs/OpenBSD/xenocara/xserver/hw/xwayland/xwayland-glamor-gbm.c,v
retrieving revision 1.1
diff -u -p -u -r1.1 xwayland-glamor-gbm.c
--- hw/xwayland/xwayland-glamor-gbm.c   27 Jul 2019 07:57:21 -0000      1.1
+++ hw/xwayland/xwayland-glamor-gbm.c   23 Nov 2019 11:51:24 -0000
@@ -36,6 +36,7 @@
 #include <drm_fourcc.h>
 
 #define MESA_EGL_NO_X11_HEADERS
+#define EGL_NO_X11
 #include <gbm.h>
 #include <glamor_egl.h>
 
@@ -169,6 +170,8 @@ xwl_glamor_gbm_create_pixmap_for_bo(Scre
                                           xwl_screen->egl_context,
                                           EGL_NATIVE_PIXMAP_KHR,
                                           xwl_pixmap->bo, NULL);
+    if (xwl_pixmap->image == EGL_NO_IMAGE_KHR)
+      goto error;
 
     glGenTextures(1, &xwl_pixmap->texture);
     glBindTexture(GL_TEXTURE_2D, xwl_pixmap->texture);
@@ -176,14 +179,31 @@ xwl_glamor_gbm_create_pixmap_for_bo(Scre
     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
 
     glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, xwl_pixmap->image);
-    glBindTexture(GL_TEXTURE_2D, 0);
+    if (eglGetError() != EGL_SUCCESS)
+      goto error;
 
-    xwl_pixmap_set_private(pixmap, xwl_pixmap);
+    glBindTexture(GL_TEXTURE_2D, 0);
 
     glamor_set_pixmap_texture(pixmap, xwl_pixmap->texture);
+    /* `set_pixmap_texture()` may fail silently if the FBO creation failed,
+     * so we check again the texture to be sure it worked.
+     */
+    if (!glamor_get_pixmap_texture(pixmap))
+      goto error;
+
     glamor_set_pixmap_type(pixmap, GLAMOR_TEXTURE_DRM);
+    xwl_pixmap_set_private(pixmap, xwl_pixmap);
 
     return pixmap;
+
+error:
+    if (xwl_pixmap->image != EGL_NO_IMAGE_KHR)
+      eglDestroyImageKHR(xwl_screen->egl_display, xwl_pixmap->image);
+    if (pixmap)
+      glamor_destroy_pixmap(pixmap);
+    free(xwl_pixmap);
+
+    return NULL;
 }
 
 static PixmapPtr
@@ -194,6 +214,7 @@ xwl_glamor_gbm_create_pixmap(ScreenPtr s
     struct xwl_screen *xwl_screen = xwl_screen_get(screen);
     struct xwl_gbm_private *xwl_gbm = xwl_gbm_get(xwl_screen);
     struct gbm_bo *bo;
+    PixmapPtr pixmap = NULL;
 
     if (width > 0 && height > 0 && depth >= 15 &&
         (hint == 0 ||
@@ -218,11 +239,18 @@ xwl_glamor_gbm_create_pixmap(ScreenPtr s
                                GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING);
         }
 
-        if (bo)
-            return xwl_glamor_gbm_create_pixmap_for_bo(screen, bo, depth);
+        if (bo) {
+            pixmap = xwl_glamor_gbm_create_pixmap_for_bo(screen, bo, depth);
+
+            if (!pixmap)
+                gbm_bo_destroy(bo);
+        }
     }
 
-    return glamor_create_pixmap(screen, width, height, depth, hint);
+    if (!pixmap)
+        pixmap = glamor_create_pixmap(screen, width, height, depth, hint);
+
+    return pixmap;
 }
 
 static Bool
Index: hw/xwayland/xwayland-glamor.c
===================================================================
RCS file: /cvs/OpenBSD/xenocara/xserver/hw/xwayland/xwayland-glamor.c,v
retrieving revision 1.6
diff -u -p -u -r1.6 xwayland-glamor.c
--- hw/xwayland/xwayland-glamor.c       27 Jul 2019 07:57:21 -0000      1.6
+++ hw/xwayland/xwayland-glamor.c       23 Nov 2019 11:51:24 -0000
@@ -26,6 +26,7 @@
 #include "xwayland.h"
 
 #define MESA_EGL_NO_X11_HEADERS
+#define EGL_NO_X11
 #include <glamor_egl.h>
 
 #include <glamor.h>
Index: hw/xwayland/xwayland-input.c
===================================================================
RCS file: /cvs/OpenBSD/xenocara/xserver/hw/xwayland/xwayland-input.c,v
retrieving revision 1.7
diff -u -p -u -r1.7 xwayland-input.c
--- hw/xwayland/xwayland-input.c        27 Jul 2019 07:57:21 -0000      1.7
+++ hw/xwayland/xwayland-input.c        23 Nov 2019 11:51:24 -0000
@@ -2667,6 +2667,7 @@ xwl_pointer_warp_emulator_maybe_lock(str
      */
     if (pointer_grab &&
         !pointer_grab->ownerEvents &&
+        sprite &&
         XYToWindow(sprite, x, y) != xwl_seat->focus_window->window)
         return;
 
Index: hw/xwayland/xwayland-output.c
===================================================================
RCS file: /cvs/OpenBSD/xenocara/xserver/hw/xwayland/xwayland-output.c,v
retrieving revision 1.7
diff -u -p -u -r1.7 xwayland-output.c
--- hw/xwayland/xwayland-output.c       27 Jul 2019 07:57:21 -0000      1.7
+++ hw/xwayland/xwayland-output.c       23 Nov 2019 11:51:24 -0000
@@ -171,6 +171,40 @@ approximate_mmpd(struct xwl_screen *xwl_
         return 25.4 / DEFAULT_DPI;
 }
 
+static int
+xwl_set_pixmap_visit_window(WindowPtr window, void *data)
+{
+    ScreenPtr screen = window->drawable.pScreen;
+
+    if (screen->GetWindowPixmap(window) == data) {
+        screen->SetWindowPixmap(window, screen->GetScreenPixmap(screen));
+        return WT_WALKCHILDREN;
+    }
+
+    return WT_DONTWALKCHILDREN;
+}
+
+static void
+update_backing_pixmaps(struct xwl_screen *xwl_screen, int width, int height)
+{
+    ScreenPtr pScreen = xwl_screen->screen;
+    WindowPtr pRoot = pScreen->root;
+    PixmapPtr old_pixmap, new_pixmap;
+
+    old_pixmap = pScreen->GetScreenPixmap(pScreen);
+    new_pixmap = pScreen->CreatePixmap(pScreen, width, height,
+                                       pScreen->rootDepth,
+                                       CREATE_PIXMAP_USAGE_BACKING_PIXMAP);
+    pScreen->SetScreenPixmap(new_pixmap);
+
+    if (old_pixmap) {
+        TraverseTree(pRoot, xwl_set_pixmap_visit_window, old_pixmap);
+        pScreen->DestroyPixmap(old_pixmap);
+    }
+
+    pScreen->ResizeWindow(pRoot, 0, 0, width, height, NULL);
+}
+
 static void
 update_screen_size(struct xwl_output *xwl_output, int width, int height)
 {
@@ -180,6 +214,9 @@ update_screen_size(struct xwl_output *xw
     if (xwl_screen->root_clip_mode == ROOT_CLIP_FULL)
         SetRootClip(xwl_screen->screen, ROOT_CLIP_NONE);
 
+    if (!xwl_screen->rootless && xwl_screen->screen->root)
+        update_backing_pixmaps (xwl_screen, width, height);
+
     xwl_screen->width = width;
     xwl_screen->height = height;
     xwl_screen->screen->width = width;
@@ -439,7 +476,7 @@ xwl_screen_init_output(struct xwl_screen
     if (!RRScreenInit(xwl_screen->screen))
         return FALSE;
 
-    RRScreenSetSizeRange(xwl_screen->screen, 320, 200, 8192, 8192);
+    RRScreenSetSizeRange(xwl_screen->screen, 16, 16, 32767, 32767);
 
     rp = rrGetScrPriv(xwl_screen->screen);
     rp->rrGetInfo = xwl_randr_get_info;
Index: hw/xwayland/xwayland.c
===================================================================
RCS file: /cvs/OpenBSD/xenocara/xserver/hw/xwayland/xwayland.c,v
retrieving revision 1.6
diff -u -p -u -r1.6 xwayland.c
--- hw/xwayland/xwayland.c      27 Jul 2019 07:57:21 -0000      1.6
+++ hw/xwayland/xwayland.c      23 Nov 2019 11:51:24 -0000
@@ -125,6 +125,7 @@ ddxProcessArgument(int argc, char *argv[
 static DevPrivateKeyRec xwl_window_private_key;
 static DevPrivateKeyRec xwl_screen_private_key;
 static DevPrivateKeyRec xwl_pixmap_private_key;
+static DevPrivateKeyRec xwl_damage_private_key;
 
 static struct xwl_window *
 xwl_window_get(WindowPtr window)
@@ -367,8 +368,14 @@ xwl_cursor_confined_to(DeviceIntPtr devi
 static void
 damage_report(DamagePtr pDamage, RegionPtr pRegion, void *data)
 {
-    struct xwl_window *xwl_window = data;
-    struct xwl_screen *xwl_screen = xwl_window->xwl_screen;
+    WindowPtr window = data;
+    struct xwl_window *xwl_window = xwl_window_get(window);
+    struct xwl_screen *xwl_screen;
+
+    if (!xwl_window)
+        return;
+
+    xwl_screen = xwl_window->xwl_screen;
 
 #ifdef GLAMOR_HAS_GBM
     if (xwl_window->present_flipped) {
@@ -390,6 +397,47 @@ damage_destroy(DamagePtr pDamage, void *
 {
 }
 
+static Bool
+register_damage(WindowPtr window)
+{
+    DamagePtr damage;
+
+    damage = DamageCreate(damage_report, damage_destroy, DamageReportNonEmpty,
+                          FALSE, window->drawable.pScreen, window);
+    if (damage == NULL) {
+        ErrorF("Failed creating damage\n");
+        return FALSE;
+    }
+
+    DamageRegister(&window->drawable, damage);
+    DamageSetReportAfterOp(damage, TRUE);
+
+    dixSetPrivate(&window->devPrivates, &xwl_damage_private_key, damage);
+
+    return TRUE;
+}
+
+static void
+unregister_damage(WindowPtr window)
+{
+    DamagePtr damage;
+
+    damage = dixLookupPrivate(&window->devPrivates, &xwl_damage_private_key);
+    if (!damage)
+        return;
+
+    DamageUnregister(damage);
+    DamageDestroy(damage);
+
+    dixSetPrivate(&window->devPrivates, &xwl_damage_private_key, NULL);
+}
+
+static DamagePtr
+window_get_damage(WindowPtr window)
+{
+    return dixLookupPrivate(&window->devPrivates, &xwl_damage_private_key);
+}
+
 static void
 shell_surface_ping(void *data,
                    struct wl_shell_surface *shell_surface, uint32_t serial)
@@ -470,36 +518,25 @@ send_surface_id_event(struct xwl_window 
 }
 
 static Bool
-xwl_realize_window(WindowPtr window)
+ensure_surface_for_window(WindowPtr window)
 {
     ScreenPtr screen = window->drawable.pScreen;
     struct xwl_screen *xwl_screen;
     struct xwl_window *xwl_window;
     struct wl_region *region;
-    Bool ret;
-
-    xwl_screen = xwl_screen_get(screen);
-
-    screen->RealizeWindow = xwl_screen->RealizeWindow;
-    ret = (*screen->RealizeWindow) (window);
-    xwl_screen->RealizeWindow = screen->RealizeWindow;
-    screen->RealizeWindow = xwl_realize_window;
 
-    if (xwl_screen->rootless && !window->parent) {
-        BoxRec box = { 0, 0, xwl_screen->width, xwl_screen->height };
+    if (xwl_window_get(window))
+        return TRUE;
 
-        RegionReset(&window->winSize, &box);
-        RegionNull(&window->clipList);
-        RegionNull(&window->borderClip);
-    }
+    xwl_screen = xwl_screen_get(screen);
 
     if (xwl_screen->rootless) {
         if (window->redirectDraw != RedirectDrawManual)
-            return ret;
+            return TRUE;
     }
     else {
         if (window->parent)
-            return ret;
+            return TRUE;
     }
 
     xwl_window = calloc(1, sizeof *xwl_window);
@@ -545,25 +582,14 @@ xwl_realize_window(WindowPtr window)
 
     wl_surface_set_user_data(xwl_window->surface, xwl_window);
 
-    xwl_window->damage =
-        DamageCreate(damage_report, damage_destroy, DamageReportNonEmpty,
-                     FALSE, screen, xwl_window);
-    if (xwl_window->damage == NULL) {
-        ErrorF("Failed creating damage\n");
-        goto err_surf;
-    }
-
     compRedirectWindow(serverClient, window, CompositeRedirectManual);
 
-    DamageRegister(&window->drawable, xwl_window->damage);
-    DamageSetReportAfterOp(xwl_window->damage, TRUE);
-
     dixSetPrivate(&window->devPrivates, &xwl_window_private_key, xwl_window);
     xorg_list_init(&xwl_window->link_damage);
 
     xwl_window_init_allow_commits(xwl_window);
 
-    return ret;
+    return TRUE;
 
 err_surf:
     if (xwl_window->shell_surface)
@@ -575,6 +601,42 @@ err:
 }
 
 static Bool
+xwl_realize_window(WindowPtr window)
+{
+    ScreenPtr screen = window->drawable.pScreen;
+    struct xwl_screen *xwl_screen;
+    Bool ret;
+
+    xwl_screen = xwl_screen_get(screen);
+
+    screen->RealizeWindow = xwl_screen->RealizeWindow;
+    ret = (*screen->RealizeWindow) (window);
+    xwl_screen->RealizeWindow = screen->RealizeWindow;
+    screen->RealizeWindow = xwl_realize_window;
+
+    if (!ret)
+        return FALSE;
+
+    if (xwl_screen->rootless && !window->parent) {
+        BoxRec box = { 0, 0, xwl_screen->width, xwl_screen->height };
+
+        RegionReset(&window->winSize, &box);
+        RegionNull(&window->clipList);
+        RegionNull(&window->borderClip);
+    }
+
+    if (xwl_screen->rootless ?
+        (window->drawable.class == InputOutput &&
+         window->parent == window->drawable.pScreen->root) :
+        !window->parent) {
+        if (!register_damage(window))
+            return FALSE;
+    }
+
+    return ensure_surface_for_window(window);
+}
+
+static Bool
 xwl_unrealize_window(WindowPtr window)
 {
     ScreenPtr screen = window->drawable.pScreen;
@@ -620,8 +682,8 @@ xwl_unrealize_window(WindowPtr window)
 
     wl_surface_destroy(xwl_window->surface);
     xorg_list_del(&xwl_window->link_damage);
-    DamageUnregister(xwl_window->damage);
-    DamageDestroy(xwl_window->damage);
+    unregister_damage(window);
+
     if (xwl_window->frame_callback)
         wl_callback_destroy(xwl_window->frame_callback);
 
@@ -638,6 +700,26 @@ xwl_save_screen(ScreenPtr pScreen, int o
 }
 
 static void
+xwl_set_window_pixmap(WindowPtr window,
+                      PixmapPtr pixmap)
+{
+    ScreenPtr screen = window->drawable.pScreen;
+    struct xwl_screen *xwl_screen;
+
+    xwl_screen = xwl_screen_get(screen);
+
+    screen->SetWindowPixmap = xwl_screen->SetWindowPixmap;
+    (*screen->SetWindowPixmap) (window, pixmap);
+    xwl_screen->SetWindowPixmap = screen->SetWindowPixmap;
+    screen->SetWindowPixmap = xwl_set_window_pixmap;
+
+    if (!RegionNotEmpty(&window->winSize))
+        return;
+
+    ensure_surface_for_window(window);
+}
+
+static void
 frame_callback(void *data,
                struct wl_callback *callback,
                uint32_t time)
@@ -689,7 +771,7 @@ xwl_window_post_damage(struct xwl_window
 
     assert(!xwl_window->frame_callback);
 
-    region = DamageRegion(xwl_window->damage);
+    region = DamageRegion(window_get_damage(xwl_window->window));
     pixmap = (*xwl_screen->screen->GetWindowPixmap) (xwl_window->window);
 
 #ifdef XWL_HAS_GLAMOR
@@ -726,7 +808,7 @@ xwl_window_post_damage(struct xwl_window
     wl_callback_add_listener(xwl_window->frame_callback, &frame_listener, 
xwl_window);
 
     wl_surface_commit(xwl_window->surface);
-    DamageEmpty(xwl_window->damage);
+    DamageEmpty(window_get_damage(xwl_window->window));
 
     xorg_list_del(&xwl_window->link_damage);
 }
@@ -962,6 +1044,8 @@ xwl_screen_init(ScreenPtr pScreen, int a
         return FALSE;
     if (!dixRegisterPrivateKey(&xwl_pixmap_private_key, PRIVATE_PIXMAP, 0))
         return FALSE;
+    if (!dixRegisterPrivateKey(&xwl_damage_private_key, PRIVATE_WINDOW, 0))
+        return FALSE;
 
     dixSetPrivate(&pScreen->devPrivates, &xwl_screen_private_key, xwl_screen);
     xwl_screen->screen = pScreen;
@@ -1120,6 +1204,11 @@ xwl_screen_init(ScreenPtr pScreen, int a
 
     xwl_screen->CloseScreen = pScreen->CloseScreen;
     pScreen->CloseScreen = xwl_close_screen;
+
+    if (xwl_screen->rootless) {
+        xwl_screen->SetWindowPixmap = pScreen->SetWindowPixmap;
+        pScreen->SetWindowPixmap = xwl_set_window_pixmap;
+    }
 
     pScreen->CursorWarpedTo = xwl_cursor_warped_to;
     pScreen->CursorConfinedTo = xwl_cursor_confined_to;
Index: hw/xwayland/xwayland.h
===================================================================
RCS file: /cvs/OpenBSD/xenocara/xserver/hw/xwayland/xwayland.h,v
retrieving revision 1.6
diff -u -p -u -r1.6 xwayland.h
--- hw/xwayland/xwayland.h      27 Jul 2019 07:57:21 -0000      1.6
+++ hw/xwayland/xwayland.h      23 Nov 2019 11:51:24 -0000
@@ -133,6 +133,7 @@ struct xwl_screen {
     UnrealizeWindowProcPtr UnrealizeWindow;
     DestroyWindowProcPtr DestroyWindow;
     XYToWindowProcPtr XYToWindow;
+    SetWindowPixmapProcPtr SetWindowPixmap;
 
     struct xorg_list output_list;
     struct xorg_list seat_list;
@@ -178,7 +179,6 @@ struct xwl_window {
     struct wl_surface *surface;
     struct wl_shell_surface *shell_surface;
     WindowPtr window;
-    DamagePtr damage;
     struct xorg_list link_damage;
     struct wl_callback *frame_callback;
     Bool allow_commits;
Index: include/dix-config.h.in
===================================================================
RCS file: /cvs/OpenBSD/xenocara/xserver/include/dix-config.h.in,v
retrieving revision 1.25
diff -u -p -u -r1.25 dix-config.h.in
--- include/dix-config.h.in     27 Jul 2019 07:57:22 -0000      1.25
+++ include/dix-config.h.in     23 Nov 2019 11:51:24 -0000
@@ -134,6 +134,9 @@
 /* Define to 1 if you have the <linux/fb.h> header file. */
 #undef HAVE_LINUX_FB_H
 
+/* Define to 1 if you have the `memfd_create' function. */
+#undef HAVE_MEMFD_CREATE
+
 /* Define to 1 if you have the `mkostemp' function. */
 #undef HAVE_MKOSTEMP
 
@@ -467,9 +470,6 @@
 /* Wrap SIGBUS to catch MIT-SHM faults */
 #undef BUSFAULT
 
-/* Directory for shared memory temp files */
-#undef SHMDIR
-
 /* Don't let Xdefs.h define 'pointer' */
 #define _XTYPEDEF_POINTER       1
 
@@ -523,5 +523,8 @@
 
 /* Have epoll_create1() */
 #undef HAVE_EPOLL_CREATE1
+
+/* Have isastream */
+#undef HAVE_ISASTREAM
 
 #endif /* _DIX_CONFIG_H_ */
Index: include/do-not-use-config.h.in
===================================================================
RCS file: /cvs/OpenBSD/xenocara/xserver/include/do-not-use-config.h.in,v
retrieving revision 1.33
diff -u -p -u -r1.33 do-not-use-config.h.in
--- include/do-not-use-config.h.in      27 Jul 2019 07:57:22 -0000      1.33
+++ include/do-not-use-config.h.in      23 Nov 2019 11:51:24 -0000
@@ -218,6 +218,9 @@
 /* Define to 1 if you have the <inttypes.h> header file. */
 #undef HAVE_INTTYPES_H
 
+/* Define to 1 if you have the `isastream' function. */
+#undef HAVE_ISASTREAM
+
 /* Define to 1 if you have the `issetugid' function. */
 #undef HAVE_ISSETUGID
 
@@ -254,6 +257,9 @@
 /* Define to 1 if you have the <linux/fb.h> header file. */
 #undef HAVE_LINUX_FB_H
 
+/* Define to 1 if you have the `memfd_create' function. */
+#undef HAVE_MEMFD_CREATE
+
 /* Define to 1 if you have the <memory.h> header file. */
 #undef HAVE_MEMORY_H
 
@@ -552,9 +558,6 @@
 
 /* Support SHAPE extension */
 #undef SHAPE
-
-/* Directory for shared memory temp files */
-#undef SHMDIR
 
 /* The size of `unsigned long', as computed by sizeof. */
 #undef SIZEOF_UNSIGNED_LONG
Index: include/glxvndabi.h
===================================================================
RCS file: /cvs/OpenBSD/xenocara/xserver/include/glxvndabi.h,v
retrieving revision 1.1
diff -u -p -u -r1.1 glxvndabi.h
--- include/glxvndabi.h 27 Jul 2019 07:57:22 -0000      1.1
+++ include/glxvndabi.h 23 Nov 2019 11:51:24 -0000
@@ -75,7 +75,7 @@
  * will still work.
  */
 #define GLXSERVER_VENDOR_ABI_MAJOR_VERSION 0
-#define GLXSERVER_VENDOR_ABI_MINOR_VERSION 0
+#define GLXSERVER_VENDOR_ABI_MINOR_VERSION 1
 
 #if defined(__cplusplus)
 extern "C" {
@@ -236,6 +236,17 @@ typedef struct GlxServerExportsRec {
      * \param client The client.
      */
     int (* forwardRequest) (GlxServerVendor *vendor, ClientPtr client);
+
+    /**
+     * Sets the vendor library to use for a screen for a specific client.
+     *
+     * This function changes which vendor should handle GLX requests for a
+     * screen. Unlike \c setScreenVendor, this function can be called at any
+     * time, and only applies to requests from a single client.
+     *
+     * This function is available in GLXVND version 0.1 or later.
+     */
+    Bool (* setClientScreenVendor) (ClientPtr client, ScreenPtr screen, 
GlxServerVendor *vendor);
 } GlxServerExports;
 
 extern _X_EXPORT const GlxServerExports glxServer;
Index: mi/mi.h
===================================================================
RCS file: /cvs/OpenBSD/xenocara/xserver/mi/mi.h,v
retrieving revision 1.9
diff -u -p -u -r1.9 mi.h
--- mi/mi.h     16 Sep 2015 19:10:25 -0000      1.9
+++ mi/mi.h     23 Nov 2019 11:51:24 -0000
@@ -360,6 +360,10 @@ extern _X_EXPORT void miPushPixels(GCPtr
 
 /* miscrinit.c */
 
+extern _X_EXPORT void
+miSourceValidate(DrawablePtr pDrawable, int x, int y, int w, int h,
+                 unsigned int subWindowMode);
+
 extern _X_EXPORT Bool miModifyPixmapHeader(PixmapPtr pPixmap,
                                            int width,
                                            int height,
Index: mi/miscrinit.c
===================================================================
RCS file: /cvs/OpenBSD/xenocara/xserver/mi/miscrinit.c,v
retrieving revision 1.12
diff -u -p -u -r1.12 miscrinit.c
--- mi/miscrinit.c      29 May 2016 12:02:39 -0000      1.12
+++ mi/miscrinit.c      23 Nov 2019 11:51:24 -0000
@@ -124,6 +124,12 @@ miCloseScreen(ScreenPtr pScreen)
     return ((*pScreen->DestroyPixmap) ((PixmapPtr) pScreen->devPrivate));
 }
 
+void
+miSourceValidate(DrawablePtr pDrawable, int x, int y, int w, int h,
+                 unsigned int subWindowMode)
+{
+}
+
 /* With the introduction of pixmap privates, the "screen pixmap" can no
  * longer be created in miScreenInit, since all the modules that could
  * possibly ask for pixmap private space have not been initialized at
@@ -243,7 +249,7 @@ miScreenInit(ScreenPtr pScreen, void *pb
     }
     /* else CloseScreen */
     /* QueryBestSize, SaveScreen, GetImage, GetSpans */
-    pScreen->SourceValidate = (SourceValidateProcPtr) 0;
+    pScreen->SourceValidate = miSourceValidate;
     /* CreateWindow, DestroyWindow, PositionWindow, ChangeWindowAttributes */
     /* RealizeWindow, UnrealizeWindow */
     pScreen->ValidateTree = miValidateTree;
Index: miext/sync/misync.c
===================================================================
RCS file: /cvs/OpenBSD/xenocara/xserver/miext/sync/misync.c,v
retrieving revision 1.5
diff -u -p -u -r1.5 misync.c
--- miext/sync/misync.c 27 Jul 2019 07:57:24 -0000      1.5
+++ miext/sync/misync.c 23 Nov 2019 11:51:24 -0000
@@ -101,24 +101,29 @@ miSyncInitFence(ScreenPtr pScreen, SyncF
     pFence->funcs = miSyncFenceFuncs;
 
     pScreenPriv->funcs.CreateFence(pScreen, pFence, initially_triggered);
+
+    pFence->sync.initialized = TRUE;
 }
 
 void
 miSyncDestroyFence(SyncFence * pFence)
 {
-    ScreenPtr pScreen = pFence->pScreen;
-    SyncScreenPrivPtr pScreenPriv = SYNC_SCREEN_PRIV(pScreen);
-    SyncTriggerList *ptl, *pNext;
-
     pFence->sync.beingDestroyed = TRUE;
-    /* tell all the fence's triggers that the counter has been destroyed */
-    for (ptl = pFence->sync.pTriglist; ptl; ptl = pNext) {
-        (*ptl->pTrigger->CounterDestroyed) (ptl->pTrigger);
-        pNext = ptl->next;
-        free(ptl);              /* destroy the trigger list as we go */
-    }
 
-    pScreenPriv->funcs.DestroyFence(pScreen, pFence);
+    if (pFence->sync.initialized) {
+        ScreenPtr pScreen = pFence->pScreen;
+        SyncScreenPrivPtr pScreenPriv = SYNC_SCREEN_PRIV(pScreen);
+        SyncTriggerList *ptl, *pNext;
+
+        /* tell all the fence's triggers that the counter has been destroyed */
+        for (ptl = pFence->sync.pTriglist; ptl; ptl = pNext) {
+            (*ptl->pTrigger->CounterDestroyed) (ptl->pTrigger);
+            pNext = ptl->next;
+            free(ptl); /* destroy the trigger list as we go */
+        }
+
+        pScreenPriv->funcs.DestroyFence(pScreen, pFence);
+    }
 
     dixFreeObjectWithPrivates(pFence, PRIVATE_SYNC_FENCE);
 }
Index: miext/sync/misync.h
===================================================================
RCS file: /cvs/OpenBSD/xenocara/xserver/miext/sync/misync.h,v
retrieving revision 1.3
diff -u -p -u -r1.3 misync.h
--- miext/sync/misync.h 2 May 2014 19:27:50 -0000       1.3
+++ miext/sync/misync.h 23 Nov 2019 11:51:24 -0000
@@ -28,6 +28,7 @@
 #ifndef _MISYNC_H_
 #define _MISYNC_H_
 
+typedef struct _SyncObject SyncObject;
 typedef struct _SyncFence SyncFence;
 typedef struct _SyncTrigger SyncTrigger;
 
Index: miext/sync/misyncstr.h
===================================================================
RCS file: /cvs/OpenBSD/xenocara/xserver/miext/sync/misyncstr.h,v
retrieving revision 1.5
diff -u -p -u -r1.5 misyncstr.h
--- miext/sync/misyncstr.h      27 Jul 2019 07:57:24 -0000      1.5
+++ miext/sync/misyncstr.h      23 Nov 2019 11:51:24 -0000
@@ -38,13 +38,14 @@
 #define SYNC_COUNTER           0
 #define SYNC_FENCE             1
 
-typedef struct _SyncObject {
+struct _SyncObject {
     ClientPtr client;           /* Owning client. 0 for system counters */
     struct _SyncTriggerList *pTriglist; /* list of triggers */
     XID id;                     /* resource ID */
     unsigned char type;         /* SYNC_* */
+    unsigned char initialized;  /* FALSE if created but not initialized */
     Bool beingDestroyed;        /* in process of going away */
-} SyncObject;
+};
 
 typedef struct _SyncCounter {
     SyncObject sync;            /* Common sync object data */
Index: os/connection.c
===================================================================
RCS file: /cvs/OpenBSD/xenocara/xserver/os/connection.c,v
retrieving revision 1.21
diff -u -p -u -r1.21 connection.c
--- os/connection.c     27 Jul 2019 07:57:24 -0000      1.21
+++ os/connection.c     23 Nov 2019 11:51:24 -0000
@@ -942,6 +942,14 @@ AttendClient(ClientPtr client)
 {
     OsCommPtr oc = (OsCommPtr) client->osPrivate;
 
+    if (client->clientGone) {
+        /*
+         * client is gone, so any pending requests will be dropped and its
+         * ignore count doesn't matter.
+         */
+        return;
+    }
+
     client->ignoreCount--;
     if (client->ignoreCount)
         return;
Index: present/present_scmd.c
===================================================================
RCS file: /cvs/OpenBSD/xenocara/xserver/present/present_scmd.c,v
retrieving revision 1.1
diff -u -p -u -r1.1 present_scmd.c
--- present/present_scmd.c      27 Jul 2019 07:57:24 -0000      1.1
+++ present/present_scmd.c      23 Nov 2019 11:51:24 -0000
@@ -78,7 +78,7 @@ present_check_flip(RRCrtcPtr            
                    PresentFlipReason   *reason)
 {
     ScreenPtr                   screen = window->drawable.pScreen;
-    PixmapPtr                   screen_pixmap, window_pixmap;
+    PixmapPtr                   window_pixmap;
     WindowPtr                   root = screen->root;
     present_screen_priv_ptr     screen_priv = present_screen_priv(screen);
 
@@ -99,9 +99,8 @@ present_check_flip(RRCrtcPtr            
         return FALSE;
 
     /* Make sure the window hasn't been redirected with Composite */
-    screen_pixmap = screen->GetScreenPixmap(screen);
     window_pixmap = screen->GetWindowPixmap(window);
-    if (window_pixmap != screen_pixmap &&
+    if (window_pixmap != screen->GetScreenPixmap(screen) &&
         window_pixmap != screen_priv->flip_pixmap &&
         window_pixmap != present_flip_pending_pixmap(screen))
         return FALSE;
@@ -127,8 +126,7 @@ present_check_flip(RRCrtcPtr            
         window->drawable.x != pixmap->screen_x || window->drawable.y != 
pixmap->screen_y ||
 #endif
         window->drawable.width != pixmap->drawable.width ||
-        window->drawable.height != pixmap->drawable.height ||
-        pixmap->devKind != screen_pixmap->devKind) {
+        window->drawable.height != pixmap->drawable.height) {
         return FALSE;
     }
 
Index: present/present_wnmd.c
===================================================================
RCS file: /cvs/OpenBSD/xenocara/xserver/present/present_wnmd.c,v
retrieving revision 1.1
diff -u -p -u -r1.1 present_wnmd.c
--- present/present_wnmd.c      27 Jul 2019 07:57:24 -0000      1.1
+++ present/present_wnmd.c      23 Nov 2019 11:51:24 -0000
@@ -649,8 +649,6 @@ present_wnmd_abort_vblank(ScreenPtr scre
     present_window_priv_ptr window_priv = present_window_priv(window);
     present_vblank_ptr      vblank;
 
-    assert(crtc);
-
     (*screen_priv->wnmd_info->abort_vblank) (window, crtc, event_id, msc);
 
     xorg_list_for_each_entry(vblank, &window_priv->exec_queue, event_queue) {
Index: randr/rrcrtc.c
===================================================================
RCS file: /cvs/OpenBSD/xenocara/xserver/randr/rrcrtc.c,v
retrieving revision 1.17
diff -u -p -u -r1.17 rrcrtc.c
--- randr/rrcrtc.c      27 Jul 2019 07:57:24 -0000      1.17
+++ randr/rrcrtc.c      23 Nov 2019 11:51:24 -0000
@@ -401,17 +401,22 @@ RRCrtcDetachScanoutPixmap(RRCrtcPtr crtc
         if (crtc->scanout_pixmap_back) {
             pScrPriv->rrDisableSharedPixmapFlipping(crtc);
 
-            master->StopFlippingPixmapTracking(mrootdraw,
-                                               crtc->scanout_pixmap,
-                                               crtc->scanout_pixmap_back);
+            if (mrootdraw) {
+                master->StopFlippingPixmapTracking(mrootdraw,
+                                                   crtc->scanout_pixmap,
+                                                   crtc->scanout_pixmap_back);
+            }
 
             rrDestroySharedPixmap(crtc, crtc->scanout_pixmap_back);
             crtc->scanout_pixmap_back = NULL;
         }
         else {
             pScrPriv->rrCrtcSetScanoutPixmap(crtc, NULL);
-            master->StopPixmapTracking(mrootdraw,
-                                       crtc->scanout_pixmap);
+
+            if (mrootdraw) {
+                master->StopPixmapTracking(mrootdraw,
+                                           crtc->scanout_pixmap);
+            }
         }
 
         rrDestroySharedPixmap(crtc, crtc->scanout_pixmap);
Index: record/record.c
===================================================================
RCS file: /cvs/OpenBSD/xenocara/xserver/record/record.c,v
retrieving revision 1.18
diff -u -p -u -r1.18 record.c
--- record/record.c     27 Jul 2019 07:57:25 -0000      1.18
+++ record/record.c     23 Nov 2019 11:51:24 -0000
@@ -2362,9 +2362,9 @@ RecordDisableContext(RecordContextPtr pC
     if (!pContext->pRecordingClient->clientGone) {
         RecordAProtocolElement(pContext, NULL, XRecordEndOfData, NULL, 0, 0, 
0);
         RecordFlushReplyBuffer(pContext, NULL, 0, NULL, 0);
-        /* Re-enable request processing on this connection. */
-        AttendClient(pContext->pRecordingClient);
     }
+    /* Re-enable request processing on this connection. */
+    AttendClient(pContext->pRecordingClient);
 
     for (pRCAP = pContext->pListOfRCAP; pRCAP; pRCAP = pRCAP->pNextRCAP) {
         RecordUninstallHooks(pRCAP, 0);
Index: render/render.c
===================================================================
RCS file: /cvs/OpenBSD/xenocara/xserver/render/render.c,v
retrieving revision 1.23
diff -u -p -u -r1.23 render.c
--- render/render.c     27 Jul 2019 07:57:25 -0000      1.23
+++ render/render.c     23 Nov 2019 11:51:24 -0000
@@ -1492,6 +1492,11 @@ ProcRenderCreateCursor(ClientPtr client)
         return BadAlloc;
     }
 
+    /* what kind of maniac creates a cursor from a window picture though */
+    if (pSrc->pDrawable->type == DRAWABLE_WINDOW)
+        pScreen->SourceValidate(pSrc->pDrawable, 0, 0, width, height,
+                                IncludeInferiors);
+
     if (pSrc->format == PICT_a8r8g8b8) {
         (*pScreen->GetImage) (pSrc->pDrawable,
                               0, 0, width, height, ZPixmap,
Index: xkb/xkb.c
===================================================================
RCS file: /cvs/OpenBSD/xenocara/xserver/xkb/xkb.c,v
retrieving revision 1.16
diff -u -p -u -r1.16 xkb.c
--- xkb/xkb.c   27 Jul 2019 07:57:26 -0000      1.16
+++ xkb/xkb.c   23 Nov 2019 11:51:24 -0000
@@ -2110,6 +2110,9 @@ SetKeySyms(ClientPtr client,
                 }
             }
         }
+        if (XkbKeyHasActions(xkb, i + req->firstKeySym))
+            XkbResizeKeyActions(xkb, i + req->firstKeySym,
+                                XkbNumGroups(wire->groupInfo) * wire->width);
         oldMap->kt_index[0] = wire->ktIndex[0];
         oldMap->kt_index[1] = wire->ktIndex[1];
         oldMap->kt_index[2] = wire->ktIndex[2];
@@ -2383,6 +2386,9 @@ _XkbSetMapChecks(ClientPtr client, Devic
     XkbSymMapPtr map;
     int i;
 
+    if (!dev->key)
+        return 0;
+
     xkbi = dev->key->xkbInfo;
     xkb = xkbi->desc;
 
@@ -2494,6 +2500,9 @@ _XkbSetMap(ClientPtr client, DeviceIntPt
     Bool sentNKN;
     XkbSrvInfoPtr xkbi;
     XkbDescPtr xkb;
+
+    if (!dev->key)
+        return Success;
 
     xkbi = dev->key->xkbInfo;
     xkb = xkbi->desc;

-- 
Matthieu Herrb

Reply via email to