1
0
Fork 0
Commit graph

32864 commits

Author SHA1 Message Date
Daniel van Vugt
3ffa98591e onscreen/native: Deduplicate calls to clutter_frame_set_result
All paths out of `meta_onscreen_native_swap_buffers_with_damage` from
here onward would set the same `CLUTTER_FRAME_RESULT_PENDING_PRESENTED`
(or terminate with `g_assert_not_reached`).

Even failed posts set this result because they will do a
`meta_onscreen_native_notify_frame_complete` in
`page_flip_feedback_discarded`.

(cherry picked from commit 24418b952c5bfd28c3e6bbd6bbc47f2cf37c0a5f)
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1441>
Signed-off-by: Mingi Sung <sungmg@saltyming.net>
2025-01-15 13:35:12 +09:00
Daniel van Vugt
a5725185be onscreen/native: Replace an assertion that double buffering is the maximum
Because it soon won't be the maximum. But we do want to verify that the
frame info queue is not empty, to avoid NULL dereferencing and catch logic
errors.

(cherry picked from commit 2076f6e3a91438bf883354888f019931f63dad00)
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1441>
Signed-off-by: Mingi Sung <sungmg@saltyming.net>
2025-01-15 13:35:12 +09:00
Daniel van Vugt
2289c5496d onscreen/native: Log swapbuffers and N-buffering when MUTTER_DEBUG=kms
(cherry picked from commit afc9b7eeb9cf4b1998e0134e0cf98a3cd26c1059)
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1441>
Signed-off-by: Mingi Sung <sungmg@saltyming.net>
2025-01-15 13:35:12 +09:00
Daniel van Vugt
13136155ab onscreen/native: Precalculate secondary_gpu_used flag
It's slightly more efficient, but also we'll soon need it in multiple
functions.

(cherry picked from commit 0fe3c5c29776e87407dadee90edecc6c8ea36960)
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1441>
Signed-off-by: Mingi Sung <sungmg@saltyming.net>
2025-01-15 13:35:12 +09:00
Daniel van Vugt
dc1f3babc1 backends/native: Add set/get_damage functions to MetaFrameNative
(cherry picked from commit 90f5ce55a9b6a3addf82a32a0ea920aa5c969c07)
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1441>
Signed-off-by: Mingi Sung <sungmg@saltyming.net>
2025-01-15 13:35:12 +09:00
Daniel van Vugt
b1337a830e renderer/native: Steal the power save flip list before iterating over it
Because a single iteration might also grow the list again.

(cherry picked from commit d3e50cc023acc440cb483604cc82b04778703f52)
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1441>
Signed-off-by: Mingi Sung <sungmg@saltyming.net>
2025-01-15 13:35:12 +09:00
Daniel van Vugt
2059c8d9d2 renderer/native: Avoid requeuing the same onscreen for a power save flip
This is a case that triple buffering will encounter. We don't want it
to queue the same onscreen multiple times because that would represent
multiple flips occurring simultaneously.

It's a linear search but the list length is typically only 1 or 2 so
no need for anything fancier yet.

(cherry picked from commit 19e62b1299405d630cb7d8ce1f210f00a4903db5)
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1441>
Signed-off-by: Mingi Sung <sungmg@saltyming.net>
2025-01-15 13:35:12 +09:00
Daniel van Vugt
e21ca829e7 kms: Keep a shutting_down flag
(cherry picked from commit 340366ac4a894306a0e48fd28bda35fb9e9319c7)
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1441>
Signed-off-by: Mingi Sung <sungmg@saltyming.net>
2025-01-15 13:35:12 +09:00
Daniel van Vugt
326ffd737e cogl/onscreen: Add function cogl_onscreen_get_pending_frame_count
(cherry picked from commit bc2d423e50ba193ab402904e9e0a75cf7c32ccb7)
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1441>
Signed-off-by: Mingi Sung <sungmg@saltyming.net>
2025-01-15 13:35:12 +09:00
Daniel van Vugt
885442b8cf clutter/frame-clock: Move "last" frame fields into structs
While in double buffering we only care about one previous presentation,
triple buffering will sometimes need to refer to the presentation from
two dispatches prior. So it might help to separate those frame stats
more clearly. This way each frame's dispatch and presentation times are
stored more cohesively such as to not be overwritten during overlapping
frame lifetimes.

Having two types of frame reference (dispatch and presentation) moving
at difference speeds meant that they could not be stored in a ring. Not
all dispatches become presentations and so storing them in a ring would
necessitate very complex conflict avoidance. Instead, a simple reference
counting model was used.

(cherry picked from commit 817a951b246b64fd1c4148e486d24017f71fc4c4)
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3961>
Signed-off-by: Mingi Sung <sungmg@saltyming.net>
2025-01-15 13:35:12 +09:00
Daniel van Vugt
36c77110e8 clutter/frame-clock: Notify on all empty frames
So that we maintain a perfectly balanced number of callbacks:

  dispatch == notify_ready + notify_presented

Otherwise you can't put any useful logic inside notify_ready and be sure
you're handling all the empty frames.

(cherry picked from commit 85f0f4e227b7f6896fc9fe6d6b9da4d568d2a9e7)
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3961>
Signed-off-by: Mingi Sung <sungmg@saltyming.net>
2025-01-15 13:35:12 +09:00
Michel Dänzer
916e85bb26 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.

(cherry picked from commit 01249bd9e4)
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4069>
Signed-off-by: Mingi Sung <sungmg@saltyming.net>
2025-01-15 13:35:12 +09:00
Florian Müllner
96e62be102
Bump version to 47.4
Update NEWS.
2025-01-12 22:29:40 +01:00
Sebastian Wick
d3ad7fdc90 compositor-view/native: Check output color state for direct scanout
The stage view color state is not the output color state but usually a
linear version of it. For direct scanout, we need the view color state
to match the output color state instead.

Fixes: 20c7653d49 ("compositor-view/native: Don't scan out surface with color state mismatch")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4196>
(cherry picked from commit aea1aee79e0fff2ff78e1f4fc4b7650c51c8f14f)
2025-01-10 22:21:47 +01:00
Jonas Ådahl
f086931ad4 tests: Add test for emitting preferred surface scales
It tests both the wl_surface integer scale and fractional scales, for
toplevels, subsurfaces and cursor surfaces. It doesn't yet test DND
surfaces.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4205>
(cherry picked from commit e7ff05632dd3b51169f7d87b95fa150e5f6d7a94)
2025-01-10 22:21:47 +01:00
Jonas Ådahl
cab2769c18 tests/wayland/client-utils: Allow creating role-less surfaces
This makes it easier to create e.g. subsurfaces or cursor surfaces that
inherit generic logic from the WaylandSurface test utility helper type.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4205>
(cherry picked from commit 7273f30234ed03bc6c8f7c48b360d6efb8c0fa87)
2025-01-10 22:21:47 +01:00
Jonas Ådahl
beaccfe934 tests/wayland/client-utils: Bind newer wl_compositor
Out of the new metadata, only gather the preferred scale, which will be
used in a later commit.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4205>
(cherry picked from commit ff58ef4bb7ac846c5e5ffe3b0990568c5bd4b303)
2025-01-10 22:21:47 +01:00
Jonas Ådahl
d14ed5eca8 tests/cursor-tests: Move cursor state helper to test utils
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4205>
(cherry picked from commit d579bf4a6ce7176c008d11627a6442dcb28515e4)
2025-01-10 22:21:47 +01:00
Jonas Ådahl
01e5b27790 wayland/cursor-surface: Update preferred scale monitor
Both when the renderer is set, which happens early shortly after
assigning the role, and when the cursor sprite is prepared at a specific
position, which happens as the cursor moves.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3829
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4205>
(cherry picked from commit 03553daacb9f3107e16c481ae1c6ec28813ddc14)
2025-01-10 22:21:47 +01:00
Jonas Ådahl
dc1416f827 wayland/surface: Add preferred scale monitor role vfunc
Use this new getter for getting the preferred surface scale.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4205>
(cherry picked from commit 16e2c4785d04dd9f2b1178af08153cee299eaf6a)
2025-01-10 22:21:47 +01:00
Jonas Ådahl
0eacaccd05 wayland/surface: Change a term from highest to preferred scale
It isn't always the highest scale for the surface, so change the
terminology in the common path to reflect this.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4205>
(cherry picked from commit 29571397bc9c23134f9c7e0ea6f6d63d93a17cef)
2025-01-10 22:21:47 +01:00
Gert-dev
d385f36aed drm-buffer-gbm: Cache EGLImages created during screen-casting
This consolidates duplicate code in meta_drm_buffer_gbm_blit_to_framebuffer
to use the newly added meta_drm_buffer_gbm_create_native_blit_image, which
also has the side-effect of caching creation of the EGLImage per GBM BO.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4027>
(cherry picked from commit dfa3755f55badd6e58ae4469dbc412f3789a7095)
2025-01-10 22:21:11 +01:00
Gert-dev
3c805cd826 meta/egl-gbm: Use g_autofd to clean up BO FD automatically
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4027>
(cherry picked from commit ada199621c0a3e7e4d39891c8cd1d91b6417b0ac)
2025-01-10 22:21:08 +01:00
Gert-dev
f044fe49ff meta/egl-gbm: Avoid using fixed size for number of planes
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4027>
(cherry picked from commit ca7345588fc96f693b57e68af3ff47fab199e387)
2025-01-10 22:21:02 +01:00
Gert-dev
bc6dc4e98c onscreen/native: Cache created secondary GPU EGLImages in copy path
Creating an EGLImage is rather expensive and is taking the bulk of the
time the secondary GPU copy path is using for each frame. By caching
these per GBM BO we avoid this expensive recreation, which seems to
significantly improve FPS throughput in these scenarios, e.g. an
AMD or Intel iGPU with an NVIDIA dGPU.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4027>
(cherry picked from commit 507409f5d0a7bced42656276e806da6f516ca321)
2025-01-10 22:20:55 +01:00
Gert-dev
d73a16ef61 meta/renderer: Split up meta_renderer_native_gles3_blit_shared_bo
Split off meta_create_gbm_bo_egl_image from
meta_renderer_native_gles3_blit_shared_bo.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4027>
(cherry picked from commit 110bdf0e9f4ffc585e7d7ac273fe3c82736a4b15)
2025-01-10 22:20:49 +01:00
Michel Dänzer
6f58ac217a onscreen/native: Move discarded KMS update handling
To swap_buffer_result_feedback from page_flip_feedback_discarded. The
former is where META_KMS_ERROR_DISCARDED from disarm_all_frame_sources
gets handled here.

Fixes: af250506fb ("kms/impl-device: Queue result when discarding submitted update")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3964>
(cherry picked from commit f8524159cc6b1980ae7e2d4894a7cab0d339fc67)
2025-01-10 22:19:39 +01:00
Jonas Ådahl
dfec672752 tests/cursor: Add test for transform cursor surfaces
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3859>
(cherry picked from commit 5a31b4e7b805280bbbf4d0b165d442f637ed2bdb)
2025-01-10 22:17:07 +01:00
Jonas Ådahl
6cca7923e0 mtk/monitor-transform: Add to/from string helpers
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3859>
(cherry picked from commit 8c2e39323ffe948c39516c55b22511b9ad9e09c8)
2025-01-10 22:17:07 +01:00
Jonas Ådahl
01748dc083 tests/cursors: Test viewport based cropping
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3859>
(cherry picked from commit 5e4821d9fc896b56ebc5dcc3521f8d215a41bf3c)
2025-01-10 22:17:07 +01:00
Jonas Ådahl
374d464256 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>
(cherry picked from commit a9a4923c03d5a00ccf4d2eece0a4fa98833b324f)
2025-01-10 22:17:07 +01:00
Jonas Ådahl
87811cd3d9 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>
(cherry picked from commit bcb52960dbe8ac2cf944acbadaed1b68e366915b)
2025-01-10 22:17:07 +01:00
Jonas Ådahl
74c3c1dcad tests/cursor-tests: Also test a couple of fractional scales
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3859>
(cherry picked from commit 3d45345789b00e1b02251b1306cdaae13fe8f369)
2025-01-10 22:17:07 +01:00
Jonas Ådahl
9b5623cd21 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>
(cherry picked from commit 35cbea59cc1cedcf0bbcb924eb4a00adc43f34d5)
2025-01-10 22:17:07 +01:00
Jonas Ådahl
d1ff64825c 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>
(cherry picked from commit 8cf41761a91b124794aa864c32577c8dd3b3b03c)
2025-01-10 22:17:07 +01:00
Jonas Ådahl
4807b50d4e 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>
(cherry picked from commit acd7fa7f506088d272b3751f255fc9bfb695a441)
2025-01-10 22:17:07 +01:00
Jonas Ådahl
2b5a20f34c 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>
(cherry picked from commit 228be801640ffc9d3f6210dd3940a48ba4121674)
2025-01-10 22:17:07 +01:00
Jonas Ådahl
2c9e95f6db tests/remote-desktop-utils: Allow screen cast only sessions
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3859>
(cherry picked from commit 967be91c92b74b616bb5bf4abaf536a8dc84b26f)
2025-01-10 22:17:07 +01:00
Jonas Ådahl
6bb3572b2c tests/remote-desktop-utils: Make cursor mode explicit
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3859>
(cherry picked from commit 92f6f2e8fdc4ea763021bfb387f8baab78f6aa07)
2025-01-10 22:17:07 +01:00
Jonas Ådahl
b13a1fa949 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>
(cherry picked from commit a4380075a69fbe9efdc77a309c84b026b8eb87d7)
2025-01-10 22:17:07 +01:00
Jonas Ådahl
2d2320decb 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>
(cherry picked from commit 2386976f5eca488ae597dd7fd01a25aa1f96ce46)
2025-01-10 22:17:07 +01:00
Jonas Ådahl
93164ddef1 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>
(cherry picked from commit 9c4e93b055f6ca7e094fbf49087dff7389472f84)
2025-01-10 22:17:07 +01:00
Robert Mader
7dd620d9af screen-cast: Implement viewport support
[jadahl] Rework hotspot calculations

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3859>
(cherry picked from commit e580453df9d4e47ae28d4cc4eb2b424a8dc7e705)
2025-01-10 22:17:07 +01:00
Jonas Ådahl
93fb3b7821 display: Fix cursor sprite sizes with fractional scales
This makes the cursor size match the expectation given by the theme
size. It also means the sprite size now matches GTK4 provided cursor
surfaces using wp_viewport.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3859>
(cherry picked from commit f77d8e2a12a07ef6abe9c9bdfe33bd9d1e1a7ce8)
2025-01-10 22:17:07 +01:00
Jonas Ådahl
f75aa9eb01 cursor-renderer/native: Handle early cursor texture changes
We create the cursor view data when we update the cursor, but allow the
texture to be realized earlier than that. The texture change listener
invalidates the hw cursor validity state, but since it's initialized to
invalid, the hardware cursor will still be correctly handled.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3859>
(cherry picked from commit 8fc1bddf3bd42533bbb064f699d91f378d30804b)
2025-01-10 22:17:07 +01:00
Robert Mader
23b2954c5b cursor-renderer: Add viewport support
This makes the overlay code work which is notably used for screen
sharing and recording if the client doesn't support meta-data cursors.

[jadahl] Changed the approach the way coordinates are scaled.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3859>
(cherry picked from commit 35e5ae718ad56210c74f987748697e21ee631530)
2025-01-10 22:17:07 +01:00
Jonas Ådahl
f3143ccde4 cursor-renderer: Pass renderer when finding highest scale monitor
Do this instead of going via the backend, since we don't need anything
other from the backend.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3859>
(cherry picked from commit 01f2f40475bd3695535ad81e7da93cfc3b7837c7)
2025-01-10 22:17:07 +01:00
Robert Mader
3486885e61 cursor-renderer/native: Add support for viewports
[jadahl] Rework hotspot calculations

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3859>
(cherry picked from commit 19669a3d9d61258e363a5cd6135e14c47daba8ec)
2025-01-10 22:17:07 +01:00
Robert Mader
b216e83779 cursor-sprite: Add API for viewports
[jadahl] Rework hotspot calculations.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3859>
(cherry picked from commit e674c7e454ce8defffa3fc26a33fbc06562d79ad)
2025-01-10 22:17:07 +01:00
Robert Mader
655c3aa08f shaped-texture: Use pipeline matrix helper
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3859>
(cherry picked from commit e402eaa950e34702ff08419065a3815bfc80fd1d)
2025-01-10 22:17:07 +01:00