13394 Commits

Author SHA1 Message Date
Bilal Elmoussaoui
5a2ef3ca4b cursor-sprite: Get Backend from cursor tracker
Instead of going through the global ClutterBackend

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4201>
2025-01-10 16:18:29 +00:00
Sebastian Wick
aea1aee79e 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>
2025-01-10 14:29:50 +00:00
Jonas Ådahl
e7ff05632d 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>
2025-01-09 16:34:35 +00:00
Jonas Ådahl
7273f30234 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>
2025-01-09 16:34:35 +00:00
Jonas Ådahl
ff58ef4bb7 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>
2025-01-09 16:34:35 +00:00
Jonas Ådahl
d579bf4a6c tests/cursor-tests: Move cursor state helper to test utils
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4205>
2025-01-09 16:34:35 +00:00
Jonas Ådahl
03553daacb 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>
2025-01-09 16:34:35 +00:00
Jonas Ådahl
16e2c4785d 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>
2025-01-09 16:34:35 +00:00
Jonas Ådahl
29571397bc 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>
2025-01-09 16:34:35 +00:00
Robert Mader
235086c788 multi-texture-format: Use BT709 coefficients in the YUV shader
In order to be consistent with KMS, i.e. avoid noticable color changes when
switching between hardware plane offloading and compositing.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4204>
2025-01-09 15:28:25 +00:00
Robert Mader
377532f2f5 onscreen/native: Set default color encoding and range values
In order to ensure consistent behavior with the composited path as well as across
different KMS drivers. In the future we'll want to use other values as well,
requested by client via the upcoming color representation protocol.

Note that right now KMS drivers default to different values. Most use BT709 and
narrow range, notably Intel and AMD, but some others do not.

BT709/narrow is arguably a much better default than BT601/narrow  as the former is
used for most contemporary video content and the later more for still images.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4204>
2025-01-09 15:28:25 +00:00
Robert Mader
5bb7a0f13e kms: Add support for color encoding and range plane properties
Which are required for correct YUV->RGB conversion. Note that encoding refers
to the matrix coefficients.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4204>
2025-01-09 15:28:25 +00:00
Derek Foreman
fd39ca9f20 wayland: Add support for FIFO commits
New protocol that allows a client to require that a previously flagged
content update must be presented before a content update can be applied.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3355>
2025-01-08 10:35:46 -06:00
Derek Foreman
14c70c4f53 wayland/commit-timing: Add support for the commit-timing-v1 protocol
Allow clients to add timestamps to content updates.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3355>
2025-01-06 09:21:15 -06:00
Derek Foreman
a645659440 wayland: Add timed transactions
Allow a transaction to have a timing constraint.

Any transaction with a timing constraint will be deferred at its initial
commit, without testing the target time. The timing constraints are cleared
later in an on_before handler immediately before repaint.

The new frame clock api to schedule later ticks is use to ensure we get an
appropraitely timed tick to clear the constraint.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3355>
2025-01-06 09:21:15 -06:00
Bilal Elmoussaoui
4ee657e31f cogl/texture: Drop set_auto_mipmap vfunc
As it is only relavant for 2D textures.
Allows getting rid of the is-primitive property which was enforcing only 2D textures
can use the set_auto_mipmap function.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4200>
2025-01-02 18:04:27 +00:00
Gert-dev
dfa3755f55 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>
2025-01-02 16:59:00 +00:00
Gert-dev
ada199621c meta/egl-gbm: Use g_autofd to clean up BO FD automatically
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4027>
2025-01-02 16:59:00 +00:00
Gert-dev
ca7345588f meta/egl-gbm: Avoid using fixed size for number of planes
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4027>
2025-01-02 16:59:00 +00:00
Gert-dev
507409f5d0 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>
2025-01-02 16:59:00 +00:00
Gert-dev
110bdf0e9f 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>
2025-01-02 16:59:00 +00:00
Bilal Elmoussaoui
5621134399 clutter: Make cairo dependant on fonts build option
As it is only used there. Once we have removed cairo usage from meta, we
can make it tests specific.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4106>
2024-12-28 12:15:12 +00:00
Bilal Elmoussaoui
32c5faf010 build: Add a new fonts option
Allowing to disable font rendering integration, making it possible to
build Mutter without pango/harfbuzz/fribidi dependencies.

This commit also adds a new clutter-pango header that is used to include
pango specific bits.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4106>
2024-12-28 12:15:12 +00:00
Bilal Elmoussaoui
b0b1e0ef4e clutter: Inline character direction detection helper
By doing so, we can make the fribidi dependency specific to having x11
backend or fonts rendering support.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4106>
2024-12-28 12:15:11 +00:00
Bilal Elmoussaoui
53fd1e43f1 shaped-texture: Add missing cairo include
Would be needed with next commit.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4106>
2024-12-28 12:15:05 +00:00
Michel Dänzer
23f3c17f0c kms/impl-device: Use deadline timer for all updates
Not with VRR though, because the deadline timer fires at most every 33ms
then.

Previously, the deadline timer was used only for cursor-only updates.
Using it for other updates means they pick up the latest cursor position
available at the deadline, resulting in the lowest possible input→output
latency for cursor movement.

TTBOMK this unlocks the full potential of the KMS thread given the
current atomic KMS API.

v2:
* Don't call meta_kms_update_merge_from with twice the same update
  pointer.
v3:
* Don't arm deadline timer if crtc_frame->pending_page_flip is true.
v4:
* Tweak want_deadline_timer indentation per check-code-style CI job.
v5:
* Also check crtc_frame->await_flush for want_deadline_timer.
v6:
* Tweak coding style to keep lines shorter. (Jonas Ådahl)

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3964>
2024-12-23 09:29:07 +00:00
Michel Dänzer
315dfaa5d4 kms/impl-device: Simplify meta_kms_impl_device_schedule_process logic
There's no need for a label.

No functional change intended.

v2:
* Keep early returns separate. (Jonas Ådahl)

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3964>
2024-12-23 09:29:07 +00:00
Michel Dänzer
0d7752a07d kms/impl-device: Move error handling into ensure_deadline_timer_armed
No functional change intended.

v2:
* Fix coding style per CI.
v3:
* Fix ensure_deadline_timer_armed parameter indentation. (Jonas Ådahl)

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3964>
2024-12-23 09:29:07 +00:00
Michel Dänzer
3353962c38 kms/impl-device: Move up ensure_deadline_timer_armed definition
Preparation for next commit, no functional change intended.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3964>
2024-12-23 09:29:07 +00:00
Michel Dänzer
37d1a20644 kms/impl-device: Use discard_update for pending_update as well
Previously it was just dropped on the floor with no feedback, which
could result in the main thread waiting for something which never
happens.

Fixes: 0d9fd1ead7a7 ("kms/impl-device: Destroy submitted update in disarm_all_deadline_timers")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3964>
2024-12-23 09:29:07 +00:00
Michel Dänzer
f8e8dad0f4 kms/impl-device: Refactor discard_update helper
No functional change intended.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3964>
2024-12-23 09:29:07 +00:00
Michel Dänzer
f8524159cc 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: af250506fbe8 ("kms/impl-device: Queue result when discarding submitted update")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3964>
2024-12-23 09:29:07 +00:00
Jonas Ådahl
aad237a04a renderer/native: Don't close DMA buf fds before handing them forward
We closed all the DMA buffer fds after creating the DMA buffer backed
CoglFramebuffer, which meant that the fds we passed to CoglDmaBufHandle
were already closed. This broke screen casting with DMA buffers.

Fixes: 8509b74532 ("Make DMA buffer allocation format and modifier aware")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4177>
2024-12-12 15:38:23 +00:00
Sebastian Wick
42ba494f07 backend/native: Remove meta_backend_native_get_launcher
We can go through MetaBackend to the launcher now and this commit
changes the last user over to it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4130>
2024-12-12 15:30:36 +01:00
Sebastian Wick
a4db61d3e4 backend/native: Remove meta_backend_native_get_seat_id
The last user of it was udev but it now goes through the launcher so we
can remove it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4130>
2024-12-12 15:30:36 +01:00
Sebastian Wick
6d3d718684 backend: Remove useless skip annotation
Those functions are declared in the meta-backend-private.h file which is
not introspected.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4130>
2024-12-12 15:30:36 +01:00
Sebastian Wick
e68728f151 udev: Create udev in MetaBackend
So we can use it for backlight control in both the native and X11
backends.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4130>
2024-12-12 15:30:35 +01:00
Sebastian Wick
387a6e82e5 build: Only add gudev_dep/libudev_dep once
We already add them if have_libgudev is true, and for native builds it
always is true.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4130>
2024-12-12 15:27:11 +01:00
Sebastian Wick
15d4123bd1 udev: Move from backends/native/ to backends/
This makes it possible to use udev even for backends which are not
native. Specifically we want to start controling backlights in mutter
which has to happen for both native and X11.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4130>
2024-12-12 15:27:11 +01:00
Sebastian Wick
11b4de08c4 udev/native: Remove dependencies on the native backend
The generic backend now provides the launcher which is the last native
specific dependency. This makes it possible to move the udev component
to the generic backend.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4130>
2024-12-12 15:27:11 +01:00
Sebastian Wick
10cbda69e6 backend: Add pause/resume vfuncs to MetaBackend
For now we only pause/resume the rendering in the base class but in the
next few commits, we'll move udev from native to generic and need to
pause/resume it as well.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4130>
2024-12-12 15:26:23 +01:00
Sebastian Wick
30c6104620 backend: Create MetaLauncher in backend and not in backend native
It also adds a vfunc so the MetaBackend subclasses can add more
constraints on what the launcher must support.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4130>
2024-12-12 15:14:39 +01:00
Sebastian Wick
7b944a52fc backend: Reorder vfuncs into init, creation and others
Also fix the formatting a bit and add newlines between each declaration
which makes it easier to parse.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4130>
2024-12-12 15:12:36 +01:00
Sebastian Wick
23c2c0853c launcher: Move from backends/native/ to backends/
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4130>
2024-12-12 15:12:36 +01:00
Sebastian Wick
2dd695e65f launcher: Move public functions to the bottom
As per mutter coding style.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4130>
2024-12-12 15:12:36 +01:00
Sebastian Wick
5d8d3df101 launcher: Fix a few formatting issues
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4130>
2024-12-12 15:12:36 +01:00
Sebastian Wick
1651ac8f2c launcher: Allow creating the launcher without taking session control
Currently only the native backend uses the launcher and it requires
being the session controler, so this commit should not change anything.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4130>
2024-12-12 15:12:36 +01:00
Sebastian Wick
9169ffade0 launcher: Add session-active property to decouple from backend native
By connecting to changes of the new property in backend native itself.
This removes the dependency on the native backend and allows us to move
it to the generic backend.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4130>
2024-12-12 15:12:36 +01:00
Sebastian Wick
6c5f552088 launcher: Turn MetaLauncher into a GObject
This will be useful later when refactoring MetaLauncher.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4130>
2024-12-12 15:12:36 +01:00
Sebastian Wick
9eb29974f1 launcher: Remove unused includes
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4130>
2024-12-12 15:12:36 +01:00