3189 Commits

Author SHA1 Message Date
Michel Dänzer
84135e51b0 clutter: Add ClutterFrameInfo::view_frame_counter
And plumb it through from ClutterFrame::frame_count.

Preparation for later changes, no functional change intended.

v2:
* Rename to view_frame_counter. (Jonas Ådahl)

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4306>
2025-03-13 15:43:29 +01:00
Bilal Elmoussaoui
41175dfccd cogl: Replace unused field with computed value
As in the commit mentioned below, we dropped the only place where
current_gl_draw_buffer is set. Which was still being used for glx and
ended up causing black screen with multi-monitors & nvidia.

Fixes: aa0600bf2 ("cogl: Remove Framebuffer:stereo-mode")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4323>
2025-03-10 15:50:44 +00:00
Robert Mader
9d5f8d464e Revert "cogl: Drop Rendererer.set_driver"
This reverts commit 6c22b7faba8112065a611921a538b9f66d9500bf.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4312>
2025-03-02 10:06:46 +00:00
Michel Dänzer
2682ab2863 stage-view: Plumb through target presentation time to ClutterFrameInfo
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4282>
2025-03-01 13:33:09 +00:00
Sebastian Wick
b7e6f6d144 cogl: Get the authority for vertex/fragment_snippets_state_equal
They expect the authority of the pipeline, which is not necessarily the
pipeline we're operating on.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3924
Fixes: 5e98ee5dbe ("cogl: Add pipeline hooks to user program pipelines")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4298>
2025-02-25 03:27:27 +00:00
Corentin Noël
2da7805f58 meson: Use library instead of shared_library
Allow to theoretically build mutter statically.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4244>
2025-02-11 09:55:07 +00:00
Bilal Elmoussaoui
8c1ec168c6 cogl/texture: Refactor Loader's new/free functions
By making them follow what other helpers alike do.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4200>
2025-01-02 18:04:27 +00:00
Bilal Elmoussaoui
4ee657e31f cogl/texture: Drop set_auto_mipmap vfunc
As it is only relavant for 2D textures.
Allows getting rid of the is-primitive property which was enforcing only 2D textures
can use the set_auto_mipmap function.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4200>
2025-01-02 18:04:27 +00:00
Bilal Elmoussaoui
f613c82ab5 cogl/texture: Remove unused get_max_waste vfunc
As only 2DSliced has one, no need for abstracting things were not
needed.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4200>
2025-01-02 18:04:26 +00:00
Bilal Elmoussaoui
6d9ef4d52a cogl: Abstract GL specific bits of Buffer
By introducing a BufferImpl that handles the buffer
allocation/de-allocation bits and making the driver responsible for
creating the correct impl.
This allow moving various Buffer specific vfuncs from Driver as well as
getting rid of the gl_handle field from Buffer.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4181>
2025-01-02 17:30:09 +00:00
Bilal Elmoussaoui
6c22b7faba cogl: Drop Rendererer.set_driver
As nothing uses it anymore. End users can still use the COGL_DRIVER variable
to force selecting a specific driver if needed.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4194>
2024-12-27 13:25:40 +00:00
Bilal Elmoussaoui
ae48cf76f9 cogl/glx: Stop loading opengl module twice
As the Renderer takes care of doing that already as we enforce that the
DriverId is GL3 inside the glx winsys connection phase.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4194>
2024-12-27 13:25:40 +00:00
Bilal Elmoussaoui
d3fec7648d cogl/renderer: Simplify driver constraints logic
By just using the DriverId to get all the necessary details where
needed.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4194>
2024-12-27 13:25:40 +00:00
Bilal Elmoussaoui
4ef475d3fe cogl/xlib-renderer: Merge renderer winsys data
Currently, we cast the CoglXlibRenderer pointer into a CoglX11Renderer
which is something that we would get rid of later on, along with the
usage of a data field once the Renderers become a subtypes of
CoglRenderer.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4187>
2024-12-18 15:39:03 +00:00
Bilal Elmoussaoui
1e65e1106f cogl: Drop COGL_X11_SYNC env variable
We already have a MUTTER_SYNC one. No need for doing the same thing twice.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4186>
2024-12-13 14:42:23 +01:00
Bilal Elmoussaoui
903b943875 cogl/xlib-renderer: Stop keeping track of the list of renderers
As we can only have one renderer, if the connect phase fails, we would
dispose it
and there is no reason to manually register/unregister them.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4186>
2024-12-13 14:41:47 +01:00
Bilal Elmoussaoui
c913a33d6a cogl: Stop storing XDisplay on the Renderer
Instead, only store it in the XlibRenderer data and drop the code
related to connecting to XDisplay as MetaX11Display handles that
already.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4186>
2024-12-13 14:40:49 +01:00
Bilal Elmoussaoui
07fa87907e cogl: Drop no longer used Indices.new_for_buffer
And drop the offset field with it as nothing sets it anymore.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4184>
2024-12-13 13:09:48 +01:00
Bilal Elmoussaoui
1fce76a0fb cogl/graphene: Simplify matrix_project_points helper
As it is always used for 3 components, drop n=2 and n=4 support.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4180>
2024-12-12 15:13:04 +00:00
Bilal Elmoussaoui
c9fffb73f7 cogl/attribute: Drop constant attributes support
As it is never used, detected through codecoverage.
Fixes adf0acbe0d5d378ecb862811e818107a0c420687

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4179>
2024-12-12 11:25:10 +01:00
Bilal Elmoussaoui
fc0a8d343f cogl/texture-driver: Abstract GL specific vfuncs
By moving them up from the abstract Driver to DriverGL.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4132>
2024-12-12 09:11:37 +01:00
Bilal Elmoussaoui
1f2ba427b6 cogl/driver: Abstract GL specific vfuncs
By moving them up from the abstract Driver to DriverGL.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4132>
2024-12-12 09:11:37 +01:00
Bilal Elmoussaoui
2769c25cf7 cogl/driver: Harmonize GL naming
Following what we did for TextureDriverGL and DriverGL, take the
opportunity to mark various headers as private while renaming them.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4132>
2024-12-12 09:11:37 +01:00
Bilal Elmoussaoui
fdee2ed8ff cogl: Move various GL utils to DriverGL
As they are no longer used separately by the GL3/GLES2 drivers.

The remaining Buffer/Texture/Attribute/Clip stack helpers are kept in
separate files as they are complex and are probably better kept split.

Further cleanups might be done in future commits.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4132>
2024-12-12 09:11:37 +01:00
Bilal Elmoussaoui
6e5bc2f6b7 cogl/gl: Move GLContext into DriverGL
By doing so, we can get rid of the context_deinit vfunc, we only have
the context_init part, which is still needed for now.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4132>
2024-12-12 09:11:37 +01:00
Bilal Elmoussaoui
ab85aa74eb cogl/gl: Share context_init implementation between GL/GLES
By using GObject features instead of calling the function manually.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4132>
2024-12-12 09:11:37 +01:00
Bilal Elmoussaoui
71381c2e7f cogl: Create a common GL driver
Both the GL3 & GLES2 inherit from it to avoid overriding the same vfuncs
multiple times.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4132>
2024-12-12 09:11:37 +01:00
Bilal Elmoussaoui
2e36f80914 cogl: Turn Driver into an abstract object
In the next commit, we will add a DriverGL that those two drivers would
inherit from to share the common infrastructure.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4132>
2024-12-12 09:11:37 +01:00
Bilal Elmoussaoui
0103288739 cogl: Rename Driver to DriverID
As we will be having a CoglDriver abstract class in the next commit.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4132>
2024-12-12 09:11:33 +01:00
Bilal Elmoussaoui
1131c3b634 cogl: Make driver header private
Along with formatting of the various vtable fields as we will turn it to
an abstract GObject next.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4132>
2024-12-11 20:52:16 +01:00
Georges Basile Stavracas Neto
c6ecaf01c2 cogl/sampler-cache: Initialize variable
It's apparently harmless.

Coverity CID: #1511379

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4175>
2024-12-10 14:17:47 -03:00
Bilal Elmoussaoui
a2fdeac9e7 cogl/driver: Move various texture functions to TextureDriverGL
As they are now shared between GL3 and GLES3 texture driver, there is no
need anymore for having them in a separate header and included.

Cleanup the names of the functions while doing so.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4163>
2024-12-10 11:08:53 +00:00
Bilal Elmoussaoui
1401c745d7 cogl: Remove function declaration
No longer has an implementation.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4163>
2024-12-10 11:08:53 +00:00
Bilal Elmoussaoui
f3430ff1c5 cogl: Add a TextureDriverGL
Abstract away the common bits between GL3 and GLES2 TextureDriver
implementations by sharing the common bits in a parent class.

Ideally, we would move the various vfuncs that are GL specific from the
abstract TextureDriver type but that can be done at a later stage once
there is actual work on adding a Vulkan driver.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4163>
2024-12-10 11:08:52 +00:00
Bilal Elmoussaoui
cde6a447b4 cogl: Move various vfuncs from DriverVtable to TextureDriver
As they make more sense there. Maybe we could have a common
OpenGLTextureDriver
that would share the common texture_2d_* vfuncs but that can be done
later.

By moving those vfuncs to the TextureDriver, we can get rid of the
texutre_2d
nop driver implementations.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4163>
2024-12-10 11:08:52 +00:00
Bilal Elmoussaoui
4f16f6df3b cogl: Turn TextureDriver into an abstract object
The motivation is to ease sharing bits between the various texture
drivers implementations.
The same thing would be done for DriverVtable & WinsysVtable.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4163>
2024-12-10 11:08:51 +00:00
Bilal Elmoussaoui
9181fdf5c2 cogl: Don't expose FramebufferBits
Fixes 34f4b8064fb32da792e69cebb911c394ab1eb8b7

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4174>
2024-12-10 08:58:24 +01:00
Georges Basile Stavracas Neto
4e8da5304a cogl/pipeline-layer: Use G_DECLARE_FINAL_TYPE
Same deal

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4155>
2024-12-09 13:23:29 +00:00
Georges Basile Stavracas Neto
ac07f10de3 cogl/pipeline: Use G_DECLARE_FINAL_TYPE
Lets us get rid of the boilerplate.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4155>
2024-12-09 13:23:29 +00:00
Georges Basile Stavracas Neto
b0fd29ece2 cogl: Drop CoglNode
It's not necessary anymore.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4155>
2024-12-09 13:23:29 +00:00
Georges Basile Stavracas Neto
8540362d1d cogl/pipeline: Inherit from GObject
Same deal as CoglPipelineLayer.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4155>
2024-12-09 13:23:29 +00:00
Georges Basile Stavracas Neto
a88f0b72aa cogl/pipeline-layer: Inherit from GObject directly
Instead of inheriting from CoglNode, inherit from GObject and manually
manage children.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4155>
2024-12-09 13:23:29 +00:00
Bilal Elmoussaoui
b0219f0697 cogl: Add default impls for FramebufferDriver
Allowing to simplify the NopFramebufferDriver.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4165>
2024-12-09 13:12:29 +00:00
Bilal Elmoussaoui
195a9b5f87 cogl/driver: Make various vfuncs optional
Avoid having to provide an impl for the NopDriver.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4165>
2024-12-09 13:12:29 +00:00
Michel Dänzer
18fbea0b03 cogl: Do not call glFlush in cogl_gl_create_timestamp_query
SwapBuffers will implicitly flush the query along with the other GPU
work for the frame.

The comment was about this function being called for direct scanout,
which hasn't been the case since 56580ea7c941 ("backends/native: Assume
zero rendering time for direct scanout buffers").

This eliminates one GPU work flush to the kernel per frame with the
Mesa radeonsi driver, leaving only a single flush per frame.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4158>
2024-12-06 11:22:05 +00:00
Michel Dänzer
33a9a1cace cogl/onscreen: Call _cogl_context_update_sync after the buffer swap
Indirectly via cogl_framebuffer_flush, since we also need to call
glFlush now. Need to do it in cogl_onscreen_egl_swap_* because
meta_onscreen_native_swap_buffers_with_damage uses
cogl_context_get_latest_sync_fd.

Doing it before the swap was problematic because the swap may do GPU
work of its own, which wasn't covered by the EGL sync object created in
_cogl_context_update_sync. This could result in visual artifacts. See
the discussion starting at
https://gitlab.freedesktop.org/mesa/mesa/-/issues/11996#note_2678104 for
details.

For similar reasons, move the cogl_framebuffer_finish calls after the
swap as well.

As a bonus, this eliminates one of 3 GPU work flushes to the kernel per
frame with the Mesa radeonsi driver, because the glFlush/glFinish call
in cogl_framebuffer_flush/finish doesn't have any GPU work to flush
after SwapBuffers.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4158>
2024-12-06 11:22:05 +00:00
Jonas Ådahl
2205181da8 cogl/renderer: Add API to get the implicit modifier
This allows avoiding having to depend on libdrm in places that are
otherwise independent of the backend.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3900>
2024-12-05 19:12:09 +00:00
Jonas Ådahl
01dcec31b0 cogl/renderer: Add way to filter modifiers by external-only
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3900>
2024-12-05 19:12:09 +00:00
Jonas Ådahl
e3f743facc cogl/renderer: Add API to query DRM format modifiers
Will be used to do explicit modifier buffer allocation via the Cogl API.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3900>
2024-12-05 19:12:09 +00:00
Jonas Ådahl
78cfbb57eb cogl/renderer: Remove stray newline
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3900>
2024-12-05 19:12:09 +00:00