1
0
Fork 0
Commit graph

11662 commits

Author SHA1 Message Date
Daniel van Vugt
7cf9997757 kms/crtc: Increase default deadline evasion to 800 microseconds
This seems to be enough to fix:
 * Constant stuttering on Apple Magic Trackpad 2 (90Hz)
 * Constant stuttering on Microsoft IntelliMouse Explorer 3.0 (125Hz)
 * Wake-from-idle frame skips on Microsoft Classic IntelliMouse (1000Hz)

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2974
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3212>
2023-09-25 09:48:07 +00:00
Carlos Garnacho
39f599018c core: Do not repick pointer while syncing wayland foci
This is a remnant of unreliable pointer state after some of the
event grabbing conditions (originally introduced for window dragging
at commit 1b29113150). Since the introduction of ClutterGrab
and implicit grabs generating crossing events when the conditions
change, this is not necessary.

Related: https://gitlab.gnome.org/GNOME/mutter/-/issues/2977
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3287>
2023-09-21 12:28:06 +00:00
Sebastian Keller
8a5067c917 events: Don't un-bypass Clutter event handling in presence of grabs
After an event has been handled such that it bypasses both Clutter and
Wayland, e.g. when handling a keybinding, bypass_clutter would get
unset in the presence of a wayland grab. This means that the event is
handled both as a keybinding and by Clutter.

In the case of switcher popups in gnome-shell in the presence of a gtk4
autohide popover this meant that instead of selecting the next element,
it would select the one after that. If there are only two elements, as
is common with input sources, this would mean going back to the current
one, preventing switching them with a single press of the keybinding.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6738
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3054>
2023-09-21 10:00:52 +00:00
Pascal Nowack
483601844b backends/eis-client: Do not add device before adding EIS regions
When a device is added, libei does not allow adding additional regions
for that particular device, as it is already advertised to the EI
client.
As a result, mutter currently effectively only adds the first region to
a device, but not the others.
This makes input in multi monitor sessions only possible on one monitor,
as the EI client cannot look up the other regions, since they were not
advertised to it.

Fix this situation by not adding and resuming the device, when a shared
device is used.
Instead, for shared devices, always add all regions first, and then
after that, add and resume the device.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3273>
2023-09-16 22:13:05 +02:00
Pascal Nowack
4c5db8e3bd backends/eis-client: Fix type of index
libei uses as index size_t. To avoid a potential endless loop due to
overflow, fix that type accordingly.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3273>
2023-09-16 22:13:05 +02:00
Pascal Nowack
83454e944b screen-cast-stream: Also release mapping id when clearing stream
Use the previously added API to release acquired mapping ids, when the
corresponding stream is destroyed.
Otherwise, the remote desktop session would maintain a whole bunch of
unused mapping ids, as their corresponding streams are already
destroyed, but maybe not the session.
Such situation would be a remote multimonitor session, where the amount
of used virtual monitors changes multiple times during the session.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3273>
2023-09-16 22:13:05 +02:00
Pascal Nowack
3461e1e18c backends/remote-desktop-session: Add API to release mapping ids
The remote desktop session currently provides a mechanism to acquire
mapping ids.
However, when they are not used anymore, they currently cannot be
removed and thus just linger around.

So, add an API to release these acquired ids.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3273>
2023-09-16 22:13:05 +02:00
Carlos Garnacho
e056ce0ea3 backends/native: Pass ClutterSeat into virtual input device constructor
Avoid passing the MetaSeatImpl, since it may be potentially null at
MetaSeatNative construction time. An example of this triggering issues
are mousekeys, since those work on an emulated pointer device created
indirectly after a keyboard device is added (and the right settings are
enabled) at a time that the MetaSeatImpl is still being created, so the
MetaSeatNative cannot yet have a reference to it.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2869
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3278>
2023-09-16 10:29:21 +00:00
Carlos Garnacho
00bb4190b3 backends/native: Drop device_native->seat_impl field
Work our way to the MetaSeatImpl internally in MetaInputDeviceNative,
instead of keeping a pointer right to it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3278>
2023-09-16 10:29:21 +00:00
Carlos Garnacho
4ce97fba6c backends/native: Avoid meta_input_device_native_get_seat_impl()
These objects already have a pointer to the ClutterSeat that has a
pointer to the MetaSeatImpl in its native implementation. This data
may be considered pretty much immutable (a pointer to the seat is
held, and the native implementation will shut down the implementation
thread within ClutterSeat finalization.

Avoids some awkward code, since the MetaInputDeviceNative needs to
be aware of the Clutter object implementation and the implementation
object.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3278>
2023-09-16 10:29:21 +00:00
Daniel van Vugt
48c9b638f3 kms/impl-device: Inhibit deadline timer on vc4 (Raspberry Pi)
vc4's implementation of `drmModeAtomicCommit` seems to require a few
milliseconds advanced notice or else it will miss the frame deadline.
That's too high for our deadline evasion threshold which is measured
in microseconds. Let's stop trying to use deadline timers on vc4 to
avoid this conflict without having to disable atomic KMS.

Suggested-by: Jonas Ådahl <jadahl@gmail.com>
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2953
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3279>
2023-09-15 13:30:52 +08:00
Daniel van Vugt
eab5e94862 kms/impl-device: Rename deadline_timer_failed to deadline_timer_inhibited
Because in the next commit we'll reuse the flag for conditional
inhibition on platforms where the deadline timer doesn't fail.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3279>
2023-09-15 13:25:20 +08:00
Sebastian Keller
bac157b037 tests/wayland-unit: Fix typo
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3032>
2023-09-14 10:41:11 +00:00
Jonas Ådahl
ec35d74f1f wayland/idle-inhibit: Handle actor going away
There were some fixes to how to handle actor going away and being
recreated, but it didn't go all the way. This is the last step that
should have been.

Fixes: a3c62bf8aa ("wayland/idle-inhibit: Add state tracking to fix races")
Related: https://bugzilla.redhat.com/show_bug.cgi?id=2238785
Closes https://gitlab.gnome.org/GNOME/mutter/-/issues/3014

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3277>
2023-09-13 23:06:28 +00:00
Robert Mader
a9c24ff653 multi-texture-format: Add P010 YCbCr format
It's the 10 bit equivalent to NV12 and uses the same layout as P016, i.e.
16 bit components with the lowest 6 bits set to 0 (padding), allowing us
to use 16 bit "subformats".

Thus adding support is quite trivial as we can reuse the NV12 shader.
The format is widely supported in decoding and display hardware (on Intel
since Kaby Lake), as well as modern codecs (AV1, VP9, HEVC) and has
visible quality advantages over NV12.

Note that the additional colors are lost if composited to a 8 bit RGB
framebuffer. Switching between direct scanout and compositing can thus
cause quality differences. This is no new phenomena, however, as the
same is the case already for e.g. GL clients using 10 bit formats -
including video players.

Also note that P012 and P016 could trivially added as well - it's not
done here as they are uncommen and thus hard to test.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3244>
2023-09-13 14:11:27 +02:00
Robert Mader
66799c1aa0 multi-texture-format: Generalize shader names
These shaders can be used for similar formats with other component
sizes since the values are represented as floats. So whether the source
value was stored in 8bit, 10bit or 16bit doesn't matter - the driver
will covert it for us.

Thus use a Weston-inspired, more general naming scheme.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3244>
2023-09-13 14:11:27 +02:00
Robert Mader
6be2add1b0 multi-texture-format: Initialize format info list with enums
To make the relations more obvious.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3244>
2023-09-13 14:11:27 +02:00
Robert Mader
15320b5a66 cogl/pixel-format: Add G16 and RG1616 pixel formats
They are needed as "subformats" for higher bit YCbCr formats, such as
P010, and we don't plan to use or expose them otherwise. Thus don't
implement any conversion or packing features.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3244>
2023-09-13 14:11:27 +02:00
Jonas Ådahl
4ff54997b6 cursor-renderer/native: Create all view objects before realizing
Realizing a cursor will assume view related state objects are valid so
they can mark them as dirty. This assumption broke when there were a
scale changed that happened with multiple CRTCs, as we'd create view
object by view object as we realized the texture. Realizing the texture
would trigger a signal that had the handler assuming the validity of all
view objects, but if we only had gotten to the first, the second view
would not be there yet, thus we'd be doing a NULL pointer dereference.

Creating the view objects first, then handling the updating avoids this
problem by making the already done assumption valid on hotplugs.

The test case added tests exactly this series of events, and uses a
virtual monitor as a cheap trick to make the KMS CRTC based view the
first one, and an arbitrary view the second that previously had its view
object initialized too late.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3012
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3262>
2023-09-13 10:38:06 +00:00
Jonas Ådahl
c7efb68ff1 wayland/pointer: Update cursor surface when current surface changes
The cursor surface is decided by the "current" surface; if that alone
changed (e.g. current surface was destroyed), we didn't update the
cursor, meaning it either got stuck, or got hidden if the client exited
completely.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3262>
2023-09-13 10:38:06 +00:00
Jonas Ådahl
838d8881d9 tests/kms/cursor-hotplug: Remove extra trailing newline
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3262>
2023-09-13 10:38:06 +00:00
Jonas Ådahl
a4aaee06f6 tests/kms/hotplug: Add missing newline
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3262>
2023-09-13 10:38:06 +00:00
Jonas Ådahl
2e295e269c tests/kms-cursor-hotplug: Clean up virtual monitor at end of test
Otherwise it'll leak into the next test, when we add one.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3262>
2023-09-13 10:38:06 +00:00
Sebastian Wick
e3b659cfe8 monitor-manager: Add logging to enabling and disabling HDR mode
It's hard to tell why turning on HDR mode failed without these log
messages. It could be missing support in the sink (EDID/DisplayID) or
missing support in the driver/display hardware (connector properties) or
just a failure turning it on.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3251>
2023-09-13 08:19:23 +00:00
Sebastian Wick
c96341dcd5 output: Validate EDID information as UTF-8 only if it exists
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3021
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3268>
2023-09-12 20:48:18 +02:00
Sebastian Wick
4514d29c90 edid: Copy the Manufacturer Code char array to a NULL-term string
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3268>
2023-09-12 20:06:22 +02:00
Sebastian Wick
de4cf18bd0 edid: Move libdisplay-info and fallback code around
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3116>
2023-09-12 17:52:34 +02:00
Sebastian Wick
d382d55eae edid: Fix up libdisplay-info support
* The code did not compile before.
* Change the MetaEdidInfo struct to be more friendly to libdisplay-info
* Change to nit based luminance from encoded values

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2896
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3116>
2023-09-12 17:52:34 +02:00
Jonas Ådahl
4749c073eb monitor-manager/xrandr: Trap DPMS changes
Apparently DPMSForceLevel() can fail to force a valid level sometimes.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2857
Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6883
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3160>
2023-09-12 14:41:26 +00:00
Carlos Garnacho
4075847278 backends/native: Use correct constructor for CLUTTER_TOUCH_CANCEL events
We were using the generic constructor for BEGIN/UPDATE/END events, that
have more data than CLUTTER_TOUCH_CANCEL. Since that function checks for
the event type, we were awkwardly forwarding a NULL event here.

Related: https://gitlab.gnome.org/GNOME/mutter/-/issues/3016
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3261>
2023-09-12 13:38:16 +00:00
Jonas Ådahl
b6c7303ee9 window: Mark the suspend-state property with (skip)
The enum used is private, and lets for now declare it private API.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3018
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3263>
2023-09-12 10:46:58 +00:00
Daniel van Vugt
c7815f33a2 backends/x11: Trap errors from XIAllowTouchEvents
And report them as debug messages instead of crashing. We don't want them
to be visible usually because failures are expected in the autodeny
code path.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2808,
        https://launchpad.net/bugs/2029413

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3253>
2023-09-07 15:04:55 +08:00
Carlos Garnacho
80e15775a5 compositor: Fix surface accounting at MetaWindowActor
When the actor gets a new "main" surface assigned, it adds the
new surface to the stack of surface actors, but forgets to remove
the old one.

This stale pointer in the array may cause invalid reads and crashes
after the assigned surface is disposed, e.g. when destroying the
MetaWindowActor tries to disconnect signals from all accounted
surface actors.

Fixes: 9a2c8b2592 ("window: Add suspend state")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3252>
2023-09-06 18:13:00 +02:00
Joan Torres
33eef7211a launcher: Fix unrefing seat_proxy
When using meta-laucher headlessly, there isn't a seat_proxy.
In that context, doing directly g_object_unref gives an error.
This commit fixes it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3249>
2023-09-06 13:02:30 +00:00
Florian Müllner
bc74d166dd window: Really fix portrait orientation check for tiling
Commit 3bfcb6d1 fixed the check for tiling via keybindings, but
ignored a subtle edge case when tiling with the pointer: The
monitor used for tiling is the monitor with the pointer, which
is not necessarily the one that contains the largest part of the
window.

That is, the correct monitor to check against depends on the
context where the function is called. We can either figure
it out automatically via the current window drag, or make it
a parameter.

The latter is clearer, because the callers already decide which
monitor to use for tiling anyway.

Fixes: 3bfcb6d1b9 ("window: Fix portrait orientation check for tiling")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3248>
2023-09-06 12:36:57 +00:00
Carlos Garnacho
a6bda759f9 wayland: Do not trigger focus sync when destroying data offers
These objects are tied to the keyboard focus lifetime, but do not drive
it in any way. There is likewise no need to synchronize Wayland focus
when those are destroyed, that will be triggered through crossing events,
surface destroy notifications, etc...

Related: https://gitlab.gnome.org/GNOME/mutter/-/issues/2993
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3246>
2023-09-06 10:55:55 +00:00
Daniel van Vugt
7c8f1b4cc0 compositor/multi-texture-format: Cache snippets
These snippets are retrieved anew every time a window is resized. But
callers never modify them, they're effectively read-only so cache them
at the place of creation.

This is required to convince the pipeline hash that each reuse of the
same snippet really is the same snippet and so the pipeline is unchanged.
`CoglPipelineSnippetList` only does shallow comparisons and there's no
need right now to reimplement it as a deep comparison.

This eliminates the log message:

> Over 50 separate %s have been generated which is very unusual,
> so something is probably wrong!

which isn't actually a leak but more a warning about wasting time.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6958
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3224>
2023-09-06 10:26:48 +00:00
Carlos Garnacho
6427b5b1f6 backends/x11: Prevent uneven error traps init/deinit on GInitable failure
GInitable initialization is failable, currently, it may fail before error
traps are initialized, but error traps would be invariably deinitialized on
finalize() of the failed object. This results in an assert hit, on top of the
original failure to initialize the backend.

The libX11 error handlers are a pure client-side construct, and not a server
request, they just need XInitThreads() called to set up the library-side locks
protecting access to the global variable. This is done beforehand already at
meta_backend_x11_init(), so initialize the error traps around that time too.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3242>
2023-09-06 10:03:21 +00:00
Carlos Garnacho
cc874f5d33 x11: Avoid poking MetaCompositor during MetaDisplay destruction
Commit 9c3b130f67 changed slightly destruction order to handle use-after-free
situations, but missed a small new one introduced by the order change: The
MetaX11Display may schedule callbacks through MetaLaters, which depend on the
MetaCompositor, which is now freed before the MetaX11Display.

Since there is no winning move here, make the MetaX11Display aware of this
by avoiding to remove the callback if the MetaCompositor is already gone.
The MetaLaters infrastructure is already fully freed at this point (incl. the
data it contained), so this shouldn't be a leak.

Fixes: 9c3b130f67 ("display: Fix destruction order")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3247>
2023-09-06 09:28:09 +00:00
Uzair Ahmad
3bfcb6d1b9 window: Fix portrait orientation check for tiling
Use work area from the monitor that the window is currently on to
determine if tiling should be allowed.

Window tiling is disabled for monitors with portrait orientation, but
the work area we use to detect portrait orientation is taken from the
monitor that currently has the mouse pointer.

This works fine for edge tiling using the mouse, but this is broken when
using keybindings for window tiling because your mouse pointer could be
on a different monitor that has horizontal orientation.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3199>
2023-09-05 20:13:48 +00:00
Bilal Elmoussaoui
81a12a7db4 cleanup: Replace cairo_matrix_t with graphene_matrix_t
Reduce cairo usage where graphene can do a much better job

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3243>
2023-09-05 18:25:49 +00:00
Jeremy Cline
379996a63e onscreen/native: Check frame_info for null in finish frame callback
While adjusting the monitor layout of my docked laptop, mutter got a
segfault while attempting to dereference the frame_info struct. This
happened on gnome-shell 44.4-1.fc38.

cogl_onscreen_peek_head_frame_info() just forwards the call to
g_queue_peek_head() which returns NULL in the event that the queue is
empty. If finish_frame_result_feedback() is expected to always be called
with a non-empty queue there's still a bug somewhere, but regardless
this API can legitimately return NULL so it should be checked for prior
to dereferencing.

Fixes: 61801a713a ("onscreen/native: Avoid freezing the frame clock on failed cursor commits")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3229>
2023-09-05 16:26:49 +00:00
Jonas Ådahl
fddcf8ca91 renderer/native: Don't drop disable-only mode set updates
If we are making an update that only disables CRTCs, we would not
actually post it, but just drop it then post nothing, as it wasn't ever
added to the mode set update hash table. This resulted in hotplugs where
we loose the all the connectors we had, where we want to disable all
CRTCs and enable nothing, to fail to disable said CRTCs.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3073>
2023-09-05 12:41:41 +00:00
Jonas Ådahl
15a3c47df5 eis: Rebuild absolute pointers when any viewport changes
This fixes remote desktop client side resize via changing virtual
monitor stream sizes.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3241>
2023-09-04 12:14:42 +02:00
Jonas Ådahl
1a1a16324b remote-desktop/session: Only add configured streams as viewports
This means they will have a valid size/position. This makes absolute
pointer events work on virtual monitor streams again.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3241>
2023-09-04 12:14:42 +02:00
Jonas Ådahl
264d29b435 screen-cast/session: Use add_stream() helper everywhere
It was introduced, but using it everywhere appropriate was forgotten.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3241>
2023-09-04 12:14:42 +02:00
Jonas Ådahl
242737c4dc screen-cast/stream: Add 'is-configured' property
When this is TRUE, it has a size, position etc. Only virtual streams do
this asynchronously, as they go via monitor configuration after being
created.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3241>
2023-09-04 12:14:42 +02:00
Jonas Ådahl
731c3e0ba3 screen-cast/stream: Keep track of object properties
This will make it possible to emit notify events without going via
strings.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3241>
2023-09-04 12:14:42 +02:00
Barnabás Pőcze
9c3b130f67 display: Fix destruction order
MetaCompositorX11 might need the MetaDisplay's x11_display
during shutdown (meta_sync_ring_destroy -> meta_sync_free),
and `meta_display_shutdown_x11()` needs the MetaStack as
it calls `meta_stack_{freeze,thaw}()`. So fix the order
of destruction so that dependencies are destroyed
after dependants.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2852
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3202>
2023-09-03 23:31:37 +02:00
Barnabás Pőcze
d6b3679bd3 core: Subscribe to stack changes in the stack-tracker
This removes the implicit dependency on `display->stack_tracker`
existing and being valid in `on_stack_changed()` because
now it is the stack-tracker's responsibility to subscribe
to the "changed" signal of the stack and handle the changes.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3202>
2023-09-03 23:31:37 +02:00