1
0
Fork 0
Commit graph

1265 commits

Author SHA1 Message Date
Georges Basile Stavracas Neto
8d47f79b2c clutter/actor: Remove '_paint' suffix from clutter_actor_should_pick_paint
We're not using paint to pick anymore.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1509
2020-10-26 09:20:38 -03:00
Georges Basile Stavracas Neto
05b6b6a88d clutter/actor: Use pick context in clutter_actor_should_pick_paint()
Pass the ClutterPickContext to clutter_actor_should_pick_paint() and
check the pick mode from it.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1509
2020-10-26 09:20:38 -03:00
Daniel van Vugt
a24b2f4b0f background-content: Assume background clones are always transformed
Because clones may not have identical geometry to their source actors.
So we can't use the geometry of the source actor to decide to take the
more optimized (more clipped) path.

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1480
2020-10-23 22:54:25 +00:00
Jonas Ådahl
5a58ccbece texture-tower: Use memory management helpers more
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1496
2020-10-16 16:17:38 +00:00
Jonas Ådahl
1cc82cf759 background: Use memory management helpers more
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1496
2020-10-16 16:17:38 +00:00
Jonas Ådahl
eb14da3874 cogl: Turn CoglFramebuffer, CoglOffscreen and CoglOnscreen into GObjects
A first step towards abandoning the CoglObject type system: convert
CoglFramebuffer, CoglOffscreen and CoglOnscreen into GObjects.
CoglFramebuffer is turned into an abstract GObject, while the two others
are currently final. The "winsys" and "platform" are still sprinkled
'void *' in the the non-abstract type instances however.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1496
2020-10-16 16:17:38 +00:00
Robert Mader
1c1c8b25ed window-actor: Freeze subsurfaces as well
In order to prevent glitches in animations, make sure we freeze all
surfaces of a window actor.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1339
2020-10-14 15:53:53 +00:00
Jonas Ådahl
bf6dde87f8 compositor: Make sure _NET_WM_FRAME_DRAWN timestamp has the right scope
The timestamp sent with _NET_WM_FRAME_DRAWN should be in "high
resolution X server timestamps", meaning they should have the same scope
as the built in X11 32 bit unsigned integer timestamps, i.e. overflow at
the same time.

This was not done correctly when mutter had determined the X server used
the monotonic clock, where it'd just forward the monotonic clock,
confusing any client using _NET_WM_FRAME_DRAWN and friends.

Fix this by 1) splitting the timestamp conversiot into an X11 case and a
display server case, where the display server case simply clamps the
monotonic clock, as it is assumed Xwayland is always usign the monotonic
clock, and 2) if we're a X11 compositing manager, if the X server is
using the monotonic clock, apply the same semantics as the display
server case and always just clamp, or if not, calculate the offset every
10 seconds, and offset the monotonic clock timestamp with the calculated
X server timestamp offset.

This fixes an issue that would occur if mutter (or rather GNOME Shell)
would have been started before a X11 timestamp overflow, after the
overflow happened. In this case, GTK3 clients would get unclamped
timestamps, and get very confused, resulting in frames queued several
weeks into the future.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1494
2020-10-12 14:48:21 +00:00
Jonas Ådahl
2c95e08998 Remove misplaced line break in g_* logging functions
They resulted in empty lines in the log.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1466
2020-10-08 16:38:41 +02:00
Jonas Ådahl
313e3e771c Make meta_* logging utilities not require line break
Unlike g_* logging utilities, the meta_* counterparts behave like odd
printf() functions. Lets change that so they fit better into how logging
is done everywhere else.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1466
2020-10-08 16:38:41 +02:00
Georges Basile Stavracas Neto
a3cb1cabd3 texture-tower: Use graphene APIs
A boring one, with the exception that row and column needed to be
swapped. For the sake of consistency, the variable names were also
synchronized with the values they hold, so e.g. xy → yx, etc.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
2020-10-06 15:34:48 +00:00
Georges Basile Stavracas Neto
f6998f87c2 src: Use graphene APIs
This commit encompasses the trivial ones.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
2020-10-06 15:34:48 +00:00
Georges Basile Stavracas Neto
4376f59c1e shaped-texture: Use graphene APIs
This is a slightly delicate port; much like the ClutterActor port,
using graphene required swapping the order of operations upside down.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
2020-10-06 15:34:48 +00:00
Georges Basile Stavracas Neto
3e0c961b76 Replace the CoglMatrix type by graphene_matrix_t
CoglMatrix already is a typedef to graphene_matrix_t. This commit
simply drops the CoglMatrix type, and align parameters. There is
no functional change here, it's simply a find-and-replace commit.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
2020-10-06 15:34:47 +00:00
Georges Basile Stavracas Neto
cedb5318da cogl/matrix: Relocate and update projection and transform APIs
Ideally, we would use Graphene to do that, however as of now Graphene
lacks these APIs so we still need these helpers. Since we're preparing
to get rid of CoglMatrix, move them to a separate file, and rename them
with the 'cogl_graphene' prefix.

Since I'm already touching the world with this change, I'm also renaming
cogl_matrix_transform_point() to cogl_graphene_matrix_project_point(),
as per XXX comment, to make it consistent with the transform/projection
semantics in place.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
2020-10-06 15:34:47 +00:00
Georges Basile Stavracas Neto
55b05e5631 Don't access CoglMatrix struct fields
Instead, use the new cogl_matrix_get_value() API.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
2020-10-06 15:34:46 +00:00
Florian Müllner
f481cbfa16 plugin: Drop version information
Mutter itself is versioned now, so passing the version information
to the plugin is redunant now: The version is already determined by
linking to a particular API version (gnome-shell) or by installing
to a versioned plugin path (external plugins).

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1473
2020-10-06 15:14:34 +02:00
Robert Mader
78592cbcc8 surface-actor: Simplify culling logic
This reverts the commits 372d73e275 and 1d20045247 - the special
case for alpha-less textures could only happen on Wayland, but now
the opaque region is also set in those cases.

This commit saves us some allocations, simplifies the logic a bit and
makes sure culling uses the same opaque region as our painting paths.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1463
2020-10-02 15:09:12 +00:00
Daniel van Vugt
64d34a7648 background-content: Apply Cullable clipping even in the transformed case
Just like we used to before 30809665d8.

Because in some cases `clip_region` is able to shave off an extra pixel
from the edge of the redraw rectangle(s). And not shaving that off was
making the background rendering inconsistent with shaped-texture, causing
occasional off-by-one artefacts. Now both shaped-texture and
background-content agree on the clip region again that doesn't happen.

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

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1464
2020-10-01 18:13:15 +08:00
Robert Mader
effb824412 shaped-texture: Add debug paint overlay for opaque regions
Using opaque painting paths can have a big impact on painting performance.
In order to easily validate whether we use the opaque paths, add a opaque
(green) or blended (purple) overlay over painted areas if the
`META_DEBUG_PAINT_OPAQUE_REGION` `MetaDebugPaintFlag` is set.

You can do so in `lg` via:
`Meta.add_debug_paint_flag(Meta.DebugPaintFlag.OPAQUE_REGION)`

This can be helpful for application developers, as previously it was not
trivial to check whether e.g. Wayland or X11 opaque regions where
properly set.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1372
2020-08-31 17:48:56 +02:00
Daniel van Vugt
86af337585 background-content: Use redraw_clip when culling is unavailable
When in the overview culling via `self->clip_region` is unavailable.
The region is `NULL` because the paint call has not originated from a
`WindowGroup`, because the overview does not use `WindowGroup`.

So the main wallpaper was being painted in full while in the overview.
That's a waste of effort because `redraw_clip` is going to be used to
stencil/scissor out only the parts that are changing. We don't need to
paint *most* of the wallpaper, only the parts behind anything changing.

For the overview this reduces GPU power usage (intel_gpu_top) roughly
10% and reduces render times almost as much.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1363
2020-08-30 12:04:07 +00:00
Daniel van Vugt
30809665d8 background-content: Explicitly distinguish stage space from actor space
`meta_background_content_paint_content` was mixing two different
coordinate systems in `actor_pixel_rect`. It was initialized with
actor-local coordinates and then `if (self->clip_region)` would be
treated as stage coordinates. This worked because `self->clip_region`
was only non-NULL outside of the overview where both coordinate systems
were the same. So it always got the right answer, possibly by accident.

In order to enhance the function however we will need to know which
coordinate system we're working in, so now we make it explicit.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1363
2020-08-30 12:04:07 +00:00
Daniel van Vugt
0efecc1dc5 background-content: Don't set up pipeline unless it's needed
There was still a possibility we might return and not paint anything
so there's no need to set up the pipeline before that.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1363
2020-08-30 12:04:07 +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
Jonas Ådahl
07e964e9fc clutter/actor: Return the actor used when picking clock
The actor used might be relevant, so that e.g. if it moves or for some
other reason changes stage views, the user can listen for that.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1404
2020-08-13 06:34:05 +00:00
Daniel van Vugt
305fcd0713 clutter-stage: Add gl-video-memory-purged signal
For when you want parts of Clutter to connect to the signal, without
referencing Meta classes.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1374
2020-08-05 08:26:37 +00:00
Olivier Fourdan
ca64a308eb surface-actor: Restore drop shadow with server-side decorations
Commit 510cbef15a changed the logic in `handle_update()` for X11 window
actors to return early if the surface is not an X11 surface.

That works fine for plain Xorg, but on Xwayland, the surface is actually
a Wayland surface, therefore the function returns early before updating
the drop shadows of server-side decorations for X11 windows.

Change the test logic to restore drops shadows with Xwayland windows.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1384
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1358
2020-07-28 13:21:23 +00:00
Olivier Fourdan
d0ee02fae7 cleanup: Remove duplicate semicolons in C code
No functional change, it just hurts my eyes when reading the code.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1385
2020-07-28 10:32:46 +02:00
Daniel van Vugt
ecaaccb064 background: Use NEAREST filtering when the texture is the monitor resolution
That was obviously always the intention, but it didn't work when the
display was scaled. My 3840x2160 monitor with a 3840x2160 texture was
being rendered with LINEAR filtering.

It seems the `force_bilinear` flag was TRUE when it should be FALSE.
Because a texture area that's an integer fraction of the texture
resolution is still a perfect match when that integer is the monitor
scale. We were also getting:

`meta_actor_painting_untransformed (fb, W, H, W, H, NULL, NULL) == FALSE`

when the display was scaled. Because the second W,H was not the real
sampling resolution. So with both of those issues fixed we now get
NEAREST filtering when the texture resolution matches the resolution it's
physically being rendered at.

Note: The background texture actually wasn't equal to the physical monitor
resolution prior to January 2020 (76240e24f7). So it wasn't possible to do
this before then. Since then however, the texture resolution is always
equal to the physical monitor resolution.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1346
2020-07-08 07:26:50 +00:00
Robert Mader
d722e59aac window-actor/wayland: Remove custom get_paint_volume() vfunc
It doesn't take all children - subsurfaces in this case - into
account, thus creating glitches if subsurfaces extend outside
of the toplevel surface.

Further more it doesn't seem to serve any special purpose - it was
added in f7315c9a36, a pretty big commit, and no discussion was
started about the code in question. So it was likely just overlooked
in the review process.

Closes https://gitlab.gnome.org/GNOME/mutter/-/issues/873
Closes https://gitlab.gnome.org/GNOME/mutter/-/issues/1316
2020-07-07 12:25:43 +00:00
Daniel van Vugt
32dbcd9352 background-content: Mipmap background texture rendering
gnome-shell displays workspace previews at one tenth scale. That's a
few binary orders of magnitude so even using a LINEAR filter was
resulting in visible jaggies. Now we apply mipmapping so they appear
smooth.

As an added bonus, the mipmaps used occupy roughly 1% the memory of
the original image (0.1 x 0.1 = 0.01) so they actually fit into GPU/CPU
caches now and rendering performance is improved. There's no need to
traverse the original texture which at 4K resolution occupies 33MB,
only a 331KB mipmap.

In my case this reduces the render time for the overview by ~10%.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/1416

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1347
2020-07-07 16:15:28 +08:00
Jonas Ådahl
a9a9a0d1c5 clutter: Paint views with individual frame clocks
Replace the default master clock with multiple frame clocks, each
driving its own stage view. As each stage view represents one CRTC, this
means we draw each CRTC with its own designated frame clock,
disconnected from all the others.

For example this means we when using the native backend will never need
to wait for one monitor to vsync before painting another, so e.g. having
a 144 Hz monitor next to a 60 Hz monitor, things including both Wayland
and X11 applications and shell UI will be able to render at the
corresponding monitor refresh rate.

This also changes a warning about missed frames when sending
_NETWM_FRAME_TIMINGS messages to a debug log entry, as it's expected
that we'll start missing frames e.g. when a X11 window (via Xwayland) is
exclusively within a stage view that was not painted, while another one
was, still increasing the global frame clock.

Addititonally, this also requires the X11 window actor to schedule
timeouts for _NET_WM_FRAME_DRAWN/_NET_WM_FRAME_TIMINGS event emitting,
if the actor wasn't on any stage views, as now we'll only get the frame
callbacks on actors when they actually were painted, while in the past,
we'd invoke that vfunc when anything was painted.

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

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
2020-07-02 19:36:51 +02:00
Jonas Ådahl
37326e4a32 compositor: Use stage signals instead of clutter repaint callbacks
The repaint callbacks are not tied to repaint, thus a bit misleading.
What the functionality in the pre/post-paint callbacks here cares about
is when actually painting; the non-painting related parts has already
moved out to a *-update signal.

This also renames the related MetaWindowActorClass vfuncs, to align with
naming convention of the signals that it listens to.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
2020-07-02 19:36:51 +02:00
Jonas Ådahl
8cff3b84f7 wayland/compositor: Process frame callbacks on 'after-update'
Instead of going via MetaCompositor to know about when we updated
(confusingly named post-paint), use the new stage signal directly.

Note that this doesn't change the time frame callbacks are dispatched;
it's still not tied to actual painting even though it seemed so before
given the function names.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
2020-07-02 19:36:51 +02:00
Jonas Ådahl
578c30792a compositor: Remove unused stage pointer
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
2020-07-02 19:36:51 +02:00
Jonas Ådahl
5f729ea437 clutter/stage: Only emit "presented" on completion event
We'd emit multiple "presented" signals per frame, one for "sync" and one
for "completion". Only the latter were ever used, and removing the
differentiation eases the avoidance of cogl onscreen framebuffer frame
callback details leaking into clutter.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
2020-07-02 19:36:51 +02:00
Jonas Ådahl
ae7cc0417f compositor: Remove 'pre-paint' signal
It's not used; just use the vfunc directly.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
2020-07-02 19:36:51 +02:00
Jonas Ådahl
468bf81307 surface-actor: Remove 'pre-paint' vfunc
The vfunc was not tied to "paint", but was used by MetaWindowActorX11
as part of the "update" mechanisms. In order to make that more clear,
special case it in MetaWindowActorX11 by type checking the surface
actor, handling the case without MetaSurfacActor abstraction.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
2020-07-02 19:36:51 +02:00
Jonas Ådahl
551101c65c compositor-x11: Move synchronization to before-update
The synchronization must happen no matter the painting, as it in itself
might result in reported damage, making the stage actually painted. Thus
move it out of the "pre-paint" handler, to something explicitly not tied
to the painting itself - ClutterStage::before-update.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
2020-07-02 19:36:51 +02:00
Jonas Ådahl
110ed7ff8a laters: Use 'before-update' signal from stage
Instead of the 'pre-paint' signal on MetaCompositor, rely directly on
the 'before-update' signal on the stage. A reason for this is that the
callback should not only invoked in connection to painting, but updating
in general. Currently the 'pre-paint' signal is emitted no matter
whether there were any painting or not, but that's both misleading and
will go away.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
2020-07-02 19:36:51 +02:00
Jonas Ådahl
fc0b8f9d9c laters: Use clutter_stage_schedule_update() instead of timeline
The MetaLater functionality needs to make sure an update is scheduled so
that it can run its callbacks etc. This used a ClutterTimeline (which is
an object more or less meant to drive animations markers, frames etc)
just to keep the master frame clock running. We're moving away from a
single master clock, so just schedule updates directly instead, with the
newly exposed API.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
2020-07-02 19:36:50 +02:00
Robert Mader
86646679f1 surface-actor: Add culling offset for geometry scale - take 2
41130b08eb added a fix for culling subsurfaces with geometry scale.
Unfortunately it only did so for the opaque regions, not for clip and
unobscured regions, as the effect was hidden by bug that was only
fixed by 3187fe8ebc.

Apply the same fix to clip and unobscured regions and use the chance
to move most of the slightly hackish geometry scale related code
into a single place.

We need to scale slightly differently in the two cases, indicated by
the new `ScalePerspectiveType` enum, as the scale is dependent on the
perspective - once from outside, once from inside of the scaled actor.

Closes https://gitlab.gnome.org/GNOME/mutter/-/issues/1312
2020-06-30 20:57:57 +02:00
Jonas Dreßler
98df2dbd05 clutter/actor: Always return a resource scale in get_resource_scale()
Since we now always return a resource scale, we can remove the boolean
return value from clutter_actor_get_resource_scale() and
_clutter_actor_get_real_resource_scale(), and instead simply return the
scale.

While at it, also remove the underscore from the
_clutter_actor_get_real_resource_scale() private API.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1276
2020-06-30 13:15:53 +00:00
Daniel van Vugt
9823a0f6c9 background-content: Fix an x/y mixup
Fortunately the coordinate is local and always (0,0) so it didn't
break anything.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1341
2020-06-30 18:37:35 +08:00
Robert Mader
1142f06af5 shaped-texture: Clean up set_opaque_region()
Make the code more consistent with similar functions elsewhere
and save a few cycles by removing the type check.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1334
2020-06-29 12:58:10 +02:00
Robert Mader
bb4e87bf35 shaped-texture: Make set_opaque_region() private
The shell doesn't use it and I couldn't find any extensions that does
and it probably doesn't make much sense any more these days anyway.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1334
2020-06-29 12:57:55 +02:00
Daniel van Vugt
e5542c3210 shaped-texture: Use the REPLACE combine function on opaque areas
We were setting the pipeline colour to all white (1.0, 1.0, 1.0, 1.0)
and so the default layer combine function multiplied each pixel
(R, G, B, A) by all ones. Obviously multiplying by one four times per
pixel is a waste of effort so we remove the colour setting *and* set
the layer combine function to a trivial shader that will ignore whatever
the current pipeline colour is set to. So now we do **zero** multiplies
per pixel.

On an i7-7700 at UHD 3840x2160 this results in 5% faster render times
and 10% lower power usage (says intel_gpu_top). The benefit is probably
much higher for virtual machines though, as they're no longer being
asked to do CPU-based math on every pixel of a window.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1331
2020-06-27 10:20:11 +00:00
Robert Mader
3187fe8ebc shaped-texture: Reintroduce clip_region
In commit 4c1fde9d MetaCullable related code was moved out of
MetaShapedTexture into MetaSurfaceActor. While generally desirable,
this removed drawing optimizations in MetaShapedTexture for partial
redraws. The common case for fully obscured actors was still supposed
to work, but it was now discovered that it actually did not.

This commit revert parts of 4c1fde9d: it reintroduces clipping
to MetaShapedTexture but leaves all culling and actor related logic
in MetaSurfaceActor.

Thanks to Daniel van Vugt for uncovering the issue.

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

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1326
2020-06-22 17:56:01 +02:00
Corentin Noël
e09ac67698 window-actor-x11: switch the signal callback argument and data on shadow factory change
invalidate_shadow takes the MetaWindowActorX11 as argument and not the MetaShadowFactory.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1314
2020-06-15 13:22:08 +00:00
Jonas Dreßler
e6a93326bf window-actor: Don't freeze actor updates during the size-change effect
As explained in the last commits, we'll let gnome-shell take care of
this since freezing and thawing needs to be decoupled from the effect
starting and ending.

So stop freezing the MetaWindowActor when starting the effect and
thawing the actor when ending the effect.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1250
2020-06-15 13:10:16 +00:00