1
0
Fork 0
Commit graph

2801 commits

Author SHA1 Message Date
Bilal Elmoussaoui
138767fa7c cogl: Drop unnused functions
These functions ends-up calling gdk-pixbuf for loading textures/bitmaps
from a file and they don't seem to be used anywhere.

These changes are only useful with the following up commit.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3097>
2023-10-23 16:32:35 +00:00
Barnabás Pőcze
c58312e249 cogl/onscreen: Add missing error untrap calls
Every `mtk_x11_error_trap_push()` must be paired
with an `mtk_x11_error_trap_pop[_with_return]()` call
otherwise all future errors will be caught and ignored
even if they shouldn't be.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3328>
2023-10-16 15:27:14 +02:00
Ivan Molodetskikh
6cfdbef3c2 cogl/trace: Correct dummy define name
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3317>
2023-10-09 11:13:10 +04:00
Ivan Molodetskikh
ad3c40cbd0 cogl: Replace HAVE_TRACING with COGL_HAS_TRACING
The former was only used in the .c file, everything else uses the latter.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3313>
2023-10-06 08:38:54 +04:00
Robert Mader
15320b5a66 cogl/pixel-format: Add G16 and RG1616 pixel formats
They are needed as "subformats" for higher bit YCbCr formats, such as
P010, and we don't plan to use or expose them otherwise. Thus don't
implement any conversion or packing features.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3244>
2023-09-13 14:11:27 +02:00
Robert Mader
4c5b2e0e48 cogl: More explicitly mark formats as not supported
To ensure they don't get used by accident.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3244>
2023-09-13 14:11:27 +02:00
Daniel van Vugt
3f7c1be59a cogl: Remember to bind the GLX context to our drawable before querying
Or else `glXQueryDrawable` will fail per the `GLX_EXT_buffer_age` spec:

> If querying GLX_BACK_BUFFER_AGE_EXT and <draw> is not bound to
> the calling thread's current context a GLXBadDrawable error is
> generated.

This mistake went unnoticed until `mtk_x11_error_trap_push` was introduced
(55e3b2e519) because for some reason it is incapable of trapping
`glXQueryDrawable`. Prior to that it seems
`cogl_onscreen_glx_get_buffer_age` would trap and so always returned zero.

This means we're reenabling clipped redraws on X11 here for the first
time in a long time.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3007
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3255>
2023-09-12 13:14:27 +00:00
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