Commit Graph

1050 Commits

Author SHA1 Message Date
Sebastian Wick
d79e4c182e cogl/tests: Fix float->int, int->float conversions
To obtain a float between 0 and 1 we have to devide the integer by the
highest possible value instead of the number of values.

Fixes off by one errors in the tests on some hardware/driver
combinations.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3065>
2023-07-19 10:39:55 +00:00
Robert Mader
4097cbbb53 cogl: Extend tests and fix RGB2101010 opaque formats
Notably fix several cases where bitmap packing was broken, resulting in
visual corruption with the GLES2 backend. These were reproducible with
the gradient-test from
https://gitlab.freedesktop.org/jadahl/wayland-test-clients

Also extend testing similar to the RGB8888 formats.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3065>
2023-07-19 10:39:55 +00:00
Robert Mader
f04209dcbf cogl: Add RGB8888 opaque format variants
So we can properly handle matching DRM and WL_SHM formats in a unified
manner.

Add extensive testing between these and existing pre-multiplied alpha
formats, i.e. all formats we support on Wayland.

Note that unfortunately for some format combinations  the value in the
alpha channel is not cleared as expected, likely because of fast-paths
in Cogl. If both source and destination format is opaque, it always
works, however. This thereby includes all cases where they are the same.

Co-Authored-By: Jonas Ådahl <jadahl@gmail.com>
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3065>
2023-07-19 10:39:55 +00:00
Jonas Ådahl
6841153ad7 tests/kms-device: Add test for scheduled no-ops
We can schedule an update from the cursor manager, but that doesn't mean
there will be an actual plane assignment changed at the time of the
update processing, since for example we might have "touched" a CRTC, but
already left it before the processing started, meaning we have nothing
to change after all.

Add a test case that checks that this works properly.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2777>
2023-07-18 23:51:34 +02:00
Jonas Ådahl
ade2aa71ed tests/kvm: Bump timeout to 60 s
It can be quite slow to set up the test environment inside the VM, as
well as outside, leaving very little time for the test itself. While
it'd be nice to not run the mock env etc outside the VM, let's just bump
the timeout for now, to avoid unnecessary timeout failures.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2777>
2023-07-18 23:51:34 +02:00
Jonas Ådahl
7a821345db tests/kms/device: Test cursor updates just before turning off CRTC
If we turn of a CRTC, we might have invalidated the cursor manager for
the same CRTC, but that should not mean a cursor plane is assigned when
turning off the CRTC.

Add a test case for this.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2777>
2023-07-18 23:51:34 +02:00
Jonas Ådahl
3b2f95cb1f kms/update: Add destroy-notify to result listener user data
No thread guarantees, users need to handle it themselves.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2777>
2023-07-17 23:42:38 +02:00
Jonas Ådahl
587da92b0a kms: Mark mode set updates as such
This is currently unused, but will be later used to distinguish betwen
per frame/CRTC updates and device wide ones.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2777>
2023-07-17 21:19:34 +02:00
Jonas Ådahl
17a78303d0 kms: Make result listener take a vtable too
As with the page flip listener, prepare to make result listeners more
capable by allowing more vfuncs for the same listener instance in the
future.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2777>
2023-07-17 21:19:34 +02:00
Jonas Ådahl
bedec579b8 tests/kms/updates: Use async update API
We ignored the feedback and entered a temporary main loop, so no need to
do things sync.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2777>
2023-07-17 21:19:34 +02:00
Jonas Ådahl
15a91e9fd4 kms/update: Stop sealing updates
This isn't very useful anymore, since posting an update takes ownership
of it. Not sealing it also means e.g. more listeners can be added after
posting.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2777>
2023-07-17 21:19:34 +02:00
Jonas Ådahl
6da3e9eb69 thread/impl: Add API to tell whether its realtime scheduled
Will be used by thread impl's to decide whether they can rely on real
time scheduling or not.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2777>
2023-07-17 21:19:34 +02:00
Jonas Ådahl
bd2fa92c29 thread: Support making threads real time scheduled
Real time scheduling is needed for better control of when we commit
updates to the kernel, so add a property to MetaThread that, if the
thread implementation uses a kernel thread and not a user thread, RTKit
is asked to make the thread real time scheduled using the maximum
priority allowed.

Currently RTKit doesn't support the GetAll() D-Bus properties method, so
some fall back code is added, as GDBusProxy depends on GetAll() working
to make the cached properties up to date. Once
https://github.com/heftig/rtkit/pull/30 lands and becomes widely
available in distributions, the work around can be dropped.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2777>
2023-07-17 21:19:34 +02:00
Jonas Ådahl
276ebbf5ee kms: Use a kernel thread by default
Also add an API to inhibit the kernel thread from being used, and make
MetaRenderDeviceEglStream inhibit the kernel thread from being used if
it's active.

The reason for this is that the MetaRenderDeviceEGlStream is used when
using EGLStreams instead of KMS for page flipping. This means the actual
page flipping happens as a side effect of using EGL/OpenGL, which can't
easily be done off thread.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2777>
2023-07-17 21:19:34 +02:00
Jonas Ådahl
788ad43e17 thread: Allow switching thread type
This will be necessary in order to default to 'kernel' and then switch
to 'user' if the thread instance can no longer be properly multi
threaded.

To avoid having the same thread impl creating and destroying
GMainContext's, this also means always creating a GMainContext for the
thread-impl. When running in user-thread mode, the GMainContext is
wrapped in a wrapper source and dispatched as part of the real main
thread GMainContext, and when in kernel-thread mode, it runs
independently in the dedicated thread.

This has the consequence that the wrapper source will always have the
priority of the highest impl context GSource, but only after it has
dispatched once. Would we need it earlier than that, we either need a
way to introspect existing sources in a GMainContext and their
priorities, or manually track known sources in MetaThreadImpl.

The wrapper source will never be below 0, as that'd mean it could reach
INT_MAX priority if it had no more sources attached to it, meaning it'd
never be dispatched again.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2777>
2023-07-17 21:19:34 +02:00
Jonas Ådahl
e4a8fc93a1 thread: Add destroy notify function for post user data
The destroy notify function can be called on any thread.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2777>
2023-07-17 17:23:31 +02:00
Jonas Ådahl
7c9d4b8c7c kms/result-listener: Allow setting a custom main context
While the default when passing NULL will be the main context of the main
thread, make it possible to specify another main context, so that
result handlers can be invoked on the right thread.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2777>
2023-07-17 17:23:31 +02:00
Jonas Ådahl
1e0367bf08 tests/kms/update: Move out some repetitive code into helper
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2777>
2023-07-17 17:23:31 +02:00
Jonas Ådahl
1350b5e260 thread: Make it possible to run sync tasks from any thread
When a task is posted from a non-main thread, a user thread still needs
to go via the queue and be signalled using the condition, just as if it
was a kernel thread.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2777>
2023-07-17 17:23:31 +02:00
Jonas Ådahl
d77b5935cd kms/update: Allow page flip callback listeners on any thread
This hooks into the MetaThread GMainContext callback machinery just
added; and allows receiving page flip callbacks on any thread.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2777>
2023-07-17 17:23:31 +02:00
Jonas Ådahl
f83c30bae5 thread: Support queuing callbacks on any thread
Callbacks could be queued to be invoked either on the impl side or the
main thread side of the thread; change this to take a GMainContext,
which effectively means a callback can be queued to be invoked on any
thread that has a GMainLoop running on its own GMainContext.

Flushing is made to handle flushing callbacks synchronously on all
threads. This works by keeping a hash table of queued callbacks per
thread (GMainContext); when flushing (from the main thread), callbacks
on the main thread context is flushed, followed by synchronization with
all the other threads.

meta_thread_flush_callbacks() is changed to no longer return the number
of dispatched callbacks; it becomes much harder when there are N queues
spread across multiple threads. Since it wasn't used for anything, just
drop the counting, making life slightly easier.

Feedback to thread tasks are however always queued on the callers
thread.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2777>
2023-07-17 17:23:31 +02:00
Jonas Ådahl
ae48019cce tests/kms: Run tests with kernel/user thread too
This means each test is run 4 times:

 * with atomic mode setting using a kernel thread,
 * with atomic mode setting using a user thread,
 * with legacy mode setting using a kernel thread, and
 * with legacy mode setting using a user thread.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2777>
2023-07-17 12:51:36 +02:00
Jonas Ådahl
8b612a6150 thread: Introduce kernel thread support
This commit makes it possible to create a MetaThread where the
MetaThreadImpl side runs in a real thread, instead of a artificially
separated impl context.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2777>
2023-07-17 12:51:36 +02:00
Jonas Ådahl
915bceb5a0 thread: Add name to threads
So far this is used to assign names to relevant sources, but will used
to name the kernel threads, when they are introduced.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2777>
2023-07-17 12:51:36 +02:00
Jonas Ådahl
251722ec4e thread: Flush tasks and callbacks on finalize
This will make sure no tasks or callbacks are unexpectedly dropped,
potentially leaking or leaving things in an unexpected state.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2777>
2023-07-17 12:51:36 +02:00
Jonas Ådahl
261624538c tests/thread: Quit main loop in idle callback if in impl thread
This isn't a problem for user space threads, as there are no race
conditions, but when kernel thread support is introduced, we must make
sure that e.g. the main loop is actually running before quitting it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2777>
2023-07-17 12:51:36 +02:00
Jonas Ådahl
50b0d8cb18 tests/thread: Test mixing async and sync task
The expected behaivor is that the sync task will "flush" the async
tasks, i.e. to maintain task order.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2777>
2023-07-17 12:51:36 +02:00
Jonas Ådahl
069bee0ce8 tests/thread: Test multiple queued tasks
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2777>
2023-07-17 12:51:36 +02:00
Jonas Ådahl
aa723e7207 thread: Add support for posting async task
This uses the queue that was introduced when migrating impl task
management from MetaThread to MetaThreadImpl, with the exception that
it's now fully used as an actual queue. It now has a GSource that sits
on the right GMainContext that is dispatched whenever there are tasks to
execute.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2777>
2023-07-17 12:51:36 +02:00
Jonas Ådahl
fda883e859 thread: Move context and task management to impl side
It's the impl side that wants to add impl side idle sources, or fd
sources, etc, so make it part of MetaThreadImpl.

This changes things to be GAsyncQueue based. While things are still
technically single threaded, the GAsyncQueue type is used as later we'll
introduce queuing tasks asynchronously, then eventually queuing across
thread barriers.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2777>
2023-07-17 12:51:36 +02:00
Jonas Ådahl
2e025eea0e tests: Add MetaThread tests
Tests posting sync tasks, posting callbacks, adding impl side fd
sources, callback flushing, impl side idle callbacks.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2777>
2023-07-17 12:51:35 +02:00
Jonas Ådahl
2059273f57 tests/input-capture: Add test for ATK input capture
Cally should not see the events when they are captured.

[ofourdan] Wait for paint before checking button count.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2628>
2023-07-14 22:23:45 +00:00
Jonas Ådahl
1513eccc03 tests/input-capture: Test that a11y isn't triggered when capturing
Accessibility should be handled on the receiving end, if needed. Make
sure this is the case by listening on some signals, verifying they are
only triggered if we're not capturing input.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2628>
2023-07-14 22:23:45 +00:00
Jonas Ådahl
2fb3bdf774 input-capture: Hook up capturing of events to active session
This adds the actual input capturing rerouting that takes events and
first hands them to the input capture session, would it be active.
Events are right now not actually processed in any way, but will
eventually be passed to a libei client using libeis.

A key binding for allowing cancelling the capture session is added
(defaults to <Super><Shift>Escape) to avoid getting stuck in case the client
doesn't even terminate the session.

The added test case makes sure that the pointer moves again after
pressing the keybinding.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2628>
2023-07-14 22:23:45 +00:00
Jonas Ådahl
e917b7de43 clutter/stage: Add input-only grabs
An input only grab is a ClutterGrab on the stage that doesn't have an
explicit actor associated with it. This is useful for cases where event
should be captured as if focus was stolen to some mysterious place that
doesn't have anything in the scene graph that represents it.

Internally, it's implemented using a 0x0 sized actor attached directly
to the stage, and a clutter action that consumes the events. An
input-only grab takes a handler, user data and a destroy function for
the user data. These are handed to the ClutterAction, which handles the
actual event handling.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2628>
2023-07-14 22:23:45 +00:00
Jonas Ådahl
a79f35612b tests/clutter/grab: Use clutter_event_get_name()
This changes the debug output slightly, but that's fine.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2628>
2023-07-14 22:23:45 +00:00
Jonas Ådahl
2a8c11d69b input-capture: Add D-Bus method to clear barriers
This will be needed by the portal backend.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2628>
2023-07-14 22:23:45 +00:00
Jonas Ådahl
1d1983edb5 input-capture: Hook up barrier adding
Adding a barrier and later enabling the input capture session will
create MetaBarrier instances for each added input capture barrier.

The barriers are created as "sticky" which means that when a pointer
hits the barrier, it'll stick to the point of entry, until it's
released.

The input capture session is also turned into a state machine with
explicit state, to more easily track things.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2628>
2023-07-14 22:23:45 +00:00
Jonas Ådahl
a8b013b006 Add beginning of input capture API
This API aims to provide a way for users to capture input devices under
certain conditions, for example when a pointer crosses a specified
barrier.

So far only part of the API is implemented, specifially the session
management as well as zone advertisement, where a zone refers to a
region in the compositor which edges will eventually be made available
for barrier placement.

So far the remote access handle is created while the session is enable,
despite the input capturing isn't actually active yet. This will change
in the future once it can actually become active.

v2: Remove absolute/relative pointer, keep only pointer (ofourdan)

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2628>
2023-07-14 22:23:45 +00:00
Dor Askayo
b3d0d84823 tests: Add missing dependencies
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3091>
2023-06-29 20:07:56 +00:00
Jonas Ådahl
4aeb051e9b tests: Mark some test cases as skippable
This means the mutter/tty suite won't fail when the tests can't
TakeControl, i.e. run in the already active session.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3095>
2023-06-28 01:03:35 +00:00
Jonas Ådahl
c724fcae2e tests/screen-cast-client: Don't process stream on tear down
We'd get a re-entry like scenario when destroying the PipeWire stream
object, where PipeWire would call the stream process vfunc. When this
happened, we had already destroyed the stream, so don't try to dequeue
or anything, just do an early exit. Fixes the following crash in the
test case client:

  #0 pw_stream_dequeue_buffer() in /usr/lib64/libpipewire-0.3.so.0.367.0
  #1 on_stream_process() at ../src/tests/screen-cast-client.c:348
  #2 do_call_process() in /usr/lib64/libpipewire-0.3.so.0.367.0
  #3 flush_items() in /usr/lib64/spa-0.2/support/libspa-support.so
  #4 loop_invoke() in /usr/lib64/spa-0.2/support/libspa-support.so
  #5 impl_send_command.lto_priv.0() in /usr/lib64/libpipewire-0.3.so.0.367.0
  #6 suspend_node.lto_priv.0() in /usr/lib64/libpipewire-0.3.so.0.367.0
  #7 pw_impl_node_set_state() in /usr/lib64/libpipewire-0.3.so.0.367.0
  #8 client_node_removed() in /usr/lib64/pipewire-0.3/libpipewire-module-client-node.so
  #9 pw_proxy_destroy() in /usr/lib64/libpipewire-0.3.so.0.367.0
 #10 pw_stream_disconnect() in /usr/lib64/libpipewire-0.3.so.0.367.0
 #11 pw_stream_destroy() in /usr/lib64/libpipewire-0.3.so.0.367.0
 #12 stream_free() at ../src/tests/screen-cast-client.c:530
 #13 main() at ../src/tests/screen-cast-client.c:803
 #14 __libc_start_call_main() at ../sysdeps/nptl/libc_start_call_main.h:58
 #15 __libc_start_main() at ../csu/libc-start.c:360
 #16 _start() in /home/jonas/Dev/gnome/mutter/build/src/tests/mutter-screen-cast-client

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3095>
2023-06-28 01:03:35 +00:00
Sebastian Wick
985d0dc3ab tests/stage-view-tests: Unref clutter timelines
If the timelines don't get destroyed they keep references to frame
clocks. Later tests check for the destruction of those frame clocks and
then can fail if the frame clock is implemented slightly differenty.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3084>
2023-06-20 23:19:28 +00:00
Jonas Dreßler
26344fb533 clutter/actor: Don't store a second stage-views list for the stage
The stage already maintains its own list of stage-views via
clutter_stage_peek_stage_views(), it's a bit superfluous to copy that list
around all the time into priv->stage_views of ClutterActor. Let's deal with
that by returning clutter_stage_peek_stage_views() when
clutter_actor_peek_stage_views() gets called for the stage.

In order to make sure ClutterActor::stage-views-changed still gets emitted
correctly for the stage, always emit that signal on the ClutterStage when
the stage views get invalidated. This now depends on the backend only
actually invalidating the views and calling
clutter_stage_clear_stage_views() when things have actually changed, but
that should be the case.

This needs a change in one of the stage-views tests, namely the one which
tests stage-view-changed emission on the stage: Here we now see an emission
of stage-views-changed, but that signal emission actually seems correct.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2679>
2023-06-06 11:41:01 +00:00
Bilal Elmoussaoui
9a6ee5d7c7 clutter: Drop unnused cairo specific APIs
The APIs are not used by Mutter and GNOME Shell, so they should be safe to remove

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3040>
2023-06-01 16:10:13 +00:00
Jonas Ådahl
340d585f91 compositor: Reparent the backend window unmanaging the display
Under X11 hiding the backend implies also unmapping the stage window, if
we do that after that we've closed the display we may end up in a
BadWindow error because such window seems to be destroyed together with
the compositor output parent (even though we are not notified about), so
to prevent this, reparent the backend window during compositor unmanage,
setting it back as a root window child.

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2835
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3020>
2023-05-31 07:53:41 +00:00
Marco Trevisan (Treviño)
6d992e9e45 tests: Perform x11 test in both sync and async modes
The former allows better catching of issues, so do both cases

See: https://gitlab.gnome.org/GNOME/mutter/-/issues/2835
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3020>
2023-05-31 07:53:41 +00:00
Marco Trevisan (Treviño)
079745ca9f tests/dbusmock-templates/colord: Remove unused variables
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3016>
2023-05-25 09:21:57 +00:00
Marco Trevisan (Treviño)
7d95a41ec2 tests/dbusmock-templates/colord: Support usernames with dash chars
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3016>
2023-05-25 09:21:57 +00:00
Jonas Ådahl
875922fbe3 tests/test-runner: Log each command before running
With verbose mode test runner will log every command before it executes
it. Hopefully this will help in some cases when tests fail in CI with a
timeout.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2893>
2023-05-22 13:21:39 +00:00
Bilal Elmoussaoui
a27b9d9707 wayland: Guard XWayland types
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2445>
2023-05-15 20:41:54 +02:00
Marco Trevisan (Treviño)
c9c4b06429 tests/test-client: Use proper style for main arguments
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2970>
2023-05-15 19:06:39 +02:00
Marco Trevisan (Treviño)
c653f30283 tests/test-client: Ensure that screen has always a compositor
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2970>
2023-05-15 19:05:00 +02:00
Marco Trevisan (Treviño)
b48351005e tests: Add check for compositor state on XWayland startup
Check that the first X11 window started has a compositor defined.

See: https://gitlab.gnome.org/GNOME/mutter/-/issues/2472#note_1582262
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2970>
2023-05-15 19:05:00 +02:00
Marco Trevisan (Treviño)
28bd3da21a tests/meson: Make tests depending on test-client to actually depend on it
It allows meson to rebuild the client-related sources when a single test
is running using the client, also ensuring that test-run dependencies
are correctly setup

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2970>
2023-05-15 19:05:00 +02:00
Bilal Elmoussaoui
05dd401b64 tests: Make wayland-x11-interop depends on xwayland feature
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2938>
2023-05-15 11:52:35 +00:00
Jonas Ådahl
61b42e5303 build: Use / operator instead of join_paths everywhere
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2985>
2023-05-04 12:35:38 +00:00
Jonas Ådahl
dcaca398f1 tests: Set a dummy XDG_CONFIG_HOME variable
This avoids a local ~/.config/monitors.xml messing up tests.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2985>
2023-05-04 12:35:38 +00:00
adarshgm
7f18cae282 edid: Integrate libdisplay-info for edid parsing
Hides libdisplay-info under a build time default-off flag,
provides provision to parse essential edid parameters with
APIs provided by libdisplay-info. This implementaion increases
readibility, avoids code duplication and decreases complexity
of edid parsing.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2642>
2023-05-02 17:37:01 +00:00
Carlos Garnacho
5eb17a362e tests: Avoid CSD window in test
This ATM triggers missed .commit events for the window in question,
to be addressed in Xwayland. Since the test does not seem to specifically
rely on this window being CSD, make it a regular window instead.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2975>
2023-04-25 17:34:24 +02:00
Jonas Ådahl
2fd9834d94 monitor: Add helper to parse simple mode strings
This will be used to extract the resolution and refresh rate from
strings like "1920x1080@60.0" or "1280x720". This aims to replace the
use of the locale dependent sscanf() function.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2902>
2023-04-18 18:38:03 +00:00
Jonas Ådahl
867494d3df wayland/cursor-surface: Update cursor on dispose
Otherwise we'll have a cursor sprite backed by a surface that no longer
exist. This usually doesn't happen, but can happen in rare situations
related to pointer capability changes Wayland client cursor changes and
hotplugs.

Fixes the following crash:

  #0 meta_wayland_buffer_get_resource() at ../src/wayland/meta-wayland-buffer.c:128
  #1 realize_cursor_sprite_from_wl_buffer_for_gpu() at ../src/backends/native/meta-cursor-renderer-native.c:1649
  #2 realize_cursor_sprite_for_gpu() at ../src/backends/native/meta-cursor-renderer-native.c:1869
  #3 realize_cursor_sprite() at ../src/backends/native/meta-cursor-renderer-native.c:1887
  #4 meta_cursor_renderer_native_update_cursor() at ../src/backends/native/meta-cursor-renderer-native.c:1100
  #5 meta_cursor_renderer_update_cursor() at ../src/backends/meta-cursor-renderer.c:414
  #6 meta_cursor_renderer_force_update() at ../src/backends/meta-cursor-renderer.c:449
  #7 update_cursors() at ../src/backends/meta-backend.c:328
  #8 meta_backend_monitors_changed() at ../src/backends/meta-backend.c:338
  #9 meta_monitor_manager_notify_monitors_changed() at ../src/backends/meta-monitor-manager.c:3590
 #10 meta_monitor_manager_rebuild() at ../src/backends/meta-monitor-manager.c:3678
 #11 meta_monitor_manager_native_apply_monitors_config() at ../src/backends/native/meta-monitor-manager-native.c:343
 #12 meta_monitor_manager_apply_monitors_config() at ../src/backends/meta-monitor-manager.c:706
 #13 meta_monitor_manager_ensure_configured() at ../src/backends/meta-monitor-manager.c:779
 #14 meta_monitor_manager_reconfigure() at ../src/backends/meta-monitor-manager.c:3738
 #15 meta_monitor_manager_reload() at ../src/backends/meta-monitor-manager.c:3745

or the following on gnome-43:

 #0 meta_wayland_surface_get_buffer at ../src/wayland/meta-wayland-surface.c:441
 #1 meta_cursor_sprite_wayland_get_buffer at ../src/wayland/meta-cursor-sprite-wayland.c:83
 #2 realize_cursor_sprite_from_wl_buffer_for_gpu at ../src/backends/native/meta-cursor-renderer-native.c:1612
 #3 realize_cursor_sprite_for_gpu at ../src/backends/native/meta-cursor-renderer-native.c:1836
 #4 realize_cursor_sprite at ../src/backends/native/meta-cursor-renderer-native.c:1854
 #5 meta_cursor_renderer_native_update_cursor at ../src/backends/native/meta-cursor-renderer-native.c:1087
 #6 meta_cursor_renderer_update_cursor at ../src/backends/meta-cursor-renderer.c:413
 #7 meta_cursor_renderer_force_update at ../src/backends/meta-cursor-renderer.c:448
 #8 update_cursors at ../src/backends/meta-backend.c:344
 #9 meta_backend_monitors_changed at ../src/backends/meta-backend.c:354

Related: https://bugzilla.redhat.com/show_bug.cgi?id=2185113
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2968>
2023-04-17 19:53:35 +00:00
Georges Basile Stavracas Neto
b47d96b862 backends/stage: Pass ClutterFrame to MetaStageWatchFunc
We'll need to access the timestamp of the frame later on, so pass
it to stage watchers.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2804>
2023-04-07 12:19:23 +02:00
Simon McVittie
d6af73ba68 tests: Use a more interoperable path to bash
On systems that have undergone the /usr merge, /bin/bash and
/usr/bin/bash can be used interchangeably, but on systems where /bin and
/usr/bin are separate (such as Debian 11 or older), bash was traditionally
in /bin and there is no bash in /usr/bin.

Resolves: https://gitlab.gnome.org/GNOME/mutter/-/issues/2385
Signed-off-by: Simon McVittie <smcv@debian.org>
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2900>
2023-03-22 15:16:06 +00:00
Jonas Ådahl
214a7d393b monitor-manager: Apply switch-config in idle callback
Just as with restoring the previous monitor configuration in case the
user clicked "revert" in GNOME Shell's monitor configuration
confirmation dialog, we need to do switch configs in an idle callback as
well.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2694
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2912>
2023-03-18 16:20:49 +00:00
Robert Mader
ce63543a3e tests/wayland: Add missing dependencies
They're needed for `ceilf()`.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2895>
2023-03-05 00:23:26 +00:00
Robert Mader
a9c9b89358 tests/wayland: Add test for fractional-scale protocol
For now test that a simple fullscreen client on a FullHD screen selects
the expected values.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2394>
2023-03-04 22:13:45 +01:00
Robert Mader
18ea492daf tests/build: Order Wayland tests alphabetically
And ensure they all start with "wayland-" for consistency.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2394>
2023-03-04 22:13:45 +01:00
Robert Mader
692ea856fb tests/wayland-client-utils: Use interface names instead of static strings
Let's be a good example here.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2394>
2023-03-04 22:13:45 +01:00
Jonas Ådahl
8b42564763 tests/build: Move 'service-channel' test to a 'misc' section
It only has a Wayland test, but might get Wayland unrelated things in
the future, so move it away into a "misc" section.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2892>
2023-03-04 20:56:40 +00:00
Sebastian Wick
f729a2023e tests: Add tests for HDR Static Metadata encoding/decoding and equality
We have the drm/InfoFrame encoding and our MetaOutputHdrMetadata
encoding. Check that we can correctly convert between each other by
doing a encode/decode and decode/encode roundtrip and then checking for
equality.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2879>
2023-03-04 09:30:41 +00:00
Olivier Fourdan
4005fda902 test: Add a test for "activate" hammering
This is what "terminator" (the terminal emulator) does, it basically
calls gdk_window_focus() in a loop thousands of times at startup.

This in turn fills up the Wayland connection between Xwayland and
mutter, and eventually the session dies.

See-also: https://github.com/gnome-terminator/terminator/issues/714
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2849>
2023-03-04 09:07:44 +00:00
Olivier Fourdan
3be189192a tests: Update README
"activate" is no longer a no-op on Wayland, it uses xdg-activation.

Update the README accordingly.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2849>
2023-03-04 09:07:44 +00:00
Jonas Ådahl
4551bc6b86 tests/kms/hotplug: Add tests for connector coming and going
Doesn't test any known issue, but just for the sake of testing.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2887>
2023-03-03 22:36:30 +00:00
Jonas Ådahl
995f9f9db8 onscreen/native: Hold output and CRTC refs until dispose
We relied on them being valid longer to keep track of used GPUs. If we
don't have the CRTC (or output) we don't have a way to fetch the pointer
to the MetaGpu that drives the associated monitor.

This avoids a crash when trying to fetch said pointer from what would be
the NULL MetaCrtc pointer.

Fixes: 08593ea872 ("onscreen/native: Hold ref to the output and CRTC until detached")
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2667
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2887>
2023-03-03 22:36:30 +00:00
Carlos Garnacho
ae2ceeda0b ci,tests: Pass GTK_A11Y=none to tests
Same rationale applies than NO_AT_BRIDGE, but for GTK4 bits.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2864>
2023-03-03 20:17:01 +00:00
Jonas Ådahl
6c1274b75e tests/monitor/default-scale: Add a couple of more test cases
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2880>
2023-03-03 08:46:02 +00:00
Jonas Ådahl
d03dce4378 monitor: Use fractional scale result to decide the non-fractional scale
We want to avoid using too high scales too easily, which started to
happen 2f1dd049bf ("monitor-manager: Rework default scale factor
selection"). Instead of using the closest non-fractional scale, which
effectively is what we'd do, only round upwards if we're closer than
0.25 (25%).

Since there are some wiggle room for scales to make the logical
resolution on the integer pixel grid, make sure to compensate. This
compensation is done by adding an extra 0.2 to scale difference.

For example the following fractional scales will get these corresponding
integer scales:

    * 1.25 -> 1.0
    * 1.5 -> 1.0
    * 1.75 -> 2.0
    * 2.0 -> 2.0
    * 2.50 -> 2.0

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2880>
2023-03-03 08:46:02 +00:00
Carlos Garnacho
bf8027ef0d tests: Fix default_scale test
It was only testing for the first item in all cases, instead
of going through all of them.

Fixes: a6217c720e ("tests: Add tests for monitor_calculate_mode_scale")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2880>
2023-03-03 08:46:02 +00:00
Jonas Ådahl
b0207f9567 tests/monitor/default-scale: Fix test cases
They weren't running, and didn't pass. Update the values to match what
is the current result.

Fixes: a6217c720e ("tests: Add tests for monitor_calculate_mode_scale")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2880>
2023-03-03 08:46:02 +00:00
Jonas Ådahl
98c9db98e3 tests/monitor/default-scale: Use a large epsilon
To have the test case say e.g. 1.75 while the effective scale is
1.74863386, use an epsilon of 0.2.

Fixes: a6217c720e ("tests: Add tests for monitor_calculate_mode_scale")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2880>
2023-03-03 08:46:02 +00:00
Jonas Ådahl
f3f9200f9a tests: Port headless start test case to VKMS
Instead of testing headless start using the dummy backend, do so with
the real native backend, and use the drm-mock library instead to emulate
monitors being disconnected at startup.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2821>
2023-03-02 23:49:15 +00:00
Jonas Ådahl
17623189e8 tests/drm-mock: Add filter mocking
This new filter allows test cases to manipulate what the kernel reports,
e.g. mark connected connectors as disconnected to emulate monitors
connecting and disconnecting.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2821>
2023-03-02 23:49:15 +00:00
Jonas Ådahl
671efb9937 tests/drm-mock: Add missing newline in macro
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2821>
2023-03-02 23:49:15 +00:00
Jonas Ådahl
ffd1e8106c kms/update: Merge connector updates too
This includes privacy screen updates, underscanning etc; this is needed
when merging mode set updates that happen to change these too, which is
rather likely.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2881>
2023-03-02 22:09:16 +01:00
Jonas Ådahl
f27ca241f9 renderer/native: Move per frame KMS update to MetaFrameNative
In order to make things more and more asynchronus and to each time we
paint be an isolated event, that can be potentially be applied
individually or together with other updates, make it so that each time
we draw, we use the transient MetaFrameNative (ClutterFrame) instance to
carry a KMS update for us.

For this to work, we also need to restructure how we apply mode sets.
Previously we'd amend the same KMS update each frame during mode set,
then after the last CRTC was composited, we'd apply the update that
contained updates for all CRTC.

Now each CRTC has its own KMS update, and instead we put them in a per
device table, and whenever we finished painting, we'll merge the new
update into any existing one, and then finally once all CRTCs have been
composited, we'll apply an update that contains all the mode sets for all
relevant CRTCs on a device.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2855>
2023-03-02 01:40:16 +01:00
Jonas Ådahl
6d043e6a8f kms/impl-device: Let process() always take ownership of the update
This allows more freedom how to handle the update in the backends.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2855>
2023-03-02 01:39:16 +01:00
Jonas Ådahl
2dfbbf0068 tests/kms/render: Add test for scanout failure handling
Make sure we repaint correctly if direct scanout updates fail.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2854>
2023-03-01 23:57:32 +00:00
Jonas Ådahl
fb622974b9 tests: Add static drm-mock library
Add a tiny library that sabotages errors in drmMode*() API calls. This
will be used to artificially trigger arbitrary errors, e.g. cause the
next commit to fail with EBUSY.

The three mocked methods are added as they will be used in a future
commit.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2854>
2023-03-01 23:57:32 +00:00
Jonas Ådahl
b1b9a9aac1 kms/update: Change lock() to seal()
At first it was called seal(), but then updates could be amended after
being posted, given a flag. That flag has been removed, so we can go
back to sealing, since it's once again acts more as a seal.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2854>
2023-03-01 23:57:32 +00:00
Jonas Ådahl
cc2bbb25ba frame-clock: Don't delay schedule_now() if already scheduled
If we call schedule(), which will schedule an update some time in the
future, and then schedule_now(), we should reschedule the frame clock to
update immediately, and not some time in the future.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2854>
2023-03-01 23:57:32 +00:00
Jonas Ådahl
7253ac501d kms: Make KMS feedback struct ref counted
It'll later be sent asynchronously; to prepare for that make it ref
counted with an atomic ref counter.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2854>
2023-03-01 23:57:32 +00:00
Jonas Ådahl
37db905ff9 kms/update: Support merging updates with mode sets
Will be helpful to allow constructing each initial mode set update per
CRTC, merging them later on-demand.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2854>
2023-03-01 23:57:32 +00:00
Jonas Ådahl
9dcb28ffd1 kms/update: Add API to merge two updates
This is intended to be used only for plane assignment, and CRTC like
changes, so that one can e.g. change a cursor plane on a pending update
that changes the primary plane, before it has been committed to KMS.

The kms-updates test overrides the get-state function MetaKmsCrtc. This
is needd to not have the update mechanism not clamp the gamma size to 0,
as vkms reports the gamma length 0. By pretending it's 3, we can test a
simple and small gamma lut is merged correctly when merging updates.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2854>
2023-03-01 23:57:32 +00:00
Adrian Vovk
a6217c720e tests: Add tests for monitor_calculate_mode_scale
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2653>
2023-02-24 22:42:19 +01:00
Sebastian Wick
e9786452c6 backends/native: Replace MetaKmsCrtcGamma with MetaGammaLut
They are the same type now so there is no reason to keep both of them
around.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2861>
2023-02-23 17:20:36 +00:00
Sebastian Wick
8ccbc21d23 backends/native: Use MetaKmsCrtcGamma for the KMS gamma color update
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2861>
2023-02-23 17:20:36 +00:00
Sebastian Wick
37639295db backends/native: Rename crtc_gamma to crtc_color_updates
We need to update more CRTC color pipeline properties in the future.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2861>
2023-02-23 17:20:36 +00:00
Jonas Ådahl
b2579750a7 cogl: Remove legacy OpenGL driver support
This means the two Cogl drivers left are OpenGL >= 3.1 and GLES >= 2.0.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2672>
2023-02-21 18:09:28 +00:00
Sebastian Wick
8ab2cbedd7 tests/kvm: Properly capture the test status code
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2862>
2023-02-21 08:54:03 +00:00
Jonas Ådahl
d1506fbb78 tests/kms/update: Add test for page flip feedbacks
Only tests the expected success path, i.e. when we receive a page flip
event.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2853>
2023-02-18 10:53:27 +00:00
Jonas Ådahl
e65c6f18b3 tests/kms: Don't leak MetaKmsFeedback
Also start warning if we don't handle the
meta_kms_device_process_update_sync() return value.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2853>
2023-02-18 10:53:27 +00:00
Jonas Ådahl
32dc870f37 wayland: Add X11 interop service client protocol
This protocol is intended to let special clients create transient-for
relationships between X11 and Wayland windows. The client that needs
this is xdg-desktop-portal-gnome, which will create e.g. file chooser
Wayland dialogs that should be mapped on top of X11 windows.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2810>
2023-02-13 15:34:24 +00:00
Jonas Ådahl
1282f4668f tests/test-client: Add helper to run 'script'
The script is a list of newline separated command lines that are sent to
the client one by one as if one would have used e.g.
meta_test_client_do().

It doesn't have error handling as it's expected to be used from tests,
and handling errors in tests that never expects to handle errors is
cumbersome.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2810>
2023-02-13 15:34:24 +00:00
Jonas Ådahl
b8d0eb80d7 tests/test-client: Move out command line handling into helper
This will allow adding more API for more convenient test client
scripting.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2810>
2023-02-13 15:34:24 +00:00
Jonas Ådahl
79e1fc63ad tests: Add service door Wayland test case
Checks that the MetaWaylandClient from the service door is the one
owning the client connection opened via the D-Bus interface.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2810>
2023-02-13 15:34:24 +00:00
Jonas Ådahl
5d888f2df6 tests/wayland-client-utils: Add way to create display from fd
Allows for more complex connection management.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2810>
2023-02-13 15:34:24 +00:00
Jonas Ådahl
337ade622c tests/wayland-test-utils: Add helper to wait for window
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2810>
2023-02-13 15:34:24 +00:00
Jonas Ådahl
9856dac593 tests/wayland: Move out window finder helper to helper file
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2810>
2023-02-13 15:34:24 +00:00
Jonas Ådahl
91c40a47b3 wayland: Add wl_global filter manager
One can add a wl_global filter to a wl_display instance, which can be
used to decide what clients should see what globals. This has so far
been used to limit a Xwayland specific protocol extension to only
Xwayland. In order to expand the logic about what globals are filtered
to what clients, introduce a filter manager and port the Xwayland
specific protocol filter to this new manager.

Tests are added, using a new dummy protocol, to ensure that filtering is
working as expected.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2810>
2023-02-13 15:34:24 +00:00
Jonas Ådahl
71e0bc0cbf tests/wayland-unit: Fix include order
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2810>
2023-02-13 15:34:24 +00:00
Jonas Ådahl
e9eb1f504e tests/build: Fix test driver protocol code target name
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2810>
2023-02-13 15:34:24 +00:00
Jonas Ådahl
99a0dd447b tests: Move Wayland protocols to dedicated directory
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2810>
2023-02-13 15:34:24 +00:00
Jonas Ådahl
056a65bb01 tests: Add MetaWaylandClient test cases
It only tests indirect clients, i.e. not the subprocess part, so far,
but tests explicitly terminating by destroying the MetaWaylandClient
object, as well as the client self terminating and the signal being
emitted.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2810>
2023-02-13 15:34:24 +00:00
Sebastian Wick
63522de4d0 tests/stacking: Change primary monitor handling
The first monitor in stacking tests is the primary monitor but that
doesn't have to stay this way forever. Instead of special casing the
name "primary" to refer to whatever monitor happens to be the primary
monitor, we add an `assert_primary_monitor` command to verify that the
monitor that should be the primary monitor actually is.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2748>
2023-02-07 17:52:19 +01:00
Sebastian Wick
4727609d2b tests/stacking: Move string to gboolean conversion to a helper
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2748>
2023-02-07 17:48:33 +01:00
Sebastian Wick
462c1115fe tests/stacking: Add a multi-monitor stacking test
New add_monitor command for adding secondary monitors. Support setting
the workspaces-only-on-primary preference.

The stacking test tests the focus and stacking for multiple monitors
with workspaces-only-on-primary=true. The default_focus changes
previously broke this.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2748>
2023-02-07 15:45:28 +01:00
Sebastian Wick
1920d55ef9 tests/stacking: Test stacking order with raise-on-click = false
Makes sure the focus changes but the stacking stays the same. Also
checks that the stacking and focus on a workspace stays the same when
changing between them.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2748>
2023-02-07 15:40:08 +01:00
Sebastian Wick
f6d96a6118 tests/stacking: Add support for moving the cursor and clicking
Also test that clicking on a window will focus and raise it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2748>
2023-02-07 15:16:39 +01:00
Carlos Garnacho
d8ef1b5b8b build: Make dependency order consistent when generating introspection
Add first the internal/local dependencies, then the external dependencies.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2826>
2023-02-05 12:38:22 +00:00
Carlos Garnacho
83e505408c build: Change dependency order building libmutter-test introspection
The order of dependencies influences the order of -L arguments to gcc/ld,
we should put our private library first, so that introspection prefers
looking up libraries in private paths than public ones.

This could bring problems in API updates of the libmutter-test library,
since introspection would still prefer the old installed one.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2826>
2023-02-05 12:38:22 +00:00
Jonas Ådahl
7fecda6a7a tests: Add public test monitor API
This will allow gnome-shell perf tests to create and destroy virtual
test monitors whenever it needs to.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2824>
2023-02-03 15:29:28 +00:00
Jonas Ådahl
d3db3157bb tests: Make libmutter-test.so introspected
This allows perf test cases in gnome-shell to use the public API.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2824>
2023-02-03 15:29:28 +00:00
Jonas Ådahl
13ca367311 tests/ref-test: Don't use gidoc for private function
This will silence some introspection warnings that would otherwise
happen when we start doing that.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2824>
2023-02-03 15:29:28 +00:00
Jonas Dreßler
f6da583d06 tests/clutter/event-delivery: Add tests for implicit grabbing
Add a few tests to make sure all the hairy details of crossing behavior etc
don't fall apart again.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2342>
2023-02-03 12:10:22 +00:00
Sebastian Wick
17c52854b7 default-plugin: Handle unmanaging windows in switch_workspace
Also add a regression metatest.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2559
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2782>
2023-02-01 16:21:55 +01:00
Niels De Graef
019267a044 tests/test-runner: Don't leak tests array
Make sure we properly free the array and its string elements

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2817>
2023-02-01 13:16:29 +00:00
Niels De Graef
1a814250c0 tests/meta-context-test: Free D-Bus call results
Don't leak the resulting `GVariant`.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2817>
2023-02-01 13:16:29 +00:00
Jonas Ådahl
be649bdad2 tests/native-pointer-constraints: Remove extra semicolon
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2814>
2023-02-01 08:40:53 +01:00
Jonas Ådahl
2c15a9569e tests/cogl: Remove extra semicolon
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2814>
2023-02-01 08:40:53 +01:00
Simon McVittie
ca70c1dfb5 tests: Break up stacking installed-tests into more, smaller tests
Running each stacking test as a separate installed-test is analogous to
what was done for build-time tests in c6d1cf4a (!442) and should make it
easier to track regressions, by being able to see whether a regression
is specific to one .metatest script or applies to more than one.

Signed-off-by: Simon McVittie <smcv@debian.org>
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2773>
2023-01-30 14:39:39 +00:00
Jonas Ådahl
64c3b824fa tests/clutter: Use a dummy actor for some interactive tests
While completely untested, at least this makes it work "in theory"
again. Before it'd listen to signals on the stage, but have an incorrect
type signature to handle the test paint procedures, meaning it'd
probably crash or cause memory corruptions.

What was needed was a signal which in the callback the test could call
some cogl functions to paint on the framebuffer. While there is no such
signal on the stage, and the ClutterActor::paint signal (which they
probably used in the past) is long gone, lets add a "test actor" that is
just a wrapper that adds that paint signal with a paint context.

The tests that need it are changed to add this actor to the stage, and
to listen to the paint signal on the actor instead of incorrectly
listening on stage signals.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2807>
2023-01-30 13:17:19 +00:00
Jonas Ådahl
bef9cecb81 build: Make D-Bus codegen declarative
This makes it a bit less cumbersome to add more D-Bus codegen
interfaces.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2811>
2023-01-28 12:41:12 +01:00
Jonas Ådahl
5235f2b4ac tests/color: Assert we saw the expected messages
g_test_expect_message() needs a g_test_assert_expected_messages() to be
of much use, so add those calls too.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2800>
2023-01-24 13:09:42 +00:00
Jonas Ådahl
08b0e563d4 clutter: Pass 'ClutterFrame' in all stage update signals
That means before-update, prepare-paint, before-paint, paint-view, after-paint,
after-update. While yet to be used, it will be used as a transient frame
book keeping object, to maintain object and state that is only valid
during a frame dispatch.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2795>
2023-01-23 15:57:50 +01:00
Jonas Ådahl
24f44aa33e tests/kms/render: Fix paint-view callback type signature
It was missing a cairo_region_t. This also needs adapting the test case,
since prior to this, we didn't actually bump the paint counter when
painting.

When a scanout test isn't waiting to go from compositing to scanout, but
from scanout to compositing, we should not early out when we actually
composited, since that's what we're expecting to see.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2795>
2023-01-23 15:57:30 +01:00
Jonas Ådahl
916b21674e clutter/frame-clock: Pass ClutterFrame via the frame clock interface
Let the ClutterFrame live for the whole frame, and be carried as an
argument to the frame clock listener interface functions.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2795>
2023-01-23 12:19:54 +01:00
Jonas Ådahl
84538f402e tests/kvm: Run with 1GB RAM
This makes things like valgrind and catch able to run.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2798>
2023-01-21 14:22:33 +01:00
Jonas Dreßler
57ce4e04e5 tests/clutter/event-delivery: Flush input thread inside wait_stage_updated()
Flushing the input thread might implicitly iterate the mainloop, and thus
update the stage while still inside the clutter_test_flush_input() call.
This means the stage update has already happened when we call
wait_stage_updated(), and that's why we call clutter_stage_schedule_update()
there currently.

This clutter_stage_schedule_update() call is not necessary though, instead
we can flush the input thread from inside wait_stage_updated() after
setting was_updated to FALSE.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2792>
2023-01-19 13:36:25 +00:00
Bilal Elmoussaoui
a4d1b50b3b tests: Disable XWayland tests if it is not enabled
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2399>
2023-01-03 20:45:04 +00:00
Bilal Elmoussaoui
abef37f5ee core: Add a copy of GDK_PRIORITY_EVENTS
Quoting Carlos:
The META_PRIORITY_EVENTS ± 1 happening below are in order to set these idles
and timeouts in a priority that is relative to the literal GDK event priority,
making those diverge is a likely way to sneakily break things.
But that's unlikely to happen, and decoupling mutter from GTK further
should make it moot, so perhaps it's alright after all.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2407>
2022-12-22 15:13:54 +01:00
Jonas Ådahl
ca98895185 tests/cogl: Add test checking rgb10 fbo precision
There are two tests; one checks that clearing with a color that cannot
be represented using 8 bits per channel doesn't loose precision when
painted, then read back using glReadPixels(). Would the texture backing
store have 8 bits per channel instead of 10, we'd get a different value
back.

The other test checks that painting from one fbo to another also doesn't
loose that precision.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2461>
2022-12-17 23:12:34 +00:00
Jonas Ådahl
ea7175f6b7 tests/wayland: Add test for xdg-foreign
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2770>
2022-12-17 20:38:23 +00:00
Jonas Ådahl
474c093801 tests/wayland-client-utils: Add simple toplevel helper
Add a helper to create a toplevel painted with a given color, size and
title. It's meant to be "dumb" and have a default size, but respect any
configured size.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2770>
2022-12-17 20:38:23 +00:00
Jonas Ådahl
d97c160122 tests/wayland-test-client-utils: Add helper to wait for event
Useful for synchronization.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2770>
2022-12-17 20:38:23 +00:00
Jonas Ådahl
f8376a43d3 Always queue MetaLater via compositor instance
The "later" API is used to queue actions in relation to compositing,
thus is owned by the MetaCompositor instance. Make users of this
functionality get MetaLaters instance from the compositor, and stop
using the global meta_later() API.

display: Use non-singleton MetaLater API

tests: Use non-singleton MetaLater API

meta/common: Make docs refer to context aware MetaLater API

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2718>
2022-12-17 15:13:48 +01:00
Jonas Ådahl
e9cd2b60a6 tests: Make tests components have ownership chains as well
This means we can eliminate the use of scattered singletons that isn't
added by the tests or the test framework itself.

tests: Don't get backend from old singleton getter

Either use the ownership chain, or the explicit test context instance
pointer.

tests/wayland: Pass context to test client constructor

So that we can get the Wayland compositor directly from the context.

tests: Don't get display from singleton

tests/client: Make test client carry a context pointer

tests/runner: Have test cases carry a context pointer

tests/wayland/test-driver: Get backend from context

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2718>
2022-12-17 15:13:48 +01:00
Jonas Ådahl
c390f70edc backend: Set up and use ownership chains
This means objects have an owner, where the chain eventually always
leads to a MetaContext. This also means that all objects can find their
way to other object instances via the chain, instead of scattered global
singletons.

This is a squashed commit originally containing the following:

cursor-tracker: Don't get backend from singleton

idle-manager: Don't get backend from singleton

input-device: Pass pointer to backend during construction

The backend is needed during construction to get the wacom database.

input-mapper: Pass backend when constructing

monitor: Don't get backend from singleton

monitor-manager: Get backend directly from monitor manager

remote: Get backend from manager class

For the remote desktop and screen cast implementations, replace getting
the backend from singletons with getting it via the manager classes.

launcher: Pass backend during construction

device-pool: Pass backend during construction

Instead of passing the (maybe null) launcher, pass the backend, and get
the launcher from there. That way we always have a way to some known
context from the device pool.

drm-buffer/gbm: Get backend via device pool

cursor-renderer: Get backend directly from renderer

input-device: Get backend getter

input-settings: Add backend construct property and getter

input-settings/x11: Don't get backend from singleton

renderer: Get backend from renderer itself

seat-impl: Add backend getter

seat/native: Get backend from instance struct

stage-impl: Get backend from stage impl itself

x11/xkb-a11y: Don't get backend from singleton

backend/x11/nested: Don't get Wayland compositor from singleton

crtc: Add backend property

Adding a link to the GPU isn't enough; the virtual CRTCs of virtual
monitors doesn't have one.

cursor-tracker: Don't get display from singleton

remote: Don't get display from singleton

seat: Don't get display from singleton

backend/x11: Don't get display from singleton

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2718>
2022-12-17 13:52:51 +00:00
Jonas Ådahl
71371750d2 clutter/input-device: Remove backend property
It will conflict with a MetaInputDevice property that'll have the same
name.

Wasn't set by the native backend anyway, so probably harmless.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2718>
2022-12-17 13:52:51 +00:00
Jonas Ådahl
f8fe7dbdd7 tests/screen-cast: Enable 'screen-cast' debug topic
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2727>
2022-12-13 18:31:14 +00:00