1. 10 Jul, 2019 1 commit
  2. 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)
      c86222d4
  3. 05 Jun, 2019 3 commits
    • Olivier Fourdan's avatar
      glamor: Make pixmap exportable from `gbm_bo_from_pixmap()` · 6e199e46
      Olivier Fourdan authored
      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: 's avatarOlivier Fourdan <ofourdan@redhat.com>
      Signed-off-by: Yuxuan Shui yshui@hadean.com
      See-also: !131
      Closes: #68
      Fixes: 86b2d874 "glamor: Reallocate pixmap storage without modifiers
             if necessary"
      (cherry picked from commit 26fe29f4)
      6e199e46
    • Olivier Fourdan's avatar
      xwayland: Check status in GBM pixmap creation · 34ad57e5
      Olivier Fourdan authored
      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: 's avatarOlivier Fourdan <ofourdan@redhat.com>
      Closes: #661
      (cherry picked from commit fc6380a1)
      34ad57e5
    • Olivier Fourdan's avatar
      xwayland: Avoid a crash on pointer enter with a grab · 6711b5c6
      Olivier Fourdan authored
      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: 's avatarOlivier Fourdan <ofourdan@redhat.com>
      Bugzilla: https://bugzilla.redhat.com/1708119
      (cherry picked from commit 0a074463)
      6711b5c6
  4. 30 May, 2019 1 commit
  5. 28 May, 2019 1 commit
    • Peter Hutterer's avatar
      dix: leave last.valuators alone on slave switch · 24086852
      Peter Hutterer authored
      Terms:
      dev->last.valuator[] is the last value given to us by the driver
      dev->valuator.axisVal[] is the last value sent to the client
      dev->last.scroll[] is the abs value of the scroll axis as given by the driver,
              used for button emulation calculation (and the remainder)
      
      This function updates the device's last.valuator state based on the current
      master axis state. This way, relative motion continues fluidly when switching
      between devices. Before mouse 2 comes into effect, it's valuator state is
      updated to wherever the pointer currently is so the relative event applies on
      top of that.
      
      This can only work for x/y axes, all other axes aren't guaranteed to have the
      same meaning and/or may not be present:
      - xtest device: no valuator 2
      - mouse: valuator 2 is horizontal scroll axis
      - tablet: valuator 2 is pressure
      
      Scaling the current value from the pressure range into the range for
      horizontal scrolling makes no sense. And it causes scroll jumps:
      
      - scroll down, last.valuator == axisVal == 20
      - xdotool click 1, the XTest device doesn't have that valuator
      - scroll up
        - updateSlaveDeviceCoords reset last.valuator to 0 (axisVal == 20)
        - DeviceClassesChangedEvent includes value 20 for the axis
        - event is processed, last.value changes from 0 to -1
        - axisVal is updated to -1, causing a jump of -21
      
      The same applies when we switch from tablet to mouse wheel if the pressure
      value is 0 on proximity out (basically guaranteed). So let's drop this code
      altogether and only leave the scaling for the relative x/y motion.
      Signed-off-by: Peter Hutterer's avatarPeter Hutterer <peter.hutterer@who-t.net>
      (cherry picked from commit d7b1753d)
      24086852
  6. 20 May, 2019 1 commit
    • Olivier Fourdan's avatar
      glamor: pixmap FBO may not be allocated · 5bc29a67
      Olivier Fourdan authored
      If `_glamor_create_tex()` fails to allocate the FBO because of
      GL_OUT_OF_MEMORY error, the `pixmap_priv->fbo` is NULL.
      
      However, `glamor_get_pixmap_texture()` doesn't actually check whether
      the `pixmap_priv->fbo` is NULL and will segfault with a NULL pointer
      dereference trying to access the `pixmap_priv->fbo->tex`.
      Signed-off-by: 's avatarOlivier Fourdan <ofourdan@redhat.com>
      Closes: #647
      (Cherry picked from commit 74479a99)
      5bc29a67
  7. 05 Apr, 2019 2 commits
  8. 25 Mar, 2019 3 commits
  9. 21 Mar, 2019 1 commit
    • Ray Strode's avatar
      dix: ensure work queues are cleared on reset · 34553f50
      Ray Strode authored
      If the server resets, most client workqueues are cleaned up as the
      clients are killed.
      
      The one exception is the server's client, which is exempt from
      the killing spree.
      
      If that client has a queued work procedure active, it won't get
      cleared on reset.
      
      This commit ensures it gets cleared too.
      
      (cherry picked from commit 8738ce85)
      
      Fixes: #670
      34553f50
  10. 25 Feb, 2019 3 commits
  11. 22 Feb, 2019 13 commits
  12. 20 Feb, 2019 10 commits