1
0
Fork 0
mutter-performance-source/src/compositor
Jonas Dreßler 5527b6e483 background-content: Add support for rounded clipping when drawing
We're going to round the workspace backgrounds in the new overview for
gnome-shell 40.

So far corner-rounding was only possible for StWidgets because the
rounded clipping was done using cairo drawing. We now need rounded
clipping for ClutterActors too because backgrounds are drawn using
ClutterActors (or more specifically a ClutterContent). To implement
that, first a ClutterOffscreenEffect subclass together with a fragment
shader from GSK (see gskSetOutputColor() [1] in the GSK GL renderer
code) was investigated, and while that was generic and worked quite
well, it was extremely slow for the case of drawing wallpapers because
of all the FBOs that had to be allocated.

This is the new, more performant approach: Use the same fragment shader,
but perform the rounded clipping right in MetaBackgroundContent while
we're painting the wallpaper. This has almost no performance impact,
with the downside of not being a generic solution.

To allow for rounded clipping not only at the edges of the wallpaper,
but using any given bounding rectangle, the API exposes not only the
radius, but also a bounding rect.

[1] https://gitlab.gnome.org/GNOME/gtk/-/blob/master/gsk/resources/glsl/preamble.fs.glsl

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1717>
2021-02-18 20:26:42 +00:00
..
plugins background-actor: Use MetaBackgroundContent 2020-06-09 17:07:02 -03:00
clutter-utils.c src: Use graphene APIs 2020-10-06 15:34:48 +00:00
clutter-utils.h shaped-texture: Fix use-nearest check when viewports are scaled 2020-03-26 08:32:46 +00:00
cogl-utils.c cogl: Remove CoglError wrapper 2019-06-20 18:25:04 +02:00
cogl-utils.h Use a consistent style for enum braces 2019-02-28 09:31:01 +01:00
compositor-private.h compositor: Refactor backend-specific code into MetaCompositor vfuncs 2021-02-14 13:23:29 +00:00
compositor.c compositor: Refactor backend-specific code into MetaCompositor vfuncs 2021-02-14 13:23:29 +00:00
meta-background-actor-private.h Clean up include macros mess 2018-11-06 17:17:36 +01:00
meta-background-actor.c background-actor: Use MetaBackgroundContent 2020-06-09 17:07:02 -03:00
meta-background-content-private.h Introduce MetaBackgroundContent 2020-06-09 17:07:02 -03:00
meta-background-content.c background-content: Add support for rounded clipping when drawing 2021-02-18 20:26:42 +00:00
meta-background-group.c meta: Make MetaBackgroundGroup derivable 2019-06-24 13:49:31 +00:00
meta-background-image.c *: Fix spelling mistakes found by codespell 2020-08-29 09:10:31 +00:00
meta-background-private.h Clean up include macros mess 2018-11-06 17:17:36 +01:00
meta-background.c background: Make the final monitor texture RGB instead of RGBA 2021-01-11 15:08:27 +08:00
meta-compositor-native.c cogl: Turn CoglFramebuffer, CoglOffscreen and CoglOnscreen into GObjects 2020-10-16 16:17:38 +00:00
meta-compositor-native.h compositor: Get the stage via the backend 2020-06-05 21:39:27 +00:00
meta-compositor-server.c compositor: Refactor backend-specific code into MetaCompositor vfuncs 2021-02-14 13:23:29 +00:00
meta-compositor-server.h compositor: Get the stage via the backend 2020-06-05 21:39:27 +00:00
meta-compositor-x11.c compositor: Sync pointer after begin/end modal on X11 2021-02-14 13:23:29 +00:00
meta-compositor-x11.h compositor: Get the stage via the backend 2020-06-05 21:39:27 +00:00
meta-cullable.c cullable: Check if effects are disabled 2020-02-14 01:17:42 +01:00
meta-cullable.h cullable: Factor out untransformed check into a vfunc 2020-02-08 19:20:41 +01:00
meta-dnd-actor-private.h Use G_DECLARE_DERIVABLE/FINAL_TYPE on some types 2018-12-21 19:48:50 +00:00
meta-dnd-actor.c compositor/dnd-actor: Take geometry scale into account on DnD-cancel 2021-02-05 09:51:56 +00:00
meta-dnd.c cleanup: Use g_clear_signal_handler() where possible 2019-11-21 15:02:27 +00:00
meta-feedback-actor-private.h feedback-actor: Add API to set and get geometry scale 2021-02-05 09:51:56 +00:00
meta-feedback-actor.c feedback-actor: Add API to set and get geometry scale 2021-02-05 09:51:56 +00:00
meta-later-private.h later: Listen to MetaCompositor signal instead of clutter 2020-04-16 15:05:52 +02:00
meta-later.c clutter: Paint views with individual frame clocks 2020-07-02 19:36:51 +02:00
meta-module.c plugin: Drop version information 2020-10-06 15:14:34 +02:00
meta-module.h Changed obsolete FSF postal address into generic URL. 2014-01-13 11:35:47 -05:00
meta-plugin-manager.c plugin-manager: Kill window effects on destroy 2019-11-08 22:18:09 +00:00
meta-plugin-manager.h compositor: Add "locate_pointer" vmethod 2019-06-05 09:34:39 +00:00
meta-plugin.c compositor: Make type derivable 2019-08-19 08:44:58 +00:00
meta-shadow-factory.c Make meta_* logging utilities not require line break 2020-10-08 16:38:41 +02:00
meta-shaped-texture-private.h shaped-texture: Make set_opaque_region() private 2020-06-29 12:57:55 +02:00
meta-shaped-texture.c shaped-texture: Update the full bounding box of each clip rectangle 2021-01-27 17:05:38 +08:00
meta-surface-actor-wayland.c surface-actor-wayland: Handle Xwayland vanishing gracefully 2021-02-09 19:06:22 +00:00
meta-surface-actor-wayland.h surface-actor-wayland: Add API to pick a primary stage view 2020-11-19 19:43:40 +01:00
meta-surface-actor-x11.c Remove misplaced line break in g_* logging functions 2020-10-08 16:38:41 +02:00
meta-surface-actor-x11.h surface-actor: Remove 'pre-paint' vfunc 2020-07-02 19:36:51 +02:00
meta-surface-actor.c compositor: Fix warning with -Wmaybe-uninitialized 2020-12-08 13:35:50 +00:00
meta-surface-actor.h surface-actor: Add API to check obscuredness per stage view 2020-11-19 19:42:08 +01:00
meta-sync-ring.c Make meta_* logging utilities not require line break 2020-10-08 16:38:41 +02:00
meta-sync-ring.h Clean up include macros mess 2018-11-06 17:17:36 +01:00
meta-texture-tower.c texture-tower: Use memory management helpers more 2020-10-16 16:17:38 +00:00
meta-texture-tower.h clutter, core: Stop using the Cogl framebuffer stack 2019-12-03 19:02:14 +00:00
meta-window-actor-private.h window-actor: Add a new can_freeze_commits() API 2021-01-30 10:13:03 +00:00
meta-window-actor-wayland.c window-actor: Add a new can_freeze_commits() API 2021-01-30 10:13:03 +00:00
meta-window-actor-wayland.h wayland: Move tree updating to the shell surface role 2020-02-19 22:34:28 +00:00
meta-window-actor-x11.c window-actor: Add a new can_freeze_commits() API 2021-01-30 10:13:03 +00:00
meta-window-actor-x11.h window-actor: Move shapes, shadows and unredirection to X11 sub types 2019-10-16 13:16:55 +02:00
meta-window-actor.c window-actor: Add a new can_freeze_commits() API 2021-01-30 10:13:03 +00:00
meta-window-group-private.h Clean up include macros mess 2018-11-06 17:17:36 +01:00
meta-window-group.c shaped-texture: Fix use-nearest check when viewports are scaled 2020-03-26 08:32:46 +00:00
meta-window-shape.c Clean up include macros mess 2018-11-06 17:17:36 +01:00
README Document window and surface actors 2019-01-04 09:32:58 -02:00
region-utils.c region-utils: Always use FLT_EPSILON when comparing floating point values 2020-11-16 19:27:20 +01:00
region-utils.h region-utils: Make transform util const correct 2020-05-26 13:54:28 +00:00

Intro
=====

In general, the compositor splits the window from the contents of
the window from the shape of the window. In other words, a window
has contents, and the contents of the window have a shape. This is
represented by the actor hierarchy:

 +--------------------------------------+
 | MetaWindowActor                      |
 | +----------------------------------+ |
 | | MetaSurfaceActor                 | |
 | | +------------------------------+ | |
 | | | MetaShapedTexture            | | |
 | | |                              | | |
 | | |                              | | |
 | | |                              | | |
 | | |                              | | |
 | | +------------------------------+ | |
 | +----------------------------------+ |
 +--------------------------------------+

Surfaces may also contain subsurfaces. The MetaWindowActor and
MetaSurfaceActor subclasses that will be created depend on the client
type, and the display server type.

## Subsurfaces

Additionally, there is also the case of subsurfaces: surfaces that
are child of other surfaces. That is also represented in the actor
hierarchy by having one or many MetaSurfaceActors (the subsurfaces)
added as children of a parent MetaSurfaceActor. There are no limits
to how many subsurfaces a surface may have. With subsurfaces, the
actor hierarchy looks like this:

 MetaWindowActor
  ↳ MetaSurfaceActor (surface)
     ↳ MetaShapedTexture
     ↳ MetaSurfaceActor (subsurface)
        ↳ MetaShapedTexture
        ↳ MetaSurfaceActor (sub-subsurface)
           ↳ MetaShapedTexture
     ↳ MetaSurfaceActor (subsurface)
        ↳ MetaShapedTexture

In this example, the main surface has 2 subsurfaces. One of these
subsurfaces contains a subsurface as well.

All MetaWindowActors contain at least one MetaSurfaceActor, and all
MetaSurfaceActors contain a MetaShapedTexture.

## Client and compositor

MetaWindowActor and its subclasses represent the client window's
type. A X11 client will have a MetaWindowActorX11 representing it,
and a Wayland client will have a MetaWindowActorWayland.

On the compositor side, the surface where the contents of the window
are drawn into are represented by MetaSurfaceActor subclasses. On a
Wayland session, windows are backed by a MetaSurfaceActorWayland
surface, whereas on X11 sessions, by MetaSurfaceActorX11.

XWayland windows are X11 client windows (MetaWindowActorX11) backed
by Wayland surfaces (MetaWindowActorWayland).


Env Vars
========

MUTTER_DISABLE_MIPMAPS - set to disable use of mipmaped windows.