1. 14 Feb, 2018 1 commit
    • Adam Jackson's avatar
      glx: Use vnd layer for dispatch (v4) · d8ec33fe
      Adam Jackson authored
      The big change here is MakeCurrent and context tag tracking. We now
      delegate context tags entirely to the vnd layer, and simply store a
      pointer to the context state as the tag data. If a context is deleted
      while it's current, we allocate a fake ID for the context and move the
      context state there, so the tag data still points to a real context. As
      a result we can stop trying so hard to detach the client from contexts
      at disconnect time and just let resource destruction handle it.
      Since vnd handles all the MakeCurrent protocol now, our request handlers
      for it can just be return BadImplementation. We also remove a bunch of
      LEGAL_NEW_RESOURCE, because now by the time we're called vnd has already
      allocated its tracking resource on that XID.
      v2: Update to match v2 of the vnd import, and remove more redundant work
      like request length checks.
      v3: Add/remove the XID map from the vendor private thunk, not the
      backend. (Kyle Brenneman)
      v4: Fix deletion of ghost contexts (Kyle Brenneman)
      Signed-off-by: Adam Jackson's avatarAdam Jackson <ajax@redhat.com>
  2. 06 Feb, 2018 1 commit
    • Lyude Paul's avatar
      xwayland: Don't process cursor warping without an xwl_seat · 98edb9a3
      Lyude Paul authored
      Unfortunately, on my machine Xwayland immediately crashes when I try to
      start it. gdb backtrace:
       #0  0x00007ffff74f0e79 in wl_proxy_marshal () from target:/lib64/libwayland-client.so.0
       #1  0x0000000000413172 in zwp_confined_pointer_v1_destroy (zwp_confined_pointer_v1=0x700000000)
           at hw/xwayland/Xwayland@exe/pointer-constraints-unstable-v1-client-protocol.h:612
       #2  0x0000000000418bc0 in xwl_seat_destroy_confined_pointer (xwl_seat=0x8ba2a0)
           at /home/lyudess/Projects/xserver/hw/xwayland/xwayland-input.c:2839
       #3  0x0000000000418c09 in xwl_seat_unconfine_pointer (xwl_seat=0x8ba2a0)
           at /home/lyudess/Projects/xserver/hw/xwayland/xwayland-input.c:2849
       #4  0x0000000000410d97 in xwl_cursor_confined_to (device=0xa5a000, screen=0x8b9d80, window=0x9bdb70)
           at /home/lyudess/Projects/xserver/hw/xwayland/xwayland.c:328
       #5  0x00000000004a8571 in ConfineCursorToWindow (pDev=0xa5a000, pWin=0x9bdb70, generateEvents=1,
           confineToScreen=0) at /home/lyudess/Projects/xserver/dix/events.c:900
       #6  0x00000000004a94b7 in ScreenRestructured (pScreen=0x8b9d80)
           at /home/lyudess/Projects/xserver/dix/events.c:1387
       #7  0x0000000000502386 in RRScreenSizeNotify (pScreen=0x8b9d80)
           at /home/lyudess/Projects/xserver/randr/rrscreen.c:160
       #8  0x000000000041a83c in update_screen_size (xwl_output=0x8e7670, width=3840, height=2160)
           at /home/lyudess/Projects/xserver/hw/xwayland/xwayland-output.c:203
       #9  0x000000000041a9f0 in apply_output_change (xwl_output=0x8e7670)
           at /home/lyudess/Projects/xserver/hw/xwayland/xwayland-output.c:252
       #10 0x000000000041aaeb in xdg_output_handle_done (data=0x8e7670, xdg_output=0x8e7580)
           at /home/lyudess/Projects/xserver/hw/xwayland/xwayland-output.c:307
       #11 0x00007ffff50e9d1e in ffi_call_unix64 () at ../src/x86/unix64.S:76
       #12 0x00007ffff50e968f in ffi_call (cif=<optimized out>, fn=<optimized out>, rvalue=<optimized out>,
           avalue=<optimized out>) at ../src/x86/ffi64.c:525
       #13 0x00007ffff74f3d8b in wl_closure_invoke () from target:/lib64/libwayland-client.so.0
       #14 0x00007ffff74f0928 in dispatch_event.isra () from target:/lib64/libwayland-client.so.0
       #15 0x00007ffff74f1be4 in wl_display_dispatch_queue_pending () from target:/lib64/libwayland-client.so.0
       #16 0x00007ffff74f200b in wl_display_roundtrip_queue () from target:/lib64/libwayland-client.so.0
       #17 0x0000000000418cad in InitInput (argc=12, argv=0x7fffffffd9c8)
           at /home/lyudess/Projects/xserver/hw/xwayland/xwayland-input.c:2867
       #18 0x00000000004a20e3 in dix_main (argc=12, argv=0x7fffffffd9c8, envp=0x7fffffffda30)
           at /home/lyudess/Projects/xserver/dix/main.c:250
       #19 0x0000000000420cb2 in main (argc=12, argv=0x7fffffffd9c8, envp=0x7fffffffda30)
          at /home/lyudess/Projects/xserver/dix/stubmain.c:34
      This appears to be the result of xwl_cursor_confined_to() and
      xwl_screen_get_default_seat(). While not against protocol, mutter ends
      up sending xdg_output before wl_seat. xwl_screen_get_default_seat()
      makes the naïve assumption that we always have a valid seat, we end up
      returning a pointer to the empty list itself instead of an actual seat
      and causing ourselves to segfault.
      So, actually return NULL in xwl_screen_get_default_seat() if the seat
      list is empty, and skip any pointer confinement processing in
      xwl_cursor_confined_to() when we don't have a seat setup yet.
      Signed-off-by: Lyude Paul's avatarLyude Paul <lyude@redhat.com>
      Reviewed-by: Adam Jackson's avatarAdam Jackson <ajax@redhat.com>
  3. 25 Jan, 2018 3 commits
    • Olivier Fourdan's avatar
      xwayland: place a manual redirect on windows · fc8b7d05
      Olivier Fourdan authored
      Place a manual redirect on windows on xwl_realize_window() and remove
      it on xwl_unrealize_window() to avoid the X11 window manager removing
      its redirect before Xwayland has unrealized the window (e.g. if the X11
      window manager has terminated unexpectedly)
      Suggested by Daniel Stone <daniel@fooishbar.org>
      Signed-off-by: default avatarOlivier Fourdan <ofourdan@redhat.com>
      Reviewed-by: Daniel Stone's avatarDaniel Stone <daniel@fooishbar.org>
    • Olivier Fourdan's avatar
      xwayland: remove dirty window unconditionally on unrealize · 3362422e
      Olivier Fourdan authored
      This is a rare occurrence of a crash in Xwayland for which I don't have
      the reproducing steps, just a core file.
      The backtrace looks as follow:
        #0  raise () from /usr/lib64/libc.so.6
        #1  abort () from /usr/lib64/libc.so.6
        #2  OsAbort () at utils.c:1361
        #3  AbortServer () at log.c:877
        #4  FatalError () at log.c:1015
        #5  OsSigHandler () at osinit.c:154
        #6  <signal handler called>
        #7  xwl_glamor_pixmap_get_wl_buffer () at xwayland-glamor.c:162
        #8  xwl_screen_post_damage () at xwayland.c:514
        #9  block_handler () at xwayland.c:665
        #10 BlockHandler () at dixutils.c:388
        #11 WaitForSomething () at WaitFor.c:219
        #12 Dispatch () at dispatch.c:422
        #13 dix_main () at main.c:287
      The crash is caused by dereferencing “xwl_pixmap->buffer” in
      xwl_glamor_pixmap_get_wl_buffer() because “xwl_pixmap” is NULL.
      Reason for this is because the corresponding pixmap is from the root
      window and xwayland is rootless by default.
      This can happen if the window was mapped, redirected, damaged and
      unredirected immediately, before the damage is processed by Xwayland.
      Make sure to remove the dirty window from the damage list on unrealize
      to prevent this from happening.
      Credit goes to Adam Jackson <ajax@nwnk.net> and Daniel Stone
      <daniel@fooishbar.org> for finding the root cause the issue.
      Signed-off-by: default avatarOlivier Fourdan <ofourdan@redhat.com>
      Reviewed-by: Daniel Stone's avatarDaniel Stone <daniels@collabora.com>
    • Jason Gerecke's avatar
      xwayland: Support for BTN_STYLUS3 kernel events · 29a5423a
      Jason Gerecke authored
      BTN_STYLUS3 has been introduced by the Linux 4.15 kernel to report the
      status of the third button present on Wacom's new "Pro Pen 3D" stylus.
      Treat this button like xf86-input-wacom and send a button 8 event
      ("navigate back") when received from Wayland.
      Signed-off-by: Jason Gerecke's avatarJason Gerecke <jason.gerecke@wacom.com>
      Reviewed-by: Peter Hutterer's avatarPeter Hutterer <peter.hutterer@who-t.net>
      Signed-off-by: Peter Hutterer's avatarPeter Hutterer <peter.hutterer@who-t.net>
  4. 24 Jan, 2018 1 commit
    • Olivier Fourdan's avatar
      xwayland: Add optional xdg-output support · da8de2a7
      Olivier Fourdan authored
      The xdg-output protocol aims at describing outputs in way which is
      more in line with the concept of an output on desktop oriented systems.
      For now it just features the position and logical size which describe
      the output position and size in the global compositor space.
      This is however much useful for Xwayland to advertise the output size
      and position to X11 clients which need this to configure their surfaces
      in the global compositor space as the compositor may apply a different
      scale from what is advertised by the output scaling property (to achieve
      fractional scaling, for example).
      This was added in wayland-protocols 1.10.
      Reviewed-by: Adam Jackson's avatarAdam Jackson <ajax@redhat.com>
      Signed-off-by: default avatarOlivier Fourdan <ofourdan@redhat.com>
  5. 22 Jan, 2018 1 commit
    • Pekka Paalanen's avatar
      xwayland: reduce over-damage · f72587ec
      Pekka Paalanen authored
      If an X11 app draws a little here, some there, and a tiny bit in the
      opposite corner, using RegionExtents for the damage to be sent to the
      Wayland compositor will cause massive over-damaging.
      However, we cannot blindly send an arbitrary number of damage
      rectangles, because there is a risk of overflowing the Wayland
      connection. If that happens, it triggers an abort in libwayland-client.
      Try to be more accurate with the damage by sending up to 256 rectangles
      per window, and fall back to extents otherwise. The number is completely
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      Reviewed-by: Daniel Stone's avatarDaniel Stone <daniels@collabora.com>
  6. 19 Dec, 2017 1 commit
  7. 13 Dec, 2017 1 commit
  8. 06 Dec, 2017 2 commits
  9. 07 Nov, 2017 1 commit
  10. 13 Sep, 2017 2 commits
  11. 05 Sep, 2017 2 commits
  12. 04 Sep, 2017 1 commit
  13. 02 Aug, 2017 1 commit
  14. 01 Aug, 2017 1 commit
  15. 05 Jul, 2017 1 commit
  16. 12 Jun, 2017 2 commits
  17. 07 Jun, 2017 5 commits
  18. 03 Jun, 2017 1 commit
  19. 31 May, 2017 1 commit
    • Lyude Paul's avatar
      xwayland: Don't load extension list more than once · 4f29366f
      Lyude Paul authored
      When running an Xwayland server from the command line, we end up
      resetting the server every time all of the clients connected to the
      server leave. This would be fine, except that xwayland makes the mistake
      of unconditionally calling LoadExtensionList(). This causes us to setup
      the glxExtension twice in a row which means that when we lose our last
      client on the second server generation, we end up trying to call the glx
      destructors twice in a row resulting in a segfault:
      (EE) Backtrace:
      (EE) 0: Xwayland (OsSigHandler+0x3b) [0x4982f9]
      (EE) 1: /lib64/libpthread.so.0 (__restore_rt+0x0) [0x70845bf]
      (EE) 2: /usr/lib64/dri/swrast_dri.so (__driDriverGetExtensions_virtio_gpu+0x32897d) [0x1196e5bd]
      (EE) 3: /usr/lib64/dri/swrast_dri.so (__driDriverGetExtensions_virtio_gpu+0x328a45) [0x1196e745]
      (EE) 4: /usr/lib64/dri/swrast_dri.so (__driDriverGetExtensions_virtio_gpu+0x32665f) [0x11969f7f]
      (EE) 5: Xwayland (__glXDRIscreenDestroy+0x30) [0x54686e]
      (EE) 6: Xwayland (glxCloseScreen+0x3f) [0x5473db]
      (EE) 7: Xwayland (glxCloseScreen+0x53) [0x5473ef]
      (EE) 8: Xwayland (dix_main+0x7b6) [0x44c8c9]
      (EE) 9: Xwayland (main+0x28) [0x61c503]
      (EE) 10: /lib64/libc.so.6 (__libc_start_main+0xf1) [0x72b1401]
      (EE) 11: Xwayland (_start+0x2a) [0x4208fa]
      (EE) 12: ? (?+0x2a) [0x2a]
      (EE) Segmentation fault at address 0x18
      Fatal server error:
      (EE) Caught signal 11 (Segmentation fault). Server aborting
      Easy reproduction recipe:
      - Start an Xwayland session with the default settings
      - Open a window
      - Close that window
      - Open another window
      - Close that window
      - Total annihilation occurs
      Signed-off-by: Lyude Paul's avatarLyude <lyude@redhat.com>
      Reviewed-by: Michel Dänzer's avatarMichel Dänzer <michel.daenzer@amd.com>
      Signed-off-by: Peter Hutterer's avatarPeter Hutterer <peter.hutterer@who-t.net>
  20. 04 May, 2017 1 commit
    • Lyude Paul's avatar
      xwayland: Unconditionally initialize lists in init_tablet_manager_seat() · a06bb730
      Lyude Paul authored
      In the event that xwayland gets launched on a wayland compositor that
      doesn't yet have support for wp_tablet_manager, we end up skipping the
      initialization of the lists. This is wrong, because regardless of
      whether or not a tablet is present we still attempt to traverse these
      lists later in xwl_set_cursor(), expecting that if the lists are empty
      from no tablet manager that we simply won't execute any loop iterations.
      (EE) Backtrace:
      (EE) 0: Xwayland (OsSigHandler+0x3b) [0x4982f9]
      (EE) 1: /lib64/libpthread.so.0 (__restore_rt+0x0) [0x7f73722545bf]
      (EE) 2: Xwayland (xwl_set_cursor+0x9f) [0x429974]
      (EE) 3: Xwayland (miPointerUpdateSprite+0x261) [0x4fe1ca]
      (EE) 4: Xwayland (mieqProcessInputEvents+0x239) [0x4f8d33]
      (EE) 5: Xwayland (ProcessInputEvents+0x9) [0x4282f0]
      (EE) 6: Xwayland (Dispatch+0x42) [0x43e2d4]
      (EE) 7: Xwayland (dix_main+0x5c9) [0x44c6dc]
      (EE) 8: Xwayland (main+0x28) [0x61c523]
      (EE) 9: /lib64/libc.so.6 (__libc_start_main+0xf1) [0x7f7371e9d401]
      (EE) 10: Xwayland (_start+0x2a) [0x4208fa]
      (EE) 11: ? (?+0x2a) [0x2a]
      (EE) Segmentation fault at address 0x28
      Fatal server error:
      (EE) Caught signal 11 (Segmentation fault). Server aborting
      Reproduced when trying to run upstream xwayland under fedora 25's weston
      Signed-off-by: Lyude Paul's avatarLyude <lyude@redhat.com>
      Reviewed-by: Peter Hutterer's avatarPeter Hutterer <peter.hutterer@who-t.net>
      Signed-off-by: Peter Hutterer's avatarPeter Hutterer <peter.hutterer@who-t.net>
  21. 28 Apr, 2017 9 commits
  22. 26 Apr, 2017 1 commit
    • Eric Anholt's avatar
      Add a Meson build system alongside autotools. · 1549e303
      Eric Anholt authored
      This is a work in progress that builds Xvfb, Xephyr, Xwayland, Xnest,
      and Xdmx so far.  The outline of Xquartz/Xwin support is in tree, but
      hasn't been built yet.  The unit tests are also not done.
      The intent is to build this as a complete replacement for the
      autotools system, then eventually replace autotools.  meson is faster
      to generate the build, faster to run the bulid, shorter to write the
      build files in, and less error-prone than autotools.
      v2: Fix indentation nits, move version declaration to project(), use
          existing meson_options for version-config.h's vendor name/web.
      Signed-off-by: Eric Anholt's avatarEric Anholt <eric@anholt.net>
      Acked-by: Keith Packard's avatarKeith Packard <keithp@keithp.com>
      Reviewed-by: Peter Hutterer's avatarPeter Hutterer <peter.hutterer@who-t.net>