1
0
Fork 0
Commit graph

32212 commits

Author SHA1 Message Date
Peter Hutterer
7e7a9322fa backends: Expose the tool button mapping via InputSettings
Unlike most other schemas the path for a tool requires a bit of
processing (serial number or tablet vid/pid if there's no serial number).
Let's make the tool settings available through the MetaInputSettings
instead of having to duplicate that path composition in the caller.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3649>
2024-07-16 09:33:29 +00:00
Peter Hutterer
7ab5a8cf95 backends/native: Handle new stylus actions as zero button events
Stylus actions that don't map into LMR or back/forward are now created
as a clutter button event with a button number of zero. Nothing is
actually done with those events for now, they're just discarded later.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3649>
2024-07-16 09:33:29 +00:00
Peter Hutterer
829adfcfaa backends/native: Store the stylus actions as actions
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3649>
2024-07-16 09:33:29 +00:00
Peter Hutterer
5fdf1fa892 backends/native: Apply stylus button mappings before anything else
For stylus buttons we apply a button mapping, e.g. secondary button ->
right. This mapping was previously applied to the clutter event's evdev
code only, not the actual clutter button. As a result, gnome-shell would
always treat the BTN_STYLUS as middle and BTN_STYLUS2 as right,
regardless of the mapping.

Move the mapping up so we first adjust our evcode, then proceed with
the usual mappings.

Note that this temporary breaks the stylus mapping to Back/Forward which
will be fixed in a follow-up commit.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3649>
2024-07-16 09:33:29 +00:00
Peter Hutterer
ae59acad76 backends/native: Use helper functions to map buttons
Use the helper function for mapping a stylus tool evdev code to a
clutter button code. This fixes a (theoretical) issue - if a tool were
to send any button other than the one we handled those would likely be
BTN_SIDE and friends and we'd likely end up with negative button
numbers. The BTN_TOOL_PEN range is not predicable enough to do any sort
of calculation conversion because things like BTN_TOOL_DOUBLETAP have
specific meanings that aren't actually buttons.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3649>
2024-07-16 09:33:29 +00:00
Peter Hutterer
dfcb160321 backends: Add helpers to convert from clutter tool button to evcode
This complements the existing clutter->evdev and evdev->clutter helpers,
but this time for buttons we expect from a stylus tool. We also need to
convert left/middle/right for the Wacom puck/lens cursor tools but that
particular conversion is lossy.

Note that these are more restrictive than the normal codes - if we
get "other" buttons from a stylus we don't really know what they could
possibly map to. So we safely map what looks like buttons from a mouse
but otherwise complain and return zero.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3649>
2024-07-16 09:33:29 +00:00
Peter Hutterer
6c77af1493 core: Add a MetaTabletActionMapper as parent of the MetaPadActionMapper
This is prep work for using the same functionality for tablet tools as
well. The new MetaTabletActionMapper takes care of the event bubbling
via the device-added/removed and input-event signals and provides the
helper functions to cycle outputs and/or emulate keybindings.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3649>
2024-07-16 09:33:29 +00:00
Peter Hutterer
94e497f630 CI: Bump the tag so we pick up libinput 1.26
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3649>
2024-07-16 09:33:29 +00:00
Sebastian Keller
31e027d1b1 edid: Ensure strings owned by MetaEdidInfo are freed
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3888>
2024-07-16 03:37:02 +02:00
Sebastian Keller
a541aa9a8c edid: Fix di_info leak after we are done parsing
This was only affecting builds using libdisplay-info.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3888>
2024-07-15 23:52:31 +02:00
Bilal Elmoussaoui
9239e8446c cogl: Remove _real suffix from Node parenting API
There is no vfunc to override anymore as it used to only chain-up

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3885>
2024-07-15 21:42:44 +02:00
Bilal Elmoussaoui
f5c376e860 cogl: Move PrimitiveTexture functions to Texture
Since the move to GObject for CoglTexture, CoglPrimitiveTexture was
removed. So drop remaining of that.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3885>
2024-07-15 21:42:38 +02:00
Sebastian Keller
2ae3012fd5 clutter/paint-nodes: Don't leak CoglColor on paint node creation
The pointer returned by cogl_color_copy() was not stored anywhere and
the allocation it was pointing to got leaked. However we also don't need
to use that function here and can just copy the struct values directly.

Fixes: dc52ccc75 ("cleanup: Port from ClutterColor to CoglColor")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3884>
2024-07-15 18:50:02 +02:00
Bilal Elmoussaoui
1d465461a7 cogl: Remove default context gross hack
As nothing uses it anymore

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3857>
2024-07-15 14:39:23 +00:00
Bilal Elmoussaoui
c23bc80ba4 cogl/debug: Take a context param
This will make the usage through gdb not as useful as it was
but it is the last remaining usage of a gross hack, so let us get rid of it

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3857>
2024-07-15 14:39:23 +00:00
Bilal Elmoussaoui
c1733e8d7c cogl: Keep a backpointer to context/display
Allows to retrieve the context from the renderer, allows
to get rid of one GET_CONTEXT usages

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3857>
2024-07-15 14:39:23 +00:00
Bilal Elmoussaoui
725e826a39 cogl: Require a Renderer/Display when initializing
The whole fallbacks all over the place were only useful when Cogl was a separate
library

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3857>
2024-07-15 14:39:23 +00:00
Bilal Elmoussaoui
54748b7f1f cogl: Call init when creating a context from Clutter
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3857>
2024-07-15 14:39:23 +00:00
Bilal Elmoussaoui
9ee1a0fc34 cogl: Expose Renderer.get_proc_address
Allows to get rid of the cogl_get_proc_address

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3857>
2024-07-15 14:39:23 +00:00
Bilal Elmoussaoui
b3ae934304 cogl: Pass Context to cogl_flush
Avoids using the global variable & also move the function to
it proper context

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3857>
2024-07-15 14:39:23 +00:00
Bilal Elmoussaoui
194fa80cdd cogl: Pass a Context param to winsys_has_feature
Avoids using the global variable

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3857>
2024-07-15 14:39:23 +00:00
Bilal Elmoussaoui
3fd7cdba09 cogl: Pass Context where possible
Avoids using the macro & global variable

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3857>
2024-07-15 14:39:23 +00:00
Bilal Elmoussaoui
24f46448ce cogl/pango: Take a context as a param when constructing a font map
Avoids using the get_context macro

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3857>
2024-07-15 14:39:23 +00:00
Martin Abente Lahaye
1b5766b5a1 ci: Sync install-meson-project.sh with its gnome-shell version
This is not strictly needed as the copy in mutter is always run as
root, but make sense to sync both just for consistency.

See bdbad8ca85

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3883>
2024-07-13 12:49:50 -04:00
Martin Abente Lahaye
9e39175df5 ci: Build and publish system extensions
Use gnomeos-build-sysext CI/CD component to build a system
extension out of mutter branches and MRs.

Use the common script for installing dependencies, but keep
a separate gnomeos script for exclusive dependencies.

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 15:02:42 -04:00
Martin Abente Lahaye
0d647bb1d6 ci: Move installation of common dependencies to a separate script
Since we would be building custom images and system extensions, having
a centralize script has the following advantages:

1. Provides a single place to add/bump dependencies.
2. Allows us to automatically stop building dependencies for
   GNOME OS that has been updated to a recent-enough version.

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 15:02:42 -04:00
Martin Abente Lahaye
8aeb6dc864 ci: Support additional destdir in install-meson-project.sh
To build a system extension we need to:

1. Add dependencies to the container (to build it), and also
2. Add dependencies to the extension (to run it, later).

So there's effectively two locations where we need to install
those dependencies.

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:37:34 -04:00
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