1
0
Fork 0
Commit graph

3081 commits

Author SHA1 Message Date
Ivan Molodetskikh
03252fefa3 cogl/journal: Add trace span to flush
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3417>
2023-12-06 16:12:58 +00:00
Jonas Ådahl
05efc92084 cogl/pipeline/glsl: Add line numbers to displayed source
When running with COGL_DEBUG=show-source include line numbers so that it
becomes easier to understand compilation errors.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3443>
2023-12-06 13:45:03 +00:00
Sebastian Wick
7f943613a8 cogl: Use sized internal renderable formats
Using sized internal formats is required to make sure we actually get
the precision that we want.

The formats should also be renderable, otherwise they can not be used as
a framebuffer attachment. For GLES we have to check for a bunch of
extensions and fall back to internal formats with more bits when they
are not available.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3429>
2023-12-05 08:47:11 +00:00
Sebastian Wick
bbf2d83e94 cogl/gles: Require OES_rgb8_rgba8 to have color-renderable 8bpc formats
In GLES 2.0 the required color-renderable formats to support to not
include 8bpc RGB/RGBA formats. The extension adds this requirement and
makes GLES 2.0 actually useable. Not specifying a gl internal format in
Cogl so far has hidden the problem and let the implementation fall back
to RGB585 for example.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3429>
2023-12-05 08:47:11 +00:00
Sebastian Wick
f77d95c9ae cogl: Make FP16 and RGBA1010102 public features
Also be more strict about what we consider RGBA1010102 support. Before
GLES 3.0, using ReadPixels on a framebuffers with format RGB10_A2 was
not possible with type GL_UNSIGNED_INT_2_10_10_10_REV_EXT and thus our
code to read back pixels could fail.

Users of cogl should check those feature flags before using FP16 and
RGBA1010102 pixel formats via CoglFeatureIDs:
 * COGL_FEATURE_ID_TEXTURE_RGBA1010102
 * COGL_FEATURE_ID_TEXTURE_HALF_FLOAT

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3429>
2023-12-05 08:47:11 +00:00
Sebastian Wick
5d0fc6d8c1 cogl: Remove unused COGL_PIXEL_FORMAT_DEPTH_32
It's not depth-renderable or required to be supported and we don't use
it anyway, so just get rid of it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3429>
2023-12-05 08:47:11 +00:00
Qiu Wenbo
48515d917c cogl: Fix memory allocation of CoglGLContext
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3440>
2023-12-04 16:54:05 +08:00
Bilal Elmoussaoui
46da153548 cogl: Various g-i fixes
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3431>
2023-11-29 12:07:36 +01:00
Bilal Elmoussaoui
79846ff263 cogl: Remove no longer needed build check
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3431>
2023-11-29 12:00:07 +01:00
Bilal Elmoussaoui
85e4d08475 cogl: Remove unused utils
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3431>
2023-11-29 11:53:03 +01:00
Daniel van Vugt
1c2decbeb5 cogl/egl: Don't log "EGL color depth" anymore
Since e437c854cd `config` no longer represents the current config
but rather the fallback config that in most cases isn't being used. So
reporting on its attributes is now misleading.

Logging the current depth can instead now be done with MUTTER_DEBUG=kms
and grepping for "KMS: Using GBM format".

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3174
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3421>
2023-11-27 14:12:38 +00:00
Michel Dänzer
e1f795ff79 onscreen/native: Add and use choose_onscreen_egl_config helper
If the EGL_KHR_no_config_context extension is supported, use it to
choose a format per onscreen which is compatible with the scanout CRTC
and the GL rendering API used.

Suggested by Jonas Ådahl.

v2:
* Drop code which checked for GLES3 renderability. Makes no sense for
  various reasons, in particular that EGLconfigs are about EGLSurfaces,
  whereas secondary GPU contexts use an FBO for blitting.
* Use error parameter directly for meta_renderer_native_choose_gbm_format
  call (Jonas Ådahl)

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3139>
2023-11-23 20:11:31 +00:00
Michel Dänzer
e437c854cd cogl/egl: Add COGL_EGL_WINSYS_FEATURE_NO_CONFIG_CONTEXT
If the EGL_KHR_no_config_context extension is supported, pass
EGL_NO_CONFIG_KHR to eglCreateContext. This will allow binding the
context to surfaces created with different configs.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3139>
2023-11-23 20:11:30 +00:00
Michel Dänzer
dc57aa6d97 cogl/egl: Fix coding style of CoglEGLWinsysFeature definition
To prevent the check-style.py script from complaining about the next
commit.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3139>
2023-11-23 20:11:30 +00:00
Ivan Molodetskikh
2d1fc65b3a Adjust COGL_TRACE names to improve automatic processing
In profilers with a timeline or flame graph views it is a very common
scenario that a span name must be displayed in an area too short to fit
it. In this case, profilers may implement automatic shortening to show
the most important part of the span name in the available area. This
makes it easier to tell what's going on without having to zoom all the
way in.

The current trace span names in Mutter don't really follow any system
and cannot really be shortened automatically.

The Tracy profiler shortens with C++ in mind. Consider an example C++
name:

SomeNamespace::SomeClass::some_method(args)

The method name is the most important part, and the arguments with the
class name will be cut if necessary in the order of importance.

This logic makes sence for other languages too, like Rust. I can see it
being implemented in other profilers like Sysprof, since it's generally
useful.

Hence, this commit adjusts our trace names to look like C++ and arrange
the parts of the name in the respective order of importance.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3402>
2023-11-22 11:46:07 +00:00
Ivan Molodetskikh
77bbe44251 cogl/trace: Remove unused cogl_is_tracing () declaration
Introduced in ab39eaf131 but never
defined.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3409>
2023-11-20 12:29:37 +00:00
Bilal Elmoussaoui
1ce1745384 cogl: Remove duplicated build options check
Meson already has a check for ensuring that either GL or GLES 2 is
enabled
at build time

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3405>
2023-11-17 11:24:23 +00:00
Bilal Elmoussaoui
c632e29ec0 cogl: Don't use a separate file for egl defines
The file doesn't do anything special to require a special header

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3405>
2023-11-17 11:24:23 +00:00
Bilal Elmoussaoui
a8f77750fd cogl: Stop auto generating gl/egl headers
They contain nothing that requires generating those headers
automatically
so simplify the whole thing

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3405>
2023-11-17 11:24:23 +00:00
Bilal Elmoussaoui
f081d4b595 cogl: Remove unused files
Fallout of https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3368

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3405>
2023-11-17 11:24:23 +00:00
Ivan Molodetskikh
47814fab71 Remove COGL_TRACE_BEGIN in favor of BEGIN_SCOPED
Scoped traces are less error prone, and they can still be ended
prematurely if needed (this commit makes that work). The only case this
doesn't support is starting a trace inside a scope but ending outside,
but this is pretty unusual, plus we have anchored traces for a limited
variation of that.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3396>
2023-11-15 13:57:43 +00:00
Bilal Elmoussaoui
f5dac3a5d9 build: One config file to rule them all
Group all the three config files from clutter/cogl/meta into one
and also remove unnused configurations and replace duplicated ones

This also fixes Cogl usage of HAS_X11/HAS_XLIB to match the expected
build options

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3368>
2023-11-15 12:00:19 +00:00
Ivan Molodetskikh
ebba651c81 cogl/trace: Add check for failed sysprof context creation
This can fail for example when passing an invalid filename to
mutter --profile, which leads to assertion failures down the line.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3397>
2023-11-15 11:46:19 +00:00
Bilal Elmoussaoui
5fe3d13db5 cogl/pango: Drop no longer useful file
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3374>
2023-11-09 15:16:16 +00:00
Bilal Elmoussaoui
bb3de27621 cogl/cleanup: Drop unnused private structs
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3374>
2023-11-09 15:16:16 +00:00
Sebastian Keller
61de313198 cogl: Unconditionally free pipeline shader/program state cache struct
destroy_shader_state()/destroy_program_state() are called when the qdata
pointer to the state cache structure gets overwritten, but were only
conditionally destroying it. This lead to leaks when called with a
shader/program state ref count > 1.

Fixes: 9b9e12edb ("cogl: Port Node/Pipeline/PipelineLayer away from CoglObject")
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3141
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3366>
2023-11-07 10:15:57 +00:00
Sebastian Wick
5dbb6c31e9 cogl: Rename COGL_PIXEL_FORMAT_G_16 with COGL_PIXEL_FORMAT_R_16
Mechanical rename. The format already describes the first two (rg/xy)
components.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3276>
2023-11-04 00:11:52 +00:00
Sebastian Wick
764d5dd67b cogl: Rename COGL_PIXEL_FORMAT_G_8 with COGL_PIXEL_FORMAT_R_8
Mechanical rename. The format already describes the first (r/x)
component.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3276>
2023-11-04 00:11:52 +00:00
Bilal Elmoussaoui
51abbb5d4f cogl: Remove unnused include macro usage
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3349>
2023-11-03 11:36:07 +00:00
Bilal Elmoussaoui
7a6a821ed0 cogl: Drop unnused experimental API config
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3349>
2023-11-03 11:36:07 +00:00
Bilal Elmoussaoui
655b4a9c75 Port to MtkRegion
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3292>
2023-11-03 11:27:52 +00:00
Bilal Elmoussaoui
c01ffdb8ba cogl/gir: Depend explicitly on Mtk
As it is used now for MtkRegion types making the GIR file not containing
the relevant dependency and not being able to resolve MtkRegion type

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3292>
2023-11-03 11:27:52 +00:00
Bilal Elmoussaoui
ac2f6e8b9e cogl: Reduce the usage of _COGL_GET_CONTEXT
In cases where we already have the context where the function ends up
being called

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3353>
2023-11-02 15:17:49 +00:00
Bilal Elmoussaoui
2c4968fb41 cogl: Port Primitive away from CoglObject
- The associated CoglAttribute's are now stored in GPtrArray as suggested
by carlosg in
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3193?commit_id=19b619073b3c7d311c64e0a997558f943b38c94a#note_1849281
- cogl_primitive_set_attributes was dropped for "simplicity"
especially that nothing uses it.
- As this is the last remaining CoglObject subclass, the commit also drops
all the CoglObject related macros/types

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3193>
2023-10-29 21:16:24 +00:00
Bilal Elmoussaoui
b4bd69e4e8 cogl/cleanup: Replace CoglUserDataDestroyCallback with GDestroyNotify
It is just a typedef

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3193>
2023-10-29 21:16:24 +00:00
Bilal Elmoussaoui
b044e26e62 cogl: Drop no longer used user data helpers
This also drops the test-object conform test as it doesn't do anything
interesting and the gobject qdata functionnality is already well tested
across the platform

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3193>
2023-10-29 21:16:24 +00:00
Bilal Elmoussaoui
9b9e12edb2 cogl: Port Node/Pipeline/PipelineLayer away from CoglObject
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3193>
2023-10-29 21:16:24 +00:00
Bilal Elmoussaoui
80ce052a47 cogl/node: Stop taking a custom unparent function
As all the use cases end up chaining up anyways

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3193>
2023-10-29 21:16:24 +00:00
Bilal Elmoussaoui
6efd4a2282 cogl/cleanup: Use construct-only properties for CoglBuffer
Instead of a custom initialize function

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3193>
2023-10-29 21:16:24 +00:00
Bilal Elmoussaoui
739c59fefc cogl: Port Buffer* away from CoglObject
Make CoglBuffer an abstract class and inherit the various Cogl*Buffer types from it.
As none of the subclasses is overriding the vtable functions, they were not turned into
vfuncs but plain function pointers in CoglBuffer.
We still use _cogl_buffer_initialize until we port the various params into actual construct-only
properties, similar to the previous commit for CoglTexture.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3193>
2023-10-29 21:16:24 +00:00
Bilal Elmoussaoui
1d47e809e4 cogl/cleanup: Use construct-only properties instead of a custom init function
It only made sense pre-GObjectified Texture types

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3193>
2023-10-29 21:16:24 +00:00
Bilal Elmoussaoui
863163cc6e cogl: Port Texture* away from CoglObject
- Make Texture a parent GObject class and move the vtable funcs as vfuncs
instead of an interface as we would like to have dispose free the TextureLoader.
- Make the various texture sub-types inherit from it.
- Make all the sub-types constructors return a CoglTexture instead of their respective
specific type. As most of the times, the used functions accept a CoglTexture,
like all the GTK widgets constructors returning GtkWidget.
- Fix up the basics of gi-docgen for all these types.
- Remove CoglPrimitiveTexture as it is useless: It is just a texture underhood.
- Remove CoglMetaTexture: for the exact same reason as above.
- Switch various memory management functions to use g_ variant instead of the cogl_ one

Note we would still want to get rid of the _cogl_texture_init which is something
for the next commit

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3193>
2023-10-29 21:16:24 +00:00
Bilal Elmoussaoui
586c43d5a9 clutter/cogl: Use more of memory management helpers
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3193>
2023-10-29 21:16:24 +00:00
Bilal Elmoussaoui
75023d96bc cogl: Port Renderer away from CoglObject
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3193>
2023-10-29 21:16:24 +00:00
Bilal Elmoussaoui
4792db371a cogl/cleanup: Stop using CoglHandle
We use a GParamSpecPointer for CoglPipeline until that
gets ported from CoglObject

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3193>
2023-10-29 21:16:24 +00:00
Bilal Elmoussaoui
c8b4568973 cogl: Drop no longer used define boxed macro
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3193>
2023-10-29 21:16:24 +00:00
Bilal Elmoussaoui
93216b3c11 cogl: Port MatrixEntry from Cogl boxed type
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3193>
2023-10-29 21:16:24 +00:00
Bilal Elmoussaoui
686081077a cogl: Port Journal away from CoglObject
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3193>
2023-10-29 21:16:24 +00:00
Bilal Elmoussaoui
82ca43c3b6 cogl: Port (OnscreenDirtyClosure|FrameClosure) away from Cogl boxed type
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3193>
2023-10-29 21:16:24 +00:00
Bilal Elmoussaoui
60dbceac4f cogl/object: Drop no longer used Handle macros
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3193>
2023-10-29 21:16:24 +00:00
Bilal Elmoussaoui
bbdc0b42fc cogl: Port Program away from CoglObject
This also switches from using CoglHandle to CoglProgram where
appropriate
which allowed dropping a duplicated function that had the wrong
signature...

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3193>
2023-10-29 21:16:24 +00:00
Bilal Elmoussaoui
3aaae11d6b cogl: Port Shader away from CoglObject
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3193>
2023-10-29 21:16:24 +00:00
Bilal Elmoussaoui
c1e6948e42 cogl: Port Bitmap away from CoglObject
We still need to use set_qdata_full as CoglBitmapPixbuf would free
the data itself by unrefing the pixbuf

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3193>
2023-10-29 21:16:24 +00:00
Bilal Elmoussaoui
3c6c6a0ea5 cogl: Port Output away from CoglObject
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3193>
2023-10-29 21:16:24 +00:00
Bilal Elmoussaoui
946b6c945a cogl: Port Color to GBoxed
Also removes a part of the docs in the private structure as it ends up
being detected as the docs for the public structure causing conflict

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3193>
2023-10-29 21:16:24 +00:00
Bilal Elmoussaoui
4afc187062 cogl: Port MatrixStack away from CoglObject
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3193>
2023-10-29 21:16:24 +00:00
Bilal Elmoussaoui
d71fe5c55e cogl: Port OnscreenTemplate away from CoglObject
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3193>
2023-10-29 21:16:24 +00:00
Bilal Elmoussaoui
df8ae83040 cogl: Port Indices away from CoglObject
Also renames Indices.get_type to Indices.get_indices_type to avoid
a conflict with the generated Object.get_type function

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3193>
2023-10-29 21:16:24 +00:00
Bilal Elmoussaoui
4ea3593ebf cogl: Port Atlas away from CoglObject
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3193>
2023-10-29 21:16:24 +00:00
Bilal Elmoussaoui
f0923aab44 cogl: Port Attribute away from CoglObject
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3193>
2023-10-29 21:16:24 +00:00
Bilal Elmoussaoui
9d71949b26 cogl: Port SwapChain away from CoglObject
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3193>
2023-10-29 21:16:24 +00:00
Bilal Elmoussaoui
312d5c367e cogl: Port Snippet away from CoglObject
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3193>
2023-10-29 21:16:24 +00:00
Bilal Elmoussaoui
1da42dc3c0 cogl: Port Context away from CoglObject
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3193>
2023-10-29 21:16:24 +00:00
Bilal Elmoussaoui
0f54700101 cogl: Port Display away from CoglObject
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3193>
2023-10-29 21:16:24 +00:00
Bilal Elmoussaoui
748c1fb9f4 cogl: Port FrameInfo away from CoglObject
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3193>
2023-10-29 21:16:24 +00:00
Robert Mader
de8f69c787 cogl: Clean up HAVE_COGL_GL(ES2) checks
These were leftovers from times when GL(ES) 1.x was still supported.
As we require HAVE_COGL_GL and/or HAVE_COGL_GLES2 to be defined, all
cases for checking both are now redundant.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3338>
2023-10-27 16:13:37 +00:00
Robert Mader
81c6269ca7 cogl/driver/gl: Clean up pre-3.1 checks
They were just leftovers from times when we didn't require a 3.1
context.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3338>
2023-10-27 16:13:37 +00:00
Robert Mader
898044b9a5 cogl/driver: Remove pixel_format_from_gl_internal
It's unused.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3338>
2023-10-27 16:13:37 +00:00
Robert Mader
26c3686162 cogl: Remove some unused files
Note that the .gitignore may prevented other files from being removed in
older checkouts.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3338>
2023-10-27 16:13:37 +00:00
Michel Dänzer
e3749ac871 Remove unused _cogl_texture_2d_nop_* functions
Never used in mutter AFAICT.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3178>
2023-10-26 09:49:29 +00:00
Michel Dänzer
3f0184982d Remove unused _cogl_poll_renderer_remove_source
Never used in mutter AFAICT.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3178>
2023-10-26 09:49:29 +00:00
Michel Dänzer
e803e7718d Remove unused _cogl_poll_renderer_modify_fd
Unused since 865da1457a ("renderer: drop wayland client support").

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3178>
2023-10-26 09:49:29 +00:00
Michel Dänzer
8511041c9e Remove unused _cogl_pipeline_get_layer_min/mag_filter
Unused since 9b16b74b5d ("cogl: Remove unused stuff from
cogl-material-compat.[ch]").

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3178>
2023-10-26 09:49:29 +00:00
Michel Dänzer
0363f68561 Remove unused _cogl_memory_stack_rewind
Never used in mutter AFAICT.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3178>
2023-10-26 09:49:29 +00:00
Michel Dänzer
935cb48f71 Remove unused _cogl_framebuffer_get_winsys
Unused since 4f3b57c841 ("cogl/onscreen: Move buffer age getter vfunc
to class").

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3178>
2023-10-26 09:49:29 +00:00
Michel Dänzer
600bcca747 Remove unused _cogl_pipeline_has_fragment_snippets
Unused since 8f58ad02fb ("cogl: Remove fixed pipeline support").

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3178>
2023-10-26 09:49:28 +00:00
Bilal Elmoussaoui
98bd2aa2c2 clutter: Move cairo pixel format to cogl
As Cogl already defines a pixel format enum, it makes sense to move such
endian dependant pixel format there

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3086>
2023-10-25 20:03:08 +00:00
Bilal Elmoussaoui
7bd4e18231 cogl/cleanup: Drop no longer used CoglAngle
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3288>
2023-10-25 19:06:47 +00:00
Bilal Elmoussaoui
b78951ad09 cogl: Drop can_convert_in_place from TextureLoader
As nothing really sets it (see previous commits)

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3097>
2023-10-23 16:32:35 +00:00
Bilal Elmoussaoui
d492dc7687 cogl: Drop various private constructors
They are only useful for passing a different value for convert_in_place
but none of these are used

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3097>
2023-10-23 16:32:35 +00:00
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
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