1
0
Fork 0
Commit graph

32241 commits

Author SHA1 Message Date
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
Sebastian Wick
af8ef6cf02 native/crtc-kms: Unset config of CRTCs which are not part of a modeset
This allows us to keep track when primary and cursor plane assignments
on a CRTC are unassigned. With this commit, all planes which are
assigned are actually in use and can't be assigned to anything else.

We'll make use of that fact when we search for a leasable primary plane.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3746>
2024-06-20 09:31:02 +00:00
Sebastian Wick
46493a986b udev: Listen for lease events
Lease events are sent when drm leases disappear. This event will help us
track leased out drm resources.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3746>
2024-06-20 09:31:02 +00:00
Jonas Ådahl
aaa8cefc25 kms-device-impl: Implement leasing, revoking and listing leases
The lease_objects function takes connectors, CRTCs and planes which are
turned into a drm lease. The resulting lease can be revoked with
revoke_lease. With list_lessees the currently active leases can be
queried.

Co-authored-by: Sebastian Wick <sebastian.wick@redhat.com>
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3746>
2024-06-20 09:31:02 +00:00
Jonas Ådahl
498310ec7c monitor-config-manager: Consider leased CRTCs assigned
With leasing, we will give another client control over connectors but
they also need a CRTC to drive them. Those CRTCs won't be available to
the desktop/monitor-manager.

Co-authored-by: Sebastian Wick <sebastian.wick@redhat.com>
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3746>
2024-06-20 09:31:02 +00:00
Jonas Ådahl
a001dbae59 kms: Add 'device-added' signal
This signals when there was a mode setting device added.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3746>
2024-06-20 09:31:02 +00:00
José Expósito
7784c0d0aa kms/connector: Allow to force connectors for lease
Add an environment variable (MUTTER_DEBUG_LEASE_CONNECTORS) that allows
set a ":" separated list of connector names as available for lease.

The names of the connectors can be found in "/sys/class/drm".

To illustrate it with an example, the names of the connectors and its
status can be fetched with this command:

  $ for p in /sys/class/drm/*/status; do con=${p%/status}; echo -n "${con#*/card?-}: "; cat $p; done
  DP-1: disconnected
  DP-2: disconnected
  DP-3: disconnected
  DP-4: disconnected
  DP-5: connected
  DP-6: connected
  DP-7: disconnected
  eDP-1: connected
  HDMI-A-1: disconnected

And, to set "DP-5" and "DP-6" available for lease, the environment
variable can be set like:

  MUTTER_DEBUG_LEASE_CONNECTORS=DP-5:DP-6

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3746>
2024-06-20 09:31:02 +00:00
Jonas Ådahl
9da43a3420 kms/connector: Add 'for-lease' getter
This is intended to be used to filter out what connectors will be
available for lease, i.e. non-desktop ones.

Co-authored-by: Sebastian Wick <sebastian.wick@redhat.com>
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3746>
2024-06-20 09:31:02 +00:00
Sebastian Wick
9e6f8a250f monitor-config-manager: Use autoptr in more cases
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3746>
2024-06-20 09:31:02 +00:00
Pascal Nowack
0dd4080509 backends/screen-cast-stream-src: Always initially set buffer stride
When mutter creates a dma-buf buffer for screencasting, the buffers
stride will, among other attributes, also be defined.
However, mutter currently only sets the buffer stride, when actually
recording a frame, but not when adding it.
This behaviour disallows screencast consumers (clients) to already
import the respective buffer (i.e. for Vulkan creating a VkImage for the
dma-buf image), as the stride is not yet communicated to the client.

Since the stride won't change after adding the respective buffer,
directly set the buffer stride, when adding the PipeWire buffer. This
allows screencast consumers (clients) to do optimizations in their
encoding paths.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3827>
2024-06-20 07:14:09 +02:00
Jonas Dreßler
e0c1dff45c Revert "tests/clutter/conform: Wait for stage update right after showing stage"
This turned out to not be needed, see the preceding commit for the proper
fix.

This reverts commit 530659c643.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3807>
2024-06-19 13:54:15 +00:00