1
0
Fork 0
Commit graph

31199 commits

Author SHA1 Message Date
Sebastian Wick
985e93f9fa cogl/cpu-caps: Build cpuid and xgetbv only for x86_64
This also adds the cpuid functionality inline and checks for GCC ASM
flag output support.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3226
Fixes: 3bf6de60b ("cogl: Add CPU capability detection helper")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3488>
2024-01-04 16:45:37 +00:00
Bilal Elmoussaoui
7f1b890df1 cogl: Add missing new block in switch case
Closes #3226
Fixes: 6efd4a228 ("cogl/cleanup: Use construct-only properties for
CoglBuffer")

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3478>
2024-01-04 15:51:52 +00:00
Bilal Elmoussaoui
b64381d366 x11: Rename cairo_rects to mtk_rects
Avoids the result from showing up in a grep cairo

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3486>
2024-01-04 14:00:26 +00:00
Bilal Elmoussaoui
9d7d25e9ee clutter/stage: Remove no longer used struct
Drops a cairo usage

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3486>
2024-01-04 14:00:26 +00:00
Daniel van Vugt
6db9a0d77e clutter/stage: Fix indentation check-code-style is complaining about
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3487>
2024-01-04 12:26:38 +00:00
Sebastian Wick
40305f53f0 docs: Import Clutter Rendering Model wiki page
This one was overlooked when we migrated the wiki to the repo, so let's
add it before we delete the wiki.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3485>
2024-01-03 22:41:10 +01:00
Sebastian Wick
50936e9953 docs: Prefix code documentation files
with the subsystem they belong to. This makes it easier to see which
files belong where.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3485>
2024-01-03 22:41:07 +01:00
Sebastian Wick
9ac2da99d6 docs/building-and-running: Add note about updating ref-tests
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3465>
2024-01-03 20:54:57 +00:00
Sebastian Wick
e583d3c0f7 docs/debugging: Expand debugging docs
Add information on different mutter specific debugging techniques.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3465>
2024-01-03 20:54:57 +00:00
Sebastian Wick
dedc2766d2 docs: Add Building and Running topic
There are a lot of ways to build and run mutter. Let's try to document
them and reduce the tribal knowledge.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3465>
2024-01-03 20:54:57 +00:00
Sebastian Wick
9682ea496c README: Mention the GNOME Handbook Development page
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3465>
2024-01-03 20:54:57 +00:00
Sebastian Wick
edfd1880c9 docs: Move the gitlab wiki and other docs to the docs/ directory
Let's try to consolidate our documentation in doc/ in the repo. This
includes some documentation from README.md, the HACKING.md coding style
and the gitlab wiki.

The README.md file now links to all top-level topics (i.e. not reachable
via other topics).

This also includes a few small changes to make things more consistent.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3465>
2024-01-03 20:54:57 +00:00
Sebastian Wick
86d61de5bd docs: Remove outdated documentation
The value of those documents is questionable. They mostly refer to the
X11 complications and have not been updated for a long time.

Let's just get rid of them.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3465>
2024-01-03 20:54:57 +00:00
Carlos Garnacho
4f68713020 frames: Notify borders on first content resize
This addresses the following race condition:
1. Window+MetaFrame are created non-fullscreen, _MUTTER_FRAME_EXTENTS
   is initialized through widget measuring, accounting for frame.
2. Window and MetaFrame become fullscreen.
3. MetaFrameContent gets first size allocation, already fullscreen.
4. Borders were initialized to 0,0,0,0, become set to 0,0,0,0 correctly
   reflecting fullscreen, however notify::borders is not emitted.
5. _MUTTER_FRAME_EXTENTS stays accounting for the frame extents.

It sounds sensible to have the borders initialized to a meaningful value,
so account for the first time the border would be set due to the content
being (re)sized, and let this first value trigger notify::borders resulting
in _MUTTER_FRAME_EXTENTS updates.

Since all later _MUTTER_FRAME_EXTENTS changes happen through content
resizes, we only have to cater for this initial handover between the
frame/content initialization paths done through widget measuring and
the later paths done through MetaFrameContent resizes.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2937
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3476>
2024-01-03 19:31:51 +00:00
Bilal Elmoussaoui
5964ccb385 wayland: Fix building without native backend
Closes https://gitlab.gnome.org/GNOME/mutter/-/issues/1026

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3480>
2024-01-03 14:46:41 +01:00
Bilal Elmoussaoui
cebde5c2d1 backend/native: Move DrmFormatBuf to cogl-drm-formats
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3480>
2024-01-03 14:46:41 +01:00
Bilal Elmoussaoui
786a9d9072 build: Require libdrm >= 2.4.95
So we can drop the DRM_FORMAT_INVALID fallback

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3480>
2024-01-03 14:46:04 +01:00
Bilal Elmoussaoui
a72f44132d build: Make use of defined req variables
Closes https://gitlab.gnome.org/GNOME/mutter/-/issues/752

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3482>
2024-01-03 12:09:46 +00:00
Bilal Elmoussaoui
50fd53d465 x11/seat: Initialize group/mode for pad events
Otherwise, if Mutter is built without libwacom, garbage values would be
passed to clutter_event_pad_button_new

Closes https://gitlab.gnome.org/GNOME/mutter/-/issues/3227

Fixes: 1611979fa ("x11: Implement ClutterSeat")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3479>
2024-01-03 10:56:11 +00:00
Mart Raudsepp
d7db784b54 build: Fix building without wayland headers
Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3046
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3471>
2024-01-03 10:48:00 +00:00
Robert Mader
cb794329e7 clutter/stage-view: Remove superfluous return in void function
Fixes: 9d3e4fd402 ("clutter/stage-cogl: Use buffer age when view monitor is rotated")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3473>
2024-01-02 13:54:38 +00:00
Robert Mader
a4181a6730 mtk: Mark mtk_rectangle_to_graphene_rect in-variable as const
To silence occasional compiler warnings.

Fixes: a93471eb90 ("mtk: Move Rectangle.to_graphene_rect from Meta")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3474>
2023-12-29 12:45:19 +01:00
Joan Torres
3a94822e75 clutter/actor: Set a minimum guessed scale
When running headlessly it fails guessing the scale to -1.0f making
the assertion g_assert (guessed_scale >= 0.5) fail.

Setting it to 1.f in that case fixes it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3464>
2023-12-22 15:44:37 +00:00
Sebastian Wick
4c6216e8a3 tests/wayland: Add basic YCbCr ref-tests
The test makes sure the YCbCr formats create the expected image and we
don't accidentally break it.

Like all wayland tests, this is now part of mutter/wayland, mutter/tty,
and mutter/kvm and will use either shm or dma-buf depending on which
suite is chosen.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3371>
2023-12-20 23:51:14 +00:00
Sebastian Wick
59d4343057 wayland-buffer: Enable YCbCr support for wayland shm
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3371>
2023-12-20 23:51:14 +00:00
Sebastian Wick
c8f4c85bfb wayland-buffer: Support MultiTexture formats via wayland shm
Finding the shm offset and shm stride for each plane is the main issue.
The rest is just creating multiple textures for each plane.

One assumption is that shm planes are always contiguous in memory so the
next plane comes directly after the size of the current plane.

The size of a plane is determined by the height and stride. There is
only a single stride parameter for shm buffers but we assume that the
first plane is always non-subsampled which gives us a number of "logical
elements" on one line (stride / bpp of the first plane). The stride of
the other planes is then the number of logical elements devided by the
subsampling factor and multiplied by the bpp of the plane.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3371>
2023-12-20 23:51:14 +00:00
Sebastian Wick
a4d75e8252 cogl/test: Test 16bpc RGBA UNORM formats
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3371>
2023-12-20 23:51:14 +00:00
Sebastian Wick
e40a256584 cogl/pixel-format: Support 16 bpc UNORM formats
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3371>
2023-12-20 23:51:14 +00:00
Sebastian Wick
19472c75be tests/wayland-test-clients: Fix up whitespace
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3371>
2023-12-20 23:51:14 +00:00
Sebastian Wick
5652c61c06 tests/wayland-test-clients: Use stride of the first plane
The assumption is that all planes are always contiguous, and we don't
have any multi-plane formats where the first plane is subsampled.

The stride of the entire buffer is then just the stride of the first
plane and the stride of the other planes is derived from that.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3371>
2023-12-20 23:51:14 +00:00
Sebastian Wick
005ede7702 tests/wayland-test-clients: Fix YUV420 vertical subsampling factor
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3371>
2023-12-20 23:51:14 +00:00
Sebastian Wick
0930282baa tests/wayland-test-clients: Destroy WaylandBuffers when released
Instead of forcing every user of WaylandBuffer to create a listener and
destroy the wl_resource and the WaylandBuffer object, provide a default
listener which does it for the user.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3371>
2023-12-20 23:51:14 +00:00
Sebastian Wick
628f12a48b tests/wayland-test-clients: Try simple dma-buf alloc first and fall back
to the complex one. If a driver supports allocating linear YCbCr formats
we can use that instead of constructing our own compatible buffer.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3371>
2023-12-20 23:51:14 +00:00
Sebastian Wick
ff3b8197fd tests/wayland-test-clients: Use ARGB dma-buf format for YUYV buffers
They are the same for our purposes of allocating a linear buffer and
writing to the CPU mapping, but the ARGB format is widely supported and
the YUYV format is not.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3371>
2023-12-20 23:51:14 +00:00
Sebastian Wick
c0832b99d8 multi-texture-format: Always use the tex coords of the first plane
The texture coordinates of all planes should be the same in theory so
using the coordinates of the first plane works.

The reason for this change is that Cogl somehow doesn't manage to get us
the correct coordinates for the 3rd plane in some circumstances. This is
really a workaround but not wrong in any way.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3176
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3469>
2023-12-20 19:39:06 +00:00
Alynx Zhou
33088d59db wayland/text-input: Pass char based offset to ClutterInputFocus
Wayland's text-input-v3 uses byte based offset for cursor and anchor of
surrounding text, but Clutter needs char based offset here. This commit
converts byte based offset to char based offset before passing them to
ClutterInputFocus.

Fixes <https://gitlab.gnome.org/GNOME/mutter/-/issues/3102>.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2712>
2023-12-20 19:31:05 +00:00
Alynx Zhou
27bdf0c577 wayland/text-input: Use byte based offset in delete_surrounding_text
ClutterInputFocus/GtkIMContext uses char based offset for
delete_surrounding, however, text_input_v3 uses byte based offset for
it. Currently only GTK with mutter can work correctly via text_input_v3
because they both forget to convert between char based offset and byte
based offset.

This commit fixes it in mutter by saving committed surrounding text in
MetaWaylandTextInput and converting char based offset to byte based
offset with the UTF-8 encoded surrounding text.

Fixes <https://gitlab.gnome.org/GNOME/mutter/-/issues/2146>.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2712>
2023-12-20 19:31:05 +00:00
Sebastian Wick
4b8798a800 shaped-texture: Don't use mipmaps for small textures
Mipmapping extremely small textures is pointless. We chose a lower limit
of 8 pixels in each direction.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3468>
2023-12-19 22:25:21 +01:00
Sebastian Wick
54c5ea9c13 texture-mipmap: Handle textures with width or height of 1
Calculating the mipmap width as half of the texture width leads to a
mipmap width of zero for textures with width of 1 which leads to an
early exit instead of a mipmap texture.

Fixes: 16fa2100d ("shaped-texture: Stop using MetaTextureTower and use GL mipmapping instead")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3468>
2023-12-19 22:24:57 +01:00
Bilal Elmoussaoui
6daa21c930 clutter: Remove unnused private functions
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3458>
2023-12-19 12:44:35 +00:00
Bilal Elmoussaoui
4d7dfb08c9 cally: Remove useless cally_actor_get_top_level_origin
Does nothing...

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3458>
2023-12-19 12:44:35 +00:00
Sebastian Wick
5dc92aa134 Revert "background: Make the final monitor texture RGB instead of RGBA"
This reverts commit 93e938e22f.

The alpha channel is required for the background-color to show where the
background-image is not visible.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1911
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3459>
2023-12-19 12:30:19 +00:00
Michel Dänzer
14d84707fc wayland/surface: Move committed buffer size check out of if (buffer)
A surface commit may change the buffer scale but not attach a new
buffer. In that case, the size of the previously attached buffer needs
to be consistent with the new buffer scale.

Fixes: 7649e2f3ab ("wayland/surface: Move buffer size check to meta_wayland_surface_commit")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3466>
2023-12-19 11:53:26 +01:00
Michel Dänzer
17640d9c98 wayland/surface: Use committed texture width/height in _surface_commit
meta_wayland_surface_get_buffer_width/height uses the currently applied
buffer, which may have a different size.

Fixes: 7649e2f3ab ("wayland/surface: Move buffer size check to meta_wayland_surface_commit")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3466>
2023-12-19 11:23:22 +01:00
Michel Dänzer
98c8c03729 wayland/surface: Check buffer size also for role-less surfaces
The Wayland protocol spec doesn't say anything about this being required
only for surfaces with a role.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3463>
2023-12-18 21:56:59 +00:00
Michel Dänzer
7649e2f3ab wayland/surface: Move buffer size check to meta_wayland_surface_commit
Multiple reasons:

* More consistent with the protocol spec language.
* Ensures the size is checked and the protocol error sent from a
  protocol processing context, instead of whatever context
  meta_wayland_surface_commit might get called from.
* The latter implies that surface->resource is guaranteed to be valid.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3211
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3463>
2023-12-18 21:56:59 +00:00
Michel Dänzer
0a0d1e2066 wayland/surface: Track committed and applied scale separately
Preparation for next commit, no functional change intended.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3463>
2023-12-18 21:56:59 +00:00
Carlos Garnacho
4081d409c6 core: Avoid checks for no_focus_window
This window is set as the key focus in the MetaX11Display when the
MetaDisplay focus is NULL, we can check for that directly instead of
its aftereffects.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3269>
2023-12-18 17:55:27 +00:00
Carlos Garnacho
7fbc0ccc01 x11: Hook X11 focus management to MetaDisplay signal
This makes the MetaX11Display indirectly react to MetaDisplay changes,
rather than having the MetaDisplay also drive the MetaX11Display focus.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3269>
2023-12-18 17:55:27 +00:00
Carlos Garnacho
24344d8141 core: Add ::focus-window signal
This will be triggered whenever the input focus changes, so that
other pieces may hook to this place.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3269>
2023-12-18 17:55:27 +00:00