summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* modesetting: Introduce ms_tearfree_is_active_on_crtc helperSultan Alsawaf2023-02-284-4/+13
| | | | | | | | | | There is more than one place with the confusing TearFree state check for a CRTC. Instead of open-coding the TearFree check everywhere, introduce a helper, ms_tearfree_is_active_on_crtc, to cover the TearFree state checks. Suggested-by: Martin Roukala <martin.roukala@mupuf.org> Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com> Reviewed-by: Martin Roukala <martin.roukala@mupuf.org>
* modesetting: Improve TearFree state check in ms_present_check_flipSultan Alsawaf2023-02-281-2/+3
| | | | | | | | | | Check that the VT is owned and that the CRTC is on before exporting info to Present stating that TearFree is available. Also, since `trf->buf[0].px` is checked, the `ms->drmmode.tearfree_enable` check is redundant and can therefore be removed. Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com> Reviewed-by: Martin Roukala <martin.roukala@mupuf.org>
* modesetting: Fix memory leak on ms_do_pageflip errorSultan Alsawaf2023-02-281-4/+9
| | | | | | | | | | | | | | | | | The event allocation for ms_do_pageflip is leaked on error because callers of ms_do_pageflip have no way of knowing whether or not a page flip succeeded for any CRTCs. If a page flip succeeded for at least one CRTC, then it's not safe for the caller to free the event allocation, and the allocation won't be leaked. The event allocation is only leaked when not a single CRTC's page flip succeeded. Since all callers of ms_do_pageflip allocate the event pointer, and all of them intentionally leak the event allocation when ms_do_pageflip returns an error, just free the event pointer inside ms_do_pageflip when a page flip doesn't succeed for any CRTC. Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com> Reviewed-by: Martin Roukala <martin.roukala@mupuf.org>
* modesetting: Pass CRTC pointer to TearFree flip handlersSultan Alsawaf2023-02-281-3/+7
| | | | | | | | | | The CRTC pointer will soon be needed in the TearFree flip handlers, so pass it in instead of passing in drmmode_tearfree_ptr. No functional change. Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com> Reviewed-by: Martin Roukala <martin.roukala@mupuf.org>
* modesetting: Pass reference CRTC pointer to ms_do_pageflipSultan Alsawaf2023-02-284-15/+9
| | | | | | | | | | | | Rather than passing the reference CRTC's vblank pipe to ms_do_pageflip, just pass the pointer to the reference CRTC directly instead. This is clearer and more useful than the vblank pipe, since the vblank pipe is only used to identify whether or not a given CRTC is the reference CRTC. No functional change. Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com> Reviewed-by: Martin Roukala <martin.roukala@mupuf.org>
* modesetting: Remove redundant GLAMOR_HAS_GBM #ifdef from ms_do_pageflipSultan Alsawaf2023-02-281-4/+0
| | | | | | | | | | This #ifdef is redundant since ms_do_pageflip is already enclosed within a larger GLAMOR_HAS_GBM #ifdef. No functional change. Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com> Reviewed-by: Martin Roukala <martin.roukala@mupuf.org>
* Remove "All rights reserved" from Oracle copyright noticesAlan Coopersmith2023-02-2531-31/+31
| | | | | | Oracle no longer includes this term in our copyright & license notices. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Add DRM platform for BSDAustin Shafer2023-02-232-1/+2
| | | | | | | This moves lnx_platform.c to the shared directory and adds it to the BSD build. This is needed for PRIME render offload. Acked-by: Olivier Fourdan <ofourdan@redhat.com>
* dix: Force update LEDs after device state update in EnableDeviceYao Wei2023-02-213-0/+44
| | | | | | | | This is to make sure the hardware gets the device states regardless whether the internal state has changed or not, to overcome situations that device LEDs are out of sync e.g. switching between VTs. Signed-off-by: Yao Wei (魏銘廷) <yao.wei@canonical.com>
* dix: fix wheel emulation lockup when a negative increment is setPeter Hutterer2023-02-201-3/+3
| | | | | | | | | | | | | | The increment sign wasn't taking into account when checking if the next value is past our current value. The result was that for negative increments, we kept looping indefinitely, locking up the server. Easiest to reproduce with the evdev driver which has a negative increment on the y axis. Fixes 0a22502c34f2ea9799a67386498f657d769c7af8 dix: switch scroll button emulation to multiples of increment Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* dix: switch scroll button emulation to multiples of incrementPeter Hutterer2023-02-161-24/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current algorithm triggers a bug in Xwayland when two devices have different granularity of scrolling. In Xwayland, the scroll increment is 1 and all physical devices scroll through the same (x)wayland pointer device. This may cause events to get lost when changing devices: - mouse scrolls by full increment, current value is 1.0 last scroll button was sent for valuator value 0.0, delta is 1.0 and we emulate a button event. - touchpad scrolls by partial increment, current value is 1.3 last scroll button was sent for valuator value 1.0, delta is 0.3 and no button event is emulated - mouse scrolls by full increment, current value is -0.7, last scroll button was sent for valuator value 1.0, delta is -0.7 and no button event is emulated Thus the wheel event appears to get lost. Xwayland cannot reliably detect this case because we don't see the physical devices. We can work around this by instead emulating buttons whenever we cross a multiple of increment. However, this has a drawback: high-resolution scroll devices can now trigger a button event storm by jittering across the multiple of increment. e.g. in the example above the touchpad moving from 1.3 to 1.0 would cause a click, despite this being a third of an increment. Fixes #1339 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Acked-by: Olivier Fourdan <ofourdan@redhat.com>
* dix: remove pointless "flexible" x/y axis mappingPeter Hutterer2023-02-161-7/+6
| | | | | | | | | storeLastValuators() takes the index in the mask for the x and y axis. Completely pointless because any device that doesn't have x/y on 0 and 1, respectively, is going to break in fun ways anyway. And we only have two callers two this function, both of which hardcode 0 and 1. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* present: Send a PresentConfigureNotify event for destroyed windowsAdam Jackson2023-02-153-4/+19
| | | | | | | | | | | | This enables fixing a deadlock case on the client side, where the client ends up blocked waiting for a Present event that will never come because the window was destroyed. The new PresentWindowDestroyed flag allows the client to avoid blocking indefinitely. Signed-off-by: Adam Jackson <ajax@redhat.com> See-also: https://gitlab.freedesktop.org/mesa/mesa/-/issues/116 See-also: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6685 Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
* xwayland: override Meson dependencySimon Ser2023-02-131-14/+27
| | | | | | | | This allows developers to setup Xwayland as a subproject of a Wayland compositor, and have it correctly pick up the features advertised in the dependency variables. Signed-off-by: Simon Ser <contact@emersion.fr>
* xwayland: generate pkg-config file from MesonSimon Ser2023-02-132-35/+23
| | | | | | | | | | | | Remove the xwayland.pc.in file: - This avoids writing down each pkg-config variable twice: once in the Meson files to set the configuration data, once in the .pc.in file to print it. - We'll be able to re-use the same variables for use as a subproject. Signed-off-by: Simon Ser <contact@emersion.fr>
* xwayland: Use wl_output.name for XRandROlivier Fourdan2023-02-131-2/+22
| | | | | | | | | | | If wl_output provides us with an output name, use that as well. If we have both xdg_output.name and wl_output.name (from version >= 4), prefer the latter. Signed-off-by: Olivier Fourdan <ofourdan@redhat.com># See-also: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/189 Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
* xwayland: Pass the wl_output versionOlivier Fourdan2023-02-133-4/+6
| | | | | | | | | | | With the wl_output protocol, the actual bind to the interface is done in xwl_output_create(). Pass the version number from the registry so we can bind to the minimum version. Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
* xwayland: Use xdg-output name for XRandROlivier Fourdan2023-02-131-3/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, Xwayland assigns sequential output names for XRandR. When an output is hotplugged, a new name is assigned sequentially (XWAYLAND0, XWAYLAND1, etc.). This is a problem because if a monitor is unplugged and plugged again, it will get a new name each time. Luckily, xdg-output provides us with a name for the outputs. Even though the protocol states that the name is not a reflection of the underlying DRM connector name, it is to remain consistent across sessions with the same hardware and software configuration. So we could use the xdg-output name for the XRandR reported name for the output. Doing so is a bit tricky though, because the output name is set at creation and is not supposed to change. The xdg-output event that provides us with the name will come at a later time. So we just allocate a default fixed size for the output name at creation and just replace the default output name with the xdg-output name when that is known. Also, historically, some X11 clients were expecting output names in Xwayland to be named XWAYLAND<x> and used that to check whether they were running on Xwayland. Those clients should now use the Xwayland X11 extension which is designed specifically for that purpose. Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1353 See-also: https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/954 Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
* xwayland: Tell RR has changed only when doneOlivier Fourdan2023-02-131-1/+2
| | | | | | | | | | | | | | | | Since commit 204f10c2, we notify XRandR clients that the randr configuration has changes as soon as an new output is created. Yet, this might be premature, considering that at that point, we are still to receive the wl_output and xdg-output events that will most likely change the setup. So instead of calling RRTellChanged() from xwl_output_create(), wait until we get to call apply_output_change(), which occurs after the done events from both xdg-output and wl_output are received. Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
* xwayland: fix GBM on driver without explicit modifiersSimon Ser2023-02-131-3/+2
| | | | | | | | | | | Some drivers (e.g. AMD GFX8-) don't support explicit format modifiers. On these drivers, gbm_bo_create_with_modifiers() will fail. This results in "Error getting buffer" in the logs later on with all X11 windows staying invisible. Fallback to the modifier-less API gbm_bo_create() in that case. Signed-off-by: Simon Ser <contact@emersion.fr>
* xwayland: Do not use "XWayland" spelling in code identifiersMichel Dänzer2023-02-131-5/+5
| | | | Let's not give people any excuse for this spelling.
* xwayland: Spell XWAYLAND consistently in debug messagesMichel Dänzer2023-02-131-1/+1
|
* xwayland: Spell Xwayland consistently in error messagesMichel Dänzer2023-02-132-3/+3
|
* xwayland/window: Do not double add window to damage listMinh Phan2023-02-101-1/+2
| | | | | | | | | | The window might be retained in the damage list after `xwl_screen_post_damage` in certain conditions. This means we need to check if the window is already in the list to avoid adding the same window twice which will lead to list corruption resulting in server freeze in `xwl_screen_post_damage`. Signed-off-by: Minh Phan <phanquangminh217@gmail.com>
* dix: Clear device sprite after free in AttachDevice()Olivier Fourdan2023-02-091-0/+1
| | | | | | | | | | | | | | | | | The code in AttachDevice() may free the dev->spriteInfo->sprite under some circumstances and later call GetCurrentRootWindow() which uses the same dev->spriteInfo->sprite. While it seems unlikely that this is actually an issue, considering the cases where one or the other get called, it still makes the code look suspicious. Make sure to clear set dev->spriteInfo->sprite to NULL immediately after it's freed to avoid any confusion, even if only to clarify the code. Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1436
* xwayland: wl_pointer.axis_v120 is no longer optionalOlivier Fourdan2023-02-094-17/+2
| | | | | | | With Wayland 1.21 being our baseline, we do not need to compile wl_pointer.axis_v120 conditionally. Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
* build: Bump Wayland dependency to 1.21Olivier Fourdan2023-02-091-1/+1
| | | | | | | | Wayland 1.21 was released on June 30, 2022 and our CI already installs Wayland 1.21 so let's just require the version we actually use in our CI. Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
* glamor: handle EXT_gpu_shader4 in dual source blend pathsDave Airlie2023-02-101-3/+8
| | | | | Fixes: a9552868697c ("glamor: add EXT_gpu_shader4 support") Acked-by: Emma Anholt <emma@anholt.net>
* Xi: fix potential use-after-free in DeepCopyPointerClassesPeter Hutterer2023-02-071-1/+3
| | | | | | | | | CVE-2023-0494, ZDI-CAN-19596 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>
* xwayland: Commit surface changes with libdecor configureOlivier Fourdan2023-02-031-0/+7
| | | | | | | | | | | With libdecor, when the state changes (in the configure handler), we need to commit the libdecor frame but also the wl_surface, otherwise the surface is left in a uncommitted state until a wl_surface commit eventually occurs later. Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Fixes: c74c6add3e - xwayland: add optional support for libdecor Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
* darwin: Implement DetermineClientCmd for macOSJeremy Huddleston Sequoia2023-01-261-1/+109
| | | | | | | | | Withoug a proper implementation of DetermineClientCmd, clients that connect via an ssh tunnel are miscategorized as local. This results in failures when we try to use SCM_RIGHTS (eg: in MIT-SHM). Fixes: https://github.com/XQuartz/XQuartz/issues/314 Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
* os: Use LOCAL_PEERPID from sys/un.h if it is available to detemine the pid ↵Jeremy Huddleston Sequoia2023-01-262-0/+19
| | | | | | | | | | when falling back on getpeereids() This provides a way to determine the pid of a peer connection on systems like darwin that do not support getpeerucred() nor SO_PEERCRED. Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
* os: Update GetLocalClientCreds to prefer getpeerucred() or SO_PEERCRED over ↵Jeremy Huddleston Sequoia2023-01-261-14/+14
| | | | | | | | | | | | | | | | getpeereid() GetLocalClientCreds() was preferring getpeereid() above other implementations. getpeereid(), however, only returns the effective uid and gid of the peer, leaving the pid unset. When this happens, we are unable to use the pid to determine the peer's command line arguments and incorrectly treat ssh-tunneled traffic as local. To address this, we now prioritize getpeerucred() or SO_PEERCRED as those two implementations will return the pid in addition to uid and gid. Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
* os: Update AllocNewConnection() debug logging to include whether or not the ↵Jeremy Huddleston Sequoia2023-01-261-2/+2
| | | | | | client is local Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
* dix: Use CopyPartialInternalEvent in EnqueueEventMike Gorse2023-01-251-1/+1
| | | | | | | The event might be a DeviceEvent allocated on the stack, in AccessXKeyboardEvent for instance. Fixes out-of-bounds read. Signed-off-by: Mike Gorse <mgorse@suse.com>
* meson: wayland_client_dep is false when wayland is disabledorbea2023-01-241-27/+26
| | | | Signed-off-by: orbea <orbea@riseup.net>
* Xephyr: fix help output.Tamura Dai2023-01-221-1/+1
| | | | | | "-mouse" require two commas before options. Signed-off-by: Tamura Dai <kirinode0@gmail.com>
* xwayland: Send PresentCompleteModeSuboptimalCopy if dmabuf feedback was resentAustin Shafer2023-01-203-1/+36
| | | | | | | | If the dmabuf protocol's feedback object gave us a new list of modifiers, send PresentCompleteModeSuboptimalCopy to the client to inform them that they need to call GetSupportedModifiers. Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
* dri3: Don't compute intersection with drawable modifiersAustin Shafer2023-01-201-44/+12
| | | | | | | | | | | | | | | In dri3_get_supported_modifiers we were previously intersecting the drawable mods and the screen mods. This meant all screen mods were returned, but the ones compatible with the drawable were returned in the drawable mods list and the rest are returned in the screen mods list. This is a problem with linux_dmabuf v4 since the drawable mods may contain different mods not found in the screen mods (such as scanout entries). This change removes the intersection, and just returns the drawable/screen mod lists directly. Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
* xwayland: Add proper support for telling if a format/mod is supportedAustin Shafer2023-01-201-6/+52
| | | | | | | | | | | | | | This adds to xwl_glamor_is_modifier_supported, where if feedback is in use we will check that the format/mod is allowed in any device advertised by the compositor. Reviewed-by: Michel Dänzer <mdaenzer@redhat.com> [ Michel Dänzer: * Move dev_formats declaration to where it's used in xwl_feedback_is_modifier_supported * Add curly braces around multi-line statement in xwl_glamor_is_modifier_supported ]
* xwayland: Return default feedback in xwl_screenAustin Shafer2023-01-201-9/+65
| | | | | | | | | | | | | If protocol version 4 of linux_dmabuf is in use, then the compositor may not return anything with the modifiers event. We instead will return the formats/mods reported for the main device. Reviewed-by: Michel Dänzer <mdaenzer@redhat.com> [ Michel Dänzer: * Move main_dev declaration to where it's used in xwl_glamor_get_formats * Add empty line between variable declaration and comment ]
* xwayland: Make helper for returning a list of formatsAustin Shafer2023-01-201-13/+23
| | | | | | | | | This adds xwl_get_formats Reviewed-by: Michel Dänzer <mdaenzer@redhat.com> [ Michel Dänzer: * Remove unused variable i from xwl_glamor_get_formats ]
* xwayland: Add get_drawable_modifiers implementationAustin Shafer2023-01-205-14/+102
| | | | | | This reads from the format list, which is not yet filled in. Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
* xwayland: Add get_main_device helper to GBMAustin Shafer2023-01-203-0/+23
| | | | Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
* xwayland: Implement linux_dmabuf_feedback event handlersAustin Shafer2023-01-206-1/+313
| | | | | | | | | Reviewed-by: Michel Dänzer <mdaenzer@redhat.com> [ Michel Dänzer: * Sort protocol #includes lexically. * memcpy to &xwl_feedback->main_dev directly in xwl_dmabuf_feedback_main_device. ]
* xwayland: Move xwl_format array management to its own functionAustin Shafer2023-01-201-19/+31
| | | | | | | | | This creates xwl_add_format_and_mod_to_list, which is a helper that adds a format/mod combo to a xwl_format* list. This will be used by both the modifier event handling and the tranche format handling. Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
* rootless: Use screen_x and screen_y instead of pixmap pointer hacksJeremy Huddleston Sequoia2023-01-2014-32/+28
| | | | | | | | | This updates rootless to treat pixmaps consistently with COMPOSITE, using the screen_x and screen_y values rather than doing hacky math. This will allow for proper bounds checking on a given PixmapRec. Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
* rootless: Dead code removal (RootlessResizeCopyWindow)Jeremy Huddleston Sequoia2023-01-201-126/+1
| | | | | | | | This should no longer be necessary since we only support implementations that handle preserving the bits across resize. We can use RootlessNoCopyWindow instead. Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
* rootless: Remove an unnecessary memory copy when handling resize with ↵Jeremy Huddleston Sequoia2023-01-201-37/+0
| | | | | | | | gravity RL_GRAVITY_NONE (border width changes) This should no longer be necessary since we only support implementations that handle preserving the bits across resize Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
* rootless: Dead code removal (resize_after in StartFrameResize / ↵Jeremy Huddleston Sequoia2023-01-201-49/+24
| | | | | | FinishFrameResize) Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>