Commit Graph

8123 Commits

Author SHA1 Message Date
Ivan Molodetskikh
e63a5369d0 clutter/frame-clock: Add output name to span descriptions
Lets you tell spans for multiple monitors apart in profilers.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3417>
2023-12-06 16:12:58 +00:00
Ivan Molodetskikh
77413ed9a0 clutter/frame-clock: Store output name
Will be used in a subsequent commit for including the output name in
COGL_TRACE plot names.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3417>
2023-12-06 16:12:58 +00:00
Ivan Molodetskikh
39e3415912 clutter/actor: Adjust trace actor name for better filtering
Tracy can filter its statistics by user text, in our case by span
description. It's useful to filter by actor type and name, and not so
much by the pointer. So, remove it, and also reduce the amount of
punctuation.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3417>
2023-12-06 16:12:58 +00:00
Ivan Molodetskikh
b0691d581a clutter/stage: Add trace span to paint_to_framebuffer
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3417>
2023-12-06 16:12:58 +00:00
Ivan Molodetskikh
58ee1dfdc8 clutter/stage-view: Add trace span to before_swap
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3417>
2023-12-06 16:12:58 +00:00
Ivan Molodetskikh
72bbb1416e clutter/timeline: Add trace spans
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3417>
2023-12-06 16:12:57 +00:00
Ivan Molodetskikh
ce836e37e8 clutter: Add trace spans to event handling
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3417>
2023-12-06 16:12:57 +00:00
Sebastian Keller
dfe4d218f1 clutter/actor: Make get_transformed_paint_volume() transfer full
Transfer none was achieved using a stack GArray in the stage which
would get resized to 0 at the end of every frame to "free" it.
In the case of direct scanout however, painting the next frame only
happens after leaving fullscreen again. Until then the array just kept
growing and because GArrays don't reallocate when shrunk, this memory
remained allocated even after leaving fullscreen.

There is no cache benefit from storing paint volumes this way, because
nothing accesses them after their immediate use in the calling code.
Also the reduced overhead from avoiding malloc calls seems negligible as
according to heaptrack this only makes up about 2-3% of the temporary
allocations.

Changing this to transfer full and removing the stack array simplifies
the code and fixes the "leak".

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3191
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3442>
2023-12-06 14:07:39 +00:00
Jonas Ådahl
ae3a20a0a0 clutter/paint-nodes: Use g_clear_object() in a few places
It's possible now that they are GObject's.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3443>
2023-12-06 13:45:03 +00:00
Jonas Ådahl
7152779ae0 clutter/stage-view: Remove unused double buffered shadow fb
It was for a failed expriment that tried to mmap() dmabuf memory and
find damaged regions to decrease the amount that was eventually used to
write to an onscreen, but mmap:ing is only fast enough on intel, and
it's only relevant on various server GPUs. For it to be achievable, we
need to render to system memory in a way that we don't need to copy it
out of OpenGL, but that's currently not possible.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3443>
2023-12-06 13:45:03 +00:00
Jonas Ådahl
d8ff97ebf6 clutter/stage-view: Pass around view when creating shadow fb
Instead of passing around the CoglContext, pass around the view, which
can be used to fetch the CoglContext. We'll use it for more stuff later.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3443>
2023-12-06 13:45:03 +00:00
Jonas Ådahl
b282097834 clutter/stage-view: Rename offscreen pipeline vfunc
It doesn't really "set it up", it just sets the transform according to
the renderer view state. We'll do more setup outside, so lets rename it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3443>
2023-12-06 13:45:03 +00:00
Jonas Ådahl
008f2642ca clutter/enums: Add trailing comma in colorspace enum
Would make it easier would we add more colorspaces later on.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3443>
2023-12-06 13:45:03 +00:00
Sebastian Wick
0f1c5223ff clutter: Add ClutterContext to clutter-types.h
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3443>
2023-12-06 13:45:03 +00:00
Jonas Ådahl
501d19656e context: Make ClutterContext a GObject and move to separate file
This is a step in cleaning up the Clutter context management. By making
it a GObject it's easier to add e.g. properties and features that helps
with introspection.

For now, this means the context creation is changed to go via a
"constructor" (clutter_create_context()). This is so that the global
context singleton can be mantained outsid of ClutterContext, until it
can be removed.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2016>
2023-12-05 14:39:25 +00:00
Jonas Ådahl
d96e458d93 clutter: Remove unused sync-to-vblank setter
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2016>
2023-12-05 14:39:25 +00:00
Jonas Ådahl
1209320cd2 clutter/context: Remove left-over locking declarations
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2016>
2023-12-05 14:39:25 +00:00
Jonas Ådahl
f14b5da387 clutter/backend: Remove 'finish_init()' vfunc
The original purpose of being able to report errors is no longer
relevant, since the Clutter backend is now practically a thin wrapper
around the actual backend, which has already dealt with error reporting.
Thus move this to the regular constructor path.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2016>
2023-12-05 14:39:25 +00:00
Jonas Ådahl
579532f644 clutter: Rename ClutterMainContext to ClutterContext
The intention for ClutterContext is to be more or less the MetaContext
or CoglContext equivalent. Lets rename the type so that it becomes more
consistent with the other similar types.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2016>
2023-12-05 14:39:25 +00:00
Ivan Molodetskikh
edbc9a2086 clutter/pick-stack: Add an allocation check to calculate_clear_area ()
We might pick an actor that needs relayout. I've seen this happen inside
hiding / unmapping in particular. In this case, calculate_clear_area ()
will call clutter_actor_get_abs_allocation_vertices () which in turn
will force a relayout. However, this is not what we want, because:

1. We don't want to run layout during picking.
2. If the actor needs an allocation, then the pick stack could not have
   used an up-to-date allocation, because it is not computed. Therefore
   this clear area would use a potentially completely different
   allocation than the one stored in the pick stack.

Thankfully, clear area seems to be used as a cache/optimization, so
let's just avoid computing it if the actor is not allocated.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3425>
2023-12-01 15:36:32 +00:00
Ivan Molodetskikh
2d1fc65b3a Adjust COGL_TRACE names to improve automatic processing
In profilers with a timeline or flame graph views it is a very common
scenario that a span name must be displayed in an area too short to fit
it. In this case, profilers may implement automatic shortening to show
the most important part of the span name in the available area. This
makes it easier to tell what's going on without having to zoom all the
way in.

The current trace span names in Mutter don't really follow any system
and cannot really be shortened automatically.

The Tracy profiler shortens with C++ in mind. Consider an example C++
name:

SomeNamespace::SomeClass::some_method(args)

The method name is the most important part, and the arguments with the
class name will be cut if necessary in the order of importance.

This logic makes sence for other languages too, like Rust. I can see it
being implemented in other profilers like Sysprof, since it's generally
useful.

Hence, this commit adjusts our trace names to look like C++ and arrange
the parts of the name in the respective order of importance.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3402>
2023-11-22 11:46:07 +00:00
Daniel van Vugt
f74fe6bd67 clutter/actor: Handle _clutter_actor_get_debug_name(NULL)
NULL actor pointers seem to arise sometimes in `clutter_stage_update_device`
when using a touchscreen, but that's only fatal with `CLUTTER_DEBUG=event`.
So just handle NULL where it was crashing: `_clutter_actor_get_debug_name`.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3413>
2023-11-21 13:41:24 +00:00
Sebastian Keller
aed55e0808 clutter/input-only-action: Don't override finalize with dispose
This was resulting in the GObject never being properly finalized,
leading to a leak.

Fixes: e917b7de4 ("clutter/stage: Add input-only grabs")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3411>
2023-11-20 12:10:52 +01:00
Carlos Garnacho
5780c10002 clutter: Check source device mode to figure out logical device in events
We look in various ways for the logical device on pointing events, in order
to assign tablet events their own device, detached from the ClutterSeat
pointer.

While this pans out on the native backend, it does not quite match with
X11 behavior where these events do drive the Virtual Core Pointer, this
results in a variety of buglets deriving from this mismatch.

Use the ClutterInputMode instead, to figure out whether the device is
physical and attached to the VCP (The default on X11), or the device is
floating thus should emit events on its own (The new stock behavior on
native backend since the previous commit), and behave accordingly
to what was specified by backend code.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/7144
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3114
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3122
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3156
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3393>
2023-11-17 20:49:18 +00:00
Carlos Garnacho
819d62cde2 clutter: Centralize repick handling due to transform changes
Since we just queue up repicks, we can improve the mechanism
added at commit 4d76a21029 this so it's less ad-hoc.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3385>
2023-11-17 20:24:41 +00:00
Carlos Garnacho
9f00572762 clutter: Defer repick on transform changes
Avoid an immediate repick, and queue it instead so it happens
for all devices on the next frame clock step.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3385>
2023-11-17 20:24:41 +00:00
Ivan Molodetskikh
47814fab71 Remove COGL_TRACE_BEGIN in favor of BEGIN_SCOPED
Scoped traces are less error prone, and they can still be ended
prematurely if needed (this commit makes that work). The only case this
doesn't support is starting a trace inside a scope but ending outside,
but this is pretty unusual, plus we have anchored traces for a limited
variation of that.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3396>
2023-11-15 13:57:43 +00:00
Bilal Elmoussaoui
371d28a766 cleanup: Stop allowing deprecated Cogl API usage
Allow only specific files to use those deprecated APIs making
it easier to find where deprecated APIs are still in use
and avoid introducing new usages without being noticed

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3400>
2023-11-15 13:13:00 +01:00
Bilal Elmoussaoui
7de0707dfa clutter/cleanup: Stop disabling deprecated API usage warnings
As we have stopped using the deprecated APIs all over clutter, so let us
enforce that newly introduced code doesn't use code that gets depreccated
in the future

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3400>
2023-11-15 13:12:13 +01:00
Bilal Elmoussaoui
f5dac3a5d9 build: One config file to rule them all
Group all the three config files from clutter/cogl/meta into one
and also remove unnused configurations and replace duplicated ones

This also fixes Cogl usage of HAS_X11/HAS_XLIB to match the expected
build options

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3368>
2023-11-15 12:00:19 +00:00
Florian Müllner
dc8de3bfd5 clutter/keyval: Fix keyval_name() transfer annotation
clutter_keyval_name() returns a pointer to a static array, not
newly allocated memory. Add a transfer annotation to indicate
that callers must not free the returned memory.

While add it, make the return value const to stress further that
callers shouldn't touch the returned memory.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3386>
2023-11-14 16:28:09 +00:00
Bilal Elmoussaoui
03235773be clutter/cleanup: Drop PaintNodes serialization
Currently, nothing uses the dumped json of the paint nodes tree. So
let us drop them in a separate commit so it can easily be reverted
if someone ends up wanting to build a tool to consume and inspect
the JSON.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3354>
2023-11-14 16:52:37 +01:00
Bilal Elmoussaoui
306ff81004 clutter: Drop ClutterUnits
As nothing uses it now that ClutterScript was dropped

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3354>
2023-11-14 16:13:19 +01:00
Bilal Elmoussaoui
8a3181f741 clutter: Make json-glib a debug only dependency
Currently, json-glib is used for two things:
- For loading scripts, nothing seems to use that in real life other
than some tests
- For debugging paint nodes

For now, the PR drops the first use case and only require json-glib
if it is a debug build

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3354>
2023-11-14 16:13:18 +01:00
Zander Brown
4bc73ba9f4 clutter/layout-meta: Become one with ClutterChildMeta
Now ClutterContainer is gone there is no reason for this split to exist,
simply merge the two types together

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3384>
2023-11-14 10:27:51 +00:00
Zander Brown
db4bbf6899 clutter/container: Drop ClutterContainer
Finally drop the type itself

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3384>
2023-11-14 10:02:21 +00:00
Zander Brown
c42fa34b01 clutter/actor: Rename ::actor-{added,removed} to ::child-{added,removed}
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3384>
2023-11-14 09:59:52 +00:00
Zander Brown
7113ecd86c clutter/actor: Take responsibility for ::actor-{added,removed}
These signals have de facto been ClutterActor signals for some time now,
simply move them in from ClutterActor

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3384>
2023-11-14 09:57:39 +00:00
Zander Brown
e1cdeb0319 clutter/layout-manager: Consume Actors not Containers
We don't actually need the host to be a container, so simply work on
actors saving us a few casts.

This'll simplify dropping ClutterContainer entirely later, and
StViewport/ShellWindowPreviewLayout will also need to be updated for the
new signatures

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3384>
2023-11-14 09:57:39 +00:00
Zander Brown
d0ebfa792d clutter/bin-layout: We don't need to store the container
We never do anything with it, just let it pass straight to the parent
implementation

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3384>
2023-11-14 09:57:39 +00:00
Florian Müllner
b611569b26 clutter/bin-layout: Remove custom alignment properties
The layout manager takes the generic ClutterActor expand/align
properties into account. Everyone should already use those instead
of the custom layout/child properties, so removing them should have
little fallout, while making for a nice cleanup.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3382>
2023-11-10 00:24:26 +01:00
Zander Brown
84c3a3fbef clutter/script-parser: Drop support for child properties
Which means ClutterContainer is no longer special cased, removing one of
it's final users.

In practice ClutterScript is unused anyway.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3377>
2023-11-09 18:11:00 +00:00
Bilal Elmoussaoui
3184986897 clutter/text: Remove deprecated prop/signal
Shell doesn't use them and they have been deprecated for very long time

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3379>
2023-11-09 16:42:24 +00:00
Bilal Elmoussaoui
2b871765f0 clutter/actor: Remove depreceated macros
Nothing uses them outside of mutter, so hurry up and remove them!

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3379>
2023-11-09 16:42:24 +00:00
Bilal Elmoussaoui
8c4d3d0516 clutter/cleanup: Remove unnused ClutterShader type
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3379>
2023-11-09 16:42:24 +00:00
Bilal Elmoussaoui
81c75b3157 clutter/swipe-action: Remove deprecated swept signal/vfunc
Also update the test to use swipe signal instead. Nothing seems to
use the signal from GNOME Shell side though

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3379>
2023-11-09 16:42:24 +00:00
Bilal Elmoussaoui
d311ff4a67 clutter/docs: Remove no longer existing vfuncs docs
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3379>
2023-11-09 16:42:24 +00:00
Bilal Elmoussaoui
1bb2f5f7b9 clutter: Drop Timeline.new constructor
Nothing uses it nowadays except GNOME Shell for tests but goes through g_object_new so it is fine

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3181>
2023-11-09 15:07:30 +00:00
Bilal Elmoussaoui
6032be04a0 clutter: Drop Event.get_source
It was marked as deprecated for ~5 years and nothing uses it nowadays
so drop it

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3181>
2023-11-09 15:07:30 +00:00
Bilal Elmoussaoui
9374f259a4 clutter: Drop GestureAction.get_threshold_trigger_egde
People should use get_threshold_trigger_edge instead.
Nothing seems to use it so it is safe to drop

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3181>
2023-11-09 15:07:30 +00:00