1
0
Fork 0
Commit graph

32201 commits

Author SHA1 Message Date
Michel Dänzer
fab78d951a wayland/actor-surface: Don't sync actor state for frozen actors
This ensures that sub-surfaces remain visible during the fade-out
animation of their window.

Fixes: be4bf8da9c ("wayland/surface: Keep applied sub-surface branch node linked up")
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3508
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3840>
2024-06-25 13:35:46 +00:00
Michel Dänzer
03f3c18d27 window-actor/wayland: Sync actor state when actor is thawed
This is currently redundant, but will be needed with the next commit.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3840>
2024-06-25 13:35:46 +00:00
Carlos Garnacho
a48a149c61 backends: Use floating point checks in MetaViewportInfo
In these checks, it's an important detail to preserve subpixel information
in order to correctly determine whether the coordinates are inside or
outside a view.

Otherwise, small enough motion towards the left/top might get rounded
to 0, be seen as "inside the view", and the pointer coordinates be allowed
to escape the viewport constraints.

This was figured out by Pascal Nowack before me, with a difference of
minutes. Credit where credit is due.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3530
Fixes: 6c972546f1 ("mtk: Add Rectangle.contains_point")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3820>
2024-06-25 01:44:30 +02:00
Carlos Garnacho
32cb2ee720 mtk: Add mtk_rectangle_contains_pointf()
This variant works on floating point coordinates, in order
to avoid undesired effects with rounding.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3820>
2024-06-25 01:44:30 +02:00
Georges Basile Stavracas Neto
de2aac7a3d src/seat-impl: Keep device variable alive for longer
In meta_seat_impl_remove_virtual_input_device(), the 'device'
variable is first removed from MetaSeatImpl, then a "device
removed" event is generated with it.

The problem here is that, if this is the last reference of
'device', the removal from MetaSeatImpl will destroy it. Then
the freed variable will be used to create the "device removed"
event, which is a use-after-free situation.

Fix that by owning an extra ref to 'device' as long as the
function is executing. Do this by declaring a g_autoptr
variable with the extra ref. This g_autoptr variable is cleaned
up by the end of the function, which achieves the desired effect.

Spotted by Coverity.

CID: #1594046
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3835>
2024-06-24 12:04:08 +00:00
Bilal Elmoussaoui
cb4b31f858 clutter: Don't generate unused keys_by_name table
Spotted by codeql

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3837>
2024-06-22 23:53:49 +00:00
Bilal Elmoussaoui
43dabfc8d1 clutter: Remove unused static function
Detected through codeql

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3837>
2024-06-22 23:53:49 +00:00
Bilal Elmoussaoui
6e1c761330 Remove unused variables
Detected through codeql

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3837>
2024-06-22 23:53:49 +00:00
Florian Müllner
42e5c7bd9c Bump API version
It has been a while since we branched, and there have been enough
divergence already to justify a bump.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3836>
2024-06-22 15:01:25 +02:00
Michel Dänzer
eb8c2f600a kms/impl-device: Use priv->path in _open_non_privileged_fd
This can work even if priv->device_file == NULL, e.g. with a secondary
GPU with no displays connected.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3833>
2024-06-21 21:39:41 +00:00
Sebastian Wick
4eacf97678 wayland/surface: Send unmapped signal when the surface goes away
This was the intention anwyway but it didn't work properly because
GObject::dispose removes all signal handlers and we unmap surfaces in
WaylandShellSurface::finalize. Move all the unmanaging and unmapping to
the dispose vfunc where we can still run all the signal handlers.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3501
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3783>
2024-06-21 22:07:45 +02:00
Sebastian Wick
3e7b1d9cbd wayland: Handle unmapping surfaces
Right now the unmapped signal doesn't always fire which means we didn't
see a surface that's being unmapped in these code paths before. In
particular the resource, window and role can be gone. Handle those
cases.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3783>
2024-06-21 22:07:42 +02:00
Sebastian Wick
dbdc8dd958 wayland/activation: Keep around all pending activation reuqests
Instead of throwing away and not finishing a previous request, let's
queue up all activation requests until a window becomes mapped or
unmanaged.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3798>
2024-06-21 18:44:25 +00:00
Sebastian Wick
750459ddfe wayland/activation: Activate existing window with activations only
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3798>
2024-06-21 18:44:25 +00:00
Sebastian Wick
b9ba34ac6f wayland/activation: Fix signal callback signature
Parameter notify signals have a GParamSpec as second parameter.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3523
Fixes: c166b3fc5 ("wayland/activation: Apply xdg-activation request when window gets mapped")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3798>
2024-06-21 18:44:25 +00:00
Jonas Ådahl
b41d1437a7 tests/backend: Make test device removal function name consistent
The add function is add_test_device(), but the remove one was
remove_device(). Lets add a test_ to the former to make them consistent.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3812>
2024-06-21 17:22:20 +00:00
Jonas Ådahl
465af4b2d3 build: Make native backend mandatory for all tests
This allows us one less level of indentation of all the tests. It is not
entirely true, the X11 backend test case script can run without it, but
it isn't valuable enough to run without the native backend being enabled
to complicate building.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3812>
2024-06-21 17:22:20 +00:00
Jonas Ådahl
24a8ef5033 build: Fix KVM tests summary
It used the option, and ignored `have_tests`.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3812>
2024-06-21 17:22:20 +00:00
Jonas Ådahl
a3082b8eb3 backend/native: Let get_seat_id() handle all modes
Instead of having get_seat_id() handle most cases, and then special
casing another case outside of it, let it handle them all, making all
users just able to call get_seat_id().

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3812>
2024-06-21 17:22:20 +00:00
Jonas Ådahl
16efcd4f9a Stop using xvfb-run in tests
Except the X11 backend test, it still needs an X server. Eventually we
can replace it with the equivalent that uses Xwayland, but that needs a
"scaled down" mutter that runs as the host compositor for Xwayland, that
doesn't expose anything on the session bus.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3812>
2024-06-21 17:22:20 +00:00
Jonas Ådahl
cb5b2dbaa7 tests/monitor-manager: Hook back up the 'handles_transforms' state
Now directly changing the CRTCs, where it'll be used via MetaCrtcNative.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3812>
2024-06-21 17:22:20 +00:00
Jonas Ådahl
dfb56fcd65 x11/nested: Remove a vfunc that was only used by the test backend
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3812>
2024-06-21 17:22:20 +00:00
Jonas Ådahl
bed5875f30 tests: Make the test backend derive from the native backend
It's constructed as a native backend headless backend, but uses a custom
monitor manager (based on MetaMonitorManagerNative) that creates a fake
monitor. Rendering is unconditionally done with the surfaceless
renderer.

The test devices used now use virtual devices, meaning some changes to
the tests to e.g. not set names, and not dealing with input devices
directly.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3812>
2024-06-21 17:22:20 +00:00
Jonas Ådahl
e6fc515ea4 backend/native: Export output, crtc and monitor manager types
They will be derived from the test backend, which lives in its own
library.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3812>
2024-06-21 17:22:20 +00:00
Jonas Ådahl
81ff760b10 backend/native: Move update_viewports signal connection to post_init()
This is where the viewports are updated, and so lets move connecting the
signal together with it. It also helps a future change to the test
backend where it creates a custom monitor manager.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3812>
2024-06-21 17:22:20 +00:00
Jonas Ådahl
4b29d81a78 monitor-manager: Remove unused is_transform_handled() vfunc
This leaves some dead code in the test monitor manager, but lets leave
it there for now and actually hook that up to something again later.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3812>
2024-06-21 17:22:20 +00:00
Jonas Ådahl
c8d3465e83 tests/monitor-manager: Move out CRTC and output to separate files
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3812>
2024-06-21 17:22:20 +00:00
Jonas Ådahl
b94a5de39d tests/monitor-unit: Don't double remove test touch devices
Test touch devices are autocleaned up, but if a test case explicitly
needs it to be removed at a certain point, make sure to also clear the
pointer so that it doesn't get removed twice.

Right now it's harmless, but in a later commit it'll expected to only
remove a device once.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3812>
2024-06-21 17:22:20 +00:00
Jonas Ådahl
5fee5da3d2 tests/monitor-unit: Remove trailing whitespace
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3812>
2024-06-21 17:22:20 +00:00
Jonas Ådahl
5fc60eac9d seat-impl: Keep track of virtual input devices too
Virtual input devices too are dealt with inside the input thread, as
without this, things like touch mode won't get updated correctly.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3812>
2024-06-21 17:22:20 +00:00
Jonas Ådahl
54ba9448ed backend/native: Rename test mode to TEST_VKMS
A later commit will add another test mode mode.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3812>
2024-06-21 17:22:20 +00:00
Jonas Ådahl
d9d2f2c06f monitor-manager/native: Make type derivable
Will be derived by the test backend to override some state for testing
purposes.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3812>
2024-06-21 17:22:20 +00:00
Jonas Ådahl
4bdc51454d backend/native: Make type derivable
This will be used as the basis for the test backend, instead of the
nested X11 backend.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3812>
2024-06-21 17:22:20 +00:00
Daniel van Vugt
5745b397f8 onscreen/native: Return the framebuffer by result, not parameters
`update_secondary_gpu_state_post_swap_buffers` decides what our front
buffer object will be. There is only one answer. So return it as the
function result instead of making the caller figure it out.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3830>
2024-06-21 15:46:48 +00:00
Daniel van Vugt
88b7f00085 onscreen/native: Remove frame parameter from flip_crtc
It's always equal to `onscreen_native->next_frame` and we can't eliminate
that copy so easily. Removing the parameter removes all ambiguity about
where the next frame will come from.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3829>
2024-06-21 15:10:37 +00:00
Georges Basile Stavracas Neto
5cfbe2528c clutter/cally-actor: Ensure accessible lives long enough
Inside the "if (clutter_actor_has_accessible (actor))" condition,
the 'atk_child' variable is set and a signal is emitted on it.
There is a classic ref/unref dance around the signal to guarantee
that 'atk_child' won't be destroyed.

However, this ref/unref dance doesn't work, because the unref is
done *before* the 'atk_child' variable is used again. So if this
was the last reference to it, it would have been destroyed in the
unref call, then used for another signal emission a few lines down.

That's a use-after-free.

Fix that by declaring the 'atk_child' variable with g_autoptr. This
delays the unref until the very end of the function, and is NULL safe.
Also add a sneaky assertion, just for extra safety.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3828>
2024-06-21 14:40:47 +00:00
José Expósito
e4c749e5f2 native/kms-lease: Fix uninitialized autoptr
Spotted by Coverity.

CID: #1594038
Fixes: 4a5fcef38d ("native/kms-lease: Implement leasing out a set of connectors")
Reported-by: Carlos Garnacho <carlosg@gnome.org>
Link: https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3746#note_2147092
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3831>
2024-06-21 13:57:21 +00:00
Florian Müllner
18924aeae0 ci: Build gsettings-desktop-schemas from git
Needed for accent-color support in gnome-shell.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3826>
2024-06-21 14:19:34 +02:00
Sebastian Wick
397c8763a4 tests/kvm: Update the kernel to prevent hangs with newer mesa
Starting in mesa 24.1 (good in 24.0.9, bad in 24.1.1), the current
kernel somehow manages to hang our VKMS based tests. Let's update the
kernel so we can bump the CI image without running into those hangs.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3826>
2024-06-21 14:18:24 +02:00
Милош Поповић
09ddfc00b4 Update Serbian translation 2024-06-20 20:34:46 +00:00
Jonas Ådahl
8d5beea246 wayland: Add DRM lease manager
Now that all the required pieces to support DRM lease are in place,
expose the protocol.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3746>
2024-06-20 09:31:02 +00:00
Jonas Ådahl
a76708350f wayland/drm-lease: Handle DRM lease requests
When a client wants to lease DRM resources, it will attach the list of
connectors is wants to lease and then submit the request.
Once the request is submitted, destroy the DRM lease request object.

Co-authored-by: José Expósito <jexposit@redhat.com>
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3746>
2024-06-20 09:31:02 +00:00
Jonas Ådahl
5e5d5f0ecb wayland/drm-lease: Update available devices
When a new device is connected, register a new global for it.

When a device is gone, remove the global. Upon receiving this event,
the client should destroy any matching wp_drm_lease_device_v1 object.

To destroy a wp_drm_lease_device_v1 object, the client must first
issue a release request. Upon receiving this request, send a released
event and destroy the object.

Co-authored-by: José Expósito <jexposit@redhat.com>
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3746>
2024-06-20 09:31:02 +00:00
Jonas Ådahl
a8a8404cdd wayland/drm-lease: Update available connectors
When the list of connectors available for lease changes send
wp_drm_lease_device_v1.connector events for added connectors and
wp_drm_lease_connector_v1.withdrawn events for removed connectors,
followed by a wp_drm_lease_device_v1.done event.

Co-authored-by: José Expósito <jexposit@redhat.com>
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3746>
2024-06-20 09:31:02 +00:00
Jonas Ådahl
fb08a597e1 wayland/drm-lease: Advertize initial connectors
After sending the drm_fd event, send zero, one or more connector events.
After all currently available connectors have been sent, send a
wp_drm_lease_device_v1.done event.

Co-authored-by: José Expósito <jexposit@redhat.com>
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3746>
2024-06-20 09:31:02 +00:00
José Expósito
145de4df8d wayland/drm-lease: Send non-master DRM fd
Some time after a client binds to the wp_drm_lease_device_v1 global,
send a drm_fd event.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3746>
2024-06-20 09:31:02 +00:00
Jonas Ådahl
536c52bdb1 wayland/drm-lease: Advertise initial devices
Advertise one wp_drm_lease_device_v1 global for each DRM node.

Co-authored-by: José Expósito <jexposit@redhat.com>
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3746>
2024-06-20 09:31:02 +00:00
José Expósito
4e4d88e537 kms/impl-device: Add function to get a non-master fd
Add meta_kms_impl_device_open_non_privileged_fd() that returns a
non-master file descriptor for a MetaKmsImplDevice.

It'll be required to implement wp_drm_lease_device_v1_send_drm_fd() in a
future commit.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3746>
2024-06-20 09:31:02 +00:00
Sebastian Wick
4a5fcef38d native/kms-lease: Implement leasing out a set of connectors
The manager keeps track of which connectors are leasable in general,
which connectors and resources are already part of a lease, and keeps
track of when leases get revoked.

When leasing out connectors, the required drm resources to drive the
connectors are included in the lease as well.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3746>
2024-06-20 09:31:02 +00:00
Sebastian Wick
647f45bfa6 native/crtc-kms: Don't assign leased primary planes to CRTCs
When a plane is leased, it is assigned to a CRTC which is leased. When
trying to find a primary plane for a modeset, skip the assigned planes
on leased CRTCs to avoid sharing the resources with the leased process.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3746>
2024-06-20 09:31:02 +00:00