1
0
Fork 0
Commit graph

32665 commits

Author SHA1 Message Date
Jonas Ådahl
6e8c7c5f84 Add experimental mode to use native scaling of Xwayland clients
Allow scale-aware Xwayland clients to scale by an integer scale
themselves, instead of letting them render them at 1x scale and then
scaling up the texture, making it look blurry.

When monitor framebuffers are scaled, this special cases Xwayland and
sends output regions in a way that Xwayland think everything is N times
as large as the logical region, where N is the ceil of the max monitor
scale.

This is done by introducing a "stage" vs "protocol" coordinate space for
X11, where the "protocol" coordinate space is "stage" multiplied by a
scaling factor.

Xwayland thus will have its own "effective scale", sent via
wl_output.scale. The effective Xwayland scale is also used for the
internal MetaWaylandSurface scale internally, unless there is a viewport
dst size set on the same surface, in which case the scale is still set
to 1, to not interfere with wp_viewport semantics.

We're guarding this behind a new experimental feature
"xwayland-native-scaling", which can only come into effect when enabled
together with "scale-monitor-framebuffer".

[v2]:

Move stage_to_protocol/protocol_to_stage to generic window class.

This means parts that aren't aware of any windowing system specific
logic, only that coordinates originate from there for a given window,
can still get their coordinates properly handled.

In particular, this means coordinates from IBus that originates from the
client, can be scaled properly when that client is using X11.

Also make them properly introspected.

[v3]:

Split up coordinate transform API.

Make it one that takes a MtkRectangle, and another that takes a point.

This means the rounding strategy becames explicit when transforming a
point, while when it's a rectangle, it's still always "grow".

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3567>
2024-08-30 20:32:01 +00:00
Jonas Ådahl
5bf9cf59aa xwayland: Introduce an 'effective scale'
This scale is currently a lie, it doesn't do anything. What it
represents is the current highest monitor scale, and will eventually be
used to, when configured to do so, scale X11 coordinates as well as
coordinates given to Xwayland.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3567>
2024-08-30 20:32:01 +00:00
Jonas Ådahl
b88482a56c monitor-manager: Add API to get layout mode
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3567>
2024-08-30 20:32:01 +00:00
Jonas Ådahl
1333d92fa5 xwayland: Set primary monitor using connector name
We know let Xwayland set the RANDR names from the connectors. To stop
relying on layouts and coordinates to match the primary logical monitor,
instead use the connector name of the first monitor.

Also make the X11 client sanity checking check that the right X11 output
is primary as part of the monitor tests.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3567>
2024-08-30 20:32:01 +00:00
Jonas Ådahl
9af1926056 test-client: Add 'assert_primary_monitor'
This is a X11 only assert, as only X11 has the concept of a primary
monitor.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3567>
2024-08-30 20:32:01 +00:00
Jonas Dreßler
e2db6c8276 Add an experimental feature for letting Xwayland clients scale natively
With the next commits we'll introduce a new mode for scaling of Xwayland apps,
we'll want to put this mode behind an experimental setting though, so add
that setting.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3567>
2024-08-30 20:32:01 +00:00
Jonas Ådahl
7635abcbf4 x11-display: Expose UI scaling factor via D-Bus
This replaces the `legacy-ui-scaling-factor` entry in
`org.gnome.Mutter.DisplayConfig`, with the motivation being to no longer
expose X11 specific state via the monitor configuration API.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3567>
2024-08-30 20:32:01 +00:00
Jonas Ådahl
2e20602fe8 test-client: Move a GdkDisplay to the toplevel scope
It's already used in a couple of places.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3567>
2024-08-30 20:32:01 +00:00
Jonas Ådahl
10913f6be3 xwayland: Remove trailing whitespace
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3567>
2024-08-30 20:32:01 +00:00
Sebastian Wick
6fa61a088f core/debug-control: Allow changing the reference luminance of outputs
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3953>
2024-08-30 20:03:43 +00:00
Sebastian Wick
9b05e39816 wayland/color-management: Let clients set the luminances
Hooks up the wayland protocol to the color state luminances. The color
state handles the default levels so we can just pass everything through
after we checked for all the error conditions.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3953>
2024-08-30 20:03:43 +00:00
Sebastian Wick
86a0797819 clutter/color-state: Match reference luminance
This uses the luminance levels of the color states to anchor the white
of content instead of hard-coding the levels.

This also starts using uniforms for parts of the mapping which means we
don't have to generate and compile a shader when the luminance levels
change.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3953>
2024-08-30 20:03:43 +00:00
Sebastian Wick
03aad0d99e clutter/color-state: Add min/max/ref luminances
They represent the minimum and maximum luminance levels of the primary
color volume and the reference luminance level (reference white, SDR
white, ...) in the reference viewing environment.

They help anchoring the white level, optionally help with preserving the
dynamic range and help with adjusting from a "dark" to a "bright"
viewing environment.

The values have defaults which depend on the transfer characteristics.

This reflects the wayland color management protocol.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3953>
2024-08-30 20:03:43 +00:00
Carlos Garnacho
fe9fff2729 clutter: Make detached actions let events through
Actions might get detached sometime during event processing,
at a time that the stage did already prepare an emission chain
holding references to the actions and actors that need to handle
events. This means actions might become detached, but still handle
the incoming event, or possible crossing events generated in-place
when the actor becomes unparented.

Avoid this situation, by skipping event handling on actions that
went detached, we will just instruct to continue event processing.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3988>
2024-08-30 17:24:24 +00:00
Daniel van Vugt
a393bd0ad6 onscreen/native: Promote "Zero-copy disabled" message to a warning
Hiding it in debug logging was a little too hidden. Someone might want
to know why performance has degraded without having to restart in debug
mode hoping they can reproduce the issue.

Also remove an assertion that would issue spurious warnings. We should not
always expect IMPORT_STATUS_NONE (implying the first failure must be on
the first frame). Instead we might start with IMPORT_STATUS_OK for a number
of frames and then have a sporadic failure some time later.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3928>
2024-08-30 13:35:42 +00:00
Daniel van Vugt
31e280c147 onscreen/native: Don't release the dumb buffers on successful zero-copy
Because a zero-copy import might fail later for driver or resource reasons.
So we may still need the dumb buffers as a fallback.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3606
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3928>
2024-08-30 13:35:42 +00:00
Daniel van Vugt
ced0d34142 onscreen/native: Set error when a fallback framebuffer is unavailable
This will prevent a spurious g_object_ref warning being followed by
a NULL dereference in `error->message`.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3928>
2024-08-30 13:35:42 +00:00
Sebastian Wick
2341346c90 wayland: Implement the color management protocol v4
To expose it, run mutter/gnome-shell with `--debug-control` and then call
`./tools/debug-control.py --enable ColorManagementProtocol`, or set
`MUTTER_DEBUG_COLOR_MANAGEMENT_PROTOCOL=1`.

Co-authored-by: Joan Torres <joan.torres@suse.com>
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3893>
2024-08-29 23:00:34 +00:00
Sebastian Wick
7e2627f5d8 wayland: Set the WaylandCompositor as wl_clients user_data
This makes it easier to get references to components in wayland
callbacks where the resource is inert and thus has a user_data of NULL.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3893>
2024-08-29 23:00:34 +00:00
Sebastian Wick
63fa79c878 wayland/surface: Add double-buffered color state
This will be used by the color management protocol to set the color
state of a surface.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3893>
2024-08-29 23:00:34 +00:00
Sebastian Wick
1b2d0a4d4a debug-control: Add property for toggling color management protocol
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3893>
2024-08-29 23:00:34 +00:00
Jonas Ådahl
fe0371641f docs/debugging: Update CI reproduction steps
No need to manually deal with pipewire or runtime directories anymore.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3987>
2024-08-29 22:04:44 +00:00
Jonas Ådahl
3248798978 ci: Rely on socket activated PipeWire
The D-Bus test environment helper now handles socket activated PipeWire,
so no need to launch it from the outside.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3986>
2024-08-29 21:23:48 +00:00
Bilal Elmoussaoui
0104fbe577 actor/x11: Remove unused shadow properties
The actor is an internal implementation detail and nothing changes
the value of those properties

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3979>
2024-08-29 18:17:19 +00:00
Bilal Elmoussaoui
3bc2ab7a6a x11/shadow-factory: Remove unused APIs
As it is a private type now, clean up unused bits

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3979>
2024-08-29 18:17:19 +00:00
Bilal Elmoussaoui
255ddae7b5 compositor: Make shadow factory types x11 specific
As they are only used there, also make their APIs private
as they are not meant to be used externally

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3979>
2024-08-29 18:17:19 +00:00
Bilal Elmoussaoui
926d041f84 compositor: Replace \r\n with \n
Zed Editor, wasn't supported editorconfig yet, causing a mess
in some of my previous commits. Fix that

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3979>
2024-08-29 18:17:19 +00:00
Bilal Elmoussaoui
43295b80aa backends/stage-impl: Drop no longer useful CoglContext check
As initializing Clutter would fail making MetaBackend to fail before creating
a MetaStage

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3977>
2024-08-29 15:26:40 +02:00
Bilal Elmoussaoui
9c7f196ef6 compositor/background: Get ClutterBackend from MetaBackend
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3977>
2024-08-29 15:26:40 +02:00
Bilal Elmoussaoui
e85d12deac compositor/window-drag: Get ClutterBackend from MetaBackend
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3977>
2024-08-29 15:26:40 +02:00
Bilal Elmoussaoui
d584a512cb clutter/stage: Get Context from actor state
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3977>
2024-08-29 15:26:40 +02:00
Bilal Elmoussaoui
b3da64c20e clutter/pick-context: Get CoglContext from actor context
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3977>
2024-08-29 15:26:40 +02:00
Bilal Elmoussaoui
617a3aa58b clutter/actor: Get Backend from associated actor context
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3977>
2024-08-29 15:26:40 +02:00
Bilal Elmoussaoui
f49a2a3370 backends/cursor-tracker: Get ClutterBackend from MetaBackend
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3977>
2024-08-29 15:26:40 +02:00
Bilal Elmoussaoui
7fca771c4e wayland/tablet-seat: Get ClutterBackend from MetaBackend
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3977>
2024-08-29 15:26:40 +02:00
Bilal Elmoussaoui
182951dea3 compositor/actor: Get ClutterBackend from MetaBackend
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3977>
2024-08-29 15:26:40 +02:00
Bilal Elmoussaoui
e3f4e735f5 backends/screencast: Get ClutterBackend from MetaBackend
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3977>
2024-08-29 15:26:40 +02:00
Bilal Elmoussaoui
10f630c4a4 wayland/input: Get ClutterBackend from MetaBackend
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3977>
2024-08-29 15:26:40 +02:00
Bilal Elmoussaoui
98c36ad1c6 input/action-mapper: Get ClutterBackend from MetaBackend
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3977>
2024-08-29 15:26:40 +02:00
Bilal Elmoussaoui
102ca86c97 wayland/text-input: Get ClutterBackend from MetaBackend
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3977>
2024-08-29 15:26:40 +02:00
Bilal Elmoussaoui
251d69f21a wayland/keyboard: Get ClutterBackend from MetaBackend
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3977>
2024-08-29 15:26:40 +02:00
Bilal Elmoussaoui
9458008863 wayland/pointer: Get ClutterBackend from MetaBackend
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3977>
2024-08-29 15:26:40 +02:00
Bilal Elmoussaoui
370e7d3157 clutter/text: Get Backend from associated actor context
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3977>
2024-08-29 15:26:40 +02:00
Bilal Elmoussaoui
3152b4a3f1 clutter/stage: Get Backend & Context from the associated actor
Had to move the state construction from init to constructed, to ensure
that the Actor's constructor has been executed and Actor.get_context
won't return NULL

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3977>
2024-08-29 15:26:40 +02:00
Bilal Elmoussaoui
62da8d7aac clutter: Get CoglContext from a CoglTexture where possible
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3977>
2024-08-29 15:26:40 +02:00
Bilal Elmoussaoui
5f5448b180 cogl/texture: Expose Texture.get_context
Would be useful for next commit

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3977>
2024-08-29 15:26:40 +02:00
Bilal Elmoussaoui
75c7ced752 clutter/text: Get CoglContext from the actor's associated Backend
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3977>
2024-08-29 15:26:39 +02:00
Bilal Elmoussaoui
bc633280d9 clutter/stage: Get Backend from stage's associated context
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3977>
2024-08-29 15:26:39 +02:00
Bilal Elmoussaoui
da625f6dad compositor/sync-ring: Pass around CoglContext
Instead of getting it from the ClutterBackend.get_default

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3977>
2024-08-29 15:26:39 +02:00
Bilal Elmoussaoui
5831a1a555 backends/x11: Get ClutterBackend from MetaBackend
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3977>
2024-08-29 15:26:39 +02:00