1. 20 Nov, 2019 1 commit
    • Aaron Plattner's avatar
      os: Don't crash in AttendClient if the client is gone · 2edadf26
      Aaron Plattner authored
      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/...
  2. 18 Nov, 2019 3 commits
    • Adam Jackson's avatar
      dix: Call SourceValidate before GetImage · 68cfee97
      Adam Jackson authored
      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's avatarMichel Dänzer <mdaenzer@redhat.com>
      (cherry picked from commit 516e75db)
    • Adam Jackson's avatar
      mi: Add a default no-op miSourceValidate · 2320fd4b
      Adam Jackson authored
      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's avatarMichel Dänzer <mdaenzer@redhat.com>
      (cherry picked from commit ff310903)
    • Olivier Fourdan's avatar
      compiler.h: Do not include sys/io.h on ARM with glibc · 07efd81b
      Olivier Fourdan authored
      <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: default avatarOlivier Fourdan <ofourdan@redhat.com>
      Closes: xorg/xserver#840
      (cherry picked from commit fe4cd0e7)
  3. 13 Nov, 2019 1 commit
    • Aaron Plattner's avatar
      xfree86: Call ScreenInit for protocol screens before GPU screens · 03b91e17
      Aaron Plattner authored
      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 e5e9a8ca)
  4. 11 Nov, 2019 4 commits
    • Alex Goins's avatar
      modesetting: Implement ms_covering_randr_crtc() for ms_present_get_crtc() · 325f694e
      Alex Goins authored
      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
      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's avatarAlex Goins <agoins@nvidia.com>
      (cherry picked from commit 562c7888)
    • Alex Goins's avatar
      modesetting: Fix ms_covering_crtc() segfault with non-xf86Crtc slave · aa43dce1
      Alex Goins authored
      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's avatarAlex Goins <agoins@nvidia.com>
      (cherry picked from commit 797e7a0c)
    • Alex Goins's avatar
      modesetting: Fix ms_covering_crtc() segfault with non-modesetting slave primary · 341a4787
      Alex Goins authored
      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
      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's avatarAlex Goins <agoins@nvidia.com>
      (cherry picked from commit 3ef9029a)
    • Alex Goins's avatar
      randr: Fix RRCrtcDetachScanoutPixmap() segfault during server teardown · 2dd9dfc8
      Alex Goins authored
      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's avatarAlex Goins <agoins@nvidia.com>
      (cherry picked from commit c82f8143)
  5. 05 Nov, 2019 4 commits
    • Hans de Goede's avatar
      glamor/xwayland: Define EGL_NO_X11 · 642c1f83
      Hans de Goede authored
      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: default avatarHans de Goede <hdegoede@redhat.com>
      (cherry picked from commit 741bd734)
    • Adam Jackson's avatar
      meson: Apparently 1.2 is < 1.2.0 · 2f55e8dc
      Adam Jackson authored
      (cherry picked from commit 3340ddf3)
    • Adam Jackson's avatar
      meson: Fix another reference to "gl" 9.2.0 · e16eb696
      Adam Jackson authored
      Previous commit e6ef2b12 missed a spot.
      (cherry picked from commit c7486613)
    • Marvin Schmidt's avatar
      build: glx: Lower gl version to work with libglvnd · a57729d3
      Marvin Schmidt authored
      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 e6ef2b12)
  6. 30 Oct, 2019 1 commit
  7. 29 Oct, 2019 5 commits
    • Alexander Tsoy's avatar
      configure: Set libdrm flags correctly if only XORG is enabled · df1f8f69
      Alexander Tsoy authored
      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's avatarAlexander Tsoy <alexander@tsoy.me>
      Reviewed-by: Emil Velikov's avatarEmil Velikov <emil.velikov@collabora.com>
      (cherry picked from commit 334f1107)
    • Matt Turner's avatar
      dix: Assert noPanoramiXExtension is false in PanoramiX code · fada61e8
      Matt Turner authored
      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's avatarMatt Turner <mattst88@gmail.com>
      (cherry picked from commit 61aa40ae)
    • Alexander Volkov's avatar
      shm: Use memfd_create when possible · e815db54
      Alexander Volkov authored
      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's avatarAlexander Volkov <a.volkov@rusbitech.ru>
      (cherry picked from commit f6753c11)
    • Emma Anholt's avatar
      shm: Pick the shm dir at run time, not build time. · 05c5b970
      Emma Anholt authored
      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: Emma Anholt's avatarEric Anholt <eric@anholt.net>
      (cherry picked from commit 19f6cb57)
    • Emma Anholt's avatar
      shm: reindent shm_tmpfile to follow our standards. · 9ee4e35b
      Emma Anholt authored
      Signed-off-by: Emma Anholt's avatarEric Anholt <eric@anholt.net>
      (cherry picked from commit 804a9b4f)
  8. 14 Oct, 2019 2 commits
  9. 26 Sep, 2019 1 commit
  10. 23 Sep, 2019 1 commit
  11. 10 Sep, 2019 3 commits
  12. 21 Aug, 2019 2 commits
    • Adam Jackson's avatar
      glx: Fix previous context validation in xorgGlxMakeCurrent · 045add84
      Adam Jackson authored
      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
      Sadly Mesa will still need to carry a workaround here for broken
      servers, but we should still fix the server.
      (cherry picked from commit 95dcc81c)
    • Adam Jackson's avatar
      miext/sync: Fix needless ABI change · 8449c862
      Adam Jackson authored
      The initialized field was added in:
          commit 82f01ad7
          Author: Alex Goins <agoins@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 194ba387)
  13. 13 Aug, 2019 5 commits
  14. 26 Jul, 2019 5 commits
  15. 10 Jul, 2019 1 commit
  16. 06 Jun, 2019 1 commit
    • Carlos Garnacho's avatar
      xwayland: Reset scheduled frames after hiding tablet cursor · c86222d4
      Carlos Garnacho authored
      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's avatarCarlos Garnacho <carlosg@gnome.org>
      (cherry picked from commit dea4a746)