1
0
Fork 0
Commit graph

32485 commits

Author SHA1 Message Date
Martin Abente Lahaye
20385dd7b9 ci: Support setting libdir in install-meson-project.sh
Besides building custom fedora images,  we will build
system extensions for GNOME OS. Since GNOME OS uses a
a different libdir compared to what meson defaults to,
we must allow setting libdir in this script.

See https://discourse.gnome.org/t/towards-a-better-way-to-hack-and-test-your-system-components/21075
See https://gitlab.gnome.org/GNOME/gnome-build-meta/-/issues/837

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3843>
2024-07-12 14:35:50 -04:00
Jonas Ådahl
a72ee3be0d cursor-renderer/native: Transform cursor sprite into output color state
This avoids making the cursor too bright when HDR is enabled.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3433>
2024-07-09 18:59:25 +02:00
Jonas Ådahl
b0e4d7c6ad cursor-sprite: Tag each cursor sprite with a color state
So far, always set a default color state. For Wayland cursors, it will
probably be more dynamic in the future.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3433>
2024-07-09 18:59:07 +02:00
Jonas Ådahl
2a6e8f7188 clutter/stage-view: Add API to get output color state
Will be used for direct transforms from source to output color state.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3433>
2024-07-09 18:56:07 +02:00
Jonas Ådahl
0bbb78f29e cursor-renderer/native: Pre-process cursor sprite with Cogl
Instead of using cairo for scaling and rotating cursors before putting
them on a plane, use Cogl. For now still download them back to the CPU
so we can place them on a dumb buffer, but can explore rendering to a
DMA buffer directly as a future improvement.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3433>
2024-07-09 18:56:07 +02:00
Jonas Ådahl
20c7653d49 compositor-view/native: Don't scan out surface with color state mismatch
If the color state of a surface doesn't match the output, don't try to
scan it out, as it needs to pass through color state transformations to
look correct.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3433>
2024-07-09 18:56:07 +02:00
Jonas Ådahl
6b07141f1a clutter/paint-nodes: Make paint nodes handle color transformations
Either handle them directly, or when using the pipeline paint node, add
them on-demand if the color transformation capability isn't already set
by something else.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3433>
2024-07-09 18:56:07 +02:00
Jonas Ådahl
9b34aac441 clutter/text: Handle color state transformations
This uses the color state tracking in the paint context to add color
state transformations to the ClutterText actor.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3433>
2024-07-09 18:56:07 +02:00
Jonas Ådahl
2d48ca8aa1 clutter/paint-nodes: Copy instead of ref passed pipelines
A ClutterPipelineNode took a reference to the passed pipeline and used
it during the lifetime of the paint node. In theory this meant that a
paint node pipeline could be changed, and reused, affecting the previous
paint node drawing.

Referencing instead of copying also meant the ClutterPipelineNode isn't
able to itself manipulate the pipeline any further.

Fix both of these issues by copying, instead of adding a reference to,
the passed pipeline. While resulting in some additional allocation
over head, it means we can now eventually handle color transformations
automatically for ClutterPipelineNode's.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3433>
2024-07-09 18:56:07 +02:00
Jonas Ådahl
a1163385db paint-nodes: Sanity check color transform in blit nodes
Blitting cannot run with a shader, thus cannot do color state
transformations, so log a warning when that happens.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3433>
2024-07-09 18:56:07 +02:00
Jonas Ådahl
9a0fbbfa81 cogl/pango: Add argument to supply extra snippet
This will be applied to the pipeline used for drawing, and can be used
to include color state transformation snippets.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3433>
2024-07-09 18:56:07 +02:00
Jonas Ådahl
fe63242d60 cogl: Include the pipeline name and program number in debug logs
When running with COGL_DEBUG=show-source, log what pipeline and shader
program is used when painting, and what shader source code corresponds
to each shader program.

This helps identify what shader is used when painting to what
framebuffer.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3433>
2024-07-09 18:56:07 +02:00
Jonas Ådahl
aaba08e5aa Set names of various Cogl pipelines
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3433>
2024-07-09 18:56:07 +02:00
Jonas Ådahl
6cd28a84ac cogl/pipeline: Add API to name a pipeline
It uses static strings, and is meant to make it easier to match what
pipeline source code one might be looking at when running with
COGL_DEBUG=show-sources.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3433>
2024-07-09 18:56:07 +02:00
Jonas Ådahl
0c653b4cf2 clutter/actor: Pass paint context in paint_node()
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3433>
2024-07-09 18:56:07 +02:00
Jonas Ådahl
15df584b7e clutter: Add color state pipeline capability enum
So far 'color-state' is added, intended to tag pipelines with color
state transformation capabilities. Color state transformation snippets
are tagged with it. Eventually handlers of pipelines will use this
information to on-demand decorate pipelines with color transformation
snippets.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3433>
2024-07-09 18:56:07 +02:00
Jonas Ådahl
f67ace517f cogl/snippet: Add way to add an opaque capability
A snippet is assigned a capability, which is then transferred to the
pipeline it gets added to. Managers of pipelines can then check whether
a pipeline it got handed whether it has a certain capability, and if
not, handle the situation where it is not.

The intention is to allow Clutter to tag color state transformation
snippets with a capability, allowing generic paint nodes to handle color
transformations when needed.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3433>
2024-07-09 18:56:07 +02:00
Jonas Ådahl
b7291cfe48 shaped-texture: Use color aware rendering
This looks at the color state it got from the actor on construction, and
the target color state from the paint context and generates (and caches)
color aware pipelines used for painting. One of the purposes here is for
mixing SDR and HDR content and painting to a HDR monitor. If HDR (or
optical blending) isn't activated, the produced shaders will be
equivalent to what we had before.

Also add some names to the piplines, as this helps identifying what
pipeline source is associated with what pipeline.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3433>
2024-07-09 18:56:07 +02:00
Jonas Ådahl
6836a511db shaped-texture: Pass around paint context instead of Cogl context
In some of the places we need more context than just the CoglContext, so
prepare for that by passing around the paint context, which carries
this, everywhere instead. It won't be needed everywhere, but lets stay
consistent.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3433>
2024-07-09 18:56:06 +02:00
Jonas Ådahl
d49bfbc6ec background-content: Fix annotation
The annotations were missing a #MetaDisplay argument.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3433>
2024-07-09 18:56:06 +02:00
Jonas Ådahl
4238512764 clutter: Introduce color transform aware pipeline cache
Color aware rendering needs shaders / pipelines that adapt to what
output they render to. For example if we want to render to a linear
BT.2020 intermediate framebuffer on one monitor, and a non-linear sRGB
direct target buffer on another, the shader for the same paint node or
content will depend on where they are going to be presented.

In order to help keeping track of what shader should target what
monitor, without having to regenerate them each time, introduce a
pipeline cache that knows how to handle differentiating between
transforming between different color state.

The cache is meant to handle caches for multiple pipeline users, where
each user might potentially want to keep track of multiple pipelines
itself. Lookup should be O(1), and in order to achieve this, separate
the cache into 3 levels.

The first level is the "pipeline group", where e.g. a ClutterContent
type allocates a group where it can store its pipelines. Each group has
a fixed number of "slots" where it can store a pipeline. Each slot has a
hash table where the key is derived from a color state transform, and
where the value is a CoglPipeline where the thame color state
transformation is expected to be handled.

A content will when painting know about its own color state, and the
target state it should render into, retrieve a cached pipeline for the
correct transform, or if the cache didn't have it, generate it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3433>
2024-07-09 18:56:06 +02:00
Jonas Ådahl
0c2fa8e9a8 clutter/stage-view: Add linear intermediate color space buffer
Allow compositing in a linear color space and do so either when forcing
it via the debug controls D-Bus API, or when the experimental HDR mode
is enabled.

This relies on paint nodes etc to actually transform everything into the
linear target color space, which isn't done yet, so enabling it right
now will cause a broken result. Yet, introduce this now, so that
painting can be fixed piece by piece.

Linear blending is automatically enabled on monitors where HDR is
enabled, as this makes it possible to use an linear color space when
blending content from different color spaces with different transfer
functions.

Linear blending requires extra precision, i.e. 16 bit per channel
in the intermediate buffer due how the values are distributed,
so only enable the experimental HDR mode if the Cogl context supports
half float formats.

By default, no intermadiate linear offscreen framebuffer is used.

To test, do e.g.

  ./tools/debug-control.py --toggle ForceLinearBlending

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3433>
2024-07-09 18:55:54 +02:00
Jonas Ådahl
beb3415d7e renderer/native: Use format from onscreen when creating offscreen
This means we'll get the same bit depth etc.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3433>
2024-07-09 18:51:30 +02:00
Jonas Ådahl
b275af95b7 clutter/paint-context: Add content and target color state tracking
The initial target color state is the color state of the stage view
being painted to. If we're painting to an arbitrary framebuffer, it's
currently hard coded to sRGB/electrical.

The content color state is not set on construction, but when starting to
paint, it's set to the color state of the stage itself. Whenever an
actor is painted, it'll set the color state to the color state of
itself. The intention is that offscreen rendering pushes a target color
state that causes painting to it to not necessarily be in the stage view
color state.

Pass color state with offscreen framebuffer, as this avoids hard coding
sRGB in the lower level bits of paint contexts. It's still practically
hard coded, only that it's derived from somewhere else (e.g. the stage
or window actor).

Nothing is actually using this yet, but will eventually.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3433>
2024-07-09 18:51:30 +02:00
Jonas Ådahl
1a52108c17 clutter/stage-view: Add API to get view color state
This aims to provide the color state used for compositing for a specific
view. It's currently hard coded to default, but will eventually be
configured depending on the monitor and configuration. It's intended to
be used as a target color state for rendering with color awareness.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3433>
2024-07-09 18:51:17 +02:00
Jonas Ådahl
2bd8216eb1 clutter/color-state: Cache snippets
The cogl shader cache uses snippet pointers as cache keys, meaning even
if we generate two identical snippets; if they have different pointer
addresses, they'll generate separate cache entries. Handle this by
caching our snippets on the context.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3433>
2024-07-09 18:00:58 +02:00
Jonas Ådahl
d7bbc9712f clutter/color-state: Pass the ClutterContext when constructing
This will be used to cache pipeline snippets shared by multiple color
states.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3433>
2024-07-09 18:00:58 +02:00
Jonas Ådahl
4a07242fed clutter/color-state: Add color state transform helper
This helper generates shader snippets that converts pixels from one
color state to another. For example if there is content with sRGB color
state that should be converted to linear BT.2020 before being written to
the framebuffer, a shader that makes the pixel go through the following
steps will be generated:

 1. sRGB EOTF
 2. Luminance gain (hard coded for now)
 3. Color space mapping

The intention is that it should be possible to composite in a linear
color space, into an intermediate framebuffer, which is then passed
through an inverse EOTF to produce linear content in the output color
state.

When transforming from BT.2020/PQ to sRGB/sRGB, clamping to the sRGB
max luminance is done.

Cases where direct transform is also handled, i.e. where one doesn't go
via an linear intermediate buffer, in which case there might be both an
EOTF and an inverted EOTF in the same shader snippet to still do color
space mapping using optical color encoding. This will be used for e.g.
transforming cursor sprites.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3433>
2024-07-09 18:00:58 +02:00
Jonas Ådahl
8b425f4e85 clutter/actor: Make unsetting color state an explicit function
It makes things easier and more straight forward to handle.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3433>
2024-07-09 18:00:58 +02:00
Jonas Ådahl
1fa5a016be cogl/gl: Bump required GLSL version to 140
This will be needed by future color management and HDR shaders.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3433>
2024-07-09 18:00:58 +02:00
Jonas Ådahl
b538f4b999 shaped-texture: Take a ClutterContext when constructing
This will be used to fetch the corresponding pipeline cache.

This also means some minor reshuffling in MetaSurfaceActor to create it
after constructing the object.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3433>
2024-07-09 18:00:58 +02:00
Jonas Ådahl
6c34055cae tests/clutter: Add getter for context and backend
Add a getter for getting a ClutterContext, and another for getting a
ClutterBackend, so that these can be easily retrieved from test cases.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3433>
2024-07-09 18:00:58 +02:00
Jonas Ådahl
c4dc0bd755 backend: Add getter for ClutterContext
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3433>
2024-07-09 18:00:58 +02:00
Jonas Ådahl
af71749e75 clutter/color-state: Add transfer function
Another enum, defining SRGB gamma transfer function, and the PQ transfer
function. As with color spaces, add a 'default' that for now is treated
as if it was sRGB.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3433>
2024-07-09 18:00:58 +02:00
Jonas Ådahl
b74515b8cf clutter/actor: Default to 'default' color space
Do this so one can distinguish between "unspecified" and explicitly
sRGB.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3433>
2024-07-09 18:00:58 +02:00
Jonas Ådahl
9adbaa05b3 clutter/enums: Removing trailing whitespace
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3433>
2024-07-09 18:00:58 +02:00
Jonas Ådahl
563fff9c9c colorspace: Rename 'unknown' to 'default'
An unknown color space isn't very useful to have, as there is not very
actionable what to do with it. Rename it to 'default'. Later it'll be
used to an implicit color space, which in practice will be treated as
sRGB.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3433>
2024-07-09 18:00:58 +02:00
Jonas Ådahl
2ae5af62ea clutter/stage-view: Make shadow fbs use the onscreen pixel format
We'd use the "default" format otherwise; once the onscreen gets
something other than the hard coded format, we'll want to make sure we
use the same here.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3433>
2024-07-09 18:00:58 +02:00
Jonas Ådahl
42d4287f20 clutter/actor: Make actors have a context
The context can be set via a property (currently unused) or via the
current global singleton as a fallback. It means API that acts on an
actor can avoid going via any globals.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3433>
2024-07-09 18:00:58 +02:00
Jonas Ådahl
2e02078638 clutter/actor: Fix indentation of color state getter/setter
They were different from all the other ones around it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3433>
2024-07-09 18:00:58 +02:00
Florian Müllner
906920cb33 compositor: Handle skipped transition in visual bell
Implicit transitions may be skipped, for example when the actor
isn't currently mapped.

Failing to check for that case not only results in a couple of
warnings, it also means that the "flash" actor is never destroyed,
and the window remains darkened.

Close: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/7760
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3872>
2024-07-09 13:22:38 +00:00
Sebastian Wick
b56332cb24 README: Link to the bi-weekly shell+mutter meetings hedgedoc
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3740>
2024-07-05 14:11:11 +00:00
Pascal Nowack
8e9d13aa3b remote-desktop-session: Always check fd index of g_unix_fd_list_append
g_unix_fd_list_append() duplicates the provided fd. If that fails, it
returns -1 as fd index and sets - if provided - the passed GError
accordingly.
However, currently, mutter does not check the return value (the fd index
of the appended fd) and thus passes an invalid fd list via dbus to the
remote desktop session user.

Fix this error by also checking the fd index. If the fd index is invalid
(< 0), simply pass the error message of the g_unix_fd_list_append() call
to the caller.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3871>
2024-07-04 13:29:52 +02:00
Sebastian Wick
6bbb04bbf4 Revert "backend/native: Let get_seat_id() handle all modes"
This reverts commit a3082b8eb3.

We don't find the VKMS device with this commit because it is on seat0
and not on META_BACKEND_TEST_INPUT_SEAT.

The other way around, i.e. returning seat0 in all cases also doesn't
work because *something* hangs if the default seat referrs to the real
seat0 instead of the nonesense META_BACKEND_TEST_INPUT_SEAT.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3869>
2024-07-04 08:17:20 +00:00
Sebastian Wick
f767ccd7a8 tests/kvm: Create the status tempfile in the build dir
mktemp can create a tempfile relative to a directory passed in via -p.
It also uses the $TMPDIR variable for the same purpose. When the
template is specified via -t, $TMPDIR takes precedence over -p. When the
template is specified via a positional argument, -p takes precedence.

Since fec38819ac $TMPDIR is set via the
dbus runner which took precedence.

virtme-ng doesn't seem to share /tmp with the host system which results
in the exit status from the test in the VM not propagating back to the
test harness.

Fix that by making sure we always create the tempfile for the result in
the build directory.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3867>
2024-07-04 07:42:58 +00:00
Michel Dänzer
041a404ba0 wayland/actor-surface: Don't bail for Xwayland surfaces
Thawing Xwayland surfaces don't hit meta_window_actor_wayland_set_frozen,
so we need to sync actor state for them here.

v2:
* Guard META_IS_XWAYLAND_SURFACE by HAVE_XWAYLAND, fixes Wayland-only
  build.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3557
Fixes: ec5444f541 ("wayland/actor-surface: Don't sync actor state for frozen actors")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3862>
2024-07-02 19:39:27 +02:00
Michel Dänzer
92d60dbb08 backend/native: Define struct drm_plane_size_hint only if libdrm doesn't
Fixes error building against libdrm >= 2.4.122:

../src/backends/native/meta-kms-plane.c:67:8: error: redefinition of ‘struct drm_plane_size_hint’
   67 | struct drm_plane_size_hint {
      |        ^~~~~~~~~~~~~~~~~~~
In file included from /usr/local/include/libdrm/drm.h:1025,
                 from /usr/local/include/xf86drm.h:40,
                 from ../src/backends/native/meta-kms-plane-private.h:20,
                 from ../src/backends/native/meta-kms-plane.c:21:
/usr/local/include/libdrm/drm_mode.h:866:8: note: originally defined here
  866 | struct drm_plane_size_hint {
      |        ^~~~~~~~~~~~~~~~~~~

Suggested by Jonas Ådahl.

v2:
* Use has_type. (Sebastian Wick)

v3: (jadahl)
* Bump meson requirement to 1.3.0 for compiler.has_type()

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3556
Fixes: 0ca933baec ("backend/native: Adds support for SIZE_HINTS Cursor Plane Property")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3848>
2024-07-02 14:09:21 +00:00
Carlos Garnacho
a1191c405d wayland: Remove dead code
This code is called from handlers connected to signals of a
MetaWindow. It cannot happen that the window will end up NULL
in these, so exchange with a g_assert() as we in fact expect
it to be non-NULL.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3860>
2024-07-02 13:26:01 +02:00
Carlos Garnacho
949eb8b638 wayland: Use separate signal handlers to track pending activations
We cannot use a function with the same signature for signals with different
arguments, if we want to rely on the user data parameter. Separate into
two signal handlers calling the same function inside.

Fixes: b9ba34ac6f ("wayland/activation: Fix signal callback signature")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3860>
2024-07-02 13:26:01 +02:00
Florian Müllner
ddef77340e
Bump version to 47.alpha
Update NEWS.
2024-06-30 16:20:17 +02:00