1
0
Fork 0
Commit graph

3094 commits

Author SHA1 Message Date
Carlos Garnacho
55e3b2e519 cogl: Replace xlib error traps with Mtk ones
Replace these with Mtk error traps altogether, and avoid stacking
one API over the other here.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3230>
2023-09-02 09:52:54 +00:00
Daniel van Vugt
025e5d5327 Remove unused *.pc.in
It seems *.pc are instead now entirely generated from meson.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3226>
2023-08-31 09:47:50 +00:00
Bilal Elmoussaoui
7ee5b0c3e6 cogl: Replace cairo_rectangle_int_t with MtkRectangle
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3128>
2023-08-30 16:46:13 +02:00
Sandro Bonazzola
ff4d87727b Update license access method
Dropped obsolete Free Software Foundation address pointing
to the FSF website instead as suggested by
https://www.gnu.org/licenses/gpl-howto.html
keeping intact the important part of the historical notice
as requested by the license.

Resolving rpmlint reported issue E: incorrect-fsf-address.

Signed-off-by: Sandro Bonazzola <sbonazzo@redhat.com>
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3155>
2023-08-30 08:48:23 +02:00
Niels De Graef
814a9de9d8 cogl: Chain up to dispose()
We forgot to chain up to the parent class' `dispose()` vfunc in both
`CoglPangoRenderer` and `CoglFrameBuffer`. Plugs 2 (probably tiny)
memory leaks.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3203>
2023-08-22 21:55:17 +02:00
Bilal Elmoussaoui
d10533cc1c cogl/pango: Fix wrong unref function
PangoRenderer is a GObject not a CoglObject
Noticed while working on
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3193

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3197>
2023-08-21 15:55:18 +00:00
Georges Basile Stavracas Neto
fdc3f3fec3 cogl/renderer: Pass pixel format to DMA-BUF constructor
In future commits, we will want to create DMA-BUFs with pixel
formats other than COGL_PIXEL_FORMAT_BGRX_8888. In preparation
for that, let's start passing a new pixel format parameter to
this function, and the corresponding winsys vfunc.

All callers of this function pass COGL_PIXEL_FORMAT_BGRX_8888
for now. Next commits will change that.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3175>
2023-08-19 23:00:28 -03:00
Bilal Elmoussaoui
cd27cb5c85 cleanup: Fix various typos
Using the typos cli app

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3169>
2023-08-12 20:13:37 +00:00
Bilal Elmoussaoui
f2f9e63568 build/gi: Set header & pkgconfig names
So that the docs generated by gi-docgen contains them

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3087>
2023-08-12 19:34:20 +00:00
Jonas Ådahl
dec8577e4b cogl/framebuffer: Fix blitting from premult to opaque
We stopped putting "premultiplied" in opaque formats - that broke the
condition in cogl_blit_framebuffer() if the source was ARGB, but the
target was XRGB.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3159>
2023-08-09 11:07:46 +00:00
Bilal Elmoussaoui
a955f0e47c cleanup: Make include macro usages consistent
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3157>
2023-08-07 22:24:36 +00:00
Bilal Elmoussaoui
ead9a3024c cleanup: Switch to pragma once
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3157>
2023-08-07 22:24:36 +00:00
Jonas Ådahl
828bc023d0 cogl/build: Remove unused built header list
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3131>
2023-07-21 07:59:54 +00:00
Bilal Elmoussaoui
b852bbba47 cleanup: Stop translating nick/blurb for pspecs
As those strings are intended to be used by some UI but nothing uses
that in reality except GStreamer.
So drop them similar to what GTK did at
https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/4717

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3101>
2023-07-19 11:33:59 +00:00
Robert Mader
eb19ac86ba cogl: Add missing RGBfp16 opaque formats
This adds the last missing opaque format variants we support on Wayland.

Do not add testing for these as we are missing helper function to pack
half float values.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3065>
2023-07-19 10:39:55 +00:00
Robert Mader
4097cbbb53 cogl: Extend tests and fix RGB2101010 opaque formats
Notably fix several cases where bitmap packing was broken, resulting in
visual corruption with the GLES2 backend. These were reproducible with
the gradient-test from
https://gitlab.freedesktop.org/jadahl/wayland-test-clients

Also extend testing similar to the RGB8888 formats.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3065>
2023-07-19 10:39:55 +00:00
Robert Mader
f04209dcbf cogl: Add RGB8888 opaque format variants
So we can properly handle matching DRM and WL_SHM formats in a unified
manner.

Add extensive testing between these and existing pre-multiplied alpha
formats, i.e. all formats we support on Wayland.

Note that unfortunately for some format combinations  the value in the
alpha channel is not cleared as expected, likely because of fast-paths
in Cogl. If both source and destination format is opaque, it always
works, however. This thereby includes all cases where they are the same.

Co-Authored-By: Jonas Ådahl <jadahl@gmail.com>
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3065>
2023-07-19 10:39:55 +00:00
Sebastian Wick
5696d61a67 cogl: Fix opaque formats on GLES2 getting premultiplied
On GLES2 reading and writing some Cogl formats is not supported
natively. In those cases we use another format to do the reading and
writing. When the internal format and the temporary format differ in
premultiplication, Cogl tries to adjust for it.

Opaque Cogl formats don't have the premult bit set but our internal
format is a premult format. Cogl tries to adjust for it but completely
misses that the opaque format doesn't have an alpha channel and it
should not do so at all.

So skip the premult adjusting when the Cogl format has no alpha channel.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3065>
2023-07-19 10:39:54 +00:00
Bilal Elmoussaoui
01ecaf10ef cogl: Drop debug helper for generating an image of the atlas
As it is the only place where cogl depends directly on cairo minus
the whole cairo_region_t.

The motivation behind the removal of this helper is to reduce the usage
of cairo in libmutter is to potentially completely drop it in
certain places or replace it with pixman.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3079>
2023-06-20 15:53:48 +00:00
Dor Askayo
b43fb9fd98 cogl/onscreen/egl: Record CPU time only when GPU time can be queried
These are only useful together at the moment.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3080>
2023-06-20 15:32:25 +00:00
Olivier Fourdan
d65883e0d7 cogl/gl-framebuffer: Remove conditional on HAVE_COGL_GL
By testing the features flag, we can get rid of the conditional build
on HAVE_COGL_GL entirely.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3047>
2023-06-07 07:16:10 +00:00
Olivier Fourdan
c3af4c1b15 cogl/gl-framebuffer: Fail without QUERY_FRAMEBUFFER_BITS
glGetIntegerv() with GL_RED_BITS/GL_GREEN_BITS/GL_BLUE_BITS/etc. is not
supported with the GL core context, so there is no point in falling back
to that without supporting COGL_PRIVATE_FEATURE_QUERY_FRAMEBUFFER_BITS,
as this will cause an GL error.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3047>
2023-06-07 07:16:10 +00:00
Olivier Fourdan
fad240f437 cogl/gl-framebuffer: Match testing features
The function ensure_bits_initialized() in cogl-gl-framebuffer-fbo.c
checks for COGL_PRIVATE_FEATURE_QUERY_FRAMEBUFFER_BITS whereas the same
in cogl-gl-framebuffer-back.c simply checks for the driver being
COGL_DRIVER_GL3.

Change the later to use the COGL_PRIVATE_FEATURE_QUERY_FRAMEBUFFER_BITS
flag as well.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3047>
2023-06-07 07:16:10 +00:00
Olivier Fourdan
a2203df9f4 cogl/gl-framebuffer: Fix inverted test in ensure_bits_initialized()
Cogl's feature COGL_PRIVATE_FEATURE_QUERY_FRAMEBUFFER_BITS is required
to use the GL_FRAMEBUFFER_ATTACHMENT_* queries.

Unfortunately, the test for the availability of the private feature is
actually inverted in ensure_bits_initialized() which causes that whole
portion of code to be ignored, falling back to the glGetIntegerv()
method which isn't supported in core profiles.

As Mesa has recently started to be more strict about these, this causes
the CI tests to fail in mutter.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3047>
2023-06-07 07:16:10 +00:00
Olivier Fourdan
5a83e8ef82 cogl/gl-framebuffer: Fix spurious trailing spaces
Purely cosmetic fix, no functional change.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3047>
2023-06-07 07:16:10 +00:00
Jonas Ådahl
a1749524da cogl/trace: Add missing semicolon when profiling is disabled
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3051>
2023-06-05 10:20:25 +02:00
Jonas Ådahl
ab39eaf131 cogl/trace: Make global start/stop more explicit
Don't try to handle things by threads enabling/disabling the main trace
context on-demand, just have a clear start/stop API. For the D-Bus API,
it becomes more straight forward, and for the persistent variant too, as
it avoids having to pass garbage input when it's known that arguments
will be discarded.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2998>
2023-05-31 08:37:52 +00:00
Jonas Ådahl
dd3c1046c1 cogl/trace: Make each thread have its own trace context ref
This means that when we disable tracing, the writer will be kept alive
until the last thread using it is disabled.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2998>
2023-05-31 08:37:52 +00:00
Georges Basile Stavracas Neto
3b7ca42c6f cogl/clip-stack: Removing window rect
The only consumer of this type of rect was the scissor clipping,
which was removed by the previous commit.

Remove window rects from CoglClipStack, and all dependent code.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3006>
2023-05-17 15:09:45 +00:00
Georges Basile Stavracas Neto
656ccb4dee cogl/framebuffer: Remove scissor clip
It's unused. Spotted while discussing snapshot APIs.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3006>
2023-05-17 15:09:45 +00:00
Jonas Ådahl
61b42e5303 build: Use / operator instead of join_paths everywhere
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2985>
2023-05-04 12:35:38 +00:00
Sebastian Keller
551aebce19 cogl: Remove struct paddings
Due to cogl being a private library we don't need worry about ABI
compatibility.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2986>
2023-05-04 12:11:26 +00:00
Sebastian Keller
679d2fb4e0 build: Don't disable checks in release builds
Both Clutter and Cogl use g_return(_val)_if_fail() to safeguard
introspected API. Release builds were dropping these checks, which could
result in a much more crashy experience, especially when considering
extensions, but also due to bugs in the shell code itself.

This won't affect any major distro, because they all use "plain" builds.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2930>
2023-03-24 12:51:49 +00:00
Carlos Garnacho
1a210218c9 build: Fix cogl-pango underlinking
This library is using Pango and PangoCairo. Make it declare them
as requirements.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2864>
2023-03-03 20:17:01 +00:00
Carlos Garnacho
ab3b12052d cogl: Trap GLX call with error trap
This is a X request that may result in errors, so it is better
to have covered by an error trap.

It is thus far not, explicitly at least, which means other less
lenient error traps might not like what happens here. Make the
error trap threeway between backend, x11 and cogl happen less
by chance here.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2864>
2023-03-03 20:17:01 +00:00
Jonas Ådahl
af5d67251b cogl/scanout: Add 'scanout-failed' signal
This will later be emitted when a scanout failed, e.g. by the not-test commit
failing for some reason, or drmModePageFlip() failing even if the
pre-conditions for scanout in the simple KMS backend passed.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2854>
2023-03-01 23:57:32 +00:00
Jonas Ådahl
b2579750a7 cogl: Remove legacy OpenGL driver support
This means the two Cogl drivers left are OpenGL >= 3.1 and GLES >= 2.0.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2672>
2023-02-21 18:09:28 +00:00
Robert Mader
943fcc7c1a stage-impl: Transform damage region before queuing
In order to queue the right values for transformed `MetaRendererView`s.

While on it ensure we query the framebuffers width/height only once,
saving some cpu cycles.

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

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2860>
2023-02-20 10:43:31 +00:00
Erico Nunes
523b27e267 cogl/onscreen: Discard depth/stencil before swapping buffers
Marking the the depth/stencil as discarded before swapping buffers for
the screen signals the GPU that we don't need to keep them around for
the future.
This helps performance by reducing memory bandwidth usage in some GPUs
which may optimize to not write those buffers back to memory at all
after rendering, when they would just be cleared right after that
anyway.
It is not necessary to mark buffers as discarded after swapping buffers.
This should have no effect according to the spec (since that is going to
be followed by new rendering commands which make the buffer valid again)
and removing that has shown no impact in performance tests.

Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2091>
2023-02-08 15:01:34 +00:00
Erico Nunes
5fedd065c9 cogl/framebuffer: Remove requirement to discard color buffer
cogl_framebuffer_discard_buffers required that the color buffer is
passed, although users might want to discard e.g. just depth and/or
stencil buffers.

Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2091>
2023-02-08 15:01:34 +00:00
Jonas Ådahl
49b0a8921c Use g_clear_fd() instead of open coding the same behavior
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2806>
2023-01-30 15:11:26 +00:00
Jonas Ådahl
b712a7e455 cogl/egl: Also log when we managed to obtain a high priority context
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2807>
2023-01-30 13:17:19 +00:00
Jan Tojnar
81cc05e61e build: Fix Sysprof interface path with split sysprof package
When sysprof-4 and libsysprof-capture-4 are installed into different
prefixes, such as with Nix package manager, the D-Bus interfaces
are likely not discoverable from the latter package.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2572>
2023-01-28 10:34:57 +01:00
Jonas Ådahl
e5602062e2 cogl/frame: Keep track of target presentation time
It's yet to be used for anything, but will later on.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2795>
2023-01-23 15:57:51 +01:00
Naveen Kumar
86b7b5bc06 cogl/texture: Add support for sized textures with explicit format
Add API that introduce a method to allocate 2d textures given a
passed pixel format (e.g. xrgb210101010).

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2461>
2022-12-17 23:12:34 +00:00
Jonas Ådahl
d8612720f6 cogl/driver/gles: Handle reading RGBA1010102 too
This means can read without loosing precision, compared to if we read a
texture as rgb8.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2461>
2022-12-17 23:12:34 +00:00
Jonas Ådahl
8e65e510d4 cogl/framebuffer/gl: Move most read restriction to drivers
OpenGL requires more hand holding in the driver regarding what pixel
memory layouts can be written when calling glReadPixels(), compared to
GLES2. Lets move the details of this logic to the corresponding
backends, so in the future, the GLES2 backend can be adapted to handle
more formats, without placing that logic in the generic layer.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2461>
2022-12-17 23:12:34 +00:00
Jonas Ådahl
8d179c078d cogl/driver/gles: Fix RGB10 GL formats
COGL_PIXEL_FORMAT_ABGR_2101010 is defined to mean the 2 A bits are
placed in a 32 bit unsigned integer on the bits with highest
significance, followed by B on the following 10 bits, and so on, until R
on the 10 least significant bits.

UNSIGNED_INT_2_10_10_10_REV_EXT is defined to represent color channels
as

```
  31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
  -------------------------------------------------------------------------------------
 |  a  |              b              |              g              |         r         |
  -------------------------------------------------------------------------------------
```

As can be seen, this matches COGL_PIXEL_FORMAT_ABGR_2101010, meaning
that's the format we can directly read and write.

In Cogl, when finding the GL formats, we get the tuple with the GL
format given the format we pass, but we also get returned "required
format" (CoglPixelFormat). This required format represents the format
that is required when reading actual pixels from GLES. In GLES, the
above mentioned format is the only one supported by the
EXT_texture_type_2_10_10_10_REV extension, thus for other types, we need
to do the CPU side conversion ourselves. To achieve this, correctly
return COGL_PIXEL_FORMAT_ABGR_2101010 as the required format.

The internal format should also be GL_RGB10_A2, not GL_RGBA.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2461>
2022-12-17 23:12:34 +00:00
Michel Dänzer
cbf5e6c85d cogl/pipeline: Simplify cogl_pipeline_get_layer_filters
By using _cogl_pipeline_layer_get_filters.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2757>
2022-12-15 11:54:21 +00:00
Michel Dänzer
1ad3d265e3 cogl/pipeline: Rename and export cogl_pipeline_get_layer_filters
For symmetry with cogl_pipeline_set_layer_filters.

Suggested by Jonas Ådahl.

v2:
* Align function parameters. (Jonas Ådahl)

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2757>
2022-12-15 11:54:21 +00:00
Michel Dänzer
1f65ab4be1 cogl/pipeline: Remove cogl_pipeline_get_layer_min/mag_filter
Unused since https://gitlab.gnome.org/GNOME/mutter/merge_requests/932
AFAICT.

As a bonus, gets rid of these compiler warnings:

../cogl/cogl/cogl-pipeline-layer-state.c: In function ‘cogl_pipeline_get_layer_min_filter’:
../cogl/cogl/cogl-pipeline-layer-state.c:1279:10: warning: ‘min_filter’ may be used uninitialized [-Wmaybe-uninitialized]
 1279 |   return min_filter;
      |          ^~~~~~~~~~
../cogl/cogl/cogl-pipeline-layer-state.c:1274:22: note: ‘min_filter’ was declared here
 1274 |   CoglPipelineFilter min_filter;
      |                      ^~~~~~~~~~
../cogl/cogl/cogl-pipeline-layer-state.c: In function ‘cogl_pipeline_get_layer_mag_filter’:
../cogl/cogl/cogl-pipeline-layer-state.c:1291:10: warning: ‘mag_filter’ may be used uninitialized [-Wmaybe-uninitialized]
 1291 |   return mag_filter;
      |          ^~~~~~~~~~
../cogl/cogl/cogl-pipeline-layer-state.c:1287:22: note: ‘mag_filter’ was declared here
 1287 |   CoglPipelineFilter mag_filter;
      |                      ^~~~~~~~~~

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2757>
2022-12-15 11:54:21 +00:00
Bilal Elmoussaoui
bb5af3a6bd g-i: Drop unneeded since/stability annotations
They are no longer useful since the merge of cogl inside mutter

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2708>
2022-11-22 13:32:52 +01:00
Bilal Elmoussaoui
3393db942a docs/cogl-pango: Make use of gi-docgen annotations
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2708>
2022-11-22 13:32:43 +01:00
Daniel van Vugt
cc19547b8c cogl: Set LOD bias to -0.5 for single mipmap modes
So that whenever forced to choose between two levels of detail (two mipmaps)
we will land on the sharpest looking one (highest resolution). That's the
mipmap level equal to the floor of the current level of detail requested.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5920
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2644>
2022-11-04 19:29:25 +00:00
Jonas Ådahl
5767d2f129 cogl/trace: Don't enable/disable in idle callback if thread matches
This makes it possible to start profiling immediately on startup, during
context/backend/display setup, as well as flush during tear down.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2678>
2022-11-01 21:04:21 +00:00
Jonas Ådahl
9117419940 cogl/texture: Type check introspected calls
CoglTexture can be used by e.g. Javascript, and the convention is to be
more forgiving regarding passed input so that invalid Javascript calls
doesn't cause actual SIGSEGV/SIGABRT. As elsewhere, do this by
sprinkeling g_return(_val)_if_fail() on introspected functions.

Related: https://bugzilla.redhat.com/show_bug.cgi?id=2124322
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2616>
2022-09-20 13:38:41 +00:00
Daniel van Vugt
dc5130ac01 cogl: Don't check glGetError for functions that don't return errors
This will at least make debug builds a tiny bit faster.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2615>
2022-09-19 14:24:39 +00:00
Daniel van Vugt
f1d7ccfa79 cogl: Add a quirk on Mali to glFlush before glGenerateMipmap
But only when the texture in question has associated framebuffers that
actually need flushing.

Workaround for: https://github.com/Xilinx/mali-userspace-binaries/issues/3
Related to: https://gitlab.gnome.org/GNOME/mutter/-/issues/2354

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2614>
2022-09-19 13:57:05 +00:00
Jonas Ådahl
efaf5a25b3 cogl: Remove the now unused test framework
All tests have been moved into src/tests/, so no need for it anymore.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2555>
2022-08-08 21:59:13 +00:00
Jonas Ådahl
30daad4da5 cogl/pipeline/vertend/glsl: Move out unit test to its own file
Fix a memory leak while at it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2555>
2022-08-08 21:59:13 +00:00
Jonas Ådahl
04bbe31287 cogl/pipeline/glsl: Distinguish between pipeline state types
Both the fragend and vertend shader state was called
"CoglPipelineShaderState", which was rather annoying, especially when
the type needs to be exposed outside of the .c file as part of moving
out unit tests. Make the types unique. This also avoids confusing what
type one is looking at.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2555>
2022-08-08 21:59:13 +00:00
Jonas Ådahl
07f8edde22 cogl/pipeline/opengl: Move out unit test to separate file
Also rename the suffix to "-glsl" to not confuse OpenGL with GLES2
since this test covers both.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2555>
2022-08-08 21:59:13 +00:00
Jonas Ådahl
16a7f77701 cogl/pipeline-state: Move out working unit test to separate file
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2555>
2022-08-08 21:59:13 +00:00
Jonas Ådahl
ae0f6c549f cogl/pipeline-state: Move out failing test to its own file
This test is a known failure, so mark it as such. It's stored in its own
file since keeping it in the same as the passing test isn't markable
using meson.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2555>
2022-08-08 21:59:13 +00:00
Jonas Ådahl
4905a55f64 cogl/pipeline-cache: Move unit test to its own file
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2555>
2022-08-08 21:59:13 +00:00
Jonas Ådahl
d0861c8ae2 cogl: Move out bitmask unit test to separate file
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2555>
2022-08-08 21:59:13 +00:00
Jonas Ådahl
9a9e7e471c tests/cogl: Add unit test framework
It consists of only a macro and build description logic.

Adds a macro for simpler tests that doesn't require a context; unit
tests requiring a context should use the same framework as conform
tests.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2555>
2022-08-08 21:59:13 +00:00
Jonas Ådahl
4ebaa433ee cogl: Remove now empty conform test suite
All working tests have already migrated to the test suite using mutter;
move the old unported tests over too, and remove the conform test
framework, as it is no longer used.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2555>
2022-08-08 21:59:13 +00:00
Jonas Ådahl
5d40a5eeea tests/cogl: Migrate fence test
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2555>
2022-08-08 21:59:12 +00:00
Jonas Ådahl
2b43ff5963 tests/cogl: Migrate texture rg test
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2555>
2022-08-08 21:59:12 +00:00
Jonas Ådahl
e7f535a21d tests/cogl: Migrate pipeline shader state test
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2555>
2022-08-08 21:59:12 +00:00
Jonas Ådahl
94744061de tests/cogl: Migrate texture no allocate test
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2555>
2022-08-08 21:59:12 +00:00
Jonas Ådahl
d066fb5380 tests/cogl: Migrate pipeline cache unrefs texture test
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2555>
2022-08-08 21:59:12 +00:00
Jonas Ådahl
68dcde0bdb tests/cogl: Migrate copy/replace texture test
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2555>
2022-08-08 21:59:12 +00:00
Jonas Ådahl
20111fa8ca tests/cogl: Migrate primitive and journal test
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2555>
2022-08-08 21:59:12 +00:00
Jonas Ådahl
3750ed6a26 tests/cogl: Migrate framebuffer bits test
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2555>
2022-08-08 21:59:12 +00:00
Jonas Ådahl
09990f8bcc tests/cogl: Migrate texture get/set data test
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2555>
2022-08-08 21:59:12 +00:00
Jonas Ådahl
85ad013b2d tests/cogl: Migrate alpha texture test
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2555>
2022-08-08 21:59:12 +00:00
Jonas Ådahl
629c23b229 tests/cogl: Migrate npot texture test
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2555>
2022-08-08 21:59:12 +00:00
Jonas Ådahl
33c582d33a tests/cogl: Migrate map buffer range test
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2555>
2022-08-08 21:59:12 +00:00
Jonas Ådahl
0a841ce846 tests/cogl: Migrate alpha test test
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2555>
2022-08-08 21:59:12 +00:00
Jonas Ådahl
5b0fa9cff4 tests/cogl: Migrate layer remove test
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2555>
2022-08-08 21:59:12 +00:00
Jonas Ådahl
7a91c30149 cogl: Remove version
The cogl version was unused, and not relevant, as the version and API is
tied to the mutter API version, not the old pre fork cogl version.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2555>
2022-08-08 21:59:12 +00:00
Jonas Ådahl
c0746a04f9 tests/cogl: Migrate no-gl header test
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2555>
2022-08-08 21:59:12 +00:00
Jonas Ådahl
590290cd6d tests/cogl: Migrate point sprite tests
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2555>
2022-08-08 21:59:12 +00:00
Jonas Ådahl
41e5ee63d3 tests/cogl: Migrate point size attribute tests
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2555>
2022-08-08 21:59:12 +00:00
Jonas Ådahl
2746861c6a tests/cogl: Migrate point size test
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2555>
2022-08-08 21:59:12 +00:00
Jonas Ådahl
ae9b4a1bcf tests/cogl: Migrate write texture formats test
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2555>
2022-08-08 21:59:12 +00:00
Jonas Ådahl
ddb982ba6e tests/cogl: Migrate read texture formats test
This test fails on gl and gl3, but not on gles2; mark is at such.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2555>
2022-08-08 21:59:12 +00:00
Jonas Ådahl
400cc89364 tests/cogl: Migrate sparse pipeline test
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2555>
2022-08-08 21:59:12 +00:00
Jonas Ådahl
8dc0489b33 tests/cogl: Migrate primitive tests
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2555>
2022-08-08 21:59:12 +00:00
Jonas Ådahl
559c9c8795 tests/cogl: Migrate journal test
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2555>
2022-08-08 21:59:12 +00:00
Jonas Ådahl
0c6eb86698 tests/cogl: Migrate offscreen test
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2555>
2022-08-08 21:59:12 +00:00
Jonas Ådahl
fd99884063 tests/cogl: Migrate custom attributes test
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2555>
2022-08-08 21:59:12 +00:00
Jonas Ådahl
6ac0c196cb tests/cogl: Migrate sub-texture test
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2555>
2022-08-08 21:59:12 +00:00
Jonas Ådahl
18dd64dd45 tests/cogl: Migrate wrap modes test
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2555>
2022-08-08 21:59:12 +00:00
Jonas Ådahl
a8f9466978 tests/cogl: Migrate snippets test
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2555>
2022-08-08 21:59:12 +00:00
Jonas Ådahl
a53fdfb733 tests/cogl: Migrate premult test
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2555>
2022-08-08 21:59:12 +00:00
Jonas Ådahl
6c8b12c4de tests/cogl: Migrate pixel buffer tests
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2555>
2022-08-08 21:59:12 +00:00
Jonas Ådahl
9305f8d9d8 tests/cogl: Migrate pipeline uniforms test
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2555>
2022-08-08 21:59:12 +00:00
Jonas Ådahl
63af78d049 tests/cogl: Migrate pipeline user matrix test
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2555>
2022-08-08 21:59:12 +00:00
Jonas Ådahl
a3b21188c9 tests/cogl: Migrate just-vertex-shader
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2555>
2022-08-08 21:59:12 +00:00
Jonas Ådahl
f3a821b4cd tests/cogl: Migrate backface-culling test
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2555>
2022-08-08 21:59:12 +00:00
Jonas Ådahl
66004d82c7 cogl/tests: Remove a few defunct 'test requirements'
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2555>
2022-08-08 21:59:12 +00:00
Jonas Ådahl
3839fb49cb tests/cogl: Migrate color-hsl test
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2555>
2022-08-08 21:59:12 +00:00
Jonas Ådahl
8c41b3b4a1 tests/cogl: Migrate depth test test
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2555>
2022-08-08 21:59:12 +00:00
Jonas Ådahl
67a9226e92 tests/cogl: Migrate blend test
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2555>
2022-08-08 21:59:12 +00:00
Jonas Ådahl
5e92500a9a tests/cogl: Migrate blend-strings test
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2555>
2022-08-08 21:59:12 +00:00
Jonas Ådahl
eaed0e4b46 tests/cogl: Migrate atlas-migration test
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2555>
2022-08-08 21:59:12 +00:00
Georges Basile Stavracas Neto
62330f273d cogl: Drop CoglHandleObject and CoglHandleClass
They're just typedefs to CoglObject and CoglObjectClass, respectively,
and the latter is unused already. The former is used in a couple of
deprecated headers, which can easily be changed.

Change all CoglHandleObject instances to CoglObject, and drop the types

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2355>
2022-05-31 16:28:16 -03:00
Georges Basile Stavracas Neto
631056bf49 cogl/journal: Make CoglJournal a free-form struct
There is no need to make CoglJournal a CoglObject, nor any kind of
object for that matter, since it doesn't require refcounting at all.
CoglJournal is entirely private to, and managed by, CoglFramebuffer,
and it only needs to create and destroy it.

Make CoglJournal a free-form struct, and adjust CoglFramebuffer to
call _cogl_journal_free() instead of cogl_object_unref().

Related: https://gitlab.gnome.org/GNOME/mutter/-/issues/2087
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2355>
2022-05-31 16:28:16 -03:00
Georges Basile Stavracas Neto
2c520f76b5 cogl: Drop cogl_texture_new_from_data
And, since this is the last public function of cogl-auto-texture.h,
drop the files entirely too.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2355>
2022-05-31 16:28:16 -03:00
Georges Basile Stavracas Neto
8ca20e709c cogl/tests: Port to cogl_texture_2d_new_from_data
Drop cogl_texture_new_from_data() in favour of the undeprecated
cogl_texture_2d_new_from_data().

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2355>
2022-05-31 16:28:16 -03:00
Georges Basile Stavracas Neto
f927e692c7 cogl: Drop cogl_texture_new_from_file
It is now unused.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2355>
2022-05-31 16:25:11 -03:00
Georges Basile Stavracas Neto
f25360677f clutter/canvas: Use cogl_texture_2d_new_from_bitmap
cogl_texture_new_from_bitmap() is deprecated. Since this was the
last usage of it, also drop cogl_texture_new_from_bitmap().

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2355>
2022-05-31 16:25:11 -03:00
Georges Basile Stavracas Neto
20bfd10f0c cogl: Remove cogl_get_option_group
It's unused.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2355>
2022-05-31 16:25:11 -03:00
Simon Schneegans
86d3a6b4bc cogl/snippet: Use "Returns:" for introspection annotations
According to the GObject introspection documentation, "Returns:" should
be used (rather than the previous "Return value:").

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2422>
2022-05-31 11:38:20 +00:00
Simon Schneegans
2fd63724af cogl/snippet: Make API introspectable
This change ensures that the Snippet API of Cogl is exposed to GJS,
making it possible to create custom shader programs in GJS.

Related: https://gitlab.gnome.org/GNOME/mutter/-/issues/2280
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2422>
2022-05-31 11:38:20 +00:00
Simon Schneegans
d7c0ecc21b cogl/pipeline: Make Snippet API introspectable
These methods are required to add snippets to a pipeline.
This change makes it possible to use them from GJS.

Related: https://gitlab.gnome.org/GNOME/mutter/-/issues/2280
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2422>
2022-05-31 11:38:20 +00:00
Bilal Elmoussaoui
bd94adaf74 cogl: Unify HAS_X11/HAS_XLIB build configs
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2354>
2022-05-25 16:42:04 +02:00
Christian Rauch
9ba510646c cogl: Fix build without X11
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2354>
2022-05-25 16:42:04 +02:00
Bilal Elmoussaoui
a81b2a49ed meson: Split x11 option into backend/xwayland
Allow disabling either the xwayland or backend implementation of x11.
Meson options were not added as this is more of a groundwork than the
actual implementation.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2354>
2022-05-25 16:42:04 +02:00
Jonas Ådahl
2b4a24132b screen-cast: Test allocate DMA buffer with implicit API
DMA buffers might be allocatable, but it doesn't mean the driver doesn't
fail when we try to allocate a buffer with an implicit modifier. Using
the proprietary NVIDIA driver for example, it will fail. Lets catch this
up front and avoid advertising DMA buffer support when we know it won't
work.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2383>
2022-04-22 12:08:04 +00:00
Corentin Noël
e4c8125c31 cogl/context: Add transfer full annotation to destroy timestamp query
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2362>
2022-04-05 12:40:56 +02:00
Christian Hergert
858f89084e winsys: Check for KHR_swap_buffers_with_damage
Previously, we would only check for EXT_swap_buffers_with_damage which
generally will find an implementation. However, some EGL implementations
do not appear to support that naming of the extension, preferring to
only advertise KHR_swap_buffers_with_damage.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2316>
2022-03-28 15:23:28 +00:00
Jonas Ådahl
63cc69b342 cogl/tests: Fix warning about passing a double to fabs
The warning was in a home baked g_assert_float_with_epsilon(). Change to
use the glib one directly.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2319>
2022-03-04 23:12:24 +00:00
Jonas Ådahl
c9125aba73 cogl/gl: Fix switch passthrough warnings
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2319>
2022-03-04 23:12:24 +00:00
Ivan Molodetskikh
bcf6ee5e55 Name unnamed sources
These names show up in GLib traces in sysprof, so let's make sure they
exist.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1928>
2022-03-04 10:10:05 +03:00
Jonas Ådahl
49ac60e346 cogl/renderer: Add 'is_dma_buf_supported()' vfunc
Returns TRUE if the active renderer backend can allocate DMA buffers.
This is the case hardware accelerated GBM backends, but FALSE for
surfaceless (i.e. no render node) and EGLDevice (legacy NVIDIA paths).
While software based gbm devices can allocate DMA buffers, we don't want
to allocate them for offscreen rendering, as we really only use these
for inter process transfers, and as buffers allocated for scanout
doesn't use the relevant API, making it return FALSE for these solves
that.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1939>
2022-02-07 10:56:57 +00:00
Daniel van Vugt
c970bb3e6c cogl: Merge FEATURE_ID_GET_GPU_TIME into FEATURE_ID_TIMESTAMP_QUERY
Because both code paths require the existence of `GL_TIMESTAMP[_EXT]`
which is only guaranteed if `ARB_timer_query` (included in GL core 3.3)
is implemented.

We know when that is true because `context->glGenQueries` and
`context->glQueryCounter` are non-NULL. So that is the minimum
requirement for any use of `GL_TIMESTAMP`, even when it is used in
`glGetInteger64v`.

Until now, Raspberry Pi (OpenGL 2.1) would find a working implementation
of `glGetInteger64v` but failed to check whether the driver understands
`GL_TIMESTAMP` (it doesn't).

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2107
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2253>
2022-01-27 22:58:59 +00:00
Neil Roberts
ad071c64f9 cogl: Rebind the EGL image when handling damage
When Cogl gained support for importing pixmaps, I think there was a
misunderstanding that there is a difference in how it works in GLX and
EGL where GLX needs to rebind the pixmap in order to guarantee that
changes are reflected in the texture after it detects damage, whereas
with EGL it doesn’t. The GLX spec makes it pretty clear that it does
need to rebind whereas the EGL spec is a bit harder to follow. As a
fallout from Mesa MR 12869, it seems like the compositor really does
need to rebind the image to comply with the spec. Notably, in
OES_EGL_image_external there is:

"Binding (or re-binding if already bound) an external texture by calling
 BindTexture after all modifications are complete guarantees that
 sampling done in future draw calls will return values corresponding to
 the values in the buffer at or after the time that BindTexture is
 called."

So this commit changes the x11_damage_notify handler for EGL to lazily
queue a rebind like GLX does. The code that binds the image while
allocating the texture has been moved into a reusable helper function.

It seems like there is a bit of a layering violation when accessing the
GL driver internals from the EGL winsys code, but I noticed that the GLX
code also includes the driver GL headers and otherwise it seems pretty
tricky to do properly.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2062>
2021-12-13 16:09:56 +00:00
Georges Basile Stavracas Neto
3cd77f8a79 cogl: Drop COGL_HAS_WAYLAND_EGL_SERVER_SUPPORT
The only place where this define is used can be replaced by
checking EGL_WL_bind_wayland_display, which is done in that
same file already.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2145>
2021-12-07 18:36:27 -03:00
Georges Basile Stavracas Neto
87a66830dc cogl: Drop cogl-wayland-server.h
This header only defines one function that doesn't exist anymore,
and nothing else. It can be safely dropped.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2145>
2021-12-07 18:34:00 -03:00
Fernando Monteiro
44aa6ab735 cogl: Remove cogl_texture_new_with_size
Replace the deprecated function with the suggested alternative.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2058>
2021-12-07 15:32:21 +00:00
Fernando Monteiro
612da58c72 cogl: Remove cogl_texture_new_from_sub_texture
This function is deprecated and must be replaced to the alternative.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2058>
2021-12-07 15:32:21 +00:00
Fernando Monteiro
0c5cf1ec58 tests: Rename 'material' variables to 'pipeline'
This should replace all usages of the material variable to
the pipeline variable.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2058>
2021-12-07 15:32:21 +00:00
Fernando Monteiro
9f9e64f077 cogl: Remove cogl_material_new
This function is deprecated and must be replaced to the alternative.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2058>
2021-12-07 15:32:21 +00:00
Fernando Monteiro
6cd4489e55 cogl: Remove cogl_material_set_color
This is unused anywhere.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2058>
2021-12-07 15:32:21 +00:00
Fernando Monteiro
edae2fff72 cogl: Remove cogl_material_set_color4ub
This function is deprecated and must be replaced to the alternative.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2058>
2021-12-07 15:32:21 +00:00
Fernando Monteiro
5a5f57d533 cogl: Remove cogl_material_set_alpha_test_function
This is unused anywhere.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2058>
2021-12-07 15:32:21 +00:00
Fernando Monteiro
afdbb71926 cogl: Remove cogl_material_set_blend
This function is deprecated and must be replaced to the alternative.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2058>
2021-12-07 15:32:21 +00:00
Fernando Monteiro
f90f8f84c3 cogl: Remove cogl_material_set_blend_constant
This is unused anywhere.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2058>
2021-12-07 15:32:21 +00:00
Fernando Monteiro
403f44e7b0 cogl: Remove cogl_material_set_user_program
This function is deprecated and must be replaced to the alternative.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2058>
2021-12-07 15:32:21 +00:00
Fernando Monteiro
06de4e241d cogl: Remove cogl_pipeline_set_point_size
This function is deprecated and must be replaced to the alternative.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2058>
2021-12-07 15:32:21 +00:00
Fernando Monteiro
a14d3d6e17 cogl: Remove cogl_pipeline_set_layer
This function is deprecated and must be replaced to the alternative.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2058>
2021-12-07 15:32:21 +00:00
Fernando Monteiro
68ec76e4ee cogl: Remove cogl_pipeline_set_layer_combine
This function is deprecated and must be replaced to the alternative.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2058>
2021-12-07 15:32:21 +00:00
Fernando Monteiro
a8cd59e029 cogl: Remove cogl_material_set_layer_combine_constant
This is unused anywhere.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2058>
2021-12-07 15:32:21 +00:00
Fernando Monteiro
ca25c5543a cogl: Remove cogl_material_set_layer_matrix
This function is deprecated and must be replaced to the alternative.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2058>
2021-12-07 15:32:21 +00:00
Fernando Monteiro
29c62fabac cogl: Remove cogl_material_set_layer_point_sprite_coords_enabled
This function is deprecated and must be replaced to the alternative.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2058>
2021-12-07 15:32:21 +00:00
Fernando Monteiro
8285091585 cogl: Remove material_set_layer_filters
This function is deprecated and must be replaced to the alternative.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2058>
2021-12-07 15:32:21 +00:00
Fernando Monteiro
913458381f cogl: Remove usages of framebuffer_draw_primitive
We were already returning cogl_primitive_draw in framebuffer_draw_primitive,
so replace all usages and remove it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2058>
2021-12-07 15:32:21 +00:00
Fernando Monteiro
b8925ef3d4 cogl: Remove deprecated backface_culing API
They are unused.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2058>
2021-12-07 15:32:21 +00:00
Fernando Monteiro
74fe57b018 cogl: Remove deprecated depth_test API
They are unused.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2058>
2021-12-07 15:32:21 +00:00
Simon McVittie
a49c98d8d8 tests: Don't continue if setup commands fail
Because POSIX sh was, with hindsight, not a particularly well-designed
programming language, if we don't 'set -e', then we'll respond to failure
of a setup command such as cd by carrying on regardless.

Signed-off-by: Simon McVittie <smcv@debian.org>
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2009>
2021-11-17 09:04:07 +00:00
Simon McVittie
7af1043865 tests: Don't use TestEnvironment
The assumption here seems to be that it's an overlay onto the
current environment which would make sense; but the implementation in
gnome-desktop-testing currently removes all other environment variables
(see GNOME/gnome-desktop-testing#1). This causes test failure when the
tests are run in Debian's autopkgtest framework, possibly because PATH
is cleared.

Signed-off-by: Simon McVittie <smcv@debian.org>
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2009>
2021-11-17 09:04:07 +00:00
Erico Nunes
87965b5ce2 cogl: Add support for partial update
Add support for a cogl function to set the damage_region on an onscreen
framebuffer.
The goal of this is to enable using the EGL_KHR_partial_update extension
which can potentially reduce memory bandwidth usage by some GPUs,
particularly on embedded GPUs that operate on a tiling rendering model.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2023>
2021-10-26 16:56:39 +00:00
Carlos Garnacho
c869b92d5d cogl: Plug leak in error path
If the renderer fails to connect, we were leaking the renderer.

CID: #1505882
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2061>
2021-10-25 15:45:35 +02:00
Carlos Garnacho
f6726c61ca cogl: Plug leak on error path
If we don't pass the gles version check, the gl_extensions string
is leaked.

CID: #1505846
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2061>
2021-10-25 15:45:35 +02:00
Carlos Garnacho
ed9650ff42 cogl: Plug possible GString leaks
These strings are leaked if there are no changes to log. This is
perhaps never true, but this anyway good for clarity.

CIDs: #1505840, #1505884
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2061>
2021-10-25 15:45:35 +02:00
Carlos Garnacho
4dc07999c6 cogl: Plug GString leak
In some error paths, this string was being leaked. Make it g_autoptr
so it's done for us.

CID: #1505903
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2061>
2021-10-25 15:45:35 +02:00
Carlos Garnacho
774f120ac4 cogl: Fix broken check for COGL_DISABLE_GL_EXTENSION envvar
This check was always true since the variable is already set in the
if() condition above. Presumably this was meant to check for empty
strings, so do that.

CID: #1491518
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2061>
2021-10-25 15:45:35 +02:00
Jonas Ådahl
259a906b8c cogl/winsys: Remove 'multiple-onscreen' feature
It was always set, and is no longer used; remove it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2002>
2021-10-18 14:36:15 +00:00
Jonas Ådahl
9bd2c5c6f2 cogl/context: Report error if allocating fallback texture failed
Error out if we fail to allocate the 1x1 all white fallback texture. If
we don't do this, and instead continue, any future (likely) allocation
failure will end up in obscure places that assumes the fallback texture
exists.

Related: https://bugzilla.redhat.com/show_bug.cgi?id=1989726
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1994>
2021-09-20 16:37:37 +00:00
Robert Mader
daace1aac5 cogl: Add XRGB_FP_16161616 and XBGR_FP_16161616 formats
These match their alpha counterparts, apart from not setting the
alpha bit. This allows our internal mashinery to more easily
distinguish whether we need a slow alpha-pass during rendering or not.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1810>
2021-09-20 14:39:20 +00:00
Robert Mader
dc442e7a75 cogl: Add XRGB_2101010 and XBGR_2101010 formats
These match their alpha counterparts, apart from not setting the
alpha bit. This allows our internal mashinery to more easily
distinguish whether we need a slow alpha-pass during rendering or not.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1810>
2021-09-20 14:39:20 +00:00
Erico Nunes
420a17d12e cogl: Fix GL_EXT_discard_framebuffer extension check
Using "framebuffer_discard" in the list refers to an invalid extension.
The extension which introduces glDiscardFramebufferEXT is
"GL_EXT_discard_framebuffer".

With this fix, cogl_gl_framebuffer_fbo_discard_buffers can actually call
glDiscardFramebufferEXT.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1974>
2021-08-24 18:33:09 +02:00
Florian Müllner
8158e96004 cogl: Remove conditional g_type_init() call
glib 2.36 hasn't met our minimum requirements for years.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1957>
2021-08-22 17:32:12 +00:00
Jonas Ådahl
6d64a43b1f cogl/trace: Add getter for trace enabled state
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1700>
2021-07-29 15:16:48 +02:00
Jonas Ådahl
8bd75747b1 cogl/trace: Add scoped trace anchors
A trace "anchor" is a trace head (CoglTraceHead) that is placed in a
certain scope (e.g. function scope), but then only triggered in another
scope, e.g. a condition.

This makes it possible to have optional trace instrumentation, that is
enabled only given e.g. a debug flag.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1700>
2021-07-29 15:16:48 +02:00
Jonas Ådahl
b1ac1327cd cogl/trace: Add way to add a description to trace
This is useful to pass more complex information, generated at runtime.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1700>
2021-07-29 15:16:48 +02:00
Jonas Ådahl
dd40e35ab2 cogl/trace: Fix argument naming
The argument passed to COGL_TRACE() and friends is the "name", not the
optional "description". Clean this up so we can add description handling
too.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1700>
2021-07-29 15:16:48 +02:00
Jonas Ådahl
e4375046e0 cogl/gl: Handle bogus glGetString(GL_RENDERER) return values
Seems glGetString(GL_RENDERER) in the wild can return NULL, causing
issues with strstr(). Handle this more gracefully by using
g_return_val_if_fail(), that assumes a NULL renderer means software
rendering.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1931>
2021-07-16 18:17:04 +02:00
Ivan Molodetskikh
f1024564a2 cogl: Store CPU and GPU rendering timestamps in frame info
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1762>
2021-07-13 08:09:42 +00:00
Ivan Molodetskikh
8c258d1de1 cogl: Add CPU swap time and GPU rendering query to CoglFrameInfo
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1762>
2021-07-13 08:09:42 +00:00
Ivan Molodetskikh
fbe6740df1 cogl: Add GPU timestamp querying utilities
Add utilities that allow getting the current GPU timestamp and creating
a query which completes upon completion of all operations currently
submitted on a framebuffer. Combined, these two allow measuring how long
it took the GPU to finish rendering something to a framebuffer.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1762>
2021-07-13 08:09:42 +00:00
Ivan Molodetskikh
cc08af48f6 cogl: Add prototypes for getting timestamp queries
Will be used for measuring GPU rendering duration.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1762>
2021-07-13 08:09:42 +00:00
Jonas Ådahl
5e45dc15b6 cogl/renderer: Add API to bind the right EGL API
We need to call eglBindAPI() with GLES before we setup the secondary
GPU blit. We've been lucky not really needing this, as it has been
GLES default, which is what the secondary blit uses, in order to not
depend on the default, or if we want to create the secondary blit
objects after initializing cogl, we must make sure to bind the right API
at the right time.

As we need to bind the GLES API when setting up the secondary blit, we
need to make sure that cogl gets the right API bound when that's done,
so Cogl can continue working. For this, add a "bind_api()" method on the
CoglRenderer object, that will know what API is correct to bind.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1828>
2021-07-07 21:03:26 +02:00
Zander Brown
cfe6cda694 cogl: Export cogl_blend_string_error_quark
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1916>
2021-07-05 23:01:37 +01:00
Daniel van Vugt
936696afcf cogl/winsys-glx: Request 2 stencil bits
Just like we do on EGL. Two bits are required because
`cogl-clip-stack-gl.c` needs each stencil buffer element to be able to
count from 0 to 2.

This mistake probably went unnoticed because:

 * Drivers usually provide more than 1 anyway; and

 * Optimizations in `cogl-clip-stack-gl.c` avoid calling the code that
   needs to count past 1 in most cases.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1873>
2021-06-01 15:44:05 +08:00
Daniel van Vugt
216bb7f960 cogl/clip-stack-gl: Set glStencilMask correctly for clip regions
Previously we were using a mask of 0x1 for the lifetime of the stencil.
This was wrong for two reasons:

  * The intersection algorithm needs to count up to a maximum 2, so a
    mask of 1 would clamp to 1 instead. Then decrementing all pixels
    resulted in all pixels being zero even though we want some to be 1.
    So the stencil then blocked some color buffer pixels being rendered.

  * The lifetime of the mask was too long. By leaving it non-zero at
    the end of the function we could accidentally end up modifying the
    stencil contents during our later color buffer paints.

This fixes faulty rendering of some actors seen in gnome-shell with
test case: `env COGL_DEBUG=stencilling`

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1873>
2021-06-01 15:44:01 +08:00
Daniel van Vugt
5991f53c84 cogl/clip-stack-gl: Set glStencilMask correctly for clip rectangles
Previously we were using a mask of 0x1 for the lifetime of the stencil.
This was wrong for two reasons:

  * The intersection algorithm needs to count up to a maximum 2, so a
    mask of 1 would clamp to 1 instead. Then decrementing all pixels
    resulted in all pixels being zero even though we want some to be 1.
    So the stencil then blocked some color buffer pixels being rendered.

  * The lifetime of the mask was too long. By leaving it non-zero at
    the end of the function we could accidentally end up modifying the
    stencil contents during our later color buffer paints.

This fixes missing rendering of some actors seen in gnome-shell with
test case: `env COGL_DEBUG=stencilling CLUTTER_PAINT=disable-clipped-redraws`

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1873>
2021-06-01 15:43:33 +08:00
Daniel van Vugt
c3d64cc05b cogl: Add new option COGL_DEBUG=stencilling to disable optimizations
This means stencilling every clip stack entry even when stencilling could
be skipped. This visibly reveals some bugs in the stencilling logic.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1873>
2021-06-01 15:42:52 +08:00
Daniel van Vugt
f390340da5 cogl/clip-stack-gl: Remove unused code: #define GL_CLIP_PLANEn
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1873>
2021-06-01 15:42:52 +08:00
Marco Trevisan (Treviño)
7d88386ee1 mutter-cogl.test: Use xvfb-run to run the cogl tests
The cogl tests need to run with a display server set, however since we
use TestEnvironment, only the listed env variables will be exposed to
the test and so no DISPLAY will be set when launching it with
gnome-desktop-testing-runner.

As per this, just run the tests using xvfb-run so that we match what's
happening in CI and we ensure that the tests are run in a safe
environment.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1876>
2021-05-26 21:03:45 +02:00
Jonas Ådahl
72f03e9c74 cogl: Remove ability to bind Wayland EGL display
We do that in the Wayland infrastructure code now, so remove Cogl's
ability to do the same.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1863>
2021-05-18 14:03:22 +00:00
Carlos Garnacho
9e10d2fa88 cogl: Drop "volatile" from static GTypes in manual registration
As documented in g_once_init_enter(): "While @location has a volatile qualifier,
this is a historical artifact and the pointer passed to it should not be
volatile.". And effectively this now warns with modern glibc.

Drop the "volatile" qualifier from these static variables as it's expected.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1785>
2021-03-22 10:47:51 +00:00
Jonas Ådahl
ec14f51ae3 cogl/onscreen/egl: Remove platform pointer
It's not used anymore, so remove it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1759>
2021-03-08 15:02:30 +00:00
Ivan Molodetskikh
47183a94eb cogl/frame-info: Add VSYNC flag
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1484>
2021-03-08 09:48:11 +00:00
Ivan Molodetskikh
9123aa4e84 cogl/frame-info: Add ZERO_COPY flag
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1484>
2021-03-08 09:48:11 +00:00
Ivan Molodetskikh
c96fb181ab cogl/frame-info: Add sequence
It will be used for the presentation-time Wayland protocol.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1484>
2021-03-08 09:48:11 +00:00
Ivan Molodetskikh
5d8cb2786b cogl: Remove get_monotonic_time_ns()
It's no longer needed. Everything else uses and assumes
g_get_monotonic_time().

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1484>
2021-03-08 09:48:11 +00:00
Ivan Molodetskikh
4ba2df0bd2 cogl: Remove cogl_get_clock_time()
It's no longer used.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1484>
2021-03-08 09:48:11 +00:00
Ivan Molodetskikh
4810164885 cogl: Make presentation time always MONOTONIC
This concerns only the cases when the presentation timestamp is received
directly from the device (from KMS or from GLX). In the majority of
cases this timestamp is already MONOTONIC. When it isn't, after this
commit, the current value of the MONOTONIC clock is sampled instead.

The alternative is to store the clock id alongside the timestamp, with
possible values of MONOTONIC, REALTIME (from KMS) and GETTIMEOFDAY (from
GLX; this might be the same as REALTIME, I'm not sure), and then
"convert" the timestamp to MONOTONIC when needed. An example of such a
conversion was done in compositor.c (removed in this commit). It would
also be needed for the presentation-time Wayland protocol. However, it
seems that the vast majority of up-to-date systems are using MONOTONIC
anyway, making this effort not justified.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1484>
2021-03-08 09:48:11 +00:00
Ivan Molodetskikh
d8606829c4 cogl: Report presentation time in microseconds
KMS and GLX device timestamps have microsecond precision, and whenever
we sample the time ourselves it's not the real presentation time anyway,
so nanosecond precision for that case is unnecessary.

The presentation timestamp in ClutterFrameInfo is in microseconds, too,
so this commit makes them have the same precision.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1484>
2021-03-08 09:48:10 +00:00
Ivan Molodetskikh
9d54ef3994 cogl/frame-info: Add HW_CLOCK flag
A flag indicating whether the presentation timestamp was provided by the
display hardware (rather than sampled in user space).

It will be used for the presentation-time Wayland protocol.

This is definitely the case for page_flip_handler(), and I'm assuming
this is also the case for the two instances in the GLX code.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1484>
2021-03-08 09:48:10 +00:00
Robert Mader
df4508e8cf cogl: Stop using GSlice
It has been inofficially deprecated for years, is known to cause issues
with valgrind and potentially hides memory corruption.
Lets stop using it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1512>
2021-02-22 13:51:30 +01:00
Jonas Ådahl
7ddbcd1fd2 cogl/journal: Don't sometimes hold a ref on the framebuffer
d42f1873fc introduced a semi circular
reference between the CoglFramebuffer, and CoglJournal, where
CoglJournal would keep a reference on the CoglFramebuffer when there
were any entries in the journal log.

To avoid risking leaking these objects indefinitely, when freeing
objects without doing anything that triggered a flush, CoglFramebuffer
had a "filter" on cogl_object_unref() calls, which knew
about under what conditions CoglJournal had a reference to it. When it
could detect that there were only the journal itself holding such a
reference, it'd flush the journal, effectively releasing the reference
the journal held, thus freeing itself, as well as the journal.

When CoglFramebuffer was ported to be implemented using GObject instead
of CoglObject, this "filter" was missed, causing not only awkward but
infrequent leaks, but also situations where we'd flush journals when
only the journal itself held the last reference to the framebuffer,
meaning the journal would free the framebuffer, thus itself, in the
middle of flushing, causing memory corruption and crashes.

A way to detect this, by asserting on CoglObject reference count during
flush, is by adding the `g_assert()` as described below, which will
assert instead cause memory corruption.

void
_cogl_journal_flush (CoglJournal *journal
{
   ...
   _cogl_journal_discard (journal);
+  g_assert (journal->_parent.ref_count > 0);
   ...
}

Fix this by making CoglFramebuffer the owner of the journal, which it
already was, and remove any circle referencing that was there before, as
it is not needed given that the CoglFramebuffer pointer is guaranteed to
be valid for the lifetime of CoglJournal as the framebuffer is the owner
of the journal.

However, to not miss flushing before tearing down, which is important as
this flushes painting calls to the driver that is important for e.g.
using the result of those journal entries, flush the journal the first
time cogl_framebuffer_dispose() is called, before doing anything else.

This also adds a test case. Without having broken the circular
reference, the test would fail on g_assert_null (offscreen), as it would
have been "leaked" at this point, but the actual memory corruption would
be a result of the `cogl_texture_get_data()` call, which flushes the
framebuffer, and causes the 'mid-flush' destruction of the journal
described above. Note that the texture keeps track of dependent
framebuffers, but it does not hold any references to them.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1474
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1735>
2021-02-18 16:59:00 +00:00
Jonas Ådahl
30e1c51b33 Change all g_memdup() to g_memdup2()
Using g_memdup() is dangerous due to the type of the size argument. See
https://gitlab.gnome.org/GNOME/glib/-/issues/2319 and
https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1926 for details.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1708>
2021-02-04 19:16:28 +01:00
Jonas Ådahl
9a21f97ce1 cogl/gl-framebuffer: Remove hard coding type name
Either "onscreen" or "offscreen" was logged as the type; replace this
with the actual type name.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:47 +00:00
Jonas Ådahl
b07994b606 cogl: Use 'is_y_flipped()' instead of instance-of checking
This is what it was effectively used for in these places, so use the
appropriate API instead.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:47 +00:00
Jonas Ådahl
6b5d7f45cb cogl/gl-framebuffer: Check Y-flipped-ness instead of framebuffer type
In a few places coordinates were flipped if driven framebuffer was or
wasn't a CoglOffscreen. Change this to use the existing Y-flipped-ness
class vfunc.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:46 +00:00
Jonas Ådahl
102aa59ce3 cogl/gl-framebuffer: Move stereo mode state flushing to backend
It's currently only handled by a surface backend framebuffer (assuming
the right GLX extensions are available). While it's theoretically
possible to do the same with the offcreen by having multiple textures,
it's not supported, so leave the FBO variant with a single warning if we
end up there.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:46 +00:00
Jonas Ådahl
dd55c3699c cogl/gl-framebuffer: GObject:ify helper functions
The object was still pretending to be CoglFramebuffer itself, by using
naming and calling conventions making it seem like that. Fix that by
passing around the driver instead of the framebuffer.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:46 +00:00
Jonas Ådahl
0fcb26075f cogl/framebuffer: Move read_pixels_into_bitmap() to driver class
This was the last driver vfunc used specifically to implement the
CoglFramebuffer driver.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:46 +00:00
Jonas Ådahl
1e5f105836 cogl/framebuffer: Move attribute drawing to driver class
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:46 +00:00
Jonas Ådahl
392ffaeeb4 cogl/framebuffer: Move discard_buffers() to driver sub types
It was implemented slightly different depending on whether it was for a
surface or FBO, so move it to their corresponding GL driver types.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:46 +00:00
Jonas Ådahl
b7c6865225 cogl/framebuffer: Move flush() and finish() to driver class
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:46 +00:00
Jonas Ådahl
1b3937491c cogl/framebuffer: Move clear() to CoglFramebufferDriver
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:46 +00:00
Jonas Ådahl
4f3b57c841 cogl/onscreen: Move buffer age getter vfunc to class
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:46 +00:00
Jonas Ådahl
b2482a2069 cogl: Add CoglX11Onscreen interface
Mutter needs to fetch the X11 Window ID from the onscreen and did that
by using an X11 specific API on the CoglOnscreen, where the X11 type was
"expanded" (Window -> uint32_t). Change this by introducing an interface
called CoglX11Onscreen, implemented by both the Xlib and GLX onscreen
implementations, that keeps the right type (Window), while avoiding X11
specific API for CoglOnscreen.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:46 +00:00
Jonas Ådahl
4ec0975e91 cogl/onscreen: Remove explicit 'resizable':ness
Mutter didn't use the APIs for resizeability of CoglOnscreens but
managed the size itself. For the native backend we don't ever resize
onscreens. Thus, remove this unused functionality.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:46 +00:00
Jonas Ådahl
e43b95cd11 cogl/onscreen: Remove show()/hide()
Not used, and not relevant.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:46 +00:00
Jonas Ådahl
b0ec3a3ad7 cogl/test-utils: Skip "showing" the onscreen
Tests pass anyway.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:46 +00:00
Jonas Ådahl
0fdf6a6405 cogl/onscreen: Move direct scanout to CoglOnscreen class
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:46 +00:00
Jonas Ådahl
f663567405 cogl/onscreen: Move binding to onscreen class
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:46 +00:00
Jonas Ådahl
fe72876b20 cogl/onscreen: Make swap_buffer/region CoglOnscreen class vfuncs
No need to go via the "winsys" vtable.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:46 +00:00
Jonas Ådahl
60e1516b1c cogl/gl-framebuffer: Split up into FBO and back drivers
One is for when we're painting to the back buffer (onscreen), and the
other when we're painting to an FBO (offscreen).

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:46 +00:00
Jonas Ådahl
a6b0376a6c cogl: Add 'framebuffer' debug topic
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:46 +00:00
Jonas Ådahl
d136c6510b cogl: Init framebuffer driver up front
The framebuffer driver was lazilly initialized on demand in some cases
(onscreen), and up front other (offscreen). Replace this with a more
predictable up front initialization, done at framebuffer allocation.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:46 +00:00
Jonas Ådahl
58eb1e87bf cogl/offscreen: Move struct to C file
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:46 +00:00
Jonas Ådahl
ece714c5c6 cogl/gl-framebuffer: Move struct fields into private
This makes it possible to make type derivable.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:45 +00:00
Jonas Ådahl
e3de0be678 cogl: Move "flush framebuffers" under the context scope
It was namespaced as a CoglFramebuffer function, but was passed two
framebuffers, and operated on state kept in CoglContext. Move and rename
accordingly.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:45 +00:00
Jonas Ådahl
5be5529269 cogl: Add CoglFramebufferDriver base type
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:45 +00:00
Jonas Ådahl
c7ea0b3d54 cogl/offscreen: Pass ColgOffscreenFlag when allocating
So that the allocation functions don't need to peek at the cached flag
struct field.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:45 +00:00
Jonas Ådahl
cac5938238 cogl/gl-framebuffer: Fix allocate flag variable name
It was called 'flags' which would conflict with a variable containing a
CoglOffscreenFlag that will be added later.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:45 +00:00
Jonas Ådahl
1bee9e0d53 cogl/offscreen: Remove alloation_flags struct field
Was unused.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:45 +00:00
Jonas Ådahl
408d4c9f09 cogl/offscreen: Remove depth buffer texture field
It was never set, so it was just some dead code.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:45 +00:00
Jonas Ådahl
8910b3e7bc cogl/offscreen: Move CoglGlFbo struct to GL driver
It was only used there, so put it in the driver private struct.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:45 +00:00
Jonas Ådahl
e9e37dd0d1 cogl/offscreen: Move CoglOffscreen code to its own file
Moving the external direct struct access will come later.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:45 +00:00
Jonas Ådahl
391866d415 cogl/gl-framebuffer: Rename CoglGLFramebuffer CoglGlFbo
The CoglGLFramebuffer (not CoglGlFramebuffer) is a private struct for
keeping track of the framebuffer object. To avoid confusing with
CoglGlFramebuffer, rename it CoglGlFbo.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:45 +00:00
Jonas Ådahl
f56b0abaef cogl/gl-framebuffer: Make it a GObject
This way we can have separate types per modes of operation (e.g. if it's
backed by an EGLSurface or single texture), instead of being dependent
on a certain type (onscreen vs offscreen).

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:45 +00:00
Jonas Ådahl
0e376f4dda cogl/framebuffer-gl: Rename from CoglFramebufferGl to CoglGlFramebuffer
This is to follow the convention [ParentName][ChildName] representing
inheritance. As this does not inherit CoglFramebuffer, rename it
CoglGlFramebuffer.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:45 +00:00
Jonas Ådahl
0936d7bd06 cogl/onscreen: Use CoglFramebufferClass::allocate() to init
Instead of calling "init_onscreen()" on two different separate vtables
from the allocate() funtion, just have the CoglOnscreen sub types
themself implement allocate() and initialize in there.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:45 +00:00
Jonas Ådahl
0b568b68c6 Make all CoglOnscreen sub types inherit CoglOnscreen
Thins means that e.g. MetaOnscreenNative now inherits CoglOnscreenEgl,
which inherits CoglOnscreen which inherits CoglFramebuffer, all being
the same GObject instance.

This makes it necessary to the one creating the onscreen to know what it
wants to create. For the X11 backend, the type of renderer (Xlib EGL or
GLX) determines the type, and for the native backend, it's currently
always MetaOnscreenNative.

The "winsys" vfunc entries related to onscreens hasn't been moved yet,
that will come later.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:45 +00:00
Jonas Ådahl
f60943afc9 cogl/onscreen/egl: Move struct fields to instance private
This is so a derivable type can be declared later.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:45 +00:00
Jonas Ådahl
b5afa6db23 cogl/onscreen: Change to follow mutters naming convention
The mutter naming convention for types and their instance variables is:

Type name:
   [Namespace][BaseName][SubType]

Instance name:

   [base_name]_[sub_type]

This means that e.g. CoglOnscreenGLX is renamed CoglOnscreenGlx, and
glx_onscreen is renamed onscreen_glx. This is in preparation for
GObjectification.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:45 +00:00
Jonas Ådahl
8339c064c8 cogl/xlib: Move EGL XLIB onscreen to separate file
As with the other onscreens, separate it into its own file in
preparation for GObjectification.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:45 +00:00
Jonas Ådahl
a057432e3d cogl/glx: Move onscreen code to a separate file
Mostly in order to untangle it from the rest, preparing turning it into
a GObject.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:45 +00:00
Jonas Ådahl
2eea373241 cogl/winsys/glx: Merge 'xlib' and 'glx' structs
The GLX winsys code had split up the GLX onscreen implementation into an
Xlib part (with a struct name confusingly enough identical to that of
the onscreen in the actual Xlib winsys). To remove some confusion,
combine the two.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:45 +00:00
Jonas Ådahl
7cf24ccc34 cogl/onscreen/egl: Move struct to C file
In praparation for declaring the EGL onscreen part using G_DECLARE*.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:45 +00:00
Jonas Ådahl
760a07cc24 cogl/onscreen/egl: Move pending_resize_notify to Xlib platform
It's only used in the Xlib onscreen, so move it there.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:45 +00:00
Jonas Ådahl
b24d5ce1dd cogl/winsys/egl: Move out onscreen code to own file
As a preparation turning it into its own type, move the code related to
CoglOnscreen to its own file.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:45 +00:00
Jonas Ådahl
d4dbcf3983 cogl/onscreen: Move fields from CoglOnscreen struct to private
This means we can now make CoglOnscreen derivable using GObject macros.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:44 +00:00
Jonas Ådahl
d0831cbbcd cogl: Move CoglOnscreen struct to C file
That means all sub types need to use helper methods, so make them do
that too.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:44 +00:00
Jonas Ådahl
6c4e01ea68 cogl: Fix license header in cogl-scanout and cogl-trace
As with cogl-graphene, the same mistake was made here.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1690>
2021-01-28 20:33:01 +00:00
Jonas Ådahl
c35335aad8 cogl/graphene: Fix license header
The intention was for these files to be licensed identically to the
other files in cogl, so fix this.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1690>
2021-01-28 20:33:01 +00:00
Jonas Ådahl
487ea0dd95 kms: Add symbolic page flips and cogl frame infos
This makes it possible to post a symbolic page flip and frame callback,
meant to be used by immediate symbolic page flip reply when emulating
cursor plane changes using legacy drmMode* functions.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1488>
2021-01-22 16:47:08 +00:00
Jonas Ådahl
1c20ba4c32 cogl/onscreen: Add way to manually add frame infos
We will soon need to use CoglOnscreen frame events communicate cursor
plane changes; this means we need to have a way to queue them without
going through any of the current APIs that can do so, i.e. the swap
buffer functions and direct scanout.

Add a function that just adds a frame info to the queue. The one who
adds it is responsible for emitting it too.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1488>
2021-01-22 16:47:08 +00:00
Jonas Ådahl
447c51e68e renderer-native: Always post device wide updates during mode set
Don't mode set each CRTC in separate KMS updates, as reconfiguring one
CRTC might cause other CRTCs to be implicitly reset thus as well,
causing KMS return EBUSY if using atomic modesetting.

Prepare for this by compositing each CRTC first including adding steps
to the KMS update, but wait until all views has rendered at least once
before posting the initial update. After this each CRTC is posted
separately.

Using EGLStreams instead of normal page flipping seems to fail when
doing this though, so handle that the old way for the EGLStream case,
i.e. eglSwapBuffers() -> mode set with dumb buffer -> eglStream
"acquire" (resulting in page flip under the hood).

For this we also introduce a new error code so that we don't use client
buffers when doing mode sets, which could accidentally configure the
CRTC in a way that is incompatible with the primary plane buffers.

Do the same also when we're in power save mode, to only have one special
case path for this scenario in the regular swap-buffer path.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1488>
2021-01-22 16:47:08 +00:00
Jonas Ådahl
249512b068 cogl/onscreen: Add opaque user_data pointer to onscreen present calls
This argument is intended to be used by clutter to be able to
communicate with the onscreen backend, that happens to be the native
backend. It will be used to pass a ClutterFrame pointer, where the
result of page flips, mode sets etc can be communicated whenever it is
available.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1488>
2021-01-22 16:47:08 +00:00
Daniel van Vugt
f0a9ec0519 cogl/journal: Invalidate framebuffer mipmaps on each journal insertion
Because the framebuffer itself might be backed by a texture, which might
have mipmapping enabled. If so then rendering to the framebuffer will make
those mipmaps out of date.

Technically we are flagging the framebuffer's mipmaps as dirty *before*
they are, because the journal hasn't been flushed yet. But we need to do
it early because ideally the next flush will both write the offscreen
framebuffer contents and then read them for use in rendering to an onscreen
framebuffer. And the `mipmaps_dirty` flag needs to be set before the read,
so therefore we need to do it before the next journal flush.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3146
where the offscreen framebuffer in question is meta-background's
`monitor->fbo`.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1664>
2021-01-08 15:51:09 +08:00
Jonas Ådahl
46ec29458d cogl/texture: Add a bit more debug logging
We fall back to slicing if the non-sliced allocation failed, but we
didn't log why. Also log why allocating a slice failed.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1648>
2020-12-18 16:19:05 +00:00
Jonas Ådahl
96842fc570 cogl/texture-2d-sliced: Don't double-free slice array when alloc failed
If texture allocation failed for a sliced 2D texture, the alloc()
function would free the slices immediately, but not clear the pointer to
the slices array. When the code attempting to allocate the texture then
freed the texture object, the cleanup functions tried to free the slices
array again, since it wasn't NULL.

Fix this by clearing the slices array after freeing it.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1580
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1648>
2020-12-18 16:19:05 +00:00
Georges Basile Stavracas Neto
d57bdb0b44 cogl/framebuffer: Add COGL_EXPORT to public function
An oversight of 038a3170bf.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1627>
2020-12-14 09:21:30 -03:00
Daniel van Vugt
a793b4eef5 cogl: Add new 'sync-{primitive,frame}' options for COGL_DEBUG
This allows profilers to trace the callers of whatever is spending the
most time on the GPU, and to measure render times more accurately.
Previously such information was hidden as it completed in the
background (asynchronously) after we call swap buffers.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1327>
2020-11-20 17:30:55 +00:00
Jonas Dreßler
4e63ed524e tests: Use ClutterStage "after-paint" instead of ClutterActor "paint"
The "paint" signal of ClutterActor is deprecated and will be removed. We
have a good replacement to get notified about stage paints nowadays,
that is "after-paint" on ClutterStage, so switch to that signal where it
makes sense.

I didn't bother to update the few tests (namely Clutters
conform/texture-fbo.c, conform/text-cache.c,
interactive/test-cogl-multitexture.c and Cogls
conform/test-multitexture.c, conform/test-texture-mipmaps.c) where it's
harder to replace the signal since we don't build those anyway.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1522
2020-10-23 22:06:58 +02:00
Uday Kiran Pichika
d504086ebf cogl: correcting the cogl trace log
Remove the extra & symbol appearing in cogl debug log

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1517
2020-10-21 12:10:16 +00:00
Daniel van Vugt
0501d3020e cogl-winsys-egl: Log the color depth in use
Enable it with environment `COGL_DEBUG=winsys`.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1387
2020-10-20 09:53:52 +00:00
Georges Basile Stavracas Neto
1f99395d20 clutter: Use graphene_matrix_inverse()
Instead of our own implementation that upscales, then downscales back,
use graphene_matrix_inverse() directly. This is possible after switching
to a z-near value that doesn't have problems with float precision.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1489
2020-10-16 13:37:44 -03:00
Jonas Ådahl
2aea404b14 cogl: Use memory management helpers more
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1496
2020-10-16 16:17:38 +00:00
Jonas Ådahl
88c830b9ab cogl/framebuffer: Move allocation and y-flip-ness to non-abstract types
Now that CoglFramebuffer is a GObject, we can start moving things to the
proper places.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1496
2020-10-16 16:17:38 +00:00
Jonas Ådahl
eb14da3874 cogl: Turn CoglFramebuffer, CoglOffscreen and CoglOnscreen into GObjects
A first step towards abandoning the CoglObject type system: convert
CoglFramebuffer, CoglOffscreen and CoglOnscreen into GObjects.
CoglFramebuffer is turned into an abstract GObject, while the two others
are currently final. The "winsys" and "platform" are still sprinkled
'void *' in the the non-abstract type instances however.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1496
2020-10-16 16:17:38 +00:00
Jonas Ådahl
ea2f4efaef cogl: Remove cogl_offscreen_new_to_texture()
It's no longer used, and has been deprecated for a long time.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1496
2020-10-16 16:17:38 +00:00
Jonas Ådahl
e7ac3e2715 cogl/framebuffer: Clean up cleanup function
Use cogl_clear_object() and g_clear_pointer() helpers.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1496
2020-10-16 16:17:38 +00:00
Jonas Ådahl
aa99e505ad cogl/framebuffer: Move public struct fields to private struct
This will limit accidental manipulation of the framebuffer struct
fields, while also paving the way to change to GObject type hierarchy.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1496
2020-10-16 16:17:38 +00:00
Jonas Ådahl
ffde1c0124 cogl/onscreen: Remove unused _cogl_onscreen_new()
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1496
2020-10-16 16:17:38 +00:00
Jonas Ådahl
209b78afd8 cogl/framebuffer/gl: Move OpenGL driver fields to private struct
It's driver specific, so it shouldn't be kept in the generic data
structure.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1496
2020-10-16 16:17:38 +00:00
Jonas Ådahl
e720ef1ceb cogl/framebuffer: Fix argument naming to blit_framebuffer()
The first argument is the framebuffer operated on, so in order to stay
consistest, rename 'src' to 'framebuffer'. The second is the
destination. The destination is commonly referred to as 'dst' elsewhere,
so rename 'dest' to 'dst'.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1496
2020-10-16 16:17:37 +00:00
Jonas Ådahl
4edcc21a5c cogl/framebuffer: Remove alignment of struct fields
They weren't all aligned anyway.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1496
2020-10-16 16:17:37 +00:00
Jonas Ådahl
e7b923289a cogl/framebuffer: Fix enum declaration coding style
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1496
2020-10-16 16:17:37 +00:00
Daniel van Vugt
df65f05e27 cogl: Remove unused swap-related COGL_FEATURE_ID_ flags
What we actually use is `COGL_WINSYS_FEATURE_SWAP_BUFFERS_EVENT`, which
is also set in the same locations.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1297
2020-10-14 16:27:23 +00:00
Georges Basile Stavracas Neto
b5749a8b27 Remove CoglMatrix
Adios, amiga.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
2020-10-06 15:34:48 +00:00
Georges Basile Stavracas Neto
090973e538 cogl/tests: Use graphene APIs
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
2020-10-06 15:34:48 +00:00
Georges Basile Stavracas Neto
182b51774e cogl: Use graphene APIs
These are the easy, trivial ones.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
2020-10-06 15:34:48 +00:00
Georges Basile Stavracas Neto
9e1004da0c cogl/matrix-stack: Use graphene APIs
This one is a bit tricky. The tl;dr; is that switching from right-hand
multiplication to left-hand multiplication required applying the stack
from left to root. This actually allowed simplifying the code a bit,
since CoglMatrixEntry only stores a pointer to its parent, and that's
all we need to know for left-hand multiplication.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
2020-10-06 15:34:48 +00:00
Georges Basile Stavracas Neto
d03ffe1e97 cogl/matrix-stack: Embed graphene matrices in entry structs
Instead of heap allocated graphene matrices, embed them into the
entries themselves. That makes the matrix magazine unused, and thus
also remove it.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
2020-10-06 15:34:48 +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
5b8c0dca68 cogl/matrix: Make CoglMatrix a typedef to graphene_matrix_t
After the previous commit, the only field in the CoglMatrix structure is
a graphene_matrix_t. That means that CoglMatrix is effectively a graphene
matrix now, and the CoglMatrix struct isn't that much useful anymore.

Remove the CoglMatrix structure and make the CoglMatrix type a typedef to
graphene_matrix_t.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
2020-10-06 15:34:47 +00:00
Georges Basile Stavracas Neto
eaa795a266 cogl/matrix: Remove cached inverse and flags
Remove the cached inverse, and dirty flags, and typedef CoglMatrix to
graphene_matrix_t itself. I preverved the type for this commit to help
reducing the commit size, next commits will remove the CoglMatrix type.

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
6c695ec39d cogl/matrix: Remove extra padding
We don't need to preserve ABI anymore.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
2020-10-06 15:34:47 +00:00
Georges Basile Stavracas Neto
1c41bfbcbb cogl/matrix: Update outdated documentation and comments
No direct access of matrix entries is allowed anymore; and we
use graphene_matrix_t internally.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
2020-10-06 15:34:47 +00:00
Georges Basile Stavracas Neto
1adc9c7c4a cogl/matrix: Update copyright headers
There's no trace of Mesa's matrix anymore.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
2020-10-06 15:34:47 +00:00
Georges Basile Stavracas Neto
70397c5e72 cogl/matrix: Use graphene_matrix_t internally
Instead of listing all matrix cells as floats, and the inverse
as a 16-length float array, use graphene_matrix_t in the structure
itself.

With this commit, all from/to CoglMatrix conversions are gone. It
is also not possible to initialize a CoglMatrix using the macro
anymore.

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
b878938de4 cogl/matrix: Cleanup flags and turn them into an enum
The only pair of flags we really care now is the DIRTY_INVERSE
and SINGULAR flags, used when computing the inverse.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
2020-10-06 15:34:47 +00:00
Georges Basile Stavracas Neto
947e538454 cogl/matrix: Remove unused defines
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
2020-10-06 15:34:47 +00:00
Georges Basile Stavracas Neto
7d7981e059 cogl/matrix: Remove matrix type
We can remove it since the most important type (identity) is now
detected through a simple graphene check.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
2020-10-06 15:34:47 +00:00
Georges Basile Stavracas Neto
a96f0d7537 cogl/matrix: Get value using graphene matrix
Internally, a graphene_matrix_t representing the same transform that
of a CoglMatrix is the same matrix but transposed, so in order to get
the same element given a column and row for a matrix as if it would
be located in Cogl, it is necessary to swap the row and column when
retrieving it from the graphene matrix.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
2020-10-06 15:34:47 +00:00
Georges Basile Stavracas Neto
45f3e15b63 cogl/matrix: Check identity using graphene matrices
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
2020-10-06 15:34:47 +00:00
Georges Basile Stavracas Neto
9b65f74eb8 cogl/matrix: Remove dead code
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
2020-10-06 15:34:47 +00:00
Georges Basile Stavracas Neto
ada5e67f7e cogl/matrix: Calculate inverse using graphene matrices
Turns out inverting a matrix was the largest chunk of the CoglMatrix
code. By switching to Graphene, a lot of it can go away. The inverse
is still cached in the CoglMatrix struct itself, to preserve the
optimization.

However, switching to graphene_matrix_t to calculate the inverse has
a challenge: float precision. We had to work around it here, and it
needs an explanation.

The way to detect whether a matrix is invertible or not (i.e.
whether it's not a "singular" matrix, or not) is by checking
if the determinant equals 0. So far, so good.

Both graphene_matrix_t and CoglMatrix use single-precision
floats to store their 4x4 matrices. Graphene uses vectorized
operations to optimize determinant calculation, while Cogl
tries to keep track of the matrix type and has special-purpose
determinant functions for different matrix types (the most
common one being a 3D matrix).

Cogl, however, has a fundamentally flawed check for whether
the matrix is invertible or not. Have a look:

```
float det;

…

if (det*det < 1e-25)
   return FALSE;
```

Notice that 1e-25 is *way* smaller than FLT_EPSILON. This
check is fundamentally flawed.

"In practice, what does it break?", the reader might ask.
Well, in this case, the answer is opposite of that: Cogl
inverts matrices that should not be invertible. Let's see
an example: the model-view-projection of a 4K monitor. It
looks like this:

```
| +0,002693 +0,000000 +0,000000 +0,000000 |
| +0,000000 -0,002693 +0,000000 +0,000000 |
| +0,000000 +0,000000 +0,002693 +0,000000 |
| -5,169809 +2,908017 -5,036834 +1,000000 |
```

The determinant of this matrix is -0.000000019530306557.
It evidently is smaller than FLT_EPSILON. In this situation,
Cogl would happily calculate the inverse matrix, whereas
Graphene (correctly) bails out and thinks it's a singular
matrix.

This commit works around that by exploiting the maths around
it. The basis of it is:

  inverse(scalar * M) = (1/scalar) * M'

which can be extrapolated to:

  inverse(M) = scalar * inverse(scalar * M) = M'

In other words, scaling the to-be-inversed matrix, then
scaling the inverse matrix by the same factor, gives us
the desired inverse. In this commit, the scale is calculated
as 1 / (smallest value in the diagonal).

I'm sorry for everyone that has to read through this :(

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
2020-10-06 15:34:47 +00:00
Georges Basile Stavracas Neto
cb733f8fbc cogl/matrix: Orthographic with graphene matrices
And remove all the custom matrix multiplication functions altogether.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
2020-10-06 15:34:47 +00:00
Georges Basile Stavracas Neto
b3318688f8 cogl/matrix: Don't debug-print inverse matrix
All multiplication functions need to go away eventually, and this is
the penultimate place we're ising the 4x4 multiplication function.

Remove it.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
2020-10-06 15:34:46 +00:00
Georges Basile Stavracas Neto
dd3c15a8a8 cogl/matrix: Euler-rotate with graphene matrices
Nothing outstanding here.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
2020-10-06 15:34:46 +00:00
Georges Basile Stavracas Neto
1f0e8fb23c cogl/tests: Remove euler test
Next commits, and this patchset in general, will make this patchset
obsolete, since it'll only test graphene types against each other.
If at all useful, the Euler test should be moved to graphene.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
2020-10-06 15:34:46 +00:00
Georges Basile Stavracas Neto
b1472a6015 cogl/matrix: Project and transpose using graphene matrices
Use dot products to simplify calculations. Because the 'w' column of
the matrix is always summed, use 1.f in the 'w' component of the point
vector.

Because CoglMatrix is column-major and graphene_matrix_t is row-major,
it is necessary to transpose the matrix before retrieving the rows.
When we switch CoglMatrix to be row-major, this transposition will
go away.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
2020-10-06 15:34:46 +00:00
Georges Basile Stavracas Neto
5d84f73aa0 cogl/matrix: Skew using graphene matrices
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
2020-10-06 15:34:46 +00:00
Georges Basile Stavracas Neto
3ea8af1489 cogl/matrix: Frustum with graphene matrices
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
2020-10-06 15:34:46 +00:00
Georges Basile Stavracas Neto
dad710adaa cogl/matrix: Transpose using graphene matrices
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
2020-10-06 15:34:46 +00:00
Georges Basile Stavracas Neto
0dbd6d3a80 cogl/matrix: Look-at using graphene matrices
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
2020-10-06 15:34:46 +00:00
Georges Basile Stavracas Neto
2b7a73e0c3 cogl/matrix: Compare using graphene matrices
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
2020-10-06 15:34:46 +00:00
Georges Basile Stavracas Neto
06db70ea28 cogl/matrix: Scale using graphene matrices
Boring.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
2020-10-06 15:34:46 +00:00
Georges Basile Stavracas Neto
ade28eeaf3 cogl/matrix: Rotate using graphene matrices
This is pretty similar to the other conversions, except we need to
store the matrix flags before operating on it, and update it using
this old value after. That's because cogl_matrix_init_from_array()
marks the matrix as entirely dirty, and we don't want that.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
2020-10-06 15:34:46 +00:00
Georges Basile Stavracas Neto
02a30f2a22 cogl/matrix: Multiply using graphene matrices
At this point, we are still only changing CoglMatrix APIs internally, and
it should still produce the same output as before.

To achieve this, using graphens matrix implementation, we need to exploit
some knowledge about conventions used in Cogl and graphene respectively.

In Cogl, transformation matrices are equivalent to those of affine
transformation matrices. The convention used by graphene, however, is to
operate on matrices that are transposed compared to their affine
counterparts.

So for example, let's say we want to multiply the affine matrices A and B,
to get C.

  A × B = C

The first step is to convert A and B to graphene matrices. We do this by
importing the floating point array, importing it directly using graphene.

Cogl exports its matrix to a column major floating point array. When we
import this in graphene, being row major, we end up with the same matrix,
only transposed.

Cogl       Graphene

  A   <===>   Aᵀ
  B   <===>   Bᵀ

We then multiply these imported matrices in reverse

  Bᵀ × Aᵀ

which in turn, due to ABᵀ = BᵀAᵀ, gives us

  Bᵀ × Aᵀ = (A × B)ᵀ

Our original goal was to find C, thus we know that

  A × B = C

That means we can shuffle things around a bit.

  A × B = C

  Bᵀ × Aᵀ = (A × B)ᵀ

  Bᵀ × Aᵀ = Cᵀ

With the same conversion as done when going from Cogl to graphene, only
the other way around, we still end up effectively transposing the matrix
during the conversion.

Graphene      Cogl

   Cᵀ  <===>   C

Thus when converting Cᵀ to Cogl, we in fact end up with C.

(Explanation authored by Jonas Ådahl)

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
2020-10-06 15:34:46 +00:00
Georges Basile Stavracas Neto
2b9ce99ff2 cogl/matrix: Translate using graphene
Add conversion helpers (from and to graphene_matrix_t), and replace
the translation code to use graphene matrices internally.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
2020-10-06 15:34:46 +00:00
Georges Basile Stavracas Neto
8e125fbab6 cogl/matrix: Add cogl_matrix_get_value
This will allow us stop accessing members of the structure
directly. Also mark all struct members as private.

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
566b081cd7 cogl/tests: Compare matrices using array
We'll remove direct access to CoglMatrix struct fields, so update
the test to not access them already.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
2020-10-06 15:34:46 +00:00
Georges Basile Stavracas Neto
eee2e331fd cogl/matrix: Add constant identity initializer
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
2020-10-06 15:34:46 +00:00
Georges Basile Stavracas Neto
a761caf079 cogl/matrix: Add cogl_matrix_init_from_matrix initializer
It does a simple memcpy() to clone the entire structure. This will
be necessary for a smoother removal of ClutterMatrix.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
2020-10-06 15:34:46 +00:00
Georges Basile Stavracas Neto
1a9f9b0164 cogl: Remove unused header
Not included nor used anywhere.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
2020-10-06 15:34:46 +00:00
Simon McVittie
8ae641aa24 cogl tests: Show the actual output from tests if VERBOSE is set
Writing tests' output to a log file makes them difficult to debug when
the test might be running on an autobuilder or CI system where only
stdout/stderr are recorded. This is particularly troublesome if a
failure is only reproducible on a particular autobuilder.

Recent Automake versions have the convention that detailed output from
failing tests is written to stdout/stderr, not just to log files, when
the VERBOSE environment variable is set; borrow that convention as a
trigger for producing detailed test output.

This was originally cogl!14, but applies equally to mutter's fork of cogl.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1273

Signed-off-by: Simon McVittie <smcv@debian.org>
2020-09-28 13:58:19 +00:00
Daniel van Vugt
647eec5f7f cogl: Flush specific framebuffers
This resolves a couple of FIXMEs. The FIXME comments were right in
stating that not *all* journals needed flushing, only the one we
are trying to put on screen needs flushing.

However we can't eliminate all flushes because the winsys swap calls
that follow go directly into OpenGL which knows nothing about cogl
journalling. So the journal *must* be flushed before the swap, to give
OpenGL the correct state.

P.S. If this turns out to cause any bugs then the next best answer is
to just remove the FIXME comments. Because flushing is still the right
thing to do.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1362
2020-09-18 11:59:52 +00: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
Jonas Ådahl
7d822459de cogl/renderer: Set error in dmabuf constructor fallback
When the CoglRenderer didn't set the DMA buffer constructor vfunc, we
return NULL. What we didn't do was set the error, meaning the caller
would crash if it tried to look up why DMA buffer construction failed.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1430
2020-09-14 16:03:17 +00:00
Georges Basile Stavracas Neto
21a21e7f68 cogl/scanout: Allow blitting to framebuffer
This will be used when screencasting monitors so that if
there's scanout in place, it'll still be possible to blit
it to a PipeWire-owned framebuffer, and stream it.

Add a new 'blit_to_framebuffer' vfunc to CoglScanout, and
implement it in MetaDrmBufferGbm.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1421
2020-09-01 13:05:24 -03:00
Robert Mader
1f557a502b cogl/context: Add API to create named pipelines
In certain situations it's desirable to keep pipelines around for
the whole lifetime of the session. In order to not leak them and
properly clean them up on shutdown, introduce a new mechanism to
create named pipelines that are bound to their correstponding
context and may be used across file boundries.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1372
2020-08-31 15:47:08 +00:00
Björn Daase
285f2a2124 cogl: Fix spelling of CoglPipelineStateComparator
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1410
2020-08-29 09:10:31 +00:00
Björn Daase
5ec9bde64f *: Fix spelling mistakes found by codespell
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1410
2020-08-29 09:10:31 +00:00
Jonas Ådahl
0d95f4d854 tests/clutter: Always use stage from backend
This removes all occurrences of creating a custom stage from the tests,
making them always use the one from MetaBackend. This will allow for
further cleanups.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1364
2020-08-13 17:51:56 +02:00
Jonas Ådahl
d857edf09c clutter: Remove support for transparent windows
We're only ever a compositor, so we're never asking to be transparent.
Thus remove support for requesting to paint to GLX or EGL displays with
an alpha channel.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1364
2020-08-13 14:45:10 +02:00
Jonas Ådahl
d6b5f89a1c cogl: Add API to check whether a format is supported by the driver
Will let us advertise what we actually support at runtime.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/804
2020-08-07 09:02:49 +00:00
Jonas Ådahl
6777a547ca cogl: Add 64 bit half-point pixel RGBA formats
In order to support the DRM formats DRM_FORMAT_ABGR16161616F and
friends, as well as the wl_shm formats WL_SHM_FORMAT_ABGR16161616F and
friends, cogl needs to have knowledge about said formats too.

We don't have a software implementation of the half point data types
however, so the pack/unpack methods remain unimplemented. We don't need
them for now, so it's not crucial that we add them.

For the GLES2 driver, currently only two formats are supported, and
since we don't currently have pack/unpack implementations, the other
formats will for now remain unsupported, until we have a half float
implementation.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/804
2020-08-07 09:02:48 +00:00
Jonas Ådahl
b191f89305 cogl/gles2: Add support for actual 10 bpc formats
Only for little-endian, depends on an extension, and needs unpack/pack
for many of the formats.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/804
2020-08-07 09:02:48 +00:00
Jonas Ådahl
2fc8841416 cogl: Add private feature flags for 10 bpc and 16 bpc formats
10 bpc are enabled for OpenGL and GLES 2 with the right extension. 16
bpc (half float) are enabled for OpenGL 3 and higher, and GLES 2 with
the right extension.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/804
2020-08-07 09:02:48 +00:00
Jonas Ådahl
598f536c51 cogl/bitmap-packing: Use hexadecimals for bit masks
It's easier to reason about what bits are 1 or 0 with e.g. 0x1f vs 0x3f
compared to 31 and 63.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/804
2020-08-07 09:02:48 +00:00
Daniel van Vugt
f3ad63e206 Remove unused flag COGL_WINSYS_FEATURE_SWAP_THROTTLE
This also removes an old comment about `wait_for_pending_flips` which
no longer exists.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1390
2020-08-04 08:43:57 +00:00
Olivier Fourdan
d0ee02fae7 cleanup: Remove duplicate semicolons in C code
No functional change, it just hurts my eyes when reading the code.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1385
2020-07-28 10:32:46 +02:00
Daniel van Vugt
3a474556b8 cogl-texture-2d: Flush the journal before mipmapping
In the case of indirect rendering like the first frame to use mutter's
background wallpaper:

  Texture_A -> FBO_B (Texture_B) -> FBO_C (screen)

we would be trying to render the contents of both FBO_B and FBO_C in
the same flush, before the contents of Texture_A had made it to FBO_B.
So when FBO_C wants to use mipmaps of Texture_B they didn't exist yet
and appeared all black. And the blackness would remain for subsequent
frames as cogl has now decided the mipmaps of FBO_B are no longer
"dirty" and don't need refreshing:

  FBO_B (Texture_B) (mipmaps_dirty==FALSE but black) -> FBO_C (screen)

We must flush FBO_B before referencing Texture_B for use in rendering
FBO_C. This only happens when Texture_A changes (e.g. when the user
changes their background wallpaper) so there's no ongoing performance
penalty from this flush.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1347
2020-07-07 16:15:24 +08:00
Jonas Ådahl
c00a8e98a3 clutter/cogl: Take over global frame count responsibility
The native backend had a plain counter, and the X11 backend used the
CoglOnscreen of the screen; change it into a plain counter in
ClutterStageCogl. This also moves the global frame count setting to the
frame info constuctor.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
2020-07-02 19:36:50 +02:00
Jonas Ådahl
2a6e8bda8d cogl/onscreen: Let swap buffer caller create frame info
We currently have mutter set a global frame counter on the frame info in
the native backend, but in order to do this from clutter, change the
frame info construction from being implicitly done so when swapping
buffers to having the caller create the frame info and passing that to
the swap buffers call.

While this commit doesn't introduce any other changes than the API, the
intention is later to have the caller be able to pass it's own state
(e.g. the global frame count) along with the frame info.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
2020-07-02 19:36:50 +02:00
Georges Basile Stavracas Neto
ae49f89cf3 clutter/stage: Remove color property
The property is deprecated and the current implementation simply
redirects it to ClutterActor::background-color, so remove it.

Also update the tests to set the background color directly.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1332
2020-06-27 13:35:46 +00:00
Georges Basile Stavracas Neto
ce3e293a18 clutter: Drop ClutterGroup
It is now unused.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1332
2020-06-27 13:35:46 +00:00
Georges Basile Stavracas Neto
d4953c77c3 clutter/actor: Remove clutter_actor_show_all
Actors are visible by default these days, and this function
is deprecated for a long time.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1332
2020-06-27 13:35:45 +00:00
Adam Jackson
1398c6dfa4 cogl: Remove some unused #define GL_BLAH safeties
None of these constants are referenced in the files defining them.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1194
2020-06-18 13:55:55 -04:00
Adam Jackson
ab9f241cc5 cogl: Remove some dead stores not flagged by the compiler
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1194
2020-06-18 13:55:55 -04:00
Adam Jackson
1f5d6a01f5 cogl: Remove unused driver includes
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1194
2020-06-18 13:55:55 -04:00
Adam Jackson
ca79073014 cogl: Move graphics reset status into the driver vtable
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1194
2020-06-18 13:55:55 -04:00
Adam Jackson
0b6f5c6f55 cogl: Move GL-specific uniform code to the driver vtable
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1194
2020-06-18 13:55:55 -04:00
Adam Jackson
e2c2a332e6 cogl: Add and use sampler init/free hooks in the CoglDriverVtable
next_fake_sampler_object_number moves to CoglGLContext.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1194
2020-06-18 13:55:55 -04:00
Adam Jackson
245977e525 cogl: Move texture unit state to CoglGLContext
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1194
2020-06-18 13:55:55 -04:00
Adam Jackson
e03c75bac7 cogl: Add a slot for driver-private state to CoglContext
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1194
2020-06-18 13:55:55 -04:00
Adam Jackson
4ff58cc63f cogl: Move some pre-layer-change-notify code into the driver
A CoglTextureUnit is a GL-specific type, this should happen in the
driver not the core.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1194
2020-06-18 13:55:55 -04:00
Adam Jackson
462df7e61a cogl: Move some GL-specific GLSL details into the driver
_cogl_shader_set_source_with_boilerplate and _cogl_shader_compile_real
have enough GL assumptions that it makes sense to push them into the
backend. Taken together their only callers are under driver/gl, so.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1194
2020-06-18 13:55:55 -04:00
Adam Jackson
1285619bcf cogl: Move GL context/version details into the driver
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1194
2020-06-18 13:55:55 -04:00