1348 Commits

Author SHA1 Message Date
Jonas Ådahl
5a31b4e7b8 tests/cursor: Add test for transform cursor surfaces
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3859>
2024-12-11 16:22:57 +00:00
Jonas Ådahl
5e4821d9fc tests/cursors: Test viewport based cropping
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3859>
2024-12-11 16:22:57 +00:00
Jonas Ådahl
a9a4923c03 tests/cursor-tests: Also test cursor rendering in screen casting
This uses the ref test infrastructure inside the cursor tests screen
cast client, and verifies the content on the screen cast matches the
content of the compositor, both when using the 'embedded' cursor mode,
and the 'metadata' cursor mode.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3859>
2024-12-11 16:22:57 +00:00
Jonas Ådahl
bcb52960db tests/cursor: Test Wayland client using wp_viewport for scaling
This test doesn't use a separate reference image, but verifies the
result is identical to that of the built in cursor.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3859>
2024-12-11 16:22:57 +00:00
Jonas Ådahl
3d45345789 tests/cursor-tests: Also test a couple of fractional scales
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3859>
2024-12-11 16:22:57 +00:00
Jonas Ådahl
35cbea59cc tests/remote-desktop-utils: Add monitor recording helpers
Will be used in tests for recording existing monitors.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3859>
2024-12-11 16:22:57 +00:00
Jonas Ådahl
8cf41761a9 tests/screen-cast: Move executable launching into helper
It doesn't contain anything screen cast specific, except the
XDG_RUNTIME_DIR, so make it usable from elsewhere. While at it, prepare
it for being able to run the glib test functionality.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3859>
2024-12-11 16:22:57 +00:00
Jonas Ådahl
acd7fa7f50 tests/utils: Rename test runner executable path variable
We'll have more "test clients", so make it a bit more explicit to avoid
shadowing variables.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3859>
2024-12-11 16:22:57 +00:00
Jonas Ådahl
228be80164 tests/monitor-test-utils: Make it explicit when scale should be dynamic
This also avoids loosing precision since the float won't be casted to an
int before being used to configure the test output.

Currently there is only one test that expects the scale to be calculated
dynamically, all the other always assume scale ending up being 1.0
unless explicitly configured in some way.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3859>
2024-12-11 16:22:57 +00:00
Jonas Ådahl
967be91c92 tests/remote-desktop-utils: Allow screen cast only sessions
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3859>
2024-12-11 16:22:57 +00:00
Jonas Ådahl
92f6f2e8fd tests/remote-desktop-utils: Make cursor mode explicit
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3859>
2024-12-11 16:22:57 +00:00
Jonas Ådahl
a4380075a6 tests/remote-desktop-utils: Keep track of current buffer
This will be useful later on when we actually look at the buffer in
places other than when it's actively processed.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3859>
2024-12-11 16:22:57 +00:00
Jonas Ådahl
2386976f5e tests/remote-desktop-utils: Narrow buffer scope
Only actively test MemFd, and don't ever ask for or expect MemPtr, since
we don't support those anyway. Also, for convenience, ask the buffers to
be automatically mmap:ed.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3859>
2024-12-11 16:22:57 +00:00
Jonas Ådahl
9c4e93b055 tests/screen-cast: Split out generic parts to utils file
This will make it easier to add more screen cast / remote desktop test
cases.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3859>
2024-12-11 16:22:57 +00:00
Jonas Ådahl
e9475b2190 tests: Add basic ref-test based cursor sprite test case
It currently contains some basic tests using the built in cursor as well
as traditional buffer scale using Wayland client in different monitor
configurations.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3859>
2024-12-11 16:22:57 +00:00
Jonas Ådahl
129ead488b tests/ref-test: Allow updating only non-existing reference images
This makes it a bit more reliable to add more reference images, but be
sure not to touch any existing ones.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3859>
2024-12-11 16:22:57 +00:00
Jonas Ådahl
9cc5bec0a3 tests/ref-test: Split out image processing bits
This allows it to be used in processes that doesn't have a stage view
etc, e.g. screen cast clients.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3859>
2024-12-11 16:22:57 +00:00
Jonas Ådahl
aeeb710d93 tests/utils: Make wait-for-window helper more generic
It took a MetaTestClient, which wasn't used. To allow it be used for windows
that doesn't come from a MetaTestClient, remove the MetaTestClient
namespace, and update the callers.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3859>
2024-12-11 16:22:57 +00:00
Jonas Ådahl
c280af08c2 tests/wayland/test-client-utils: Add boilerplate for pointer input
This adds wl_seat and wl_pointer boilerplate, and a pointer-entered
signal on the surface helper struct. It's intended to be used by a
future cursor test case client.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3859>
2024-12-11 16:22:57 +00:00
Jonas Ådahl
08147d0c9b tests/wayland: Add int property type to test driver
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3859>
2024-12-11 16:22:57 +00:00
Jonas Ådahl
a0877dc071 tests/wayland: Make test driver properties table multi typed
Store values as GVariant's. This will allow to add other types property
types than strings.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3859>
2024-12-11 16:22:57 +00:00
Jonas Ådahl
29850b7345 tests/utils: Return GTask after flushing input
This silences a debug warning from glib.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3859>
2024-12-11 16:22:57 +00:00
Jonas Ådahl
ff2c329074 tests: Disable animations with context flag instead of env var
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3859>
2024-12-11 16:22:57 +00:00
Jonas Ådahl
1f3dd65594 tests/shell: Allow configuring the background color
This will be used to create background colors that will match fullscreen
window colors, so they can share the same ref test reference image.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3859>
2024-12-11 16:22:57 +00:00
Jonas Ådahl
ea9e8bff2d debug-control: Add InhibitHwCursor property
Inhibits the hardware cursor globally when true.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3859>
2024-12-11 16:22:57 +00:00
Georges Basile Stavracas Neto
8540362d1d cogl/pipeline: Inherit from GObject
Same deal as CoglPipelineLayer.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4155>
2024-12-09 13:23:29 +00:00
Bilal Elmoussaoui
9592aa0bda clutter/tests: Remove interactive tests using gdk-pixbuf
As those tests are not really useful, see previous commit. Removing them
allows us
to get rid of gdk-pixbuf in this code path and so, allowing to
completely remove it
once the MetaBackground API is refactored.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4133>
2024-12-09 12:14:28 +00:00
Bilal Elmoussaoui
a2dd7d6d1d clutter: Move Image down to GNOME Shell
As is, ClutterImage is not really useful, it only serves for rendering a
CoglTexture as an actor. Shell, has a subclass that adds more features
that unfortunately cannot be upstreamed without bringing more gdk-pixbuf
usage inside libmutter, eg implementing GIcon/GLoadableIcon.

It also has requirements based on whether the image is symbolic or not.
Things that Clutter so far doesn't care about.

So just remove ClutterImage & let shells re-implement it themselves if
needed based on their needs.

Note, that once we have ClutterSnapshot, it should be straightforward to
write a custom actor that renders a CoglTexture or so.

This "un"fortunately means getting rid of various interactive tests that
either didn't compile at all or are not useful as is, like all the
remaining interactive tests.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4133>
2024-12-09 12:14:28 +00:00
Michel Dänzer
2c56c9a1da backends: Improve MetaCrtcMode lifetime management
The same MetaCrtcMode objects can be reached via the
MetaOutputInfo::modes array & MetaMonitorMode::crtc_modes arrays and via
the MetaGpuPrivate::modes list, so all of them need to hold their own
references.

In turn, those references need to dropped in meta_output_info_unref and
meta_monitor_mode_free. (meta_gpu_finalize is already dropping the
MetaGpuPrivate::modes list references)

Fixes leak:

==4092== 123 (32 direct, 91 indirect) bytes in 1 blocks are definitely lost in loss record 11,396 of 13,056
==4092==    at 0x4F81D57: g_type_create_instance (gtype.c:1929)
==4092==    by 0x4F64ABF: g_object_new_internal.part.0 (gobject.c:2606)
==4092==    by 0x4F676BA: g_object_new_internal (gobject.c:2923)
==4092==    by 0x4F676BA: g_object_new_valist (gobject.c:2945)
==4092==    by 0x4F67A0C: g_object_new (gobject.c:2418)
==4092==    by 0x4AB578B: meta_crtc_mode_virtual_new (meta-crtc-mode-virtual.c:51)
==4092==    by 0x4B081BB: meta_virtual_monitor_native_new (meta-virtual-monitor-native.c:83)
==4092==    by 0x4AC58CC: meta_monitor_manager_native_create_virtual_monitor (meta-monitor-manager-native.c:603)
==4092==    by 0x496803B: meta_monitor_manager_create_virtual_monitor (meta-monitor-manager.c:621)
==4092==    by 0x4A4A204: create_virtual_monitor (meta-screen-cast-virtual-stream-src.c:625)
==4092==    by 0x4A4A39D: ensure_virtual_monitor (meta-screen-cast-virtual-stream-src.c:663)
==4092==    by 0x4A4A461: meta_screen_cast_virtual_stream_src_notify_params_updated (meta-screen-cast-virtual-stream-src.c:684)
==4092==    by 0x4A568C5: on_stream_param_changed (meta-screen-cast-stream-src.c:1565)

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4149>
2024-12-06 16:49:34 +00:00
Joan Torres
7e847b555b clutter/color-state: Abstract color state and add Params subclass
Most of the implementation at color state was specific to a color state
generated from parameters so move it to a new class Params.

In the next commits a new color state ICC class will be added.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4144>
2024-12-05 22:24:05 +00:00
Jonas Ådahl
24083e1e58 stage: Clear update_scheduled field when update discarded
clutter_stage_schedule_update() sets the field `update_scheduled` to
`TRUE` as an optimization to make redundant updates a no-op. This failed
if there was a pending event and if the stage was not yet mapped.

What happened is:

 * clutter_stage_schedule_update() is called
   - ClutterStage::update_scheduled is set to TRUE
   - frame clock scheduled
 * frame clock dispatches
   - frame is discarded early, no actual stage update happens
 * device is created (e.g. virtual device from remote desktop session)
   - `device-added` event reaches ClutterStage::event_queue
 * stage is shown
   - clutter_stage_schedule_update() is called
     - ClutterStage::update_scheduled is TRUE
     - ClutterStage::event_queue has events in it
     - These two conditions means clutter_schedule_update() becomes a
       no-op

At this point, no more updates will happen from
clutter_stage_schedule_update().

Fix this by resetting `ClutterStage::update_scheduled` to `FALSE` even
if the frame was discarded due to the stage not yet being mapped.

A test case is added that replicates the above descibed events.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3804
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4152>
2024-12-05 00:19:12 +00:00
Jonas Ådahl
904c39116e tests/test-shell: Allow skipping showing the stage
To allow tests to emulate GNOME Shell behavior, where the stage showing
is delayed. Do so by adding the `"options"` property to the plugin
object type. The property expects a vararg GVariant, and supports
the `"show-stage"` (boolean) vararg entry.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4152>
2024-12-05 00:19:12 +00:00
José Expósito
479bb6921d monitor-manager: Configure for lease monitors in ApplyMonitorsConfig
Add a new property to the ApplyMonitorsConfig D-Bus API allowing to set
a list of monitors for lease.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4121>
2024-11-15 14:58:32 +00:00
José Expósito
c93e06696f monitor-manager: Return for lease status in GetCurrentState
Add a new property to the list of monitors returned by the
GetCurrentState D-Bus API indicating whether the monitor is available
for lease or not.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4121>
2024-11-15 14:58:32 +00:00
Jonas Ådahl
3e024ae2d3 thread: Add support for requesting high priority scheduling
In contrast to realtime scheduling, this doesn't risk us getting
SIGKILL:ed when the kernel is doing busy looping in
drmModeAtomicCommit() for some reason, but will according to testing,
right now, give us more or less the same benefit when it comes to
dispatch lateness and commit lateness.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4124>
2024-11-15 12:39:24 +00:00
Jonas Ådahl
1a6c0ea3d0 thread: Make thread priority preference more generic
Either prefer "normal" or "realtime", via an enum, instead of a boolean.
Also make it configurable with an env var
`MUTTER_DEBUG_KMS_SCHEDULING_PRIORITY`, which can be set to either
`normal` or `realtime`.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4124>
2024-11-15 12:39:24 +00:00
Jonas Dreßler
2fdba8cfce tests/monitor-unit: Test initial rotation workaround for portrait-panels
There's a workaround (ec18a559c687 ("monitor-manager: Ignore
tablet-mode-switch on initial config of native portrait mode panels")) for
panels that default to portrait mode, where touch mode is disabled, but
a touchscreen is present. This workaround gets applied when we receive
the first reading from the orientation manager.

Make sure this workaround is applied as expected by adding a test for it.
The test needs to be first in the list of orientation tests, because mutter
only applies the workaround on the first orientation event it receives.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4126>
2024-11-15 12:08:22 +00:00
Olivier Fourdan
4c20584b11 window: Use the MetaWindowConfig
This is a fairly large refactoring to replace the window rect and
fullscreen flag with the new MetaWindowConfig object.

No functional change intended at this point.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4076>
2024-11-12 16:01:35 +01:00
Bilal Elmoussaoui
d92bb351da clutter: Remove duplicated ShaderType
As we have the exact same one in Cogl.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4127>
2024-11-12 10:01:29 +00:00
Bilal Elmoussaoui
1ba28bc6b4 cogl: Get rid of remaining MetaTexture usages
As that pseudo-interface no longer exists since the migration to
GObjectified CoglTexture.
Also moves cogl_meta_texture_foreach_in_region to the correct namespace.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4127>
2024-11-12 10:01:29 +00:00
Jonas Ådahl
744894fa46 tests/input-capture-test-client: Wait for devices before enabling
This fixes a race where the barrier would be activated before all
devices would be created, resulting in an unexpected set of received
events.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4128>
2024-11-11 20:34:02 +00:00
Jonas Ådahl
e417643d78 tests/screen-cast-client: Add a couple of more debug logs
It makes it easier to diagnose issues.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4065>
2024-11-11 14:53:53 +00:00
Jonas Ådahl
9358d00381 tests/screen-cast-client: Don't fail on empty buffers
These are received when doing cursor-only updates.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4065>
2024-11-11 14:53:53 +00:00
Jonas Ådahl
0808c4cf52 tests/screen-cast-client: Remove incorrect 'unused' annotations
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4065>
2024-11-11 14:53:53 +00:00
Jonas Ådahl
b78eda1b73 tests/screen-cast-client: Fix expected order of events
We expect to first enter the 'streaming' state, and then receive a
buffer, not the other way around.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4065>
2024-11-11 14:53:53 +00:00
José Expósito
f93e85f69b monitor: Keep track of the for lease status
Add a flag to MetaMonitor indicating if the monitor is available for
lease and store/update it from the monitor configuration.

Also, add unit tests validating that the configuration is applied and
that invalid configurations fail.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4112>
2024-11-06 15:36:21 +00:00
Bilal Elmoussaoui
696dfaa124 clutter/threads: Remove helper functions
See previous commit

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4077>
2024-10-30 08:32:46 +01:00
Bilal Elmoussaoui
d92893b6f3 clutter/threads: Remove _full functions variant
As they are not used anywhere, in the next commit
we will just remove the whole thing and use glib helpers directly as
there is nothing specific about ClutterThread anymore

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4077>
2024-10-30 08:32:46 +01:00
Joan Torres
56d5b36b86 clutter/color-state: Fix of indentation and duplicated endline
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4108>
2024-10-25 17:30:23 +02:00
Florian Müllner
2a6bee224c tests/shell: Stop implementing plugin_info()
The hook would be optional if anything called `meta_plugin_get_info()`,
except that since commit 4fdbb466e1c ten years ago, nothing has done so.

It seems a bit pointless to export information that is completely
unused, so stop doing that.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4104>
2024-10-21 23:31:16 +02:00