1
0
Fork 0
Commit graph

10345 commits

Author SHA1 Message Date
Jonas Ådahl
5e92500a9a tests/cogl: Migrate blend-strings test
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2555>
2022-08-08 21:59:12 +00:00
Jonas Ådahl
eaed0e4b46 tests/cogl: Migrate atlas-migration test
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2555>
2022-08-08 21:59:12 +00:00
Jonas Ådahl
f91f53e6eb tests: Add cogl test utils framework
This is in preparation of moving Cogl tests into src/tests, so they can
use the real backend, instead of the franken-backend it some how still
manages to use some how.

This makes them no longer installed. Most mutter tests are yet to be
installed, so leave that for later, since bigger changes are needed for
that.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2555>
2022-08-08 21:59:12 +00:00
Jonas Ådahl
02eac693df tests/dbus-runner: Just forward test case exit status
This allows tests to skip (return 77) and properly report that to meson.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2555>
2022-08-08 21:59:12 +00:00
Jonas Ådahl
c61dc682a2 monitor-manager: Don't include generated header in header
This tends to result in build system race conditions.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2555>
2022-08-08 21:59:12 +00:00
Robert Mader
01a4ec1841 wayland/outputs: Report actual monitor transform
Now that we support Wayland buffer transforms in all cases, we can
properly report them to outputs.
Also make sure we resend the output geomerty on transform changes.

This partly reverts commit bda9c359

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/344>
2022-08-05 20:30:50 +02:00
Robert Mader
22b9a4219a screencast: Implement buffer-transform support
So all cursor renderers support the feature.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/344>
2022-08-05 20:30:50 +02:00
Robert Mader
f804fe3a82 stage: Implement buffer-transform support in MetaOverlay
This allows the GL fallback path to correctly paint the cursor
if clients pre-rotated the buffer using
`wl_surface::set_buffer_transform`, visually matching the
hardware cursor path.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/344>
2022-08-05 20:30:50 +02:00
Robert Mader
df27017ba3 monitor-transform: Add helper to transform matrices
Moved from `MetaShapedTexture` - it will be useful
in several other places as well.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/344>
2022-08-05 20:30:50 +02:00
Robert Mader
385df73276 wayland/cursor-surface: Pass buffer-transform to cursor sprite
This was previously forgotten, effectively disabling pre-rotated
hardware cursors.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/344>
2022-08-05 20:30:50 +02:00
Jonas Ådahl
43336251bd tests/kvm: Don't run in parallel
They can be quite heavy, as they load up one virtual machine each. If
your system is already busy, this can easily cause them to time out
instead of finish in time, as they all fight over the same limited
amount of CPU and I/O time.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2556>
2022-08-05 12:29:27 +02:00
Jonas Ådahl
1a86b6b12a tests/clutter: Don't set CLUTTER_SCALE
It's not used so don't set it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2556>
2022-08-05 12:28:54 +02:00
Jonas Ådahl
a07fd4ee66 wayland/dma-buf: Only try to query KMS device on native backend
This fixes a crash when using the nested backend and DMA buf Wayland
clients.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2553>
2022-08-04 09:38:47 +02:00
Robert Mader
5b868a2bdf tests/wayland: Add test for single pixel buffer protocol
The protocol is supposed to be used together with `wp_viewporter`
thus add both protocols to client-utils.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2246>
2022-08-02 12:19:42 +00:00
Robert Mader
45ccf10e2a tests/wayland: Print error messages for wl_display_dispatch()
Failing in `wait_for_effects_completed()` or `wait_for_view_verified()
indicates client- or compositor-bugs. As hitting those is quite likely
during test development, print error messages to simplify debugging.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2246>
2022-08-02 12:19:42 +00:00
Jonas Ådahl
2cb7499735 wayland: Add single pixel buffer support
The "single pixel buffer" Wayland protocol extension provides a way for
clients to create 1x1 buffers with a single color, specified by
providing the color channels (red, green and blue) as well as the
alpha channel as a 32 bit unsigned integer.

For now, this is turned into a 1x1 texture. Future potential
improvements is to hook things up to the scanout candidate logic and
turn it into a scanout capable DMA buffer.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2246>
2022-08-02 12:19:42 +00:00
Robert Mader
550f09a5e7 clutter/stage-view: Defer and accumulate redraw-clip on scanout
When taking the scanout path we still want to clear the
redraw-clip from the stage-view in order to ensure we skip
frames in `handle_frame_clock_frame()` if no new redraw-clip
was recorded.
This was not done previously as the accumulated redraw-clip was
needed for the next repaint, likely under the assumption that
scheduling a scanout repeatedly would be computationally cost-free.
This assumption does not hold in a VRR world.

In order to archive both, an accumulated redraw-clip for the next
paint and frame-skipping during scanout, introduce new API to defer
and accumulate redraw-clips until the next repaint.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2480>
2022-08-02 12:54:18 +02:00
Jonas Ådahl
34475e7e98 wayland/dma-buf: Always send modifiers if AddFB2() is supported
To Wayland clients, it doesn't matter how we configure our onscreen
buffers, since they don't necessarily have the same bandwidth issues
related to mode setting, whichis the primary reason why we disable
modifiers using the udev rule, so simply check whether importing with
modifiers will work at all and advertise modifiers if so is the case.

This might help avoid issues using legacy non-modifiers path in drivers.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2546>
2022-08-02 10:04:52 +00:00
Jonas Ådahl
50396fc00e kms/device: Differentiate between lack of AddFb2() and udev rule
We disable modifiers for two reasons: an udev rule saying so, or the
lack of a working drmModeAddFB2(). However, to the users, this is not
granular enough. While the current user, whether to enable modifiers in
MetaRendererNative, doesn't need more granularity, we want to send
modifiers to Wayland clients even if the onscreen framebuffers should
still be allocated without modifiers.

Prepare for differentiating between how Wayland DMA buffers work and how
onscreen buffer allocation work by separating the relevant device flags.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2546>
2022-08-02 10:04:52 +00:00
Jonas Ådahl
1844dcc08e wayland/dma-buf: Get backend via MetaContext
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2546>
2022-08-02 10:04:52 +00:00
Jonas Ådahl
bd4dd6b1e8 wayland/compositor: Add MetaContext getter
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2546>
2022-08-02 10:04:52 +00:00
Dor Askayo
4736f873f2 compositor/native: Add support for direct scanout per view
This uses MetaCompositorViewNative to find a candidate surface for
scanout and to keep track of it separately for each view, effectively
allowing each CRTC to use a different buffer for direct scanout.

There are three parts for potentially assigning a buffer for direct
scanout at the compositor level:
  1. Finding a candidate surface actor on the view (if any)
  2. Attempting to assign the candidate's buffer for direct scanout
  3. Updating references relating to the scanout candidate as needed

The three parts were moved in their entirety from being handled by the
MetaCompositorNative to being handled by the MetaCompositorViewNative.
As part of this transition, the logic was also slightly refactored so
that each of the three parts is handled by its own helper function.
This allowed to avoid the use of "goto" statements and hopefully make
the logic easier to read and follow.

The first part mentioned above was changed in this commit to make use
of the new meta_compositor_view_get_top_window_actor () API to get the
top window actor in the view instead of the top window actor on all
views.

The second part and third parts mentioned above weren't changed other
than being done in the context of a view instead of globally.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2526>
2022-08-01 21:05:04 +00:00
Dor Askayo
ad0e19a034 compositor/native: Remove redundant function
All of the checks this function performed internally were already
done before calling it, making it a simple wrapper function without a
meaningful purpose.

Removing this function also reduces the chance of additional checks
being added to the MetaSurfaceActor after it is already chosen as a
scanout candidate.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2526>
2022-08-01 21:05:04 +00:00
Dor Askayo
66e938bc34 compositor/native: Don't allow obscured surface actors as scanout candidates
This check was previously done after it was already determined that
a surface actor is suitable for scanout.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2526>
2022-08-01 21:05:04 +00:00
Dor Askayo
259a9998d8 compositor: Introduce MetaCompositorViewNative
This class is meant to hold logic specific to the native backend
in the context of a MetaCompositorView.

Its addition requires making MetaCompositorView inheritable, and an
addition of a virtual function which allows each compositor to create
its own MetaCompositorView instance.

In the case of the MetaCompositorNative, a MetaCompositorViewNative
is created. In all other cases, a MetaCompositorView is created.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2526>
2022-08-01 21:05:04 +00:00
Dor Askayo
85b8632cd6 compositor: Keep track of the top window actor on each view
First, add logic in MetaCompositorView to find topmost visible
MetaWindowActor on its view, and expose it through a new API.

Then, queue an update to find the top MetaWindowActor of each
MetaCompositorView in the following cases:
  1. The MetaCompositor is in its initial state.
  2. The window stack order has changed.
  3. A window has changed its visibility.
  4. A "stage-views-changed" signal was emitted for a MetaWindowActor.

Finally, perform the queued update in meta_compositor_before_paint (),
and assert that an update isn't queued during painting. This ensures
that the top window actor in the MetaCompositorView remains up-to-date
and available to child classes of MetaCompositor throughout the entire
paint stage.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2526>
2022-08-01 21:05:04 +00:00
Dor Askayo
2ead3874f5 compositor: Expose the MetaCompositorView in before_paint () vfunc
The idea is that the state of the MetaCompositorView shall be
up-to-date only in specific scenarios, thus allowing operations
performed on it to be queued and aggregated to be handled in the
right time, and only if they are still necessary.

For example, in a following commit, the top window actor in each
view will be planned (if needed) only once before painting a frame,
rendering the top window actor in the MetaCompositorView potentially
stale in all other times.

Similarly, if a MetaCompositorView is destroyed before the beginning
of the frame, a queued operation to update its top window actor can be
discarded.

As an interface segragation measure, and as part of an attempt to
avoid the use of g_return_if_fail () to check the validity of the
MetaCompositorView's state in multiple places (which is still prone to
human error), the interfaces through which a MetaCompositorView is
made available would only ones where it's state is gurenteed to be
up-to-date.

Specifically, this commit gurentees that the state of the
MetaCompositorView would be up-to-date during the before_paint () and
after_paint () vfuncs exposed to child classes of the MetaCompositor.

The frame_in_progress variable will be used in a following commit to
guarantee that the MetaCompositorView's state is not invalidated during
this time.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2526>
2022-08-01 21:05:04 +00:00
Dor Askayo
049db7c7e5 compositor: Introduce MetaCompositorView
MetaCompositorView is a class which contains compositor logic
specific to ClutterStageViews.

Each MetaCompositorView is "attached" to a ClutterStageView as an
opaque pointer using g_object_set_qdata_full (), and is freed when
the ClutterStageView is destroyed. This ensures that the lifetime of
the MetaCompositorView can't extend beyond the lifetime of its
ClutterStageView.

In a following commit, MetaCompositorView will be expanded to allow
keeping track of the top MetaWindowActor located on each
ClutterStageView.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2526>
2022-08-01 21:05:04 +00:00
Florian Müllner
9d4aa4488a frames: Add basic color-scheme support
Use the dark variant for decorations if the color-scheme preference
indicates that it's preferred, and the client didn't explicitly
pick a variant via the _GTK_THEME_VARIANT hint.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2541>
2022-07-29 13:19:23 +00:00
Daniel van Vugt
7c8ffe7efe renderer-native: Fall back to ARGB if XRGB is not supported
This fixes mutter failing to start on some ARM/Mali boards.

Related: https://gitlab.gnome.org/GNOME/mutter/-/issues/2354
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2519>
2022-07-29 08:48:57 +00:00
Jonas Ådahl
9966c8717b tests/kms: Run tests both using simple and atomic KMS
Two sanity checks to make sure the debug env vars still work are added
too.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2456>
2022-07-28 23:59:24 +00:00
Jonas Ådahl
5823d2d1ae kms/impl-device/simple: Ensure buffer fb_id on test update too
This ensures the fb_id will be there when we actually apply the update,
and will also make scanout test case pass if we run it with the
non-atomic KMS API.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2456>
2022-07-28 23:59:24 +00:00
Daniel van Vugt
e0145447a3 shaped-texture: Remove mipmap framerate limiting
Although mipmapping is still slower than not mipmapping, commit 16fa2100
simplified N synchronous draw calls per texture tower into just one. So
it's more efficient now, and four years have passed since the throttling
was introduced so people also have better hardware as well as mutter being
generally faster than it used to be. So I am happy to effectively revert
commit c9c32835.

This means antialiasing will remain consistent rather than popping in and
out of existence.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/403
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2538>
2022-07-28 12:12:38 +02:00
Jonas Ådahl
a66c820d05 tests/get-state: Run with G_DEBUG=fatal-warnings
For this to pass, pass an explicit Wayland display name to avoid the
display conflict warning that may happen when there is an already
running Wayland display server.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2448>
2022-07-28 09:04:45 +00:00
Jonas Ådahl
083b872677 tests: Add get-state test using gdbus
This ensures we know how to handle data from bug reports gathered using
gdbus.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2448>
2022-07-28 09:04:45 +00:00
Jonas Ådahl
4e3932c7ac tests: Add sanity test for get-state.py tool
It'll fail if the type signature of the GetCurrentStat() method is
changed, more or less.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2448>
2022-07-28 09:04:45 +00:00
Daniel van Vugt
5eb5ed54e8 shaped-texture: Remember to turn on mipmapping
It was accidentally lost in 877dc335.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2365
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2537>
2022-07-27 09:40:20 +00:00
Daniel van Vugt
069e18c09d compositor: Add copyrights for recent mipmapping changes
Relating to b29a6c4d, 16fa2100, 877dc335

The most recent mipmapping logic was written by Canonical and rearranged
by Neil Moore.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2535>
2022-07-27 16:08:46 +08:00
Jonas Ådahl
4095c2431c barrier: Get rid of private instance struct
The struct is private to begin with, so no need for it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2442>
2022-07-26 20:27:24 +00:00
Jonas Ådahl
3c6c1af0a0 barrier: Add GInitable based constructor method
This one does proper error reporting. Via Javascript, barriers are
constructed directly via GObject construction, which currently can't
handle error reporting, but when calling from C we can. However, if we
initialize using GInitable, and use that in our constructor method, once
gjs gains support for construction using GInitable, including the error
reporting, we'll automatically get proper error reporting to Javascript.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2442>
2022-07-26 20:27:24 +00:00
Jonas Ådahl
27b75d3c96 barrier: Modernize type implementation
This means using G_DECLARE*() to declare the type, using
`_get_private_instance()` everywhere, and other smaller cleanups.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2442>
2022-07-26 20:27:24 +00:00
Jonas Ådahl
1992aa1567 x11-display: Stop special casing barriers when iterating window table
In the past, barries were added to the window management X11 display
instance window table, and then special cased when iterating over the
list.

Since then, barriers, which are really part of the backend, has stopped
being added to the window hash table, instead being managed by the
backend. Lets clean up the left-over special casing that is no longer
needed.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2442>
2022-07-26 20:27:24 +00:00
Jonas Ådahl
0debb24e12 barriers: Make barriers fully part of the backend
Prior to this commit, barriers were created with a MetaDisplay pointer,
despite being entities related and owned by the backend. In the X11
case, it was also not hooked up to the backend X11 connection, but the
clutter one, meaning for example that the logic was active (but dormant)
also for the Xwayland connection.

Fix this by moving X11 barrier management and event processing fully to
the backend. Also replace passing a display pointer with passing a
backend pointer. Keep the display pointer around for a release, but mark
it as deprecated.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2442>
2022-07-26 20:27:24 +00:00
Neil Moore
877dc33545 shaped-texture: Move texture mipmap implementation to 'meta-texture-mipmap'
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2506>
2022-07-26 19:16:50 +00:00
Daniel van Vugt
16fa2100dc shaped-texture: Stop using MetaTextureTower and use GL mipmapping instead
But only in cases where it's needed; when we are displaying a texture at
less than half its native resolution. We also keep the existing
optimization that avoids mipmapping of textures while they're animating.

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/849
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2506>
2022-07-26 19:16:50 +00:00
Daniel van Vugt
b29a6c4d0c compositor: Return more details from meta_actor_painting_untransformed
This adds x_scale and y_scale information, as well as simplifying the
parameters.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2506>
2022-07-26 19:16:50 +00:00
Robert Mader
0c12903352 renderer-view: Drop bogus meta_monitor_transform_invert()
It papered over wrong `meta_rectangle_transform()` behaviour for
non-flipped output transforms. Also there is no obvious reason
why we would need inverted values here.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2459>
2022-07-26 18:41:43 +00:00
Robert Mader
0c34908132 cursor-renderer/native: Various fixes for rotated cursors
- Drop bogus `meta_monitor_transform_invert()`. It papered over
  wrong `meta_rectangle_transform()` behaviour for non-flipped
  output transforms.
- Update `scale_and_transform_cursor_sprite_cpu` to match the GL
  pipeline matrix in `MetaShapedTexture`, fixing several of the
  flipped cases. Note: the rotation applied is the one a client would
  need to apply to the buffer for a given monitor transform.
- While on it, drop a redundant `return`.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2459>
2022-07-26 18:41:43 +00:00
Robert Mader
d644a40cf5 shaped-texture: Swap 90 and 270 degree transforms in pipeline matrix
With `META_MONITOR_TRANSFORM` values matching their `WL_OUTPUT_TRANSFORM`
counterparts, the definition from the Wayland spec applies: the
`META_MONITOR_TRANSFORM` value tells us how the output was rotated
and that the buffer was drawn by the client to compensate for that.

The matrix describes the transformation from surface- to buffer-
coordinates, so the operation we need here is the same one that
the client applied (not from buffer- to surface-coordinates, i.e.
the inverse).

While on it fix `FLIPPED_90` and `FLIPPED_270` to use the correct
axes: flip on the x-axis, rotation on the z-axis.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2459>
2022-07-26 18:41:43 +00:00
Robert Mader
2ade26ebf8 boxes: Swap 90 and 270 degree transforms in meta_rectangle_transform()
`meta_rectangle_transform()` is used in the stack to *compensate* for a
`MetaMonitorTransform` applied to a output, not to apply it again.
Change the function accordingly.

Context:
Experimenting with direct scanout on offscreen-rotated outputs revealed
that the 90/270 degree cases were actually interchanged.
Further digging revealed that we use `meta_rectangle_transform()` with
those values swapped in every single case, papering over the issue.

Either a unintuitive and unexplained `meta_monitor_transform_invert()`
was added, in which case "flipped" values would be wrong, or, in case
of Wayland buffer transforms, the values were swapped by interpreting
the Wayland enums accordingly, see commit 8d9bbe10.

Swapping the 90/270 degree values in `meta_rectangle_transform()`:
1. fixes hardware cursor positioning with flipped output transforms
2. fixes rendering issues with offscreen-rotated flipped output transforms
3. allows us to drop unexplained `meta_monitor_transform_invert()`s in
follow-up commits
4. allows us to make `META_MONITOR_TRANSFORM` and `WL_OUTPUT_TRANSFORM`
enums match again (reverting 8d9bbe10, as already done)

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2459>
2022-07-26 18:41:43 +00:00