1
0
Fork 0
Commit graph

10565 commits

Author SHA1 Message Date
Robert Mader
2a87eb6226 renderer-view: Use common helper function to transform matrices
To deduplicate some code. Tested with all eight possible values.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2468>
2022-09-01 20:40:35 +00:00
Robert Mader
d3b81d70f0 stage-impl: Use onscreen framebuffer for scanout
We may want to use scanout even if the default framebuffer
of the stage view is an offscreen, for example when a Wayland
client provides pre-rotated buffers. The caller is responsible
to ensure this is correct - we already asserted on that before.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2468>
2022-09-01 20:40:35 +00:00
Robert Mader
3c79eb56b9 compositor/native: Allow scanout for offscreen rotated views
If a stage view uses an offscreen framebuffer exclusively for
rotation and a Wayland client provides pre-rotated buffers,
we should try to use scanout.
This saves us one copy more than scanout in the onscreen case,
i.e. two fullscreen copies in total.

Offscreen rotation is notably used for all 90/270 degree rotations
at the moment, as using display hardware for them is apparently
more complex than for x-/y-flips and can even have detrimental
effects on power consumption.

This can be tested with `weston-simple-egl`.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2468>
2022-09-01 20:40:35 +00:00
Jonas Ådahl
39e01d8700 color-manager/x11: Set color transformation matrix
As was done in gsd-color, set the "CTM" of the output. This is only done
in X11, as it was only ever implemented for X11.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2166>
2022-09-01 19:09:21 +02:00
Jonas Ådahl
17c99edfe0 x11: Add X11 color manager subclass
This is used as part of the X11 backend to updated X11 root window
properties according to the ICC Profiles in X Specification.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2166>
2022-09-01 19:09:21 +02:00
Jonas Ådahl
1adbb686bc tests/color: Add test for night light
This mocks gsd-colord to enable night ligth at a given temperature. The
test then verifies that the result exactly matches that of the gamma
ramps gsd-color generated for the same temperature and ICC profile.

There are two types of profiles tested; ones with VCGT, i.e. calibrated
profiles, and ones without. These are tested as the VCGT affects how the
gamma curve looks, while the non-VCGT profiles all only rely on
the blackbody temperature to generate a gamma ramp.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2165>
2022-09-01 17:52:01 +02:00
Jonas Ådahl
ceedc0e5fb color: Emit signal when device is updated
Will be emitted when a device updated its color state. Will be used by
an X11 color manager implementation, and tests.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2165>
2022-09-01 17:52:01 +02:00
Jonas Ådahl
99d0c37d32 tests/color: Auto cleanup devices after tests
This helps making the test cases smaller, skipping irrelevant repetitive
cleanup after each test.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2165>
2022-09-01 17:52:01 +02:00
Jonas Ådahl
a232eb263f backend/test: Add support for gamma getting/setting
The set gamma is just stored in the object, nothing else. It's
initialized to a linear gamma ramp from 0 to UINT16_MAX for each color
channel.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2165>
2022-09-01 17:52:01 +02:00
Jonas Ådahl
b7d3c9e3c5 color-device: Maybe update brightness from profile when updating
Some profiles have brightness metadata that also needs to be applied.
Make sure this happens.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2165>
2022-09-01 17:52:01 +02:00
Jonas Ådahl
71009779c8 color-manager: Update gamma LUTs when needed
This means on
  - hotplugs
  - color temperature changes
  - service availability (gsd-color, gsd-power)
  - when color devices become ready
  - when color devices change

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2165>
2022-09-01 17:52:01 +02:00
Jonas Ådahl
baef39e603 color-device: Add API to update gamma LUTs
This will generate a gamma LUT from the profile and apply it to the
monitor.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2165>
2022-09-01 17:52:01 +02:00
Jonas Ådahl
3e1a3faa28 color-profile: Add gamma LUT generators
More or less copied from gnome-settings-daemon. The look up tables are
either calculated based on the VCGT (Video Card Gamma Table) and the
blackbody color for a given temperature, or the blackbody color for a
given temperature alone, if no VCGT is available.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2165>
2022-09-01 17:52:01 +02:00
Jonas Ådahl
69df2a368d color-store: Monitor for non-EDID color profiles
This means that e.g. custom profiles or calibrated profiles will be
added and registered with colord. This does not use CdIccStore for two
reasons: don't want to generate duplicate entries for auto-generated
EDID or EFI profiles, and we want to store profiles as MetaColorProfile.
It also happens to be the case that CdIcc does synchronous I/O, which
should be avoided everywhere except on startup.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2165>
2022-09-01 17:52:01 +02:00
Jonas Ådahl
22064055be color-profile: Add API to get file path
Each color profile has a corresponding ICC profile saved on the file
system. The getter returns a file path for that ICC profile file.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2165>
2022-09-01 17:52:01 +02:00
Jonas Ådahl
16149d7c25 color-manager: Keep track of temperature
It will be used to generate gamma look up tables depending on
temperature.

The temperature comes from org.gnome.SettingsDaemon.Color and
depends on the current night light state.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2165>
2022-09-01 17:52:01 +02:00
Jonas Ådahl
b3fa4a6cd8 color-manager: Add API to set brightness
It uses the org.gnome.SettingsDaemon.Power.Screen D-Bus API. Currently
brightness set if the proxy is not ready are ignored; whether the
brightness value should be cached and set once it appears or whether
color profiles should be reapplied is yet to be decided.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2165>
2022-09-01 17:52:01 +02:00
Jonas Ådahl
7b71ec8ff0 color-device: Add new 'changed' signal for when the device changes
What triggers emission right now is the assigned profile changing.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2165>
2022-09-01 17:52:01 +02:00
Jonas Ådahl
985292c109 color-profile: Add getter for brightness profile
Will be used to set brightness from a color profile.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2165>
2022-09-01 17:52:01 +02:00
Jonas Ådahl
b59dc05b22 crtc: Get/set gamma via helper struct
Instead of passing 4 arguments (red, green and blue arrays as well as a
size), always pass them together in a new struct MetaGammaLut. Makes
things slightly less tedious.

The KMS layer still has its own variant, but lets leave it as that for
now, to keep the KMS layer "below" the cross backend CRTC layer.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2165>
2022-09-01 17:52:01 +02:00
Jonas Ådahl
9dda79b281 monitor-manager: Move gamma LUT manipulation API to MetaCrtc
In practice, for KMS backend CRTC's, we cache the gamma in the monitor
manager instance, so that anyone asking gets the pending or up to date
value, instead of the potentially not up to date value if one queries
after gamma was scheduled to be updated, and before it was actually
updated.

While this is true, lets still move the API to the MetaCrtc type; the
backend specific implementation can still look up cached values from the
MetaMonitorManager, but for users, it becomes less cumbersome to not
have to go via the monitor manager.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2165>
2022-09-01 17:52:01 +02:00
Jonas Ådahl
0a0fb2fda9 color: Create color profile for assigned profile
We created device profiles, that we manage the lifetime of in colord,
but color devices can be assigned profiles other than the ones it was
created for. For example, this can include the standard sRGB profile
provided by colord.

To achieve this, keep track of the default profile of the CdDevice as
the "assigned" color profile of the device. Given this profile
(CdProfile), construct a MetaColorProfile that can then be interacted
with as if it was generated by ourself.

The assigned profile (default profile in colord terms) does nothing
special so far, but will later be used to determine how to apply CRTC
gamma ramps etc.

The sRGB.icc file used in the tests was copied from colord. It was
stated in the repository that it has no known copyright restrictions.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2164>
2022-09-01 16:54:04 +02:00
Jonas Ådahl
cc84a45b56 color-profile: Create colord profiles
This works similiarly to how MetaColorDevice works, by creating them
asynchronously then signalling the 'ready' signal when done. Also
similarly to MetaColorDevice, the on-demand sync cleanup on finalize is
added, to avoid race conditions when hotplugs happens very rapidly,
e.g. in tests.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2164>
2022-09-01 16:54:04 +02:00
Jonas Ådahl
60d0394468 tests/mock/colord: Add profile mock support
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2164>
2022-09-01 16:54:04 +02:00
Jonas Ådahl
062abe01b3 color: Generate and store ICC profiles from EDID or EFI
Just as gsd-color does, generate color profiles. This can either be done
from EFI, if available and the color device is associated with a built
in panel, or from the EDID. If no source for a profile is found, none is
created.

The ICC profiles are also stored on disk so that they can be read by
e.g. colord. The on disk stored profiles will only be used for storing,
not reading the profiles, as the autogenerated ones will no matter what
always be loaded to verify the on disk profiles are up to date. If a on
disk profile is not, it will be replaced. This is so that fixes or
improvements to the profile generation will be made available despite
having run an older version earlier.

After generating, add some metadata about the generated file itself
needed by colord, i.e. file MD5 checksum and the file path.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2164>
2022-09-01 16:54:04 +02:00
Jonas Ådahl
7a242ff1a1 monitor: Add API to check color transform support
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2164>
2022-09-01 16:54:04 +02:00
Jonas Ådahl
083b788c74 color-manager: Maintain a lcms context
Will be used from other color related units later on. This also adds an
explicit dependency on LCMS2.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2164>
2022-09-01 16:54:04 +02:00
Jonas Ådahl
f4be29eec7 tests: Add rudimentary color device test
Tests that test case EDID is setup correctly, and that color devices for
monitors are created.

tests/color: Add hotplugging tests

Checks that changing the number of connected monitors reflects the
number of current color devices, and that we end up with the correct end
state.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2164>
2022-09-01 16:54:04 +02:00
Jonas Ådahl
8826b29329 color-manager: Add ready state
Ready means it has established the connection to colord and can operate.
Will be used by tests to make sure tests don't fail due to race
conditions when connecting to colord.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2164>
2022-09-01 16:54:04 +02:00
Jonas Ådahl
41ebf3b1bf color-device: Add getter for the associated monitor
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2164>
2022-09-01 16:54:04 +02:00
Jonas Ådahl
6403cfe170 color-manager: Add API to get the color device for a monitor
There is a 1-on-1 mapping between these two entities, so add a getter.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2164>
2022-09-01 16:54:04 +02:00
Jonas Ådahl
b8ddf7ad8b monitor: Add getter for EDID info struct
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2164>
2022-09-01 16:54:04 +02:00
Jonas Ådahl
9ece224718 output: Keep the EDID struct with the other output info
Will be used later to retrieve other EDID details, e.g. for color
management.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2164>
2022-09-01 16:54:04 +02:00
Jonas Ådahl
43cd70089e color-manager: Set up a D-Bus proxy to org.gnome.SettingsDaemon.Color
gsd-color provides this API, which exposes details about the night light
state. Currently, gsd-color also turns this state into CRTC gamma
changes, but this will eventually change, and this is a preparation for
this.

The proxy isn't yet used for anything.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2164>
2022-09-01 16:54:04 +02:00
Jonas Ådahl
0dc6d76371 tests/kvm: Forward MUTTER_DEBUG to the virtual machine
This helps debugging the tests running using KVM.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2141>
2022-09-01 14:31:40 +00:00
Jonas Ådahl
3fe01ffc4a color-manager: Take over color device management from gsd-color
Previously, gsd-color handled adding color devices. It got information
about those via the GnomeRR API, which is part of libgnome-desktop.
libgnome-desktop itself got this information from the
org.gnome.Mutter.DisplayConfig.GetResources() D-Bus method, implemented
by mutter.

Now, mutter itself will add all the monitor color devices itself,
without having to go via gsd-color.

We sometimes need to delete colord devices synchronously, in certain
race conditions when we add and remove devices very quickly (e.g. in
tests). However, we cannot use libcolord's 'sync' API variants, as it
has a nested takes-all main loop as a way to invoke the sync call. This
effectively means we end up sometimes not return from this function in a
timely manner, causing wierd issues.

Instead, create our own sync helper, that uses a separate context that
we temporarly push as the thread-default one.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2141>
2022-09-01 14:31:40 +00:00
Jonas Ådahl
4fe743e03b dbus-runner: Add colord mocking
This will be needed for adding colord integration without breaking
testing.

The test context is altered to make sure any left over color devices are
cleaned up before starting. This means it becomes possible to run a test
case multiple times without having to restart meta-dbus-runner.py.

Note: Don't use os.getlogin() to get the current username; as that
requires a controlling terminal.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2141>
2022-09-01 14:31:40 +00:00
Jonas Ådahl
67e7140c25 monitor-manager: Move PNP lookup to MetaBackend
It's not really about monitors, even though it is used for monitors.
Lets shrink MetaMonitorManager a bit moving it to the backend.

While at it, stop leaking it too.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2141>
2022-09-01 14:31:40 +00:00
Jonas Ådahl
7ee60e1143 monitor: Don't only use 'winsys ID' to check sameness
What determines whether one MetaMonitor is the same as the other should
be whether the actual monitor is the same. The way to check this is
comparing the EDID vendor/product/serial fields. Whene these are
incomplete, fall back on the 'winsys ID'.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2141>
2022-09-01 14:31:40 +00:00
Jonas Ådahl
ccb6a7e84f monitor: Allow vendor/product/serial to return NULL
Same applies to MetaOutput. The reason for this is to make it possible
to more reliably know when there was EDID telling us about these
details. This will be used for colord integration.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2141>
2022-09-01 14:31:40 +00:00
Jonas Ådahl
f939a7ca29 tests/monitor-unit-tests: Make serials more unique
We fairly consistently had multiple monitors with the whole
vendor,product,serial tuple identical. If we start relying on making
monitors a bit more unique, e.g. for colord integration, we need to make
two monitors connected distinguishable in order for tests to properly
reflect reality and excercise the correct colord integration paths.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2141>
2022-09-01 14:31:40 +00:00
Jonas Ådahl
972e393fc0 monitor: Add API to check whether the monitor is virtual or not
As for the types of monitor, X11 and KMS are currently assumed to always be
physical, while the virtual ones are assumed to be virtual. In theory
X11 ones could be virtual, but lets not bother. KMS ones can be virtual
in the case of virtual KMS, but we typically use that for testing as if
it was physical, so lets leave it as such.

Will later be used to feed correct information to colord.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2141>
2022-09-01 14:31:40 +00:00
Jonas Ådahl
f8dbea27f8 monitor: Add API to set GAMMA LUT
It's effectively a for-each for every active CRTC of the monitor.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2141>
2022-09-01 14:31:40 +00:00
Jonas Ådahl
c6c3f340ec monitor: Add API to get GAMMA LUT size
Will be used to generate look up tables.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2141>
2022-09-01 14:31:40 +00:00
Jonas Ådahl
8446cd9f4f monitor: Add getter for EDID MD5 checksum
Will be used for colord device matching.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2141>
2022-09-01 14:31:40 +00:00
Jonas Ådahl
15bbded86b monitor-manager/native: Bail if gamma LUT size differs
Don't attempt to set a CRTC GAMMA LUT with a different size than what is
already there.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2141>
2022-09-01 14:31:40 +00:00
Jonas Ådahl
b6aea1318d util: Add 'color' debug topic
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2141>
2022-09-01 14:31:40 +00:00
Jonas Ådahl
20a91aa4e9 backend: Add color manager skeleton
Create a color manager type that eventually will be the high level
manager of color related behavior, such as ICC profiles and
color "temperature" a.k.a. night light.

For now, it's only an empty shell. It's also constructed by the actual
backend, as at a later point, the X11 and native color management
implementations will differ.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2141>
2022-09-01 14:31:40 +00:00
Jonas Ådahl
c7954be56e tests/wayland/test-driver: Unset resource user data on finalize
Client connections may linger after the test driver is teared down;
handle this gracefully by unsetting the user data on the wl_resource,
and make the resource destructor a no-op, instead of where it would
otherwise remove itself from the resource list. This fixes this crash
seen in CI:

Received signal 11 (SIGSEGV)
 #0  g_list_remove() at ../glib/glist.c:596
 #1  test_driver_destructor() at ../src/tests/meta-wayland-test-driver.c:219
 #2  destroy_resource() at ../src/wayland-server.c:730
 #3  for_each_helper() at ../src/wayland-util.c:416
 #4  wl_map_for_each() at ../src/wayland-util.c:430
 #5  wl_client_destroy() at ../src/wayland-server.c:889
 #6  wl_display_destroy_clients() at ../src/wayland-server.c:1482
 #7  meta_wayland_compositor_prepare_shutdown() at ../src/wayland/meta-wayland.c:441
 #8  meta_context_dispose() at ../src/core/meta-context.c:667
 #9  g_object_unref() at ../gobject/gobject.c:3863
 #9  g_object_unref() at ../gobject/gobject.c:3780
 #10 glib_autoptr_clear_GObject() at /usr/include/glib-2.0/gobject/gobject-autocleanups.h:29
 #10 glib_autoptr_clear_MetaContext() at ../src/meta/meta-context.h:32
 #10 glib_autoptr_cleanup_MetaContext() at ../src/meta/meta-context.h:32
 #10 main() at ../src/tests/wayland-unit-tests.c:707
 #11 __libc_start_call_main() in /usr/lib64/libc.so.6
 #12 __libc_start_main() in /usr/lib64/libc.so.6
 #13 _start() in /builds/GNOME/mutter/build/src/tests/mutter-wayland-unit

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2601>
2022-09-01 08:39:48 +00:00
Mario Limonciello
96aa0fb853 output/kms: Add more heuristics to decide when to offer fallback modes
If the panel is connected via eDP and supports more than one mode
at different resolutions don't try to add more.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2586>
2022-08-31 08:15:57 +00:00
Daniel van Vugt
bb1ffb0887 shaped-texture: Don't clear mipmaps during painting
This reverts an attempt at saving texture memory that was introduced
recently in 16fa2100. It was misguided because the same texture may be
needed in the next frame if a window has multiple previews visible on
screen at once (gnome-shell's overview). Keeping the mipmaps around
seems to reduce the peak render times of the overview by roughly 5%-10%.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2598>
2022-08-30 14:50:26 +00:00
Daniel van Vugt
8e2085dad9 backends/native: Add xlnx to the atomic deny list
Although its atomic KMS support seems to work at first, mode sets to
anything other than the Xilinx preferred max resolution of 2048x1280
would result in a hang. The xlnx kernel driver is given:
`DRM_MODE_ATOMIC_ALLOW_MODESET | DRM_MODE_PAGE_FLIP_EVENT`
and it does complete the mode set without error, but page flip events
never arrive and so you're frozen on the first frame.

Revert to legacy KMS which has no such problem with non-default modes.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2596>
2022-08-26 18:39:12 +08:00
Carlos Garnacho
9d558e334c wayland: Unlink surface listener when freeing token
If the token ended up consumed and freed, we might leave a dangling
destroy listener after freeing the token struct.

Fixes: ed516dde89 (wayland: Add destruction listener to activation token surface)
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2594>
2022-08-25 11:15:01 +02:00
Jonas Dreßler
84396baafb stage: Mark stage as active on wayland when it has key-focus
The "activate" and "deactivate" signals on ClutterStage are used by
Cally to track the key-focus when the user is interacting with shell UI.
key-focus only gets tracked while the stage is activated.

Wayland has no concept of the stage receiving focus or not, so right now
the activation state is bound to whether there's a focus_window in
meta_display_sync_wayland_input_focus(). Since display->focus_window is
set pretty much all the time, this effectively binds activation state to
whether the stage holds a grab or not. This is almost good enough, but
it misses cases where key-focus is on the stage without a grab, for
example when keyboard-navigating the panel after using Ctrl+Alt+Tab.

It seems to make more sense to bind the activation state to whether
key-focus is set to an actor or to NULL, so let's do that instead.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2329>
2022-08-24 10:00:22 +00:00
Carlos Garnacho
ed516dde89 wayland: Add destruction listener to activation token surface
In the timespan between an activation token being created and the
token being used by the activated application, the surface that started
the activation request may end up destroyed/disposed.

In that case, the token would be left with a stale surface pointer,
maybe causing crashes later on. Set up a destroy notification listener
so that we do know to unset the token surface if that situation arises,
this will result in Mutter not considering the token activatable, thus
maybe issuing the "Application needs attention" notification if the
activated surface did not immediately get focus. In any case this is
better than a compositor crash.

A typical situation where this may happen is "Open With..." dialogs,
since those don't live long after launching the application.

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2390
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2592>
2022-08-23 22:56:42 +02:00
Carlos Garnacho
9c402bd091 wayland: Ensure to remove destroy listener for MetaWaylandBuffer
Avoid the chance of invalid memory access by leaving the wl_listener
behind when handling the destroy notification.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2588>
2022-08-23 17:06:07 +00:00
Carlos Garnacho
f4f39d3a2c wayland: Ensure to unlink destroy listeners for subsurfaces
There is some surface tracking going on here, and all notify handlers
are possibly leaving the linked wl_listener behind. Ensure it is unlinked
in all destroy notification functions.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2588>
2022-08-23 17:06:07 +00:00
Carlos Garnacho
51064c1b4e wayland: Ensure to unlink destroy listeners after destruction
This is missed in some wl_listeners added
through wl_resource_add_destroy_listener(). Ensure this is done consistently
for all notify functions.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2588>
2022-08-23 17:06:07 +00:00
Daniel van Vugt
0cfd0c3a8c monitor-store-unit-tests: Verify <maxbpc> XML is stored correctly
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2412>
2022-08-19 17:07:13 +00:00
Daniel van Vugt
26a9dd7f88 monitor-unit-tests: Add a basic set-and-get test for max_bpc
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2412>
2022-08-19 17:07:13 +00:00
Daniel van Vugt
cc203e241d monitor-test-utils: Add max_bpc field
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2412>
2022-08-19 17:07:12 +00:00
Daniel van Vugt
03336788fb monitor-config-store: Add parsing support for "maxbpc" in monitors.xml
For example:

  <monitor>
    ...
    <maxbpc>8</maxbpc>
  </monitor>

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2412>
2022-08-19 17:07:12 +00:00
Daniel van Vugt
d39137c631 monitor-manager-xrandr: Changing "max bpc" changes output assignment
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2412>
2022-08-19 17:07:12 +00:00
Daniel van Vugt
99d84ae1cc output-xrandr: Add support for the "max bpc" KMS connector property
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2412>
2022-08-19 17:07:12 +00:00
Daniel van Vugt
978cbe2da4 onscreen-native: Set max_bpc with mode sets
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2412>
2022-08-19 17:07:12 +00:00
Daniel van Vugt
f19b350c94 output-kms: Add max_bpc support
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2412>
2022-08-19 17:07:12 +00:00
Daniel van Vugt
4eef54f80a monitor-config-manager: Add a max_bpc field to MetaMonitorConfig
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2412>
2022-08-19 17:07:12 +00:00
Daniel van Vugt
a907cef905 monitor: Add function meta_monitor_get_max_bpc()
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2412>
2022-08-19 17:07:12 +00:00
Daniel van Vugt
6ff0d600c3 output: Add max_bpc support
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2412>
2022-08-19 17:07:12 +00:00
Daniel van Vugt
e0e10c29d9 monitor-manager-private: Add max_bpc to MetaOutputAssignment
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2412>
2022-08-19 17:07:12 +00:00
Daniel van Vugt
b6dbb686e2 kms-impl-device-simple: Apply META_KMS_CONNECTOR_PROP_MAX_BPC
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2412>
2022-08-19 17:07:12 +00:00
Daniel van Vugt
0cc4815837 kms-impl-device-atomic: Apply META_KMS_CONNECTOR_PROP_MAX_BPC
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2412>
2022-08-19 17:07:12 +00:00
Daniel van Vugt
2b561a369c kms-update: Add function meta_kms_update_set_max_bpc
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2412>
2022-08-19 17:07:12 +00:00
Daniel van Vugt
33ee155630 kms-connector: Add "max bpc" property
This limits the bits-per-channel colour depth of the signal that
the connector is allowed to output.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2412>
2022-08-19 17:07:12 +00:00
Daniel van Vugt
f765437410 kms-types: Add type MetaKmsRange
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2412>
2022-08-19 17:07:12 +00:00
Daniel van Vugt
f760b47a3c kms-impl-device: Remember the min/max values for a DRM_MODE_PROP_RANGE
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2412>
2022-08-19 17:07:12 +00:00
Simon McVittie
64a67aa00b backend/native: Don't warn on EACCES if headless
Since commit 1bf70334 "tests/runner: Make test runner use the headless
backend", tests are run with the native backend in headless mode, which
will attempt to open each GPU and show a warning (fatal during tests)
if it cannot.

However, in headless mode we might not be logged in on any seat (for
example we might be logged in via ssh instead), which means we might
legitimately not have permission to use any GPUs, even if they exist.
Downgrade the warning to a debug message in this case.

Resolves: https://gitlab.gnome.org/GNOME/mutter/-/issues/2381
Signed-off-by: Simon McVittie <smcv@debian.org>
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2584>
2022-08-19 16:07:23 +00:00
Daniel van Vugt
a2636ce2df tests: Expect <rate> to always have three decimal places (rounded)
At least when the XML is written by mutter it will have three decimal
places. We don't enforce any precision requirements when reading the
XML.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2465>
2022-08-19 15:28:56 +00:00
Daniel van Vugt
8711d44991 monitor-config-store: Only save 3 decimal places of <rate>
Because elsewhere we already ignore precision beyond that. It's also
easier to read rounded to 3 places than 15 decimal places.

  59.996623992919922  ->  59.997

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2465>
2022-08-19 15:28:56 +00:00
Daniel van Vugt
8e5f5fbe54 monitor-config-manager: Only report Hz to 3 decimal places
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2465>
2022-08-19 15:28:56 +00:00
Daniel van Vugt
b5169f2567 output-kms: Change SYNC_TOLERANCE from 1% to 0.001Hz
1% of 60Hz is 0.6Hz so it was losing the usual two decimal places
precision you would expect as a minimum. Now we use three to be sure.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2465>
2022-08-19 15:28:56 +00:00
Daniel van Vugt
f6e24c6293 monitor: Generate mode IDs with 3 decimal places for Hz
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2465>
2022-08-19 15:28:56 +00:00
Jonas Ådahl
9c1cd66d41 tests/kvm/virtme-runner: Add more logging
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2561>
2022-08-19 15:40:00 +02:00
Jonas Ådahl
b50353ba23 Add 'catch' option
The catch option makes test run via 'catch'[1], which will log
backtraces whenever an abort or segmentation fault happens in any of the
subprocesses. The aim is to enable this when running in CI to help
debugging crashes that only tend to happen in CI.

While it's possible to wrap the whole meson command in 'catch', doing so
doesn't cover the KVM tests, so this option is added instead that covers
both cases.

[1] https://gitlab.gnome.org/jadahl/catch/

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2561>
2022-08-19 15:39:31 +02:00
Jonas Ådahl
510a938069 tests/pointer-constraints: Destroy client after test
Otherwise the client might exit non-cleanly due to a broken pipe.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2561>
2022-08-19 15:02:38 +02:00
Jonas Ådahl
9988dc344d tests/test-client: Wait for processs to exit before shutting down
This makes sure the client has exited cleanly before the Wayland server
is teared down, causing the client to potentially end up with a broken
pipe.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2561>
2022-08-19 15:02:38 +02:00
Jonas Ådahl
d2c4914546 tests/dbus-runner: Don't consume options after '--'
This allows passing arguments to test cases that conflict with
meta-dbus-runner.py.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2561>
2022-08-19 15:02:25 +02:00
Jonas Ådahl
22a46d4f7b tests/kvm: Allow passing multi argument test cases
This means we can wrap the test case in another executable, or pass
arguments to test case executables.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2561>
2022-08-19 14:58:10 +02:00
Jonas Ådahl
2df9ccd598 tests/kvm: Pass test executable last
This is in preparation to pass an arbitrary command with arguments.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2561>
2022-08-19 14:58:10 +02:00
Florian Müllner
d371c18035 tests/kvm: Disable -Werror when building kernel image
We aren't kernel developers, and we won't fix any new warnings
that appear after a compiler update, in particular when building
a CI image.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2430>
2022-08-18 15:02:12 +00:00
Simon McVittie
2b06e1bbad tests: Give mutter-test-runner the RUNPATH to find Clutter
Until recently, mutter-test-runner called into libraries that
indirectly depend on (mutter's fork of) Clutter, but did not actually
call into Clutter itself. Commit 1bf70334 "tests/runner: Make test
runner use the headless backend" gave it a direct call into Clutter,
which means the runtime linker will fail unless the executable's
RUNPATH is sufficient to find Clutter.

For future-proofing, do the same for the other test executables.

Resolves: https://gitlab.gnome.org/GNOME/mutter/-/issues/2389
Signed-off-by: Simon McVittie <smcv@debian.org>
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2581>
2022-08-17 17:14:26 +01:00
Steev Klimaszewski
642791673c Update meta connector types enum
This adds the 4 new connector types that mutter didn't know about from
drm_mode.h in the kernel.

Noticed because mutter kept crashing when plugging in a USB-C adapter to
use an external monitor.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2577>
2022-08-17 08:37:35 +00:00
Salman Malik
e2d4da8562 screen-cast-stream: Embed the wayland output name to streams
If a screencast session is screencasting from multiple monitors,
it is not possible to distinguish which stream (or PipeWire stream
node id) belongs to which connected monitor (such information may be useful
to the caller e.g. caller might want to embed the stream in a window
and name it after the monitor connector, for example). This change adds
optional metadata for monitor streams to also return the wayland output
name with the stream.

Ideally, this metadata should equip the caller to get more information about
display from the following Wayland interfaces:

https://wayland.freedesktop.org/docs/html/apa.html#protocol-spec-wl_output
https://wayland.app/protocols/xdg-output-unstable-v1

Related:
- https://github.com/flatpak/xdg-desktop-portal/pull/832
- https://gitlab.gnome.org/GNOME/xdg-desktop-portal-gnome/-/merge_requests/48

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2540>
2022-08-15 17:01:27 +00:00
Florian Müllner
dcd3bccae5 monitor-manager: Expose :night-light-supported property
We currently only expose this information over D-Bus, but now
gnome-shell needs it as well for the corresponding quick settings
toggle.

We don't want to talk D-Bus to ourselves, so make the information
available as a property as well.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5752

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2576>
2022-08-15 12:50:32 +00:00
Jonas Ådahl
6de2e0a320 tests: Add test for remembering configured monitor scales
Tests that switching using the same API used by the key binding
remembers the monitor scale from previous configurations.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2479>
2022-08-15 10:00:25 +00:00
Jonas Ådahl
3dca01a06c monitor-config-manager: Use scale from past configs when generating
When we e.g. generate switch configs (i.e. the ones from pressing the
Super+P or the switch-config key on laptops), try a bit harder to find a
"good" monitor scale.

With "good", it means pick a scale that was used in a previous
configuration. In practice, this means that if you for example have
configured your external monitor to use a specific scale, then pressed
e.g. "built in only", and then switched back to e.g. "external only" or
"linear", the generated configuration will use the scale that was
previously configured.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2479>
2022-08-15 10:00:25 +00:00
Jonas Ådahl
4580bca664 monitor: Add mode spec helper checking resolution similarness
If two modes are roughly the same, they should probably use the same UI
scaling factor. I.e. for the same monitor, if a 4K mode was configured to
have a certain scaling factor, and we generate a new configuration with
a similar sized 4K mode, we should re-use the scale previously
configured; however if we e.g. go from a 4K mode to a FHD mode, we
shouldn't.

This allows implementing better hueristics when using the switch-config
feature, where we'd be less likely to loose the for a certain monitor
mode combination previously configured scaling factor.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2479>
2022-08-15 10:00:25 +00:00
Jonas Ådahl
71bf31da83 monitor-config-manager: Use helper to calculate mirroring scale
This will eventually help with better hueristics for finding a good
scale. It currently doesn't change much, but the helper will later gain
more functionality that will also help when coming up with mirroring
configs.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2479>
2022-08-15 10:00:25 +00:00
Jonas Ådahl
8698b4a493 monitor-config-manager: Mark the mirroring logical monitor as primary
The resulting logical monitor was eventually marked as primary anyway,
but without the config being marked as such, various primary properties
was not set e.g. the one on the MetaOutput. Also, tests would fail.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2479>
2022-08-15 10:00:25 +00:00
Jonas Ådahl
5fb4a2c286 monitor-config-manager: Fix layout size with scaled mirroring
The dimension of the logical monitor layout was not scaled according to
the scale, meaning generated mirror monitor configurations were broken.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2479>
2022-08-15 10:00:25 +00:00