Commit Graph

2667 Commits

Author SHA1 Message Date
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