1
0
Fork 0
Commit graph

12233 commits

Author SHA1 Message Date
Dor Askayo
fee3329997 onscreen/native: Allow requesting frame synchronization
Frame synchronization is enabled for a view as long as it's
applicable to be enabled. It is considered applicable if it's both
requested for the onscreen and if the onscreen uses a CRTC which is
configured with a variable refresh rate mode.

When frame synchronization is enabled, it enables both the the variable
scheduling mode of ClutterFrameClock and the variable refresh rate
property for the CRTC.

Changes in the frame synchronization mode are applied asynchronously,
before the next frame is drawn.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1154>
2024-03-02 12:08:21 +00:00
Dor Askayo
732f5afe13 monitor-manager: Add support for refresh rate modes
The refresh rate mode is exposed in the DisplayConfig D-Bus interface
and is made persistent through monitors.xml.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1154>
2024-03-02 12:08:21 +00:00
Dor Askayo
1721dad5ec monitor: Include the refresh rate mode in the mode spec
Variable refresh rate modes are preferred over their fixed refresh
rate counterparts.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1154>
2024-03-02 12:08:21 +00:00
Dor Askayo
be36c18787 output/kms: Initialize variable refresh rate output modes
Add variable refresh rate output modes for connectors that are VRR
capable when VRR is not disabled for the GPU.

Variable refresh rate output modes are sorted before their fixed
refresh rate counterparts. They are also marked as the preferred mode
for the output between the two.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1154>
2024-03-02 12:08:21 +00:00
Dor Askayo
455ac43e0a kms: Initialize variable refresh rate CRTC modes
When VRR is not disabled for a GPU, create two variants of every
display mode: one with fixed refresh rate and another with variable
refresh rate.

The variable refresh rate modes are not used yet. They will be used
in a following commit.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1154>
2024-03-02 12:08:21 +00:00
Dor Askayo
9fcc938075 gpu/kms: Allow checking if VRR should be disabled
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1154>
2024-03-02 12:08:21 +00:00
Dor Askayo
b2ceb055d6 backends/native: Add support to disable VRR using udev
This can be used to disable VRR in specific drivers and hardware
combinations where it is found to be problematic.

No default rules are added for now to encourage testing.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1154>
2024-03-02 12:08:21 +00:00
Dor Askayo
e72baac97d settings: Add experimental feature for variable refresh rate
Require the "variable-refresh-rate" keyword under the
"experimental-features" gsetting to enable the feature for now.

It would no longer be required once the experience with variable
refresh rate is good enough for general use and handles all common
use cases well.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1154>
2024-03-02 12:08:21 +00:00
Dor Askayo
a74fbecbd6 kms/crtc: Calculate CRTC deadline for VRR
Use a sufficiently low refresh rate to calculate the CRTC deadline
when variable refresh rate is enabled. This is done to avoid cursor
updates from driving the monitor refresh rate.

It's not great solution and is sometimes not enough, but it avoids
stutter in the main content as a result of cursor movement in most
cases.

The unfortunate downside of this approach is that cursor movement
would usually only update with the main content and would not be
smooth when the main content updates are not frequent enough.

A better solution may use an approach similar to LFC (Low Framerate
Compensation) to insert cursor-only updates between updates of the
main content, but achieving adequate results with an approach of this
nature requires more research and experimentation.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1154>
2024-03-02 12:08:21 +00:00
Dor Askayo
2a3fc9b830 kms/impl-device: Allow the expected presentation time to be unknown
It is not trivial to accurately estimate the expected presentation
time with variable refresh rate, and not doing so only affects debug
prints.

No change in behavior for now because the expected presentation time
is always calculated. A following commit will introduce a case where
it is not.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1154>
2024-03-02 12:08:21 +00:00
Dor Askayo
4ad282cf26 kms: Allow setting the "VRR_ENABLED" property on a CRTC
Add functions to update and monitor the value of the "VRR_ENABLED"
KMS property.

This requires the addition of functions to process CRTC property
updates in both the atomic and the simple KMS backends. The
implementation is similar to the implemention of processing
connector updates.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1154>
2024-03-02 12:08:21 +00:00
Dor Askayo
b7128b1d12 connector/kms: Detect variable refresh rate capability
The "vrr_capable" property indicates whether variable refresh rate is
supported for a connector.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1154>
2024-03-02 12:08:21 +00:00
Jonas Dreßler
525ed1166c wayland/pointer: Unset current surface during window drags
Commit d48129f5ee broke the displaying of our own drag cursor during window
drags, as now the window cursor is always used, even during stage grabs
(window grabs are just a kind of stage grab).

To fix it, while not regressing on the intention of the other commit, unset
the MetaWaylandPointer surface in case a window drag is active (instead of
all kinds of grabs) by checking via meta_display_is_grab().

Fixes: d48129f5ee ("wayland: Fix pointer cursor during Wayland grabs")
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3316
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3624>
2024-03-01 16:41:46 +01:00
Carlos Garnacho
8519a31e8f wayland: Make MetaWaylandTabletTool struct private
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3627>
2024-03-01 14:37:58 +00:00
Carlos Garnacho
f17300a22e wayland: Refactor tablet tool grab checks
Move the bulk of the implementation inside MetaWaylandTabletTool
files, so MetaWaylandTablet does not need to access at tool struct
fields.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3627>
2024-03-01 14:37:58 +00:00
Carlos Garnacho
314ab7c3cb wayland: Remove some unnecessary header includes
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3627>
2024-03-01 14:37:58 +00:00
Carlos Garnacho
bff8269a3e wayland: Make MetaWaylandPointer struct definition private
Move it outside the header and into private code.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3627>
2024-03-01 14:37:58 +00:00
Carlos Garnacho
f53adae278 wayland: Avoid MetaWaylandPointer struct peeking in touchpad gestures
Use getters for the MetaWaylandPointerClient and MetaWaylandSurface for
the logical focus.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3627>
2024-03-01 14:37:58 +00:00
Carlos Garnacho
bf4d46097b wayland: Add getter for the pointer focus client
Similarly to MetaWaylandKeyboard, there's some subsystems
that want access to this, e.g. touchpad gestures.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3627>
2024-03-01 14:37:58 +00:00
Carlos Garnacho
03b504fc38 wayland: Refactor pointer grab checks
Move the bulk of the implementation inside MetaWaylandPointer
files, like it happens in other places (e.g. MetaWaylandTabletSeat).
This avoids MetaWaylandPointer struct peeking from outside.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3627>
2024-03-01 14:37:58 +00:00
Carlos Garnacho
84d48254d7 wayland: Make MetaWaylandKeyboard struct private
Move it out of the header and into the C code.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3627>
2024-03-01 14:37:58 +00:00
Carlos Garnacho
fb7cd18ebf wayland: Fetch seat input focus as focus for new pad devices
Use the MetaWaylandSeat focus, and avoid peeking at MetaWaylandKeyboard
internals.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3627>
2024-03-01 14:37:58 +00:00
Carlos Garnacho
017eff6663 wayland: Avoid MetaWaylandKeyboard struct access
Use the MetaWaylandSeat focus, instead of peeking at MetaWaylandKeyboard
internals.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3627>
2024-03-01 14:37:58 +00:00
Carlos Garnacho
81df305645 wayland: Add MetaWaylandSeat input focus getter
This will be useful for MetaWaylandCompositor to get the
current input focus for keyboard and other related devices.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3627>
2024-03-01 14:37:58 +00:00
Sebastian Keller
9e77d45704 Revert "frames: Always initialize _MUTTER_FRAME_EXTENTS to zero"
The _MUTTER_FRAME_EXTENTS need to have the correct size before the
window is shown, otherwise the client window size will effectively have
the headarbar height subtracted when initially syncing the frame/client
geometries.

This reverts commit f10b3eac62.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3628>
2024-03-01 10:54:32 +01:00
Carlos Garnacho
c12991936e wayland: Let the tablet tool handle the handle_event() return value
This was being ignored, and the events propagated always. This may lead
to confusion with Clutter about who handled what, since shockingly the
events may be delivered to clients.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3317
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3625>
2024-02-28 22:46:03 +00:00
Carlos Garnacho
4c4c0b847d wayland: Do not claim tablet tool events as consumed without focus
If the tablet tool has no focus, it should let events go through.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3625>
2024-02-28 22:46:03 +00:00
Sebastian Wick
8234f5bc7e egl: Return success status from meta_egl_query_device_string
QueryDeviceString can successfully return NULL. The convention however
is that when NULL is returned, the error will be set.

This commit makes the returned string an output parameter which allows
us to return the success status and have the error set accordingly.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3614>
2024-02-27 13:13:53 +00:00
Sebastian Wick
46619573e0 egl: Make sure GError gets set when we return FALSE
The convention is that when a function returns FALSE or NULL, the error
will be set. In this file we call set_egl_error but it might not set an
error. Code of the form

if (egl_do_thing (..., &error))
 use_error (error);

will crash in those cases.

This commit makes sure we always set the error even if EGL doesn't give
us an error.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3614>
2024-02-27 13:13:53 +00:00
Doğukan Korkmaztürk
a816470996 screen-cast-stream: Remove stale comments and an unused variable
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3592>
2024-02-27 12:38:01 +00:00
Marco Trevisan (Treviño)
839158ffd5 build/meta: Add explicit dependency on Gio-2.0 gir
We depend on Gio for many introspection features (GSettings, GFile...)
without this we'd end up not having many symbols being exposed.

And errors such as
  Warning: Meta: meta_display_add_keybinding: argument settings:
    Unresolved type: 'GSettings*'

As per previous commit we now have this dependency implicitly, but still
it's better to make it clearer in case Clutter would drop it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3620>
2024-02-27 10:35:06 +01:00
Carlos Garnacho
e5483a963e wayland: Pass button/touch press begin coordinates as window drag hint
This will make windows stick to the pointer from the right point
where dragging started.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3546>
2024-02-27 00:19:22 +01:00
Carlos Garnacho
1b3759d51c x11: Pass NET_WM_MOVERESIZE coordinates as window drag hint
This will make windows stick to the pointer from the right point
where dragging started.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3546>
2024-02-27 00:19:22 +01:00
Carlos Garnacho
4b1e24fcc4 core: Pass position hint to meta_window_begin_grab_op()
Add an argument to pass the position hint to this public API
call, so that callers can specify such hint. Everyone passes
NULL at the moment.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3546>
2024-02-27 00:19:22 +01:00
Carlos Garnacho
51e084ee8d compositor: Forward window drag position hint across internals
Allow passing an argument to meta_compositor_drag_window() to pass
the hint. Unused so far.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3546>
2024-02-27 00:19:20 +01:00
Carlos Garnacho
e4542a6495 compositor: Add MetaWindowDrag API to add a hint on the grab coordinates
This is added as a hint so that the caller can optionally use it, e.g.
in the case that a window drag is driven by the mouse. This will be used
to more accurately follow the drag position, other than starting at the
current pointer position.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3546>
2024-02-27 00:18:23 +01:00
Carlos Garnacho
4fa2706b9b wayland: Look up pointer logical focus when enabling constraints
Pointer constraints obey to logical pointer focus changes, and looking
up the current surface in order to maybe enable them is getting ahead
of itself, since the pointer focus might differ from the current surface
due to other factors (e.g. grabs).

Change the code checking whether constraints should be enabled to again
check the pointer logical focus, this will be influenced by the
MetaWaylandEventInterface mechanism, and correctly reflect the logical
state accounting for those factors.

Fixes: 125ba92169 ("wayland: Port pointer constraints to using MetaWaylandEventInterface")
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3303
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3618>
2024-02-26 22:15:19 +00:00
Carlos Garnacho
1d5676bc9a wayland: Handle event interface changes during focus synchronization
Currently, we don't handle too well the removal of a MetaWaylandEventInterface
during meta_wayland_event_interface_invalidate_all_focus(), since the
MetaWaylandEventInterface may be freed at an intermediate point in that function
while handling the focus change for all input devices.

Turn this invalidate_all_focus() function into a MetaWaylandInput method, and
always ensure to use the currently effective MetaWaylandEventInterface when
resetting the focus for each device.

This fixes the situation through handling reentrancy naturally, a focus
sync (say, triggered by a grab) would reset a device focus (say, pointer), which
would remove an event interface (say, a pointer constraint), which would
invalidate_all_focus() again underneath using the new effective
MetaWaylandEventInterface. When that is done, the initial invalidate_all_focus()
call would re-apply the same focus to the same currently effective
MetaWaylandEventInterface, resulting in a no-op for the remainder of the function.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3618>
2024-02-26 22:15:19 +00:00
Carlos Garnacho
7fc49f742b wayland: Add getter for the MetaWaylandPointer logical focus
Even though the logical focus is typically business that only the
MetaWaylandEventInterface mechanism minds about, there are some pointer
subsystems that want to look this up, as opposed to the current surface.

Add a getter to make this easier, without struct peeking.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3618>
2024-02-26 22:15:19 +00:00
Sebastian Wick
b102b6eca7 kms/connector: Remove getters for state tracked by KmsConnectorState
This also removes some g_return_if_fail's because the test suite expects
to be able to create arbitrary KmsUpdates even if they don't make sense
for the real state. We just get lucky that the test suite isn't
constructing updates with color space and hdr changes, yet.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3552>
2024-02-26 18:18:53 +00:00
Sebastian Wick
420c8cb37f kms/connector: Simplify privacy screen tracking
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3552>
2024-02-26 18:18:53 +00:00
Sebastian Wick
3e14edb00c kms/connector: Track max_bpc in KmsConnectorState
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3552>
2024-02-26 18:18:53 +00:00
Sebastian Wick
e9e613a6c3 kms/connector: Track underscan in KmsConnectorState
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3552>
2024-02-26 18:18:53 +00:00
Sebastian Wick
0dc43c04ee onscreen/native: Move rgb range support to OutputInfo
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3552>
2024-02-26 18:18:53 +00:00
Sebastian Wick
706bee2a58 onscreen/native: Use max bpc support from OutputInfo
The max bpc support is already tracked in the OutputInfo, so let's use
that instead of querying the KMS Connector directly.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3552>
2024-02-26 18:18:53 +00:00
Sebastian Wick
8acf250583 output: Move privacy screen support to OutputInfo
Same as previous commit for privacy screen support.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3552>
2024-02-26 18:18:53 +00:00
Sebastian Wick
a3a4de6c6b output: Move color space and hdr tf support to OutputInfo
Currently querying support for some output features is done partially
through the OutputInfo and partially via KMS CRTC and Connector objects.
Let's be consistent and use OutputInfo always which works with all
backends and backend types.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3552>
2024-02-26 18:18:53 +00:00
Sebastian Wick
fb7b9b0955 onscreen/native: Disable the CRTC LUT when we have no LUT to set
The KmsImplDevice supports bypassing the hardware LUT when we pass in
NULL or an empty LUT.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3552>
2024-02-26 18:18:53 +00:00
Sebastian Wick
eb8a12c24b tests/kms/update: Use proper gamma LUT size
We're currently pretending the gamma LUT has another size. This becomes
a problem when we try to reset the LUT to passthrough, create an
identity LUT for it and it has a size that the kernel doesn't accept.

We do track the size and have utility for creating the LUTs, so let's
just use them.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3552>
2024-02-26 18:18:53 +00:00
Sebastian Wick
b083ad67df kms/impl-device/simple: Handle NULL gamma LUTs for passthrough
The kernel doesn't let us set gamma to passthrough with the legacy API
so we have to trick a bit and create an identity LUT, and also when we
read the KMS state, detect when an identity LUT is active.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3552>
2024-02-26 18:18:53 +00:00