1
0
Fork 0
Commit graph

3007 commits

Author SHA1 Message Date
Bilal Elmoussaoui
b054a09aa1 cogl: Remove unnused Renderer.foreach_output
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3781>
2024-05-26 16:12:48 +02:00
Bilal Elmoussaoui
c506c194b6 cogl: Don't allow overriding renderer winsys_id
It is an API that no longer makes sense, as Cogl is only usable inside of Mutter

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3781>
2024-05-26 16:11:47 +02:00
Bilal Elmoussaoui
dad9f64b5f cogl: Don't allow overriding renderer constraints
It is an API that no longer makes sense, as Cogl is only usable inside of Mutter

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3781>
2024-05-26 16:10:21 +02:00
Jonas Ådahl
c192f51159 cogl: Add sync fd feature enum value
This is meant to tell whether cogl_context_get_latest_sync_fd() is
supposed to work or not. It's enabled when ANDROID_native_fence_sync is
exposed by the driver.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3771>
2024-05-23 16:42:21 +00:00
Bilal Elmoussaoui
5cac24346d cogl: Remove unused DEFAULT_DRIVER code
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3762>
2024-05-21 09:38:35 +00:00
Bilal Elmoussaoui
5752704886 cogl: Remove COGL_RENDERER env variable
Doesn't seem to be that useful with Cogl being embedded inside Mutter nowadays.
Spotted by Georges

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3762>
2024-05-21 09:38:35 +00:00
Georges Basile Stavracas Neto
638d3355b4 cogl: Drop CoglSwapChain
CoglSwapChain is currently unused, and doesn't hold any information
nor is used for anything in particular.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3759>
2024-05-20 11:45:31 +00:00
Bilal Elmoussaoui
fc623c1ed1 build: Enable -Werror=shadow and fix related issues
Mostly renames or removing already defined types

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3378>
2024-05-06 15:54:16 +00:00
Michel Dänzer
09267d0bdd cogl/onscreen: Add cogl_onscreen_egl_maybe_create_timestamp_query
Move the code out of cogl_onscreen_egl_swap_buffers_with_damage, and
call the new function from callers of the former.

v2:
* Use early return if the cogl context doesn't support timestamp
  queries. (Sebastian Wick)

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3689>
2024-04-10 11:17:23 +02:00
Michel Dänzer
0bbc25f694 cogl: Update latest sync fd from cogl_onscreen_swap_buffers_with_damage
Preparation for later changes, no functional change intended.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3689>
2024-04-10 11:17:19 +02:00
Bilal Elmoussaoui
34d79b9ddf cogl: Make sure generated enum header is built before sources using it
Fixes: 63a558950 ("cogl: Generate a GType for PixelFormat")
Closes https://gitlab.gnome.org/GNOME/mutter/-/issues/3413

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3690>
2024-04-07 14:29:07 +00:00
Bilal Elmoussaoui
260a8d92dc cogl: Use uint64_t for size params
As we are using a GParamSpecUint64 for that property
which makes it fail under 32bits platforms

Fixes: 6efd4a228 ("cogl/cleanup: Use construct-only properties for
CoglBuffer")
Closes https://gitlab.gnome.org/GNOME/mutter/-/issues/3408

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3683>
2024-04-03 14:30:49 +00:00
Austin Shafer
99209958b9 cogl: Store latest GPU work completed sync fd
This keeps an internal sync_fd for the latest work submitted to
the GPU. This can then be fetched with cogl_context_get_latest_sync_fd
for use. This is intended for use with linux-drm-syncobj-v1

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3300>
2024-03-28 13:27:42 -04:00
Robert Mader
683e917854 cogl/winsys: Remove eglGetProcAddress workaround for EGL < 1.5
`eglGetProcAddress()` used to not work for core API in EGL versions
below 1.5. The workaround in place in turn can fail - notably for setups
with a local Mesa build in /usr/local.
EGL 1.5 is almost 10 years old and similar workarounds don't seem to be
in place for toolkits we rely on, notably GTK4. Thus remove it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3655>
2024-03-13 16:37:31 +01:00
Robert Mader
aaae07f9dd onscreen/native: Mark GPU rendering duration as valid if supported
Since commit e30eb78891 `ClutterFrameClock` assumes that a valid CPU time
implies timestamp query support, which is also checked in
`cogl_onscreen_egl_swap_buffers_with_damage()`.

Unconditionally setting the CPU time on direct scanout meant that the
compositing path would be stuck on the last (direct scanout optimized)
result on GL implementations without timestamp query support since.

be0aa2976e (clutter/frame-clock: Avoid rapidly toggling dynamic max render time)

Fix that by explicitly marking the gpu rendering duration as valid when
querying the GPU timestamps is supported and check for it ClutterFrameClock.

Fixes: 56580ea7c9 ("backends/native: Assume zero rendering time for direct scanout buffers")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3655>
2024-03-13 16:37:16 +01:00
Zander Brown
6a445d2eef build: Make exported package in gir consistent
Additionally Cogl was missing xlib as an include

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1918>
2024-03-13 12:52:41 +00:00
Corentin Noël
c4767b6c01 cogl: Increase annotation coverage
Upstream the annotations used in Gala, make more Cogl methods available since
things got moved to a GObject base and thus works natively with the introspection.

Add all the public API to the introspection.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3619>
2024-02-27 14:45:29 +00:00
Bilal Elmoussaoui
60e10511ae cogl: Remove Color.init_from_4ub
Slowly switching to using floats only in CoglColor
Helps https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3544

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3594>
2024-02-22 12:34:58 +00:00
Bilal Elmoussaoui
cf0803ab71 cogl: Remove Color.get_*_byte
Helps with https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3544

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3594>
2024-02-22 12:34:58 +00:00
Bilal Elmoussaoui
40dde833af cogl: Remove Color.get_*_float
They are exactly the same as the get_* variants

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3594>
2024-02-22 12:34:57 +00:00
Bilal Elmoussaoui
77f95d2203 cogl: Drop unused Color APIs
Simplifies the overall API as preparation of merging both
CoglColor and ClutterColor

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3594>
2024-02-22 12:34:57 +00:00
Corentin Noël
e7de5c36f3 build: Remove the config.h inclusion from all public headers
Do not include it at header side as it is not part of the installed headers.

Only keep it in cogl-gl-headers.h as it is a private header.

Add it to all the source files that depend on it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3593>
2024-02-17 11:58:55 +00:00
Doğukan Korkmaztürk
34d00d769e render-device: Update DMA-BUF allocation API to allow modifiers
meta_render_device_gbm_allocate_dma_buf() function is updated to take a
list of modifiers. If no modifiers are specified, the modifier is
selected by the allocator, and implicit modifiers are used to import the
created DMA-BUF.

Co-authored-by: Jonas Ådahl <jadahl@gmail.com>
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3537>
2024-02-16 08:22:04 -05:00
Bilal Elmoussaoui
2c613df4eb cogl: Drop Pipeline.set_color_*
Those setters variants makes it very hard to do across project changes
to the
color type. As part of
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3544
I would like to switch from using integers to floats inside CoglColor
which this PR would simplify

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3553>
2024-02-16 12:13:23 +01:00
Daniel van Vugt
c63fdba6b3 cogl/onscreen/glx: Remove extraneous spaces
check-code-style was complaining about this.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3587>
2024-02-15 15:13:17 +08:00
Daniel van Vugt
53ca3a0089 cogl/onscreen/glx: Remove comment about clipped redraws not being supported
They've been supported for a very long time.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3587>
2024-02-15 14:57:23 +08:00
Daniel van Vugt
ea486b200f cogl/onscreen/glx: Remove duplicate wait function
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3587>
2024-02-15 14:55:18 +08:00
Robert Mader
912cd80f10 cogl/scanout: Add API for source/destination rectangles
These will get passed on to KMS later.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3177>
2024-02-10 17:41:12 +00:00
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