1
0
Fork 0
Commit graph

1393 commits

Author SHA1 Message Date
Jonas Ådahl
5be8c50746 window-actor: Rename confusing variable name
A "window rect" in most places refers to the rectangle the window
corresponds to when it comes to window management. MetaWindow::rect also
refers to this window management related rectangle. However in the
geometry sync functions, it instead called what was to be the rectangle
the actor should have as "window rect", which is arguably a bit
confusing. Fix this by renaming it "actor_rect" so that it becomes clear
that it's the rectangle the actor should get on the stage.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2338>
2022-10-10 18:16:51 +00:00
Sebastian Wick
c6b4b33570 window-actor: Make meta_window_actor_get_image fastpath reachable
MetaWindowActor previously peeked at the number of child Actors to
determine the number of surfaces. The following commit rearranged the
tree such that MetaWindowActorWayland always has two Actors. This change
lets the subclass determine if the main surface describes the whole
window.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2338>
2022-10-10 18:16:51 +00:00
Jonas Ådahl
85ef0d1a46 compositor-view/native: Check that the actor covers the the view
If we have a window that match the size (i.e. will pass the "fits
framebuffer" low level check), that doesn't mean it matches the
position. For example, if we have two monitors 2K monitors, with two 2K
sized windows, one on monitor A, and one on monitor both monitor A and
B, overlapping both, if the latter window is above the former, it'll end
up bing scanned out on both if it ends up fitting all the other
requirements.

Fix this by checking that the paint box matches the stage view layout,
as that makes sure the actor we're painting isn't just partially on the
right view.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2387
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2624>
2022-09-20 18:47:06 +00:00
Sebastian Wick
f336911d8f default-plugin: Use stopped instead of completed signal
The completed signal is only emitted if the timeline actually completed
but when an actor is destroyed or removed from its parent the timeline
is stopped and not completed.

The workspace switch effect removes window actors from the window group
which destroys the timeline so on_$EFFECT_effect_stopped is never
called and the pointer to the timeline is dangling.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2489>
2022-09-20 17:14:53 +00:00
Sebastian Wick
bc6af4f1c8 default-plugin: Kill workspace switch animation on shutdown
The workspace switch animation moves the WindowActors out of the
WindowGroup so if we shut down while the animation is playing the
WindowActors will have queued a destroy but will be disposed only after
the compositor is destroyed, leaving the WindowActor with a dangling
pointer.

Fix the issue by killing the workspace switch animation on shutdown.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2489>
2022-09-20 17:14:53 +00:00
Jonas Ådahl
d517f3ae61 feedback-actor: Make the other properties static strings
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2619>
2022-09-19 14:46:01 +00:00
Jonas Ådahl
c1215f4213 window-actor/wayland: Add missing config.h
The lack of this resulted in some surprises in header file macro
processing.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2619>
2022-09-19 14:46:01 +00:00
Daniel van Vugt
f94189d4eb clutter/utils: Remove magic numbers from fixed point calculations
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2587>
2022-09-02 07:33:26 +00:00
Robert Mader
3c79eb56b9 compositor/native: Allow scanout for offscreen rotated views
If a stage view uses an offscreen framebuffer exclusively for
rotation and a Wayland client provides pre-rotated buffers,
we should try to use scanout.
This saves us one copy more than scanout in the onscreen case,
i.e. two fullscreen copies in total.

Offscreen rotation is notably used for all 90/270 degree rotations
at the moment, as using display hardware for them is apparently
more complex than for x-/y-flips and can even have detrimental
effects on power consumption.

This can be tested with `weston-simple-egl`.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2468>
2022-09-01 20:40:35 +00:00
Daniel van Vugt
bb1ffb0887 shaped-texture: Don't clear mipmaps during painting
This reverts an attempt at saving texture memory that was introduced
recently in 16fa2100. It was misguided because the same texture may be
needed in the next frame if a window has multiple previews visible on
screen at once (gnome-shell's overview). Keeping the mipmaps around
seems to reduce the peak render times of the overview by roughly 5%-10%.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2598>
2022-08-30 14:50:26 +00:00
Daniel van Vugt
8019714b5d texture-mipmap: Fix some leaks and tidy up
Seems we were leaking mipmap->mipmap_texture and mipmap->fb.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2562>
2022-08-10 11:52:39 +00: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
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
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
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
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
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
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
0f8f30c93f window-actor/wayland: Skip unnecessary set_child_at_index() calls
`clutter_actor_set_child_at_index()` is far from a no-op, even if
the current index is equal to the new one - presumably for good
reasons. For the use-case here we want it to be a no-op though, so
skip calling it if the index already matches.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2501>
2022-07-11 17:23:10 +00:00
Robert Mader
57881ba612 wayland/subsurface: Move actor unparenting back to rebuild_surface_tree()
Unparenting the surface actor when the subsurface object is destroyed
has several issues:
 - subsurface actors can be unparented while a close animation is
   still ongoing, breaking the animation for e.g. Firefox.
 - adding and removing the actor to/from the parent is not handled in
   one place, making the code harder to follow.
 - if the destroyed subsurface had children of its own, they potentially
   stick around until a surface-tree rebuild. This makes the Firefox
   hamburger menu not close with the "compositor" backend.

Move the unparenting back to
`meta_window_actor_wayland_rebuild_surface_tree()` and instead just
notify the parent of a state change, if it still exist. This will ensure
a correct mapping between the subsurface node tree and the flat surface
actor list. In case of the closing animation the parent will already be
removed and the call is skipped.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2501>
2022-07-11 17:23:10 +00:00
Dor Askayo
525fc3ca47 surface-actor-wayland: Remove leftover function declarations
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2485>
2022-07-01 16:05:33 +00:00
Jonas Ådahl
74230038c9 Remove checks for GLSL
The Cogl feature was removed a while back, while Clutter just hard coded
it to TRUE. Lets remove the confusion that GLSL isn't supported and just
remove the (dead) fallback paths.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2015>
2022-06-03 12:57:31 +00:00
Robert Mader
11fc5b6c6c tests/wayland: Add more requests to test driver protocol
Add `sync_effects_completed()` and `verify_view()` in
order to allow Wayland test clients to trigger verifications
and add convenience functions to use them to client-utils.

Notes:
- `sync_effects_completed()` works in two stages in order
  to ensure it doesn't race with window effects. By the time
  `sync_effects_completed()` is processed, an effect could
  already have ended or not yet been scheduled. Thus we
  defer a check for pending effects to the next paint cycle,
  assuming that by then they should have been scheduled.
- `meta_ref_test_verify_view()` internally triggers the
  `paint` signal for the stage which is why it can not be run
  in the after-paint signal handler.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1055>
2022-06-03 09:03:10 +00:00
Jonas Ådahl
f772b4cde6 restart: Make API that needs context take a context
This allows avoiding looking up old singletons.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2446>
2022-05-31 16:42:46 +00:00
Sebastian Keller
bb76d6fcc3 compositor: Update topmost window actor after visibility changes
The compositor currently only updates the topmost window actor that is
visible to it after stacking changes. The visibility of a window actor
to the compositor however might only change via the display idle queue
after the stacking changes. This could then lead to the topmost window
actor being assumed to be NULL on Wayland after switching from an empty
workspace or when opening the first window on an empty workspace. The
result of this is direct scanout being disabled in these cases.

To fix this also trigger the update when the visibility of windows
changes.

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2269
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2413>
2022-05-17 13:42:07 +00:00
Sebastian Keller
0bc142ec1b compositor: Split out a function to update the topmost window actor
This allows this to be used from outside the restacking code in the
follow-up commit.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2413>
2022-05-17 13:42:07 +00:00
Sebastian Keller
54ba64b9f2 window-actor/wayland: Only use scanout for opaque non-fullscreen windows
This could for example happen with the client window created by the
desktop-icons-ng extension which spans the entire desktop, but is not a
fullscreen window and uses transparency

On Wayland only opaque surfaces or transparent surfaces of fullscreen
windows can be used for direct scanout.

Related: https://gitlab.gnome.org/GNOME/mutter/-/issues/2263
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2409>
2022-05-17 10:34:20 +00:00
Sebastian Keller
dc43bb9f68 window-actor/x11: Don't use direct scanout if the window is not opaque
Some windows span the entire screen but still use transparency, such as
the desktop window of Nemo. When these windows were used for direct
scanout, the transparent areas would turn black and nothing else would
be rendered.

In addition to checking the surface for opaqueness, for X11 windows also
the window actor itself has to be checked, because its opacity might
have been changed via _NET_WM_WINDOW_OPACITY.

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2263
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2409>
2022-05-17 10:34:20 +00:00
Sebastian Keller
9c8948fc04 window-actor: Add API to get the surface actor candidate for scanout
This replaces the API to get the topmost surface actor with an API to
get the surface actor that could be a candidate for direct scanout. The
advantage of this is that it allows X11 and Wayland specific
restrictions for these actors.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2409>
2022-05-17 10:34:20 +00:00
Bilal Elmoussaoui
749b9be98a core: Drop the default close dialog implementation
If the MetaPlugin doesn't implement it, we don't show anything.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2370>
2022-05-06 16:13:45 +02:00
Bilal Elmoussaoui
0e092ad6b3 default-plugin: Drop default confirm display dialog
Mostly to drop the 1/3 use cases of zenity on mutter and usually
shells built on top of Mutter should implement that vfunc

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2370>
2022-05-06 16:13:45 +02:00
Bilal Elmoussaoui
03929ca01f build: Fix building without Wayland
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2400>
2022-05-03 16:47:02 +02:00
Jonas Ådahl
d19700604b compositor/dnd: Fix indentation
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2391>
2022-04-29 18:58:38 +00:00
Jonas Ådahl
9d0f612de1 shaped-texture: Paint with the right layer snippet
When we get passed a "snippet" to the shaped texture, it's added as a
pipeline layer snippet to change how the source texture is sampled. When
we draw from a texture tower however we have allocated regular textures
which doesn't need any special layer snippet, so create separate
pipelines for those that doesn't use that snippet.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/528
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2278>
2022-04-07 07:28:44 +00:00
Jonas Ådahl
d4ffaf291f shaped-texture: Pass along the snippet to the texture tower
The snippet is used make sure the right source is sampled in the shader.
This wasn't done in the texture tower, meaning the textures from the
tower were not correct.

Related: https://gitlab.gnome.org/GNOME/mutter/-/issues/528
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2278>
2022-04-07 07:28:44 +00:00
Robert Mader
7f93004809 compositor/native: Check that the surface can be scanned out untransformed
Before scanning out the surface of a native client we have
to check the following attributes that influence the
relationship between buffer and the defined result on screen:
 - buffer scale
 - buffer transform
 - viewport

In the future we can loose these checks again in cases where the
display hardware supports the required operations (scaling, cropping
and rotating).

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2276>
2022-03-05 14:14:37 +00:00
Robert Mader
6330acfaa2 compositor: Some header cleanups
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2276>
2022-03-05 14:14:37 +00:00
Jonas Dreßler
672696f823 dnd: Notify about events during compositor grab from event filter
Since the introduction of ClutterGrabs, MetaDnd now no longer gets
notified about input events on the stage during grabs (for example while
the alt-tab popup is shown) and thus can't move the grab feedback actor
anymore.

To fix this, forward events to MetaDnD directly from
meta_display_handle_event() when a ClutterGrab is in effect.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2308>
2022-03-02 15:12:23 +00:00
Carlos Garnacho
a870e6b38d backends/x11: Update MetaBackend on ClutterEvent processing
This should fix wonky handling of last used device and pointer
visibility on X11. At least does on --nested under presence of
touchscreen/tablet.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/285>
2022-02-08 14:34:47 +00:00
Jonas Ådahl
35ac3a096d compositor: Destroy actors when unmanaging
When disposing, actors being destroyed might want to access the disposed
compositor; avoid that by destroying them earlier.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2264>
2022-02-07 17:52:05 +00:00
Jonas Ådahl
dd14592314 laters: Expose MetaLaters publicly
Will allow not having to use the context-less meta_later_add().

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2264>
2022-02-07 17:52:05 +00:00