Instead of duplicating a string we own already we can just steal it from
the array that we're using.
This is safe since we're sure about the tokens GStrv length and we are
always stealing the last element, so there is no risk that g_strfreev
would eventually leak something.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4071>
Previously ClutterStageWindow was an interface with only one base
implementation (MetaStageImpl) which others inherit from.
This just makes it a class so that we can use _GET_CLASS() API instead of
the costly (by comparison) _GET_IFACE() vtable lookups.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4048>
The meta_input_device_get_wacom_device function may return NULL, so
we should check it before use. I'm not 100% sure that the code as
currently written could reach here with a NULL wacom_device, but
that could change in the future.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4070>
clutter_primaries_to_wayland made sense when there only existed
ClutterColorspace. Now that ClutterPrimaries also exist, it makes more
sense to change that func to clutter_colorspace_to_wayland.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4062>
Quoting Ebassi https://www.bassi.io/articles/2023/02/20/bindable-api-2023/:
Whenever you’re describing a function that takes a callback, you
should always annotate the callback argument with the argument that
contains the user data using the (closure argument) annotation
You should not annotate the data argument with a unary (closure).
The unary (closure) is meant to be used when annotating the callback
type
Recently gobject-introspection became a bit more strict with this and
that generated some warnings:
Warning: Cogl: invalid "closure" annotation: only valid on callback
parameters
This commit fix all the closure annotations.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4058>
In some use cases there is a need to dynamically change the preferred
primary GPU, or get rid of the preference altogether. This is currently
not possible due to a change in udev introduced by systemd v247. This
version made the tags "sticky", meaning there is no way to remove them
once attached. When a tag gets removed, only the CURRENT_TAGS property
reflects that change, the removed tag will remain in the TAGS property.
This also bumps libgudev version to 238, since that version introduces
a function, which we need to get the current tags.
Related: https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1562
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4055>
This TF can't be defined as a TransferFunction enum because it needs a
gamma_exp value too.
Add to EOTFType enum a new type: EOTF_TYPE_GAMMA.
With this new type, now EOTFs are unions that can have either
a TransferFunction enum or a gamma_exp.
Set gamma_exp as uniform.
Add the support of it in the color management protocol.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4020>
These properties now are tagged unions:
- ClutterColorimetry:
Can be from colorspace or primaries;
- ClutterEOTF:
Can be from known tf or custom gamma exp (next commit);
- ClutterLuminance:
Can be defined explicitly or derived;
Make the color management protocol use them too.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4020>
ColorState is inmutable so the GObject properties aren't necessary.
Also move ClutterColorstate and ClutterTransferFunction enums to
color-state.h now that they are not used as GObject properties.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4020>
For non-debug and non-plain cases - i.e. mainly release builds.
This ensures we use the same options in all places and draws a cleaner
distinction between g_assert() and g_return_if_fail() - the later will
still be done in release build while the former are meant for debug
only.
One advantage of doing this is that it allows us to use non-trivial
asserts more generously, such as calling `g_list_length()`.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3424>
Add a test that:
- Creates 2 clients
- Leases a connector using the first client
- Tries to lease the same connector using the second client
- Checks that the first lease succeeded
- Checks that the second lease failed
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4031>
Add a test that:
- Creates 2 clients
- Leases a connector using the first client
- Checks that the first client receives a lease_fd event
- Checks that both clients receive a connector withdrawn event
- Finishes the lease
- Check that both clients have access to the connector
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4031>
Add a test that:
- Creates 2 clients
- Releases a device for each client
- Checks that releasing a device for one client doesn't affect the other
- Checks that an error is raised if a released client is used
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4031>
Add an event queue to the DRM lease client that allows to check that the
compositor sent the expected events in the expected order.
For the moment, the event queue is used to check that the initial
connection to the compositor works as expected.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4031>
Add the most basic possible test that checks that:
- The DRM lease protocol is available
- At least one device is advertised
- At least one connector is available for lease
Organize the code in a way that it is possible to created multiple DRM
lease clients at the same time as future tests will need this.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4031>
Add the required files to run DRM lease using the KVM/tty backends.
DRM lease tests need at least one connector available for lease. Instead
of adding the test to "wayland-unit-tests.c", add it to its own file and
set the environment variable MUTTER_DEBUG_LEASE_CONNECTORS=Virtual-1 to
make the only connector created by VKMS by default available for lease.
This commit doesn't add any tests, just the required files to start
adding them.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4031>
MetaWaylandDrmLeaseDevice and MetaWaylandDrmLeaseConnector hold a
reference to each other.
In both cases, the reference count was increased. Do not increase the
reference count when lease_connector->lease_device is stored to break
the reference count cycle.
Fixes: fb08a597e1 ("wayland/drm-lease: Advertize initial connectors")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4031>
drmModeAddFB() doesn't take a format, but depth and bits per pixel.
These can be used to determine whether there should be an alpha channel
or not, and is roughly assumed to result in either XR24 or AR24 if one
passes 24 or 32 as depth, with 32 as bpp.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3926>
In multi-GPU setups, when one of the GPUs is used to render the desktop
and the other one has all of their devices available for lease,
meta_kms_impl_device_list_lessees() can be called after the device fd
has been unhold.
Make sure to hold and unhold it in this function.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4030>
When running with COGL_DEBUG=show-uniforms, display the values of the
uploaded uniforms.
This helps because it's not possible to know the uniform values only from
the shader source.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3965>
This function returns a string of the boxed value considering type, size
and count; and adds a name.
e.g:
vec2 scale = vec2(1.0000, 1.0000)
Also handle NULL cases on _cogl_boxed_value_equal.
This will be used by the next commit.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3965>
Use _cogl_boxed_value_destroy to free the correspondent array instead of
free, which was only freeing float_array.
Add a new func _cogl_boxed_value_array_alloc to allocate the
corresponding array considering the type.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3965>