1
0
Fork 0
Commit graph

2485 commits

Author SHA1 Message Date
columbarius
30b5229e0e screen-cast-stream: Use SPA_META_Header
With this header we can set a flag to signal that the whole buffer is
corrupt and should be ignored. With this we can cater to all cases:
* Window buffer fine, but cursor broken:
  Use the spa_meta_cursor properties like id or offset accordingly
* Window buffer broken, but cursor fine:
  Use the chunk flags
* Both are broken / the dequeued buffer is not usable
  Use the spa_meta_header flag

Additionally clients can now check if a buffer contains spa_meta_header
data and can thus only check for the new or the old behaviour.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2516>
2022-07-21 22:29:45 +00:00
Michel Dänzer
10c7ab2dec cursor-renderer/native: Fix type in unset_crtc_cursor_renderer_privates
Since the commit below, meta_crtc_kms_get_cursor_renderer_private has
returned a CrtcCursorData pointer, but this code was still treating it
as a MetaDrmBuffer pointer.

Fixes: fea8ebcca9 ("cursor-renderer/native: Store struct in CRTC private")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2524>
2022-07-21 21:03:18 +00:00
columbarius
82fd5cbdbd screen-cast-stream: Use flag to signal failed recording
PipeWire supports flags to signal a corrupted buffer. We should use the
flag SPA_CHUNK_FLAG_CORRUPTED for `chunk->flags` instead of setting
`chunk->size = 0` since the size isn't well defined for arbitrary dmabufs
and should be set to 0.
Sadly clients like obs are using a chunk size of 0 to decide if a buffer
should be imported. Thus we should offer both until clients are using
the flag.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2323>
2022-07-15 02:03:44 +02:00
José Expósito
5171e5b795 backends/native: Migrate discrete scroll
Change meta_seat_impl_notify_discrete_scroll_in_impl to receive 120
based values and report high-resolution scroll values as smooth scroll.

Notify discrete scroll only when the accumulated value reach 120.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1962>
2022-07-14 22:29:56 +00:00
José Expósito
a1c50194a9 backends/native: Migrate continuous scroll
In order to get the delta X/Y value of the
LIBINPUT_EVENT_POINTER_SCROLL_FINGER
or LIBINPUT_EVENT_POINTER_SCROLL_CONTINUOUS events the new function
libinput_event_pointer_get_scroll_value should be used instead of
libinput_event_pointer_get_axis_value.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1962>
2022-07-14 22:29:56 +00:00
José Expósito
5d884d49b5 backends/native: Deprecate LIBINPUT_EVENT_POINTER_AXIS
Ignore deprecated LIBINPUT_EVENT_POINTER_AXIS events and handle
LIBINPUT_EVENT_POINTER_SCROLL_WHEEL,
LIBINPUT_EVENT_POINTER_SCROLL_FINGER and
LIBINPUT_EVENT_POINTER_SCROLL_CONTINUOUS instead.

The scroll source is now encoded in the event type making
libinput_event_pointer_get_axis_source and translate_scroll_source
redundant.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1962>
2022-07-14 22:29:56 +00:00
Pascal Nowack
ab3931fec8 backends/screen-cast-stream-src: Set correct stride when using dmabufs
Currently, mutter hardcodes the stride of all recorded images in a
screencast to width * 4.
While this stride is valid for general memory buffers, it is not
necessarily valid for dmabuf buffers, as the driver may need a specific
alignment of the stride.
This can currently result into import failures, e.g. when using the AMD
driver.

To fix this issue, retrieve the actual dmabuf stride, when using dmabuf
screencasts, and set it as the stride value in the PipeWire buffer.

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1913
Fixes: https://gitlab.gnome.org/GNOME/gnome-remote-desktop/-/issues/101
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2513>
2022-07-14 20:09:07 +02:00
Sebastian Keller
fe0a383d6f pointer-constraints/native: Fix borders array memory leaks
The borders arrays were not (fully) freed when going out of scope.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2337
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2497>
2022-07-06 19:27:20 +00:00
Sebastian Wick
14b7da4292 tests/edid: Test EDID CTA-861 parsing code
Parses a real-world EDID blob with CTA-861 EDID extension and compares
it to edid-decode output.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2351>
2022-07-04 14:54:11 +00:00
Sebastian Wick
64362fcd76 edid: Parse CTA-861 HDR Static Metadata Data Block
Extract the supported HDR metadata type, supported Transfer Functions,
and display luminance characteristics.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2351>
2022-07-04 14:54:11 +00:00
Sebastian Wick
80626edfea edid: Parse CTA-861 Colorimetry Data Block (CDB)
Parses the CTA-861 extensions data blocks to extract the supported
colorimetry which can be set with the KMS connectors `Colorspace`
property.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2351>
2022-07-04 14:54:11 +00:00
Sebastian Wick
d76f9e6c4a edid: Parse CTA-861 EDID extension
This adds support for E-EDID extensions. Tags are allocated by VESA and
the CTA has such an extension defined in CTA-861.

The switch in `decode_ext_cta` is empty in this commit because we don't
parse any CTA-861 data blocks, yet.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2351>
2022-07-04 14:54:11 +00:00
Sebastian Wick
97c0d17596 edid: Fix EDID parsing function signatures
Parsing functions return a boolean so change the return type to reflect
this.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2351>
2022-07-04 14:54:11 +00:00
Jonas Ådahl
de2443bc3e edid: Prepare types for wider exposure
The EDID code is copy from elsewhere, without adapting to conventions
regarding e.g. API and types. Clean this up a bit, as EDID information
will be kept around longer when possible, to be used e.g. by color
management.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2351>
2022-07-04 14:54:11 +00:00
Jonas Ådahl
43860110ff output/kms: Replace common mode bandwidth check with clock check
The pixel clock determines how fast pixels can be processed. When adding
non-native common modes, avoid adding modes that exceed the max pixel
clock frequency of the native modes. Avoiding these avoids potential
mode setting failures where the GPU can't handle the modeline since the
configured pixel clock is too fast. This replaces the "bandwidth" check
which used the number of pixels and refresh rate, which wasn't enough to
avoid incompatible modes.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2492>
2022-07-01 16:13:18 +02:00
Jonas Ådahl
53b52e26f5 screen-cast/monitor: Always use clutter_stage_paint_to_framebuffer()
'screen-cast/monitor-src: Use clutter_stage_paint_to_buffer'
(6c818cd8d5) made the non-dma-buf path use
clutter_stage_paint_to_buffer() to avoid running into direct scanout
issues. At a glance, the dma-buf paths didn't have the same issue since
it explicitly handled dma-bufs by blitting them.

What it also did was move the recording to an idle callback, to avoid
paint reentry issues. A side effect of this, however, is that it also
broke the dma-buf paths, as they rely on the back buffer existing, and
the stage view direct scanout already being setup, which it isn't in an
idle callback.

Fix this by using the dma-buf variant of
clutter_stage_paint_to_buffer(): clutter_stage_paint_to_framebuffer().
This has some negative performance impact, but we can't use
cogl_blit_framebuffer() when using an idle callback for recording.

Potential performance improvements to make things work more as they did
before is to enhance 'cogl_blit_framebuffer()' a bit, making it a vfunc
that could be implemented by MetaOnscreenNative. A flag to say whether
to look at the back or front buffer would let MetaOnscreenNative know
whether to use the already committed-to-KMS buffer, or the current back
buffer.

Fixes: 6c818cd8d5
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2282
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2462>
2022-06-28 09:54:40 +00:00
Olivier Fourdan
1c16e1cb9c backends: Move MetaKeyboardA11yFlags to a public header
The MetaKeyboardA11yFlags are used by gnome-shell to show a dialog
whenever a keyboard accessibility feature is switched using the
keyboard.

Unfortunately, commit c3acaeb25 renamed the Clutter flag to Meta and
moved them to a private header. As a result, gnome-shell do not show any
dialog anymore when a keyboard accessibility feature is activated.

Move the MetaKeyboardA11yFlags definition to a public header so that
gnome-shell can use it.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2306
Fixes: c3acaeb25 - backends: Move keyboard a11y into backends
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2463>
2022-06-14 18:04:05 +02:00
Jonas Ådahl
6d46ffccbc pointer-constraints: Move min edge distance from backend to Wayland
The min distance to the right/bottom edge depends on Wayland concepts
(wl_fixed_t) and eventually geometry scale. Move the logic the Wayland
side of the pointer constraints machinery to avoid the backend trying to
figure this out without the proper data.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2460>
2022-06-13 18:38:50 +00:00
Jonas Ådahl
94aaa65bd2 pointer-constraints/native: Remove old clutter float math work around
There were some coordinate nudging to avoid running into Clutter
floating point math issues related to coordinate transformations. Over
the years these things have improved, especially with the move to
graphene, so remove the old work around.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2460>
2022-06-13 18:38:50 +00:00
Sebastian Wick
a49c4e188a backends/native: Use the PropTable to look up KMS values
We already look up all the metadata and values in the
MetaKmsConnectorPropTable so we can just use them instead of looking it
all up again.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2379>
2022-06-10 17:49:07 +00:00
Sebastian Wick
4e3f3842a1 backends/native: Use MetaKmsPlaneRotation in plane updates
The ImplDeviceAtomic converts the MetaKmsPlaneRotation back to the
concrete KMS value. The MetaMonitorTransform is always directly
converted to a MetaKmsPlaneRotation.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2379>
2022-06-10 17:49:07 +00:00
Sebastian Wick
981524c268 backends/native: Update PropTable on hotplug and remove parse callback
Updating the PropTable has the side effect that the parse callback now
also gets called on hotplug but it is used to initialize data. The parse
callbacks are moved to the read_state functions which are aware if this
is an initializing call or just an update.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2379>
2022-06-10 17:49:07 +00:00
Sebastian Wick
1e06b346cb backends/native: Store Enum and Bitmask information in MetaKmsProp
Add functions for converting between the values used by DRM and the
enums/bitmasks used by mutter.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2379>
2022-06-10 17:49:07 +00:00
Sebastian Wick
9519a84967 backends/native: Define all KMS properties in PropTable we actually use
Currently those properties are looked up manually or fixed values are
used when they should be looked up. The following commits will actually
make use of this.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2379>
2022-06-10 17:49:07 +00:00
Jonas Ådahl
3776f9df8c x11/clutter-backend: Remove unused XSynchronize() call
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2444>
2022-06-03 13:43:26 +00:00
Jonas Ådahl
fdde7e0f37 x11: Let X11 connection owners call XSynchronize() themselves
Only make the context carry the boolean state, but move the two libX11
calls into their corresponding connection handler objects.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2444>
2022-06-03 13:43:26 +00:00
Dor Askayo
a0ff90a329 kms/page-flip: Add a debug print with page flip event timings
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2439>
2022-06-03 06:55:28 +00:00
Jonas Ådahl
16af2e407b gpu/xrandr: Gracefully handle 0.0 refresh rate
We don't make use of the refresh rate in any useful way in the X11, and
in this case we just ended up with warnings since the refresh rate was
NaN. Fix this by making it 0.0 to mean "no refresh rate". This also is
what 'xrandr' itself reports.

Fixes warnings when launching 'mutter --x11' in Xvfb.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2434>
2022-06-02 17:19:42 +00:00
Jonas Ådahl
f5887a6258 monitor-manager: Make warning message less confusing
It talked about KMS state, which was a bit unexpected when debugging the
X11 backend.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2434>
2022-06-02 17:19:42 +00:00
Jonas Ådahl
c9960850c8 tests/kms/render: Add direct scanout test case
This adds a minimalistic fullscreen direct scanout test case, that runs
on vkms. It doesn't use EGL, and it uses uninitialized memory, thus it
lacks any kind of implicit synchronization, but it does test that the
scanout selection paths are working.

What is tested is:

  * DMA buffer allocated using gbm on top of VKMS
  * Buffer passes a mode setting TEST_ONLY check
  * Paint is omitted
  * Correct buffer active in KMS after presentation

What isn't yet tested:

  * Implicit synchronization related behavior
  * Presented pixel content

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2417>
2022-06-02 08:59:13 +00:00
Jonas Ådahl
a2ebd10f04 kms/crtc: Determine gamma support given the gamma length
The property doesn't necessarily exist when using drivers that doesn't
support atomic mode setting, and the way it worked will break night
light and other gamma related features. This makes things use the gamma
length; if it is higher than 0, it definitely supports it one way or the
other, i.e. GAMMA_LUT with the atomic backend, and drmModeCrtcSetGamma()
with the legacy/simple backend.

Fixes: 364572b95c
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2287
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2435>
2022-05-28 18:29:13 +00:00
Jonas Ådahl
9001fa9717 kms/crtc: Always read the gamma state
It doesn't depend on whether the CRTC is active or not, so always read
it. This is also useful to know whether a CRTC supports gamma, before it
is being turned on, without relying on the existance of properties.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2435>
2022-05-28 18:29:13 +00:00
Bilal Elmoussaoui
c861101ae6 backend: Check if the gsettings scheme exists
Mutter makes use of a gsettings scheme that comes from
gnome-settings-daemon to check for the screen orientation.
In use cases where gnome-settings-daemon is not available,
this would lead to a crash as the key doesn't exists

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2398>
2022-05-17 11:24:07 +02:00
Jonas Ådahl
8fdb80a718 monitor-manager: Add NightLightSupported property to DisplayConfig
This checks whether it's possible to set a CRTC GAMMA_LUT, which is what
is necessary to implement night light.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2310>
2022-05-17 08:42:25 +00:00
Marco Trevisan (Treviño)
c93e402a89 monitor-manager: Ensure monitors settings after backend has been updated
The monitors settings such as the privacy screen property is propagated
to the monitors via kms updates, however during initialization and
on monitors changes, we end up clearing the pending KMS updates because
such settings are added to the queue before the backend has fully
initialized the monitors, and this may lead to discarding all the
pending updates, including the one we've just planned.

To avoid this, move settings applications after we've both initialized
the backend and notified it about changes.

Also avoid to try set the settings during actual initialization, but
delay that after post-init.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2372>
2022-05-11 18:13:46 +00:00
Dor Askayo
61c9e344e4 screen-cast/src: Avoid undefined behavior with GSource
Follow the existing convention in Mutter and avoid downcasting
custom GSource structs.

This fixes the following warning:
    ../src/backends/meta-screen-cast-stream-src.c:1301:20: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
     1301 |   g_clear_pointer ((GSource **) &priv->pipewire_source, g_source_destroy);
    /usr/include/glib-2.0/glib/glib-typeof.h:36:36: note: in definition of macro ‘glib_typeof’
       36 | #define glib_typeof(t) __typeof__ (t)
          |                                    ^
    ../src/backends/meta-screen-cast-stream-src.c:1301:3: note: in expansion of macro ‘g_clear_pointer’
     1301 |   g_clear_pointer ((GSource **) &priv->pipewire_source, g_source_destroy);
          |   ^~~~~~~~~~~~~~~

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2406>
2022-05-11 15:01:31 +00:00
Jonas Ådahl
5404eb34f8 kms/impl/simple: Make sure cursor buffers have fb ids
'kms/impl-device/simple: Get the buffer handle from MetaDrmBuffer'
changed how fb ids are generated, but it only made it fully work with
atomic mode setting. For legacy/simple mode setting, it only handled the
primary plane buffer, not the hardware cursor.

Fix this by making sure the fb id is generated also in the legacy mode
setting case.

Fixes: ea39142da2
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2250
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2397>
2022-05-03 21:45:19 +00:00
Jonas Ådahl
b1be1e86e9 screen-cast: Always wait for an update before sending cursor-only frames
With the unthrottled input emission, we ended up often getting the
cursor updates long before any damage had been posted, meaning that if
you moved around the mouse pointer where the mouse had a high enough
refresh rate, we'd effectively stall the screen cast stream by only
sending cursor updates and nothing else.

Fix this by scheduling an update when we get a cursor update, then
sending a cursor-only frame after any damage and relayout has been
processed, but only if there is no queued damage that will cause an
actual repaint.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2393>
2022-04-29 20:51:25 +00:00
Jonas Ådahl
c5410b61d2 screen-cast/window/src: Fix signal handler types
Should be gulong, not unsigned long.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2393>
2022-04-29 20:51:25 +00:00
Jonas Ådahl
2cfd4f325b cursor-renderer/native: Support allocating dumb buffers
This makes it possible to allocate HW cursor without a gbm_device, e.g.
when using EGLStream/EGLDevice.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1980
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2275>
2022-04-29 19:35:35 +00:00
Jonas Ådahl
42ed40ac52 cursor-renderer/native: Move buffer creation to helper
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2275>
2022-04-29 19:35:35 +00:00
Jonas Ådahl
ea39142da2 kms/impl-device/simple: Get the buffer handle from MetaDrmBuffer
This avoids buffer implementation specific code where it shouldn't
matter.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2275>
2022-04-29 19:35:35 +00:00
Jonas Ådahl
22d11eb9cb drm-buffer: Keep track of handle as well
This handle is used by the legacy KMS API; lets avoid having to have GBM
specific code where this is done by letting the MetaDrmBuffer API, that
already has this information, expose it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2275>
2022-04-29 19:35:35 +00:00
Jonas Ådahl
b2eec49873 screen-cast: Remove stray newline
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2391>
2022-04-29 18:58:38 +00:00
Jonas Ådahl
5da8e5a9d5 barrier: Remove _ prefix in various places
It's not a convention used anywhere else anymore, lets remove the
prefixes.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2391>
2022-04-29 18:58:38 +00:00
Jonas Ådahl
1a5647e00c barrier: Some coding style cleanup
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2391>
2022-04-29 18:58:38 +00:00
Jonas Ådahl
358df1c569 screen-cast/src: Always allow MemFd buffer types to be selected
Just because the PipeWire client can handle DMA buffers, doesnt mean we
should not advertise support for MemFd.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2383>
2022-04-22 12:08:04 +00:00
Jonas Ådahl
2b4a24132b screen-cast: Test allocate DMA buffer with implicit API
DMA buffers might be allocatable, but it doesn't mean the driver doesn't
fail when we try to allocate a buffer with an implicit modifier. Using
the proprietary NVIDIA driver for example, it will fail. Lets catch this
up front and avoid advertising DMA buffer support when we know it won't
work.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2383>
2022-04-22 12:08:04 +00:00
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