1
0
Fork 0
Commit graph

27380 commits

Author SHA1 Message Date
Jonas Ådahl
688280f82d remote-desktop/session: Handle unable to transform coordinate gracefully
There may be a race between the ability to turn stream relative input
coordinates and turning them into screen coordinates, due to the future
scenario where the entity backing a stream is created and managed ad-hoc
depending on PipeWire stream negotiations.

When an input event is sent during this time, drop it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1698>
2021-03-12 15:09:45 +00:00
Jonas Ådahl
9b1b4eb843 clutter: Expose 'capture_view_into()` as API
It'll be used to explicitly capture the content of a single view.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1698>
2021-03-12 15:09:45 +00:00
Jonas Ådahl
005c49063d main: Add --virtual-monitor argument
Make it possible to create persintent virtual monitors using command
line argument. This will not be the only way to create virtual monitors,
the primary way will be using the screen cast API, but using command
line argumenst is convenient for debugging purposes.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1698>
2021-03-12 15:09:45 +00:00
Jonas Ådahl
51ff51c854 tests: Add virtual monitor tests
The testing currently done is:

 * Creating a virtual monitor succeeds and gets the right configuration
 * Painting a few times results in the expected output
 * Changing the content of the stage also changes the painted content
   accordingly
 * Destroying the virtual monitor works as expected

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1698>
2021-03-12 15:09:45 +00:00
Jonas Ådahl
d7ce6a47f8 tests: Add reference test framework
This adds a test framework that makes it possible to compare the result
of painting a view against a reference image. Test reference as PNG
images are stored in src/tests/ref-tests/.

Reference images needs to be created for testing to be able to succeed.
Adding a test reference image is done using the
`MUTTER_REF_TEST_UPDATE` environment variable. See meta-ref-test.c for
details.

The image comparison code is largely based on the reference image test
framework in weston; see meta-ref-test.c for details.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1698>
2021-03-12 15:09:45 +00:00
Jonas Ådahl
1818d21da5 Introduce virtual monitors
Virtual monitors are monitors that isn't backed by any monitor like
hardware. It would typically be backed by e.g. a remote desktop service,
or a network display.

It is currently only supported by the native backend, and whether the
X11 backend will ever see virtual monitors is an open question. This
rest of this commit message describes how it works under the native
backend.

Each virutal monitor consists of virtualized mode setting components:

 * A virtual CRTC mode (MetaCrtcModeVirtual)
 * A virtual CRTC (MetaCrtcVirtual)
 * A virtual connector (MetaOutputVirtual)

In difference to the corresponding mode setting objects that represents
KMS objects, the virtual ones isn't directly tied to a MetaGpu, other
than the CoglFramebuffer being part of the GPU context of the primary
GPU, which is the case for all monitors no matter what GPU they are
connected to. Part of the reason for this is that a MetaGpu in practice
represents a mode setting device, and its CRTCs and outputs, are all
backed by real mode setting objects, while a virtual monitor is only
backed by a framebuffer that is tied to the primary GPU. Maybe this will
be reevaluated in the future, but since a virtual monitor is not tied to
any GPU currently, so is the case for the virtual mode setting objects.

The native rendering backend, including the cursor renderer, is adapted
to handle the situation where a CRTC does not have a GPU associated with
it; this in practice means that it e.g. will not try to upload HW cursor
buffers when the cursor is only on a virtual monitor. The same applies
to the native renderer, which is made to avoid creating
MetaOnscreenNative for views that are backed by virtual CRTCs, as well
as to avoid trying to mode set on such views.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1698>
2021-03-12 15:09:45 +00:00
Jonas Ådahl
e7ae1978f8 kms/connector: Don't use MetaConnectorType for connector type
Use uint32_t as that is what it is in the drm layer. MetaConnectorType
will be less suitable, as it will grow custom connector types that can't
be mapped.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1698>
2021-03-12 15:09:45 +00:00
Jonas Ådahl
ba38057067 plugins/default: Initialize background color in a predictable manner
The order of which function argument expressions are executed is
undefined, so don't rely on this for setting the background colors, as
it results in different colors on different architectures.

For example, it has been observed that the order of execution is
reversed comparing x86_64 and aarch64, making these two architectures
having different background color.

Fix this confusion, and also reproduceability in future reference tests,
by making the order of execution predictable.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1698>
2021-03-12 15:09:45 +00:00
Jonas Ådahl
c8089f07a3 backend: Only show cursor when showing stage if pointer is present
This avoids showing the cursor when initially there is no pointer
device, nor touchscreen device.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1698>
2021-03-12 15:09:45 +00:00
Jonas Ådahl
b31a639378 backend: Add 'prepare-shutdown' signal
This will be used to avoid doing various work when we're shutting down,
e.g. react to changes triggering monitor reconfigurations.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1698>
2021-03-12 15:09:45 +00:00
Jonas Ådahl
a0e4f5226c workspace: Nag less about tiny but sane work areas
It's useful to be able to have very very tiny monitors (e.g. 60x60
pixels) when doing reference testing, as tests have reference images
that the output is compared to. Smaller reference images the less
storage they use.

To avoid annoying pointless warnings when this is done, change the
pedantic workspace work area code to be more forgiving if the work area
happens to match the display size.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1698>
2021-03-12 15:09:45 +00:00
Jonas Ådahl
47a6725207 monitor: Unset output monitor when disposing
When rebuilding the monitors (e.g. during hotplug), make sure to detach
the disposed monitors from any outputs before creating the new monitors.
While this isn't currently needed, as outputs are too being recreated,
with the to be introduced virtual outputs that are created for virtual
monitors, this is not always the case anymore, as these virtual outputs
are not regenerated each time anything changes.

Prepare for this by making sure that cleaning up disposed monitors
detach themself properly from the outputs, so new ones can attach
themself to outputs without running into conflicts.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1698>
2021-03-12 15:09:45 +00:00
Jonas Ådahl
b91740df0e crtc/kms: Make the 'transform-handled' API pass through MetaCrtcNative
In preparation for creating another non-KMS backend virtual CRTC.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1698>
2021-03-12 15:09:45 +00:00
Jonas Ådahl
6aef4b3970 monitor: Attach to backend instead of GPU
Prepare for the future when a monitor isn't necessarily attached to a
mode setting device, which is practically what MetaGpu represents.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1698>
2021-03-12 15:09:45 +00:00
Jonas Ådahl
19c4667d6a renderer/native: Downgrade warning to message about no hw-accel dGPU path
Warnings should be for errors, not non-optimal system configurations.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1698>
2021-03-12 15:09:45 +00:00
Jonas Ådahl
78ba1429c8 tests: Add headless native backend test
It doesn't do anything more than construct and tear down, but it's a
start.

Don't run the test as part of CI yet, as doesn't have the DRM devices
needed.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1698>
2021-03-12 15:09:45 +00:00
Jonas Ådahl
9bf57f82d3 main: Make it possible to set properties when overriding configuration
This makes it possible to pass custom properties to backends when
constructing tests. This will be used to create "headless" native
backend instances for testing the headless native backend.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1698>
2021-03-12 15:09:45 +00:00
Jonas Ådahl
1e2ef9023d backend/native: Hook up 'headless' mode to input and KMS subsystems
With this commit, it's possible to run mutter without being DRM master.
It's not yet possible to add virtual monitors, but one can for example
already add virtual input devices.

This currently doesn't try to hook up to any logind session, thus will
not have a real seat assigned. Currently it's hard coded to "seat0".

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1698>
2021-03-12 15:09:45 +00:00
Jonas Ådahl
ee4e78b100 kms: Add way to run without mode setting
Currently our only entry point for DRM devices is MetaKms*, but in order
to run without being DRM master, we cannot use /dev/dri/card*, nor can
we be either of the existing MetaKmsImplDevice implementation (legacy
KMS, and atomic KMS), as they both depend on being DRM master.

Thus to handle running without being DRM master (i.e. headless), add a
"dummy" MetaKmsImplDevice implementation, that doesn't do any mode
setting at all, and that switches to operate on the render node, instead
of the card node itself.

This means we still use the same GBM code paths as the regular native
backend paths, except we never make use of any CRTC backed onscreen
framebuffers.

Eventually, this "dummy" MetaKmsImplDevice will be replaced separating
"KMS" device objects from "render" device objects, but that will require
more significant changes. It will, however, be necessary for e.g. going
from being headless, only having access to a render node, to turning
into a real session, with a seat, being DRM master, and having access to
a card node.

This is currently not hooked up, but will be in a later commit.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1698>
2021-03-12 15:09:45 +00:00
Jonas Ådahl
739283d396 backend/native: Add getter for is-headless state
Will be used to determine how to run subsystems.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1698>
2021-03-12 15:09:45 +00:00
Jonas Ådahl
0786f44b0b seat/impl: Make it possible to run without libinput
Add a flag to MetaSeatNative and MetaSeatImpl that tells it not to
attempt to create a libinput context. This is intended to be used when
mutter is to run headless, as in without any input devices other than
virtual ones.

Currently not hooked up.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1698>
2021-03-12 15:09:45 +00:00
Jonas Ådahl
59a10cd188 monitor-manager/native: Allow starting without outputs when headless
This will allow starting, then adding virtual outputs when needed e.g.
via the screen cast API.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1698>
2021-03-12 15:09:45 +00:00
Jonas Ådahl
34b0f9c124 kms/device: Move universal plane cap check to mode set init
This leaves only the atomic mode setting cap check before creating the
impl device, aiming to make it possible to create a non-mode-setting
MetaKmsImplDevice implementation.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1698>
2021-03-12 15:09:45 +00:00
Jonas Ådahl
7c25953c65 kms/impl-device: Make non-abstract types explicitly init mode setting
This is a step towards making it possible to add a MetaKmsImplDevice
that doesn't actually do any mode setting.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1698>
2021-03-12 15:09:45 +00:00
Jonas Ådahl
c4a422bc24 crtc/kms: Add an abstract MetaCrtcNative that sits under MetaCrtcKms
There is going to me another non-abstract MetaCrtcNative type, just as
there will be for MetaOutputNative.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1698>
2021-03-12 15:09:45 +00:00
Jonas Ådahl
074d4f3418 output/kms: Make EDID be read via MetaOutputNative object
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1698>
2021-03-12 15:09:45 +00:00
Jonas Ådahl
fd4ea67b27 native: Add abstract MetaOutputNative object
MetaOutputKms is made to inherit from this, but it doesn't do anything
special yet.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1698>
2021-03-12 15:09:45 +00:00
Jonas Ådahl
3091cd89dc native: Rename MetaMonitorManagerKms to MetaMonitorManagerNative
We'll sooner or later start managing not only KMS backend monitors, but
virtual / remote ones too.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1698>
2021-03-12 15:09:45 +00:00
Jonas Ådahl
42d614f6fa backend-native: Add non-functional 'headless' mode
Make it possible to pass --headless as a command line argument in order
to turn the native backend "headless". This currently doesn't do
anything, but the intention is that it should not use logind nor KMS,
and work completely headless with only virtual outputs.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1698>
2021-03-12 15:09:45 +00:00
Jonas Dreßler
b770ea606a background-content: Optimize rounded clipping shader a bit
We're using the gtk4 shader for rounded rect clipping here, and gtk just
introduced a small optimization to make this shader a bit faster, so
let's do the same.

See 57e354c297

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1774>
2021-03-11 22:59:07 +01:00
Marco Trevisan (Treviño)
244e881912 backends/input-settings: Do not disconnect seat signals
This was added with commit c956193d, when we did connect to the seat
signals in input settings, but this is not the case anymore since commit
2c1558dd, so we can safely remove this call now.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1763>
2021-03-10 16:18:25 +00:00
Marco Trevisan (Treviño)
8d008112b6 backends/x11: Pass the seat to the input settings
Input settings requires a valid seat in order to initialize the a11y
settings (since commit 1609d145), however in X11 we never set it and
even if we create the input settings early (as per commit 7547891a) we
never initialize the seat for it.

This leads to startup critical errors on X11:
 clutter_seat_get_pointer_a11y_settings: assertion
   'CLUTTER_IS_SEAT (seat)' failed

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1763>
2021-03-10 16:18:24 +00:00
Suryashankar Das
b353b97512 backends/x11: Fix device hierarchy event handling for x11 backend
This commit adds the events created in the function
`meta_seat_x11_notify_devices` to the clutter events queue, which
are currently only added to the stage queue making the events not
being picked up by the `clutter_seat_handle_event_post` function.
This results in devices not getting added to the device-list of
`MetaInputSettings`.

Fixes the bug in which mouse and touchpad settings are not working in
the settings app during x11 session.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1767>
2021-03-10 15:44:46 +01:00
Marco Trevisan (Treviño)
012c0a18ef clutter: Ensure we always call handle_event_post for processed events
Since commit 2ceac4a device-related X11 events aren't processed anymore,
causing the input settings not to handle the devices.
This is due to the fact that we may never call clutter_seat_handle_event_post()
for such events.

While this is always happening for the native backend, it doesn't happen in
X11 because the events are removed from the queue as part of
meta_x11_handle_event(), and thus no event was queued to the stage by the
backend events source.

This also makes sure that the event post handler is called after the
event is actually processed, and not before an event is queued.

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1564
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1769>
2021-03-10 13:56:54 +00:00
Marco Trevisan (Treviño)
ccbdf91776 backends/x11: Add dummy input-settings implementation
The nested backend may need to have an input setting implementation,
while we don't want to change the host settings (re-using an X11 input
settings) we can add a dummy implementation, until something more
complex is needed.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1769>
2021-03-10 13:56:54 +00:00
Fabio Tomat
393be6c676 Update Friulian translation 2021-03-10 13:03:01 +00:00
Ivan Molodetskikh
acbaccd5c9 README: Fix list paragraphs
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1770>
2021-03-10 09:01:50 +03:00
Jonas Ådahl
dcbd96df38 README: Clarify how to name flag types
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1765>
2021-03-09 20:52:16 +00:00
Jordi Mas
86435d88a2 Update Catalan translation 2021-03-09 20:22:02 +01:00
Jonas Ådahl
9b90b5a1b0 window-actor/x11: Queue full actor redraw when redraw queued
With frame timings, we might end up in a situation where a frame drawn
is expected, but no damage was posted. Up until now, mutter handled
this, if the window wasn't completely hidden, by posting a 1x1 pixel
damage region. The problem with this is that we now are a bit more
aggressive optimizing away no-op redraws, meaning we still might end up
not drawing, making things get stuck.

Fix this by doing a full actor redraw, as that is the only reliable way
to both a new frame being drawn, as well as the actor in question itself
getting redrawn.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1516
Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3369
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1471
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1754>
2021-03-09 17:42:58 +00:00
Jonas Ådahl
44a4e61665 compositor/x11: Notify the sync ring about frames on updates
The sync ring has an API about "frames", where it is notified about
the end of frames. However, its "insert wait" call is done before
updates, meaning that some "insert waits" will never see the "after
frame" if there was no frame drawn. This will cause mismatching in the
frame counting, causing freezes in the synchronization until something
else triggers an actual frame, effectively "unfreezing" the sync ring.

Fix this by not only notifying the sync ring about frames when there
were actual frames drawn, but also on plain updates which didn't result
in a drawn frame.

Related: https://gitlab.gnome.org/GNOME/mutter/-/issues/1516
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1754>
2021-03-09 17:42:58 +00:00
Sebastian Keller
c2968c89fe frame: Fix crash when clicking below titlebar with broken gtk themes
When a gtk theme uses larger shadows for the unfocused state than for
the focused one, this can cause a crash in meta_frame_left_click_event.
Since whether to call meta_frame_left_click_event is decided based on
the decoration size before focusing and the control that was clicked on
after focusing, this can result in an event handled in
meta_frame_left_click_event being on the client area.

Fixes https://gitlab.gnome.org/GNOME/mutter/-/issues/1668

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1748>
2021-03-08 21:16:09 +00:00
Jonas Dreßler
3263084bcf backends/native: Translate right coords when creating motion events
With commit 7d78768809 we switched to
storing pointer coordinates in MetaInputDeviceNative instead of
ClutterInputDevice, and while we had set the coordinates of the
ClutterInputDevice in ClutterStage when queueing an event, we now set
the MetaInputDeviceNative coordinates in new_absolute_motion_event().

Here a small mistake snuck in: new_absolute_motion_event() only
translates the coordinates of the event, but we call
meta_input_device_native_set_coords() using the x and y variables
(which remain untranslated), so now the input device coordinates are no
longer translated.

Fix that by translating the coordinates of the x and y variables in case
we're we handling a tablet/stylus event instead of only translating the
event coordinates.

Fixes https://gitlab.gnome.org/GNOME/mutter/-/issues/1685

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1760>
2021-03-08 15:33:36 +00:00
Jonas Ådahl
ec14f51ae3 cogl/onscreen/egl: Remove platform pointer
It's not used anymore, so remove it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1759>
2021-03-08 15:02:30 +00:00
Jonas Ådahl
b962822f26 onscreen/native: Fix cast from CoglOnscreenEgl
It used the defunct platform pointer, meaning if this path would have
hit, it'd end up with a segmentation fault due to the platform pointer
being NULL.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1759>
2021-03-08 15:02:30 +00:00
Jonas Ådahl
372737e282 tests/clutter/timeline-interpolate: Use correct clock
This fixes the interpolate test to not use the wall clock, but the
monotonic clock. It also cleans up the timestamp granularity naming, so
that the different granularity is clearer, as in the test, different
timestamps have different granularity.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1751>
2021-03-08 14:37:00 +00:00
Jonas Ådahl
6f30764320 tests/clutter/timeline-interpolate: Rework test to be less flaky
This more or less rewrites this test so that it explicitly tests the
"interpolation" when a timeline loops, i.e. that if something occupies
the thread when a timeline was supposed to have looped, we end up in the
right place "in the middle" of the next timeline cycle.

The test more or less does this:

 * Start a 3 second looping timeline
 * Sleep so that we're in the middle of the first cycle
 * Sleep again so that we end up in the middle of the next cycle

The semantics checked are that we see the following frames:

 * The first frame with timestamp 0
 * The second frame in the middle of the first cycle (timestamp ~= 1.5
   sceonds)
 * The third frame in the end of the first cycle (timestamp == 3.0
   seconds)
 * The fourth frame, first in the second cycle, with timestamp ~= 1.5
   seconds)

This means we can increase the "grace period" to the double (from 0.5 s
to 1 s), while at the same time decrease the time spent running the test
(from 10 s to 4.5 s). This should hopefully make the test less flaky,
especially in slower runners, e.g. aarch64.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1751>
2021-03-08 14:37:00 +00:00
Jonas Ådahl
0d3840b056 tests/clutter/timeline-interpolate: Assorted style cleanups
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1751>
2021-03-08 14:37:00 +00:00
Jonas Ådahl
b155063227 tests/test-client: Set padding to 0 too
This makes size dependent stacking tests less flaky.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1751>
2021-03-08 14:37:00 +00:00
Jonas Dreßler
301198a9b8 Revert "backends: Use also a native cursor renderer for tablets"
With commit c985753442 the support for
multiple hardware cursors broke, but those were never properly supported
anyway as we usually assume there's only one hardware cursor around.

With the introduction of the KMS thread in the future, we'll only have
one KMS cursor that gets updated directly from the input thread. So
apart from the fact that it never really makes sense to have two cursors
visible, in this new model having multiple cursors won't work anyway.

So make the cursor we show for stylii a software cursor again.
Eventually the plan is to make the input device that's driving the KMS
cursor interchangeable, so that we can always use hardware cursors.

This reverts commit 165b7369c8.

Fixes https://gitlab.gnome.org/GNOME/mutter/-/issues/1645

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1758>
2021-03-08 13:13:22 +00:00