summaryrefslogtreecommitdiff
path: root/src/backends
Commit message (Collapse)AuthorAgeFilesLines
* x11: Limit touch replay pointer events to when replayinggnome-3-30Jonas Ådahl2020-04-241-13/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a touch sequence was rejected, the emulated pointer events would be replayed with old timestamps. This caused issues with grabs as they would be ignored due to being too old. This was mitigated by making sure device event timestamps never travelled back in time by tampering with any event that had a timestamp seemingly in the past. This failed when the most recent timestamp that had been received were much older than the timestamp of the new event. This could for example happen when a session was left not interacted with for 40+ days or so; when interacted with again, as any new timestamp would according to XSERVER_TIME_IS_BEFORE() still be in the past compared to the "most recent" one. The effect is that we'd always use the `latest_evtime` for all new device events without ever updating it. The end result of this was that passive grabs would become active when interacted with, but would then newer be released, as the timestamps to XIAllowEvents() would out of date, resulting in the desktop effectively freezing, as the Shell would have an active pointer grab. To avoid the situation where we get stuck with an old `latest_evtime` timestamp, limit the tampering with device event timestamp to 1) only pointer events, and 2) only during the replay sequence. The second part is implemented by sending an asynchronous message via the X server after rejecting a touch sequence, only potentially tampering with the device event timestamps until the reply. This should avoid the stuck timestamp as in those situations, we'll always have a relatively up to date `latest_evtime` meaning XSERVER_TIME_IS_BEFORE() will not get confused. https://gitlab.gnome.org/GNOME/mutter/merge_requests/886
* display: Move finishing of touch sequence to the backendJonas Ådahl2020-04-243-0/+53
| | | | | | | We need to manipulate an X11 grab when a touch sequence ends; move that logic to where it belongs - in the X11 backend. https://gitlab.gnome.org/GNOME/mutter/merge_requests/886
* renderer/native: add missing eglTerminate in EGLDevice error pathEmil Velikov2019-06-131-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Currently the EGLDevice code gets the display and calls eglInitialize. As a follow-up it checks the required EGL extensions - technically it could check the EGL device extensions earlier. In either case, eglTerminate is missing. Thus the connection to the display was still bound. This was highlighted with Mesa commit d6edccee8da ("egl: add EGL_platform_device support") + amdgpu. In that case, since the eglTerminate is missing, we end up reusing the underlying amdgpu_device due to some caching in libdrm_amdgpu. The latter in itself being a good solution since it allows buffer sharing across primary and render node of the same device. Note: we should really get this in branches all the way back to 3.30. https://gitlab.gnome.org/GNOME/mutter/merge_requests/619 Fixes: 934184e23 ("MetaRendererNative: Add EGLDevice based rendering support") Cc: Jonas Ådahl <jadahl@gmail.com> Signed-off-by: Emil Velikov <emil.velikov@collabora.com> (cherry picked from commit 9213574870faee7fe40609791fc48f4b44f861c0)
* cursor-renderer-native: Free MetaCursorNativePrivate structMarco Trevisan (Treviño)2019-05-271-0/+1
| | | | | | | | Fix a small leak in native renderer. https://gitlab.gnome.org/GNOME/mutter/merge_requests/581 (cherry picked from commit b016ff29f638b04d1a756b82c461563207083391)
* monitor-manager: Don't use switch-config when ensuring configurationJonas Ådahl2019-01-301-3/+1
| | | | | | | | | | | | | | | Switch-configs are only to be used in certain circumstances (see meta_monitor_manager_can_switch_config()) so when ensuring configuration and attempting to create a linear configuration, use the linear configuration constructor function directly without going via the switch config method, otherwise we might incorrectly fall back to the fallback configuration (only enable primary monitor). This is a regression introduced by 6267732bec97773. Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/342 (cherry picked from commit 149e4d69345adab2bfea84a04f88511cbad62fe0)
* screen-cast: Fix monitor recording on HiDPIJonas Ådahl2019-01-281-1/+5
| | | | | | | | | | | | It scaled the logical monitor rect with scale to get the stream dimensions, but that is only valid when having 'scale-monitor-framebuffers' enabled. Even when it was, it didn't work properly, as clutter_stage_capture_into() doesn't work properly with scaled monitor framebuffers yet. https://gitlab.gnome.org/GNOME/mutter/merge_requests/415 (cherry picked from commit 3fa6a92cc5dda6ab3939c3e982185f6caf453360)
* monitor-manager: use MonitorsConfig to track switch_configDaniel Drake2018-10-083-12/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When constructing MetaMonitorsConfig objects, store which type of switch_config they are for (or UNKNOWN if it is not such type of config). Stop unconditionally setting current_switch_config to UNKNOWN when handling monitors changed events. Instead, set it to the switch_config type stored in the MonitorsConfig in the codepath that updates logical state. In addition to being called in the hotplug case along the same code flow that generates monitors changed events, this is also called in the coldplug case where a secondary monitor was connected before mutter was started. When creating the default linear display config, create it as a switch_config so that internal state gets updated to represent linear mode when this config is used. The previous behaviour of unconditionally resetting current_switch_config to UNKNOWN was breaking the internal state machine for display config switching, causing misbehaviour in gnome-shell's switchMonitor UI when using display switch hotkeys. The lack of internal tracking when the displays are already in the default "Join Displays" linear mode was then causing the first display switch hotkey press to do nothing (it would attempt to select "Join Displays" mode, but that was already active). Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/281 https://gitlab.gnome.org/GNOME/mutter/merge_requests/213
* renderer/native: honour dumb buffer stridePekka Paalanen2018-10-043-4/+15
| | | | | | | | | | | meta_renderer_native_gles3_read_pixels() was assuming that the target buffer stride == width * 4. This is not generally true. When a DRM driver allocates a dumb buffer, it is free to choose a stride so that the buffer can actually work on the hardware. Record the driver chosen stride in MetaDumbBuffer, and use it in the CPU copy path. This should fix any possible stride issues in meta_renderer_native_gles3_read_pixels().
* renderer/native: assert dumb buffer size on CPU copyPekka Paalanen2018-10-041-0/+7
| | | | | | | | | | | Track the allocated dumb buffer size in MetaDumbBuffer. Assert that the size is as expected in copy_shared_framebuffer_cpu(). This is just to ensure that Cogl and the real size match. The size from Cogl was used in the copy, so getting that wrong might have written beyond the allocation. This is a safety measure and has not been observed to happen yet.
* renderer/native: check format for drmModeAddFB fallbackPekka Paalanen2018-10-041-0/+10
| | | | | | | | | | If drmModeAddFB2() does not work, the fallback to drmModeAddFB() can only handle a single specific format. Make sure the requested format is that one format, and fail the operation otherwise. This should at least makes the failure mode obvious on such old systems where the kernel does not support AddFB2, rather than producing wrong colors.
* input-settings: detect trackball using udev ID_INPUT_TRACKBALLTony Novak2018-09-194-29/+17
| | | | | | | | | | | | | | | | Previously, trackballs were detected based on the presence of the substring "trackball" in the device name. This had the downside of missing devices, such as the Kensington Expert Mouse, which don't have "trackball" in their names. Rather than depending on the device name, use the ID_INPUT_TRACKBALL property from udev to determine whether or not to treat a device as a trackball. This adds a new function, `is_trackball_device`, to MetaInputEvents, and eliminates the `meta_input_device_is_trackball` function. Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/258
* input-settings-x11: Push error trapFlorian Müllner2018-09-071-0/+1
| | | | | | Pops are lonely without push, so add one for a happy error trap. https://gitlab.gnome.org/GNOME/mutter/issues/294
* renderer/native: Check calculated transform when creating viewJonas Ådahl2018-08-242-4/+13
| | | | | | | | | | | | | The "backends: Move MetaOutput::crtc field into private struct" accidentally changed the view transform calculation code to assume that "MetaCrtc::transform" corresponds to the transform of the CRTC; so is not the case yet; one must calculate the transform from the logical monitor, and check whether it is supported by the CRTC using meta_monitor_manager_is_transform_handled(). This commit restores the old behaviour that doesn't use MetaCrtc::transform when calculating the view transform. Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/216
* monitor-manager-kms: Check if GPUs can have outputsIain Lane2018-08-213-0/+30
| | | | | | | | | We need a way for mutter to exit if no available GPUs are going to work. For example if gdm starts gnome-shell and we're using a DRM driver that doesn't work with KMS then we should exit so that GDM can try with Xorg, rather than operating in headless mode. Related: https://gitlab.gnome.org/GNOME/mutter/issues/223
* gpu-kms: Handle drmModeGetResources() failingIain Lane2018-08-211-5/+31
| | | | | | | Avoid dereferencing the NULL return value if it fails. We still create the MetaGpu, but we treat it as if it has no outputs. Closes: https://gitlab.gnome.org/GNOME/mutter/issues/223
* idle-monitor: Store either 1 or 0 in the inhibited gbooleanJonas Ådahl2018-08-141-2/+3
| | | | | Wrap the flag checking in !!(..) to make sure we always either store TRUE or FALSE in the gboolean.
* backends/x11: Improve grab-device clock updatesJeff Smith2018-08-131-2/+3
| | | | | | | | | | meta_backend_x11_grab_device is performing X server clock comparison using the MAX macro, which comes down to a simple greater-than. Use XSERVER_TIME_IS_BEFORE, which is a better macro for X server clock comparisons, as it accounts for 32-bit wrap-around. https://gitlab.gnome.org/GNOME/mutter/merge_requests/174
* Revert "gpu-kms: Handle drmModeGetResources() failing"Jonas Ådahl2018-08-101-31/+5
| | | This reverts commit acf70a35611bfd6c3c4f46279f80fea52873193e
* gpu-kms: Handle drmModeGetResources() failingIain Lane2018-08-101-5/+31
| | | | | | | Avoid dereferencing the NULL return value if it fails. We still create the MetaGpu, but we treat it as if it has no outputs. Closes: https://gitlab.gnome.org/GNOME/mutter/issues/223
* renderer/native: Fallback to non-planar API if gbm_bo_get_handle_for_plane failsAlex Villacís Lasso2018-08-091-5/+16
| | | | | | | | | | | | | | | | | | | Commit c0d9b08ef9bf2be865aad9bf1bc74ba24c655d9f replaced the old GBM API calls with the multi-plane GBM API. However, the call to gbm_bo_get_handle_for_plane fails for some DRI drivers (in particular i915). Due to missing error checks, the subsequent call to drmModeAddFB[2] fails and the screen output locks up. This commit adds the missing error checks and falls back to the old GBM API (non-planar) if necessary. v5: test success of gbm_bo_get_handle_for_plane instead of errno This commit adopts solution proposed by Daniel van Vugt to check the return value of gbm_bo_get_handle_for_plane on plane 0 and fall back to old non-planar method if the call fails. This removes the errno check (for ENOSYS) that could abort if mesa ever sets a different value. Related to: https://gitlab.gnome.org/GNOME/mutter/issues/127
* Don't cast free function passed to g_clear_pointerFlorian Müllner2018-07-312-5/+5
| | | | | | | | | The function is intentionally provided as macro to not require a cast. Recently the macro was improved to check that the passed in pointer matches the free function, so the cast to GDestroyNotify is now even harmful. https://gitlab.gnome.org/GNOME/mutter/merge_requests/176
* Stop using g_type_class_add_private()Florian Müllner2018-07-311-3/+1
| | | | | | | It is now deprecated in favor of the G_ADD_PRIVATE() macro (usually called via G_DEFINE_WITH_PRIVATE()). https://gitlab.gnome.org/GNOME/mutter/merge_requests/176
* monitor: Use current monitor mode to check whether activeJonas Ådahl2018-07-311-6/+16
| | | | | | | | | | | | | | | | | | | | | | | | | For historical reasons meta_monitor_is_active() checked whether it is active by checking whether the main output have a CRTC assigned and whether that CRTC has a current mode. At a later point, the MetaMonitor got its own mode abstraction (MetaMonitorMode), but meta_monitor_is_active() was never updated to use this. An issue with checking the main output's CRTC state is that, if there is some CRTC mode combination that for some reason isn't properly detected by the MetaMonitorMode abstraction (e.g. some tiling configuration not yet handled), meta_monitor_is_active() would return TRUE, even though no (abstracted) mode was set. This would cause confusion here and there, leading to NULL pointer dereferences due to the assumption that if a monitor is active, it has an active mode. Instead, change meta_monitor_is_active() to directly check the current monitor mode, and log a warning if the main output still happen to have a CRTC with a mode assigned to it. This way, when an not undrestood CRTC mode combination is encountered, instead of dereferencing NULL pointers, simply assume the monitor is not active, which means that it will not be managed or rendered by mutter at all. https://gitlab.gnome.org/GNOME/mutter/issues/130
* monitor-manager: Filter out low screen resolutionsAndrea Azzarone2018-07-303-2/+23
| | | | | | | | | Avoid exporting through org.gnome.Mutter.DisplayConfig.GetCurrentState excessively-low screen resolutions setting both a minimum width and a minimum height. GetCurrentState is e.g. used by Gnome Control Center to build a list of selectable resolutions. Fixes: https://bugzilla.gnome.org/show_bug.cgi?id=793223
* native/gpu: Handle drmModeSetCrtc() failing gracefullyJonas Ådahl2018-07-251-1/+4
| | | | | | | | If drmModeSetCrtc() is called with no fb, mode or connectors for some CRTC it may still fail, and we should handle that gracefully instead of assuming it failed to set a non-disabled state. Closes https://gitlab.gnome.org/GNOME/mutter/issues/70
* Add remote access controller APIJonas Ådahl2018-07-207-0/+357
| | | | | | | | | | | | Add API to let GNOME Shell have the ability to get notified about remote access sessions (remote desktop, remote control and screen cast), and with a way to close them. This is done by adding an abstraction above the remote desktop and screen cast session objects, to avoid exposing their objects to outside of mutter. Doing that would result in external parts holding references to the objects, complicating their lifetimes. By using separate wrapper objects, we avoid this issue all together.
* backend: Remove direct upower-glib usageBastien Nocera2018-07-182-17/+97
| | | | | | | | | Monitor whether UPower is running ourselves. That allows us to keep the same value for "lid-is-closed" throughout the process of UPower restarting, preventing unwanted monitor re-configuration through the process. Fixes another screen black out when UPower restarts and the laptop lid is closed.
* backend: Move lid-is-closed handling to MetaBackendBastien Nocera2018-07-185-69/+103
| | | | | | | | Rather than handle UpClient in both MetaBackend (to reset the idletime when the lid is opened), and in MetaMonitorManager and MetaMonitorConfigManager (to turn the screen under the lid on/off depending on its status), move the ability to get the lid status from UPower or mock it in one place, in MetaBackend.
* monitor-manager: Cache the last known value of "lid-is-closed"Bastien Nocera2018-07-182-1/+9
| | | | | | | | | Restarting UPower will make every property of UpClient emit a "notify" signal (as a GDBusProxy would). Avoid mutter reconfiguring the displays when upower restarts by caching the last known value of "lid-is-closed" and only reconfiguring the displays if it actually changed. This fixes a black out of the screen when UPower restarts.
* monitor-manager: Don't throw an error if UPower isn't runningBastien Nocera2018-07-181-2/+5
| | | | | Don't try to connect to a UpClient signal if creating the client failed, because UPower isn't running for example.
* backends/native: Remove unused upower-glib headerBastien Nocera2018-07-181-1/+0
| | | | Wasn't removed in 657417a.
* screen-cast-src: Allow negotiating the framerateJonas Ådahl2018-07-131-3/+3
| | | | | | | | | | The framerate for screen cast sources was set to variable within 1 FPS and the framerate of the monitor being screen casted. This meant that if the sink didn't match the framerate (e.g. had a lower max framerate), the formats would not match and a stream would not be established. Allow letting the sink clamp the framerate range by setting it as 'unset', allowing it to be negotiated.
* screen-cast-src: Port to pipewire masterJonas Ådahl2018-07-121-23/+23
| | | | | | | The PipeWire master branch saw some backports from the work branch, including API changes making the 0.1 series more aligned with future plans. Make mutter use the new API. This is needed to avoid dead locks that existed in the older version.
* launcher: First check if we are in a login sessionIain Lane2018-07-101-0/+23
| | | | | | | For mutter developers we still want to support running from a VT, which will be in a different login session. Fixes #218
* meta-launcher: Find the current user's graphical session, not the pid'sIain Lane2018-07-071-11/+144
| | | | | If we're started by systemd --user, we might not be in the same session, but this is nevertheless the one we are interested in.
* backends/x11: Force-update cursor when theme or size changedJonas Ådahl2018-07-062-0/+12
| | | | | | Force update the cursor renderer after theme or size changes; otherwise we'll be stuck with the old theme and/or size until something else triggers resetting of the cursor.
* Rename errors.[ch] to meta-x11-errors.[ch]Armin Krezović2018-07-065-13/+12
| | | | | | | Also rename meta_error_trap_* to meta_x11_error_trap_* and move meta-x11-errors.c to src/x11 https://bugzilla.gnome.org/show_bug.cgi?id=759538
* remote-desktop: Remove unnecessary includeJonas Ådahl2018-07-062-2/+0
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=759538
* Fix XDND handling to work without GDK and MetaX11DisplayArmin Krezović2018-07-062-2/+2
| | | | | | This fixes mutter --nested --wayland without X11 https://bugzilla.gnome.org/show_bug.cgi?id=759538
* Prepare for making MetaX11Display conditionalArmin Krezović2018-07-061-2/+2
| | | | | | | | - Stop using CurrentTime, introduce META_CURRENT_TIME - Use g_get_monotonic_time () instead of relying on an X server running and making roundtrip to it https://bugzilla.gnome.org/show_bug.cgi?id=759538
* Stop using MetaScreen where it is unnecessaryArmin Krezović2018-07-064-6/+5
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=759538
* Move monitor management API to MetaDisplayArmin Krezović2018-07-065-25/+25
| | | | | | | This includes changing various users to use MetaDisplay directly, who used MetaScreen only for this before. https://bugzilla.gnome.org/show_bug.cgi?id=759538
* Move alarm and xids management to MetaX11DisplayArmin Krezović2018-07-061-5/+5
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=759538
* Move X11 extension queries to MetaX11DisplayArmin Krezović2018-07-062-3/+4
| | | | | | Also split extension queries into their own functions https://bugzilla.gnome.org/show_bug.cgi?id=759538
* Switch meta_error_trap functions to MetaX11DisplayArmin Krezović2018-07-061-8/+8
| | | | | | | | They are X11 specific functions, used for X11 code. They have been improved per jadahl's suggestion to use gdk_x11_lookup_xdisplay and gdk_x11_display_error_trap_* functions, instead of current code. https://bugzilla.gnome.org/show_bug.cgi?id=759538
* Start populating MetaX11DisplayArmin Krezović2018-07-062-4/+11
| | | | | | | | | | | - Moved xdisplay, name and various atoms from MetaDisplay - Moved xroot, screen_name, default_depth and default_xvisual from MetaScreen - Moved some X11 specific functions from screen.c and display.c to meta-x11-display.c https://bugzilla.gnome.org/show_bug.cgi?id=759538
* backends: Add logical monitor -> monitor -> output -> crtc ref chainJonas Ådahl2018-06-283-10/+42
| | | | | | | | | | | Make it so that each logical monitor has a reference to all the monitors that are assigned to it. All monitors has a reference to each output that belongs to it. Each output has a reference to any CRTC it has been assigned. https://bugzilla.gnome.org/show_bug.cgi?id=786929
* backends: Move MetaOutput::crtc field into private structJonas Ådahl2018-06-2815-74/+141
| | | | | | | No functional changes. This is only done so that changes to reference counting can done more reliably. https://bugzilla.gnome.org/show_bug.cgi?id=786929
* monitor-manager: Add back warning messagesJonas Ådahl2018-06-281-0/+4
| | | | | | | | For some reason "backends: Remove X11 idle-monitor backend" removed unrelated warning messages for when generated monitor configurations that should work didn't, which also made the unit tests fail. This commit adds them back, which also makes the tests pass again.
* renderer/native: Choose first EGL config for non-GBM backendsMiguel A. Vico2018-06-151-17/+48
| | | | | | | | | | | | | Commit 712ec30cd9be1f180c3789e7e6a042c5f7b5781d added the logic to only choose EGL configs that match the GBM_FORMAT_XRGB8888 pixel format. However, there won't be any EGL config satisfying such criteria for non-GBM backends, such as EGLDevice. This change will let us choose the first EGL config for the EGLDevice backend, while still forcing GBM_FORMAT_XRGB8888 configs for the GBM one. Related to: https://gitlab.gnome.org/GNOME/mutter/issues/2