1
0
Fork 0
Commit graph

2959 commits

Author SHA1 Message Date
Daniel van Vugt
fc7ece8a13
cogl/onscreen: Indent declaration parameters to align with above
This fixes warnings from check-code-style.

Signed-off-by: Mingi Sung <sungmg@saltyming.net>
2024-09-15 14:00:16 +09:00
Daniel van Vugt
0b33663007
cogl/onscreen: Add function cogl_onscreen_get_pending_frame_count
Signed-off-by: Mingi Sung <sungmg@saltyming.net>
2024-09-15 14:00:15 +09:00
Bilal Elmoussaoui
fc1532efc4 Remove unused variables
Detected through codeql

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3837>
(cherry picked from commit 6e1c761330)
2024-09-14 21:16:38 +02:00
Sebastian Wick
1a09f44c60 cogl/gles: Revert to unsized GL_BGRA as internalformat for BGRA_8888
Using GL_BGRA8_EXT as internalformat for TexSubImage2D was not allowed
in the EXT_texture_format_BGRA8888 extension. This changed recently:

https://registry.khronos.org/OpenGL/extensions/EXT/EXT_texture_format_BGRA8888.txt

  1.4, 23/06/2024 Erik Faye-Lund: Add GL_BGRA8_EXT for ES 2.0 and later.

Mesa already supports this which is why 7f943613a8 ("cogl: Use sized
internal renderable formats") worked as intended. Technically spec
compliant and our CI had an up-to-date driver.

So while this is no bug, it's still not great because older drivers will
generate GL errors. This commit changes this specific format back to an
unsized internal format which means we could, in theory, get less than
8bpc framebuffers.

We can try to revert this commit when newer driver versions have
propagated far enough.

Fixes: 7f943613a8 ("cogl: Use sized internal renderable formats")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3954>

(cherry picked from commit 45dcfeb0cc)
2024-08-18 18:28:54 +00:00
Sebastian Wick
d9d3199127 cogl/gles: Explain GLES2 requirement of matching internalformat & format
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3914>

(cherry picked from commit ce5f97fde1)
2024-08-18 18:28:54 +00:00
Sebastian Wick
7ab98f961c cogl/gles: Use the GL_BGRA8_EXT internalformat instead of the format
There is one define for the format (GL_BGRA_EXT) and one for the
internal format (GL_BGRA8_EXT). Use them appropriately.

This also adds defines to consistenly not use the _EXT postfix.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3914>

(cherry picked from commit c3eb01e547)
2024-08-18 18:28:54 +00:00
Sebastian Wick
66156236e2 cogl/gles: Use a premul required format for opaque fp16 Cogl formats
The opaque fp16 Cogl format variants need a required format that is
already premultiplied whereas the fp16 formats with an alpha channel can
be either straight or premult.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3914>

(cherry picked from commit d820fe030a)
2024-08-18 18:28:54 +00:00
Sebastian Wick
eecec5a699 cogl/gl: Use internal formats without alpha for non-alpha Cogl formats
The formats COGL_PIXEL_FORMAT_RGB_888 and COGL_PIXEL_FORMAT_BGR_888 for
the gl driver were using internal formats with an alpha channel.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3914>

(cherry picked from commit 41700d3cc7)
2024-08-18 18:28:54 +00:00
Michel Dänzer
a60ba34264 cogl: Update latest sync fd also from cogl_gl_framebuffer_flush/finish
This ensures that any drawing for screen casting is reflected in the
sync fd.

Fixes: 99209958b9 ("cogl: Store latest GPU work completed sync fd")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3946>


(cherry picked from commit 61ae9eedb6)
2024-08-13 10:15:55 +00:00
Marco Trevisan (Treviño)
6f489292b9 cogl: Do not store the XVisualInfo
We were leaking one instance because _cogl_winsys_egl_context_created()
could be potentially be called twice (via cogl_display_setup() one as
part of cogl_renderer_check_onscreen_template() and the other when
called from clutter_backend_do_real_create_context()), and so we'd ended
up overwriting the reference we had.

However, we really didn't use it anywhere and once used to call the
relevant functions it's just useless.

So let's just keep it as local variable

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3788>
(cherry picked from commit bcec6df78e)
2024-06-28 21:18:01 +02: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