Commit Graph

7352 Commits

Author SHA1 Message Date
Georges Basile Stavracas Neto
4435bec347 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/1474
2020-10-07 13:30:37 +00:00
Georges Basile Stavracas Neto
cef6534e44 clutter/offscreen-effect: Remove CoglMaterial from public API
Rename clutter_offscreen_effect_get_material() to get_pipeline() and
make it return (actually, stop casting to) a CoglMaterial.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1474
2020-10-07 13:30:37 +00:00
Georges Basile Stavracas Neto
f6500042f1 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/1474
2020-10-07 13:30:37 +00:00
Georges Basile Stavracas Neto
de01dea93e 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/1474
2020-10-07 13:30:36 +00:00
Georges Basile Stavracas Neto
f5c77df86c clutter/offscreen-effect: Unref framebuffer on pre_paint
Move unreffing the framebuffer 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/1474
2020-10-07 13:30:36 +00:00
Georges Basile Stavracas Neto
67129c7757 clutter/effect: Don't expose pre and post paint helpers
They're not used outside ClutterEffect.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1474
2020-10-07 13:30:36 +00:00
Carlos Garnacho
0cab71ea52 clutter: Do not special case allocated events
All events should be allocated, stack allocation is avoided and should
be avoided in the future, probably by making ClutterEvent structs opaque.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1475
2020-10-06 21:33:19 +02:00
Carlos Garnacho
a3c95f6023 clutter: Drop clutter_event_peek()
Peeking doesn't seem such a good idea when we switch to async queues.
Luckily nobody seems to be using this.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1475
2020-10-06 21:33:16 +02:00
Georges Basile Stavracas Neto
3cb59050f3 clutter/util: Use graphene APIs
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
2020-10-06 15:34:48 +00:00
Georges Basile Stavracas Neto
462ade5afe clutter/scroll-actor: Use graphene APIs
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
2020-10-06 15:34:48 +00:00
Georges Basile Stavracas Neto
571bf5af6d clutter/pan-action: Use graphene APIs
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
2020-10-06 15:34:48 +00:00
Georges Basile Stavracas Neto
6aa29640d6 clutter/paint-volume: Use graphene APIs
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
2020-10-06 15:34:48 +00:00
Georges Basile Stavracas Neto
eff662f7d7 clutter/paint-nodes: Use graphene APIs
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
2020-10-06 15:34:48 +00:00
Georges Basile Stavracas Neto
aca2880c6a clutter/stage-view: Use graphene APIs
In this case, since we are building the entire matrix by ourselves,
reverse the order of operations (translate + scale → scale + translate)
and build it using graphene-specific APIs.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
2020-10-06 15:34:48 +00:00
Georges Basile Stavracas Neto
dc8f875a8a clutter/offscreen-effect: Stop using CoglMatrix API
Switch to using CoglFramebuffer APIs, which use the modelview matrix
stack. CoglMatrixStack will be ported to graphene APIs later, but it
will be transparent to this change.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
2020-10-06 15:34:48 +00:00
Georges Basile Stavracas Neto
f9d1b7ca58 clutter/clone: Use graphene APIs
This is another instance of graphene reversing the order of operations (see
the commit notes of how ClutterActor was ported.) The tl;dr; here is that,
in the CoglMatrix past, we used to do:

  (actor transforms) → scale

and now, it's the other way round:

  scale → (actor transforms)

due to changing from right-handed multiplications (CoglMatrix) to left-handed
ones (graphene_matrix_t).

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
2020-10-06 15:34:48 +00:00
Georges Basile Stavracas Neto
2406f225a9 clutter/actor: Use graphene APIs
ClutterActor is a particularly heavy user of matrices, and
switching to graphene_matrix_* APIs means we had to change
the order of operations due to left-hand vs right-hand
differences.

When applying the actor transform, there are 2 main branches
that can be followed: the default transforms, and when a
custom transform is set.

To facilitate review, here's the table that I've made to
guide myself:

+--------------- Case 1: Default Transforms --------------+
|        CoglMatrix          |      graphene_matrix_t     |
+----------------------------+----------------------------+
| multiply (child transform) | translate (-pivot)         |
| translate (allocation)¹    | rotate_x (angle)           |
| translate (pivot)¹         | rotate_y (angle)           |
| translate (translation)¹   | rotate_z (angle)           |
| scale (sx, sy, sz)         | scale (sx, sy, sz)         |
| rotate_z (angle)           | translate (translation)¹   |
| rotate_y (angle)           | translate (pivot)¹         |
| rotate_x (angle)           | translate (allocation)¹    |
| translate (-pivot)         | multiply (child transform) |
+----------------------------+----------------------------+

¹ - these 3 translations are simplified as a single call
    to translate(allocation + pivot + translation)

+---------------- Case 2: Custom Transform ---------------+
|        CoglMatrix          |      graphene_matrix_t     |
+----------------------------+----------------------------+
| multiply (child transform) | translate (-pivot)         |
| translate (allocation)²    | multiply (transform)       |
| translate (pivot)²         | translate (pivot)²         |
| multiply (transform)       | translate (allocation)²    |
| translate (-pivot)         | multiply (child transform) |
+----------------------------+----------------------------+

² - likewise, these 2 translations are simplified as a
    single call to translate(allocation + pivot)

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
2020-10-06 15:34:47 +00:00
Georges Basile Stavracas Neto
cbcbe39f4d clutter/stage: Only use graphene_matrix_* APIs
Switch away from cogl_matrix_* APIs in favor of graphene_matrix_*
ones. Notice that cogl_matrix_get_value() swaps row and column,
which is reflected here.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
2020-10-06 15:34:47 +00:00
Georges Basile Stavracas Neto
5db1f67d44 clutter/stage: Setup 2D view internally
Move and simplify cogl_matrix_view_2d_in_perspective() to inside
ClutterStage, since it's the only consumer of this API, and remove
it from Cogl.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
2020-10-06 15:34:47 +00:00
Georges Basile Stavracas Neto
db23ee5829 cogl/matrix: Move inverse calculation to cogl-graphene.c
This special precision-bearing calculation will be used in other
places, so better share them all here.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
2020-10-06 15:34:47 +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
050053a114 cogl/matrix: Remove custom boxed type
Given that CoglMatrix is simply a typedef to graphene_matrix_t, we can
remove all the GType machinery and reuse Graphene's.

Also remove the clutter-cogl helper, and cogl_matrix_to_graphene_matrix()
which is now unused.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
2020-10-06 15:34:47 +00:00
Georges Basile Stavracas Neto
1f38494a7a clutter: Register progress function for graphene_matrix_t
Soon, there'll be no CoglMatrix anymore, and to pair CoglMatrix's
progress function, add the same for graphene_matrix_t.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
2020-10-06 15:34:47 +00:00
Georges Basile Stavracas Neto
6512138791 clutter/actor: Cache inverse transform
It turns it to be quite easy to inverse the transform, and doing that
on ClutterActor level means we can actually think about removing
CoglMatrix entirely and using graphene_matrix_t everywhere.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
2020-10-06 15:34:47 +00:00
Georges Basile Stavracas Neto
1d13c52db8 clutter/actor: Split building the transform into a separate function
It'll be used independently by the next commit to ensure ClutterStage
has a valid transform set.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
2020-10-06 15:34:47 +00:00
Georges Basile Stavracas Neto
2e986ed3e8 cogl/matrix: Add graphene_matrix_t utility function
CoglMatrix doesn't have a 1:1 mapping of graphene functions, and
sometimes it's just not worth adding wrappers over it. It is easier
to expose the internal graphene_matrix_t and let callers use it
directly.

Add new cogl_matrix_get_graphene_matrix() helper function, and
simplify Clutter's matrix progress function.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
2020-10-06 15:34:47 +00:00
Georges Basile Stavracas Neto
51094de8c4 cogl/matrix: Rename and change cogl_matrix_get_array()
Rename cogl_matrix_get_array() to cogl_matrix_to_float(), and
make it copy the floats to an out argument instead of returning
a pointer to the casted CoglMatrix struct.

The naming change is specifically made to match graphene's,
and ease the transition.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
2020-10-06 15:34:47 +00:00
Georges Basile Stavracas Neto
3324fbb1e3 clutter: Explicitly initiate CoglMatrices
Instead of relying on the macro. The macro will go away in the
next commit as part of using graphene_matrix_t in the CoglMatrix
structure.

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
Georges Basile Stavracas Neto
e06139323b clutter/util: Remove unused functions
After transitioning to purely graphene-based matrix interpolation,
these functions are unused.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
2020-10-06 15:34:46 +00:00
Georges Basile Stavracas Neto
8fc3d296b6 clutter/cogl: Use graphene to progress matrices
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
2020-10-06 15:34:46 +00:00
Georges Basile Stavracas Neto
f61377bb5e clutter/util: Make ClutterVertex4 internal to clutter-util.c
It's an implementation detail now, and not used not exposed anywhere.
One less Clutter type for us to deal with \o/

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
2020-10-06 15:34:46 +00:00
Georges Basile Stavracas Neto
eed3c62751 clutter/util: Replace ClutterVertex4 with graphene_vec4_t in public API
Soon, ClutterVertex4 will be internal to clutter-util.c, and only for the
_clutter_util_fully_transform_vertices() function, so remove it from all
public API.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
2020-10-06 15:34:46 +00:00
Georges Basile Stavracas Neto
fe0a325e9f cogl/matrix: Import skew functions from Clutter
Graphene provides skewing as part of graphene_matrix_t API, and it'll
be easier for the transition to just expose similar API surfaces.

Move the matrix skew methods to CoglMatrix.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
2020-10-06 15:34:46 +00:00
Georges Basile Stavracas Neto
dc9c1f8983 Remove ClutterMatrix
Good bye. You won't be missed.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
2020-10-06 15:34:46 +00:00
Georges Basile Stavracas Neto
c2dbdb3703 clutter: Add progress function for CoglMatrix
So that we can remove the custom ClutterMatrix type that plagues
the codebase.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
2020-10-06 15:34:46 +00:00
Jonas Ådahl
209b1ba383 clutter/frame-clock: Adapt refresh rate from to frame info
We should update to whatever refresh rate that comes our way, in
particular on X11, as this may change over time.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1430
2020-10-05 11:27:05 +00:00
Carlos Garnacho
6664044679 clutter: Do not use stack-allocated ClutterEvents
Use ClutterEvent* and clutter_event_new() to always allocate events.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1460
2020-09-30 18:26:20 +00:00
Jonas Ådahl
df228e8945 screen-cast/area-src: Clear framebuffer before painting stage
We'll be painting to a framebuffer that may not be completely covered by
the painted areas, meaning the not painted areas would end up undefined,
thus potentially contain garbage or old content.

Avoid this by clearing the framebuffer before painting the stage.

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

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1459
2020-09-30 15:56:07 +00:00
Daniel van Vugt
67cc60cbda clutter: Align all screen transformations to 1/256th of a stage unit.
So as to eliminate floating point precision errors that creep in
during matrix operations.

1/256th is chosen as a reasonable maximum resolution to cover any
realistic fractional scaling factor. Floats can represent such
a fraction losslessly because it is a small power of 2.

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

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1429
2020-09-30 14:17:53 +08:00
Carlos Garnacho
a270b6a2ce clutter: Drop _clutter_clear_events_queue_for_stage()
There's only one stage. Let's not overcomplicate things, as it
will not be possible to simply go through the event queue inspecting
every event.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1448
2020-09-23 16:49:32 +02:00
Jonas Ådahl
6e3ecadb79 backends/native: Fall back to compositing if direct scanout failed
Even when a direct client buffer has a compatible format, stride and
modifier for direct scanout, drmModePageFlip() may still fail sometimes.

From testing, it has been observed that it may seemingly randomly fail
with ENOSPC, where all subsequent attempts later on the same CRTC
failing with EBUSY.

Handle this by falling back to flipping after having composited a full
frame again.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1410
2020-09-17 12:17:35 +00:00
Marco Trevisan (Treviño)
aa56595b31 clutter-backend-x11: Don't set the font-dpi computed on X11 parameters
We already correctly set the font-dpi based on user settings in
MetaSettings at each user change and as part of backend initialization,
so there's no point to set it also during x11 backend post-parsing and
using X11 values, as this may happen at later point and lead to a wrong
clutter font DPI value.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1444
2020-09-17 11:37:43 +02:00
Georges Basile Stavracas Neto
9e011958d4 clutter/stage: Add new before_paint signal hook
It'll allow subclasses to get notified of the before-paint
signal without having to connect to it. This will allow
MetaStage to have proper watches being fired there without
the cost of the signal handling machinery.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1421
2020-09-01 13:05:29 -03:00
Georges Basile Stavracas Neto
098360f2c2 clutter/stage-view: Add method to peek scanout
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1421
2020-09-01 13:05:28 -03:00
Florian Müllner
6b04b2ff60 clutter/backends: Rename master and slave devices
Just because X11/XI uses a particular terminology doesn't mean we
have to use the same terms in our own API. The replacement terms
are in line with gtk@1c856a208, which seems a better precedent
for consistency.

Follow-up to commit 17417a82a5.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1425
2020-08-31 21:07:03 +02:00
Carlos Garnacho
51760692b0 clutter: Push commit/delete_sourrounding as IM events
These are not given directly to the input focus anymore, instead
queued up as events. This way, all actions triggered by the input
method (commit and preedit buffer ones, but also synthesized key
events) queue up the same way, and are thus processed in the exact
same order than they are given to us.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1286
2020-08-31 08:40:12 +00:00
Carlos Garnacho
fb6ff75a97 clutter: Prepare input focus for IM event delivery
The clutter_input_focus_filter_key_event() function has been made
a more generic filter_event(). Besides its old role about letting
key events go through the IM, it will also process the IM events
that are possibly injected as a result.

Users have been updated to these changes.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1286
2020-08-31 08:40:12 +00:00
Carlos Garnacho
d3b845902e clutter: Add IM events
These will be used to make IM commands into something that is processed
in a fixed order relative to key events.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1286
2020-08-31 08:40:12 +00:00