1
0
Fork 0
Commit graph

10352 commits

Author SHA1 Message Date
Neil Moore
877dc33545 shaped-texture: Move texture mipmap implementation to 'meta-texture-mipmap'
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2506>
2022-07-26 19:16:50 +00:00
Daniel van Vugt
16fa2100dc shaped-texture: Stop using MetaTextureTower and use GL mipmapping instead
But only in cases where it's needed; when we are displaying a texture at
less than half its native resolution. We also keep the existing
optimization that avoids mipmapping of textures while they're animating.

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/849
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2506>
2022-07-26 19:16:50 +00:00
Daniel van Vugt
b29a6c4d0c compositor: Return more details from meta_actor_painting_untransformed
This adds x_scale and y_scale information, as well as simplifying the
parameters.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2506>
2022-07-26 19:16:50 +00:00
Robert Mader
0c12903352 renderer-view: Drop bogus meta_monitor_transform_invert()
It papered over wrong `meta_rectangle_transform()` behaviour for
non-flipped output transforms. Also there is no obvious reason
why we would need inverted values here.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2459>
2022-07-26 18:41:43 +00:00
Robert Mader
0c34908132 cursor-renderer/native: Various fixes for rotated cursors
- Drop bogus `meta_monitor_transform_invert()`. It papered over
  wrong `meta_rectangle_transform()` behaviour for non-flipped
  output transforms.
- Update `scale_and_transform_cursor_sprite_cpu` to match the GL
  pipeline matrix in `MetaShapedTexture`, fixing several of the
  flipped cases. Note: the rotation applied is the one a client would
  need to apply to the buffer for a given monitor transform.
- While on it, drop a redundant `return`.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2459>
2022-07-26 18:41:43 +00:00
Robert Mader
d644a40cf5 shaped-texture: Swap 90 and 270 degree transforms in pipeline matrix
With `META_MONITOR_TRANSFORM` values matching their `WL_OUTPUT_TRANSFORM`
counterparts, the definition from the Wayland spec applies: the
`META_MONITOR_TRANSFORM` value tells us how the output was rotated
and that the buffer was drawn by the client to compensate for that.

The matrix describes the transformation from surface- to buffer-
coordinates, so the operation we need here is the same one that
the client applied (not from buffer- to surface-coordinates, i.e.
the inverse).

While on it fix `FLIPPED_90` and `FLIPPED_270` to use the correct
axes: flip on the x-axis, rotation on the z-axis.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2459>
2022-07-26 18:41:43 +00:00
Robert Mader
2ade26ebf8 boxes: Swap 90 and 270 degree transforms in meta_rectangle_transform()
`meta_rectangle_transform()` is used in the stack to *compensate* for a
`MetaMonitorTransform` applied to a output, not to apply it again.
Change the function accordingly.

Context:
Experimenting with direct scanout on offscreen-rotated outputs revealed
that the 90/270 degree cases were actually interchanged.
Further digging revealed that we use `meta_rectangle_transform()` with
those values swapped in every single case, papering over the issue.

Either a unintuitive and unexplained `meta_monitor_transform_invert()`
was added, in which case "flipped" values would be wrong, or, in case
of Wayland buffer transforms, the values were swapped by interpreting
the Wayland enums accordingly, see commit 8d9bbe10.

Swapping the 90/270 degree values in `meta_rectangle_transform()`:
1. fixes hardware cursor positioning with flipped output transforms
2. fixes rendering issues with offscreen-rotated flipped output transforms
3. allows us to drop unexplained `meta_monitor_transform_invert()`s in
follow-up commits
4. allows us to make `META_MONITOR_TRANSFORM` and `WL_OUTPUT_TRANSFORM`
enums match again (reverting 8d9bbe10, as already done)

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2459>
2022-07-26 18:41:43 +00:00
Robert Mader
29cafe6f6c monitor-transform: Fix transform() and drop relative_transform()
The following implicit definition for `transform()` did not
correctly apply:
```
a * b = c
c * invert(b) = a
```

Crucially the following did not apply for `FLIPPED-90`
and `FLIPPED-270`:
```
a * invert(a) = identity
```

Fix this by applying the operations, first the flip, then the
rotation, in this order and add tests to ensure correct results
for the requirement above.

Also drop `relative_transform()` as it only had a single user and
can be replaced by `transform()`:
```
invert(a) * b = c
a * c = b
```

As this is not very intuitive, ensure in tests as well.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2459>
2022-07-26 18:41:43 +00:00
Robert Mader
c6cf4bd9c3 backends/native: Fix checks for 'reflect-x' and 'reflect-y' bits
Checking for both bits at once means only one matching bit is
sufficient - very likely in case of `rotate-0'.

This fixes crashes on hardware that does not support 'reflect-'
bits when setting a flipped output transform.

While on it, also update the check for `reflect-y` instead of
`reflect-x` + `rotate-180`. They are logically equivalent,
however some hardware may support `reflect-y` but not both
other bits.

Fixes commit 4e3f3842a1

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2459>
2022-07-26 18:41:43 +00:00
Robert Mader
9e71278488 Revert "wayland/surface: Swap 90 and 270 degree transforms"
As testing of direct scanout revealed, `META_MONITOR_TRANSFORM`
does actually match `WL_OUTPUT_TRANSFORM` enums. The fact that
things rendered correctly with 90/270 degree values swapped
was because other parts of the stack got the interpretation
wrong, most notably `meta_rectangle_transform()`.
Thus lets revert this change and fix the stack accordingly.

This reverts commit 8d9bbe109b.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2459>
2022-07-26 18:41:43 +00:00
Jonas Ådahl
d985069542 kms/crtc: Don't report predicted gamma changes
We started to report resource changes using prediction when an update
had been successfully committed. While at it, gamma changes were
reported too, but this was problematic, as gsd-color will listen for the
MonitorsChanged D-Bus signal and naively set the gamma again, even if it
didn't change. There aren't currently any actual use cases for being
told when gamma changes from a prediction, so just ignore it and just
report privacy screen changes.

This avoids a feedback loop between mutter and gsd-color.

Fixes: 81b28a1d97
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2531>
2022-07-26 11:04:52 +02:00
Michel Dänzer
d928b6baa6 wayland: Clean up tablet manager state
Fixes memory leak:

==995170== 936 (40 direct, 896 indirect) bytes in 1 blocks are definitely lost in loss record 15,090 of 15,641
==995170==    at 0x48445EF: calloc (vg_replace_malloc.c:1328)
==995170==    by 0x4B211D0: g_malloc0 (gmem.c:155)
==995170==    by 0x4A56693: meta_wayland_tablet_manager_new (meta-wayland-tablet-manager.c:109)
==995170==    by 0x4A56693: meta_wayland_tablet_manager_init (meta-wayland-tablet-manager.c:126)
==995170==    by 0x4A3FA95: meta_wayland_compositor_new (meta-wayland.c:626)
==995170==    by 0x49C7FA7: meta_context_start (meta-context.c:412)
==995170==    by 0x10F065: main (mutter.c:148)

Fixes: 745cb67988 ("wayland: Initialize the MetaWaylandTabletManager")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2527>
2022-07-25 14:55:59 +00:00
Michel Dänzer
f3cd2b8ce7 wayland: Clean up output state
Fixes memory leak:

==995170== 383 (96 direct, 287 indirect) bytes in 1 blocks are definitely lost in loss record 14,733 of 15,641
==995170==    at 0x483F7B5: malloc (vg_replace_malloc.c:381)
==995170==    by 0x4B21178: g_malloc (gmem.c:125)
==995170==    by 0x4B395C0: g_slice_alloc (gslice.c:1072)
==995170==    by 0x4B0766D: g_hash_table_new_full (ghash.c:1071)
==995170==    by 0x4A4A8B4: meta_wayland_compositor_update_outputs (meta-wayland-outputs.c:483)
==995170==    by 0x4A4ABAB: meta_wayland_outputs_init (meta-wayland-outputs.c:716)
==995170==    by 0x4A3FA65: meta_wayland_compositor_new (meta-wayland.c:620)
==995170==    by 0x49C7FA7: meta_context_start (meta-context.c:412)
==995170==    by 0x10F065: main (mutter.c:148)

v2:
* Use meta_backend_get_monitor_manager. (Jonas Ådahl)

Fixes: 9a4783e364 ("Integrate the monitor manager with wayland")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2527>
2022-07-25 14:55:59 +00:00
Michel Dänzer
806e64dcb0 wayland: Clean up presentation-time state
Fixes memory leak:

==995170== 288 (96 direct, 192 indirect) bytes in 1 blocks are definitely lost in loss record 14,607 of 15,641
==995170==    at 0x483F7B5: malloc (vg_replace_malloc.c:381)
==995170==    by 0x4B21178: g_malloc (gmem.c:125)
==995170==    by 0x4B395C0: g_slice_alloc (gslice.c:1072)
==995170==    by 0x4B0766D: g_hash_table_new_full (ghash.c:1071)
==995170==    by 0x4A4F973: meta_wayland_init_presentation_time (meta-wayland-presentation-time.c:222)
==995170==    by 0x4A3FB04: meta_wayland_compositor_new (meta-wayland.c:635)
==995170==    by 0x49C7FA7: meta_context_start (meta-context.c:412)
==995170==    by 0x10F065: main (mutter.c:148)

Fixes: dccc60ec3e ("wayland: Implement stub presentation-time")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2527>
2022-07-25 14:55:59 +00:00
Michel Dänzer
b329dce070 wayland: Clean up xdg-activation state
Fixes memory leak:

==995170== 240 (48 direct, 192 indirect) bytes in 1 blocks are definitely lost in loss record 14,428 of 15,641
==995170==    at 0x48445EF: calloc (vg_replace_malloc.c:1328)
==995170==    by 0x4B211D0: g_malloc0 (gmem.c:155)
==995170==    by 0x4A3CDB3: meta_wayland_activation_init (meta-wayland-activation.c:383)
==995170==    by 0x4A3FB0C: meta_wayland_compositor_new (meta-wayland.c:636)
==995170==    by 0x49C7FA7: meta_context_start (meta-context.c:412)
==995170==    by 0x10F065: main (mutter.c:148)

Fixes: ec390b68c5 ("wayland: Implement the xdg-activation protocol")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2527>
2022-07-25 14:55:59 +00:00
Michel Dänzer
4ddefb9a69 wayland: Clean up scheduled_surface_associations hash table
Fixes memory leak:

==995170== 192 (96 direct, 96 indirect) bytes in 1 blocks are definitely lost in loss record 14,260 of 15,641
==995170==    at 0x483F7B5: malloc (vg_replace_malloc.c:381)
==995170==    by 0x4B21178: g_malloc (gmem.c:125)
==995170==    by 0x4B395C0: g_slice_alloc (gslice.c:1072)
==995170==    by 0x4B0766D: g_hash_table_new_full (ghash.c:1071)
==995170==    by 0x4A3F3A4: meta_wayland_compositor_init (meta-wayland.c:477)
==995170==    by 0x4E1F509: g_type_create_instance (gtype.c:1929)
==995170==    by 0x4E03DFC: g_object_new_internal (gobject.c:2011)
==995170==    by 0x4E0538C: g_object_new_with_properties (gobject.c:2181)
==995170==    by 0x4E05D40: g_object_new (gobject.c:1821)
==995170==    by 0x4A3F8C4: meta_wayland_compositor_new (meta-wayland.c:590)
==995170==    by 0x49C7FA7: meta_context_start (meta-context.c:412)
==995170==    by 0x10F065: main (mutter.c:148)

Fixes: 8df2a1452c ("wayland: Notify actively of xwayland window/surface associations")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2527>
2022-07-25 14:55:59 +00:00
Michel Dänzer
39fd32c362 wayland: Disconnect signals when Wayland compositor object is finalized
Fixes potential use-after-free during mutter shutdown, e.g.:

==993876== Invalid read of size 8
==993876==    at 0x4A4FCA3: meta_wayland_presentation_time_ensure_feedbacks (meta-wayland-presentation-time.c:373)
==993876==    by 0x4A3F07F: on_presented (meta-wayland.c:282)
==993876==    by 0x661B7E9: ??? (in /usr/lib/x86_64-linux-gnu/libffi.so.8.1.0)
==993876==    by 0x661A922: ??? (in /usr/lib/x86_64-linux-gnu/libffi.so.8.1.0)
==993876==    by 0x4DFF4BC: g_cclosure_marshal_generic_va (gclosure.c:1648)
==993876==    by 0x4DFE948: _g_closure_invoke_va (gclosure.c:893)
==993876==    by 0x4E17498: g_signal_emit_valist (gsignal.c:3406)
==993876==    by 0x4E176BE: g_signal_emit (gsignal.c:3553)
==993876==    by 0x51D9DB5: clutter_stage_view_notify_presented (clutter-stage-view.c:1226)
==993876==    by 0x499ACD2: frame_cb (meta-stage-view.c:83)
==993876==    by 0x499ACD2: frame_cb (meta-stage-view.c:43)
==993876==    by 0x50CAA41: notify_event (cogl-onscreen.c:175)
==993876==    by 0x50CAA41: _cogl_onscreen_notify_complete (cogl-onscreen.c:545)
==993876==    by 0x4A877F5: meta_onscreen_native_notify_frame_complete (meta-onscreen-native.c:211)
==993876==  Address 0x24b7be58 is 296 bytes inside a block of size 344 free'd
==993876==    at 0x484217B: free (vg_replace_malloc.c:872)
==993876==    by 0x4E1F88B: g_type_free_instance (gtype.c:2001)
==993876==    by 0x49C793C: meta_context_dispose (meta-context.c:675)
==993876==    by 0x4E037E0: g_object_unref (gobject.c:3636)
==993876==    by 0x4E037E0: g_object_unref (gobject.c:3553)
==993876==    by 0x10F145: glib_autoptr_clear_GObject (gobject-autocleanups.h:27)
==993876==    by 0x10F145: glib_autoptr_clear_MetaContext (meta-context.h:32)
==993876==    by 0x10F145: glib_autoptr_cleanup_MetaContext (meta-context.h:32)
==993876==    by 0x10F145: main (mutter.c:126)
==993876==  Block was alloc'd at
==993876==    at 0x483F7B5: malloc (vg_replace_malloc.c:381)
==993876==    by 0x4B21178: g_malloc (gmem.c:125)
==993876==    by 0x4B395C0: g_slice_alloc (gslice.c:1072)
==993876==    by 0x4B39C29: g_slice_alloc0 (gslice.c:1098)
==993876==    by 0x4E1F544: g_type_create_instance (gtype.c:1901)
==993876==    by 0x4E03DFC: g_object_new_internal (gobject.c:2011)
==993876==    by 0x4E0538C: g_object_new_with_properties (gobject.c:2181)
==993876==    by 0x4E05D40: g_object_new (gobject.c:1821)
==993876==    by 0x4A3F864: meta_wayland_compositor_new (meta-wayland.c:585)
==993876==    by 0x49C7FA7: meta_context_start (meta-context.c:412)
==993876==    by 0x10F065: main (mutter.c:148)

Fixes: 2ce3a050f0 ("wayland: Wire up presentation-time machinery")
Fixes: 8cff3b84f7 ("wayland/compositor: Process frame callbacks on 'after-update'")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2527>
2022-07-25 14:55:59 +00:00
Jonas Ådahl
81b28a1d97 kms: Notify about privacy screen changes via predictions
When we change the privacy screen, we added a result listener to the KMS
update object to notify the upper layer about the privacy screen state
change. This was slightly awkward as one might have changed the state
multiple times for a single update, thus it was necessary to remove any
old result listeners to an update before adding a new one.

Doing this will not be possible when updates are fully async and managed
by the KMS impl device.

To handle this, instead make the post-commit prediction notify about
changes that happens in response to a successfully committed update. We
already predicted the new privacy screen state, so the necessary change
was to plumb the actual change into a callback which emits the signal if
there actually was a privacy screen change.

This will then be communicated via the same signal listener that already
listens to the 'resources-changed' signal.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2340>
2022-07-25 11:02:35 +00:00
Jonas Ådahl
1b0aa0b3ad kms: Rename MetaKmsUpdateChanges to MetaKmsResourceChanges
The name had a bit conceptual conflicts with MetaKmsUpdate, as it shared
its namespace but had no relation to it. Fix this by renaming it
MetaKmsResourceChanges (and the corresponding META_KMS_UPDATE_CHANGE_*
to META_KMS_RESOURCE_CHANGE_*). The term "resource" is used since that's
already used in the signal, and the fact that the changes partly comes
from changes in the DRM resource as retrieved by drmModeGetResources.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2340>
2022-07-25 11:02:35 +00:00
Carlos Garnacho
633635d608 backend: Fix cursor visibility on X11 with only tablets as input
Since tablets on X11 drive the Virtual Core Pointer as every other
pointing device, we should consider it as a pointer device when
determining whether the pointer cursor should be visible.

Fixes the cursor being hidden if there are only tablets for input.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2283
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2518>
2022-07-25 10:12:50 +00:00
columbarius
b17a510309 screen-cast-stream: Timestamp buffers
With spa_meta_header we can timestamp our buffers so clients can relate
and synchronize media from different sources.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2516>
2022-07-21 22:29:45 +00:00
columbarius
30b5229e0e screen-cast-stream: Use SPA_META_Header
With this header we can set a flag to signal that the whole buffer is
corrupt and should be ignored. With this we can cater to all cases:
* Window buffer fine, but cursor broken:
  Use the spa_meta_cursor properties like id or offset accordingly
* Window buffer broken, but cursor fine:
  Use the chunk flags
* Both are broken / the dequeued buffer is not usable
  Use the spa_meta_header flag

Additionally clients can now check if a buffer contains spa_meta_header
data and can thus only check for the new or the old behaviour.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2516>
2022-07-21 22:29:45 +00:00
Michel Dänzer
10c7ab2dec cursor-renderer/native: Fix type in unset_crtc_cursor_renderer_privates
Since the commit below, meta_crtc_kms_get_cursor_renderer_private has
returned a CrtcCursorData pointer, but this code was still treating it
as a MetaDrmBuffer pointer.

Fixes: fea8ebcca9 ("cursor-renderer/native: Store struct in CRTC private")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2524>
2022-07-21 21:03:18 +00:00
Michel Dänzer
709d06e89e wayland/surface: The same sub-surface is not a valid sibling
The Wayland protocol documentation at
https://wayland.app/protocols/wayland#wl_subsurface:request:place_above
says:

 The reference surface must be one of the sibling surfaces, or the
 parent surface. Using any other surface, including this sub-surface,
 will cause a protocol error.

v2:
* Leave it as a single line. (Georges Basile Stavracas Neto)

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2525>
2022-07-21 17:03:12 +02:00
Michel Dänzer
ddb7f84291 wayland/surface: Simplify is_child & is_sibling
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2525>
2022-07-21 17:03:12 +02:00
Carlos Garnacho
ffac294520 clutter: Pass anchor position to ClutterInputFocus
Some implementations may need this (namely, the one that drives
the Wayland protocol), so pass this along from the IM events.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2517>
2022-07-19 11:04:56 +00:00
columbarius
82fd5cbdbd screen-cast-stream: Use flag to signal failed recording
PipeWire supports flags to signal a corrupted buffer. We should use the
flag SPA_CHUNK_FLAG_CORRUPTED for `chunk->flags` instead of setting
`chunk->size = 0` since the size isn't well defined for arbitrary dmabufs
and should be set to 0.
Sadly clients like obs are using a chunk size of 0 to decide if a buffer
should be imported. Thus we should offer both until clients are using
the flag.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2323>
2022-07-15 02:03:44 +02:00
José Expósito
9dd6268d13 wayland/pointer: Send high-resolution scroll data
Upgrade the seat protocol to version 8 and change the scroll handler to
support new clients.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1962>
2022-07-14 22:29:56 +00:00
José Expósito
5171e5b795 backends/native: Migrate discrete scroll
Change meta_seat_impl_notify_discrete_scroll_in_impl to receive 120
based values and report high-resolution scroll values as smooth scroll.

Notify discrete scroll only when the accumulated value reach 120.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1962>
2022-07-14 22:29:56 +00:00
José Expósito
a1c50194a9 backends/native: Migrate continuous scroll
In order to get the delta X/Y value of the
LIBINPUT_EVENT_POINTER_SCROLL_FINGER
or LIBINPUT_EVENT_POINTER_SCROLL_CONTINUOUS events the new function
libinput_event_pointer_get_scroll_value should be used instead of
libinput_event_pointer_get_axis_value.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1962>
2022-07-14 22:29:56 +00:00
José Expósito
5d884d49b5 backends/native: Deprecate LIBINPUT_EVENT_POINTER_AXIS
Ignore deprecated LIBINPUT_EVENT_POINTER_AXIS events and handle
LIBINPUT_EVENT_POINTER_SCROLL_WHEEL,
LIBINPUT_EVENT_POINTER_SCROLL_FINGER and
LIBINPUT_EVENT_POINTER_SCROLL_CONTINUOUS instead.

The scroll source is now encoded in the event type making
libinput_event_pointer_get_axis_source and translate_scroll_source
redundant.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1962>
2022-07-14 22:29:56 +00:00
Pascal Nowack
ab3931fec8 backends/screen-cast-stream-src: Set correct stride when using dmabufs
Currently, mutter hardcodes the stride of all recorded images in a
screencast to width * 4.
While this stride is valid for general memory buffers, it is not
necessarily valid for dmabuf buffers, as the driver may need a specific
alignment of the stride.
This can currently result into import failures, e.g. when using the AMD
driver.

To fix this issue, retrieve the actual dmabuf stride, when using dmabuf
screencasts, and set it as the stride value in the PipeWire buffer.

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1913
Fixes: https://gitlab.gnome.org/GNOME/gnome-remote-desktop/-/issues/101
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2513>
2022-07-14 20:09:07 +02:00
Dor Askayo
f037c9df66 wayland/dma-buf: Don't require modifiers support for scanout tranche
When building the list of formats to be sent as part of the scanout
tranche, avoid requiring modifier support by the DRM driver for
formats relying on implicit modifiers (DRM_FORMAT_MOD_INVALID).

Specifically, the previous check required the DRM driver to have
advertised some modifier support for the given format in its
IN_FORMATS KMS plane property, regardless of modifier it was. If it
hadn't, the format was left out of the list of formats to be sent
in the scanout tranche.

When no formats remained to be sent in the scanout tranche, the
tranche simply wasn't sent.

This resulted in the scanout tranche never being sent for GPUs where
modifiers aren't supported. In those cases, no formats are advertised
using the IN_FORMATS property, and thus the list of formats to be sent
in the scanout tranche remained empty.

Since Mesa doesn't use scanout-compatible buffers for native Wayland
clients unless specifically requested to do so using the "scanout"
tranche flag, it effectively means that direct scanout of native
Wayland clients wasn't supported for GPUs without modifiers support.

Sending a tranche with formats paired with the implicit modifier
(DRM_FORMAT_MOD_INVALID) is both allowed by the protocol and is
already done by default for GPUs with modifiers support, unless the
experimental support for explicit modifiers is enabled in Mutter.

So instead of requiring modifiers to be supported for each format
being evaluated for the scanout tranche, when processing formats
which rely on implicit modifiers, only check if the format in
question is supported by the DRM driver for scanout on the primary
plane.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2510>
2022-07-12 18:53:30 +03:00
Robert Mader
1a56a53909 wayland/actor-surface: Consider clones in is_on_logical_monitor()
While the check for `clutter_actor_has_mapped_clones` clearly indicates
an intention to take clones into account, the following code
does not do so, likely because it predates the introduction of
`clutter_actor_is_effectively_on_stage_view()`.

Switch to that newer API in order to take clones into account. This
avoids unnecessary `wl_surface_send_enter()` and `wl_surface_send_leave()`
events when entering the overview, reducing client work.

This also avoids unnecessarily allocating a `cairo_region_t`.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2502>
2022-07-11 18:18:56 +00:00
Robert Mader
0f8f30c93f window-actor/wayland: Skip unnecessary set_child_at_index() calls
`clutter_actor_set_child_at_index()` is far from a no-op, even if
the current index is equal to the new one - presumably for good
reasons. For the use-case here we want it to be a no-op though, so
skip calling it if the index already matches.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2501>
2022-07-11 17:23:10 +00:00
Robert Mader
57881ba612 wayland/subsurface: Move actor unparenting back to rebuild_surface_tree()
Unparenting the surface actor when the subsurface object is destroyed
has several issues:
 - subsurface actors can be unparented while a close animation is
   still ongoing, breaking the animation for e.g. Firefox.
 - adding and removing the actor to/from the parent is not handled in
   one place, making the code harder to follow.
 - if the destroyed subsurface had children of its own, they potentially
   stick around until a surface-tree rebuild. This makes the Firefox
   hamburger menu not close with the "compositor" backend.

Move the unparenting back to
`meta_window_actor_wayland_rebuild_surface_tree()` and instead just
notify the parent of a state change, if it still exist. This will ensure
a correct mapping between the subsurface node tree and the flat surface
actor list. In case of the closing animation the parent will already be
removed and the call is skipped.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2501>
2022-07-11 17:23:10 +00:00
Florian Müllner
640ca57c34 window: Close window when unsetting transient_for
Since b443bd42ac, we unmanage a wayland window when clearing its
transient parent. That's to make sure that xdg-foreign doesn't
leave the dialog around after the imported surface was destroyed.

While that behavior is sound, it is problematic to implement it
by unmanaging the window, as that happens entirely behind the
client's back.

Instead, send a close event for the window. Unless the client has
good reasons, it should honor the request. (And if it has good
reasons - like unsaved work - then effectively hiding the window
from both the user and client is probably not the best idea anyway).

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5458

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2499>
2022-07-08 21:00:13 +00:00
Florian Müllner
7ff1c04c8f window: Guard minimize()
Not all windows can be minimized: X11 clients can disable the
functionality, and so do we for windows that aren't shown in
the alt-tab popup or the shell overview, so there would be no
way of getting them back.

While we make sure that we respect that ourselves (keybinding,
window menu, etc.), we don't guard meta_window_minimize(), so
clients or extensions can still minimize a window that isn't
supposed to be minimized.

That can lead to all kinds of issues, from the hidden window
being lost (as far as users are concerned) to a crash when
the minimzed window has a transient parent.

Just add an explicit check to make sure the unexpected doesn't
happen after all, and print a warning if it does.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2491>
2022-07-08 20:05:32 +00:00
George Barrett
9bdf4b3572 core/events: Fix cursor tracking for other backends
The cursor rendering code path used by the screen cast code relies on
the cursor tracker machinery to determine where to blit the cursor
texture, but at the moment the cursor position invalidation is behind
a check for whether the shell is using a Wayland backend. (This code
path used to be Wayland-specific before 00cbcb7ba1 but has been
backend-agnostic since).

This commit removes the check for a Wayland compositor, allowing
cursor drawing to function correctly on X11 when screen casting in
embedded cursor mode.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1780
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2474>
2022-07-07 19:39:07 +00:00
Sebastian Keller
fe0a383d6f pointer-constraints/native: Fix borders array memory leaks
The borders arrays were not (fully) freed when going out of scope.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2337
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2497>
2022-07-06 19:27:20 +00:00
Florian Müllner
995ee2b638 tests/stage-view: Give outer container an explicit size
The test case checks that the stage views of hidden actors are
not updated when the views of the visible outer parent change.

The check for the outer parent's updated stage views currently
relies on ClutterFixedLayout not excluding hidden children in
its size request: As the container doesn't contain any visible
children at that point, its size would change to 0x0 and end
up on no stage view (rather than the assumed two).

Avoid that oddity by giving the outer container a fixed size,
so that the visibility of its child doesn't affect the test
when we fix ClutterFixedLayout.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2488>
2022-07-06 18:57:12 +00:00
Sebastian Wick
14b7da4292 tests/edid: Test EDID CTA-861 parsing code
Parses a real-world EDID blob with CTA-861 EDID extension and compares
it to edid-decode output.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2351>
2022-07-04 14:54:11 +00:00
Sebastian Wick
64362fcd76 edid: Parse CTA-861 HDR Static Metadata Data Block
Extract the supported HDR metadata type, supported Transfer Functions,
and display luminance characteristics.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2351>
2022-07-04 14:54:11 +00:00
Sebastian Wick
80626edfea edid: Parse CTA-861 Colorimetry Data Block (CDB)
Parses the CTA-861 extensions data blocks to extract the supported
colorimetry which can be set with the KMS connectors `Colorspace`
property.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2351>
2022-07-04 14:54:11 +00:00
Sebastian Wick
d76f9e6c4a edid: Parse CTA-861 EDID extension
This adds support for E-EDID extensions. Tags are allocated by VESA and
the CTA has such an extension defined in CTA-861.

The switch in `decode_ext_cta` is empty in this commit because we don't
parse any CTA-861 data blocks, yet.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2351>
2022-07-04 14:54:11 +00:00
Sebastian Wick
97c0d17596 edid: Fix EDID parsing function signatures
Parsing functions return a boolean so change the return type to reflect
this.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2351>
2022-07-04 14:54:11 +00:00
Jonas Ådahl
de2443bc3e edid: Prepare types for wider exposure
The EDID code is copy from elsewhere, without adapting to conventions
regarding e.g. API and types. Clean this up a bit, as EDID information
will be kept around longer when possible, to be used e.g. by color
management.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2351>
2022-07-04 14:54:11 +00:00
Dor Askayo
1f03a20939 window: Reuse existing function
This open-coded section is identical to the function.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2485>
2022-07-01 16:05:33 +00:00
Dor Askayo
525fc3ca47 surface-actor-wayland: Remove leftover function declarations
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2485>
2022-07-01 16:05:33 +00:00
Dor Askayo
cd68d5b26c wayland/surface: Remove leftover function declarations
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2485>
2022-07-01 16:05:33 +00:00
Jonas Ådahl
003ff46a98 tests/xwayland: Wait for clipboard to settle before killing Xwayland
The test aims to test that trying to fetch X11 clipboard content after
Xwayland went away doesn't cause issues. What happens though is that
sometimes the clipboard content doesn't have time to settle (i.e. fetch
mime types etc) before Xwayland gets terminated, which causes flakyness.

Fix this by waiting for the compositor side clipboard owners to finish
setting up before continuing.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2484>
2022-07-01 15:46:25 +00:00
Jonas Ådahl
43860110ff output/kms: Replace common mode bandwidth check with clock check
The pixel clock determines how fast pixels can be processed. When adding
non-native common modes, avoid adding modes that exceed the max pixel
clock frequency of the native modes. Avoiding these avoids potential
mode setting failures where the GPU can't handle the modeline since the
configured pixel clock is too fast. This replaces the "bandwidth" check
which used the number of pixels and refresh rate, which wasn't enough to
avoid incompatible modes.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2492>
2022-07-01 16:13:18 +02:00
Jonas Ådahl
53b52e26f5 screen-cast/monitor: Always use clutter_stage_paint_to_framebuffer()
'screen-cast/monitor-src: Use clutter_stage_paint_to_buffer'
(6c818cd8d5) made the non-dma-buf path use
clutter_stage_paint_to_buffer() to avoid running into direct scanout
issues. At a glance, the dma-buf paths didn't have the same issue since
it explicitly handled dma-bufs by blitting them.

What it also did was move the recording to an idle callback, to avoid
paint reentry issues. A side effect of this, however, is that it also
broke the dma-buf paths, as they rely on the back buffer existing, and
the stage view direct scanout already being setup, which it isn't in an
idle callback.

Fix this by using the dma-buf variant of
clutter_stage_paint_to_buffer(): clutter_stage_paint_to_framebuffer().
This has some negative performance impact, but we can't use
cogl_blit_framebuffer() when using an idle callback for recording.

Potential performance improvements to make things work more as they did
before is to enhance 'cogl_blit_framebuffer()' a bit, making it a vfunc
that could be implemented by MetaOnscreenNative. A flag to say whether
to look at the back or front buffer would let MetaOnscreenNative know
whether to use the already committed-to-KMS buffer, or the current back
buffer.

Fixes: 6c818cd8d5
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2282
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2462>
2022-06-28 09:54:40 +00:00
Michel Dänzer
4af54225de wayland/dma-buf: Free feedback in surface_feedback_surface_destroyed_cb
Fixes leak:

==14889== 2,168 (16 direct, 2,152 indirect) bytes in 1 blocks are definitely lost in loss record 15,308 of 15,584
==14889==    at 0x48445EF: calloc (vg_replace_malloc.c:1328)
==14889==    by 0x4BAC1D0: g_malloc0 (gmem.c:155)
==14889==    by 0x4AAFF60: meta_wayland_dma_buf_feedback_new (meta-wayland-dma-buf.c:298)
==14889==    by 0x4AAFFE0: meta_wayland_dma_buf_feedback_copy (meta-wayland-dma-buf.c:317)
==14889==    by 0x4AB16B6: ensure_surface_feedback (meta-wayland-dma-buf.c:1121)
==14889==    by 0x4AB1848: dma_buf_handle_get_surface_feedback (meta-wayland-dma-buf.c:1169)
==14889==    by 0x66F77E9: ??? (in /usr/lib/x86_64-linux-gnu/libffi.so.8.1.0)
==14889==    by 0x66F6922: ??? (in /usr/lib/x86_64-linux-gnu/libffi.so.8.1.0)
==14889==    by 0x5318750: ??? (in /usr/lib/x86_64-linux-gnu/libwayland-server.so.0.20.0)
==14889==    by 0x5313B99: ??? (in /usr/lib/x86_64-linux-gnu/libwayland-server.so.0.20.0)
==14889==    by 0x5316649: wl_event_loop_dispatch (in /usr/lib/x86_64-linux-gnu/libwayland-server.so.0.20.0)
==14889==    by 0x4AA7C19: wayland_event_source_dispatch (meta-wayland.c:110)

Fixes: 64e6bedb6b ("wayland/dma-buf: Add support for scanout surface feedback")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2469>
2022-06-16 10:24:42 +00:00
Olivier Fourdan
1c16e1cb9c backends: Move MetaKeyboardA11yFlags to a public header
The MetaKeyboardA11yFlags are used by gnome-shell to show a dialog
whenever a keyboard accessibility feature is switched using the
keyboard.

Unfortunately, commit c3acaeb25 renamed the Clutter flag to Meta and
moved them to a private header. As a result, gnome-shell do not show any
dialog anymore when a keyboard accessibility feature is activated.

Move the MetaKeyboardA11yFlags definition to a public header so that
gnome-shell can use it.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2306
Fixes: c3acaeb25 - backends: Move keyboard a11y into backends
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2463>
2022-06-14 18:04:05 +02:00
Jonas Ådahl
ccde353fb3 wayland/pointer-confinement: Scale region with the geometry scale
Without applying the geometry scale, to both the region and the minimum
edge distance, the confinement area becomes too small and offset on
HiDPI setups.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2110
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2460>
2022-06-13 18:38:51 +00:00
Jonas Ådahl
6d46ffccbc pointer-constraints: Move min edge distance from backend to Wayland
The min distance to the right/bottom edge depends on Wayland concepts
(wl_fixed_t) and eventually geometry scale. Move the logic the Wayland
side of the pointer constraints machinery to avoid the backend trying to
figure this out without the proper data.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2460>
2022-06-13 18:38:50 +00:00
Jonas Ådahl
94aaa65bd2 pointer-constraints/native: Remove old clutter float math work around
There were some coordinate nudging to avoid running into Clutter
floating point math issues related to coordinate transformations. Over
the years these things have improved, especially with the move to
graphene, so remove the old work around.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2460>
2022-06-13 18:38:50 +00:00
Jonas Ådahl
71ea01f54c wayland/surface-role: Make geometry scale API return int
Geometry scale are always ints, callers always assumed they were ints,
but they were doubles. Make them ints.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2460>
2022-06-13 18:38:50 +00:00
Sebastian Wick
a49c4e188a backends/native: Use the PropTable to look up KMS values
We already look up all the metadata and values in the
MetaKmsConnectorPropTable so we can just use them instead of looking it
all up again.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2379>
2022-06-10 17:49:07 +00:00
Sebastian Wick
4e3f3842a1 backends/native: Use MetaKmsPlaneRotation in plane updates
The ImplDeviceAtomic converts the MetaKmsPlaneRotation back to the
concrete KMS value. The MetaMonitorTransform is always directly
converted to a MetaKmsPlaneRotation.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2379>
2022-06-10 17:49:07 +00:00
Sebastian Wick
981524c268 backends/native: Update PropTable on hotplug and remove parse callback
Updating the PropTable has the side effect that the parse callback now
also gets called on hotplug but it is used to initialize data. The parse
callbacks are moved to the read_state functions which are aware if this
is an initializing call or just an update.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2379>
2022-06-10 17:49:07 +00:00
Sebastian Wick
1e06b346cb backends/native: Store Enum and Bitmask information in MetaKmsProp
Add functions for converting between the values used by DRM and the
enums/bitmasks used by mutter.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2379>
2022-06-10 17:49:07 +00:00
Sebastian Wick
9519a84967 backends/native: Define all KMS properties in PropTable we actually use
Currently those properties are looked up manually or fixed values are
used when they should be looked up. The following commits will actually
make use of this.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2379>
2022-06-10 17:49:07 +00:00
Naveen Kumar
3b062842ed tests/clutter: Add color state conform tests
* creating an actor will result in it being assigned a color state
 with the color space sRGB
* creating an actor with a color state passed will result in that
 color state being returned
* changing an actor's color state makes that happen
* changing an actor's color state to NULL ends up with it being
 changed back to a color state with the sRGB color space

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2443>
2022-06-09 15:00:07 +00:00
Dor Askayo
c18ce8569e tests/wayland: Add a missing "include"
This avoids the following error:

  ../src/tests/wayland-test-clients/dma-buf-scanout.c💯5: error:
    implicit declaration of function ‘close’; did you mean ‘pclose’?
    [-Werror=implicit-function-declaration]
    100 |     close (buffer->dmabuf_fds[i]);
        |     ^~~~~
        |     pclose

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2458>
2022-06-08 00:29:50 +03:00
Jonas Ådahl
3776f9df8c x11/clutter-backend: Remove unused XSynchronize() call
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2444>
2022-06-03 13:43:26 +00:00
Jonas Ådahl
fdde7e0f37 x11: Let X11 connection owners call XSynchronize() themselves
Only make the context carry the boolean state, but move the two libX11
calls into their corresponding connection handler objects.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2444>
2022-06-03 13:43:26 +00:00
Jonas Ådahl
74230038c9 Remove checks for GLSL
The Cogl feature was removed a while back, while Clutter just hard coded
it to TRUE. Lets remove the confusion that GLSL isn't supported and just
remove the (dead) fallback paths.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2015>
2022-06-03 12:57:31 +00:00
Robert Mader
b988fd73c9 tests/wayland: Add test for buffer transforms
Ensure that buffer transforms are correctly rendered.

This test would fail without the commit
"wayland/surface: Swap 90 and 270 degree transforms"

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1055>
2022-06-03 09:03:10 +00:00
Robert Mader
11fc5b6c6c tests/wayland: Add more requests to test driver protocol
Add `sync_effects_completed()` and `verify_view()` in
order to allow Wayland test clients to trigger verifications
and add convenience functions to use them to client-utils.

Notes:
- `sync_effects_completed()` works in two stages in order
  to ensure it doesn't race with window effects. By the time
  `sync_effects_completed()` is processed, an effect could
  already have ended or not yet been scheduled. Thus we
  defer a check for pending effects to the next paint cycle,
  assuming that by then they should have been scheduled.
- `meta_ref_test_verify_view()` internally triggers the
  `paint` signal for the stage which is why it can not be run
  in the after-paint signal handler.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1055>
2022-06-03 09:03:10 +00:00
Robert Mader
27dbf77d19 tests/wayland: Update documentation for MUTTER_REF_TEST_UPDATE
For some reason `LIBGL_ALWAYS_SOFTWARE=1` does not work as intended
while `MESA_LOADER_DRIVER_OVERRIDE=swrast` does.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1055>
2022-06-03 09:03:10 +00:00
Robert Mader
fd7ee33337 tests/wayland: Make create_shm_buffer() public
It will be needed in a following commit.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1055>
2022-06-03 09:03:10 +00:00
Robert Mader
db2cf4b874 tests/wayland: Bump wl_compositor version for test clients
Version 2 is required for buffer transform, however directly going
for the highest currently supported version doesn't break any
tests and makes more features available.

Also fix indentation below while on it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1055>
2022-06-03 09:03:10 +00:00
Robert Mader
8d9bbe109b wayland/surface: Swap 90 and 270 degree transforms
Our internal interpretation of output transforms is not in line with
the Wayland spec. Wayland describes them as the transform that a
compositor will apply to a surface to compensate for the rotation
or mirroring of an output device - counter-clockwise.

Mutter in turn interprets it the other way around. One could
argue it does the same but clock-wise - or it interprets the transform
from the viewpoint of the content, not the device.

In either way, the difference is that 90 and 270 degree values are
switched. Thus swap these accordingly when we translate from
`WL_OUTPUT_TRANSFORM` to `META_MONITOR_TRANSFORM`.

See: https://gitlab.freedesktop.org/wayland/weston/issues/99
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1055>
2022-06-03 09:03:10 +00:00
Dor Askayo
a0ff90a329 kms/page-flip: Add a debug print with page flip event timings
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2439>
2022-06-03 06:55:28 +00:00
Jonas Ådahl
57d3b5225e tests: Add basic X11 WM test
This launches Xvfb, using xvfb-run, and inside tests the following:

  1. Launching 'mutter --x11' works
  2. Launching a couple of X11 clients works (doesn't crash or result in
     warnings)
  3. Launching 'mutter --x11 --replace' works
  4. Terminating works

It does this using a simple shell script.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2434>
2022-06-02 17:19:42 +00:00
Jonas Ådahl
16af2e407b gpu/xrandr: Gracefully handle 0.0 refresh rate
We don't make use of the refresh rate in any useful way in the X11, and
in this case we just ended up with warnings since the refresh rate was
NaN. Fix this by making it 0.0 to mean "no refresh rate". This also is
what 'xrandr' itself reports.

Fixes warnings when launching 'mutter --x11' in Xvfb.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2434>
2022-06-02 17:19:42 +00:00
Jonas Ådahl
f5887a6258 monitor-manager: Make warning message less confusing
It talked about KMS state, which was a bit unexpected when debugging the
X11 backend.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2434>
2022-06-02 17:19:42 +00:00
Jonas Ådahl
7bf4f850b8 wayland/dma-buf: Remove no longer used mesa macro duplication
We're bumped the required mesa version, so we don't need to keep this
around anymore.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2417>
2022-06-02 08:59:13 +00:00
Jonas Ådahl
c9960850c8 tests/kms/render: Add direct scanout test case
This adds a minimalistic fullscreen direct scanout test case, that runs
on vkms. It doesn't use EGL, and it uses uninitialized memory, thus it
lacks any kind of implicit synchronization, but it does test that the
scanout selection paths are working.

What is tested is:

  * DMA buffer allocated using gbm on top of VKMS
  * Buffer passes a mode setting TEST_ONLY check
  * Paint is omitted
  * Correct buffer active in KMS after presentation

What isn't yet tested:

  * Implicit synchronization related behavior
  * Presented pixel content

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2417>
2022-06-02 08:59:13 +00:00
Jonas Ådahl
5be555c59d tests/kms/render: Disconnect signal in end of test case
Otherwise it'll get invoked in later test cases.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2417>
2022-06-02 08:59:13 +00:00
Jonas Ådahl
f76258b840 tests/kms/render: Get backend from context
Avoids a couple of singleton accesses.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2417>
2022-06-02 08:59:13 +00:00
Jonas Ådahl
a8c2df6fb5 tests/test-driver: Add way to send generic properties to client
This will make it rather convenient to send arbitrary strings, e.g. file
paths, to the client test case.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2417>
2022-06-02 08:59:13 +00:00
Bilal Elmoussaoui
89d036cca0 context/main: Disable X11 specific options
Related: https://gitlab.gnome.org/GNOME/mutter/-/issues/2272
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2429>
2022-06-01 11:25:17 +00:00
Georges Basile Stavracas Neto
0b47554f74 tests/interactive: Port to cogl_texture_2d_new_from_data
Same old story.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2355>
2022-05-31 16:28:16 -03:00
Georges Basile Stavracas Neto
8f6469f6cb tests/interactive: Replace cogl_texture_new_from_file
The interactive tests are the last users use this deprecated API, so
port them to the appropriate alternatives - either CoglTexture2D or
CoglTexture2DSliced.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2355>
2022-05-31 16:25:11 -03:00
Georges Basile Stavracas Neto
ca0e467a3b tests/interactive: Drop test-cogl-image-convert
This test exercises a form of image conversion that isn't exposed in
the new CoglTexture2D APIs, which is about to be removed. Drop this
test.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2355>
2022-05-31 16:25:11 -03:00
Georges Basile Stavracas Neto
da8353dbcd tests/interactive: Replace most CoglHandles by CoglTextures
There are 2 remaining CoglHandles, but they're for shaders, which
actually return CoglHandle as part of the API signature.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2355>
2022-05-31 16:25:11 -03:00
Georges Basile Stavracas Neto
9f3191fe9c tests/interactive: Drop empty test_coglbox_finalize
All of them were devoid of code.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2355>
2022-05-31 16:25:11 -03:00
Georges Basile Stavracas Neto
dbae8d7aa7 tests/interactive: Make TestCoglbox final
This cleans up a lot of boilerplate code.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2355>
2022-05-31 16:25:11 -03:00
Georges Basile Stavracas Neto
83e0553534 tests/interactive: Cleanup tabs
I also sneaked in some code style fixes on the lines that were
touched. Judge me freely, it's all for the greater good.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2355>
2022-05-31 16:25:11 -03:00
Jonas Ådahl
f772b4cde6 restart: Make API that needs context take a context
This allows avoiding looking up old singletons.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2446>
2022-05-31 16:42:46 +00:00
Jonas Ådahl
81860229ba restart: Don't pass error as unused user data
We passed the pointer to a GError * as user data on an async I/O call.
The callback function didn't make use of it, so it was never written to,
thus remained NULL, thus was dead code. Remove it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2446>
2022-05-31 16:42:46 +00:00
Jonas Ådahl
83ed7b7dfd xwayland: Remove stray newline
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2364>
2022-05-31 12:00:55 +00:00
Jonas Ådahl
e939d5b89a tests: Check that X11 selections handle Xwayland disappearing
It works by using an X11 client to set the clipboard content, using a
mimetype that on purpose is not handled by the clipboard manager. The
test then makes sure we don't crash when trying to transfer data from
the old X11 selection source.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2364>
2022-05-31 12:00:55 +00:00
Jonas Ådahl
7e8bddccb5 tests/async-waiter: Keep track of X11 display it was created with
The Xwayland server can go away at any time; when this happen we might
have a test client running, and for it to tear down more nicely, make
sure to avoid trying to clean up X11 resources on the old X11 display.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2364>
2022-05-31 12:00:55 +00:00
Jonas Ådahl
82d9ef7a55 x11/input-selection-stream: Handle Xwayland going away
Xwayland can disappear at any time, for example during a new_async() or
read_async() call. When we eventually finalize the stream, the X11
display it was created for is gone, thus can't clean up the X11
resources. Handle this by making the MetaX11Display pointer a weak
pointer, and ignore cleaning up if it disappeared. This is fine since
the X11 server it created those resources one is gone already.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2364>
2022-05-31 12:00:55 +00:00
Jonas Ådahl
6c0a917832 selection: Return an error if trying to transfer from NULL source
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2364>
2022-05-31 12:00:55 +00:00
Jonas Ådahl
c9e7cf4ea1 xwayland: Add API to send signal to the Xwayland process
Will be used for test cases to fake-crash the Xwayland process.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2364>
2022-05-31 12:00:55 +00:00