1
0
Fork 0
Commit graph

31385 commits

Author SHA1 Message Date
Dor Askayo
0eaf4b4f4c Revert "frame/native: Remember whether the frame carried a kms update"
This reverts commit 020d128d15.

This API is no longer used and can be removed.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3549>
2024-01-26 22:23:05 +00:00
Dor Askayo
b8deb4caa0 wayland: Emit frame callbacks when the frame is pending presentation
When Wayland clients send commits without a buffer attached ("empty"
commits), they may lead to stage updates that do not result in any
frame being submitted for presentation ("empty" updates).

Due to how frame scheduling is handled, there can be many such
"empty" updates in a single refresh cycle. If frame callbacks were
emitted after each of these "empty" updates, and if the client
sending "empty" commits was using frame callbacks to throttle the
same logic that results in these "empty" commits being sent, it would
result in a feedback loop between Mutter and the client where the
client would send "empty" commits and Mutter would reply almost
immediately with a frame callback causing the client to send "empty"
commits continuously.

As such, when an "empty" update is detected, frame callbacks are
scheduled to be emitted only once in every refresh cycle, avoiding the
feedback loop.

When a "non-empty" update is detected, frame callbacks are instead
emitted immediately to allow clients to draw their next frame as soon
as possible. It is safe to emit frame callbacks in this case because
the frame for the current refresh cycle is already "finalized" and
that any commit sent by the client at that point would only be handled
in a future refresh cycle.

To implement this, the previous logic had used
meta_frame_native_had_kms_update() to detect "non-empty" updates,
assuming that those would always result in a KMS presentation with the
native backend.

However, this approach misses the fact that virtual monitors do not
use KMS, and as such do not result in KMS presentation even for
"non-empty" updates. As a result, frame callbacks would not be emitted
immediately, resulting in unintended throttling of client rendering.

Instead, assume that it is safe to emit frame callbacks immediately
whenever an update results in the frame clock waiting to be notified
of presentation, since this is also when commits sent by clients are
scheduled to be handled in a future refresh cycle.

This issue was mostly hidden because frame callbacks would be sent
immediately when the target presentation time for the frame had
changed compared to the previous frame. However, this behavior was
removed in 26d8b9c69 ("wayland: Remove unnecessary dispatch of frame
callback source"), exposing the issue.

Fixes: a7a7933e0 ("wayland: Emit frame events in GSource after "empty" updates")
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3263
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3549>
2024-01-26 22:22:52 +00:00
Dor Askayo
c9cd9cef6a clutter/frame: Export clutter_frame_get_result()
This makes the function available to Wayland.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3549>
2024-01-26 19:03:02 +00:00
Sabri Ünal
79b998c681 Update Turkish translation 2024-01-25 15:00:31 +00:00
Fran Dieguez
a512682b0e Update Galician translation 2024-01-24 08:36:08 +00:00
Dor Askayo
3e4a330ae7 clutter/frame-clock,wayland: Calculate frame deadline during scheduling
Calculate the frame deadline in ClutterFrameClock's
calculate_next_update_time_us() rather than in MetaWaylandCompositor's
on_after_update().

The specifics of the deadline calculation for a given frame should be
implementation detail of the frame clock and and remain internal to
allow extensibility.

This extensibility is specifically useful for scenarios where a
different deadline calculation is needed due to alternative frame
scheduling logic, such as for VRR.

No change in behavior.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3521>
2024-01-22 15:39:48 +00:00
Dor Askayo
d5c2f20d55 wayland: Flatten logic in on_after_update()
Slightly improves the cognitive complexity of the function.

No change in behavior.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3521>
2024-01-22 15:39:48 +00:00
Dor Askayo
26d8b9c69b wayland: Remove unnecessary dispatch of frame callback source
To avoid communicating lower frame rate to clients through frame
callbacks, it is important to avoid delaying the source dispatch when
a dispatch is already scheduled.

To that end, the previous logic would emit pending frame callbacks
immediately in case a source dispatch was still scheduled for the
previous refresh cycle and then (potentially) schedule another source
dispatch for the current refresh cycle.

However, emitting pending frame callbacks immediately would send
frame events for every pending frame callback, including for the
current "empty" update. Scheduling another source dispatch for the
current cycle was then unnecessary and potentially undesirable
because there may not even be another "empty" update during the cycle.

Instead, let the already-scheduled source dispatch handle emitting any
pending frame callbacks, and do not schedule an additional source
dispatch for the current cycle as it may not be needed.

This approach is useful because it removes an implicit assumption
that the refresh rate is fixed and that target presentation time
remains constant within a refresh cycle. This assumption does not
apply for VRR.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3521>
2024-01-22 15:39:48 +00:00
Dor Askayo
8c88dbfbe8 wayland: Rename source_ready_time_us to frame_deadline_us
The value of this variable represents the last point in time in
which an update would be allowed to scheduled for the given frame.

Rename it for clarity and in preparation for the next commits.

No change in behavior.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3521>
2024-01-22 15:39:48 +00:00
Dor Askayo
83713a38bb wayland: Remove unreachable condition
The value returned from clutter_frame_get_target_presentation_time()
is always same as the value returned from
clutter_frame_get_min_render_time_allowed() when they are called
consecutively because both functions effectively return the value of
frame->has_target_presentation_time. This is with the assumption
that this variable is only ever modified by the same thread that
also executes on_after_update().

As such, a case where the former returns FALSE after the latter
returned TRUE is not possible, which means the line that sets
"target_presentation_time_us = 0;" is effectively unreachable.

Acknowledging this fact allows the call to
clutter_frame_get_target_presentation_time() to be moved outside the
"else" case and into the "if" condition itself. This is done in
preparation for the next commits.

No change in behavior.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3521>
2024-01-22 15:39:48 +00:00
Bilal Elmoussaoui
a2397e6b80 clutter: Prefer using ClutterTextDirection
In various public APIs, Clutter used to return a PangoDirection
while we have a text direction enum defined in Clutter.

This allows us to drop pango dependency from meta making it specific
to cogl-pango & clutter

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3531>
2024-01-22 15:02:33 +00:00
Robert Mader
c19eef3f5e wayland/dmabuf: Bump protocol version to 5
It adds the following clarification:
```
Starting from version 5, the invalid_format protocol error is sent if
all planes don't use the same modifier.
```

We already send an error, just the wrong one.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3450>
2024-01-22 14:20:30 +00:00
Robert Mader
8b1015a5c7 wayland: Switch to stable linux-dmabuf protocol
It is the first protocol to keep the `-vN-` despite being declared
stable.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3450>
2024-01-22 14:20:30 +00:00
Robert Mader
69446e1fb2 meson: Bump wayland-protocols requirement to 1.33
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3450>
2024-01-22 14:20:30 +00:00
Daniel Rusek
98ec6e66f5 Update Czech translation 2024-01-22 00:42:27 +00:00
Artur S0
8e5a2b2f59 Update Russian translation 2024-01-20 19:00:13 +00:00
Dor Askayo
5e13c1dca6 kms/impl-device: Inhibit the deadline timer on permission errors
Set the deadline timer state as "inhibited" in case a permission error
is returned while attempting to arm the deadline timer. This makes each
device enable its deadline timer again after a VT switch.

Also print a note in this case instead of a warning as such errors are
expected during a VT switch and should not raise concerns.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3259
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3534>
2024-01-19 18:46:41 +00:00
Dor Askayo
79063604ad kms: Resume all devices when KMS is resumed
KMS is resumed when the current VT becomes active.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3534>
2024-01-19 18:46:41 +00:00
Dor Askayo
9eb38b4107 kms/impl-device: Add function to resume all devices
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3534>
2024-01-19 18:46:41 +00:00
Dor Askayo
ada4ac49fb kms/impl-device: Add function to handle device resumption
For now, this function only enables the deadline timer in case it was
inhibited. This would result in an attempt to use the deadline timer
again after a device is resumed.

If the conditions that resulted in the timer becoming inhibited
remain, it is expected to return to this state after the next frame
and before being armed.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3534>
2024-01-19 18:46:41 +00:00
Dor Askayo
98cdafdf0b kms/impl-device: Use enum for deadline timer state
The "disabled" state indicates that the deadline timer is disabled
for the lifetime of the device, while the "inhibited" state indicates
that it is disabled temporarily for the device.

This distinction is needed to handle each state differently in a
following commit. For now, only "disabled" is used.

No change in behavior.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3534>
2024-01-19 18:46:41 +00:00
Leorize
8e39398d05 backends: Allow XKB model to be configured
This allows GNOME Shell to communicate the user desired XKB model
to the compositor instead of sticking with the pc105 default.

Particularly useful for those with a custom keyboard layout/irregular
keyboards.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2760>
2024-01-18 18:51:42 +00:00
Florian Müllner
1ab4faaf18 place: Fix centering transients over parent
Transient dialogs are meant to be placed centered over their
parent. However as we don't use the DIALOG window type on
wayland, this currently only works for modal dialogs.

To fix this, also apply the policy to NORMAL windows for
wayland clients.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3533>
2024-01-18 16:07:15 +00:00
Kai-Heng Feng
8e58aa46ac gen_default_modes: Consider reduced blanking with lower pixelclock
Some panels only support fixed resolutions and fixed refresh rate with reduced blanking:
  Established Timings I & II: none
  Standard Timings: none
  Detailed Timing Descriptors:
    DTD 1:  2560x1600  120.001823 Hz   8:5    203.283 kHz    552.930000 MHz (345 mm x 215 mm)
                 Hfront   48 Hsync  32 Hback   80 Hpol P
                 Vfront    3 Vsync   6 Vback   85 Vpol N
    DTD 2:  2560x1600   48.000295 Hz   8:5     81.312 kHz    221.170000 MHz (345 mm x 215 mm)
                 Hfront   48 Hsync  32 Hback   80 Hpol P
                 Vfront    3 Vsync   6 Vback   85 Vpol N
...
    Minimum Pixel Clock: 552922 kHz
    Maximum Pixel Clock: 552922 kHz

When using mirror mode, resolutions like 2560x1440 120Hz can be too high
to meet the pixelclock limitation, so 2560x1440 90Hz is selected
instead. However, the panel only supports 120Hz so using 90Hz result to
failed mode set.

So add reduced blanking to fallback mode, so correct refresh rate can be
used.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3449>
2024-01-18 12:12:06 +08:00
Shmuel Melamud
237e505cc7 clutter: Move ClutterCanvas to gnome-shell
Since StDrawingArea in gnome-shell is the only user of ClutterCanvas,
it is possible to move ClutterCanvas completely out of Mutter to
gnome-shell. This allows to remove another Cairo dependency from
Mutter.

This patch removes ClutterCanvas code from Mutter.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3470>
2024-01-17 11:58:47 +01:00
Sebastian Wick
41a7e8e3e0 build: Make g-ir-scanner warnings fatal when -werror is set
This should help catching problems with introspection in CI.

This also pulls out some common arguments to the gnome.generate_gir
call.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3528>
2024-01-17 09:26:00 +00:00
Daniel van Vugt
e8116ba4f0 clutter/actor: Double asterisk is required for GObject Introspection
Like GtkDoc and Doxygen before it.

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

Fixes: f4c6fa949d
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3527>
2024-01-17 15:04:48 +08:00
Daniel van Vugt
7551ffa81e clutter/actor: Remove whitespace at end of line
It's upsetting check-code-style

Fixes: 00b4d4c4bc
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3527>
2024-01-17 15:04:48 +08:00
Florian Müllner
65d4815942 doc: Update link to commit message guidelines
Replace the wiki page with the corresponding section in
the GNOME handbook.

Death to the wiki!

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3526>
2024-01-16 09:37:21 +00:00
Sebastian Wick
db492fe335 cogl: Use COGL_ENABLE_DEBUG instead of COGL_DEBUG_ENABLED
COGL_DEBUG_ENABLED is a macro to check if a debug flag is set.
COGL_ENABLE_DEBUG is set by the build system if it's a debug build. The
check `#ifdef COGL_DEBUG_ENABLED` always evaluates to true. Use the
appropriate macro to guard some debugging code.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3446>
2024-01-15 22:28:54 +00:00
Sebastian Wick
6749151ac9 cogl/pipeline: Use the pipeline context instead of the default context
In practise they are the same right now but this prepares CoglPipeline
for a future where we have multiple contexts.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3446>
2024-01-15 22:28:54 +00:00
Sebastian Wick
a9944b27aa cogl/pipeline: Refactor pipeline initialization
Make it a bit easier to follow the construction process and rely on
GObjects zero-initialization in more places.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3446>
2024-01-15 22:28:54 +00:00
Shmuel Melamud
f4c6fa949d clutter: Make clutter_actor_create_texture_paint_node public
Since StDrawingArea in gnome-shell is the only user of ClutterCanvas,
it is possible to move ClutterCanvas completely out of Mutter to
gnome-shell. This allows to remove another Cairo dependency from
Mutter.

This patch makes clutter_actor_create_texture_paint_node() function
public to be used by StDrawingArea in gnome-shell that replaces
ClutterCanvas.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3507>
2024-01-15 17:02:55 +00:00
Efstathios Iosifidis
37c0b27895 Update Greek translation
(cherry picked from commit b71f86ae9e4ad3ac9bddd404d7eea1616b6817f3)
2024-01-14 22:43:00 +00:00
Florian Müllner
1037fde087 ci: Update gsettings-desktop-schemas
It is needed to support the new "show-status-shapes" setting
in the shell.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3513>
2024-01-14 17:21:09 +00:00
Florian Müllner
4dbe97a894 ci: Add work-around for podman-push permission issue
For some reason, podman recently started to fail to read files
in non-world-readable directories:

https://gitlab.gnome.org/Infrastructure/Infrastructure/-/issues/1247

As long as it happens with stuff we don't actually need, the
work-around is to just remove the offending files.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3513>
2024-01-14 17:21:09 +00:00
Florian Müllner
3002e18668 ci: Quote package names with parentheses
This is needed by newer versions of the template.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3513>
2024-01-14 17:21:09 +00:00
Bilal Elmoussaoui
2dd04f7cbe compositor: Use subclassing macros for Module
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3520>
2024-01-13 17:22:26 +00:00
Bilal Elmoussaoui
b1bc03a314 native: Use subclassing macros for InputDeviceToolNative
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3520>
2024-01-13 17:22:26 +00:00
Bilal Elmoussaoui
a79834a1ff x11: Use subclassing macros for InputSettingsX11
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3520>
2024-01-13 17:22:26 +00:00
Bilal Elmoussaoui
b1fc022ee6 x11: Use subclassing macros for InputDeviceX11
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3520>
2024-01-13 17:22:26 +00:00
Bilal Elmoussaoui
5387135220 x11: Use subclassing macros for InputDeviceToolX11
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3520>
2024-01-13 17:22:26 +00:00
Bilal Elmoussaoui
4f96b43222 x11: Use subclassing macros for CursorRendererX11
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3520>
2024-01-13 17:22:26 +00:00
Bilal Elmoussaoui
d90a938c17 core: Use subclassing macros for GestureTracker
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3520>
2024-01-13 17:22:26 +00:00
Bilal Elmoussaoui
59bdc69544 native: Use subclassing macros for InputSettingsNative
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3520>
2024-01-13 17:22:26 +00:00
Dallas Strouse
c8c5560916 backends/native: Main thread rt-scheduler: experimental feature no more
To paraphrase jadahl: we have a dedicated KMS thread now, which also
has realtime scheduling enabled unconditionally. realtime scheduling
on the main thread isn't too great of an idea, considering GC can
take a hot minute.

And to quote rmader: we most likely won't be able to make the main
thread rt as long as we use GJS and thus have GC.

So let's get rid of it! It's just been breaking things anyways.

This just ignores the setting; we'll fully remove it when GNOME 46
comes around.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3296>
2024-01-13 15:10:31 +01:00
Simon McVittie
ecdd2aeb85 workspace: Don't crash on invalid argument to meta_workspace_index
Mitigates: https://gitlab.gnome.org/GNOME/mutter/-/issues/2559
Mitigates: https://bugs.debian.org/1024438
Signed-off-by: Simon McVittie <smcv@debian.org>
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2774>
2024-01-12 15:24:14 +00:00
Corentin Noël
cb03b46a20 cogl/onscreen: Add several introspection annotations
Only an unowned closure is returned by the add_*_callback methods as the object
itself owns the closure.

Add array annotation when taking an array of integers.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3516>
2024-01-12 15:04:30 +00:00
Sebastian Wick
399ffdfc88 kms/connector: Keep a ref to the KmsImplDevice instead of KmsDevice
The KmsImplDevice always exists as long as a KmsConnector exists. The
KmsDevice doesn't exist yet as long as the KmsImplDevice is not fully
initiallized. Going through the KmsImplDevice makes sure we always have
a valid reference and can release the device fd correctly when the
initialization fails.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3243
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3518>
2024-01-12 14:51:14 +00:00
Carlos Garnacho
7b232d9f65 wayland: Keep track of the "input focus" on MetaWaylandSeat
This is the unified focus (key, IM, pads, ...) for the focus window.
Just like MetaWaylandPointer and others keep track of the "current"
surface, this is the "current" surface for those (not necessarily
the focused surface, e.g. in the case of compositor grabs).

Since this unified focus will exist regardless of keyboard
capabilities (e.g. even if just for "logical" focus like IM/clipboard
that does not depend on input devices), it does not make sense
to trigger a focus sync on keyboard capability changes, the focus
is staying the same, we however need to focus the keyboard interface
to the already existing focus when the capability is enabled.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3511>
2024-01-12 14:39:17 +00:00