33067 Commits

Author SHA1 Message Date
Jonas Ådahl
8fc1bddf3b 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>
2024-12-11 16:22:57 +00:00
Robert Mader
35e5ae718a 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>
2024-12-11 16:22:57 +00:00
Jonas Ådahl
01f2f40475 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>
2024-12-11 16:22:57 +00:00
Robert Mader
19669a3d9d cursor-renderer/native: Add support for viewports
[jadahl] Rework hotspot calculations

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3859>
2024-12-11 16:22:57 +00:00
Robert Mader
e674c7e454 cursor-sprite: Add API for viewports
[jadahl] Rework hotspot calculations.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3859>
2024-12-11 16:22:57 +00:00
Robert Mader
e402eaa950 shaped-texture: Use pipeline matrix helper
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3859>
2024-12-11 16:22:57 +00:00
Robert Mader
2ae0fcfc5c mtk: Add mtk_compute_viewport_matrix helper
It'll be used to calculate a CoglPipeline layer matrix given viewport
data.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3859>
2024-12-11 16:22:57 +00:00
Jonas Ådahl
996678cfef mtk/build: Sort files alphabetically
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3859>
2024-12-11 16:22:57 +00:00
Jonas Ådahl
e9475b2190 tests: Add basic ref-test based cursor sprite test case
It currently contains some basic tests using the built in cursor as well
as traditional buffer scale using Wayland client in different monitor
configurations.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3859>
2024-12-11 16:22:57 +00:00
Jonas Ådahl
129ead488b tests/ref-test: Allow updating only non-existing reference images
This makes it a bit more reliable to add more reference images, but be
sure not to touch any existing ones.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3859>
2024-12-11 16:22:57 +00:00
Jonas Ådahl
9cc5bec0a3 tests/ref-test: Split out image processing bits
This allows it to be used in processes that doesn't have a stage view
etc, e.g. screen cast clients.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3859>
2024-12-11 16:22:57 +00:00
Jonas Ådahl
aeeb710d93 tests/utils: Make wait-for-window helper more generic
It took a MetaTestClient, which wasn't used. To allow it be used for windows
that doesn't come from a MetaTestClient, remove the MetaTestClient
namespace, and update the callers.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3859>
2024-12-11 16:22:57 +00:00
Jonas Ådahl
c280af08c2 tests/wayland/test-client-utils: Add boilerplate for pointer input
This adds wl_seat and wl_pointer boilerplate, and a pointer-entered
signal on the surface helper struct. It's intended to be used by a
future cursor test case client.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3859>
2024-12-11 16:22:57 +00:00
Jonas Ådahl
08147d0c9b tests/wayland: Add int property type to test driver
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3859>
2024-12-11 16:22:57 +00:00
Jonas Ådahl
a0877dc071 tests/wayland: Make test driver properties table multi typed
Store values as GVariant's. This will allow to add other types property
types than strings.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3859>
2024-12-11 16:22:57 +00:00
Jonas Ådahl
29850b7345 tests/utils: Return GTask after flushing input
This silences a debug warning from glib.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3859>
2024-12-11 16:22:57 +00:00
Jonas Ådahl
ff2c329074 tests: Disable animations with context flag instead of env var
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3859>
2024-12-11 16:22:57 +00:00
Jonas Ådahl
1f3dd65594 tests/shell: Allow configuring the background color
This will be used to create background colors that will match fullscreen
window colors, so they can share the same ref test reference image.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3859>
2024-12-11 16:22:57 +00:00
Jonas Ådahl
ea9e8bff2d debug-control: Add InhibitHwCursor property
Inhibits the hardware cursor globally when true.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3859>
2024-12-11 16:22:57 +00:00
Jonas Ådahl
b97516edb9 backend: Add simple HW cursor inhibit API
The existing is meant to allow more complex inhibitation, but sometimes
it's useful to inhibit globally, e.g. for debugging purposes. Add API to
achieve this.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3859>
2024-12-11 16:22:57 +00:00
Jonas Ådahl
da0fa12f1f cursor-sprite/xcursor: Assume pixels are premultiplied
This makes the built in cursors and cursors from Wayland clients look
the same.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3859>
2024-12-11 16:22:57 +00:00
Bilal Elmoussaoui
aa7e963422 ci: Adapt to updated release module template
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4176>
2024-12-11 13:57:31 +01:00
Bilal Elmoussaoui
54f48349b6 Revert "ci: Use meson introspect to generate artifact path"
This reverts commit bcfbc7fa17c189306788bd708409b1e68740c890.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4176>
2024-12-11 13:43:36 +01:00
Georges Basile Stavracas Neto
3c4ec122b5 clutter/paint-volume: Cleanup private API
Following previous commit, rename _clutter_paint_volume_init_static()
to clutter_paint_volume_init_from_actor(), and also
_clutter_paint_volume_copy_static() to
clutter_paint_volume_init_from_paint_volume().

Make clutter_paint_volume_init_from_paint_volume() follow the dst/src
semantic in its arguments, which also allows removing
_clutter_paint_volume_set_from_volume() which is exactly the same now.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4175>
2024-12-10 14:18:18 -03:00
Georges Basile Stavracas Neto
7e24b9696a clutter/paint-volume: Remove 'is_static'
And change clutter_paint_volume_free() to always free the paint volume.
Remove all calls to clutter_paint_volume_free() on static variables.

Having to call a free function on a static variable always seemed a bit
odd, and this genuinely confuses Coverity (and me).

Coverity CID: #1505838

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4175>
2024-12-10 14:18:17 -03:00
Georges Basile Stavracas Neto
38d4962c20 clutter/paint-nodes: Use g_autoptr
Tighten up the refcount of the CoglTexture created by the blur node.
This seems to make Coverity happier.

Coverity CID: #1575122

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4175>
2024-12-10 14:18:17 -03:00
Georges Basile Stavracas Neto
2e61e58b57 clutter/gesture-action: Call clutter_event_type once
It's not really necessary to call clutter_event_type (event) twice
for the same event. It also seems to confuse Coverity.

Coverity CID: #1508228

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4175>
2024-12-10 14:18:17 -03:00
Georges Basile Stavracas Neto
0265fa34be window: Initialize rect
As far as I can see this doesn't happen in practice, but theoretically
the uninitialized values can be used if:

 1. `did_placement` is TRUE
 2. `flags` contains both `META_MOVE_RESIZE_RESIZE_ACTION` and
    also `META_MOVE_RESIZE_MOVE_ACTION`
 3. `!meta_window_is_tied_to_drag (window)` is FALSE

In that case, the `frame_rect` variable (with uninitialized values) is
passed to `unconstrained_rect`, then passed to `constrained_rect`,
then finally the (uninitialized) X and Y values are read in the
`if (did_placement)` branch.

This is probably a regression from 3047b2ce261. I don't know if this is
the appropriate fix.

Coverity CID: #1511378

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4175>
2024-12-10 14:17:47 -03:00
Georges Basile Stavracas Neto
c6ecaf01c2 cogl/sampler-cache: Initialize variable
It's apparently harmless.

Coverity CID: #1511379

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4175>
2024-12-10 14:17:47 -03:00
Jonas Ådahl
f4201bc3d3 service-channel: Add global shotcuts portal backend client type
The global shortcuts portal backend component lives in
gnome-control-center, and is responsible for preseting the GUI for
managing client provided global shortcuts.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4173>
2024-12-10 17:02:24 +00:00
Jonas Ådahl
0f195078cb wayland/x11-interop: Make allow list more declarative
Declare allowed service client types in a list, and loop through them,
instead of doing it manually.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4173>
2024-12-10 17:02:24 +00:00
Bilal Elmoussaoui
a2fdeac9e7 cogl/driver: Move various texture functions to TextureDriverGL
As they are now shared between GL3 and GLES3 texture driver, there is no
need anymore for having them in a separate header and included.

Cleanup the names of the functions while doing so.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4163>
2024-12-10 11:08:53 +00:00
Bilal Elmoussaoui
1401c745d7 cogl: Remove function declaration
No longer has an implementation.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4163>
2024-12-10 11:08:53 +00:00
Bilal Elmoussaoui
f3430ff1c5 cogl: Add a TextureDriverGL
Abstract away the common bits between GL3 and GLES2 TextureDriver
implementations by sharing the common bits in a parent class.

Ideally, we would move the various vfuncs that are GL specific from the
abstract TextureDriver type but that can be done at a later stage once
there is actual work on adding a Vulkan driver.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4163>
2024-12-10 11:08:52 +00:00
Bilal Elmoussaoui
cde6a447b4 cogl: Move various vfuncs from DriverVtable to TextureDriver
As they make more sense there. Maybe we could have a common
OpenGLTextureDriver
that would share the common texture_2d_* vfuncs but that can be done
later.

By moving those vfuncs to the TextureDriver, we can get rid of the
texutre_2d
nop driver implementations.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4163>
2024-12-10 11:08:52 +00:00
Bilal Elmoussaoui
4f16f6df3b cogl: Turn TextureDriver into an abstract object
The motivation is to ease sharing bits between the various texture
drivers implementations.
The same thing would be done for DriverVtable & WinsysVtable.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4163>
2024-12-10 11:08:51 +00:00
Bilal Elmoussaoui
9181fdf5c2 cogl: Don't expose FramebufferBits
Fixes 34f4b8064fb32da792e69cebb911c394ab1eb8b7

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4174>
2024-12-10 08:58:24 +01:00
Olivier Fourdan
c4be3cd568 window-actor: Apply opacity once assigned a surface
Trying to update the opacity before the window actor get assigned a
surface will be ignored.

As result, the initial opacity set by X11 clients using the EWMH
property _NET_WM_WINDOW_OPACITY is not applied at first.

To avoid the issue, make sure to set the opacity once the window actor
has a surface assigned.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3513
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4170>
2024-12-09 13:46:04 +00:00
Georges Basile Stavracas Neto
4e8da5304a cogl/pipeline-layer: Use G_DECLARE_FINAL_TYPE
Same deal

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4155>
2024-12-09 13:23:29 +00:00
Georges Basile Stavracas Neto
ac07f10de3 cogl/pipeline: Use G_DECLARE_FINAL_TYPE
Lets us get rid of the boilerplate.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4155>
2024-12-09 13:23:29 +00:00
Georges Basile Stavracas Neto
b0fd29ece2 cogl: Drop CoglNode
It's not necessary anymore.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4155>
2024-12-09 13:23:29 +00:00
Georges Basile Stavracas Neto
8540362d1d cogl/pipeline: Inherit from GObject
Same deal as CoglPipelineLayer.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4155>
2024-12-09 13:23:29 +00:00
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