1
0
Fork 0
Commit graph

11854 commits

Author SHA1 Message Date
Jonas Ådahl
08d2155b6c shaped-texture: Rename GObjectClass pointer variable
To be consistent with the rest of mutter, call it `object_class`.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3443>
2023-12-06 13:45:03 +00:00
Jonas Ådahl
68412cedac shaped-texture: Get type from klass
We don't need to get the type from the type casted class pointer, just
get it from the one from the function argument.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3443>
2023-12-06 13:45:03 +00:00
Jonas Ådahl
b282097834 clutter/stage-view: Rename offscreen pipeline vfunc
It doesn't really "set it up", it just sets the transform according to
the renderer view state. We'll do more setup outside, so lets rename it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3443>
2023-12-06 13:45:03 +00:00
Jonas Ådahl
a27949d25e renderer/native: Stop passing around CoglContext when creating offscreen
We can easily get it, so it's unnecessary to pass it around everywhere.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3443>
2023-12-06 13:45:03 +00:00
Michel Dänzer
c47730894e wayland/dma-buf: Prefer sync_file for dma-buf readiness source
Similarly to https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3389,
this avoids over-synchronization due to the client reading from the
buffer, e.g. if drawing a frame re-uses the previous frame contents.

v2:
* Rename owned_fd → owned_sync_fd (Sebastian Wick)
* Put curly braces around do/while loop

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3408>
2023-12-05 14:53:21 +00:00
Michel Dänzer
0e471bcea7 wayland/dma-buf: Refactor create_source helper
No functional change intended.

v2:
* Make local source assignment separate from its declaration
  (Ivan Molodetskikh)

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3408>
2023-12-05 14:53:21 +00:00
Jonas Ådahl
501d19656e context: Make ClutterContext a GObject and move to separate file
This is a step in cleaning up the Clutter context management. By making
it a GObject it's easier to add e.g. properties and features that helps
with introspection.

For now, this means the context creation is changed to go via a
"constructor" (clutter_create_context()). This is so that the global
context singleton can be mantained outsid of ClutterContext, until it
can be removed.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2016>
2023-12-05 14:39:25 +00:00
Jonas Ådahl
6aebd5407d stage/impl: Fix variable naming consistency
Changed to follow convention in mutter.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2016>
2023-12-05 14:39:25 +00:00
Jonas Ådahl
f14b5da387 clutter/backend: Remove 'finish_init()' vfunc
The original purpose of being able to report errors is no longer
relevant, since the Clutter backend is now practically a thin wrapper
around the actual backend, which has already dealt with error reporting.
Thus move this to the regular constructor path.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2016>
2023-12-05 14:39:25 +00:00
Carlos Garnacho
6ad0114d1f compositor: Undo MetaWindowDrag on MetaWindow::unmanaged signal
The current usage of MetaWindow::unmanaging may result in confused
focus window lookups while undoing the MetaWindowDrag grab (i.e.
still pointing to the window that is now being unmanaged).

The meta_window_unmanage() function itself takes care of changing
focus outside of the window being unmanaged, so postpone the
MetaWindowDrag undoing to a point after that is done.

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3073
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3376>
2023-12-05 14:16:27 +00:00
Michel Dänzer
75d00027ca kms: Remove dead MetaKmsPageFlipListenerFlag type
Unused since 02b1cfe08f ("onscreen/native: Handle unexpected scanout
failures async").

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3389>
2023-12-05 12:51:32 +00:00
Michel Dänzer
e8a213beef kms/impl-device/atomic: Set IN_FENCE_FD for direct scanout
Since meta_kms_impl_device_get_sync_file always returns the same
file descriptor referencing the same sync_file, this means the atomic
ioctl doesn't need to wait for any fences to signal. This is fine
because we already waited for the buffer to become idle before applying
the Wayland surface state.

Fixes the atomic commit ioctl spuriously synchronizing to the screen
cast paint (at least with the amdgpu driver), which could result in
the page flip missing its target scanout cycle.

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

v2:
* Rename local variable to signaled_sync_file for consistency with new
  function name

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3389>
2023-12-05 12:51:32 +00:00
Michel Dänzer
281ff86b4b kms/impl-device: Add meta_kms_impl_device_get_signaled_sync_file helper
It returns a file descriptor which references a signaled sync_file.

v2:
* Change function name and add Doxygen comment to hopefully make its
  purpose a bit clearer (Ivan Molodetskikh)
v3: (Jonas Ådahl)
* Create sync_file from scratch via a syncobj, no buffer needed anymore
* Initialize priv->sync_file = 1 and use g_clear_fd in finalize

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3389>
2023-12-05 12:51:32 +00:00
Michel Dänzer
3ad32ee0bc kms/plane: Add META_KMS_ASSIGN_PLANE_FLAG_DIRECT_SCANOUT flag
It marks plane assignments for direct scanout.

Preparation for following commits, no functional change intended.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3389>
2023-12-05 12:51:32 +00:00
Michel Dänzer
0f52c2a6da onscreen/native: Plumb through MetaKmsAssignPlaneFlag
Through meta_onscreen_native_flip_crtc and
meta_crtc_kms_assign_primary_plane.

Preparation for following commits, no functional change intended.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3389>
2023-12-05 12:51:32 +00:00
Michel Dänzer
ebf9a1edde ksm/plane: Add support for IN_FENCE_FD property
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3389>
2023-12-05 12:51:32 +00:00
Sebastian Wick
962ca18341 cogl/tests: Skip 10bpc tests if the pixel formats are not supported
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3429>
2023-12-05 08:47:11 +00:00
Daniel van Vugt
2a17a5dee8 onscreen/native: Remove trailing whitespace
check-code-style complains about this, when it works (after !3426).

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3430>
2023-12-05 08:30:03 +00:00
Jonas Ådahl
adc5489ba7 Add debug controller
The debug controller can optionally, when passing --debug-control,
enable manipulating debug state, so far enabling/disabling HDR, via
D-Bus.

It's always created, in order to have a place to store debug state and
emit signals etc when it changes, but so far, it doesn't have its own
state it tracks, it just mirrors that of the monitor manager.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3432>
2023-12-01 14:25:08 +00:00
Jonas Ådahl
d5253b1385 build: Make input-capture use declarative D-Bus code generation
This was cleaned up, but a input capture rebased didn't port to the new
way of declaring what D-Bus protocol files that should go through code
generation.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3432>
2023-12-01 14:25:08 +00:00
Jonas Ådahl
294739db15 monitor-manager: Apply HDR settings before updating the stage
This means we can make use of the HDR configuration of outputs to derive
stage rendering configuration.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3432>
2023-12-01 14:25:08 +00:00
Jonas Ådahl
3561f3c20e monitor-manager: Set up experimental HDR change listener after starting
This means we can fiddle with it during startup without an accidental
reconfigure being sneaked in by the listener.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3432>
2023-12-01 14:25:08 +00:00
Jonas Ådahl
e4badfecb3 monitor-manager: Allow forcing experimental HDR mode with an env var
This makes it possible to test without GNOME Shell and looking glass.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3432>
2023-12-01 14:25:08 +00:00
Jonas Ådahl
be3394646f monitor-manager: Stop leaking experimental HDR setting
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3432>
2023-12-01 14:25:08 +00:00
Carlos Garnacho
9f89421ef5 backends: Attempt a fallback to 'default' cursor on failed lookups
While we should ideally have a sensible cursor theme, handle the
case of cursor themes that lack certain cursor names, and fallback
to the 'default' cursor in those cases.

The 'grey rectangle' fallback is still left, in case we even fail
to load a 'default' cursor.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3295>
2023-11-30 20:38:22 +00:00
Carlos Garnacho
d970c9db1a backends: Use standard cursor names from the CSS specification
This is the preferred name set, and handled by adwaita icon theme.
Use the names from https://www.w3.org/TR/css-ui-4/#cursor, like
GDK does at https://docs.gtk.org/gdk4/ctor.Cursor.new_from_name.html.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3040
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3295>
2023-11-30 20:38:22 +00:00
Pascal Nowack
a2a4067e07 screencast: Add ability to stop streams
When a stream is destroyed by a consumer, mutter won't be able to
recognize that.
For mutter, the stream just paused, but did not disconnect, because the
connection state of a PipeWire stream only represents, whether the
respective PipeWire context is connected to PipeWire.
In addition to that, it may be the case, that the stream consumer just
recreates the stream.
So even if mutter would be able to know, when the stream consumer
destroyed a stream, but not the whole screencast or remote-desktop
session, then mutter would not know, whether the stream will be resumed
eventually or not.

So, add an explicit API call to the screencast interface to stop a
stream.
For virtual streams, this also means, that the respective virtual
monitor is destroyed.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2889
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3307>
2023-11-30 12:22:59 +01:00
Pascal Nowack
d2122a02a3 monitor-manager: Reload monitor manager in idle callback
When a virtual stream is destroyed, its respective virtual monitor is
destroyed too. When the virtual monitor is destroyed, mutter reloads
the monitor manager.
However, at this point, the virtual stream is not completely destroyed
yet. The viewport of the virtual monitor still exists at this point and
when the monitor manager reloads, it will try to fetch the logical
monitor of the now destroyed virtual monitor, which will fail and thus
gnome-shell will run into a segfault.

Fix this situation by reloading the monitor manager in an idle callback.
When the monitor manager reloads, the virtual monitor is completely
gone, since the viewport of the virtual monitor is destroyed after the
virtual monitor itself.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2864
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3307>
2023-11-30 12:22:52 +01:00
Pascal Nowack
e70fa342a9 monitor-manager: Fix minor code style issue
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3307>
2023-11-30 12:13:26 +01:00
Jonas Ådahl
822ea67358 tests/utils: Add helper for waiting for monitor reconfigurations
This is useful after having removed a virtual monitor, which
will soon reconfigure in an idle callback.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3307>
2023-11-30 12:13:26 +01:00
Jonas Ådahl
5dc0824ea9 tests/utils: Raise error if monitors changed while waiting for paint
If it does, the views we are waiting for won't get painted.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3307>
2023-11-30 12:13:26 +01:00
Jonas Ådahl
c3c144f991 color-manager: Don't try to manage virtual monitors
There is no way to set any gamma luts, or do anything other color
management related. Eventually we'll probably want to, but that requires
bringing color management plumbing to PipeWire.

Doing this is also needed when running a headless session, as when
headless, polkit doesn't let us create colord devices without explicit
user permission, meaning we'll spam the session with useless dialogs
each time a session is started.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3423>
2023-11-27 14:21:37 +00:00
Carlos Garnacho
8de30c3b6e core: Disconnect notify::is-grabbed signal when closing display
Given destruction order, the display goes away before the stage, so
this lingering signal connection may trigger unintended crashes.

Fixes: 05eeb684d1 ("window: Postpone focusing until grab ended if uninteractable")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3422>
2023-11-24 13:54:05 +01:00
Daniel van Vugt
8103ebc21a backends/native: Count MetaRenderDeviceEglStream instances externally
`count_mode_setting_devices` was incorrect in both name and in function.
What it was actually doing was counting GPUs that had been registered with
the backend so far (during the `init_gpus` loop). What it was intended to
do was to count the number of `MetaRenderDeviceEglStream` instances, which
is the thing we're limited to only one of. So `count_mode_setting_devices`
would return zero whenever the first GPU initialized happened to be a
`MetaRenderDeviceEglStream`, which would in turn prevent
`MetaRenderDeviceEglStream` from successfully initializing. Seems it only
ever worked in the case of a hybrid system where the first GPU initialized
was GBM-based.

Now we count `MetaRenderDeviceEglStream` instances (zero or one) externally.
This allows initialization to succeed when it happens to be the first (or
only) GPU. And so `MUTTER_DEBUG_FORCE_EGL_STREAM=1` now works.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2905>
2023-11-24 15:07:16 +08:00
Daniel van Vugt
6cb68d39f5 native/render-device-egl-stream: Remove unused variable
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2905>
2023-11-24 15:07:16 +08:00
Michel Dänzer
69e0ce36b1 renderer/native: Try 10 bpc formats for EGL surfaces
For scanout on a secondary GPU, for the time being try only formats
which are guaranteed to be renderable with GLES3, which notably excludes
10 bpc formats without alpha channel.

v2:
* Use separate format array for 10 bpc formats without alpha.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3139>
2023-11-23 20:11:31 +00:00
Michel Dänzer
e1f795ff79 onscreen/native: Add and use choose_onscreen_egl_config helper
If the EGL_KHR_no_config_context extension is supported, use it to
choose a format per onscreen which is compatible with the scanout CRTC
and the GL rendering API used.

Suggested by Jonas Ådahl.

v2:
* Drop code which checked for GLES3 renderability. Makes no sense for
  various reasons, in particular that EGLconfigs are about EGLSurfaces,
  whereas secondary GPU contexts use an FBO for blitting.
* Use error parameter directly for meta_renderer_native_choose_gbm_format
  call (Jonas Ådahl)

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3139>
2023-11-23 20:11:31 +00:00
Michel Dänzer
4c42eab358 renderer/native: Refactor meta_renderer_native_choose_gbm_format helper
Preparation for the following commits, no functional change intended.

v2:
* Pass through MetaEgl pointer
v3:
* Make it return gboolean (Robert Mader)
v4:
* Add debug logging and corresponding purpose parameter
v5:
* Fix excessive function parameter indentation (Jonas Ådahl)

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3139>
2023-11-23 20:11:31 +00:00
Sebastian Wick
3897bf68f7 tests/wayland-unit-tests: Order unit test categories alphabetically
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3394>
2023-11-22 13:56:48 +00:00
Sebastian Wick
c0952f02e7 tests/wayland-unit-tests: Use the same naming convention for all tests
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3394>
2023-11-22 13:56:48 +00:00
Sebastian Wick
e1812dbf86 tests/wayland: Order test clients and add missing dependencies
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3394>
2023-11-22 13:56:48 +00:00
Sebastian Wick
97c1d19017 wayland-buffer: Use MetaFormatInfo to find supported formats
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3280>
2023-11-22 12:11:38 +00:00
Sebastian Wick
dbdc821ca7 multi-texture-format: Expose immutable fields directly
Split the struct into mutable and immutable parts. Access the mutable
parts via getters and the immutable parts via a single struct. This
avoids copying around the immutable parts.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3280>
2023-11-22 12:11:38 +00:00
Sebastian Wick
6f1edfc776 common/drm-formats: Rename to MetaFormatInfo and simplify API
Every format kind has it's own function to search for a MetaFormatInfo
from which contains all the information.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3280>
2023-11-22 12:11:38 +00:00
Ivan Molodetskikh
2d1fc65b3a Adjust COGL_TRACE names to improve automatic processing
In profilers with a timeline or flame graph views it is a very common
scenario that a span name must be displayed in an area too short to fit
it. In this case, profilers may implement automatic shortening to show
the most important part of the span name in the available area. This
makes it easier to tell what's going on without having to zoom all the
way in.

The current trace span names in Mutter don't really follow any system
and cannot really be shortened automatically.

The Tracy profiler shortens with C++ in mind. Consider an example C++
name:

SomeNamespace::SomeClass::some_method(args)

The method name is the most important part, and the arguments with the
class name will be cut if necessary in the order of importance.

This logic makes sence for other languages too, like Rust. I can see it
being implemented in other profilers like Sysprof, since it's generally
useful.

Hence, this commit adjusts our trace names to look like C++ and arrange
the parts of the name in the respective order of importance.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3402>
2023-11-22 11:46:07 +00:00
Georges Basile Stavracas Neto
f96d6b0afe screen-cast/monitor-src: Bring back blitting
Now that the monitor screencast records to DMA-BUF buffers immediately
(since bc2f1145d8), and we know which phase of the paint rountines we
are (since last commit), we have the opportunity to bring back the
blitting technique.

Bring back blitting. This time, instead of simply failing if the blit
fails, add a fallback path that does a stage paint if something goes
wrong. Unlike the previous implementation of blitting, this one only
blits the current view - it does not blit all views that intersect
with the screencasted monitor.

Embedded cursors should still be fine because hardware cursor is
inhibited while embedded cursor screencasts are running.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3406>
2023-11-22 07:55:04 +00:00
Georges Basile Stavracas Neto
91bdb2b692 screen-cast/src: Track paint phase
Track where we are in terms of the paint cycle. Do this through an
enumeration that is passed through the paint vfuncs of screencast
sources.

Right now, this information is not used by any one of the sources,
but next patch will use it to prevent blitting when detached from
the paint cycle.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3406>
2023-11-22 07:55:04 +00:00
Robert Mader
9ddb0371c6 cursor-renderer/native: Disable HW cursor when inhibited by backend
We need to disable the hardware cursor in some situations, notably when
doing a screencast with clients that require an embedded cursor.

While a API to do so is in place already, until now we didn't actually
make use of it. Do so.

Closes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/7007

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3412>
2023-11-20 22:51:57 +01:00
Jonas Ådahl
8d3696f39a monitor-manager/x11: Ignore errors when creating tiled monitors
The error is most likely a race where the tiled outputs disappeared
before we had the chance to turn them into a whole monitor. Ignoring the
error should be harmless, as we should be receive another RANDR event
where we'd eventually fix things up.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/7120
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3335>
2023-11-18 10:33:23 +00:00
Carlos Garnacho
571acf57d1 backends/native: Make tablet devices "floating"
With the existing ClutterInputMode terminology (inherited from XI2),
hardware devices may be "physical" (i.e. attached to a logical device),
or "floating" (i.e. detached from all logical devices).

In the native backend, tablet devices are closer to "floating" than
"physical", since they do not emit events relative to the ClutterSeat
pointer logical device, nor drive the MetaCursorTracker sprite. This
is in contrast to X11 where all tablet devices drive the Virtual
Core Pointer by default, along with every other pointing device.

Change this mode in the Wayland backend to be more coherent. The
existing checks on the ClutterInputMode along Mutter seem appropriate
for handling these as floating devices, since they mainly care about
logical vs non-logical.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3393>
2023-11-17 20:49:18 +00:00