Commit Graph

26149 Commits

Author SHA1 Message Date
Georges Basile Stavracas Neto
edf8a1e399 clutter/effect: Move ClutterEffect creation to ClutterActor
As so paint node creation is centralized in a single function.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1355
2020-07-06 11:05:59 -03:00
Georges Basile Stavracas Neto
dd80e623a0 clutter/offscreen-effect: Document paint nodes
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1355
2020-07-06 11:05:59 -03:00
Georges Basile Stavracas Neto
5e680fd43f clutter/effect: Add paint nodes to all paint vfuncs
In the purely paint node based rendering future, ClutterEffects
simply add more paint nodes to the tree when painting the actor.

This is the leap to achieve that future.

Add paint nodes to pre_paint, paint, and post_paint, and move the
ClutterEffectNode creation to _clutter_effect_paint().

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1355
2020-07-06 11:05:59 -03:00
Georges Basile Stavracas Neto
4226fa50da clutter/offscreen-effect: Remove clutter_offscreen_effect_get_target_rect
And drop the annoying 'position' field from ClutterOffscreenEffect as well.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1355
2020-07-06 11:05:59 -03:00
Georges Basile Stavracas Neto
e5ee6e1138 clutter/deform-effect: Use clutter_offscreen_effect_get_target_size()
We don't read the x/y position anyway.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1355
2020-07-06 11:05:59 -03:00
Georges Basile Stavracas Neto
47b88de3b6 clutter/offscreen-effect: Undeprecate clutter_offscreen_effect_get_target_size()
clutter_offscreen_effect_get_target_rect() is going away soon.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1355
2020-07-06 11:05:59 -03:00
Georges Basile Stavracas Neto
e9b9784c5c clutter/offscreen-effect: Implement paint_node()
The paint node tree that ClutterOffscreenEffect generates is
simple:

  Root
    |------------+
    |            |
  Layer        Pipeline
    |
  Actor

Right now, both pre-paint and ClutterLayerNode push the offscreen
to the framebuffer stack. That's harmless, and will go away soon
anyway.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1355
2020-07-06 11:05:59 -03:00
Georges Basile Stavracas Neto
1135a74e3e clutter/offscreen-effect: Use paint nodes to paint target
Add a new ClutterPaintNode parameter to the paint_target() vfunc.
For now, create a temporary ClutterEffectNode that is passed to
paint_target() and immediately painted; next commits will move
this to upper layers.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1355
2020-07-06 11:05:59 -03:00
Georges Basile Stavracas Neto
ae14a0a677 clutter/desaturate-effect: Switch to create_pipeline vfunc
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1355
2020-07-06 10:55:32 -03:00
Georges Basile Stavracas Neto
dbe0602c4c clutter/colorize-effect: Switch to create_pipeline vfunc
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1355
2020-07-06 10:55:32 -03:00
Georges Basile Stavracas Neto
f6c57366af clutter/brightness-contrast-effect: Switch to create_pipeline vfunc
Pretty much the exact same steps and constraints of the previous
commit.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1355
2020-07-06 10:55:32 -03:00
Georges Basile Stavracas Neto
6ee3ece103 clutter/blur-effect: Switch to create_pipeline vfunc
The blur pipeline is still cached on ClutterBlurEffect, and we
simply update the uniforms when asked to create the pipeline.

Now that ClutterOffscreenEffect will use the blur pipeline, it
doesn't need to override the paint_target() vfunc anymore.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1355
2020-07-06 10:55:32 -03:00
Georges Basile Stavracas Neto
be3743ec3f clutter/offscreen-effect: Add new create_pipeline() vfunc
The most annoying aspect of ClutterOffscreenEffect right now, and
the reason for all its subclasses to override pre-paint, is that
the pipeline creating isn't under subclasses' control. That means
all subclasses must ask ClutterOffscreenEffect to run pre-paint
and create the pipeline, then they all create their own pipelines
to paint.

To reduce this complexity, add a new create_pipeline() vfunc to
ClutterOffscreenEffect. Next commits will port effects to use this
vfunc when necessary.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1355
2020-07-06 10:55:32 -03:00
Georges Basile Stavracas Neto
59a3075f60 clutter/offscreen-effect: Remove CoglMaterial from public API
Rename clutter_offscreen_effect_get_material() to get_pipeline() and
make it return (actuall, stop casting to) a CoglMaterial.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1355
2020-07-06 10:55:32 -03:00
Georges Basile Stavracas Neto
5d7edde37d Introduce ClutterBlitNode
It is not possible to express a blit operation using paint
nodes as of now. This is a requirement for GNOME Shell, e.g.,
to implement its blur effect.

Add a new ClutterBlitNode node that takes two framebuffers as
input, and blits source into dest according to added rectangles.

Because this paint node uses the rectangles in a different way
compared to all the other nodes, add an auxiliary method to
ensure all blit operations are valid.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1340
2020-07-06 10:55:00 -03:00
Georges Basile Stavracas Neto
96e8074a4f clutter/paint-nodes: Add serialization to layer node
It's useful to know which framebuffer the layer node is holding,
so serialize that too.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1340
2020-07-06 10:55:00 -03:00
Georges Basile Stavracas Neto
c261eb736a clutter/paint-nodes: Push and pop framebuffer even without ops
ClutterLayerNode currently skips pushing and popping its framebuffer
to the paint context when no rectangles are added to it. However,
it's still useful to do that, since we might want to render child
nodes to the offscreen and reuse the pipeline in a later node.

Make ClutterLayerNode push and pop its framebuffer even without
rectangles.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1340
2020-07-06 10:55:00 -03:00
Georges Basile Stavracas Neto
03be5ed9f1 clutter/paint-nodes: Add new ClutterLayerNode API
ClutterLayerNode is the "offscreen framebuffer" node, that paints
it's child nodes in a separate framebuffer, and then copies that
framebuffer to the parent one.

It'll be useful to hand ClutterLayerNode which framebuffer to use,
as this is a requirement for porting e.g. ClutterOffscreenEffect
and subclasses.

Add a new clutter_layer_node_new_with_framebuffer() API.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1340
2020-07-06 10:55:00 -03:00
Georges Basile Stavracas Neto
6f0719b3c7 clutter/paint-nodes: Don't skip pipeline node constructor
ClutterPipelineNode will be used by GNOME Shell in the future.
Fortunately for us, CoglPipeline is already usable from GJS,
so we don't need to skip the constructor for the pipeline node.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1340
2020-07-06 10:55:00 -03:00
Georges Basile Stavracas Neto
6be6f04456 clutter/paint-nodes: Add opacity overriding to ClutterActorNode
Some effects, such as ShellBlurEffect and ClutterOffscreenEffect, need
to make sure the actor is painted fully opaque. With ClutterActorNode,
however, that is currently not possible.

Add a new 'opacity' parameter to clutter_actor_node_new(). It follows
the opacity override heuristic, where -1 means disable, and anything
else is clamped to [0, 255].

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1340
2020-07-06 10:54:49 -03:00
Georges Basile Stavracas Neto
e0a8e824b3 clutter/offscreen-effect: Simplify paint
Simply chain up to get the pre and post paint methods,
instead of reimplementing ClutterEffect.paint()

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1340
2020-07-06 10:39:59 -03:00
Georges Basile Stavracas Neto
0d51678bbe clutter/offscreen-effect: Clear framebuffer on pre_paint
Move the framebuffer cleanup to ClutterOffscreenEffect.pre_paint().
This will allow us to properly chain up ClutterOffscreenEffect.paint()
and not reimplement exactly what ClutterEffect does by default.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1340
2020-07-06 10:39:59 -03:00
Georges Basile Stavracas Neto
35af306acc clutter/effect: Add paint_node vfunc
Introduce a new paint_node vfunc that, if implemented, allows
the effect to add nodes to a transient paint node that is
immediately painted. This is a transitional step until we
have fully delegated paint node rendering.

The most basic implementation of a ClutterEffect.paint_node
vfunc, and also the default implementation, is with an actor
node, as follows:

```
static void
foo_bar_paint_node (ClutterEffect           *effect,
                    ClutterPaintNode        *node,
                    ClutterPaintContext     *paint_context,
                    ClutterEffectPaintFlags  flags)
{
  g_autoptr (ClutterPaintNode) actor_node = NULL;

  actor_node = clutter_actor_node_new (effect->actor);
  clutter_paint_node_add_child (node, actor_node);
}
```

This example gives the exact same behavior of simply calling
clutter_actor_continue_paint(). In the future, the paint node
itself will be a parameter of clutter_actor_continue_paint()
and we'll be able to simplify it event more.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1340
2020-07-06 10:39:59 -03:00
Georges Basile Stavracas Neto
e8f9d093b1 Introduce ClutterEffectNode
ClutterEffectNode is a private ClutterPaintNode implementation
that does effectively nothing, but helps organizing the paint
node tree. It also helps debugging, since it can output the
effect class and name to the JSON debugging routines.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1340
2020-07-06 10:39:59 -03:00
Georges Basile Stavracas Neto
0f1289e534 clutter/effect: Don't expose pre and post paint helpers
They're not used outside ClutterEffect.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1340
2020-07-06 10:39:59 -03:00
Daniel van Vugt
dbff32ec5c clutter-backend: Default to scale 1
So we at least don't trigger assertions for invalid scales of zero.

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

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1349
2020-07-03 19:57:30 +00:00
Carlos Garnacho
2f1f47d257 x11: Look up reason for selection clear events from XFixes
If the event originates from a XSetSelectionOwner request, the event
will contain a XFixesSetSelectionOwnerNotify subtype. The other
subtypes (meant for the selection window being destroyed, and the
client closing) are the situations where we mean to replace the
selection.

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

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1350
2020-07-03 13:58:25 +02:00
Jonas Ådahl
06781985e4 clutter/timeline: Warn if started with a detached actor
The timeline can't find a frame clock if the actor is detached, so warn
if that happens.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
2020-07-02 20:13:53 +02:00
Georges Basile Stavracas Neto
5b0a7b3a33 clutter/timeline: Wait for stage if no frame clock is available
When picking which frame clock to use, we traverse up in the actor
hierarchy until a suitable frame clock is found. ClutterTimeline
also listens to the 'stage-views-changed' to make sure it's always
attached to the correct frame clock.

However, there is one special situation where neither of them would
work: when the stage doesn't have a frame clock yet, and the actor
of the timeline is outside any stage view. When that happens, the
returned frame clock is NULL, and 'stage-views-changed' is never
emitted by the actor.

Monitor the stage for stage view changes when the frame clock is
NULL.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
2020-07-02 19:36:51 +02:00
Jonas Ådahl
1ecdaa646f wayland: Respond to frame callbacks also if a clone was painted
This will mean that a surface on one monitor, with e.g. a preview on
another, will still get frame callbacks if the preview is painted, but
itself being hidden.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
2020-07-02 19:36:51 +02:00
Jonas Ådahl
2f4d50c723 clutter/actor: Add API to check whether actor or clone is on view
The new function returns TRUE if an actor is effectively on the passed
view, where effectively refers to itself or a clone containing itself.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
2020-07-02 19:36:51 +02:00
Jonas Ådahl
4b8bb4608c clutter/transition: Get timeline actor from animatable
Undeprecate the non-actor carrying transition constructor, and instead
rely on set_animatable() to give us a source for an actor to derive a
view and frame clock from.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
2020-07-02 19:36:51 +02:00
Jonas Ådahl
aa34f6ad7c clutter/actor: Pick frame clock of parent if not on any views
An actor may be placed without being on any current stage view; in this
case, to get the ball rolling, walk up the actor tree to find the first
actor where a frame clock can be picked from.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
2020-07-02 19:36:51 +02:00
Jonas Ådahl
f9be670522 tests/frame-clock: Check that destroy signal is emitted
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
2020-07-02 19:36:51 +02:00
Jonas Ådahl
d77bcb9028 clutter/animatable: Add way to get an actor from an animatable
This will be used by ClutterTransition to associate the timeline with an
actor, which itself will be used to determine what frame clock should
drive the timeline.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
2020-07-02 19:36:51 +02:00
Jonas Ådahl
d29c8e290c clutter/frame-clock: Add explicit destroy function
The frame clock owner should be able to explicitly destroy (i.e. make
defunct) a frame clock, e.g. when a stage view is destructed. This is so
that other objects can keep reference to its without it being left
around even after stopped being usable.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
2020-07-02 19:36:51 +02:00
Jonas Ådahl
e12ce70385 tests/stage-view: Test that timelime adapts to actor moving across views
The timeline should switch frame clock, and automatically continue on
the new frame clock.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
2020-07-02 19:36:51 +02:00
Jonas Ådahl
442f34b4de tests/stage-view: Test that actors pick the right frame clock
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
2020-07-02 19:36:51 +02:00
Jonas Ådahl
20becd782f clutter/stage-view: Export refresh rate getter symbol
To be used by tests.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
2020-07-02 19:36:51 +02:00
Jonas Ådahl
feb8bfa0bf clutter/frame-clock: Add refresh rate getter
This gets the refresh rate of the frame clock. To be used by tests.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
2020-07-02 19:36:51 +02:00
Jonas Ådahl
59a38fcb69 tests/stage-view: Check that hotplugging reestablishes view list
Currently there is a point in between hot plug, and when the stage view
list is up to date. The check also tests for this behaviour; would this
ever change, the test should be adapted to deal with this too.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
2020-07-02 19:36:51 +02:00
Jonas Ådahl
190e285c23 tests/stage-view: Remove unnecessary warning supression
It doesn't occur anymore, so lets stop ignoring it.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
2020-07-02 19:36:51 +02: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
57a2f7b4a3 renderer: Use 'add_view()' when adding CRTC views
This also changes the view construction path used by the renderer view
to use the new 'add_view()' function, meaning we have a common entry
point for views into the renderer, which will be useful later on.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
2020-07-02 19:36:51 +02:00
Jonas Ådahl
1f895719b3 renderer-x11-cm: Initialize screen stage view in one step
Before we'd create the view in init(), then continue poking at it in
realize(). Move all of the screen stage view initialization to
realize(), as that's when we have all the dependent state available.
This is possible since there is nothing needing it until realizing.

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
9daec23033 cursor-renderer: Use 'after-paint' stage signal instead paint callback
The clutter "thread" repaint callback are not tied to painting, but
indirectly to updating. What the cursor renderer cares about is when we
actually painted, as this is related to the OpenGL fallback paths.

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