1
0
Fork 0
Commit graph

20 commits

Author SHA1 Message Date
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
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
Carlos Garnacho
a5294ce55f cogl: Remove CoglPath and the tesselator
This was barely used, and doesn't represent the way we want to
do 2D rendering.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1126
2020-04-08 11:38:48 +02:00
Jonas Ådahl
4b5abdc988 cogl/tests: Remove test-materials
It wasn't compiled, nor ported to the new test suite, and tests
deprecated functionality that are being removed. Lets drop it.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
2019-12-03 19:02:14 +00:00
Jonas Ådahl
e8e5ccf82d cogl/tests: Remove test-fixed
It was a non-built non-ported test case for removed code.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
2019-12-03 19:02:14 +00:00
Jonas Ådahl
98c0fe934b cogl: Remove CoglVertexBuffer
It was deprecated, relied on deprecated API (implicit framebuffers,
mateiarls etc), and was unused. Lets remove it.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
2019-12-03 19:02:14 +00:00
Adam Jackson
13fd213064 cogl: Remove unported test-vertex-buffer-mutability
https://gitlab.gnome.org/GNOME/mutter/merge_requests/933
2019-11-20 11:59:15 -05:00
Georges Basile Stavracas Neto
16875340cb Remove CoglQuaternion
This is unused API, and there are no plans to actually
use it. Even if we want to use it in the future, we'll
be fully Graphene and won't need this API anyway.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/458
2019-10-16 11:38:13 +00:00
Adam Jackson
7e8a864992 cogl: Remove unused cogl-gles2 API
This was introduced in:

    commit 010d16f647
    Author: Robert Bragg <robert@linux.intel.com>
    Date:   Tue Mar 6 03:21:30 2012 +0000

        Adds initial GLES2 integration support

        This makes it possible to integrate existing GLES2 code with
        applications using Cogl as the rendering api.

That's maybe a reasonable thing for a standalone cogl to want, but our
cogl has only one consumer. So if we want additional rendering out of
our cogl layer, it makes more sense to just add that to cogl rather than
support clutter or mutter or the javascript bindings creating their own
GLES contexts.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/500
2019-08-16 06:35:35 +00:00
Marco Trevisan (Treviño)
81ae886dda cogl/tests: Use less verbose run-tests.sh on single tests run by meson
Use less verbose output when run-tests.sh is running only a test and we're
requested for less verbose output.

Also write the test name first of running it.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/442
2019-05-02 19:56:23 +00:00
Marco Trevisan (Treviño)
34312c272b cogl/tests: Run conform tests as single meson tests
Use find-conform-unit-tests.sh to create a meson list of tests to run.
This allows to run each test as single test with meson and to remove the timeout
for all the tests.

Instead of changing 'run-tests.sh' to take test-names as arguments we can just
generate simple dummy test-files for each test, without having to change the
tooling.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/442
2019-05-02 19:56:23 +00:00
Marco Trevisan (Treviño)
a934fa07b8 tests: Use suites for test cases
They allows to filter tests better and so we can just launch tests with:
  meson test --suite [core|cogl|clutter] [single-test-name]

https://gitlab.gnome.org/GNOME/mutter/merge_requests/442
2019-05-02 19:56:23 +00:00
Adam Jackson
ce6acf9dca cogl: Remove rectangle-texture tests
https://gitlab.gnome.org/GNOME/mutter/merge_requests/546
2019-04-18 12:53:12 -04:00
Adam Jackson
28954e8271 cogl: Remove unused 3D texture support
We're not using this, and it's difficult to imagine we ever would.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/487
2019-04-18 01:26:32 +00:00
Adam Jackson
a94841abf1 cogl: Remove color write masks from the framebuffer and pipeline API
The only thing using this is its own tests, and it's difficult to
imagine a real use for it.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/468
2019-04-17 19:57:14 +00:00
Marco Trevisan (Treviño)
3838341d83 meson: Set cogl as dependency of libmutter-cogl dependency
Since a libmutter-cogl dependency is declared as libmutter_cogl_dep, it can be
used to avoid repeating cogl dependency everywhere.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/3955
2019-01-23 13:03:40 +00:00
Georges Basile Stavracas Neto
ebb6c56f67
Add Meson support for installed tests
This is the last remaining feature necessary to achieve
parity with the Autotools build.

A few changes were made to the install locations of the
tests, in order to better acomodate them in Meson:

 * Tests are now installed under a versioned folder (e.g.
   /usr/share/installed-tests/mutter-4)

 * The mutter-cogl.test file is now generated from an .in
   file, instead of a series of $(echo)s from within Makefile.

Notice that those tests need very controlled environments
to run correctly. Mutter installed tests, for example, will
failed when running under a regular session due to D-Bus
failing to acquire the ScreenCast and/or RemoteScreen names.
2018-12-20 13:52:35 -02:00
Jonas Ådahl
5b3e439c5d cogl/tests: Increase the conform test timeout to 120 s
Running it on CI runners can take bit more time, so let it be for a bit
more until bailing out.
2018-11-14 15:55:45 +01:00
Georges Basile Stavracas Neto
d1c4c46281
build: Prefer dependencies instead of link_with
Meson uses the 'dependencies' field to determine and
parallelize build steps, but that isn't entirely true
with 'link_with'; this might cause a race condition
when generating header files while trying to build
them.

Fix that by only using 'dependencies' instead of 'link_with'.
2018-11-06 17:50:24 -02:00
Jonas Ådahl
ef85d1a643 Add meson build support
This commit adds meson build support to mutter. It takes a step away
from the three separate code bases with three different autotools setups
into a single meson build system. There are still places that can be
unified better, for example by removing various "config.h" style files
from cogl and clutter, centralizing debug C flags and other configurable
macros, and similar artifacts that are there only because they were once
separate code bases.

There are some differences between the autotools setup and the new
meson. Here are a few:

The meson setup doesn't generate wrapper scripts for various cogl and
clutter test cases. What these tests did was more or less generate a
tiny script that called an executable with a test name as the argument.
To run particular tests, just run the test executable with the name of
the test as the argument.

The meson setup doesn't install test files anymore. The autotools test
suite was designed towards working with installed tests, but it didn't
really still, and now with meson, it doesn't install anything at all,
but instead makes sure that everything runs with the uninstalled input
files, binaries and libraries when running the test suite. Installable
tests may come later.

Tests from cogl, clutter and mutter are run on 'meson test'. In
autotools, only cogl and clutter tests were run on 'make check'.
2018-11-06 18:51:44 +01:00