13115 Commits

Author SHA1 Message Date
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
Joan Torres
8f709f26e7 wayland/color-management: Fix setting luminances
It was missing setting luminance type to explicit.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4108>
2024-10-25 17:30:23 +02:00
Gert-dev
ceed33b68e onscreen/native: Use EGLSyncs instead of cogl_framebuffer_finish
cogl_framebuffer_finish can result in a CPU-side stall because it waits for
the primary GPU to flush and execute all commands that were queued before
that. By using a GPU-side EGLSync we can let the primary GPU inform us when
it is done with the queued commands instead. We then create another EGLSync
on the secondary GPU using the same fd so the primary GPU effectively
signals the secondary GPU when it is done rendering, causing the latter
to wait for the former before copying part of the frames it needs for
monitors attached to it directly.

This solves the corruption that cogl_framebuffer_finish also solved, but
without needing a CPU-side stall.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4015>
2024-10-22 19:24:27 +00:00
Gert-dev
9cb01597c9 egl: Add helpers to manage and wait for EGLSync objects
This adds meta_egl_create_sync and meta_egl_destroy_sync to be able to
create and dispose EGLSync objects, respectively, as well as
meta_egl_wait_sync to be able to wait for an EGLSync on the GPU.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4015>
2024-10-22 19:24:27 +00:00
Florian Müllner
7f624800bf compositor: Remove plugin_info() vfunc
Nothing has called it since commit 4fdbb466e1c ten years ago, so
drop the entire thing.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4104>
2024-10-21 23:41:00 +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
Florian Müllner
8172acab93 plugins/default: 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:28:44 +02:00
Sebastian Keller
cb34fafd57 wayland/pointer-constraints: Warp pointer after destroying resource
e994fbf02 moved warping the pointer to before the destruction of the
resource to prevent dereferencing the constraint after destruction.
This however meant that the constraint was still active when the motion
event caused by the warp is handled, which would constrain the pointer
back again to its original position.

This moves the warping of the pointer back to after the destruction of
the resource and instead just retrieves the seat earlier while the
constraint is still valid.

Fixes: e994fbf02 ("wayland/pointer-constraints: Warp pointer before destroying resource")
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3696
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4098>
2024-10-19 20:49:16 +02:00
Michel Dänzer
01249bd9e4 kms/impl-device: Don't merge KMS updates in process_mode_set_update
Based on the discussion leading to
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3999#note_2220825
this shouldn't be necessary.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4069>
2024-10-19 14:40:45 +00:00
Michel Dänzer
118f294a48 onscreen/native: Don't set sync_fd for KMS update if secondary GPU used
The sync_fd represents only the primary GPU work.

Fixes: c2621eca151d ("onscreen/native: Set latest cogl sync_fd on KMS update")

v2:
* Use g_steal_fd. (Georges Basile Stavracas Neto, Sebastian Wick)

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4060>
2024-10-18 14:54:56 +00:00
Michel Dänzer
64ce8b2071 onscreen/native: Rename create_timestamp_query to secondary_gpu_used
This describes the condition it represents, rather than what it's
currently used for.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4060>
2024-10-18 14:54:56 +00:00
Robert Mader
faf4dc21ea meta/stage: Replace \r\n with \n
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4093>
2024-10-18 15:01:46 +02:00
Robert Mader
129a71d0ca cursor-renderer/native: Deduplicate scale and transform code
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4093>
2024-10-18 14:58:03 +02:00
Robert Mader
e32a788179 cursor-renderer: Do pixel alignment a bit later
To avoid multiple identical if statements.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4093>
2024-10-18 14:57:46 +02:00
Robert Mader
72ac8c6987 cursor-sprite: Use early exits when invalidating
To make the code easier to follow. While on it, use `G_APPROX_VALUE`
where appropriate.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4093>
2024-10-18 14:54:45 +02:00
Guacamolie
f8a46b548a Revert "introspection: Make MetaKeyHandlerFunc compatible with master"
This reverts commit bad48ea8155d94af7b62bf4ff42d747f27c7464c.

Commit 666e5f1f9 (keybindings: Port to Clutter, 2013-10-03) changed the
Meta.KeyEventHandler callback so that it would take a Clutter.KeyEvent
instead of an XIDeviceEvent. This removed the need for the "(type
gpointer)" annotation, since Clutter works with introspection.

The gpointer annotation caused GJS to simply skip over the callback
argument. Since this was only the second-last argument, reintroducing it
required updating gnome-shell JS code that used the last 'binding'
argument. This was likely inconvenient at the time, since work was
happening in a separate 'wayland' branch, and compatibility with the
X11-only branch had to be kept. So shortly after, the gpointer
annotation was reintroduced with commit bad48ea81 (introspection: Make
MetaKeyHandlerFunc compatible with master, 2013-12-09), unbreaking the
gnome-shell JS code.

But now that the 'wayland' branch has long been merged, we can fix this
properly by removing the gpointer annotation and updating the JS
handlers instead.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4079>
2024-10-15 18:24:59 +02:00
Sebastian Wick
245dafe811 color-device: Set the color state to BT2020+PQ when HDR is forced
Sets the color state of all monitors to BT2020+PQ even if the monitor
isn't accpeting such a signal.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4035>
2024-10-15 10:37:36 +00:00
Sebastian Wick
2f3ad4be5c core/debug-control: Add new ForceHDR debug control
It will be used to force the color state of all monitors to be as if
they managed to turn on HDR mode. This is useful for debugging shaders
in an environment where an HDR mode capable display is not available,
such as the nested mode.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4035>
2024-10-15 10:37:36 +00:00
Doğukan Korkmaztürk
6a0cc1371c stage-impl: Ensure that a sync object is created in headless mode
During an onscreen swap, the cogl_onscreen_swap_buffers_with_damage()
function ensures that the Cogl renderer creates a sync object every
frame. This sync object is later shared with the Wayland clients that
utilize the explicit sync protocol.

However, in headless mode, the function mentioned above is not called.
As a result, the sync object the Cogl renderer stores seems to be not
created. This causes cogl_context_get_latest_sync_fd() function to
return an invalid sync fd, causing Mutter to not be able to materialize
the sync timeline point that the clients wait for when the explicit sync
protocol is in use.

This change simply adds a call to the cogl_framebuffer_flush() function
to the offscreen swap path to make sure that there is a sync object that
can be shared with the clients, which will be signalled when all the
queued operations before the swap are completed.

Signed-off-by: Doğukan Korkmaztürk <dkorkmazturk@nvidia.com>
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4056>
2024-10-15 09:22:42 +00:00
Sebastian Wick
ef58572df7 edid: Use libdisplay-info's high-level API for populating EdidInfo
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3602>
2024-10-15 09:10:21 +00:00
Sebastian Wick
c820a63b87 edid: Make libdisplay-info hard dep
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3602>
2024-10-15 09:10:21 +00:00
Florian Müllner
34c2767f81 keybindings: Pass generic ClutterEvent* to handlers
While the events when processing keybindings are quite obviously
key events, the individual structs are all opaque and all public
API is provided by the generic ClutterEvent type. That means that
any handler that uses the passed in event must cast it to
ClutterEvent anyway, so drop the cast to ClutterKeyEvent when
processing key events.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4080>
2024-10-14 14:10:05 +02:00
Michel Dänzer
3cf3d5d1c6 kms/crtc: Complain and bail if DRM mode info isn't valid
Otherwise meta_calculate_drm_mode_refresh_rate returns 0.0, which
results in non-sense refresh_interval_us.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3982 fixed that
happening before. This is intended to catch if it ever happens again.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3980>
2024-10-09 18:51:35 +00:00
Bilal Elmoussaoui
3eb5381c46 wayland/inhibit-dialog: Drop duplicated hide call
the destroy and the response handler, already hide the dialog
themselves. The calls here were unnecessary.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3048
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4034>
2024-10-09 10:24:12 +00:00
Bilal Elmoussaoui
fe3192169a Merge CoglPango inside of Clutter
As that is where the whole text rendering integration happens
And would allow us to get rid of some over-abstraction in cogl-pango,
simplify
ClutterSnapshot integration as well

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4004>
2024-10-08 16:00:57 +00:00
Christian Hergert
61c722881d clutter: Classify ClutterStageWindow
Previously ClutterStageWindow was an interface with only one base
implementation (MetaStageImpl) which others inherit from.

This just makes it a class so that we can use _GET_CLASS() API instead of
the costly (by comparison) _GET_IFACE() vtable lookups.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4048>
2024-10-07 13:06:26 +00:00
Jason Gerecke
d7d92c68bd backends/x11: Avoid potential crash in pad_switch_mode
The meta_input_device_get_wacom_device function may return NULL, so
we should check it before use. I'm not 100% sure that the code as
currently written could reach here with a NULL wacom_device, but
that could change in the future.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4070>
2024-10-04 20:49:58 +00:00
Jason Gerecke
d46352b23f display: Do not crash attempting to display OSD for unknown Wacom device
The gnome-control-center has recently allowed unknown tablets to appear
in its UI. The UI provides a "Map Buttons" button that tries to open the
OSD, but if a device is not known there may be no Wacom object to actually
act on.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3722
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4059>
2024-10-04 20:38:55 +00:00
Joan Torres
0ed0367d74 wayland/color-management: Add support for bt.709 TF
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4062>
2024-10-03 11:41:25 +02:00
Joan Torres
f671fea7b9 wayland/color-management: Add support for NTSC primaries
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4062>
2024-10-03 11:41:24 +02:00
Joan Torres
1d4061f21e wayland/color-management: When sending colorspace info send primaries too
clutter_primaries_to_wayland made sense when there only existed
ClutterColorspace. Now that ClutterPrimaries also exist, it makes more
sense to change that func to clutter_colorspace_to_wayland.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4062>
2024-10-03 11:40:51 +02:00
Sebastian Wick
077eb80a8d gir: Correct usage of the closure annotation
Quoting Ebassi https://www.bassi.io/articles/2023/02/20/bindable-api-2023/:

    Whenever you’re describing a function that takes a callback, you
    should always annotate the callback argument with the argument that
    contains the user data using the (closure argument) annotation

    You should not annotate the data argument with a unary (closure).

    The unary (closure) is meant to be used when annotating the callback
    type

Recently gobject-introspection became a bit more strict with this and
that generated some warnings:

    Warning: Cogl: invalid "closure" annotation: only valid on callback
    parameters

This commit fix all the closure annotations.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4058>
2024-10-01 15:39:18 +02:00
Sebastian Wick
b218fc5b7f tests/wayland-drm-lease: Let the test be skipped if not on a tty
By passing META_TEST_RUN_FLAG_CAN_SKIP instead of
META_TEST_RUN_FLAG_NONE.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4049>
2024-10-01 11:38:51 +00:00
Kamil Szczęk
57812546b9 udev: Use current tags when looking for preferred primary devices
In some use cases there is a need to dynamically change the preferred
primary GPU, or get rid of the preference altogether. This is currently
not possible due to a change in udev introduced by systemd v247. This
version made the tags "sticky", meaning there is no way to remove them
once attached. When a tag gets removed, only the CURRENT_TAGS property
reflects that change, the removed tag will remain in the TAGS property.

This also bumps libgudev version to 238, since that version introduces
a function, which we need to get the current tags.

Related: https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1562
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4055>
2024-10-01 11:18:13 +00:00
Joan Torres
2636ff7430 tests/wayland: Add color-management test
Right now multiple image_descriptions are created with different
parameters and are set to a surface.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4020>
2024-10-01 10:55:02 +00:00
Joan Torres
fcbd2e3840 clutter/color-state: Add support for gamma TF
This TF can't be defined as a TransferFunction enum because it needs a
gamma_exp value too.

Add to EOTFType enum a new type: EOTF_TYPE_GAMMA.

With this new type, now EOTFs are unions that can have either
a TransferFunction enum or a gamma_exp.

Set gamma_exp as uniform.

Add the support of it in the color management protocol.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4020>
2024-10-01 10:55:02 +00:00
Joan Torres
3b53f7cb6c clutter/color-state: Drop using default colorspace and default tf
Use the defaults explicitliy, which is SRGB for both.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4020>
2024-10-01 10:55:02 +00:00
Joan Torres
eff17bf1b5 clutter/color-state: Encapsulate primaries, tf and luminance
These properties now are tagged unions:
- ClutterColorimetry:
    Can be from colorspace or primaries;
- ClutterEOTF:
    Can be from known tf or custom gamma exp (next commit);
- ClutterLuminance:
    Can be defined explicitly or derived;

Make the color management protocol use them too.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4020>
2024-10-01 10:55:02 +00:00
Christian Hergert
2666aabde2 tests: Avoid g_assert() use in unit tests
This is aimed towards allowing g_assert() to be compiled out of
release builds by ensuring they do not affect the testsuite.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4011>
2024-09-24 14:51:43 +02:00
Jonas Ådahl
bce2790f7f Revert "window/wayland: Use scale for configured rect in configuration"
This caused https://gitlab.gnome.org/GNOME/mutter/-/issues/2616.

This reverts commit 2a62e690a21f98c22549d8a8c8a9b39916e1bc44.


(cherry picked from commit 2ea002c0df875b9bba18a8580b23e8f4ddfb042f)

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4041>
2024-09-23 22:53:01 +00:00
José Expósito
562beb9314 tests/wayland: Add lease without connectors error test
Add a test that:
- Creates a client
- Creates and submits a lease without connectors
- Check that the compositor returns the correct error

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4031>
2024-09-23 22:38:10 +00:00
José Expósito
973454dbdd tests/wayland: Add duplicated connector lease error test
Add a test that:
- Creates a client
- Creates a lease with a duplicated connector
- Check that the compositor returns the correct error

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4031>
2024-09-23 22:38:10 +00:00
José Expósito
c804222e40 tests/wayland: Add connector lease with leased connector test
Add a test that:
- Creates 2 clients
- Leases a connector using the first client
- Tries to lease the same connector using the second client
- Checks that the first lease succeeded
- Checks that the second lease failed

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4031>
2024-09-23 22:38:10 +00:00
José Expósito
e6178fae6d tests/wayland: Add connector lease test
Add a test that:
- Creates 2 clients
- Leases a connector using the first client
- Checks that the first client receives a lease_fd event
- Checks that both clients receive a connector withdrawn event
- Finishes the lease
- Check that both clients have access to the connector

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4031>
2024-09-23 22:38:10 +00:00
José Expósito
c366e32da6 tests/wayland: Add DRM lease device release test
Add a test that:
- Creates 2 clients
- Releases a device for each client
- Checks that releasing a device for one client doesn't affect the other
- Checks that an error is raised if a released client is used

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4031>
2024-09-23 22:38:10 +00:00
José Expósito
59c4054c91 tests/wayland: Add event queue
Add an event queue to the DRM lease client that allows to check that the
compositor sent the expected events in the expected order.

For the moment, the event queue is used to check that the initial
connection to the compositor works as expected.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4031>
2024-09-23 22:38:10 +00:00
José Expósito
97e50a7285 tests/wayland: Add DRM lease client basic test
Add the most basic possible test that checks that:
- The DRM lease protocol is available
- At least one device is advertised
- At least one connector is available for lease

Organize the code in a way that it is possible to created multiple DRM
lease clients at the same time as future tests will need this.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4031>
2024-09-23 22:38:10 +00:00
José Expósito
b4aba293b0 tests/wayland-test-utils: Add helper to start a client with args
Add a helper function similar to meta_wayland_test_client_new() that
allows to pass command line arguments to the test clients.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4031>
2024-09-23 22:38:10 +00:00
José Expósito
bc8a376b81 tests/wayland: Add DRM lease test scaffolding
Add the required files to run DRM lease using the KVM/tty backends.

DRM lease tests need at least one connector available for lease. Instead
of adding the test to "wayland-unit-tests.c", add it to its own file and
set the environment variable MUTTER_DEBUG_LEASE_CONNECTORS=Virtual-1 to
make the only connector created by VKMS by default available for lease.

This commit doesn't add any tests, just the required files to start
adding them.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4031>
2024-09-23 22:38:10 +00:00
José Expósito
9c536939a1 wayland/drm-lease: Fix reference count cycle
MetaWaylandDrmLeaseDevice and MetaWaylandDrmLeaseConnector hold a
reference to each other.

In both cases, the reference count was increased. Do not increase the
reference count when lease_connector->lease_device is stored to break
the reference count cycle.

Fixes: fb08a597e1d3 ("wayland/drm-lease: Advertize initial connectors")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4031>
2024-09-23 22:38:10 +00:00