summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* rootless: Remove the special case for northwest gravity in StartFrameResizeJeremy Huddleston Sequoia2023-01-201-114/+2
| | | | | | | | I don't see a reason why we would want to preserve pixels that are going to not be visible anyways. The rootless implementation already handles preserving the relevant bits for us. Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
* rootless: Use RL_GRAVITY_NORTH_WEST for min/max/zoom resizingJeremy Huddleston Sequoia2023-01-201-1/+1
| | | | | | | If none of the four corners is fixed, we can use RL_GRAVITY_NORTH_WEST weighting for the operation to let the implementation presetve the window bits for us. Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
* rootless: Ensure gResizeDeathPix is stored in locally-managed memory rather ↵Jeremy Huddleston Sequoia2023-01-201-15/+5
| | | | | | | | | | | | than re-using the implementation's backing store The implementation owns the pointer during RootlessStopDrawing and RootlessStartDrawing and is free to (does) change it. Rootless cannot assume ownership of this memory region. This is possibly the cause of some hard to diagnose crashes in XQuartz over the years. Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
* rootless: Remove option to disable ROOTLESS_RESIZE_GRAVITYJeremy Huddleston Sequoia2023-01-204-18/+1
| | | | Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
* rootless: Fixup some format errors in debug loggingJeremy Huddleston Sequoia2023-01-203-10/+11
| | | | Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
* glamor: Don't initialize on softpipeIvan A. Melnikov2023-01-192-0/+9
| | | | | | | | | | | | | There are systems where softpipe is the default renderer, e.g. when llvmpipe is not is not available. Using glamor on such systems is never a good idea. This mirrors what commit 0a9415cf793babed1f28c61f8047d51de04f1528 did for llvmpipe. Closes: #1417 Signed-off-by: Ivan A. Melnikov <iv@altlinux.org>
* ci: Export LP_NUM_THREADS=0 for meson testMichel Dänzer2023-01-191-1/+1
| | | | | | | This prevents the Mesa llvmpipe driver from spawning (potentially lots of) worker threads. Suggested by Daniel Stone on IRC.
* ci: Move dist testing to a separate jobMichel Dänzer2023-01-193-2/+24
| | | | | | | | | | Multiple reasons, in particular: * Doing it in every build & test job duplicates effort, resulting in the pipeline taking longer than necessary. * We cannot limit the number of test processes spawned by meson dist. * There's little point running tests for dist anyway, we just want to make sure we can build & install from the generated tarball.
* ci: Use "meson test" instead of "ninja test"Michel Dänzer2023-01-191-1/+2
| | | | | | | | This lets us actually limit the number of test processes spawned in parallel. (ninja test runs meson test without --num-processes, so it ends up spawning as many processes in parallel as there are CPU cores)
* xwayland: hook up wl_pointer.axis_v120 eventsPeter Hutterer2023-01-185-22/+57
| | | | | | | | | | | | | | | | | For details on the protocol itself see the Wayland merge request: https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/72 The v120 event has a value base of 120, so one wheel detent is 120, half a wheel is 60, etc. This is the API Windows has been using since Vista but it requires HW support from the device. Logitech mice and many Microsoft mice of the last decade or so have support and it's enabled in the kernel since v5.0. The new events replace wl_pointer.axis_discrete events, once you bind to wl_pointer >= 8 you only get the v120 events. So backwards compatibility is simple, we just multiply the discrete events if we get them and treat everything as 120 event internally. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* xwayland: use a define for the horiz/vert scroll valuatorsPeter Hutterer2023-01-181-10/+13
| | | | | | Slightly more readable and less prone to copy/paste errors. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Revert "meson: Don't build COMPOSITE for XQuartz"Jeremy Huddleston Sequoia2023-01-172-12/+3
| | | | | | | This will allow us to remove build-time conditionalization on COMPOSITE while still allowing XQuartz to disable it and use ROOTLESS. This reverts commit 9c0373366988cc0b909ba31e61c43cc46e054b40.
* xquartz: Disable COMPOSITE at runtimeJeremy Huddleston Sequoia2023-01-171-0/+9
| | | | Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
* xquartz: Update the about box copyright to 2023Jeremy Huddleston Sequoia2023-01-171-2/+2
| | | | Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
* xwayland: Don't expose XRandR emulated modes for leaseable displaysJoshua Ashton2023-01-121-2/+2
| | | | | | | | | | | | | | | | | | | | | | Leasable displays do not have any actual associated Wayland output and are not available to regular X11 clients and left entirely to the application who requests the lease. As these are not actually managed by the Wayland compositor and left entirely to the "lessee" application, the viewporter protocol required for the XRandR emulation is not usable on such devices. We should therefore not advertise the XRandR emulated modes for those leasable displays. This also solves a problem with implementations of glXGetMscRateOML() which is used notably by Chromium/Electron. Applications using this which will begin lagging/stuttering exponentially over time, trying to look up a non-existent mode with 0x0 as returned by XF86VidModeGetModeLine() with XRandR emulation for such devices. See-also: https://github.com/labwc/labwc/issues/553 Signed-off-by: Joshua Ashton <joshua@froggi.es>
* config: add a quirk for Apple Silicon appledrmEric Curtin2023-01-111-0/+10
| | | | | | | | Xorg server does not correctly select the DCP for the display without a quirk on Apple Silicon. Signed-off-by: Eric Curtin <ecurtin@redhat.com> Suggested-by: Hector Martin <marcan@marcan.st>
* x86/logind fix suspend/resume when there are no input devicesJocelyn Falempe2023-01-091-1/+5
| | | | | | | | | | | Make sure info->active and info->vt_active are false after dropping drm master. Normally, this is done when pausing the first input device, so it breaks when there are no input device at all. Fixes: da9d012a9 ("xf86/logind: Fix drm_drop_master before vt_reldisp") Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1387 Signed-off-by: Jocelyn Falempe <jfalempe@redhat.com>
* Disallow byte-swapped clients by defaultPeter Hutterer2023-01-067-1/+31
| | | | | | | | | | | | | | | | | The X server swapping code is a huge attack surface, much of this code is untested and prone to security issues. The use-case of byte-swapped clients is very niche, so let's disable this by default and allow it only when the respective config option or commandline flag is given. For Xorg, this adds the ServerFlag "AllowByteSwappedClients" "on". For all DDX, this adds the commandline options +byteswappedclients and -byteswappedclients to enable or disable, respectively. Fixes #1201 https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1029 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* dix: localize two variablesPeter Hutterer2023-01-061-4/+4
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* dix: remove unused PANORAMIX_DEBUG ifdefPeter Hutterer2023-01-061-5/+0
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Fix some indentation issuesPeter Hutterer2023-01-061-11/+11
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* xfree86: Fix videodrv ABI versionOlivier Fourdan2023-01-041-1/+1
| | | | | | | | | | Commit 5145742fb6 accidentally bumped the videodrv ABI version from 26.0 to 26.6 in one go. Change it back to 26.1 as per the documented process for minor additions. Fixes: 5145742fb6 - randr: introduce rrCrtcGetInfo DDX function Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
* xwayland/output: properly return the current emulated mode when queriedMinh Phan2023-01-032-0/+17
| | | | | | | | This fixes an issue with GLFW-based games failing to set the resolution when the user request to switch back to the native display mode. Signed-off-by: Minh Phan <phanquangminh217@gmail.com> Acked-by: Olivier Fourdan <ofourdan@redhat.com>
* randr: introduce rrCrtcGetInfo DDX functionMinh Phan2023-01-033-1/+12
| | | | | | | | | This allows rrCrtcGetInfo to override the values in the XRRCrtcGetInfo reply. One use case is to allow Xwayland to return the current emulated mode for the specific client instead of the global mode. Signed-off-by: Minh Phan <phanquangminh217@gmail.com> Acked-by: Olivier Fourdan <ofourdan@redhat.com>
* dix: Remove pScratchPixmap and other associated ABI changesJeremy Huddleston Sequoia2022-12-306-21/+8
| | | | Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
* dix: Stop recycling scratch pixmapsJeremy Huddleston Sequoia2022-12-302-19/+12
| | | | | | | | The minimal performance wins we gain by recycling pixmaps at this layer are not worth the code complexity nor the interference with memory analysis tools like malloc history, ASan, etc. Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
* os/connection: don't leave `port` uninitializedJulian Orth2022-12-291-1/+1
| | | | | | | If DISPLAY is set but does not start with `/`, `port` is now initialized. Fixes 83d0d911069d502232d719882cd1c5cd090defa1
* xwayland: Implement xwayland_shell_v1Joshua Ashton2022-12-216-13/+98
| | | | | | | | | | | | | | | | Implements the xwayland_shell protocol which makes the surface association happen via a shared serial, rather than sharing a wl_surface resource ID across an X atom. This solves a race that can happen if the wl_surface associated with a WL_SURFACE_ID for a window was destroyed before the update of the atom was processed by the compositor and another surface (or other object) had taken its id due to recycling. Closes: #1157 Signed-off-by: Joshua Ashton <joshua@froggi.es> Reviewed-by: Olivier Fourdan <ofourdan@redhat.com>
* ci: Bump to wayland-protocols 1.28 for xwayland_shellJoshua Ashton2022-12-212-5/+5
| | | | | | | Debian Bullseye only has 1.20, so we need to bump this. Signed-off-by: Joshua Ashton <joshua@froggi.es> Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
* ci: Bump to wayland 1.21.0Joshua Ashton2022-12-211-0/+8
| | | | | | | wayland-protocols requires wayland-scanner 1.20, but Debian bullseye has 1.18 only Signed-off-by: Joshua Ashton <joshua@froggi.es> Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
* rootless: Add additional debug logging to help triage XQuartz ↵Jeremy Huddleston Sequoia2022-12-211-3/+41
| | | | | | fb/rootless/damage crashes Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
* xquartz: Use xorg_backtrace() instead of rolling our own for debuggingJeremy Huddleston Sequoia2022-12-211-20/+6
| | | | Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
* xquartz: Ignore SIGPIPE at process launchJeremy Huddleston Sequoia2022-12-211-0/+3
| | | | Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
* modesetting: Log whether atomic modesetting is enabledOlivier Fourdan2022-12-201-0/+4
| | | | | | | | If atomic modesetting is to be enabled in the configuration file, log whether this is supported and eventually enabled or disabled. Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Reviewed-by: Martin Roukala <martin.roukala@mupuf.org>
* modesetting: Document the "Atomic" optionOlivier Fourdan2022-12-201-0/+4
| | | | | | | | | | The modesetting driver has atomic modesetting disabled by default but can be enabled (if supported) using a configuration option. Add this option in the man page. Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Reviewed-by: Martin Roukala <martin.roukala@mupuf.org>
* modesetting: add support for TearFree page flipsSultan Alsawaf2022-12-197-16/+360
| | | | | | | | | | | | | | | | This adds support for TearFree page flips to eliminate tearing without the use of a compositor. It allocates two shadow buffers for each CRTC, a back buffer and a front buffer, and uses damage tracking to minimize excessive copying between buffers and skip unnecessary flips when the screen's contents remain unchanged. It works on transformed screens too, such as rotated and scaled CRTCs. When PageFlip is enabled, TearFree won't force fullscreen DRI clients to synchronize their page flips to the vblank interval. TearFree is disabled by default. Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
* modesetting: coalesce vblank events to avoid DRM event queue exhaustionSultan Alsawaf2022-12-194-8/+121
| | | | | | | | | | | | | | | | | | | | | | | | | The DRM event queue in the kernel is quite small and can be easily exhausted by DRI clients. When the event queue is full, that means nothing can be queued onto it anymore, which can lead to incorrect presentation times for DRI clients and failure when attempting to queue a page flip. To make matters worse, once an event is placed onto the kernel's event queue, there's no straightforward way to prematurely remove it from the kernel's event queue in userspace, which means that aborting a sequence number doesn't free up space in the event queue. Since vblank events from DRI clients are the largest consumers of the event queue, and since it's often easy to know the desired target MSC of their vblank events without querying the kernel for a CRTC's current MSC, we can coalesce vblank events occurring at the same MSC such that only one of them is placed onto the kernel's event queue, instead of allowing duplicate vblank events to pollute the event queue. This is achieved by tracking the next kernel-queued event's MSC on a per-CRTC basis and then running all of that CRTC's vblank event handlers which have reached their target MSC when the queued MSC is signaled. Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
* present: add awareness for drivers with TearFreeSultan Alsawaf2022-12-192-15/+71
| | | | | | | | | | | | | | | | | | | | | | | When a driver uses TearFree to flip all frames synchronized to the vblank interval, Present has no idea and still assumes that each presentation occurs immediately upon copying its damages to the primary scanout. This faulty assumption breaks presentation timestamping, potentially leading to A/V de-synchronization and dropped frames. Present needs to have some awareness of a driver using TearFree so that it can know when each presentation actually becomes visible on the screen. Teach Present about drivers using TearFree by expanding PresentFlipReason to allow drivers to export some contextual info about TearFree when Present cannot page-flip directly anyway. PRESENT_FLIP_REASON_DRIVER_TEARFREE indicates that a driver has TearFree enabled but doesn't have a TearFree flip currently pending. PRESENT_FLIP_REASON_DRIVER_TEARFREE_FLIPPING indicates that a driver has a TearFree flip currently pending. Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
* modesetting: make do_queue_flip_on_crtc genericSultan Alsawaf2022-12-193-21/+25
| | | | | | | | | | do_queue_flip_on_crtc() is about to be used to flip buffers other than the primary scanout (`ms->drmmode.fb_id`), so make it generic to accept any frame buffer ID, as well as x and y coordinates in the frame buffer, to flip on a given CRTC. Move the retry logic from queue_flip_on_crtc() into it as well, so that it's robust for all callers. Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
* modesetting: make the shadow buffer helpers genericSultan Alsawaf2022-12-191-34/+64
| | | | | | | | Shadow buffers are about to be used for TearFree, so make the shadow buffer helpers generic such that they can be used to create arbitrary per-CRTC shadows aside from just the per-CRTC rotated buffer. Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
* xfree86: make xf86RotateCrtcRedisplay publicSultan Alsawaf2022-12-193-10/+19
| | | | | | | | | | | | | | | | xf86RotateCrtcRedisplay() is about to be used outside of xf86Rotate.c in order to copy transformed pixmaps, so fix up its interface by specifying the source drawable and destination pixmap rather than assuming the root drawable and rotated pixmap, respectively. In addition, add an argument to make xf86RotateCrtcRedisplay() not perform any transformations, which is an indicator that it should only copy a transformed pixmap rather than actually transform a pixmap. These changes make it possible to use xf86RotateCrtcRedisplay() to not only copy transformed pixmaps, but also actually transform pixmaps, making it very useful outside of xf86Rotate.c. Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
* pixmap: make PixmapDirtyCopyArea publicSultan Alsawaf2022-12-192-8/+12
| | | | | | | | | | PixmapDirtyCopyArea() is about to be used outside of pixmap.c, so fix up its interface by specifying the dirty area directly rather than passing a `PixmapDirtyUpdatePtr`. This makes it easier to use outside of pixmap.c, as the caller doesn't need to create a bulky PixmapDirtyUpdateRec to use this function. Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
* Xext: fix invalid event type mask in XTestSwapFakeInputPeter Hutterer2022-12-191-1/+1
| | | | | | | | | | | | In commit b320ca0 the mask was inadvertently changed from octal 0177 to hexadecimal 0x177. Fixes commit b320ca0ffe4c0c872eeb3a93d9bde21f765c7c63 Xtest: disallow GenericEvents in XTestSwapFakeInput Found by Stuart Cassoff Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* xquartz: Fix some formattingJeremy Huddleston Sequoia2022-12-141-39/+23
| | | | Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
* XQuartz: stub: Call LSOpenApplication instead of fork()/exec()John D Pell2022-12-141-33/+20
| | | | Reviewed-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
* xkb: reset the radio_groups pointer to NULL after freeing itPeter Hutterer2022-12-141-0/+1
| | | | | | | | | | | | | | Unlike other elements of the keymap, this pointer was freed but not reset. On a subsequent XkbGetKbdByName request, the server may access already freed memory. CVE-2022-4283, ZDI-CAN-19530 This vulnerability was discovered by: Jan-Niklas Sohn working with Trend Micro Zero Day Initiative Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Acked-by: Olivier Fourdan <ofourdan@redhat.com>
* Xi: avoid integer truncation in length check of ProcXIChangePropertyPeter Hutterer2022-12-142-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | This fixes an OOB read and the resulting information disclosure. Length calculation for the request was clipped to a 32-bit integer. With the correct stuff->num_items value the expected request size was truncated, passing the REQUEST_FIXED_SIZE check. The server then proceeded with reading at least stuff->num_items bytes (depending on stuff->format) from the request and stuffing whatever it finds into the property. In the process it would also allocate at least stuff->num_items bytes, i.e. 4GB. The same bug exists in ProcChangeProperty and ProcXChangeDeviceProperty, so let's fix that too. CVE-2022-46344, ZDI-CAN 19405 This vulnerability was discovered by: Jan-Niklas Sohn working with Trend Micro Zero Day Initiative Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Acked-by: Olivier Fourdan <ofourdan@redhat.com>
* Xi: return an error from XI property changes if verification failedPeter Hutterer2022-12-141-0/+5
| | | | | | | | Both ProcXChangeDeviceProperty and ProcXIChangeProperty checked the property for validity but didn't actually return the potential error. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Acked-by: Olivier Fourdan <ofourdan@redhat.com>
* Xext: free the screen saver resource when replacing itPeter Hutterer2022-12-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | This fixes a use-after-free bug: When a client first calls ScreenSaverSetAttributes(), a struct ScreenSaverAttrRec is allocated and added to the client's resources. When the same client calls ScreenSaverSetAttributes() again, a new struct ScreenSaverAttrRec is allocated, replacing the old struct. The old struct was freed but not removed from the clients resources. Later, when the client is destroyed the resource system invokes ScreenSaverFreeAttr and attempts to clean up the already freed struct. Fix this by letting the resource system free the old attrs instead. CVE-2022-46343, ZDI-CAN 19404 This vulnerability was discovered by: Jan-Niklas Sohn working with Trend Micro Zero Day Initiative Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Acked-by: Olivier Fourdan <ofourdan@redhat.com>
* Xext: free the XvRTVideoNotify when turning off from the same clientPeter Hutterer2022-12-141-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes a use-after-free bug: When a client first calls XvdiSelectVideoNotify() on a drawable with a TRUE onoff argument, a struct XvVideoNotifyRec is allocated. This struct is added twice to the resources: - as the drawable's XvRTVideoNotifyList. This happens only once per drawable, subsequent calls append to this list. - as the client's XvRTVideoNotify. This happens for every client. The struct keeps the ClientPtr around once it has been added for a client. The idea, presumably, is that if the client disconnects we can remove all structs from the drawable's list that match the client (by resetting the ClientPtr to NULL), but if the drawable is destroyed we can remove and free the whole list. However, if the same client then calls XvdiSelectVideoNotify() on the same drawable with a FALSE onoff argument, only the ClientPtr on the existing struct was set to NULL. The struct itself remained in the client's resources. If the drawable is now destroyed, the resource system invokes XvdiDestroyVideoNotifyList which frees the whole list for this drawable - including our struct. This function however does not free the resource for the client since our ClientPtr is NULL. Later, when the client is destroyed and the resource system invokes XvdiDestroyVideoNotify, we unconditionally set the ClientPtr to NULL. On a struct that has been freed previously. This is generally frowned upon. Fix this by calling FreeResource() on the second call instead of merely setting the ClientPtr to NULL. This removes the struct from the client resources (but not from the list), ensuring that it won't be accessed again when the client quits. Note that the assignment tpn->client = NULL; is superfluous since the XvdiDestroyVideoNotify function will do this anyway. But it's left for clarity and to match a similar invocation in XvdiSelectPortNotify. CVE-2022-46342, ZDI-CAN 19400 This vulnerability was discovered by: Jan-Niklas Sohn working with Trend Micro Zero Day Initiative Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Acked-by: Olivier Fourdan <ofourdan@redhat.com>