1
0
Fork 0
Commit graph

9545 commits

Author SHA1 Message Date
Jonas Ådahl
aa306ac3ca Introduce MetaContextMain
This object intends to replace the scattered functions that are used to
make up what is effectively a "mutter context". It takes care of the
command line arguments that is now done in main.c, persistant virtual
monitors, and the like.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861>
2021-07-15 11:25:21 +02:00
Jonas Ådahl
2ac262f138 tests/clutter: Port to MetaContext
The clutter tests neeed to start and stop, thus uses their own main loop
instead of the one in MetaContext. Shouldn't matter, since nothing
in mutter should happen that makes the test self-terminate from inside
mutter.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861>
2021-07-15 11:25:21 +02:00
Jonas Ådahl
2f19a5f28d context/test: Add 'no-x11' and 'test-client' constructor flags
The 'no-x11' one will inhibit Xwayland from starting, and 'test-client'
will make sure the test client path is properly discovered.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861>
2021-07-15 11:25:21 +02:00
Jonas Ådahl
07384e18c5 clutter: Remove clutter_init_with_args()
Not used anymore.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861>
2021-07-15 11:25:21 +02:00
Jonas Ådahl
2712555c71 display: Don't include sn.h from display-private.h
It has some annoying macro requirement to not nag about API stability;
try to limit its exposure.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861>
2021-07-15 11:25:21 +02:00
Jonas Ådahl
383392f963 tests/stage-view-tests: Port to MetaContext
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861>
2021-07-15 11:25:21 +02:00
Jonas Ådahl
648a8b9861 tests/ref-test-sanity: Port to MetaContext
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861>
2021-07-15 11:25:21 +02:00
Jonas Ådahl
f8465906dd tests/headless-start: Port to MetaContext
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861>
2021-07-15 11:25:21 +02:00
Jonas Ådahl
fbc00a60cf tests/headless-start: Stop ignoring the missed frame warnings
They don't seem to happen anymore.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861>
2021-07-15 11:25:21 +02:00
Jonas Ådahl
d6ae8e7873 tests/test-runner: Port to MetaContext
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861>
2021-07-15 11:25:21 +02:00
Jonas Ådahl
54c9ca7d06 monitor-manager/test: Add default fall back initial config
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861>
2021-07-15 11:25:21 +02:00
Jonas Ådahl
f61c1a1be1 context/test: Add 'run-tests' signal that can replace g_test_run()
For tests that doesn't use g_test_run().

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861>
2021-07-15 11:25:21 +02:00
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