33063 Commits

Author SHA1 Message Date
Ikey Doherty
f385b276d8 compositor/plugins: Ensure libdefault has valid RPATH
Correct dependency analysis for required DT_NEEDED entries is
made difficult due to the lack of DT_RPATH, despite all other
installed libraries in the build setting an RPATH.

Whilst it is true dlopen() still works, this is only because
libmutter is already linked to the main executable, which in turn
links to the private libraries via DT_RPATH.

Signed-off-by: Ikey Doherty <ikey@serpentos.com>
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4150>
2024-11-26 20:24:34 +00:00
Alessandro Astone
7f89e5b881 wayland: Invalidate focus from all touch inputs too
This allows drag-and-drop within the same surface with touch input.

Test case: drag-and-drop a file into a directory in Nautilus.
Prior to this change that would only work if the finger first leaves
then re-enters the surface.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4091>
2024-11-22 18:45:25 +00:00
Jocelyn Falempe
e44620c86e renderer/native: Add BGRX8888 format to the default list
On big endian machine, the native 32bits format is
DRM_FORMAT_BGRX8888, so add this format to the list.

Tested on a s390x VM, using virtio-gpu driver.

Signed-off-by: Jocelyn Falempe <jfalempe@redhat.com>
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4088>
2024-11-22 14:21:31 +00:00
Jocelyn Falempe
18085b0e40 cogl/egl: Choose config only if needed
In try_create_context(), if COGL_EGL_WINSYS_FEATURE_NO_CONFIG_CONTEXT
is set, don't try to choose an egl config.

Signed-off-by: Jocelyn Falempe <jfalempe@redhat.com>
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4088>
2024-11-22 14:21:31 +00:00
Takao Fujiwara
fb86d5d5b0 wayland/text-input: Reset surrounding text values by focus change
For zwp_text_input_v3_set_surrounding_text(), the protocol specifies:

"If the client is unaware of the text around the cursor, it should
not issue this request, to signify lack of support to the compositor."

Mutter currently doesn't clear its stored surrounding text when the
input focus changes, re-using the existing text for the newly focused
client. This already seems problematic, but since clients aren't
supposed to set surrounding text to NULL or an empty string if they
don't have one (and instead should simply avoid calling
`set_surrounding_text()`), this is clearly a bug in Mutter.

Fix it by unsetting the stored surrounding text when removing input
focus from a client.

Fixes: 33088d59db ("wayland/text-input: Pass char based offset to ClutterInputFocus")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3604>
2024-11-20 22:54:54 +00:00
Michel Dänzer
a516090014 backend/native: Handle NULL priv->startup_render_devices
In add_drm_device, calling g_hash_table_insert with NULL for the hash
table (which happens for any device added after mutter finished starting
up) would presumably just drop the key/value pointers on the floor,
leaking the string & MetaRenderDevice object referenced by them. Fixing
this should help for the referenced issue.

In meta_backend_native_take_render_device, g_hash_table_steal_extended
would presumably return FALSE (and log a warning), so the behaviour would
be "correct" by chance.

Issue: https://gitlab.gnome.org/GNOME/mutter/-/issues/3785
Fixes: 58c3734d78e9 ("backend/native: Prepare render devices earlier than KMS")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4136>
2024-11-20 19:38:58 +00:00
Michel Dänzer
206ec7b46b wayland/cursor-surface: Schedule update for frame events
Without this, frame events may never be sent for the cursor surface if
nothing else happens to schedule an update.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3735

v2:
* Use meta_wayland_surface_get_main_monitor. (Sebastian Wick)
v3:
* Move some local variable initializers to the declarations in
  meta_wayland_cursor_schedule_update. (Sebastian Wick)

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4113>
2024-11-20 19:27:26 +00:00
Peter Hutterer
327346f9ea clutter/stage: Don't compress motion from two different device tools
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4117>
2024-11-19 19:23:15 +00:00
Peter Hutterer
4de65bd836 clutter/stage: When compressing relative motion, append the axes
When using a tablet tool in relative mode motion compression may
apply. Doing so drops the axes from the event, leading to a segfault
later when we're trying to broadcast_axis() an event without axes.

Fix this by making sure we copy the axes over during motion compression.
All but the wheel are absolute so we can just take them from the new
event but if we do have wheel data add them together and where the wheel
changes direction skip motion compression.

We can take a few shortcuts here because the clutter implementation
guarantees exactly CLUTTER_INPUT_AXIS_LAST axes so we only need to
put in warning checks in case that ever changes.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3766
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4117>
2024-11-19 19:23:15 +00:00
Jonas Dreßler
423f17a982 wayland/text-input: Add some input validation to set_surrounding()
The cursor and anchor position of the surrounding text *must* be within
(or right before/after) the string that is submitted as surrounding text.
Everything else is a client error that we shouldn't accept and log as such.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3650>
2024-11-19 17:57:17 +01:00
Jonas Dreßler
2c42a28420 wayland/text-input: Don't crash on wrong parameters to delete_surrounding()
meta_wayland_text_input_focus_delete_surrounding() is accessible from JS and
used by gnome-shell via ClutterInputMethod.delete_surrounding(). Mutter
should never crash on invalid function calls from JS, so g_return_if_fail()
instead of asserting in case the parameters are wrong here.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3650>
2024-11-17 20:48:31 +01: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
80a19134ff monitor-manager: Allow to check if config has a visible monitor
Add a new function, similar to meta_logical_monitor_configs_have_monitor()
that, in addition, checks if the monitor is visible.

Refactor, no functional change.

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
Sebastian Wick
4b13aa4c5e docs/debugging: Expand on Renderdoc and built-in support
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4061>
2024-11-15 14:04:35 +00:00
Sebastian Wick
8103301115 renderdoc: Integrate renderdoc into mutter
This allows to capture the next update of all stage views using
meta_backend_renderdoc_capture. Finer control over what stage view is
captured when can be added in the future.

Currently, renderdoc does not support the GL_OES_EGL_image extension
that we depend on for importing dma-bufs. This means that dma-buf
support is broken when mutter in launched with renderdoc.

One can hack up renderdoc to pretend to support GL_OES_EGL_image and
specifically EGLImageTargetTexture2DOES to restore the full mutter
functionality but renderdoc captures replay with a black rectangle where
those dma-buf buffers are being painted.

See:
https://registry.khronos.org/OpenGL/extensions/OES/OES_EGL_image.txt
https://registry.khronos.org/OpenGL/extensions/OES/OES_EGL_image_external.txt

It looks like the renderdoc maintainer does not want to merge support
for the extension: https://github.com/baldurk/renderdoc/pull/2845

We would only need support for dma-buf EGLImages which so it might be
possible to convince the maintainer.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4061>
2024-11-15 14:04:35 +00:00
Sebastian Wick
f467a31d56 onscreen: Get device and window handle for onscreens
This adds a new method which returns the device and window handle for
onscreen framebuffers. Renderdoc uses those handles to target what it
is going to capture.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4061>
2024-11-15 14:04:35 +00:00
Jonas Ådahl
aea9afa6ec kms: Default to high priority KMS thread scheduling
As mentioned in the previous commit, this will give us more or less the
same benefits as realtime scheduling, according to tests, without the
risk of SIGKILL. It's still possible to use realtime scheduling via an
env var, for experimentation.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3065
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3151
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3225
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3358
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3450
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3479
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3751
Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/7967
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4124>
2024-11-15 12:39:24 +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 Ådahl
52aa84b3c3 stage: Make some cursor overlay function names more obvious
Overlays are always cursors, and "redraw overlay" doesn't communicate
that. Add "cursor" or "cursor overlay" to some functions to make it a
bit more obvious in a couple of places.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4066>
2024-11-15 12:24:24 +00:00
Jonas Ådahl
67995f2730 screen-cast-stream-src/virtual: Remove redundant frame scheduling
We're posting damage; that'll mean a frame clock already being
scheduled.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4066>
2024-11-15 12:24:24 +00:00
Jonas Ådahl
ca47be6ee9 screen-cast-stream-src/virtual: Reorganize hooking things up
There were things hooked up (connecting signals, adding stage watches),
but it was a bit disorganized, with "adding watches" doing more, and
"init callbacks" being a bit vague. Split things up to

 * setup view - hook up things that need to listen on a stage view
 * setup cursor tracking - track cursor positions, sprite changes
 * the rest - monitor changes etc

This also properly handles a race condition when we'll enable before the
idle callback creating the view from the virtual monitors is run.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4066>
2024-11-15 12:24:24 +00:00
Jonas Ådahl
7ff5334a3b screen-cast-stream-src/virtual: Stop inhibiting hw cursor
The hardware cursor support in the cursor renderer now acts on a per
stage view basis, so no need to inhibit the hardware cursor, it isn't
going to try to put a hardware cursor on a virtual CRTC anyway.

Instead use overlay inhibitation to decide whether an cursor overlay
should be painted or not. Inhibit the overlay when hidden/metadata, but
not when embedded.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4066>
2024-11-15 12:24:24 +00:00
Jonas Ådahl
13e0b72026 stage: Don't queue overlay damage on views with overlays inhibited
This saves some unnecessary redraws with virtual monitors with
metadata/hidden cursor modes.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4066>
2024-11-15 12:24: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
Jakub Steiner
43cad8d68b fonts: Use static.gnome.org
- centralized font hosting

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4129>
2024-11-12 18:21:01 +01:00
Olivier Fourdan
ad9a192455 window-x11: Emit the configure signal
Emit the configure signal for X11 windows as soon as they get created.

The configuration values then get applied as initial values.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4076>
2024-11-12 16:01:35 +01:00
Olivier Fourdan
9927eaa963 wayland: Emit the configure signal
Emit the configure signal from the xdg_toplevel's apply_state function.

A plugin gets a chance to tweak the initial configuration before it gets
applied.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4076>
2024-11-12 16:01:35 +01:00
Olivier Fourdan
c597feaa67 wayland/window-configuration: Add MetaWindowConfig support
This allows to bridge MetaWaylandWindowConfiguration and
MetaWindowConfig.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4076>
2024-11-12 16:01:35 +01:00
Olivier Fourdan
5a231a4d27 window: Add a window helper function for MetaWindowConfig
The MetaWindowConfig can indicate whether the configuration reflects on
the initial configuration, before the window is first mapped.

Add a smaller helper (private) window function to create the appropriate
"type" of MetaWindowConfig depending whether the window was already
showed or not.

This is preparation work for the following commits where this function
will be used.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4076>
2024-11-12 16:01:35 +01:00
Olivier Fourdan
d44fd167bb window: Add a "configure" signal
This conveys the initial window configuration.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4076>
2024-11-12 16:01:35 +01: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
Olivier Fourdan
a7ef0b137e window: Use the fullscreen API
Use the meta_window_is_fullscreen() API instead of accessing the
fullscreen field of the MetaWindow structure directly.

This is both a (small) cleanup and preparation work for the next commit.

No function change (intended).

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4076>
2024-11-12 16:01:35 +01:00
Olivier Fourdan
7e098ae671 window: Add a MetaWindowConfig type
This is intended to be used in place of the window rect and fullscreen
flags.

That will also allow for a pre-configuration signal to be added, passing
the configuration so that a plugin can tweak the configuration before it
gets applied first.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4076>
2024-11-12 16:01:35 +01:00
Mario Limonciello
ecbe4a5dad Prefer GPUs with built-in panels connected when selecting a primary GPU
Some laptops don't have the integrated GPU come earlier in the PCI topology
which means that when mutter enumerates the GPUs it may select the dGPU
as the primary.

In a laptop context, this is unlikely to work because the eDP panel can
only be actively connected to a single GPU at a time.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3746
Suggested-by: Jonas Ådahl
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4114>
2024-11-12 11:28:59 +00:00
Mario Limonciello
a280280cff backend/native: Refactor choose_primary_gpu_unchecked() to meet style
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4114>
2024-11-12 11:28:59 +00: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
Bilal Elmoussaoui
c143e8e303 cogl: Move get_rectangle_indices to it correct namespace
Keep the implementation in cogl-indices.c though as it is too much of
implementation details to be in cogl-context.c.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4127>
2024-11-12 10:01:29 +00:00
Bilal Elmoussaoui
45296416df cogl: Move blit_framebuffer to it correct namespace
As it belongs into CoglFramebuffer.

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
4345ff6be4 input-capture/session: Start emulating new devices if already active
The client may not wait for devices to be created before enabling,
meaning we might activate the input capture session before the device
emulation is started. This would result in events silently being
dropped.

This helps with the flaky input-capture test case.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4128>
2024-11-11 20:34:02 +00:00
Sebastian Keller
80f92e0a20 cogl/boxed-value: Set size on initialization
Since 1eba07f6 the size of a boxed value is read when calling
_cogl_boxed_value_set_x(). This results in an uninitialized read when
setting uniforms using cogl_pipeline_set_uniform_*() since the size was
not initialized by _cogl_pipeline_override_uniform() when these
functions call _cogl_boxed_value_set_*().

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4125>
2024-11-11 15:37:33 +00:00
Jonas Ådahl
91f1d3dab3 screen-cast-stream-src: Improve state change debug log entry
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4065>
2024-11-11 14:53:53 +00:00
Jonas Ådahl
ee41825f03 screne-cast-stream-src: Fix argument alignment
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4065>
2024-11-11 14:53:53 +00:00
Jonas Ådahl
bf758f349b screen-cast-stream-src: Track buffer sequence number
Use the 'seq' field in the spa_meta_header struct to track buffer
sequence numbers. This can be useful for predictable buffer tracking in
consumers, or for debugging purposes.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4065>
2024-11-11 14:53:53 +00:00
Jonas Ådahl
cb702a7d21 screen-cast-stream-src: Use obj_props array for properties
As is convention.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4065>
2024-11-11 14:53:53 +00:00
Jonas Ådahl
bc9cc0135b screen-cast-stream-src: Remove stray newline
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4065>
2024-11-11 14:53:53 +00:00
Jonas Ådahl
2e068dd124 stage-view: Bump fake swap ready notify callback priority
This will become important when dispatching happens from a frame clock
driver, where the driver itself triggers from a GSource. If the driver
source has a higher priority, we'll risk dispatching before the frame
clock has returned to a state expecting to be dispatched.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4065>
2024-11-11 14:53:53 +00:00