1
0
Fork 0
Commit graph

32731 commits

Author SHA1 Message Date
Michel Dänzer
369596a82b kms/update: Add meta_kms_update_get/set_sync_fd
v2:
* Use g_steal_fd in meta_kms_update_merge_from. (Jonas Ådahl)

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3958>
2024-08-28 14:42:38 +00:00
Michel Dänzer
452e4fbf70 kms/plane: Rename META_KMS_ASSIGN_PLANE_FLAG_DIRECT_SCANOUT
To META_KMS_ASSIGN_PLANE_FLAG_DISABLE_IMPLICIT_SYNC. This describes the
effect of the flag, instead of the circumstances it's currently used
for.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3958>
2024-08-28 14:42:38 +00:00
Michel Dänzer
a589456209 kms/crtc: Conditionally return 0 in meta_kms_crtc_get_deadline_evasion
If both crtc->shortterm_max_dispatch_duration_us and
crtc->deadline_evasion_us are 0, i.e. we're not using the deadline
timer.

v2:
* Fix coding style. (Jonas Ådahl)

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3958>
2024-08-28 14:42:38 +00:00
Christian Hergert
030270ba3b compositor: Mark window drag actor invisible
If the window_drag->handle ClutterActor:visible property is FALSE,
then we avoid a full-framebuffer damage on the monitor when beginning
and ending a drag.

Testing with `mutter --wayland --display-server` still shows a full-
framebuffer damage on the first drag, but that appears to be unrelated
to this. Subsequent full-framebuffer damage which would occur on
drag-begin and drag-end have been elided.

Related: #3630
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3975>
2024-08-28 14:25:15 +00:00
Sebastian Wick
757f8b6d69 wayland/surface-role: Keep track of the surface main monitor
Toplevels get the main monitor from their MetaWindow and have no main
monitor when the toplevel is not mapped.

Subsurfaces get the main monitor from their parent surface.

DnD and cursors get the main monitor from the current cursor position no
matter if the cursor is actually being shown or not.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3941>
2024-08-27 23:22:21 +02:00
Sebastian Wick
fe17e717c3 wayland-surface: Add a main-monitor property
The main monitor is role dependent. For a toplevel this comes from the
MetaWindow main monitor, for a subsurface from the parent surface, for
pointer and dnd from the cursor position.

The next commit will use meta_wayland_surface_set_main_monitor in the
different roles to keep the property up-to-date.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3941>
2024-08-27 23:22:21 +02:00
Sebastian Wick
586fd41a7e feedback-actor: Remove unused meta_feedback_actor_update
We removed the last user in the previous commit.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3941>
2024-08-27 19:16:36 +02:00
Sebastian Wick
20cf5fb02f wayland/data-device: Move position updates to a common function
The function will be expanded in a later commit.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3941>
2024-08-27 19:16:36 +02:00
Sebastian Wick
035bbb3250 wayland/data-device: Remove unused drag_grab_update_feedback_actor
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3941>
2024-08-27 19:16:36 +02:00
Sebastian Wick
a43dbd46fb cursor: Fix set_property vfunc name
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3941>
2024-08-27 19:16:36 +02:00
Quentin PAGÈS
d5e72ff24d Update Occitan translation 2024-08-26 15:41:53 +00:00
Daniel van Vugt
dc637e95ac tests/monitor-unit: Use the correct XML syntax
Fixes: 4175a37e4c ("tests/monitor-unit: Add layout mode migration tests")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3976>
2024-08-23 12:01:09 +08:00
Daniel van Vugt
3eebe2592a monitor-config-store: Fix typos in <layoutmode> written to monitors.xml
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3635
Fixes: 076b3664a3 ("monitor-config-store: Store and load layout mode for each configuration")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3976>
2024-08-23 11:32:19 +08:00
Bilal Elmoussaoui
70dc8cabac clutter/settings: Remove unused fontconfig-timestamp property
As a writable property, nothing sets it in both Mutter/GNOME Shell
making it a dead-code. As we will be moving pango related bits to
gnome-shell, remove this one already

Removes pango-ft2 dependency

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3969>
2024-08-22 19:09:51 +00:00
Florian Müllner
da828c2fcc x11/input-device: Stop using deprecated libwacom API
libwacom_has_ring/ring2 was deprecated. Switch to the replacement
function where it is available.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3974>
2024-08-22 18:48:36 +00:00
Florian Müllner
98e7197511 build: Replace unnecessary get_compiler() call
We already have a variable with the compiler object.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3974>
2024-08-22 18:48:36 +00:00
Bilal Elmoussaoui
60edafe3eb cogl/pango: Drop mipmapping API/env variables
As GNOME Shell always sets that to FALSE anyways
This does not drop the separate caching whether the mipmapping is
disabled or not, in case shell wants to make use of that in the future

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3962>
2024-08-22 16:45:01 +00:00
Bilal Elmoussaoui
5176a828eb core/util: Drop duplicated MetaLocaleDirection
Clutter has an enum for that already, just use it instead of mapping between the types

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3962>
2024-08-22 16:45:01 +00:00
Bilal Elmoussaoui
4f606261d3 clutter: Remove unused get_font_map
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3962>
2024-08-22 16:45:01 +00:00
Bilal Elmoussaoui
39da6e10fa clutter/context: Move get_show_fps to it correct namespace
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3962>
2024-08-22 16:45:01 +00:00
Bilal Elmoussaoui
078bbd82c8 clutter: Export Context header
As otherwise, GNOME Shell canno't make use of the public APIs, especially the
future Context.get_settings / Context.get_text_direction for example

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3962>
2024-08-22 16:45:01 +00:00
Bilal Elmoussaoui
8291b2d6d0 clutter/context: Free the stage manager
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3962>
2024-08-22 16:45:01 +00:00
Bilal Elmoussaoui
0d93f805d4 clutter/context: Create a StageManager when constructed
Instead of delegating that to StageManager.get_default and add a private getter
for it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3962>
2024-08-22 16:45:01 +00:00
Bilal Elmoussaoui
914787294f clutter/stage-manager: Mark as private type
Nothing is supposed to interact with it externally

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3962>
2024-08-22 16:45:01 +00:00
Bilal Elmoussaoui
09c7c2bf7b clutter/stage-manager: Remove unused APIs
As the type will be made private in future commits

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3962>
2024-08-22 16:45:01 +00:00
Bilal Elmoussaoui
5391ab56e8 clutter/stage-manager: Mark as final
It is not something that can be replaced

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3962>
2024-08-22 16:45:00 +00:00
Bilal Elmoussaoui
3fb1c9ab21 clutter/context: Remove unused is_initalized
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3962>
2024-08-22 16:45:00 +00:00
Bilal Elmoussaoui
3453a6e51f clutter/stage-manager: Remove unused default-stage
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3962>
2024-08-22 16:45:00 +00:00
Sebastian Wick
d1750e5bdb build: Enable libdisplay-info by default
So far libdisplay-info has only been used when it was available. This
change requires either libdisplay-info to be available or the user to
explicitly disable it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3971>
2024-08-22 14:26:51 +02:00
Sebastian Wick
41f0194280 tests: Start pipewire and wireplumber for the native-unit test
So far, the tests relied on the host system to provide pipewire and
wireplumber. This seperates the tests from the host system which is
especially useful if the tests are run in a toolbox which has a
different pipewire installed than the host. It also should make it
harder to have a mismatch between the pipewire library and the pipewire
daemon.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3966>
2024-08-22 08:51:56 +00:00
Sebastian Wick
7bcc8c19cb build: Remove unused CI test setup
The CI uses the default and plain setups but not the CI one. Let's
remove it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3966>
2024-08-22 08:51:56 +00:00
José Expósito
c7acd6074b wayland/drm-lease: Fix list initialization bug
The new_connectors list must be initialized empty, otherwise, connectors
are duplicated.

Fixes: 115b2c1247 ("wayland/drm-lease: Make MetaDrmLeaseManager::connectors a GList")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3967>
2024-08-21 12:47:57 +00:00
Jonas Ådahl
d2be0b6950 kms: Inhibit real time scheduling until initial mode set
We're already inhibiting real time scheduling when reading new KMS state
after hot plugs, as well as when during mode sets, due to the kernel not
being able to reliably handle these within the 250 ms limit. However, we
didn't do this during initial probing, which meant that occasionally
we'd run into these kind of issues during startup.

Handle this by always inhibiting real time scheduling up front, and
don't uninhibit until all initially discovered device have finished
processing their initial mode set.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3628
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3960>
2024-08-21 12:15:59 +00:00
Peter Hutterer
d866590b78 wayland: Set current tool surface to NULL on prox-out
If an application is maximised, clutter_stage_pick_and_update_device()
goes into the
        if ((flags & CLUTTER_DEVICE_UPDATE_IGNORE_CACHE) == 0)
condition and returns the current actor for the device. This means no
CLUTTER_LEAVE/ENTER events are generated and in turn means the focus is
never invalidated and updated.

This leads to tool->focus_surface always being NULL and all events are
discarded.

Notably, tool->current is set to the right surface but
that one never changes either so meta_wayland_tablet_tool_set_current_surface()
exits early too because surface == tool->current and we thus never call
meta_wayland_input_invalidate_focus().

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3616
Fixes: fb8ac5dff7 ("wayland: Track current tablet tool focus surface")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3956>
2024-08-21 10:21:33 +00:00
Martin Abente Lahaye
eaa416904d ci: Bump CI/CD component version for building system extensions
This new version allows us to specify a branch,  which will be needed
soon to freeze the GNOME OS version used in stable branches e.g. once
GNOME OS 47 is available.

See https://gitlab.gnome.org/GNOME/gnome-build-meta/-/issues/872

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3963>
2024-08-20 12:23:58 -04:00
Peter Hutterer
c03e64ef1d wayland: Propagate a tablet's DEVICE_REMOVED to trigger the signals
Clutter's "device-removed" signal is sent in
clutter_seat_handle_event_post(). Our tablet code is set up to handle
that signal to then notify wayland clients of removed tablet devices.

However, returning CLUTTER_EVENT_STOP for a DEVICE_REMOVED event means
we never get to the point where we send out the signals and thus never
remove the tablets.

Fixes: a37fd34bbb ("wayland: Make MetaWaylandSeat in charge of its own tablet seat")

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3615
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3955>
2024-08-20 14:06:32 +00:00
Carlos Garnacho
ae35c1efe0 core: Use event return value defines in keybinding code
Make the fate of the given event in every return path more
evident.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3935>
2024-08-20 10:50:06 +00:00
Carlos Garnacho
cdf427039d core: Let unhandled key release events be propagated by keybindings
This leads to possibly missed key release events being propagated down to
clients, and in the case of X11 clients, to stuck keys e.g. after switching
workspace with Ctrl+Alt+Left/Right and ending up with a X11 client focused.

Fixes: 11a4d56185 ("keybindings: Send trigger when a key accelerator is deactivated")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3935>
2024-08-20 10:50:06 +00:00
Lukáš Tyrychtr
a35326cc93 dbus-interfaces: Fix ApplyMonitorsConfig documentation
The "overscanning" property had its name at least from 2019,
but the documentation was wrong all that time.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3624
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3957>
2024-08-19 13:01:46 +02:00
Michel Dänzer
bd8db38460 kms/impl-device: Track dispatch duration in crtc_frame_deadline_dispatch
And take it into account in meta_kms_crtc_get_deadline_evasion.

This uses the same fundamental approach as clutter frame clock scheduling:

Measure the deadline timer dispatch duration, keep track of the longest
duration, and set the timer to fire such that the longest measured
dispatch duration would result in it completing shortly before start of
vblank.

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

v2:
* Move DEADLINE_EVASION_CONSTANT_US addition from
  meta_kms_crtc_determine_deadline to meta_kms_crtc_get_deadline_evasion.
* Calculate how long before start of vblank dispatch completed for
  debug output in crtc_frame_deadline_dispatch.
* Shorten over-long lines in crtc_frame_deadline_dispatch.
v3:
* Take VRR into account in crtc_frame_deadline_dispatch &
  meta_kms_crtc_update_shortterm_max_dispatch_duration. (Robert Mader)
v4:
* Check if deadline has already passed in meta_kms_crtc_determine_deadline,
  set the deadline for one refresh interval later if so.
* Fix indentation in crtc_frame_deadline_dispatch.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3934>
2024-08-17 19:16:01 +00:00
Michel Dänzer
d7012d2ad3 kms/impl-device: Use KMS_DEADLINE in crtc_page_flip_feedback_flipped
It's useful for this to match the debug topic in
crtc_frame_deadline_dispatch.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3934>
2024-08-17 19:16:01 +00:00
Sebastian Wick
45dcfeb0cc cogl/gles: Revert to unsized GL_BGRA as internalformat for BGRA_8888
Using GL_BGRA8_EXT as internalformat for TexSubImage2D was not allowed
in the EXT_texture_format_BGRA8888 extension. This changed recently:

https://registry.khronos.org/OpenGL/extensions/EXT/EXT_texture_format_BGRA8888.txt

  1.4, 23/06/2024 Erik Faye-Lund: Add GL_BGRA8_EXT for ES 2.0 and later.

Mesa already supports this which is why 7f943613a8 ("cogl: Use sized
internal renderable formats") worked as intended. Technically spec
compliant and our CI had an up-to-date driver.

So while this is no bug, it's still not great because older drivers will
generate GL errors. This commit changes this specific format back to an
unsized internal format which means we could, in theory, get less than
8bpc framebuffers.

We can try to revert this commit when newer driver versions have
propagated far enough.

Fixes: 7f943613a8 ("cogl: Use sized internal renderable formats")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3954>
2024-08-16 14:24:38 +00:00
Sebastian Wick
7610973a94 Replace deprecated g_qsort_with_data with g_sort_array
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3899>
2024-08-15 23:58:53 +02:00
Jonas Ådahl
e5827ea06b monitor-config-utils: Use g_list_copy_deep() to clone lists
It makes things a bit more easy to follow.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3596>
2024-08-14 13:07:47 +00:00
Jonas Ådahl
b8394c68f5 monitor-config-store: Use auto pointers in a couple of places
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3596>
2024-08-14 13:07:47 +00:00
Jonas Dreßler
4175a37e4c tests/monitor-unit: Add layout mode migration tests
Let's add a bunch of tests for the newly introduced monitor config
migration code. We're verifying that:

- monitor configs get migrated and monitors.xml is updated on startup

- existing monitor configs in LOGICAL layout mode (ie.
"scale-monitor-framebuffers" was enabled before updating mutter) get
migrated

- the migration of various more complex monitor layouts from PHYSICAL
to LOGICAL layout mode works

- for monitor layouts where conversion to LOGICAL fails, the PHYSICAL
layout mode still is migrated, while for LOGICAL at least primary
monitor and disabled monitors are preserved

- simple monitor configurations (with no scaled monitors, or with only
"irrelevant" scaled monitors at the end of the layout) do not go through
the conversion code paths

- monitor configs in PHYSICAL layout mode with integer scale factors
which will result in non-integer logical monitor sizes get converted
to the closest fractional scale factor

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3596>
2024-08-14 13:07:47 +00:00
Jonas Dreßler
05cc8a56e1 monitor-config-store: Save configs after layout mode detection/conversion
We don't want to do the work of the layout mode detection and conversion
every time we read the monitors.xml file.

Instead, when the detection logic is used, set a flag to automatically
update the config files after the parsing is finished.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3596>
2024-08-14 13:07:47 +00:00
Jonas Dreßler
2c8b383a7e monitor-config-store: Attempt to convert physical to logical layout modes
Introduce some "best effort" conversion code to migrate monitor configurations
from PHYSICAL (the old default) to LOGICAL (the new default on wayland)
layout mode.

This conversion will only be used when the old PHYSICAL layout-mode
configuration is not compatible with the new LOGICAL layout-mode one.
This only applies if 1) there's a monitor that needs scaling in the
layout, and 2) the scaled monitor comes before other monitors in the
coordinate system (ie. it's not the rightmost or bottommost monitor).

There are two algorithms added here to convert monitor layouts:

- One for "simple" 1-dimensional monitor layouts, where all monitors are
aligned on a vertical or horizontal strip.

Here's a few (inaccurate) examples of how this would look with different
layouts (left side is PHYSICAL, right side is LOGICAL, x is the origin of
the coordinate system, the numbers are scales of the monitors):

```
x──────┬──────┬──────┐     x  ┌──────┐
│  2   │  1   │  2   │    2┌──┤  1   ├──┐2
│      │      │      │ ──► └──┤      ├──┘
└──────┴──────┴──────┘        └──────┘

         x    ┌──────┐     x  ┌──────┐
         ┌────┤  1   │     ┌──┤  1   │
         │ 2  │      │ ──► └──┤      │
         └────┴──────┘      2 └──────┘

    x      ┌────┐
    ┌──────┤    │          x──────┐
    │      │    │          │      ├─┬────┐
    │  1   │ 3  │      ──► │  1   │3│ 1  │
    │      │    │          │      ├─┴────┘
    └──────┤    │          └──────┘
           │    ├────┐
           │    │ 1  │
           └────┴────┘
```

- A second more complex algorithm for 2-dimensional monitor layouts with
a common baseline that all monitors are aligned to.

And examples for this one:

```
             x      ┌──────┐
             ┌──────┤      │
             │  1   │  2   │     x──────┐
             │      │      │     │  1   ├────┐
             └──┬───┴───┬──┘ ──► │      │ 2  │
                │  3    │        ├──┬───┴────┘
                │       │        └──┘3
                └───────┘

       x     ┌──────┬──────┐
             │  1   │      │
             │      │      │     x──────┬──────┐
       ┌─────┴──────┤  1   │     │  1   │      │
       │            │      │     │      │      │
       │            │      │ ──► └──┬───┤  1   │
       │     3      │      │        │ 3 │      │
       │            ├──────┘        └───┤      │
       │            │                   │      │
       │            │                   └──────┘
       └────────────┘

x                  ┌───────┐
┌──────┐           │       │     x         ┌───────┐
│  2   │    ┌──────┤   1   │               │       │
│      │    │  1   │       │      2 ┌──────┤   1   │
└────┬─┴────┴─┬────┴───────┘ ──► ┌──┤  1   │       │
     │        │                  ├──┴┬─────┴───────┘
     │   2    │                  │ 2 │
     │        │                  └───┘
     └────────┘
```

These algorithms will fail for any more complex 2d monitor layout, eg.

```
x   ┌───┬────┐
    │ 2 │ 1  │
    │   ├────┘
┌───┴┬──┘
│ 1  │
└────┘

x───┬───┬───┐
│ 1 │ 2 │ 1 │
├───┼───┼───┤
│ 1 │ 1 │ 1 │
├───┼───┼───┤
│ 1 │ 1 │ 1 │
└───┴───┴───┘
```

In those cases where the conversion failed, we fall back to aligning
the monitors on a horizontal line, preserving the scale, the primary
monitor and the disabled monitors.

Note that we also need to convert the scale factor in some cases,
because LOGICAL layout mode also behaves different here:
When the scale results in a fractional logical monitor size (eg.
the native monitor width is 2560px, and a scale of 3 is set =>
2560px / 3 = 853.333px), in LOGICAL mode we won't use that scale.
Instead we have an algorithm (see
meta_monitor_get_closest_scale_factor_for_resolution()) to find
the nearest fractional scale factor which doesn't result in
fractional logical monitor size. We reuse this algorithm here for
the conversion.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3596>
2024-08-14 13:07:47 +00:00
Jonas Dreßler
96791f111a monitor: Move check to limit fractional scales to certain monitor sizes
We'll reuse meta_monitor_get_closest_scale_factor_for_resolution() for the
conversion of monitor configs, and during those conversions, we probably don't
want to impose the same limits to fractional scales that we usually impose.
This means that we can even convert physical layout configs where the user
manually changed to a value higher than what our fractional scale calculations
would allow.

Move this check into the calling function so that it's not imposed by
meta_monitor_get_closest_scale_factor_for_resolution() directly.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3596>
2024-08-14 13:07:47 +00:00
Jonas Dreßler
078d95cc15 monitor: Make function to calculate fractional scale factor public
We'll need this function for migrating from PHYSICAL layout mode to LOGICAL
layout mode soon, so make it public.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3596>
2024-08-14 13:07:47 +00:00