1
0
Fork 0
Commit graph

3079 commits

Author SHA1 Message Date
Robert Mader
52c4b85161 cogl: Turn CoglScanout into an object
We need an object to hold additional scanout related information, such
as scaling and positioning data. Turn CoglScanout into such an object,
moving the interface into CoglScanoutBuffer.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3177>
2024-02-10 17:41:12 +00:00
Daniel van Vugt
c43f57f757 cogl/onscreen/glx: Fix x/y mixup used to identify the current output
I haven't seen this cause a problem but it looks like the worst case is
that it would have put the wrong refresh rate value in CoglFrameInfo
for multi-monitor systems of differing frequencies. But even that seems
unlikely given `_cogl_xlib_renderer_output_for_rectangle` chooses the
output with the greatest overlap of the partially-correct rectangle.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3569>
2024-02-08 18:03:03 +08:00
Robert Mader
03c3b642bd cogl: Move CoglScanout declarations from onscreen to types
While closely related, types appears to be the more appropriate place
these days.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3559>
2024-02-02 17:40:37 +01:00
Bilal Elmoussaoui
f0ebc41205 cogl: Move cairo dependency to cogl-pango
As cairo is not used in cogl API

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3530>
2024-01-27 10:03:15 +00:00
Bilal Elmoussaoui
a55b080129 gir: Remove unnused cairo include
As cairo is not used in the public API

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3530>
2024-01-27 10:03:15 +00:00
Sebastian Wick
41a7e8e3e0 build: Make g-ir-scanner warnings fatal when -werror is set
This should help catching problems with introspection in CI.

This also pulls out some common arguments to the gnome.generate_gir
call.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3528>
2024-01-17 09:26:00 +00:00
Sebastian Wick
db492fe335 cogl: Use COGL_ENABLE_DEBUG instead of COGL_DEBUG_ENABLED
COGL_DEBUG_ENABLED is a macro to check if a debug flag is set.
COGL_ENABLE_DEBUG is set by the build system if it's a debug build. The
check `#ifdef COGL_DEBUG_ENABLED` always evaluates to true. Use the
appropriate macro to guard some debugging code.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3446>
2024-01-15 22:28:54 +00:00
Sebastian Wick
6749151ac9 cogl/pipeline: Use the pipeline context instead of the default context
In practise they are the same right now but this prepares CoglPipeline
for a future where we have multiple contexts.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3446>
2024-01-15 22:28:54 +00:00
Sebastian Wick
a9944b27aa cogl/pipeline: Refactor pipeline initialization
Make it a bit easier to follow the construction process and rely on
GObjects zero-initialization in more places.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3446>
2024-01-15 22:28:54 +00:00
Corentin Noël
cb03b46a20 cogl/onscreen: Add several introspection annotations
Only an unowned closure is returned by the add_*_callback methods as the object
itself owns the closure.

Add array annotation when taking an array of integers.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3516>
2024-01-12 15:04:30 +00:00
Robert Mader
5ffeb34251 build: Enable no-omit-frame-pointer for all non-plain builds
This is useful for local installations with e.g. the `release`
buildtype.
Further more, Fedora has been doing the same system wide and it
apparently was helpful in various ways, see also

Also add -mno-omit-leaf-frame-pointer, like Fedora.

https://blogs.gnome.org/chergert/2023/10/03/what-have-frame-pointers-given-us-anyway/

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3333>
2024-01-09 16:26:57 +00:00
Robert Mader
ee65ca791b build: Harmonize c_args handling
The slightly different styles in the different build files make it
harder to reason about or share c_args.

This notably ensures we never set any extra c_args for plain builds and
fixes the cc.get_supported_arguments() check in Cogl, Clutter and Mtk.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3333>
2024-01-09 16:26:57 +00:00
Bilal Elmoussaoui
346e9a7f2c docs: Remove remaining SECTIONs
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3489>
2024-01-09 15:23:04 +00:00
Bilal Elmoussaoui
00b4d4c4bc docs: Update more links to gi-docgen
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3489>
2024-01-09 15:23:04 +00:00
Bilal Elmoussaoui
e7a920f94d docs: Migrate remaining content to markdown
By stopping using gtk-doc annotations

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3489>
2024-01-09 15:23:04 +00:00
Sebastian Wick
a0a1d102a0 cogl/bitmap-conversion: Don't break strict-aliasing for flt_pack/unpack
Simply reinterpreting the bytes differently is a strict-aliasing
violation if the type of the object isn't char or the target type of the
reinterpretation. None of that is the case here, so we have to resort to
a memcpy.

Fixes: 60c082caa ("cogl/bitmap-conversion: Support packing fp16 formats")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3499>
2024-01-09 14:43:16 +00:00
Sebastian Wick
0cd85e4adf cogl/half-float: Include SSE intrinsics
The intel intrinsics (including SSE) are only included in the header if
the arch is x86_64 which made the i686 build fail.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3234
Fixes: 568506ecb ("cogl: Add half float implementation")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3499>
2024-01-09 14:43:16 +00:00
Bilal Elmoussaoui
0f6df633fe cogl/pango: Drop PANGO_ENABLE_BACKEND usage
Dropped before Pango 1.46 which is the min required version
so the backward compatibility is no longer needed

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3491>
2024-01-05 14:22:22 +01:00
Bilal Elmoussaoui
3b4fe5d577 cleanup: Make cogl includes consistent
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3491>
2024-01-05 14:22:22 +01:00
Bilal Elmoussaoui
2317fbe7c4 cogl: Remove no longer useful define
No longer a public lib so the comment no longer applies as well

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3491>
2024-01-05 14:22:22 +01:00
Bilal Elmoussaoui
3fcff05847 cogl/pango: Remove no longer needed version check
We require pango 1.46 nowadays

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3491>
2024-01-05 14:22:22 +01:00
Bilal Elmoussaoui
f20cb09f34 cogl: Generate a GType for Buffer{BindTarget|UpdateHint}
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3357>
2024-01-05 12:25:00 +00:00
Bilal Elmoussaoui
3280fee8bc cogl: Make BufferBindTarget public
It would be used in the next commit to generate a gtype and
be used for Buffer::default-target

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3357>
2024-01-05 12:25:00 +00:00
Bilal Elmoussaoui
63a558950b cogl: Generate a GType for PixelFormat
So that CoglTexture uses the proper pspec type for it format property

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3357>
2024-01-05 12:25:00 +00:00
Sebastian Wick
985e93f9fa cogl/cpu-caps: Build cpuid and xgetbv only for x86_64
This also adds the cpuid functionality inline and checks for GCC ASM
flag output support.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3226
Fixes: 3bf6de60b ("cogl: Add CPU capability detection helper")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3488>
2024-01-04 16:45:37 +00:00
Bilal Elmoussaoui
7f1b890df1 cogl: Add missing new block in switch case
Closes #3226
Fixes: 6efd4a228 ("cogl/cleanup: Use construct-only properties for
CoglBuffer")

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3478>
2024-01-04 15:51:52 +00:00
Bilal Elmoussaoui
a72f44132d build: Make use of defined req variables
Closes https://gitlab.gnome.org/GNOME/mutter/-/issues/752

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3482>
2024-01-03 12:09:46 +00:00
Sebastian Wick
e40a256584 cogl/pixel-format: Support 16 bpc UNORM formats
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3371>
2023-12-20 23:51:14 +00:00
Bilal Elmoussaoui
05cd7bc6cb cogl: Remove unused Buffer:usage-hint
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3437>
2023-12-13 11:20:04 +00:00
Bilal Elmoussaoui
bc44d2855b cogl: Initialize first_index_to_prune
I don't know how come that the compiler wasn't complaining about it till now

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3437>
2023-12-13 11:20:04 +00:00
Bilal Elmoussaoui
6b29371db3 cogl: Remove unused private functions
The commit also moves certain functions from the private header
as they are not used anywhere else and removes COGL_EXPORT
when the function is supposed to be private and is not used outside of
cogl

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3437>
2023-12-13 11:20:04 +00:00
Bilal Elmoussaoui
5d9e9707dd cogl: Remove unused CoglPipelineEvalFlags
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3437>
2023-12-13 11:20:04 +00:00
Robert Mader
7454287d3b cogl/gles: Fix GL_OES_rgb8_rgba8 check
Fixes: bbf2d83e94 ("cogl/gles: Require OES_rgb8_rgba8 to have color-renderable 8bpc formats")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3451>
2023-12-11 23:28:24 +01:00
Sebastian Wick
60c082caaf cogl/bitmap-conversion: Support packing fp16 formats
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3441>
2023-12-06 23:01:02 +01:00
Sebastian Wick
e6eed4f32c cogl: Add a fp32 format for pixel read-back
We will also require GL_OES_texture_half_float and GLES 3.0 to enable
COGL_FEATURE_ID_TEXTURE_HALF_FLOAT. This gives us float types and makes
it possible to read pixels from framebuffers with internal floating
point formats (into float, half is never supported).

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3441>
2023-12-06 23:00:49 +01:00
Jonas Ådahl
568506ecbe cogl: Add half float implementation
This implementation is copied from mesa.

It uses x86_64 assembler on CPUs where it's supported, otherwise falls
back on a software implementation (cogl-soft-float.c). It's intended to
be used for packing and unpacking f16 format bitmaps.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3441>
2023-12-06 21:18:11 +01:00
Jonas Ådahl
3bf6de60bb cogl: Add CPU capability detection helper
This will be needed to support the fast half float implementations.
Copied from mesa and adapted.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3441>
2023-12-06 21:18:11 +01:00
Jonas Ådahl
8420692d3e cogl: Add soft-float software implementation
The implementation comes from mesa, which came from Berkeley SoftFloat
3e Library.

The software float implementation will be used to convert from and to
half floating point pixel format bitmaps, when no the CPU isn't capable
of the conversion.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3441>
2023-12-06 21:18:11 +01:00
Jonas Ådahl
68788d0e75 cogl/bitmap-conversion: Use enum for medium type
The type of the intermediate medium for storing pixel channels is
changed from "is 8 or 16 bit" to an enum, and switch cases. This doesn't
add support for anything, but will make adding a "float" medium type
less intrusive.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3441>
2023-12-06 21:18:11 +01:00
Sebastian Wick
64f4415f28 cogl/gl: Use CPU packing/unpacking for opaque fp16 formats
There is no internal fp16 format which has no alpha which means we would
get garbage alpha when reading the framebuffer directly. We have to use
the packing/unpacking to always get the alpha of 1.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3441>
2023-12-06 21:18:11 +01:00
Sebastian Wick
9c219db9fe cogl/pixel-format: Re-order pixel formats to be consistent
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3441>
2023-12-06 21:18:11 +01:00
Sebastian Wick
d90c2ab2a0 cogl: Determine glReadPixels format based on framebuffer format
Which gltype and glformat are allowed for a given gl framebuffer depends
on the internal gl framebuffer format. Either the format we want to read
into matches the gltype, glformat and doesn't need CPU packing from
another format or we have to use a tmp buffer with a format that matches
the GL requirements.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3441>
2023-12-06 21:18:11 +01:00
Sebastian Wick
07bfb24312 cogl/gles2: Only support rgba1010102 on little endian systems
We already check for this in various places but we still advertised this
feature when it's not actually supported.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3441>
2023-12-06 21:07:29 +01:00
Sebastian Wick
dc3866adf4 cogl/bitmap-conversion: Fix packing 8bpc opaque alpha
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3441>
2023-12-06 21:07:29 +01:00
Jonas Ådahl
80daaac438 cogl/build: Sort source files
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3441>
2023-12-06 21:07:29 +01:00
Ivan Molodetskikh
1f22b3a2e2 cogl/trace: Add COGL_TRACE_MESSAGE
Emits a formatted message at the current time without a duration.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3417>
2023-12-06 16:12:58 +00:00
Ivan Molodetskikh
bed42454d3 cogl/trace: Make COGL_TRACE_DESCRIBE append
Sometimes it's useful to combine the description from multiple places.
For example, a subsequent commit will add the output name as the first
thing to the frame clock span descriptions, leaving the rest of the
description with complex checks unchanged.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3417>
2023-12-06 16:12:58 +00:00
Ivan Molodetskikh
c897302f87 cogl/framebuffer: Add trace spans to flush and finish
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3417>
2023-12-06 16:12:58 +00:00
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