1
0
Fork 0
Commit graph

3505 commits

Author SHA1 Message Date
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
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
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
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
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
Jonas Dreßler
0d23eb1da8 monitor-config-manager: Move verification of logical monitor configs into utils
We'll need these verification utilities in the next commits where we introduce
detection for physical vs logical layout modes.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3596>
2024-08-14 13:07:47 +00:00
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
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
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
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
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
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
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
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
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
Bilal Elmoussaoui
9c7eafc8c3 clutter/context: Track if accessibility enabled
Currently, we would only disable a11y if a certain flag is passed
but the function is always called with NONE flag. Instead
drop the flag, use a new environment variable for that

That value is then used by actors to short-circuit get_accessible
implementation and return NULL if the accessibility is not enabled

Also clean the other accessibility functions

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3917>
2024-08-07 22:46:16 +00:00
Bilal Elmoussaoui
ec028553d3 accessibility: Set various accessible names
For actors that are created by libmutter itself.
Although, not sure if such names should be translatable?

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3917>
2024-08-07 22:46:16 +00:00
Bilal Elmoussaoui
7571ae6f05 clutter/stage: Track is_active
Instead of doing that in both MetaStage & CallyStage.
This allows ClutterStage to also emits the relavant acessibility
bits directly without having a roundtrip through Cally

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3917>
2024-08-07 22:46:16 +00:00
Sebastian Wick
e3afa1a1d1 color-device: Apply HDR and colorspace calibration
The color device now updates the white point via a LUT and sets the
colorspace and HDR metadata properties on monitors to get into the
required configuration.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3904>
2024-08-07 16:45:26 +02:00
Sebastian Wick
dc6632f19b color-device: Derive color space from monitor calibration
This ignores the white point calibration for now because our color state
isn't expressive enough, yet.

Co-authored-by: Joan Torres <joan.torres@suse.com>
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3904>
2024-08-07 16:45:10 +02:00
Sebastian Wick
357e5c92f2 backends: Let the color manager know about monitor changes earlier
This makes it possible to set monitor/output properties before the stage
views get re-created.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3904>
2024-08-07 16:40:56 +02:00
Sebastian Wick
a539071548 output: Fix minor coding style issue
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3904>
2024-08-07 16:40:56 +02:00
Sebastian Wick
6dc9cab14b backends: Move MetaOutputHdrMetadata from KmsConnector to Output
This makes it independent of the native backend and allows us to use it
in more places.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3904>
2024-08-07 16:40:56 +02:00
Sebastian Wick
fefcc6edec color-device: Track the ClutterColorState of the device
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3904>
2024-08-07 16:40:56 +02:00
Sebastian Wick
c123178f1c color-device: Rename signal "updated" to "calibration-changed"
The generic term updated can mean anything. This is specifically about
calibration related updates like changing the sink colorimetry
(Colorspace, HDR metadata) and changes to the white point for night
light etc.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3904>
2024-08-07 16:40:56 +02:00
Sebastian Wick
f5ce2ddf3c color-manager: Create color devices also for virtual monitors
We will need color devices on all monitors soon.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3904>
2024-08-07 16:40:56 +02:00
Sebastian Wick
431c4d12b9 color-device: Make it possible to outlive the active monitors
Previously the color device was destroyed when it was attached to a
monitor that was going away. However, the MetaMonitor objects are
ref-counted and can stay around for longer, even if the underlying
resources went away. We need color devices for as long as the
MetaMonitors are alive.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3904>
2024-08-07 16:40:48 +02:00
Sebastian Wick
a10b56e946 color-manager: Dispose instead of finalize
Otherwise we'll keep references to color devices for too long.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3904>
2024-08-07 16:30:04 +02:00