1. 20 Jul, 2020 1 commit
    • Link Mauve's avatar
      xwayland: Use memfd_create() when available · a137dd5f
      Link Mauve authored
      This (so-far) Linux-only API lets users create file descriptors purely
      in memory, without any backing file on the filesystem and the race
      condition which could ensue when unlink()ing it.
      
      It also allows seals to be placed on the file, ensuring to every other
      process that we won’t be allowed to shrink the contents, potentially
      causing a SIGBUS when they try reading it.
      
      This patch is best viewed with the -w option of git log -p.
      
      This is a port of this commit from Weston:
      wayland/weston@deae98ef
      
      
      
      Fixes #848.
      Signed-off-by: Link Mauve's avatarEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>
      a137dd5f
  2. 16 Jul, 2020 1 commit
    • Lyude Paul's avatar
      xwayland: Store xwl_tablet_pad in its own private key · ba0e789b
      Lyude Paul authored
      
      
      When a slave device causes the master virtual pointer device to change
      device types, the device's private data pointer
      (device->public.devicePrivate) is also changed to match the type of the
      slave device. This can be a problem though, as tablet pad devices will
      set the device's private data pointer to their own xwl_tablet_pad
      struct. This can cause us to dereference the pointer as the wrong type,
      and result in a segfault:
      
      Thread 1 "Xwayland" received signal SIGSEGV, Segmentation fault.
      wl_proxy_marshal (proxy=0x51, opcode=opcode@entry=0) at src/wayland-client.c:792
      792             va_start(ap, opcode);
      (gdb) bt
      0  wl_proxy_marshal (proxy=0x51, opcode=opcode@entry=0) at
        src/wayland-client.c:792
      1  0x00005610b27b6c55 in wl_pointer_set_cursor (hotspot_y=0,
        hotspot_x=0, surface=0x0, serial=<optimized out>, wl_pointer=<optimized
        out>) at /usr/include/wayland-client-protocol.h:4610
      2  xwl_seat_set_cursor (xwl_seat=xwl_seat@entry=0x5610b46d5d10) at
        xwayland-cursor.c:137
      3  0x00005610b27b6ecd in xwl_set_cursor (device=<optimized out>,
        screen=<optimized out>, cursor=<optimized out>, x=<optimized out>,
        y=<optimized out>) at xwayland-cursor.c:249
      4  0x00005610b2800b46 in miPointerUpdateSprite (pDev=0x5610b4501a30) at
        mipointer.c:468
      5  miPointerUpdateSprite (pDev=0x5610b4501a30) at mipointer.c:410
      6  0x00005610b2800e56 in miPointerDisplayCursor (pCursor=0x5610b4b35740,
        pScreen=0x5610b3d54410, pDev=0x5610b4501a30) at mipointer.c:206
      7  miPointerDisplayCursor (pDev=0x5610b4501a30, pScreen=0x5610b3d54410,
        pCursor=0x5610b4b35740) at mipointer.c:194
      8  0x00005610b27ed62b in CursorDisplayCursor (pDev=<optimized out>,
        pScreen=0x5610b3d54410, pCursor=0x5610b4b35740) at cursor.c:168
      9  0x00005610b28773ee in AnimCurDisplayCursor (pDev=0x5610b4501a30,
        pScreen=0x5610b3d54410, pCursor=0x5610b4b35740) at animcur.c:197
      10 0x00005610b28eb4ca in ChangeToCursor (pDev=0x5610b4501a30,
        cursor=0x5610b4b35740) at events.c:938
      11 0x00005610b28ec99f in WindowHasNewCursor
        (pWin=pWin@entry=0x5610b4b2e0c0) at events.c:3362
      12 0x00005610b291102d in ChangeWindowAttributes (pWin=0x5610b4b2e0c0,
        vmask=<optimized out>, vlist=vlist@entry=0x5610b4c41dcc,
        client=client@entry=0x5610b4b2c900) at window.c:1561
      13 0x00005610b28db8e3 in ProcChangeWindowAttributes (client=0x5610b4b2c900)
        at dispatch.c:746
      14 0x00005610b28e1e5b in Dispatch () at dispatch.c:497
      15 0x00005610b28e5f34 in dix_main (argc=16, argv=0x7ffc7a601b68,
        envp=<optimized out>) at main.c:276
      16 0x00007f8828cde042 in __libc_start_main (main=0x5610b27ae930 <main>,
        argc=16, argv=0x7ffc7a601b68, init=<optimized out>, fini=<optimized
        out>, rtld_fini=<optimized out>, stack_end=0x7ffc7a601b58) at
        ../csu/libc-start.c:308
      17 0x00005610b27ae96e in _start () at cursor.c:1064
      
      Simple reproducer in gnome-shell: open up an Xwayland window, press some
      tablet buttons, lock and unlock the screen. Repeat if it doesn't crash
      the first time.
      
      So, let's fix this by registering our own device-specific private key
      for storing a backpointer to xwl_tablet_pad, so that all input devices
      have their private data pointers set to their respective xwl_seat.
      Reviewed-by: Peter Hutterer's avatarPeter Hutterer <peter.hutterer@who-t.net>
      Signed-off-by: Lyude Paul's avatarLyude Paul <lyude@redhat.com>
      ba0e789b
  3. 14 Jul, 2020 1 commit
  4. 12 Jul, 2020 1 commit
  5. 09 Jul, 2020 2 commits
  6. 08 Jul, 2020 1 commit
    • Olivier Fourdan's avatar
      xwayland: Add a pkg-config file for Xwayland · 5188603f
      Olivier Fourdan authored
      
      
      Xwayland is usually spawned by the Wayland compositor which sets the
      command line options.
      
      If a command line option is not supported, Xwayland will fail to start.
      
      That somehow makes the Xwayland command line option sort of ABI, the
      Wayland compositor need to know if a particular option is supported by
      Xwayland at build time.
      
      Also, currently, Xwayland is being installed along with the rest of the
      common executable programs that users may run, which is sub-optimal
      because, well, Xwayland is not a common executable program, it's meant
      to be a proxy between the Wayland compositor and the legacy X11 clients
      which wouldn't be able to run on Wayland otherwise.
      
      Xwayland would be better installed in `libexec` but that directory is
      (purposedly) not in the user `PATH` and therefore the Wayland compositor
      may not be able to find Xwayland in that case.
      
      To solve both problems (which options are supported by Xwayland and
      where to look for it), add a `pkg-config` file specifically for Xwayland
      which gives the full path to Xwayland (`xwayland`) and which options it
      supports (using `pkg-config` variables).
      
      The `pkg-config` file also provides the `Version` so the build scripts
      can check for a particular version if necessary.
      
      Obviously, Wayland compositors are not required to use the `pkg-config`
      file and can continue to use whatever mechanism they deem preferable.
      Signed-off-by: default avatarOlivier Fourdan <ofourdan@redhat.com>
      Reviewed-by: Michel Dänzer's avatarMichel Dänzer <mdaenzer@redhat.com>
      5188603f
  7. 07 Jul, 2020 4 commits
  8. 05 Jul, 2020 2 commits
  9. 03 Jul, 2020 2 commits
    • Olivier Fourdan's avatar
      xwayland: Use a fixed DPI value for core protocol · b0413b6e
      Olivier Fourdan authored
      
      
      The way Xwayland works (like all Wayland clients), it first queries the
      Wayland registry, set up all relevant protocols and then initializes its
      own structures.
      
      That means Xwayland will get the Wayland outputs from the Wayland
      compositor, compute the physical size of the combined outputs and set
      the corresponding Xwayland screen properties accordingly.
      
      Then it creates the X11 screen using fbScreenInit() but does so by using
      a default DPI value of 96. That value is used to set the physical size
      of the X11 screen, hence overriding the value computed from the actual
      physical size provided by the Wayland compositor.
      
      As a result, the DPI computed by tools such as xdpyinfo will always be
      96 regardless of the actual screen size and resolution.
      
      However, if the Wayland outputs get reconfigured, or new outputs added,
      or existing outputs removed, Xwayland will recompute and update the
      physical size of the screen, leading to an unexpected change of DPI.
      
      To avoid that discrepancy, use a fixed size DPI (defaults to 96, and can
      be set using the standard command lime option "-dpi") and compute a
      physical screen size to match that DPI setting.
      
      Note that only affects legacy core protocols, X11 clients can still get
      the actual physical output size as reported by the Wayland compositor
      using the RandR protocol, which also allows for the size to be 0 if the
      size is unknown or meaningless.
      Signed-off-by: default avatarOlivier Fourdan <ofourdan@redhat.com>
      Reviewed-by: Simon Ser's avatarSimon Ser <contact@emersion.fr>
      Closes: xorg/xserver#731
      b0413b6e
    • SimonPilkington's avatar
      xwayland: Initialise values in xwlVidModeGetGamma() · 6748a409
      SimonPilkington authored
      ProcVidModeGetGamma() relies on GetGamma() to initialise values if it
      returns TRUE. Without this, we're sending uninitialised values to
      clients.
      
      Fixes: xorg/xserver#1040
      6748a409
  10. 02 Jul, 2020 1 commit
  11. 27 Jun, 2020 1 commit
  12. 25 Jun, 2020 4 commits
  13. 24 Jun, 2020 1 commit
    • Martin Weber's avatar
      hw/xfree86: Avoid cursor use after free · 7ae221ad
      Martin Weber authored
      
      
      During a VT-Switch a raw pointer to the shared cursor object
      is saved which is then freed (in case of low refcount) by a call to
      xf86CursorSetCursor with argument pCurs = NullCursor.
      This leads to a dangling pointer which can follow in a use after free.
      
      This fix ensures that there is a shared handle saved for the VT-Switch cycle.
      Reviewed-by: Michel Dänzer's avatarMichel Dänzer <mdaenzer@redhat.com>
      7ae221ad
  14. 23 Jun, 2020 1 commit
  15. 19 Jun, 2020 3 commits
  16. 05 Jun, 2020 1 commit
    • Adam Jackson's avatar
      xwayland: Set the vendor name for GLX_EXT_libglvnd · fc4f2485
      Adam Jackson authored
      Without this the client library will flail around looking for a default
      provider, probably one named "indirect", and that defeats the point of
      having the EGL provider for direct context support in the first place.
      
      This assumes that "mesa" will work, of course, and in general it should.
      Mesa drivers will DTRT through the DRI3 setup path, and if our glamor is
      atop something non-Mesa then you should fall back to llvmpipe like 1.20.
      In the future it might be useful to differentiate the vendor here based
      on whether glamor is using gbm or streams.
      
      Fixes: xorg/xserver#1032
      fc4f2485
  17. 03 Jun, 2020 1 commit
  18. 27 May, 2020 3 commits
    • Jan Beich's avatar
      meson: split udev from udev_kms which requires systemd · b5b52979
      Jan Beich authored
      DragonFly and FreeBSD can use xf86-input-libinput with config/udev.
      
      ld: error: undefined symbol: xf86PlatformDeviceProbe
      >>> referenced by xf86platformBus.c
      >>>               xf86platformBus.c.o:(xf86platformProbe) in archive hw/xfree86/common/libxorg_common.a
      
      ld: error: undefined symbol: xf86PlatformDeviceCheckBusID
      >>> referenced by xf86platformBus.c
      >>>               xf86platformBus.c.o:(xf86platformProbeDev) in archive hw/xfree86/common/libxorg_common.a
      
      ld: error: undefined symbol: xf86PlatformReprobeDevice
      >>> referenced by xf86platformBus.c
      >>>               xf86platformBus.c.o:(xf86platformVTProbe) in archive hw/xfree86/common/libxorg_common.a
      
      ld: error: undefined symbol: NewGPUDeviceRequest
      >>> referenced by udev.c
      >>>               udev.c.o:(device_added) in archive config/liblibxserver_config.a
      
      ld: error: undefined symbol: DeleteGPUDeviceRequest
      >>> referenced by udev.c
      >>>               udev.c.o:(device_removed) in archive config/liblibxserver_config.a
      b5b52979
    • Jan Beich's avatar
      glx: unbreak on Unix without /usr/include/drm · be731e0b
      Jan Beich authored
      In file included from ../glx/glxdri2.c:35:
      /usr/local/include/GL/internal/dri_interface.h:43:10: fatal error: 'drm.h' file not found
       #include <drm.h>
                ^~~~~~~
      In file included from ../glx/glxdriswrast.c:39:
      /usr/local/include/GL/internal/dri_interface.h:43:10: fatal error: 'drm.h' file not found
       #include <drm.h>
                ^~~~~~~
      be731e0b
    • Jan Beich's avatar
      os: unbreak xsha1 on FreeBSD · f2cf236d
      Jan Beich authored
      ../os/xsha1.c:36:10: fatal error: 'sha1.h' file not found
       #include <sha1.h>
                ^~~~~~~~
      ../os/xsha1.c:45:5: error: implicit declaration of function 'SHA1Init' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
          SHA1Init(ctx);
          ^
      ../os/xsha1.c:54:5: error: implicit declaration of function 'SHA1Update' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
          SHA1Update(sha1_ctx, data, size);
          ^
      ../os/xsha1.c:63:5: error: implicit declaration of function 'SHA1Final' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
          SHA1Final(result, sha1_ctx);
          ^
      f2cf236d
  19. 20 May, 2020 2 commits
  20. 18 May, 2020 1 commit
  21. 13 May, 2020 1 commit
    • Carlos Garnacho's avatar
      xwayland: Improve checks for confined_to on InputOnly windows · 0777cf46
      Carlos Garnacho authored
      
      
      In this pretty Wine/Proton specific kludge, we try to handle confining grabs
      on InputOnly windows by trying to find the InputOutput window that the pointer
      would get visually confined to.
      
      The grabbing window and the visible window come from different clients, so
      we used to simply resort to the pointer focus. This is troublesome though, as
      the call may happen very soon at a time that the toplevel wasn't yet mapped by
      the Wayland compositor, so the pointer focus may well be out of date soon.
      
      In these situations, it does seem that even though the confining grab happens
      too early to have the wayland surface mapped, the xserver view of the WindowPtr
      does already reflect the size. Use this to find out the better window to
      assign the confining grab to, one whose geometry fully contains the InputOnly
      window's.
      Signed-off-by: Carlos Garnacho's avatarCarlos Garnacho <carlosg@gnome.org>
      Reviewed-by: default avatarOlivier Fourdan <ofourdan@redhat.com>
      0777cf46
  22. 12 May, 2020 4 commits
  23. 11 May, 2020 1 commit