1
0
Fork 0
Commit graph

32680 commits

Author SHA1 Message Date
Jonas Dreßler
bbb34c2a80 monitor-config-store: Detect unkown layout modes based on the configuration
When there is no layout mode set in a logical monitor config, we currently just
assume the configuration matches the mode that the system expects. This blows
up when the layout mode expected by the system changes (eg. by turning on
"scale-monitor-framebuffers" in mutter): Suddenly configs fail the validation
check and get thrown away.

Since we now can add one configuration for each layout mode to the config store,
we can do better here: Let's only add configurations to the store where we
verified beforehand that the monitor layout is compatible with that mode, either
because we set it ourselves using the <layout_mode> key, or by detecting which
modes the layout is compatible with.

Also update monitor config ifiles to adjust for the new layout_mode, as
they all are assumed to be "logical".

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3596>
2024-08-14 13:07:47 +00:00
Jonas Dreßler
becee89fb9 monitor-config-manager: Verify more things about logical monitor configs
Verify even more assumptions we make about logical monitor configs:

- Have a more explicit check that the monitor modes in the logical monitor are
all equal

- Complain if scale factor with physical layout mode is fractional

- Make sure that scale factor with logical layout mode actually scales to a
non-fractional width and height

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3596>
2024-08-14 13:07:47 +00:00
Jonas Dreßler
a203020c4b monitor-config-manager: Move some things into common file for config utils
We'll need a few of those things from the monitor config store soon, also it's
generally useful to have a prefix which makes it clear where functions are
defined.

So factor some things out into a new monitor-config-utils.c file.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3596>
2024-08-14 13:07:47 +00:00
Jonas Dreßler
076b3664a3 monitor-config-store: Store and load layout mode for each configuration
Store and load the layout mode for each logical monitor configuration in
monitors.xml by introducing a new <layoutmode> element. The value of the
element can be either "logical" or "physical". The layout mode is also
made part of the monitor configuration key.

Right now this isn't doing a lot:

When no <layoutmode> is found on the config (this is the case with all
existing configs), we'll keep using the layout mode expected by the system,
without updating the config file.

When changing an existing, or introducing a new configuration, we'll now
store the current layout mode with the config though, and load it again
on the next start of mutter. This is still not problematic as long as
mutters expected layout mode doesn't change (eg. by turning on/off
"scale-monitor-framebuffers").

When the expected layout mode of mutter switches between
restarts, the monitor config is now still loaded but remains unused,
and mutter will create (and store) a new one with the other layout mode.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3596>
2024-08-14 13:07:47 +00:00
Jonas Dreßler
de56634fd0 Remove monitor migration support from v1 monitors.xml format
We'll introduce some new migration code with the next few commits to introduce
a layout_mode property in monitors.xml. This will be significantly easier
without keeping around the old monitor migration code, so drop it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3596>
2024-08-14 13:07:47 +00:00
Jonas Dreßler
4105827254 monitor-config-manager: Do more verification of logical monitor configs
We have meta_verify_logical_monitor_config() already, and it does a few checks that
meta_verify_monitors_config() doesn't do yet, so let's also call
meta_verify_logical_monitor_config() when verifying the whole config.

We'll rely on this being part of meta_verify_monitors_config() soon, because we'll
stop calling meta_verify_logical_monitor_config() from the config parser.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3596>
2024-08-14 13:07:47 +00:00
Jonas Dreßler
72b324d686 monitor-config-manager: Verify the whole monitor layout is connected
We forgot to check whether multiple groups of monitors are actually
all connected with each other, so fix that.

[jadahl: Rewrote algorithm to detect split groups]
[jadahl: Added test case]

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3596>
2024-08-14 13:07:47 +00:00
Sebastian Wick
ce5f97fde1 cogl/gles: Explain GLES2 requirement of matching internalformat & format
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3914>
2024-08-14 12:17:18 +00:00
Sebastian Wick
c3eb01e547 cogl/gles: Use the GL_BGRA8_EXT internalformat instead of the format
There is one define for the format (GL_BGRA_EXT) and one for the
internal format (GL_BGRA8_EXT). Use them appropriately.

This also adds defines to consistenly not use the _EXT postfix.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3914>
2024-08-14 12:17:18 +00:00
Sebastian Wick
d820fe030a cogl/gles: Use a premul required format for opaque fp16 Cogl formats
The opaque fp16 Cogl format variants need a required format that is
already premultiplied whereas the fp16 formats with an alpha channel can
be either straight or premult.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3914>
2024-08-14 12:17:18 +00:00
Sebastian Wick
41700d3cc7 cogl/gl: Use internal formats without alpha for non-alpha Cogl formats
The formats COGL_PIXEL_FORMAT_RGB_888 and COGL_PIXEL_FORMAT_BGR_888 for
the gl driver were using internal formats with an alpha channel.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3914>
2024-08-14 12:17:18 +00:00
Carlos Garnacho
2e82a2049f wayland: Register touchpoint info on CLUTTER_ENTER
The first event happening for a new touch will be the CLUTTER_ENTER
event generated when picking it. Use this event for registration of
the touch info, so that MetaWaylandEventHandler.get_focus_surface may
get the right focus surface for the device/sequence on the first try.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3889>
2024-08-14 11:47:01 +02:00
Carlos Garnacho
77b21ef8dc wayland: Only cancel touch when a new event handler takes over
And notably, don't cancel touch when an event handler is being
removed. Touch events are largely unaffected by most Wayland
grabs (pointer constraints, popups), so we might be cancelling
input too early if one of these wayland grabs was effective when
touch interaction began, but stopped sometime between touch updates.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3889>
2024-08-14 11:47:01 +02:00
Carlos Garnacho
08c903a359 wayland: Ignore touch events in seat default focus handler
Touch events are implicitly grabbed to the surface they began in,
and are not affected by the focus handler. However these events
will appear to come from the core pointer device, which might lead
to the wrong device being updated.

Ignore events with a sequence, since the default focus handler
does not intend to do anything with them.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3889>
2024-08-14 11:46:55 +02:00
Daniel van Vugt
c436e7cb17 kms/impl-device: Add/remove deadline timer as required
On a hybrid machine with i915 primary and nvidia-drm (470) secondary,
`meta_render_device_egl_stream_initable_init` calls
`meta_kms_inhibit_kernel_thread` to change from the default 'kernel'
thread type to 'user'. And soon after that it would
`meta_render_device_egl_stream_finalize` because I'm not actually
using that GPU, and calls `meta_kms_uninhibit_kernel_thread`.

So during startup Mutter would default to a realtime kernel thread,
switch to a user thread (which doesn't support realtime), and then
switch back to a realtime kernel thread.

In the middle of all that, while the thread type was 'user' and
realtime disabled, something was invoking `ensure_crtc_frame` which
created a `CrtcFrame` without a deadline timer. Soon after that the
thread type changed back to 'kernel' with deadline timers expected, but
our existing `CrtcFrame` has no deadline timer associated with it. And
so it would never fire, causing the cursor to freeze whenever the primary
plane isn't changing. And the problem was permanent, not just the first
frame because each `CrtcFrame` gets repeatedly reused (maybe shouldn't
be called a "Frame"?).

Now we adapt to switching between kernel and user thread types by adding
and removing the deadline timer as required.

Close: https://gitlab.gnome.org/GNOME/mutter/-/issues/3464
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3950>
2024-08-14 15:50:48 +08:00
Sebastian Wick
82fa9e676a color-device: Don't create colord profiles for virtual monitors
Colord is a system service which will result in a polkit dialog showing
up when connecting a remote session.

We want to get rid of colord eventually anyway, so disconnecting virtual
monitors from colord isn't an issue.

Fixes: f5ce2ddf3c ("color-manager: Create color devices also for virtual monitors")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3942>
2024-08-13 22:10:03 +00:00
Robert Mader
bb55a1e83a compositor-view/native: Add debug flag to force-disable direct scanout
In order to make it easier to test composited paths.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3949>
2024-08-13 21:09:50 +02:00
Bilal Elmoussaoui
4ea693bc20 surface-actor: Pass damage area as MtkRectangle
All the corresponding calls ends up creating a rectangle anyways

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3945>
2024-08-13 14:08:48 +02:00
Bilal Elmoussaoui
cbe88c8e71 surface-actor: Replace \r\n with \n
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3945>
2024-08-13 14:08:48 +02:00
Jonas Ådahl
8e2587c197 kms: Don't disarm deadline timer when compositing
If we finish compositing in time, the composited result will be
submitted prior to the deadline timer is triggered, and we'll be fine,
and if not, at least the cursor updates will be smooth, which makes it
appear smoother than not.

There is a risk that this can negatively impact composited updates when
moving the cursor, so make it possible to toggle a paint-debug flag for
now until this has been more tested.

This also mean we need to disarm the deadline timer after handling
update, as there might be a scheduled cursor update pending, but we
already handled it, so disarm the timer.

Here is an illustration of the difference.

In the following scenario, with disarming, the composited frame E, and
the cursor movement C gets presented. With this branch, only the cursor
movement C gets presented.
```
 * A: beginning of composited frame
 * B: begin notification reaches KMS thread
 * C: cursor moved
 * D: calculated deadline dispatch time (disabled with the branch)
 * E: KMS update posted
 * F: KMS update reaches KMS thread
 * G: actual deadline (and with branch and gets committed)
Compositor thread: --------A---------------E---------
                            \               \
                             \               \
KMS thread:        -----------B------C----D---F-G----
```

In the following scenario, by not disarming, the cursor update C will be
presented, and the would-be-delayed composited frame E would be delayed
anyway, i.e. fixing cursor stutter.
```
 * A: beginning of composited frame
 * B: begin notification reaches KMS thread
 * C: cursor moved
 * D: calculated deadline dispatch time (and with branch will be dispatched)
 * E: KMS update posted
 * F: actual deadline
 * G: KMS update reaches KMS thread (and with branch gets postponed)
Compositor thread: --------A---------------E---------
                            \               \
                             \               \
KMS thread:        -----------B------C----D-F-G------
```

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3184>
2024-08-13 10:09:05 +00:00
Jonas Ådahl
6ec1312384 renderer-view/native: Update deadline evasion each frame
The deadline evasion depends on debug flags, but they are not trackable,
so update the deadline evasion each time we schedule an update.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3184>
2024-08-13 10:09:05 +00:00
Jonas Ådahl
5da94d2c1d clutter/frame-clock: Take deadline evasion into account
This is meant to be the amount of time before a CRTC deadline we're
usually dispatching at. It's not yet set by anything however.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3184>
2024-08-13 10:09:04 +00:00
Michel Dänzer
61ae9eedb6 cogl: Update latest sync fd also from cogl_gl_framebuffer_flush/finish
This ensures that any drawing for screen casting is reflected in the
sync fd.

Fixes: 99209958b9 ("cogl: Store latest GPU work completed sync fd")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3946>
2024-08-13 09:52:34 +00:00
Sophie Herold
f2642dbc31 doap: Remove marge-bot maintainer entry
marge-bot has had GNOME wide Developer access for a while, which should be sufficient.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3940>
2024-08-13 08:48:28 +00:00
Daniel van Vugt
4c91616ff2 kms/update: Don't count trivial custom page flips as empty updates
This includes most frames when using EGL_DEVICE.

While it would be nice to skip all update processing in this case,
we can't go quite that far because EGL_DEVICE is still waiting on
page flip callbacks.

Fixes: 27ed069766 ("kms/impl-device: Add deadline based KMS commit scheduling")
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3196
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3939>
2024-08-13 13:55:52 +08:00
Daniel van Vugt
cfb2100d40 onscreen/native: Associate the kms_crtc with EGL_DEVICE updates
Although we track updates for EGL_DEVICE, they are often empty because
the primary plane has a custom page flip method. That means there's
no CRTC latched yet, but we do know exactly which CRTC is associated
with the flip. Set it so the update can still be processed.

Fixes: 27ed069766 ("kms/impl-device: Add deadline based KMS commit scheduling")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3939>
2024-08-13 13:53:17 +08:00
Carlos Garnacho
c179bebb70 wayland: Bypass popup grab focus if other handlers are in effect
If other handlers (e.g. DnD) are on top of the popup grab focus, we
may want it to move outside same-client surfaces as the popup grab
specifies.

Check that it is the current handler before making same-client checks,
so that these handlers on top have an opportunity to find other
surfaces, e.g. during DnD from a popup.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1681
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3937>
2024-08-12 13:50:24 +00:00
Carlos Garnacho
22362378ea wayland: Track pressed mouse buttons for popup grabs through modifiers
Move away from tracking presses/releases directly, since there might be
other event handlers on top that might prevent the popup event handler
to fully track all events. The replacement is using event state modifiers,
which will use information set from the backend, and is enough to determine
there's no more pressed buttons without tracking prior event history.

This makes the popup event handler able to interact with other event
handlers that might be on top, and consume button release events for
themselves (e.g. DnD), no longer resulting in a stuck popup grab.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3937>
2024-08-12 13:50:24 +00:00
José Expósito
115b2c1247 wayland/drm-lease: Make MetaDrmLeaseManager::connectors a GList
The relationship between MetaKmsConnector and MetaDrmLease is already
stored in MetaDrmLeaseManager::leased_connectors.

Change the type of MetaDrmLeaseManager::connectors to a GList.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3922>
2024-08-12 10:25:36 +00:00
José Expósito
fc44437876 wayland/drm-lease: Withdrawn leased connectors
As in the protocol definition for wp_drm_lease_connector_v1::withdrawn:

    Sent to indicate that the compositor will no longer honor requests
    for DRM leases which include this connector. [...] Compositors are
    encouraged to send this event when [...] the connector gets leased
    to a client.

Withdrawn the leased connectors and, if they are available once the
lease finishes, advertise them again.

Related to: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/322/

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3922>
2024-08-12 10:25:36 +00:00
José Expósito
fc8b28a2bd wayland/drm-lease: Remove unused function
The meta_drm_lease_manager_get_connector_from_id() function is not used
and a future commit would need to change it.
Remove the unused code instead.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3922>
2024-08-12 10:25:36 +00:00
José Expósito
5cd15d8aaf wayland/drm-lease: Reset reused variable in loop
The `lease` variable is reused in a loop and might contain values from
previous loop iterations.

Fixes: 4a5fcef38d ("native/kms-lease: Implement leasing out a set of connectors")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3922>
2024-08-12 10:25:36 +00:00
Daniel Șerbănescu
5bce390fe8 Update Romanian translation
(cherry picked from commit dec5ffdadf)
2024-08-11 11:28:52 +00:00
Sebastian Wick
608d66afa5 renderer-view: Set ClutterColorStates from a MetaColorDevice
And stop passing in the color states from the RendererNative. We also
keep the color states updated by listening for changes in the color
device.

The RendererX11Cm has a single view and no mapping to a specific color
device, so we handle the absense of a color device as well and rely on
ClutterStageView to have the default color states.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3930>
2024-08-09 15:51:36 +00:00
Sebastian Wick
5b44d589b1 clutter/stage-view: Move offscreen creation functions around
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3930>
2024-08-09 15:51:36 +00:00
Sebastian Wick
a91fd4a72c clutter/stage-view: Move offscreen creation from renderer to view
This allows us to destroy and create a new offscreen dynamically, when
the rotation or color state changes.

An idle gsource with priority higher than CLUTTER_PRIORITY_REDRAW is
used to ensure the an offscreen exists when required without having to
allocate in the redraw process.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3930>
2024-08-09 15:51:36 +00:00
Sebastian Wick
6a1749009f clutter/stage-view: Pass the format when creating offscreens
Also use g_autoptr to make the code easier.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3930>
2024-08-09 15:51:36 +00:00
Sebastian Wick
163efa620b clutter/stage-view: Ensure we have view and output ColorStates
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3930>
2024-08-09 15:51:36 +00:00
Sebastian Wick
d8ecd07f9f clutter/color-state: Allow comparing NULL color states
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3930>
2024-08-09 15:51:36 +00:00
Sebastian Wick
0ed160bc5a stage-view: Move transform from MetaRenderereView to ClutterStageView
This is possible because MonitorTransform is a Mtk type now. It will
allow us to create the offscreens in ClutterStageView.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3930>
2024-08-09 15:51:36 +00:00
Sebastian Wick
243140069c renderer-native: Get the color state for the view from the MetaColorDevice
The color state will eventually not be derivable just from the monitor
configuration alone but the color device will be able to track all of
this.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3930>
2024-08-09 15:51:36 +00:00
Sebastian Wick
ccede14a09 renderer: Pass through the monitor to the create_view vfunc
We will want to use the monitor in a later commit and going there from a
logical monitor or output is ambiguous.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3930>
2024-08-09 15:51:36 +00:00
Sebastian Wick
af83233be3 wayland/outputs: Return a monitor instead of a logical monitor
Going from the monitor to a logical monitor is possible but going from a
logical monitor to a monitor is ambiguous.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3930>
2024-08-09 15:51:36 +00:00
Sebastian Wick
dcaa57c2c8 mtk: Move meta_rectangle_transform to Mtk
Both MtkMonitorTransform and MtkRectangle are Mtk types, so we can push
this into Mtk and start using it in Clutter as well.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3930>
2024-08-09 15:51:36 +00:00
Sebastian Wick
89af55d8aa mtk: Move MetaMonitorTransform to Mtk
This makes it possible to use MtkMonitorTransform in Clutter which will
be used to track the transform in ClutterStageView.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3930>
2024-08-09 15:51:36 +00:00
Sebastian Wick
54b2abfe1b backends: Move monitor_transform_from_orientation to orientation manager
This removes the dependency on MetaOrientation from MetaMonitorTransform
which makes it possible to move MetaMonitorTransform to Mtk.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3930>
2024-08-09 15:51:36 +00:00
Sebastian Wick
f88b54502c ci: Downgrade libX11 to avoid a bug in teardown
Xlib would always report the error

  XIO:  fatal IO error 9 (Bad file descriptor) on X server ":102"

when mutter is tearing down. This behavior changed somewhere between
version 1.8.7 to 1.8.10 and is tracked at
https://gitlab.freedesktop.org/xorg/lib/libx11/-/merge_requests/264.

Until we have a fixed libX11, we downgrade it to a known-good version.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3918>
2024-08-09 08:29:21 +00:00
Sebastian Wick
adf28cad71 tests/x11: Get the right mutter pid and be more verbose
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3918>
2024-08-09 08:29:21 +00:00
Florian Müllner
52a5984c45 build: Bump gsettings-desktop-schemas requirement
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3794
depends on the just released 47.beta gds version.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3918>
2024-08-09 08:29:21 +00:00
Florian Müllner
97978962fb ci: Bump image
Let's pull in gsettings-desktop-schemas 47.beta, so we can
bump the requirement.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3918>
2024-08-09 08:29:21 +00:00