This makes DMA buffer allocation in all layers take an array of possible
modifiers to allocate using, or zero modifiers if implicit modifiers
should be used.
The format hard coding previously used is moved to the screen cast code,
or in case of the (unused by default) shadow buffer buffers use the same
format as the the CoglOnscreen.
This also means the CoglDmaBufHandle and MetaDrmBuffer got taught how to
distinguish between planes. It's mostly unused in practice, so rather
untested.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3900>
It's only implemented by the GBM render device backend, and uses EGL,
thus does not distinguish scanout capable modifiers.
A filter enum is added to Cogl, since it'll be used via the Cogl API,
but the actual Cogl API isn't added yet.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3900>
The cogl_scanout_get_dst_rect() fell back on the buffer dimensions as
the destination rectangle when nothing was explicitly set. This,
however, is not necessarily correct. For example, if a buffer is larger
the CRTC resolution, but the surface is scaled to exactly match the CRTC view,
the expected destination size should match the CRTC resolution, not the
buffer dimension, which would be the case if no explicit destination was
set.
In meta_wayland_try_aquire_scanout() we're in a good position to
determine the destination rect in the CRTC primary plane, since we have
all the prerequisits, i.e. that the surface effectively covers the whole
CRTC, the actor allocation box (the non-black border part), the scale
and transform of the view.
This tweaks the CoglScanout API a bit to make it explicit that the
dst_rect must be unconditionally provided, and removes the fallback to
the buffer dimension as the destination rectangle, which sometimes
resulted in a destination rectangle being larger than the primary plane
itself, resulting in clipping and incorrect scaling.
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3773
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4147>
In try_create_context(), if COGL_EGL_WINSYS_FEATURE_NO_CONFIG_CONTEXT
is set, don't try to choose an egl config.
Signed-off-by: Jocelyn Falempe <jfalempe@redhat.com>
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4088>
Since 1eba07f6 the size of a boxed value is read when calling
_cogl_boxed_value_set_x(). This results in an uninitialized read when
setting uniforms using cogl_pipeline_set_uniform_*() since the size was
not initialized by _cogl_pipeline_override_uniform() when these
functions call _cogl_boxed_value_set_*().
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4125>
We can't unfortunately use the macros for the sub-types as the whole GL
variant of the texture wants access to the struct fields even when using
a macro like COGL_DECLARE_INTERNAL_TYPE. So we would have to re-do the
whole driver integration first.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4100>
Go one step further and pass regions. Sometimes the rectangles were
already a region, e.g. the swap-buffer case, and sometimes it still
potentially needs to pass through a rectangle array, e.g. damage with a
view transform.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4103>
Only before passing to EGL does it need to become a int tuple array.
It's used in non-EGL places which now become more easy to read. While at
it, make use of the new (and tweaked) helper function for flipping
rectangles from "cogl space" to "GL space".
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4103>
The other similar API all operate with the assumptions that (0,0) is at
the top left, so lets make damage regions behave this way too. Add a
helper to flip the rectangles, to make it a bit more convenient. It'll
be used in more places in a follow up.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4103>
Instead of just adding the cogl header boilerplate, we'll redirect the
main function with #define and #undef to cogl_main(). The real main
calls the hooks-generated cogl_hooks() which chains up to the users
main() which is now called cogl_main().
<boilerplate>
#define main cogl_main
<user shader>
<hook functions>
void
cogl_hooks () {
cogl_main ();
<hook code>
}
#undef main
void main () { cogl_hooks(); }
This allows the user shader to continue using shaders which seem like
they define the main function and output to the framebuffer but also
gives the CoglPipeline a chance to add hooks.
This in particular makes our ClutterColorState transform hooks work on
user programs which are used by ClutterShaderEffects.
Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/7804
Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/7805
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3662
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4037>
As that is where the whole text rendering integration happens
And would allow us to get rid of some over-abstraction in cogl-pango,
simplify
ClutterSnapshot integration as well
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4004>
As we will be merging CoglPango inside Clutter, so prepare for that
Note this removes the Cogl shared atlas debug usage, as it is private to Cogl
The usage of cogl_c_args was replaced with cogl_debug_c_args to avoid COGL_COMPILATION
pre-moving to clutter. The whole meson file will be removed later anyways.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4004>
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>
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>
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>
_cogl_boxed_value_transpose is only used for the matrix type.
Now is named _cogl_boxed_value_copy_transposed_value.
Gets the transposed value considering count (to store in array type or not).
The caller doesn't have to worry about count anymore.
Instead of calling memcpy, add function _cogl_boxed_value_copy_value
which copies the value to the corresponding boxed value property
considering type and count.
The caller doesn't have to worry about type and count anymore.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3965>
There are three array properties, considering type:
1. float *float_array
2. int *int_array
3. void *array
Drop using array. This was inteded to be used when type is matrix and
count > 1, however some functions use it and others use
float_array. Fix this using always float_array, this starts to make all funcs
consistent handling the properties.
There's a mem leak when destroying the boxed value, only freeing the array
prop. Free the corresponding array considering the boxed value type to fix it.
_cogl_boxed_value_set_x func is still inconsistent, the next commits
will solve it.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3965>
Because for `COGL_DRIVER_GL3`, `_cogl_context_get_gl_extensions` needs to
know that the GL version *really* is >= 3.0 before it calls `glGetStringi`
which didn't exist prior to GL 3.0 or ES 3.0.
This was causing crashes on Xilinx Mali implementations that only support
ES 2.0 (hence `glGetStringi` == NULL), but were being forced to call
that function before the GL version check which should tell you the
function isn't supported.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4019>
GLES 2.0 does not have RGB8 and RGBA8 as sized internal formats. There
is OES_rgb8_rgba8 which adds RGB8 and RGBA8 but only for
RenderbufferStorageOES and not for TexImage2D which I wrongly assumed.
It seems like there is currently no GLES2 extension which adds RGB8 and
RGBA8 to TexImage2D so we have no choice but to fall back to unsized
internal formats in those cases as long as we don't want to drop GLES2
support.
This should be fine in practice and we should get our 8bpc textures.
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3680
Fixes: 7f943613a8 ("cogl: Use sized internal renderable formats")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4036>