1
0
Fork 0
Commit graph

9583 commits

Author SHA1 Message Date
Jonas Ådahl
03242a4e2a tests/test-runner: Assorted style cleanup
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861>
2021-07-15 11:25:21 +02:00
Jonas Ådahl
e09de6787f context: Handle dealing with option entries
Users can add option entries, and it'll be part of the configuration
phase.

Create the main group manually to be able to set a user_data pointer;
this will be required to not have to rely on globals when parsing
options using a callback.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861>
2021-07-15 11:25:21 +02:00
Jonas Ådahl
3d2160b473 tests/unit-tests: Port to MetaContext
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861>
2021-07-15 11:25:20 +02:00
Jonas Ådahl
ccd8da336f context/test: Add 'before-tests' and 'after-tests' signals
Will be used to set up and tear down test infrastructure.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861>
2021-07-15 10:59:40 +02:00
Jonas Ådahl
bccd93a598 tests/native-headless: Port to MetaContext
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861>
2021-07-15 10:59:40 +02:00
Jonas Ådahl
82d9dda08a context/test: Add helper to run a test session
Takes care of setup, starting, running, and terminating, as well as
running the GLib test suite.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861>
2021-07-15 10:59:40 +02:00
Jonas Ådahl
6732e3e585 main: Temporarily tie meta_quit() to meta_context_terminate*()
Makes it possible for mutter internally to use meta_quit() both if we're
running using a MetaContext or the scattered functions.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861>
2021-07-15 10:59:40 +02:00
Jonas Ådahl
2e784e23a2 context: Add 'notify_ready()' vfunc and method
This intends to replace the call to `meta_register_with_session()` that
deals with X11 session management, and is called when the user is
"ready". In thet test context, doing that makes no sense, so make it a
no-op.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861>
2021-07-15 10:59:40 +02:00
Jonas Ådahl
4cd1154b3d context/test: Respect MUTTER_SYNC envvar
It just calls meta_set_syncing() accordingly. Is currently done by
meta_init() either when the env var is set, or when a command line
argument is passed.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861>
2021-07-15 10:59:40 +02:00
Jonas Ådahl
fddc631599 context/test: Enable 'scale-monitor-framebuffer' backend setting
This is done in all tests, so make life easier by doing it here.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861>
2021-07-15 10:59:40 +02:00
Jonas Ådahl
8bf7d5c155 context: Init debug utils during setup phase
Is currently done during meta_init().

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861>
2021-07-15 10:59:40 +02:00
Jonas Ådahl
ecc40e7b23 context: Init introspection paths during setup
This is currently done during meta_init().

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861>
2021-07-15 10:59:40 +02:00
Jonas Ådahl
a32b005848 context: Change to home directory during setup
Is currently done during meta_init().

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861>
2021-07-15 10:59:40 +02:00
Jonas Ådahl
6f4b973329 context: Initialize signal handlers during setup
Is currently done during meta_init().

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861>
2021-07-15 10:59:40 +02:00
Jonas Ådahl
8ace1bf3ea context: Init prefs when starting
Is currently done by meta_start().

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861>
2021-07-15 10:59:40 +02:00
Jonas Ådahl
02176eab83 context: Add start/run/terminate phases
The start phase creates the MetaDisplay object, and initializes Wayland, and
creates the main loop.

The run phase runs the main loop and handles returning an error if the
context was terminated with an error.

The terminate phase terminates the main loop, with or without an error.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861>
2021-07-15 10:59:40 +02:00
Jonas Ådahl
fe652518af context: Load plugin during setup phase
The plugin must be configured by the context implementation during the
configure phase.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861>
2021-07-15 10:59:40 +02:00
Jonas Ådahl
75f9085ab9 context: Add setup phase
During this phase, the backend is created and configured. Currently only
configured, but will gain more logic that currently main.c does with
various helpers.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861>
2021-07-15 10:59:40 +02:00
Jonas Ådahl
df8074c636 util: Export meta_set_syncing() symbol
Will be set by MetaContextTest, until we can move away from the function
completely.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861>
2021-07-15 10:59:40 +02:00
Jonas Ådahl
c45a1619f5 context: Set up locale on init
Taken from main.c, which does that when getting the main option context,
which happens to happen early in a process's lifetime.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861>
2021-07-15 10:59:40 +02:00
Jonas Ådahl
6e4d3e0f85 context: Add create_backend() vfunc
This lets the context implementation create a backend. Will later be
used in a 'setup' phase.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861>
2021-07-15 10:59:40 +02:00
Jonas Ådahl
434f5e5b7b context/test: Add test context type enum
A test context type will later determine what kind of backend the test
case should use; i.e. whether the nested or headless backend should be
used.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861>
2021-07-15 10:43:28 +02:00
Jonas Ådahl
8cb177499d context/test: Configure test setup during configuration
This includes setting up the GLib test framework, overriding the X11
and Wayland display names.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861>
2021-07-15 10:43:28 +02:00
Jonas Ådahl
bbf6d88d54 test-utils: Expose helper for ensuring client path
Will be used by the test context to reduce boiler plate.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861>
2021-07-15 10:43:28 +02:00
Jonas Ådahl
6c6b5b9a48 context: Add entry points for context configuration
Configuration is the first step of the lifetime of a context, after
creation; it's here where argc/argv is processed, and it's determined
what kind of compositor, etc, it is going to be.

The tests always run as Wayand compositors, so the configuration is
quite simple, but will involve more steps later on.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861>
2021-07-15 10:43:28 +02:00
Jonas Ådahl
bf84b2423d main: Move MetaCompositorType to a new meta-enums.h
It'll be part of and owned by MetaContext, intending to replace
`meta_is_wayland_compositor()`, but place it in a new file for public
enums so that it can be used from wherever.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861>
2021-07-15 10:43:28 +02:00
Jonas Ådahl
e17bf88d5e tests: Introduce MetaContextTest
This introduces a MetaContext implementation aimed to be used for test
cases, with as little boiler plate as possible needed in the test.

It currently doesn't do anything, just fills out the GObject boiler
plate and sets a name.

Build it into every core test, for compilation, even though it isn't
used anywhere yet.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861>
2021-07-15 10:43:28 +02:00
Jonas Ådahl
e020fdfddf Introduce mostly empty MetaContext type
This type is intended to replace the scattered functions used to
configure how the Mutter compositor is run. It currently doesn't do
anything, and only has a human readable name, intended to be set to e.g.
"GNOME Shell".

It's an abstract type, and is intended to be used via either a future
`MetaContextMain` for real display server use cases, and a
`MetaContextTest` for test cases.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861>
2021-07-15 10:43:28 +02:00
Jonas Ådahl
23b79f33fa launcher: Remove open/close restricted file API
It has since some time been replaced with MetaDevicePool, and isn't used
by anything anymore, so remove it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1929>
2021-07-13 12:19:14 +00:00
Ivan Molodetskikh
1116b14f38 backends/native: Get rendering and swap timings during scanout
Scanout doesn't go through the usual path of compositing and doing
eglSwapBuffers, therefore it doesn't hit the timestamp query placed in
that path. Instead, get the timings by binding the scanout buffer to an
FBO and doing a timestamp query on the FBO.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1762>
2021-07-13 08:09:42 +00:00
Ivan Molodetskikh
5a0d3ed4dd backends/native: Remove unneeded NULL check
There seems to be no way to construct this type with an invalid bo.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1762>
2021-07-13 08:09:42 +00:00
Ivan Molodetskikh
8c258d1de1 cogl: Add CPU swap time and GPU rendering query to CoglFrameInfo
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1762>
2021-07-13 08:09:42 +00:00
Ivan Molodetskikh
3aa0e3074f clutter: Store vblank duration in ClutterFrameClock
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1762>
2021-07-13 08:09:42 +00:00
Ivan Molodetskikh
d10567ea3e clutter: Add vblank duration to ClutterStageView
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1762>
2021-07-13 08:09:42 +00:00
Ivan Molodetskikh
2d939754b1 crtc-mode-info: Add vblank duration field
Only populated for KMS backed modes, as that's where it's relevant.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1762>
2021-07-13 08:09:42 +00:00
Ivan Molodetskikh
e40ff9d8b7 backends/native: Add meta_calculate_drm_mode_vblank_duration_us()
Computes the vblank duration from mode timings.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1762>
2021-07-13 08:09:42 +00:00
Daniel van Vugt
9f492a0ee0 kms: Add fixed point formatting to MUTTER_DEBUG=kms printing
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1923>
2021-07-13 15:29:14 +08:00
Daniel van Vugt
b59c5386b9 kms: Add a trivial meta_fixed_16_to_double conversion function
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1923>
2021-07-13 15:26:43 +08:00
Daniel van Vugt
ea75ea0b73 kms: Add an internal MetaKmsPropType to distinguish fixed point values
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1923>
2021-07-13 15:26:43 +08:00
Jonas Ådahl
c2c41bbf0a tests/kms-utils: Add some basic 16:16 fixed tests
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1927>
2021-07-09 22:40:06 +00:00
Jonas Ådahl
021a401bc8 tests: Move out KMS utils unit tests to its own executable
Better to split things up a bit, so one can with more ease run a
specific test.

In the KMS utils case, we don't even need a mutter context, making it
much lighter.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1927>
2021-07-09 22:40:05 +00:00
Carlos Garnacho
ec390b68c5 wayland: Implement the xdg-activation protocol
This protocol implements the IPC necessary to focus application
windows across launcher/launchee. Add support for it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1845>
2021-07-09 09:34:28 +00:00
Carlos Garnacho
665081d268 core: Add ::timeout signal to MetaStartupSequence
These objects are missing explicit notifications about when they
are going away by themselves, add one.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1845>
2021-07-09 09:34:28 +00:00
Carlos Garnacho
2115debd09 build: Add xdg-activation to build
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1845>
2021-07-09 09:34:28 +00:00
Carlos Garnacho
256939cb84 build: Add support for "staging" wayland protocols
These come in a different folder, with no stable/unstable nomenclature.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1845>
2021-07-09 09:34:28 +00:00
Daniel van Vugt
d996319cf9 kms: Add a missing g_set_error on error
So the GError is not left NULL and then dereferenced.

Fix provided by Jonas Ådahl <jadahl@gmail.com>

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1878
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1925>
2021-07-09 16:26:11 +08:00
Florian Müllner
357c506ee7 events: Only support super+scroll on wayland
On Xorg, the event only reaches us when the pointer is within the
stage input region. That makes the feature more confusing than
useful, so make it wayland-only.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3759

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1922>
2021-07-08 00:02:41 +02:00
Jonas Ådahl
ce5a5789bb native: Release output device files that are unused
In order to make it possible to e.g. unload an unused DRM device, we
need to make sure that we don't keep the file descriptor open if we
don't need it; otherwise we block anyone from unloading the
corresponding module.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1828>
2021-07-07 21:10:30 +02:00
Jonas Ådahl
3c47661b78 egl: Add eglBindAPI helper
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1828>
2021-07-07 21:03:26 +02:00
Jonas Ådahl
173d895d53 kms: Remove now unused API to get file descriptor
The last user switched to using MetaDeviceFile, so time to clean up.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1828>
2021-07-07 21:03:26 +02:00
Jonas Ådahl
10c4bc6e3f drm-buffer: Create from MetaDeviceFile instead of MetaKmsDevice
The DRM buffers aren't really tied to mode setting, so they shouldn't
need to have an associated mode setting device. Now that we have a
device file level object that can fill this role, port over
MetaDrmBuffer and friends away from MetaKmsDevice to MetaDeviceFile.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1828>
2021-07-07 21:03:26 +02:00
Jonas Ådahl
6613463f58 renderer/native: Decouple device file from MetaKmsDevice
Keep a private MetaDeviceFile instance for the GPU's managed by the
renderer. This is a step towards decoupling rendering from mode setting,
as well as on-demand holding of device file descriptors.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1828>
2021-07-07 21:03:26 +02:00
Jonas Ådahl
e567cb972d renderer/native: Get 'uses-monotonic' state from MetaKmsDevice
It's better suited to be handled by the MetaKmsDevice abstraction.

This eliminates the last caller of drmGetCaps() from outside
MetaKmsImplDevice.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1828>
2021-07-07 21:03:26 +02:00
Jonas Ådahl
86c4369f41 renderer/native: Look up prefers-shadow cap via MetaKmsDevice
This eliminates the second last user of drmGetCap() from outside of
MetaKmsImplDevice.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1828>
2021-07-07 21:03:26 +02:00
Jonas Ådahl
93f9c99cc5 kms/impl-device: Set universal plane client cap when opening file
This means it will be set again if the file is reopened.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1828>
2021-07-07 21:03:26 +02:00
Jonas Ådahl
5502f956f5 device-file: Add tags
Tags are meant to make it possible for a device file opener to tag a
file if it has affected the state the file descriptor is in; e.g. if it
has enabled a DRM capability.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1828>
2021-07-07 21:03:26 +02:00
Jonas Ådahl
ceff2a93ca renderer/native: Create dummy offscreens if onscreens fail to allocate
This is less dramatic than aborting, and could in theory be a temporary
issue, so handle it by rendering into an offscreen.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1828>
2021-07-07 21:03:26 +02:00
Jonas Ådahl
db1d35c53d kms/mode: Recreate blob id each mode set
This simplifies the blob management and isn't that less efficient that
it matters.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1828>
2021-07-07 21:03:25 +02:00
Jonas Ådahl
3c9ab768ec launcher: Remove now unused file management API
The open/close helpers for (maybe) restricted files has been replaced
with MetaDevicePool, so lets remove that functionality from here.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1828>
2021-07-07 21:03:25 +02:00
Jonas Ådahl
7ce266628e seat-impl: Open/close files via device pool
This replaces going through MetaLauncher to open/close restricted files.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1828>
2021-07-07 21:03:25 +02:00
Jonas Ådahl
f6f9c093ba clutter/seat: Remove backend pointer
It was unused, and having a pointer to the MetaBackend in subtypes is
more useful, so remove it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1828>
2021-07-07 21:03:25 +02:00
Jonas Ådahl
b4cf839e87 device-pool: Add way to open files read-only
Will be used by libinput's tablet device led device files.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1828>
2021-07-07 21:03:25 +02:00
Jonas Ådahl
a845a07a92 device-pool: Handle interrupted open()
Handle open() failing due to being interrupted by trying again until it
either succeeds, or fails due to some other error. This was an error
handling path taken when opening sysfs files; do the same here to not
potentially regress once we open sysfs files with the device pool.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1828>
2021-07-07 21:03:25 +02:00
Jonas Ådahl
3d882b6410 device-pool: Only fetch major/minor for taken devices
It's only when we take/release from/to logind we need these two
integers, so only retrieve them when that's done. Making this change
makes it possible to open devices that don't have these parameters.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1828>
2021-07-07 21:03:25 +02:00
Jonas Ådahl
e6421dc5da kms: Have the device impl open device files themself
This changes the way the KMS backends load; if we're headless, we always
use the dummy one and fail otherwise; in other cases, we first try the
atomic backend, and if that fails, fall back on the simple one.

The aim for this is to have the impl device open and close the device
when needed, using the device pool directly.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1828>
2021-07-07 21:03:25 +02:00
Jonas Ådahl
f3457b678c kms/device: Use device pool to open/close dri devices
This replaces the usage of MetaLauncher.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1828>
2021-07-07 21:03:25 +02:00
Jonas Ådahl
ee8c252a8c native: Add device pool for tracking device file descriptors
This practically does the same thing as part of MetaLauncher, except
with added thread safety and caching. For example, opening the same file
a second time will return the same MetaDeviceFile, and only once all
acquired MetaDeviceFile's are released, will the file descriptor be
closed and control of the device released.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1828>
2021-07-07 21:03:25 +02:00
Carlos Garnacho
44af2c0d37 core: Be more careful around n_modes signedness
This is returned as an integer, which we deal with as an unsigned
integer. Deal with it as an integer all along, and skip safely
negative values.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1920>
2021-07-07 18:37:54 +02:00
Carlos Garnacho
841ee0a227 backends/native: Fix logic error
ClutterInputDevice's get_group_n_modes() vfunc is meant to return
-1 for groups that are out of the known range, not within. Fix the
early return condition, and let the native backend return correctly
the number of modes for the given group.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1920>
2021-07-07 18:37:54 +02:00
Jonas Ådahl
8ca087fee9 kms/impl-device/simple: Pass the NULL to discard_page_flip() on shut-down
The second argument is an optional GError, not an impl device pointer.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1911>
2021-07-07 14:51:46 +00:00
Christian Rauch
258b85a5a7 tests: Add test for setting min/max wayland toplevel limits
Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1716
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1795>
2021-07-06 09:11:10 +00:00
Jonas Ådahl
8c5b7ddc48 tests/wayland-test-driver: Add generic "sync point" request
This can be used by test cases to make sure the compositor tries
something after a known client state.

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1716
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1795>
2021-07-06 09:11:10 +00:00
Jonas Ådahl
151c80d2ef tests: Move Wayland test driver helper protocol to its own file
While at it, make it a GObject so one can add signals to it.

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1716
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1795>
2021-07-06 09:11:10 +00:00
Christian Rauch
aacdc0b6f1 wayland: Apply states without needing a newly attached buffer
Applying some states, such as the minimum and maximum toplevel size, do not
require a new buffer and can operate on the old buffer. Requiring a client
to commit a new buffer just to change such states prevents setting limits
on an already existing surface buffer.

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1716
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1795>
2021-07-06 09:11:10 +00:00
Zander Brown
b3fb1ebaac meta: Drop meta_backend_set_numlock from header
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1916>
2021-07-05 23:01:13 +01:00
Michel Dänzer
8de0771aad screen-cast/area-src: Add before-paint watch to catch scanouts
Scanouts are taken away after painting. However, when we're
streaming, what we actually want is to capture whatever is
going to end up on screen - and that includes the scanout
if there's any.

Add a before-paint watch that only records new frames if a
scanout is set.

Inspired by (and commit log mostly copied from) e6a13e5d57
("monitor-stream-src: Add before-paint watch to catch scanouts").

v2:
* Do not call stage_painted from before_stage_painted (Georges Basile
  Stavracas Neto)

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1707
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1902>
2021-07-05 15:57:20 +00:00
Michel Dänzer
7bcbf6d5c7 screen-cast/area-src: Drop phase parameter from add_view_painted_watches
It was always META_STAGE_WATCH_AFTER_ACTOR_PAINT.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1902>
2021-07-05 15:57:20 +00:00
Jonas Ådahl
9542c713ad window/wayland: Replace constraint side effect peeking with state checks
When the MetaWindow resize machinery for toplevels ended up in the
Wayland window implementation, we tried to avoid configuring
not-yet-mapped windows that just had its zero sized dimension pass
through the constraint machinery, resulting in a 1x1 sized window.

If we'd properly set up the min size metadata earlier, that 1x1 would
likely be the minimum size set of a window, which makes things harder to
predict when peeking at side effects.

However, what the side effect peeking intends to do, as documented in
the comment, was to figure out when the client hadn't committed any
buffer yet, i.e. during the initial map, and in those cases avoid
sending that nasty 1x1 size, resulting in silly window sizes. A more
robust way to detect this is instead checking when we shouldn't really
try resize things our own way, and in those cases early out as was done
before.

This means that, for a yet to me mapped window, we only ever want to
send an initial non-zero configuration when 1) it's initially maximized,
2) initially fullscreen, or 3) initially tiled in any way, as those are
the situations where the compositor is the one deciding the size.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1912>
2021-07-05 10:27:58 +00:00
Jonas Ådahl
80caf12461 tests/stacking: Add test for initially fixed size windows
E.g. map a window maximized or fullscreen.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1912>
2021-07-05 10:27:58 +00:00
Jonas Ådahl
1d7920872d kms: Gracefully handle page flipping direct scanouts failing
When drmModePageFlip() or drmModeAtomicCommit() unexpectedly failed (e.g.
ENOSPC, which has been seen in the wild), this failure was not handled
very gracefully. The page flip listener for the scanout was left in the
MetaKmsUpdate, meaning when the primary plane composition was later page
flipped, two page flip listeners were added, one for the primary plane,
and one for the scanout. This caused the 'page-flipped' event to be
handled twice, the second time being fatal.

Handle this by making 'no-discard' listener flag be somewhat reversed,
and say 'drop-on-error', and then drop all 'drop-on-error' listeners
when a MetaKmsUpdate failed to be processed.

Also for a "preserve" flagged update, don't ever trigger "discard"
callbacks just yet, as preserved updates are used again for the primary
plane composition, in order to not miss e.g. CRTC gamma updates, or
cursor plane updates, which were added separately.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1809
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1910>
2021-07-02 13:29:54 +00:00
Christoph Trassl
4b0fd9ab76 input-mapper: Fix (libwacom) tablet mapping to monitor
Remove early return when using libwacom, so guess_candidates returns
monitor candidates for those devices, too.

Additionally, changing the output of an input requires removing the
input from its current output first.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1712
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1887>
2021-07-01 06:36:33 +02:00
JoseExposito
dc919998b1 wayland/pointer-gestures: Fix swipe cancellation
The cancel phase for swipe gestures was not being handled, hence,
Wayland "end" events where not sent to clients when the gesture was
cancelled.

A swipe gesture is cancelled when extra finger(s) are put down on the
touchpad in the middle of the gesture or when some, but not all, of the
fingers are put up.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1857>
2021-06-15 22:22:30 +00:00
Jonas Ådahl
a0343b0abd renderer/native: Clear pending update list before repopulating
Before we did a simple copy, meaning the old list was overriden. Copy
was too eager, as it meant views without modes to set was waited for,
resulting in a dead lock. Instead only the relevant views were added to
the list for view which had pending updates needed. What was missed was
that the list was never cleared, meaning we just appended the new list
on top of the old, causing issues.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1846
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1843
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1844
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1895>
2021-06-12 21:09:55 +02:00
Jonas Ådahl
c0758c63b5 native: Properly ignore devices on init too
There is an udev rule marking whether a device should be ignored by
mutter or not, but it was only respected on hotplug events not on init,
partly defeating its purpose. Fix this.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1892>
2021-06-09 19:21:44 +00:00
Carlos Garnacho
fcdda41def wayland: Make implicit grabs during popups be owner_events=TRUE
Getting crossing events is necessary between client surfaces while
there is a popup grab in effect (e.g. allow press-drag-release in
menus), we should only stick with the focus surface while the pointer
is outside any client surface.

This partially undoes commit 79050004b0 (or, at least, mutter no
longer fixes the bug it claimed to fix). This will be addressed in
gtk4.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1885>
2021-06-09 19:00:15 +00:00
Jonas Ådahl
8478db96f9 renderer-native: Don't attempt to queue mode sets on non-onscreen views
A view is only a 'CoglOnscreen' if it ends up on a CRTC, thus needs a
mode. Other views are for virtual monitors, and require no mode setting,
so exclude them from the pending mode set list.

This avoids a dead lock when we'll be waiting indefinitely for mode
setting on a virtual monitor.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1891>
2021-06-09 17:40:34 +00:00
Jonas Ådahl
2a81c6d393 screen-cast: Clean up sessions on 'prepare-shutdown'
However, leave the remote desktop screen cast sessions to the remote
desktop manager to close.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1891>
2021-06-09 17:40:34 +00:00
Daniel van Vugt
ea626a5059 main: Avoid calling meta_wayland_compositor_get_default() on X11
Because it contains an assertion that will fail, and crash.
Started in 301d2c55c6.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1883>
2021-06-02 16:45:04 +08:00
Marco Trevisan (Treviño)
14c8f5f94c mutter-all.test: Run tests in a environment with display and bus set
The mutter tests require to run in a valid environment where a display
is available and a session bus, however currently we rely on the current
environment, and this may lead to unexpected behaviors.

So let's just ensure that a display is running through xvfb-run and
that a session bus is running in a temporary directory.

We also ensure to use the gsettings memory backend, even because by
setting TestEnvironment we ensure that no other env variable is leaked
to the test.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1876>
2021-05-26 21:23:29 +02:00
Jonas Ådahl
e15b4b8fbe test-runner: Disconnect display-opened signal on destruction
When running multiple tests at once (with --all) as in the
installed-tests cases, we may open and close the display multiple times,
this leads to setting the alarm filter each time that the x11 display is
opened (causing a critical error) because we never disconnect from the
::x11-display-opened signal.

So disconnect from the signal on test destruction, to avoid this to be
emitted multiple times.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1876>
2021-05-26 20:32:39 +02:00
Carlos Garnacho
4ed05830e2 wayland: Close pipe file descriptors after use
Both ends were being leaked here, one directly, other through the
GIOChannel.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4302
(just maybe)

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1870>
2021-05-25 16:31:07 +00:00
Jonas Ådahl
301d2c55c6 wayland: Make init and shutdown symmetric
We first initialized the Wayland infrastructure, then the display, but
on shutdown, we first teared down the Wayland infrastructure, then the
display.

Make things a bit more symmetric and tear down the display before
Wayland. This however means we need to tear down some things Wayland a
bit earlier than the rest. For now this is a separate function, but
eventually, it can be replaced with a signal shared by the backend's
'prepare-shutdown' signal.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1863>
2021-05-18 14:03:22 +00:00
Jonas Ådahl
dc97163bcd xwayland: Pass MetaWaylandCompositor pointer when initializing
This way we can initialize without having any way to retrieve it via
some global variable. This isn't needed now, but will be once Wayland
infrastructure initializiation is done in a single step.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1863>
2021-05-18 14:03:22 +00:00
Jonas Ådahl
d03c194552 wayland/output: Use the passed compositor pointer
This is especially important as we might end up here when initializing
the Wayland infrastructure. Later that will be done in one step, meaning
the "get_default()" function will not work properly.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1863>
2021-05-18 14:03:22 +00:00
Jonas Ådahl
5bc8823701 xwayland: Don't fetch global when shutting down DND
It might not be there when shutting down, so get it from a more managed
place. Note that this isn't strictly needed right now, but eventually,
the MetaWaylandCompositor pointer will be cleared using a g_clear*()
helper, which clears the pointer before freeing the instance, which
wouldn't work here.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1863>
2021-05-18 14:03:22 +00:00
Jonas Ådahl
b578a534a3 clutter: Remove Wayland server helper
It's a wrapper around a similar Cogl API we don't use anymore.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1863>
2021-05-18 14:03:22 +00:00
Jonas Ådahl
14eba8bb8f wayland: Bind Wayland EGL display ourselves
This will allow us less awkward startup, where previously we had to
pre-initialize Wayland very early so Cogl could bind the Wayland display
when it initialized. Move things around so we bind the Wayland EGL
display when initializing the rest of Wayland infrastructure.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1863>
2021-05-18 14:03:22 +00:00
Jonas Ådahl
5c77b640d4 egl: Add helper for eglBindWaylandDisplayWL
Lets us untangle awkward Cogl setup dependencies.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1863>
2021-05-18 14:03:22 +00:00
Jonas Ådahl
ebfeb106bc egl: Fly-by indentation fix
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1863>
2021-05-18 14:03:22 +00:00
Jonas Ådahl
dcf953ad3b idle-monitor: Use G_DECLARE_FINAL_TYPE()
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1859>
2021-05-18 13:19:36 +00:00
Jonas Ådahl
18d670e69f backends: Introduce MetaIdleManager
This object takes over the functionality of meta-idle-monitor-dbus.c,
meta-idle-monitor.c and meta-backend.c, all related to higher level
management of idle watches etc.

The idle D-Bus API is changed to be initialized by the backend instead
of MetaDisplay, as it's more of a backend functionality than what
MetaDisplay usually deals with.

It also takes over the work of implementing "core" idle monitors. The
singleton API is replaced with thin wrapper functions on the backend.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1859>
2021-05-18 13:19:36 +00:00
Jonas Ådahl
389432de46 backend/x11-cm: Add missing chain-up to finalize()
Reported by @muktupavels.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1869>
2021-05-17 19:22:25 +02:00
Jonas Ådahl
243dd868b6 main: Move grab op macro to relevant file
It was in main-private.h for some reason, but only used in display.c.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1833>
2021-05-17 16:08:42 +00:00
Jonas Ådahl
b0a73f04b7 main: Move rect related macro to util-private.h
No reason that it should be in main-private.h, lets place it in
util-private.h. This also mean we can remove main-private.h.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1833>
2021-05-17 16:08:42 +00:00
Jonas Ådahl
c6329807c2 x11/session: Remove #if 0:ed out declaration
Not used, no idea what it was for, but it serves no purpose, so lets
remove it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1833>
2021-05-17 16:08:42 +00:00
Jonas Ådahl
3bb6865912 stage/x11: Fix clutter backend variable naming
Being in backends/, `backend` tends to refer to a `MetaBackend`, so
avoid that naming convention for things that are not, e.g. clutter
backends.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1833>
2021-05-17 16:08:42 +00:00
Jonas Ådahl
475296ee9a tests/clutter: Don't have tests take arguments
It just complicates things; we can't run them right now, so just get rid
of the runtime variability; just change the macros if you want to tweak
the test, would you be able to get it running.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1833>
2021-05-17 16:08:42 +00:00
Jonas Ådahl
af501ac472 prefs: Make init function private
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1833>
2021-05-17 16:08:42 +00:00
Jonas Ådahl
7b390b4c5b display: Don't have the display meta_quit() when closing
Instead only do that e.g. when we're being replaced; elsewhere let the
one intending to actually quit, do the quitting.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1833>
2021-05-17 16:08:42 +00:00
Jonas Ådahl
6558d43cd5 main: Let the X11 CM backend deal with selecting the display
It's specific to that backend, so do it there.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1833>
2021-05-17 16:08:42 +00:00
Jonas Ådahl
89053cc6f7 display: Make meta_display_open() report errors
Instead of just exit():ing, report the error, so the caller can decide
how to deal with the error.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1833>
2021-05-17 16:08:42 +00:00
Jonas Ådahl
c9992a2953 main: Initialize Wayland just before MetaDisplay
Wayland support is not really a "backend" thing, it just lacked a better
place to store its instance pointer. Eventually we'll have a better
place, but prepare for that by initializing it together with the more
similar subsystems.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1833>
2021-05-17 16:08:42 +00:00
Jonas Ådahl
270f1cf7a5 tests/runner: Check compositor type instead of X11 policy
It's practically equivalent, and means we can soon ditch the global.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1833>
2021-05-17 16:08:42 +00:00
Jonas Ådahl
6c1793b7d3 Rename MetaDisplayPolicy to MetaX11DisplayPolicy
This lack of X11 in the name was a bit confusing, since this is about
the X11 policy, not some policy of MetaDisplay.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1833>
2021-05-17 16:08:42 +00:00
Jonas Ådahl
f677e0cbfb display: Make the display handle its own prefs handlers
Two prefs were handled by display.c itself, and another in main.c.
Unscattter things a bit by moving the one in main.c to the others in
display.c.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1833>
2021-05-17 16:08:42 +00:00
Jonas Ådahl
9cd99ee7ac main: Move away debug flag management to util.c
The rest of debug flag details are in util.c and util.h, make things
less scattered by moving the rest to util.c too.

While at it, put the coredump:ability setting needed for being suid
there too, so we have a common place for initializing "debug utils".

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1833>
2021-05-17 16:08:42 +00:00
Jonas Ådahl
62ef293cdb main: Let session management code deal with DESKTOP_AUTOSTART_ID
No need to have that outside of meta_session_init().

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1833>
2021-05-17 16:08:42 +00:00
Pascal Nowack
25e2839339 screencast: Fix transform_position(), when using fractional scaling
Commit 64c9c9c5b0 fixed monitor
screencasting, when fractional screencasting is enabled.
For the remote desktop usage, NotifyPointerMotionAbsolute() submits
the new mouse pointer position in addition to the stream, where the
mouse pointer was moved.
When not using fractional scaling, the mouse pointer position is
correct.
With the usage of fractional scaling, the mouse pointer position is
wrong, as the scale of the position is applied two times.

Fix this behaviour, by reverting the second scale by dividing by the
logical monitor scale, when fractional scaling is used.

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1808
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1867>
2021-05-17 16:11:47 +02:00
Jonas Ådahl
4a057535e7 remote-desktop: Close sessions on prepare-shutdown
When finalizing, the MetaDisplay instance will already be gone, so to be
able to gracefully tear down the clipboard integration, make sure to
close sessions before the display is closed, i.e. on prepare-shutdown.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1853>
2021-05-11 16:18:13 +00:00
Olivier Fourdan
b03ccfff4d xwayland: Check the condition on displayfd ready
The callback on_displayfd_ready() would unconditionally set the return
value to TRUE, regardless of the condition.

Use the GIO condition to determine if there was data written and adjust
the return value accordingly.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1851>
2021-05-11 15:49:25 +00:00
Sebastian Keller
e423653017 xprops: Validate text properties that claim to be UTF8
Some clients such as mpv might set the WM_TITLE as a UTF8_STRING based
on some unconverted/unvalidated metadata that is not actually UTF8. This
would then be set as the title of a MetaWindow (in the absence of a
valid UTF8 _NET_WM_TITLE). The shell then tries to use this window title
for things like the overview or the window switcher where it would
trigger an UTF8 validation error and leave the shell in an unusable
state.

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1794
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1850>
2021-05-11 15:20:17 +00:00
kirbykevinson
64c9c9c5b0 clutter: Make stage capture support fractional scaling
This commit adds scaling support to clutter_stage_capture_into, which
is currently used when screencasting monitors. This is supposed to
fix graphical issues that arise when using fractional scaling.

Fixes #1131

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1855>
2021-05-08 22:27:52 +07:00
Jonas Ådahl
a49dc78396 remote-desktop-session: Don't recreate virtual device over and over
In 'remote-desktop-session: Create virtual input devices on demand' the
intention was to create input devices on-demand, but during a
refactorization of the code, instead the virtual input device was
recreated over and over. Lets fix that.

Fixes: a0af52caf0
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1799
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1858>
2021-05-07 13:16:27 +00:00
Jonas Ådahl
4490d4524b xwayland: Handle shutting down without having started
We initialize, but might not start, e.g. when a test case just needs a
backend and doesn't start mutter. When cleaning up, we'll still try to
clean up Xwayland integration, and this commit handles cleaning up
without having made the mess.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1856>
2021-05-06 17:55:32 +02:00
Jonas Ådahl
1a43312b96 wayland: Tear down seat too when shutting down
The functionality was mostly there, but not hooked up to anything.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1822>
2021-05-05 19:52:04 +00:00
Jonas Ådahl
9827687ca1 wayland/seat: Unset resource user data when disabling
We make objects inert when disabling the seat, but we requests may still
have effect. This is especially bad if disabling is followed by
destroying, but also means e.g. set_cursor() not doing an early out
after the pointer capability was disabled.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1822>
2021-05-05 19:52:04 +00:00
Jonas Ådahl
8303752e32 wayland/keyboard: Don't free NULL anonymous file
Use g_clear_pointer() instead, as meta_anonymous_file_free() rightfully
doesn't like being passed NULL.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1822>
2021-05-05 19:52:04 +00:00
Jonas Ådahl
c614cc3e82 wayland: Terminate Xwayland when shutting down
This is less confusing to Xwayland than suddenly loosing the Wayland
socket connection.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1822>
2021-05-05 19:52:04 +00:00
Jonas Ådahl
799c6dcf2f main: Tear down Wayland support before MetaDisplay
MetaDisplay does a lot of things, and is a central part to anything
window management. To let Wayland units have an easier time tearing
down, make it so that the Wayland infrastructure is terminated before
MetaDisplay.

This also makes sure that X11 support is turned off, so that we don't
stumble upon Xwayland terminating due to the Wayland socket connection
being broken. Will mitigate that in a better way in a later commit.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1822>
2021-05-05 19:52:04 +00:00
Jonas Ådahl
b71f52ff32 xwayland: Set libX11 error handlers to no-ops before terminating
We might not be the only entity holding on to the X11 GdkDisplay,
meaning the X11 connection will stay alive indefinitely, e.g. if the gjs
context has some reference to it.

Avoid running into issues due to X11 connection errors by setting the
libX11 handlers to no-ops, so when we are terminating; that means the
GDK X11 connection can stay "alive" until its too late, and we'll just
silently ignore any connection errors that may happen due to the
lingering GDK display reference.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1822>
2021-05-05 19:52:04 +00:00
Jonas Ådahl
c4a73e7950 backend: Cleanup renderer on shutdown
This removes left-over views, and related resources.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1822>
2021-05-05 19:52:04 +00:00
Jonas Ådahl
abf2f17387 renderer: Cleanup views in dispose
The views needs to be cleaned up before things cleaned up on finalize
that they depend on existing, so do so in dispose().

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1822>
2021-05-05 19:52:04 +00:00
Jonas Ådahl
558cb4fac3 backend: Cleanup cursor tracker on shutdown
It keeps references to cursors, and cursors keep references to DRM
buffers. In order to be able to clean up on exit, explicitly destroy the
cursor tracker on shutdown.

We can't rely on GObject reference counting, as gjs might hold onto a
reference until it's garbage collected.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1822>
2021-05-05 19:52:04 +00:00
Jonas Ådahl
f1a120ca36 backend: Clean up GPU instances last
Various things, e.g, the renderer, the stage, either directly or
indirectly depends on GPU objects being alive during tear-down. Make it
so, by moving GPU cleanup after the other cleaning. This will allow
tearing down a couple of more objects.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1822>
2021-05-05 19:52:04 +00:00
Jonas Ådahl
0a12f1c9c6 wayland: Clean up Wayland clients and display on shutdown
This will clean up Wayland related objects, e.g. surfaces and buffers.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1822>
2021-05-05 19:52:04 +00:00
Jonas Ådahl
22417b8a94 backend/native: Split up KMS shutdown in two phases
The first phase happens early, which discards pending page flips,
meaning the references held by those page flip closures are released.

The second phase happens late, after other units depending on the KMS
abstraction, have been cleaned up.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1822>
2021-05-05 19:52:04 +00:00
Jonas Ådahl
1af874fca6 kms/impl-device/atomic: Discard pending page flip datas on finalize
This is so page flip listeners can clean up any references attached to a
page flip.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1822>
2021-05-05 19:52:04 +00:00
Jonas Ådahl
7c924a562f kms/impl-simple: Clean up pending page flip datas on finalize
They might be holding on to references, so lets keep track of them and
clean up on finalize.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1822>
2021-05-05 19:52:04 +00:00
Jonas Ådahl
2ed4e8c906 kms-impl/simple: Discard pending flips when finalizing
Removing the reference isn't enough, the callbacks needs to be invoked
so the buffer state machinery gets notified about the page flips being
discarded.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1822>
2021-05-05 19:52:04 +00:00
Jonas Ådahl
4dec1f5ddf kms/impl-simple: Add helper for dispatching page flip datas
Instead of a invoke helper, and a clear helper, use a single dispatch
helper that does both.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1822>
2021-05-05 19:52:04 +00:00
Jonas Ådahl
c29f8c8b73 onscreen/native: Complete buffer swap also if we discarded
We already swapped the front buffer, and even if it didn't get
presented, we should still swap our representation of the state, to not
get into a confused buffer tracking state.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1822>
2021-05-05 19:52:04 +00:00
Jonas Ådahl
4cb6033a27 onscreen/native: Simplyify notify_view_crtc_presented()
We don't really need to fetch the rendering mode, as we'd only ever call
a function that is effectively a no-op if render modes it isn't relevant
to.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1822>
2021-05-05 19:52:04 +00:00
Jonas Ådahl
b731eb29b5 kms: Remove idle flush callback when flushing
We might flush in other places than the idle callback; in this case, we
don't need the idle callback anymore, so remove it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1822>
2021-05-05 19:52:04 +00:00
Jonas Ådahl
023dd13d6c onscreen/native: Get backend pointer from GPU
If we clean things up during destruction, the singleton pointer to the
backend is already gone; get it from a better place instead, to not
crash.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1822>
2021-05-05 19:52:04 +00:00
Jonas Ådahl
d077baadbb renderer/native: Destory EGL context on GPU data tear down
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1822>
2021-05-05 19:52:04 +00:00
Carlos Garnacho
63d969537f backends: Drop MetaInputSettings::seat property
This is now entirely unused, and it's dubious it should ever
be again.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1849>
2021-05-05 19:07:26 +00:00
Carlos Garnacho
7ba1448e5b clutter: Move pointer a11y settings management from MetaInputSettings
All pointer a11y is a fabrication of Clutter backend-independent
code, with the help of a ClutterVirtualInputDevice and with some
UI on top.

On the other hand, MetaInputSettings is a backend implementation
detail, this has 2 gotchas:
- In the native backend, the MetaInputSettings (and pointer a11y
  with it) are initialized early, before the ClutterSeat core
  pointer is set up.
- Doing this from the MetaInputSettings also means another dubious
  access from the input thread into main thread territory.

Move the pointer a11y into ClutterSettings, making this effectively
backend-independent business, invariably done from the main thread
and ensured to happen after seat initialization.

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1765
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1849>
2021-05-05 19:07:26 +00:00
Florian Müllner
d4a042b88d native: Fix compiler warning
cogl_context is only used when building with EGLDevice support,
resulting in an "unused variable" warning otherwise.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1852>
2021-05-05 10:32:28 +02:00
Robert Mader
96f2da9fb0 wayland/data-device: Clear existing data device resource from list
Compositor behaviour when calling `wl_data_device_manager_get_data_device`
for the same seat multiple times is not very clearly defined in
the spec and both Mutter and Weston currently don't handle
the DnD case properly.

While Weston handles DnD only for the last created data device,
Mutter, because of some internal reshuffling, ends up toggling
between two devices.

Properly handling this case requires some bigger changes. So
in order to behave predictable and in line with Weston,
only take the last created data device into account while
still keeping the previous created ones around.

The main affect client here is Firefox, which gets very
confused by the toggling behaviour and becomes more stable
with this patch.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1841>
2021-04-30 22:38:39 +02:00
Jonas Ådahl
8989c42d40 backend/native: Add udev rule to ignore vkms devices
Virtual Kernel Mode Setting (vkms) is a virtual /dev/dri/card* device
not backed by any actual hardware. It's intended for testing purposes,
e.g. to run tests suites with a reproducable setup, or in continuous
integration pipelines.

Currently mutter don't have any tests that can run on top of vkms, but
will eventually get that. To prepare for the ability to do that, and
having said kernel module loaded without causing wierd issues with any
active session, add an udev rule that tells mutter to ignore any vkms
device.

Otherwise, when vkms is loaded, mutter would detect it, assume it's a
regular monitor, configure it as such, thus add a region of the stage
that ends up nowhere, which isn't very helpful. It might also conflict
with running actual tests that need to interact with vkms if the active
session has taken control of it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1740>
2021-04-30 15:10:28 +02:00