Commit Graph

28893 Commits

Author SHA1 Message Date
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
d2c4616242 clutter/fixed-layout: Ignore hidden children in size request
Hidden actors aren't only invisible, they should also not take
up any size.

Found in the context of
https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2347

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2488>
2022-07-06 18:57:12 +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
973b94ae46 ci: Bump the container image
This will include gtk+ 3.24.34, which contains a fix avoiding errors
when querying RANDR after Xwayland terminated.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2484>
2022-07-01 15:46:25 +00:00
Jonas Ådahl
3ee28bc336 ci: Fix Xwayland build config
Some of the options doesn't exist anymore, and warnings are now fatal.

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
Bilal Elmoussaoui
5bbc8ffaa6 readme: Add links to the API documentation
Fixes #341

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2455>
2022-06-14 15:15:08 +00: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
Naveen Kumar
12c02b3f1a clutter: Attach color state information to actors
ClutterColorState, that is a GObject. each ClutterActor would own
such an object, and it'd be set via a GObject property.
It would have an API to get the colorspace, whether the actor
content is in pq or not, and things like that.
if it is NULL, it will default to color state with sRGB colorspace.

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
Bilal Elmoussaoui
d1a85c34cc ci: Build and deploy documentations
A first step towards better documentations of Mutter
and it internal libraries

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2427>
2022-06-03 16:56:49 +00: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
9a68fb19e4 clutter: Remove 'features'
There are no 'features' left, the last one, GLSL shader support, was
moved to Cogl.

This also move the Cogl context creation to a more sensible place, as it
was hidden away in the feature initialization.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2015>
2022-06-03 12:57:31 +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
e7a8173f3a frame-clock: Fix constant type of condition
To avoid confusion, change the int to a float, since we're comparing
with a float.

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