1
0
Fork 0
Commit graph

1174 commits

Author SHA1 Message Date
Sebastian Wick
43ae37a93e backends/native: Update cursor also when scaled or transformed
MetaCursorRendererNative only updates the cursor state when the
underlying texture changes. The cursor scale and transform do not
trigger updates. This results in wrong cursor orientations on rotated
displays. Use both texture changes and scale and transformation changes
to figure out when to update the cursor state.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2363>
2022-04-21 11:23:15 +00:00
Łukasz Spintzyk
ad838ec540 renderer/native: Restore EGL state after creating secondary GPU state
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2347>
2022-04-20 09:30:04 +00:00
Daniel van Vugt
af7e116b94 cursor-renderer/native: Remove unused DRM_CAP_CURSOR_{WIDTH,HEIGHT}
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2361>
2022-04-20 08:28:06 +00:00
Daniel van Vugt
be9deeba09 crtc/kms: Don't add gamma to the update if unsupported by the CRTC
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2197
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2360>
2022-04-19 07:58:31 +00:00
Daniel van Vugt
364572b95c kms/crtc: Add function meta_kms_crtc_has_gamma
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2360>
2022-04-19 07:58:31 +00:00
Daniel van Vugt
cc20584032 kms/crtc: Add debug logging of supported vs unsupported properties
Unsupported properties are particularly common in an Nvidia/hybrid
setup so we don't want to make it a warning that's always visible.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2360>
2022-04-19 07:58:31 +00:00
Daniel van Vugt
e3cba9f2d8 kms/crtc: Fix typo s/proporties/properties/
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2360>
2022-04-19 07:58:31 +00:00
Daniel van Vugt
dd94c448e9 kms/device: Disable modifiers when !DRM_CAP_ADDFB2_MODIFIERS
Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2210
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2359>
2022-04-08 16:20:34 +00:00
Daniel van Vugt
11e6100226 kms/impl-device: Add addfb2_modifiers to MetaKmsDeviceCaps
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2359>
2022-04-08 16:20:34 +00:00
Daniel van Vugt
9a23ed98e7 onscreen/native: Fix typo in log message "the the"
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2357>
2022-04-04 17:36:37 +08:00
Daniel van Vugt
8354289650 onscreen/native: Fall back if COPY_MODE_SECONDARY_GPU fails to init
This can happen if we've got a GBM driver that is incomplete or
buggy for any reason. Currently this includes the Nvidia driver
when used as a secondary GPU, and as soon as they fix that it will
use the fast path instead.

Falling back means we can still use it as a KMS device with all rendering
done on the primary GPU instead. Just like a DisplayLink.

It's slow, but at least the screens all light up now and you get a
usable desktop. Surprisingly it's still a better experience than using
Xorg, maybe because we can flip the outputs independently with the
native backend.

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2166,
       https://gitlab.gnome.org/GNOME/mutter/-/issues/2182,
       https://launchpad.net/bugs/1959888,
       https://launchpad.net/bugs/1964037

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2341>
2022-03-30 12:36:05 +00:00
Daniel van Vugt
41bfabad96 onscreen/native: Don't try rendering on a secondary GPU without EGL
We rather confusingly still call a secondary display card that is
GPU-less (DisplayLink or other basic KMS device) a "secondary GPU",
so just because secondary_gpu_state is non-NULL doesn't mean we
can use it for rendering. The clearest indication of this is when
there is no EGL surface.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2341>
2022-03-30 12:36:05 +00:00
Carlos Garnacho
1f3fb8441f backends/native: Assign capabilities to input devices
These are extracted from the individual libinput_devices.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2331>
2022-03-30 12:06:52 +00:00
Carlos Garnacho
842295838f backends/native: Make function to determine ClutterInputDeviceType private
We do not need to open code the ClutterInputDeviceType fetching from a
libinput_device, since we already created a native ClutterInputDevice that
has the right type.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2331>
2022-03-30 12:06:52 +00:00
Ivan Molodetskikh
690b8806dd backends/native: Change uint32_t modifiers to uint64_t
They were erroneously cast to uint32_t. In particular this prevented the
invalid modifier from working as it is equal to a 64-bit -1.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2322>
2022-03-06 16:56:27 +03:00
Jonas Ådahl
46f81afb3b kms/impl-device/atomic: Fix function type signature
The property enum type was wrong.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2319>
2022-03-04 23:12:24 +00:00
Jonas Ådahl
339c315ed9 input-settings/native: Fix switch fallthrough warning
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2319>
2022-03-04 23:12:24 +00:00
Jonas Ådahl
79319a3a91 barrier/native: Fix warning about implicit enum conversion
Also add static asserts to make sure the values match so casting can be
done.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2319>
2022-03-04 23:12:24 +00:00
Jonas Ådahl
34d0e68aef virtual-monitor: Add way to change virtual monitor mode
This can be used to change the size of the virtual monitor without
recreating it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2270>
2022-03-04 18:13:45 +00:00
Jonas Ådahl
a97b6560d7 virtual-monitor: Never reuse mode IDs
We'll change mode's on-demand so using IDs identical to the virtual
monitor ID would mean IDs didn't change when changing mode, and that is
rather unintuitive. IDs don't mean much anyhow, just make them grow
within the realm of a 63 bit unsigned integer, as the 64th bit means its
a virtual mode ID. Making sure the ID is in the virtual mode namespace
is handled by meta_crtc_mode_virtual_new().

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2270>
2022-03-04 18:13:45 +00:00
Jonas Ådahl
ee8de0dc83 backend/native: Remove unused ID namespace macros
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2270>
2022-03-04 18:13:45 +00:00
Jonas Ådahl
46a4a080b7 virtual-monitor: Split out mode info into separate struct
Will help when changing virtual monitor modes.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2270>
2022-03-04 18:13:45 +00:00
Ivan Molodetskikh
bcf6ee5e55 Name unnamed sources
These names show up in GLib traces in sysprof, so let's make sure they
exist.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1928>
2022-03-04 10:10:05 +03:00
Daniel van Vugt
b7f7b82b89 onscreen/native: Warn instead of crashing if the frame_info queue is empty
Some Ubuntu systems with mutter 40 and 41 report `maybe_update_frame_info`
crashes with SIGSEGV when `frame_info == NULL`.

The same was reported by @rmader as happening "after wakeup" in testing
(https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1441#note_1301588)
although the Ubuntu reports show it's not related to that MR.

Fixes: https://launchpad.net/bugs/1960585
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2282>
2022-02-14 10:51:18 +00:00
Jonas Ådahl
2a624dbd1e monitor-manager/native: Emit privacy-screen-changed signal later
Make sure the monitor and output state is up to date when we emit the
privacy-monitor-changed signal, otherwise the signal emission code will
try to look up out of date state.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2119
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2280>
2022-02-14 09:29:48 +00:00
Konstantin Kharlamov
338eea7a37 backends/native/meta-seat: Sync keyboard LEDs when changing layout
Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/633
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2279>
2022-02-10 08:11:56 +00:00
Carlos Garnacho
3ab59175c8 backends/native: Fix cursor renderer assignment for tablet devices
We create a cursor renderer per device for those at
meta_seat_native_handle_event_post() with PROXIMITY_IN events, but
the MetaWaylandTabletTool handles the event before that, and goes
with a NULL cursor renderer.

Make MetaBackend::get_cursor_renderer() on the native backend create
those cursor renderers on demand, and only handle PROXIMITY_OUT in
handle_event_post() to dispose those. This makes MetaWaylandTabletTool
happily get a cursor renderer again.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/285>
2022-02-08 14:34:47 +00:00
Jonas Ådahl
52ce81657d backend/native: Only disable dmabuf screen cast when not hw accelerated
We now only enable DMA buffer based PipeWire screen casting if a
format/modifier has been negotiated. This practically means a consumer
is aware about what is needed, and we should not try to predict that it
uses the DMA buffer the right way (i.e. not mmap:ing directly).

However, in case we're not hardware accelerated, we never want to
attempt to use DMA buffer screen sharing, as we want to avoid
compositing into a DMA buffer on such hardware as doing so can be very
slow.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2086>
2022-02-07 19:16:45 +00:00
Jonas Ådahl
49ac60e346 cogl/renderer: Add 'is_dma_buf_supported()' vfunc
Returns TRUE if the active renderer backend can allocate DMA buffers.
This is the case hardware accelerated GBM backends, but FALSE for
surfaceless (i.e. no render node) and EGLDevice (legacy NVIDIA paths).
While software based gbm devices can allocate DMA buffers, we don't want
to allocate them for offscreen rendering, as we really only use these
for inter process transfers, and as buffers allocated for scanout
doesn't use the relevant API, making it return FALSE for these solves
that.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1939>
2022-02-07 10:56:57 +00:00
Daniel van Vugt
c970bb3e6c cogl: Merge FEATURE_ID_GET_GPU_TIME into FEATURE_ID_TIMESTAMP_QUERY
Because both code paths require the existence of `GL_TIMESTAMP[_EXT]`
which is only guaranteed if `ARB_timer_query` (included in GL core 3.3)
is implemented.

We know when that is true because `context->glGenQueries` and
`context->glQueryCounter` are non-NULL. So that is the minimum
requirement for any use of `GL_TIMESTAMP`, even when it is used in
`glGetInteger64v`.

Until now, Raspberry Pi (OpenGL 2.1) would find a working implementation
of `glGetInteger64v` but failed to check whether the driver understands
`GL_TIMESTAMP` (it doesn't).

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2107
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2253>
2022-01-27 22:58:59 +00:00
Jonas Ådahl
2d7a8c3ce9 kms: Don't enter power saving via updates
The way device backends implement power saving differ, and power saving
needs to contain nothing incompatible in the same update. Make it
impossible to e.g. mode set, page flip, etc while entering power save by
not using MetaKmsUpdate's at all for this.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2159>
2022-01-25 15:47:03 +00:00
Jonas Ådahl
2e774e8e14 tests/kms: Check predicted state is correctly predicted
When we're predicting state, i.e. when having posted an update while
avoiding reading KMS state, copy the predicted state, update the actual
state, and check that the predicted state matches the newly updated one.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2159>
2022-01-25 15:47:03 +00:00
Jonas Ådahl
2478000c73 kms: Properly predict power saving effect on tracked state
Entering power saving effectively disables CRTCs, and thus the CRTC id a
connector is associated with. Make sure that the tracked state reflects
this.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2159>
2022-01-25 15:47:03 +00:00
Jonas Ådahl
8ea49fe9d9 kms/connector: Add missing newline
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2159>
2022-01-25 15:47:03 +00:00
Jonas Ådahl
0fab55dbc0 tests/kms/device: Add mode setting test
Checks that the relevant device state is correct after mode setting.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2159>
2022-01-25 15:47:03 +00:00
Jonas Ådahl
feadaacfdd kms/connector: Add getter for preferred mode
This replaces a helper used in tests. The intention is to use it from
other tests, and seemed like a good fit to place it under the KMS
connector object itself.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2159>
2022-01-25 15:47:03 +00:00
Jonas Ådahl
c35e8f5a51 kms: Concentrate update processing in MetaKmsDevice
It was a bit scattered, with it being split between MetaKms and
MetaKmsImpl, dealing with MetaKmsDevice and MetaKmsImplDevice
differentation. Replace this by, for now, single entry point on
MetaKmsDevice: meta_kms_device_process_update_sync() that does the right
thing.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2159>
2022-01-25 15:47:03 +00:00
Jonas Ådahl
43a1ba3432 tests: Add KMS device tests
As other KMS tests, depends on being DRM master and vkms being loaded.

Currently consists of a sanity check that checks for the expected set of
connectors, CRTCs, planes, etc.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2159>
2022-01-25 15:47:03 +00:00
Jonas Ådahl
23a530cb09 monitor-manager/native: Get CRTC gamma from cache if available
Right now gamma is set only via the D-Bus API (from gsd-color), but the
actual gamma isn't right after SetCrtcGamma(), meaning if one would call
GetCrtcGamma() right after setting it, one would get the old result.
Avoid this by getting the "current" CRTC gamma from the cache we manage.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2159>
2022-01-25 15:47:03 +00:00
Jonas Ådahl
cd517216ae kms/impl-device: Clear fd source on prepare-shutdown
This ensures we won't receive any untimely page flip callbacks during
later phases of shutting down.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2159>
2022-01-25 15:47:03 +00:00
Jonas Ådahl
4276e9ddd3 tests/kms-update: Add mode setting sanity tests
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2159>
2022-01-25 15:47:03 +00:00
Jonas Ådahl
65073c145c tests/kms: Add basic plane assignment update tests
Test that adding a couple of plane assignments were correctly added to
the update.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2159>
2022-01-25 15:47:03 +00:00
Jonas Ådahl
758e5e23fa kms/mode: Add width/height getters
This avoids some situations where one would otherwise need to fetch the
drm mode to check the dimensions.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2159>
2022-01-25 15:47:03 +00:00
Jonas Ådahl
de06d5d9e7 kms/update: Add init helper macros for fixed 16 rects
META_FIXED_16_INIT(), taking MetaFixed16's, and META_FIXED_16_INIT_INT()
taking integers, converting them to MetaFixed16.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2159>
2022-01-25 15:47:03 +00:00
Jonas Ådahl
acd51a7e69 tests: Add some basic MetaKmsUpdate unit tests
Mostly rudimentary sanity testing.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2159>
2022-01-25 15:47:03 +00:00
Jonas Ådahl
bf398a5f84 kms/update: Add getter for cursor plane assignment
To be used in tests.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2159>
2022-01-25 15:47:03 +00:00
Jonas Ådahl
501b6f52d3 monitor-manager/native: Fix include macros
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2159>
2022-01-25 15:47:03 +00:00
Marco Trevisan (Treviño)
8cf3485ab0 monitor-manager: Notify privacy screen changes on hotkey press
When privacy screen is changed and this happens on explicit user request
(that is not a setting change) we should notify about this via an OSD.

To perform this, we keep track of the reason that lead to a privacy
screen change, and when we record it we try to notify the user about.

When the hardware has not an explicit hotkey signal but we record a
change we must still fallback to this case.

Fixes: #2105
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1952>
2022-01-25 07:31:19 +00:00
Marco Trevisan (Treviño)
47d7bc7a13 backends/kms: Implement privacy screen handling and setting
Privacy screen events on connector are handled as notification events
that won't cause any monitors reconfiguration but will emit monitors
changed on DBus, so that the new value can be fetched.

We monitor the hardware state so that we can also handle the case of
devices with hw-switchers only.

In case a software state is available it means we can also support
changing the state, and if so expose the state as unlocked.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1952>
2022-01-25 07:31:19 +00:00
Marco Trevisan (Treviño)
4b0a10c562 backends/kms/update: Add ability to remove result listeners
We may need to remove a result listener once we've added it, and before
that it ha been processed, so add support for this.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1952>
2022-01-25 07:31:19 +00:00