32975 Commits

Author SHA1 Message Date
Georges Basile Stavracas Neto
a88f0b72aa cogl/pipeline-layer: Inherit from GObject directly
Instead of inheriting from CoglNode, inherit from GObject and manually
manage children.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4155>
2024-12-09 13:23:29 +00:00
Bilal Elmoussaoui
b0219f0697 cogl: Add default impls for FramebufferDriver
Allowing to simplify the NopFramebufferDriver.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4165>
2024-12-09 13:12:29 +00:00
Bilal Elmoussaoui
195a9b5f87 cogl/driver: Make various vfuncs optional
Avoid having to provide an impl for the NopDriver.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4165>
2024-12-09 13:12:29 +00:00
Bilal Elmoussaoui
9592aa0bda clutter/tests: Remove interactive tests using gdk-pixbuf
As those tests are not really useful, see previous commit. Removing them
allows us
to get rid of gdk-pixbuf in this code path and so, allowing to
completely remove it
once the MetaBackground API is refactored.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4133>
2024-12-09 12:14:28 +00:00
Bilal Elmoussaoui
a2dd7d6d1d clutter: Move Image down to GNOME Shell
As is, ClutterImage is not really useful, it only serves for rendering a
CoglTexture as an actor. Shell, has a subclass that adds more features
that unfortunately cannot be upstreamed without bringing more gdk-pixbuf
usage inside libmutter, eg implementing GIcon/GLoadableIcon.

It also has requirements based on whether the image is symbolic or not.
Things that Clutter so far doesn't care about.

So just remove ClutterImage & let shells re-implement it themselves if
needed based on their needs.

Note, that once we have ClutterSnapshot, it should be straightforward to
write a custom actor that renders a CoglTexture or so.

This "un"fortunately means getting rid of various interactive tests that
either didn't compile at all or are not useful as is, like all the
remaining interactive tests.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4133>
2024-12-09 12:14:28 +00:00
Michel Dänzer
4284371a26 wayland/outputs: Use g_hash_table_steal_extended in _update_outputs
g_hash_table_steal leaked the MetaMonitorSpec key in the old
compositor->outputs hash table:

==1059254== 62 (32 direct, 30 indirect) bytes in 1 blocks are definitely lost in loss record 8,232 of 13,059
==1059254==    at 0x48489F3: calloc (vg_replace_malloc.c:1340)
==1059254==    by 0x4C65C19: g_malloc0 (gmem.c:133)
==1059254==    by 0x4956FE8: meta_monitor_spec_clone (meta-monitor.c:108)
==1059254==    by 0x4A7B9E8: meta_wayland_compositor_update_outputs (meta-wayland-outputs.c:555)
==1059254==    by 0x4A7C09E: meta_wayland_outputs_init (meta-wayland-outputs.c:796)
==1059254==    by 0x4A63B60: meta_wayland_compositor_new (meta-wayland.c:874)
==1059254==    by 0x49B58D0: meta_context_start (meta-context.c:523)
==1059254==    by 0x10A8D7: main (mutter.c:148)
==1059254==
==1059254== 62 (32 direct, 30 indirect) bytes in 1 blocks are definitely lost in loss record 8,233 of 13,059
==1059254==    at 0x48489F3: calloc (vg_replace_malloc.c:1340)
==1059254==    by 0x4C65C19: g_malloc0 (gmem.c:133)
==1059254==    by 0x4956FE8: meta_monitor_spec_clone (meta-monitor.c:108)
==1059254==    by 0x4A7B9E8: meta_wayland_compositor_update_outputs (meta-wayland-outputs.c:555)
==1059254==    by 0x4A7BA8C: on_monitors_changed (meta-wayland-outputs.c:572)
==1059254==    by 0x4F5E9BF: g_closure_invoke (gclosure.c:833)
==1059254==    by 0x4F72D82: signal_emit_unlocked_R.isra.0 (gsignal.c:3887)
==1059254==    by 0x4F747A8: signal_emit_valist_unlocked (gsignal.c:3519)
==1059254==    by 0x4F7A665: g_signal_emit_valist (gsignal.c:3262)
==1059254==    by 0x4F7A722: g_signal_emit (gsignal.c:3582)
==1059254==    by 0x49691BD: meta_monitor_manager_notify_monitors_changed (meta-monitor-manager.c:1241)
==1059254==    by 0x496EA8D: meta_monitor_manager_rebuild (meta-monitor-manager.c:3968)

v2:
* Use g_autoptr. (Sebastian Wick, Jonas Ådahl)

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4149>
2024-12-06 16:49:34 +00:00
Michel Dänzer
1e5a79451c kms/impl-device: Call drmModeFreePlaneResources
Fixes leak:

==9634== 60 (16 direct, 44 indirect) bytes in 1 blocks are definitely lost in loss record 8,198 of 13,049
==9634==    at 0x48489F3: calloc (vg_replace_malloc.c:1340)
==9634==    by 0x5DDCD29: drmModeGetPlaneResources (xf86drmMode.c:1243)
==9634==    by 0x4AD94C9: init_planes (meta-kms-impl-device.c:1010)
==9634==    by 0x4ADC7B5: meta_kms_impl_device_init_mode_setting (meta-kms-impl-device.c:2350)
==9634==    by 0x4AD27BC: meta_kms_impl_device_atomic_initable_init (meta-kms-impl-device-atomic.c:1416)
==9634==    by 0x4DD3B32: g_initable_new_valist (ginitable.c:249)
==9634==    by 0x4DD3C19: g_initable_new (ginitable.c:163)
==9634==    by 0x4ACEAE8: meta_create_kms_impl_device (meta-kms-device.c:662)
==9634==    by 0x4ACECD1: create_impl_device_in_impl (meta-kms-device.c:722)
==9634==    by 0x4B01837: meta_thread_impl_dispatch (meta-thread-impl.c:542)
==9634==    by 0x4B00D06: impl_source_dispatch (meta-thread-impl.c:175)
==9634==    by 0x4C5C81E: g_main_dispatch (gmain.c:3357)

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4149>
2024-12-06 16:49:34 +00:00
Michel Dänzer
f11164320a screen-cast-stream-src: Destroy redraw_clip in dispose
Fixes leak:

==6470== 64 bytes in 1 blocks are definitely lost in loss record 8,677 of 13,062
==6470==    at 0x48489F3: calloc (vg_replace_malloc.c:1340)
==6470==    by 0x4C65C19: g_malloc0 (gmem.c:133)
==6470==    by 0x4C746C5: g_rc_box_alloc_full (grcbox.c:106)
==6470==    by 0x527B63B: mtk_region_create (mtk-region.c:75)
==6470==    by 0x527B69C: mtk_region_copy (mtk-region.c:96)
==6470==    by 0x4A54F56: meta_screen_cast_stream_src_maybe_record_frame_with_timestamp (meta-screen-cast-stream-src.c:1023)
==6470==    by 0x4A54A9F: meta_screen_cast_stream_src_maybe_record_frame (meta-screen-cast-stream-src.c:871)
==6470==    by 0x4A49431: on_after_paint (meta-screen-cast-virtual-stream-src.c:190)
==6470==    by 0x49787F6: notify_watchers_for_mode (meta-stage.c:195)
==6470==    by 0x4978A2F: meta_stage_paint_view (meta-stage.c:271)
==6470==    by 0x533D152: clutter_stage_paint_view (clutter-stage.c:490)
==6470==    by 0x497A476: paint_stage (meta-stage-impl.c:410)

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4149>
2024-12-06 16:49:34 +00:00
Michel Dänzer
376c0585ef clutter/stage-view: Clear output_color_state in dispose
Fixes leaks:

==1060013== 96 (32 direct, 64 indirect) bytes in 1 blocks are definitely lost in loss record 10,897 of 13,064
==1060013==    at 0x4F81D57: g_type_create_instance (gtype.c:1929)
==1060013==    by 0x4F64ABF: g_object_new_internal.part.0 (gobject.c:2606)
==1060013==    by 0x4F66ADD: g_object_new_internal (gobject.c:2603)
==1060013==    by 0x4F66ADD: g_object_new_with_properties (gobject.c:2769)
==1060013==    by 0x4F67A30: g_object_new (gobject.c:2415)
==1060013==    by 0x52F7C7B: clutter_color_state_new_full (clutter-color-state.c:339)
==1060013==    by 0x4939CD0: update_color_state (meta-color-device.c:725)
==1060013==    by 0x4939DDE: meta_color_device_new (meta-color-device.c:759)
==1060013==    by 0x493CB7B: update_devices (meta-color-manager.c:205)
==1060013==    by 0x493CE65: meta_color_manager_monitors_changed (meta-color-manager.c:264)
==1060013==    by 0x49341CB: meta_backend_monitors_changed (meta-backend.c:371)
==1060013==    by 0x4969150: meta_monitor_manager_notify_monitors_changed (meta-monitor-manager.c:1235)
==1060013==    by 0x496928F: meta_monitor_manager_setup (meta-monitor-manager.c:1273)
==1060013==
==1060013== 96 (32 direct, 64 indirect) bytes in 1 blocks are definitely lost in loss record 10,898 of 13,064
==1060013==    at 0x4F81D57: g_type_create_instance (gtype.c:1929)
==1060013==    by 0x4F64ABF: g_object_new_internal.part.0 (gobject.c:2606)
==1060013==    by 0x4F66ADD: g_object_new_internal (gobject.c:2603)
==1060013==    by 0x4F66ADD: g_object_new_with_properties (gobject.c:2769)
==1060013==    by 0x4F67A30: g_object_new (gobject.c:2415)
==1060013==    by 0x52F7C7B: clutter_color_state_new_full (clutter-color-state.c:339)
==1060013==    by 0x4939CD0: update_color_state (meta-color-device.c:725)
==1060013==    by 0x4939DDE: meta_color_device_new (meta-color-device.c:759)
==1060013==    by 0x493CB7B: update_devices (meta-color-manager.c:205)
==1060013==    by 0x493CE65: meta_color_manager_monitors_changed (meta-color-manager.c:264)
==1060013==    by 0x49341CB: meta_backend_monitors_changed (meta-backend.c:371)
==1060013==    by 0x4969150: meta_monitor_manager_notify_monitors_changed (meta-monitor-manager.c:1235)
==1060013==    by 0x496EA7D: meta_monitor_manager_rebuild (meta-monitor-manager.c:3968)

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4149>
2024-12-06 16:49:34 +00:00
Michel Dänzer
57f3e172ca clutter/color-manager: Clear default_color_state in finalize
Fixes leak:

==5763== 96 (32 direct, 64 indirect) bytes in 1 blocks are definitely lost in loss record 10,901 of 13,065
==5763==    at 0x4F81D57: g_type_create_instance (gtype.c:1929)
==5763==    by 0x4F64ABF: g_object_new_internal.part.0 (gobject.c:2606)
==5763==    by 0x4F66ADD: g_object_new_internal (gobject.c:2603)
==5763==    by 0x4F66ADD: g_object_new_with_properties (gobject.c:2769)
==5763==    by 0x4F67A30: g_object_new (gobject.c:2415)
==5763==    by 0x52F7C46: clutter_color_state_new_full (clutter-color-state.c:339)
==5763==    by 0x52F7C03: clutter_color_state_new (clutter-color-state.c:312)
==5763==    by 0x52F7110: clutter_color_manager_get_default_color_state (clutter-color-manager.c:150)
==5763==    by 0x52E7543: get_default_color_state (clutter-actor.c:17836)
==5763==    by 0x52E765D: clutter_actor_unset_color_state (clutter-actor.c:17864)
==5763==    by 0x52CF056: clutter_actor_constructor (clutter-actor.c:5646)
==5763==    by 0x4F64DD3: g_object_new_with_custom_constructor (gobject.c:2524)
==5763==    by 0x4F67275: g_object_new_internal (gobject.c:2604)
==5763==    by 0x4F67275: g_object_new_valist (gobject.c:2945)

Fixes: 2693cac83a5c ("clutter/color-manager: Add a method to get the default color state")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4149>
2024-12-06 16:49:34 +00:00
Michel Dänzer
2c56c9a1da backends: Improve MetaCrtcMode lifetime management
The same MetaCrtcMode objects can be reached via the
MetaOutputInfo::modes array & MetaMonitorMode::crtc_modes arrays and via
the MetaGpuPrivate::modes list, so all of them need to hold their own
references.

In turn, those references need to dropped in meta_output_info_unref and
meta_monitor_mode_free. (meta_gpu_finalize is already dropping the
MetaGpuPrivate::modes list references)

Fixes leak:

==4092== 123 (32 direct, 91 indirect) bytes in 1 blocks are definitely lost in loss record 11,396 of 13,056
==4092==    at 0x4F81D57: g_type_create_instance (gtype.c:1929)
==4092==    by 0x4F64ABF: g_object_new_internal.part.0 (gobject.c:2606)
==4092==    by 0x4F676BA: g_object_new_internal (gobject.c:2923)
==4092==    by 0x4F676BA: g_object_new_valist (gobject.c:2945)
==4092==    by 0x4F67A0C: g_object_new (gobject.c:2418)
==4092==    by 0x4AB578B: meta_crtc_mode_virtual_new (meta-crtc-mode-virtual.c:51)
==4092==    by 0x4B081BB: meta_virtual_monitor_native_new (meta-virtual-monitor-native.c:83)
==4092==    by 0x4AC58CC: meta_monitor_manager_native_create_virtual_monitor (meta-monitor-manager-native.c:603)
==4092==    by 0x496803B: meta_monitor_manager_create_virtual_monitor (meta-monitor-manager.c:621)
==4092==    by 0x4A4A204: create_virtual_monitor (meta-screen-cast-virtual-stream-src.c:625)
==4092==    by 0x4A4A39D: ensure_virtual_monitor (meta-screen-cast-virtual-stream-src.c:663)
==4092==    by 0x4A4A461: meta_screen_cast_virtual_stream_src_notify_params_updated (meta-screen-cast-virtual-stream-src.c:684)
==4092==    by 0x4A568C5: on_stream_param_changed (meta-screen-cast-stream-src.c:1565)

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4149>
2024-12-06 16:49:34 +00:00
Jonas Ådahl
fbe00573d7 xwayland/dnd: Handle stage to protocol transformations
We'd send stage coordinates via the Xdnd X11 protocol, but X11 clients
expect X11 protocol coordinates. Make sure to transform these
accordingly. The same applies to the size of our DND cover window, which
needs to be move/resize:ed in protocol coordinates.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3815
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4169>
2024-12-06 11:53:50 +00:00
Jonas Ådahl
796ee28b1c xwayland: Move protocol <-> stage calculations to Xwayland manager
Will make it more convenient to use without a MetaWindow at hand.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4169>
2024-12-06 11:53:50 +00:00
José Expósito
64847aa50f onscreen/native: Simplify get_supported_kms_modifiers()
This code doesn't work like the comment suggest, it simply creates a
copy of the modifiers.

Remove the unused code.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4168>
2024-12-06 11:43:46 +00:00
Michel Dänzer
18fbea0b03 cogl: Do not call glFlush in cogl_gl_create_timestamp_query
SwapBuffers will implicitly flush the query along with the other GPU
work for the frame.

The comment was about this function being called for direct scanout,
which hasn't been the case since 56580ea7c941 ("backends/native: Assume
zero rendering time for direct scanout buffers").

This eliminates one GPU work flush to the kernel per frame with the
Mesa radeonsi driver, leaving only a single flush per frame.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4158>
2024-12-06 11:22:05 +00:00
Michel Dänzer
33a9a1cace cogl/onscreen: Call _cogl_context_update_sync after the buffer swap
Indirectly via cogl_framebuffer_flush, since we also need to call
glFlush now. Need to do it in cogl_onscreen_egl_swap_* because
meta_onscreen_native_swap_buffers_with_damage uses
cogl_context_get_latest_sync_fd.

Doing it before the swap was problematic because the swap may do GPU
work of its own, which wasn't covered by the EGL sync object created in
_cogl_context_update_sync. This could result in visual artifacts. See
the discussion starting at
https://gitlab.freedesktop.org/mesa/mesa/-/issues/11996#note_2678104 for
details.

For similar reasons, move the cogl_framebuffer_finish calls after the
swap as well.

As a bonus, this eliminates one of 3 GPU work flushes to the kernel per
frame with the Mesa radeonsi driver, because the glFlush/glFinish call
in cogl_framebuffer_flush/finish doesn't have any GPU work to flush
after SwapBuffers.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4158>
2024-12-06 11:22:05 +00:00
Corentin Noël
cd765c2da9 clutter: Add missing public headers to the main header
Also remove keyval source file from the installed headers. Move clutter-mutter to
the private headers.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4156>
2024-12-06 10:54:06 +00:00
Jonas Ådahl
8f557cdb29 renderer/native: Also request high priority secondary EGL context
We request a high priority context for the Cogl managed EGL context,
lets do the same for the one used for secondary GPU blits.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2973>
2024-12-06 09:47:06 +00:00
Sebastian Wick
918dd0c293 wayland/buffer: Do not guard explicit sync releases by buffer->resource
The buffer resource doesn't need to exist for a timeline to exist so we
still have to send the timeline release. Only guard the
wl_buffer_send_relase call.

Fixes: e8b890ab53 ("wayland: Implement linux-drm-syncobj-v1")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4157>
2024-12-06 08:56:23 +00:00
Carlos Garnacho
18c8efcd42 wayland: Lock touch sequence info on first entered surface
Even though the touch moved to being set up in CLUTTER_ENTER, it
is still meant to lock onto the pressed surface, we however will
receive crossing events if the touch moves between actors/surfaces,
triggering warnings when the touch info registration is attempted
on the already existing touch sequence.

The reasons to handle this in CLUTTER_ENTER still apply, so ensure
the touch info for the sequence does not previously exist to avoid
the warning.

Fixes: 2e82a2049f ("wayland: Register touchpoint info on CLUTTER_ENTER")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4166>
2024-12-05 22:35:26 +00:00
Carlos Garnacho
f637b8b12c wayland: Drop invalidate focus flags
This is not necessary anymore, so far can be dropped.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4166>
2024-12-05 22:35:26 +00:00
Carlos Garnacho
5cb8773409 wayland: Emit wl_touch.cancel in seat focus handling
We try to emit wl_touch.cancel in the situations where grabbing input
would take input away from the wl_touch interface. This however does
not play fine with grabs induced by wayland interfaces (e.g. xdg popups).

A more natural place to handle this is the MetaWaylandSeats' default
input handler, specifically the focus() vmethod. Here, we may know if the
focus surface matches the current surface as picked by MetaWaylandTouch,
and if it does not, either a grab or another input handler stole input
away from the default event handler.

A case where this will notably not happen anymore is in the transition
to a xdg_popup grab, since the grabbing client will still be handling
input, and touch input will not be unfocused away despite the transition
to a grab.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3752
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4166>
2024-12-05 22:35:26 +00:00
Carlos Garnacho
c9fa30c55b wayland: Handle reentrancy invalidating touch foci
The hashtable containing per-sequence touch info may change while
invalidating the focus, so grab a copy first of the existing sequences.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4166>
2024-12-05 22:35:26 +00:00
Carlos Garnacho
f28f31fc32 wayland: Fix updating pointer cursor on Drag and Drop
The logic to allow src/wayland to update the pointer cursor changed
to bypassing grabs in commit e69e4fa6, since it is nowadays the
responsibility of the DnD source to update the pointer cursor in reaction
to the negotiated action.

This is not entirely correct, and was done at the expense of regressions.
Change the logic so we explicitly check for a DnD grab existing, or use
the active focus instead (i.e. grab-aware). This fixes the regression, and
keep DnD cursor icons working.

This is a partial revert of commit e69e4fa6dbbd62677de61bcd2f5f3bec515e79ce.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3460
Fixes: e69e4fa6db ("Revert "wayland: Check focus surface to set a pointer cursor"")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4166>
2024-12-05 22:35:26 +00:00
Joan Torres
0095e7d50a clutter/color-state-params: Improve create transform snippet
Make create_transform_snippet method more consistent.

Abstract TransferFunction struct: convert it to ColorOpSnippet.

This transform snippet will be defined by these ColorOpSnippets.
These ColorOpSnippets are similar to the prescriptive DRM API for
color transformation.

A standard transform snippet would have as ColorOpSnippets:
  1. eotf
  2. luminance_mapping
  3. color_space_mapping
  4. inv_eotf

Update uniforms the same way the transform snippet is defined.

Update color transform key to consider how the transform snippet is
generated.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4144>
2024-12-05 22:24:05 +00:00
Joan Torres
7f8df9d9a1 clutter/color-state-params: Add new_from_primitives
When creating a new color state from the primitives Colorimetry, EOTF
and Luminance; it is needed to previously check their tags to properly get
their values and avoid UB.

This check is duplicated and is a bit unreadable.

Using this new function helps keeping readability.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4144>
2024-12-05 22:24:05 +00:00
Joan Torres
2e2a91a14b clutter/color-state-params: Make get white chromaticity func generic
Change the name of the func to xyY_to_XYZ which explains more and allows
reusing it in the following commits.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4144>
2024-12-05 22:24:05 +00:00
Joan Torres
7e847b555b clutter/color-state: Abstract color state and add Params subclass
Most of the implementation at color state was specific to a color state
generated from parameters so move it to a new class Params.

In the next commits a new color state ICC class will be added.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4144>
2024-12-05 22:24:05 +00:00
Joan Torres
403c8a7b63 clutter/color-state: When equals don't add color transform pipeline
The EOTFs snippets were only added when color states were not equal.

It makes more sense to only add the whole color transformation pipeline
in that case.

This makes the assumption to always append EOTFs snippets.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4144>
2024-12-05 22:24:05 +00:00
Jonas Ådahl
c3cc1338ec renderer/native: Change an explicit unref to autoptr
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3900>
2024-12-05 19:12:09 +00:00
Jonas Ådahl
c11c654f0d screen-cast: Check whether modifier is implicit via helper
This avoids another native backend macro check.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3315
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3900>
2024-12-05 19:12:09 +00:00
Jonas Ådahl
6dcc5e9a6b screen-cast: Query format modifiers via CoglRenderer
This moves some backend specific code to the actual backend.

Related: https://gitlab.gnome.org/GNOME/mutter/-/issues/3315
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3900>
2024-12-05 19:12:09 +00:00
Jonas Ådahl
2205181da8 cogl/renderer: Add API to get the implicit modifier
This allows avoiding having to depend on libdrm in places that are
otherwise independent of the backend.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3900>
2024-12-05 19:12:09 +00:00
Jonas Ådahl
01dcec31b0 cogl/renderer: Add way to filter modifiers by external-only
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3900>
2024-12-05 19:12:09 +00:00
Jonas Ådahl
4bf04585d2 render-device/gdm: Make query format modifier filter loop more generic
This will allow adding more filters more easily.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3900>
2024-12-05 19:12:09 +00:00
Jonas Ådahl
157c4af11e screen-cast/stream-src: Put type definition higher up
Type definition (G_TYPE_DEFINE..()) should be above all other code; only
type definitions etc should be above.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3900>
2024-12-05 19:12:09 +00:00
Jonas Ådahl
e3f743facc cogl/renderer: Add API to query DRM format modifiers
Will be used to do explicit modifier buffer allocation via the Cogl API.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3900>
2024-12-05 19:12:09 +00:00
Jonas Ådahl
78cfbb57eb cogl/renderer: Remove stray newline
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3900>
2024-12-05 19:12:09 +00:00
Jonas Ådahl
8509b74532 Make DMA buffer allocation format and modifier aware
This makes DMA buffer allocation in all layers take an array of possible
modifiers to allocate using, or zero modifiers if implicit modifiers
should be used.

The format hard coding previously used is moved to the screen cast code,
or in case of the (unused by default) shadow buffer buffers use the same
format as the the CoglOnscreen.

This also means the CoglDmaBufHandle and MetaDrmBuffer got taught how to
distinguish between planes. It's mostly unused in practice, so rather
untested.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3900>
2024-12-05 19:12:09 +00:00
Jonas Ådahl
a4ddba44e9 onscreen/native: Move DRM modifier querying to MetaRenderDevice
It's only implemented by the GBM render device backend, and uses EGL,
thus does not distinguish scanout capable modifiers.

A filter enum is added to Cogl, since it'll be used via the Cogl API,
but the actual Cogl API isn't added yet.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3900>
2024-12-05 19:12:09 +00:00
Michel Dänzer
a8fe1fd625 crtc-kms: Use clutter_stage_view_schedule_update in _kms_set_gamma_lut
Instead of clutter_stage_schedule_update. There's no need to schedule
updates for stage views other than of the CRTC passed in.

As a bonus, this avoids a crash when a virtual monitor is removed.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3719
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4148>
2024-12-05 09:36:07 +00:00
Jonas Ådahl
24083e1e58 stage: Clear update_scheduled field when update discarded
clutter_stage_schedule_update() sets the field `update_scheduled` to
`TRUE` as an optimization to make redundant updates a no-op. This failed
if there was a pending event and if the stage was not yet mapped.

What happened is:

 * clutter_stage_schedule_update() is called
   - ClutterStage::update_scheduled is set to TRUE
   - frame clock scheduled
 * frame clock dispatches
   - frame is discarded early, no actual stage update happens
 * device is created (e.g. virtual device from remote desktop session)
   - `device-added` event reaches ClutterStage::event_queue
 * stage is shown
   - clutter_stage_schedule_update() is called
     - ClutterStage::update_scheduled is TRUE
     - ClutterStage::event_queue has events in it
     - These two conditions means clutter_schedule_update() becomes a
       no-op

At this point, no more updates will happen from
clutter_stage_schedule_update().

Fix this by resetting `ClutterStage::update_scheduled` to `FALSE` even
if the frame was discarded due to the stage not yet being mapped.

A test case is added that replicates the above descibed events.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3804
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4152>
2024-12-05 00:19:12 +00:00
Jonas Ådahl
904c39116e tests/test-shell: Allow skipping showing the stage
To allow tests to emulate GNOME Shell behavior, where the stage showing
is delayed. Do so by adding the `"options"` property to the plugin
object type. The property expects a vararg GVariant, and supports
the `"show-stage"` (boolean) vararg entry.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4152>
2024-12-05 00:19:12 +00:00
Jonas Ådahl
a23d08c754 Add way to pass construct time options to plugin
This is needed to allow tests to manipulate the behavior of the test
shell plugin during startup. Since the plugin is created and started
when the MetaDisplay is created, it needs to be handled via MetaContext,
by setting the options after creating the context, but before starting.

For simplicity reasons, make the options an opaque GVariant, passed via
a an `"options"` property when the plugin object is created, if the
passed options is non-NULL. Only passing the options when non-NULL
allows for backward compatibility.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4152>
2024-12-05 00:19:12 +00:00
Bilal Elmoussaoui
03c36f94bb cogl/buffer: Don't store "vfuncs" in the struct
This was done during the move to a GObjectified Buffer instance, but in
the future when we will move the DriverVtable to an abstract class, this
would annoy us.

Given that those functions are only used internally in three instances,
just replace them with the actual logic of checking whether tu use
malloc fallback path or not.

Helps https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4132

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4137>
2024-12-04 23:51:18 +02:00
Georges Basile Stavracas Neto
13f6dcc098 clutter/paint-nodes: Use g_clear_object()
Minor cleanup.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4160>
2024-12-03 01:17:50 +00:00
Georges Basile Stavracas Neto
4aef995f72 clutter/stage: Delegate color state to root node
As the title says. Another step towards moving the color state
management to the paint node tree. Will help with ClutterSnapshot
transition.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4160>
2024-12-03 01:17:50 +00:00
Georges Basile Stavracas Neto
551db47b4c clutter/actor: Push/pop color state in actor node
Instead of ClutterActor doing that manually in the paint routines
manually, delegate that to the actor node. This will help with the
move to ClutterSnapshot.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4160>
2024-12-03 01:17:50 +00:00
Bilal Elmoussaoui
6d37dbdc40 cogl/winsys: Drop unnused functions
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4162>
2024-11-30 17:05:02 +00:00
Georges Basile Stavracas Neto
4f71551f66 frames: Cleanup unused function argument
It's unused.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4161>
2024-11-30 13:34:14 -03:00