1
0
Fork 0
Commit graph

1689 commits

Author SHA1 Message Date
Carlos Garnacho
b9e5a2d6e2 backends/native: Wait to have an stage before emitting CLUTTER_DEVICE_ADDED
During seat initialization, we process early libinput events (adding all known
devices) before the seat gets a stage assigned. This causes warnings when trying
to handle the corresponding CLUTTER_DEVICE_ADDED events, as they are sent
stageless.

As it is definitely too soon to have those events sent meaningfully, filter
those events out and instead handle the CLUTTER_DEVICE_ADDED emission for all
known devices after the seat receives an stage. This makes the events guaranteed
to be emitted early in initialization, but not so soon that they can't be
handled yet.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1472
2020-10-06 13:29:59 +00:00
Carlos Garnacho
089be8b71d backends: Ensure to clear the last updated device on device removal
If the last updated device is removed, ensure that it does result in
a ::last-device-changed with a NULL device.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1460
2020-09-30 18:26:20 +00:00
Carlos Garnacho
16139efa5c backends: Do not use stack-allocated ClutterEvents
Use ClutterEvent* and clutter_event_new() to always allocate events.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1460
2020-09-30 18:26:20 +00:00
Jonas Ådahl
df228e8945 screen-cast/area-src: Clear framebuffer before painting stage
We'll be painting to a framebuffer that may not be completely covered by
the painted areas, meaning the not painted areas would end up undefined,
thus potentially contain garbage or old content.

Avoid this by clearing the framebuffer before painting the stage.

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

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1459
2020-09-30 15:56:07 +00:00
Carlos Garnacho
3a273028ae backends/x11: Set stage on logical keyboard device
Like it's done for the pointer in other places. Without a stage assigned,
some bits (like IM handling) may end up with events ignored, and misbehave.

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1413
2020-09-29 21:26:26 +00:00
Karol Herbst
9b9b912765 backends: force enable modifiers on tagged devices
Some devices can't scanout to linear buffers directly as the hw is not
capable of eg rendering into a linear depth buffer.

Add code to force kms-modifiers on udev taged devices.

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

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1443
2020-09-28 14:00:44 +02:00
Ray Strode
1e78d90a37 barriers: Free backend implementation at dispose time
When a MetaBarrier is first created it allocates a backend
impl object which does the actual heavy lifting.

Unfortunately, that backend object is never freed.

This commit ensures the implementation gets freed when
the barrier object is freed.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1451
2020-09-27 00:38:58 -04:00
Ray Strode
97f10a0d21 barriers: Fix leak in meta_barrier_destroy
meta_barrier_destroy is responsible for removing the extra
reference added in meta_barrier_constructed.

Unfortunately, it fails to do this because of a misplaced early
return statement.

This commit removes the spurious return.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1449
2020-09-26 22:55:37 -04:00
Carlos Garnacho
41042b18d6 backends/native: Remove unused function
This meta_seat_native_get_device() function has been unused for some time.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1448
2020-09-23 16:32:18 +02:00
Carlos Garnacho
f7d0f2ce20 backends: Drop unused function
This meta_input_settings_get_tablet_mapping() was never necessary outside
MetaInputSettings, nor used. It can simply go away.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1448
2020-09-23 16:32:13 +02:00
Carlos Garnacho
df89c30241 backends: Drop unused function
meta_cursor_tracker_get_displayed_cursor() is used nowhere.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1448
2020-09-23 16:32:02 +02:00
Peter Hutterer
aa638f4d48 backends/native: fix the scroll button lock right/middle mismatch
In X, buttons 1, 2, 3 are left, middle, right. In evdev, the order is
BTN_LEFT, BTN_RIGHT, BTN_MIDDLE. So setting a scroll button to 2 gave us a
middle button in the X session and a right button in a wayland session.

Fix that by hard-coding the LMR buttons handling.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1433
2020-09-17 12:30:49 +00:00
Jonas Ådahl
6e3ecadb79 backends/native: Fall back to compositing if direct scanout failed
Even when a direct client buffer has a compatible format, stride and
modifier for direct scanout, drmModePageFlip() may still fail sometimes.

From testing, it has been observed that it may seemingly randomly fail
with ENOSPC, where all subsequent attempts later on the same CRTC
failing with EBUSY.

Handle this by falling back to flipping after having composited a full
frame again.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1410
2020-09-17 12:17:35 +00:00
Peter Hutterer
48243bfcbc backends/x11: if the scroll button is nonzero, enable button scrolling
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1431
2020-09-16 15:03:09 +00:00
Peter Hutterer
e04e003fd5 backends/x11: factor out the scroll method property changes
Let's not duplicate this given how complicated it is.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1431
2020-09-16 15:03:09 +00:00
Peter Hutterer
453e02b779 backends/x11: fix the property type for the scroll button
For reasons beyond my memory, this is an XA_CARDINAL, not an XA_INTEGER.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1431
2020-09-16 15:03:09 +00:00
Benjamin Berg
d586d06b39 kms/crtc: Always consider gamma state valid
The gamma curve remains valid even if the CRTC is turned off. As such,
there is no need to clear it and doing so breaks reading the gamma curve
while the screens are turned off using DPMS.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1420

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1392
2020-09-15 11:31:57 +00:00
Jonas Ådahl
827f545c27 kms/crtc: Read initial gamma state
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1420
2020-09-15 11:31:57 +00:00
Simon McVittie
e74b065fb5 input-mapper: Don't match touchscreens to the absence of a monitor
If there is no laptop panel (for example on a desktop PC or a virtual
machine), attempting to put a NULL monitor in the list of matches
will just make mapping_helper_apply() crash.

Mitigates: https://gitlab.gnome.org/GNOME/mutter/-/issues/1414
Signed-off-by: Simon McVittie <smcv@debian.org>
2020-09-14 17:31:32 +00:00
Jonas Ådahl
af9df1e5b6 screen-cast: Add 'dma-buf-screen-sharing' experimental feature
It's enabled by default when using the i915 driver, but disabled
everywhere else until it can be made reliably an improvement. Until
then, for anyone want to force-enable it, add the string
'dma-buf-screen-sharing' to the experimental features list in GSettings.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1442
2020-09-14 16:33:16 +00:00
Jonas Ådahl
6c0440697d screen-cast: Enable DMA buffers only for i915
Seems DMA buffer based interprocess buffer sharing is more broken than
not, so for now only enable it when using the i915 driver.

For example vmwgfx, qxl and radeon, it results in mmap() failing to mmap the
memory region. Other drivers, e.g. amdgpu will function, but may hit
very slow memory download paths, resulting in worse performance.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1442
2020-09-14 16:33:16 +00:00
Carlos Garnacho
bbcd65ce38 backends: Hook ClutterSeat::touch-mode to PanelOrientationManaged
We only want the panel autorotation to happen if the laptop has an
accelerometer, and is in tablet mode. Regular laptop mode should
lock the orientation, and let it be configured manually.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1311
2020-09-05 07:25:02 +00:00
Carlos Garnacho
bb0712077a backends: Check panel autorotation state before applying autorotation
So far, we've expected this signal to not happen whenever autorotation
shouldn't apply (no accelerometer is a strong reason). In future commits
we'll add further checks to this policy, so prevent autorotation to
change the display configuration if the MetaOrientationManager signal
happens but it should be ignored.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1311
2020-09-05 07:25:02 +00:00
Carlos Garnacho
1acf744473 backends: Centralize panel autorotation in a DisplayConfig property
Instead of having everyone check net.hadess.SensorProxy themselves, have
this all controlled by the MetaOrientationManager, and proxied everywhere
else via a readonly property in org.gnome.Mutter.DisplayConfig.

We want to attach more complex policies here, and it seems better to
centralize the handling of the autorotation feature rather than
implementing policy changes all over the place.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1311
2020-09-05 07:25:02 +00:00
Carlos Garnacho
7f9949a5e3 backends: Add method/property to get accelerometer availability
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1311
2020-09-05 07:25:02 +00:00
Carlos Garnacho
cba82d19b3 backends/input-mapper: Add some g_debug() traces to MetaInputMapper
Add some debug statements to mapping_helper_apply(), enough to work out
the heuristic decisions that were taken.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1202
2020-09-04 22:12:02 +00:00
Carlos Garnacho
ba937ffbb3 backends/input-mapper: Implement score mechanism to assign the most relevant output
We used to pick the "best" output for each builtin/size/edid categories,
and then pick the "best" (in that order) of those for each input device.
This is most often enough, but is prone to wrong results in some corner
cases (eg. 2 outputs with the exact same dimensions).

Change this to a score mechanism that doesn't leave outputs out. The
weights are the same, but the score is accumulated if an output matches
multiple categories. All outputs are evaluated and sorted by score, and
input devices with the best matches are applied first (as they already
did).

This should break the tie if eg. there's 2 outputs with similar dimensions,
but one of them has some EDID match in addition. The output with multiple
matches will score higher up, while it might have been entirely discarded
with the previous implementation.

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

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1202
2020-09-04 22:12:02 +00:00
Carlos Garnacho
766d5299d3 backends: Allow integrated tablet devices to cycle outputs
The work at https://gitlab.gnome.org/GNOME/gnome-control-center/issues/239
intended to make integrated devices optionally mappable to other outputs
(in order to allow fix mishandling from our heuristics, or to quickly reach
things in other monitor without changing devices).

This was missed in that plan, we do allow cycling outputs, but we still did
prevent it from doing anything for integrated devices. Fix that, and change
output cycling so we don't allow a "NULL" EDID for integrated devices, this
makes those go through the MetaInputMapper (resulting in one output listed
twice), instead of mapping to the full stage.

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

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1201
2020-09-04 21:57:43 +00:00
Georges Basile Stavracas Neto
a00ab5fada stream: Remove cursor if it's invisible
The cursor tracker may give us a valid position, and a
valid cursor sprite, and yet the cursor can be hidden,
meaning we must hide the cursor on the stream as well.

Remove cursor from stream buffer if it's hidden.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1421
2020-09-01 13:05:29 -03:00
Georges Basile Stavracas Neto
e6a13e5d57 monitor-stream-src: Add before-paint watch to catch scanouts
Scanouts are taken away after painting. However, when we're
streaming, what we actually want is to capture whatever is
going to end up on screen - and that includes the scanout
if there's any.

Add a before-paint watch that only records new frames if a
scanout is set.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1421
2020-09-01 13:05:29 -03:00
Georges Basile Stavracas Neto
aed286aa46 monitor-stream-src: Generalize function
We'll need to pass a custom callback to the stage views watcher.
Generalize and rename the add_view_painted_watches() function
to allow accepting custom callbacks.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1421
2020-09-01 13:05:29 -03:00
Georges Basile Stavracas Neto
b63e94af31 meta/stage: Process BEFORE_PAINT watchers at ClutterStage.before_paint
This way, watches can properly get notified about before-paint without
having to connect to the corresponding signal.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1421
2020-09-01 13:05:29 -03:00
Georges Basile Stavracas Neto
b1648e75a8 monitor-stream-src: Blit scanout when available
When there's a direct scanout set in the stage view, we
have to use it instead of the view's regular onscreen
framebuffer.

Use the new CoglScanout API to implement blitting to the
stream framebuffer.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1421
2020-09-01 13:05:28 -03:00
Georges Basile Stavracas Neto
21a21e7f68 cogl/scanout: Allow blitting to framebuffer
This will be used when screencasting monitors so that if
there's scanout in place, it'll still be possible to blit
it to a PipeWire-owned framebuffer, and stream it.

Add a new 'blit_to_framebuffer' vfunc to CoglScanout, and
implement it in MetaDrmBufferGbm.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1421
2020-09-01 13:05:24 -03:00
Georges Basile Stavracas Neto
661fe7769d backends/native: Move pixel format helper to separate file
The pixel format helper will be reused by the next commits, and
it doesn't make sense to simply expose it as MetaRendererNative
API.

Move it to a separate file.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1421
2020-09-01 13:05:24 -03:00
Georges Basile Stavracas Neto
ea7be8b9eb renderer-native: Cleanup unused variable
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1421
2020-09-01 13:05:24 -03:00
Georges Basile Stavracas Neto
b039def189 window-stream-src: Record a full frame on damage
This is a regression introduced by 882967d3ce.

When a window is damaged, we want to record the full frame, not a cursor-only
frame.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1421
2020-09-01 13:05:24 -03:00
Florian Müllner
6b04b2ff60 clutter/backends: Rename master and slave devices
Just because X11/XI uses a particular terminology doesn't mean we
have to use the same terms in our own API. The replacement terms
are in line with gtk@1c856a208, which seems a better precedent
for consistency.

Follow-up to commit 17417a82a5.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1425
2020-08-31 21:07:03 +02:00
Grey Christoforo
aaf70b28d1 screen-cast: Add vmwgfx to the DMA buffer deny list
VMWare has the same issues with mmap():ing DMA buffers cross process
boundaries so fall back to regular shared memory for 'vmwgfx' as well.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1318
2020-08-29 10:32:20 +00:00
Jonas Ådahl
986066ed40 screen-cast: Disable DMA buffer based screen casting for QXL
QXL doesn't support mmap():ing a DMA buffer allocated in mutter inside
the PipeWire stream consumer process. To make screen casting work again
on QXL, disable DMA buffer based screen casting for QXL.

Eventually, it should be the client that renegotiates the supported
buffer types, but until then we need this list.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1318
2020-08-29 10:32:20 +00:00
Jonas Ådahl
d73a858dc2 kms/device: Provide driver name and description
Retrieved from drmGetVersion(), to be used to identify what driver a DRM
device is driven by.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1318
2020-08-29 10:32:20 +00:00
Jonas Ådahl
d725acb267 screen-cast: Move DMA buffer allocation to MetaScreenCast
The aim with centralizing it is to be able to apply global policy to DMA
buffer allocations, e.g. disabling due to various hueristics.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1318
2020-08-29 10:32:19 +00:00
Jonas Ådahl
60c8d227ea backend: Add getter for MetaScreenCast
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1318
2020-08-29 10:32:19 +00:00
Olivier Fourdan
5171e35a97 xwayland: Add a setting to disable selected X extensions
The X server, including Xwayland, can be compiled with different X11
extensions enabled at build time.

When an X11 extension is built in the X server, it's usually also
enabled at run time. Users can chose to disable those extensions at run
time using the X server command line option "-extension".

However, in the case of Xwayland, it is spawned automatically by the
Wayland compositor, and the command line options are not configurable
by users.

Add a new setting to disable a selected set of X extension in Xwayland
at startup, without needing to rebuild Xwayland.

Of course, if Xwayland is not built with a given extension support in
the first place (which is the default for the security extension for
example), that option has no effect.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1405
2020-08-29 12:20:26 +02:00
Marco Trevisan (Treviño)
e44c42f254 seat-native: Process device added/removed events as ClutterEvents
Delay the addition and removal of devices using ClutterDeviceEvent's so that
they are processed following the libinput event order, and that we don't
have to flush the events on removal.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1371
2020-08-29 09:33:54 +00:00
Marco Trevisan (Treviño)
9db289b4ae seat-x11: Translate device enabled/disabled into clutter events
When a device is removed from the seat the events that this device may have
emitted just before being removed might still be in the stage events queue,
this may lead a to a crash because:

Once the device is removed, we dispose it and the staling event is
kept in queue and sent for processing at next loop.
During event processing we ask the backend to update the last device
with the disposed device
The device is disposed once the events referencing it, are free'd
The actual last device emission happens in an idle, but at this point
the device may have been free'd, and in any case will be still disposed
and so not providing useful informations.

To avoid this, once a device has been added/removed from the seat, we queue
ClutterDeviceEvent events to inform the stack that the device state has
changed, preserving the order with the other actual generated device events.
In this way it can't happen that we emit another event before that the
device has been added or after that it has been removed.

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1345
2020-08-29 09:33:54 +00:00
Marco Trevisan (Treviño)
5730b998fd backend: Use connect-after to perform actions on device removed
When a device is removed we perform some actions such as stopping the
"::last-device-changed" signal emission and unsetting the current device.
And we want to be sure that these actions happen after all the
device-removed operations are sorted out.

Related to: https://gitlab.gnome.org/GNOME/mutter/-/issues/1345
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1371
2020-08-29 09:33:54 +00:00
Marco Trevisan (Treviño)
0756826753 backend: Don't emit last-device updates with no device
When removing a device that has been just marked as the last in use, we may
try to notify that a NULL device is the last one.

This is not supported, as both update_last_device() and the clients of the
"::last-device-changed" signal are assuming that the last device is always
a valid ClutterInputDevice.

So let's avoid erroring, and stop the idle when clearing the current device.

Related to: https://gitlab.gnome.org/GNOME/mutter/-/issues/1345
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1371
2020-08-29 09:33:54 +00:00
Björn Daase
5ec9bde64f *: Fix spelling mistakes found by codespell
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1410
2020-08-29 09:10:31 +00:00
Georges Basile Stavracas Neto
2b67030dbb streams: Don't bail out when cursor is outside the stream
PipeWire reuses buffers, and buffer metadatas, when streaming. When
the cursor is moved to outside the stream, the cursor meta also needs
to be updated, otherwise it'll use the cursor position of whatever is
in the buffer.

Don't bail out when cursor is outside the stream, and ensure to record
a metadata-only frame. This only applies to metadata streams.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1417
2020-08-28 16:34:56 +00:00