Commit graph

9865 commits

Author SHA1 Message Date
Derek Foreman
8993f5eabb compositor: Drop flow id from weston_view_update_transform
This can end up being the first function to touch a surface in a flow,
which leads to confusing traces.

Just trace the function without a flow instead.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-02-06 13:26:11 +00:00
Michael Olbrich
f36a0c2cb8 backend-headless: use weston_output_arm_frame_timer()
headless_output_repaint() is not actually called immediately after
weston_output_finish_frame(): Weston waits for "frame-duration - repaint-window"
but at least one millisecond.
And renderning can also take an arbitrary amount of time.

So use weston_output_arm_frame_timer() like all other timer based backends. It
takes all of this into account and calculates the delay relative to the next
expected vblank time.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2025-02-06 11:20:14 +00:00
Marius Vlad
c335ec70af gitlab-ci: Expand CI job for building with a C++ compiler
This tests out if libweston can be built with a C++ compiler and catch
potential issues which we don't normally see.

We re-use one of the builds, the full-x86-64 one, and build this new
front-end alongside it.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2025-02-06 10:21:22 +00:00
Loïc Molinari
10f8b4ba81 gl-renderer: Adapt gl_fbo_texture_init() to new texture utilities
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2025-02-06 08:42:56 +00:00
Loïc Molinari
b3f6491b3a gl-renderer: Extend accepted renderbuffer formats
Use the new FBO utilities to extend the list of supported FBO formats.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2025-02-06 08:42:56 +00:00
Loïc Molinari
3d8edc15ce gl-renderer: Port wl_shm code to new texture utilities
A new gl_format_info structure is added to the pixel_format_info
structure in order to store new GL format information (compatible with
Table 1 in gl-utils.c) for each supported format. There will be a
temporary duplication of GL format info in order to keep other parts
of the code not yet ported working. That will be removed later.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2025-02-06 08:42:56 +00:00
Loïc Molinari
672178dc24 gl-renderer: Port color transformation to new texture utilities
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2025-02-06 08:42:56 +00:00
Loïc Molinari
ccf3fda334 gl-renderer: Port border images to new texture utilities
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2025-02-06 08:42:56 +00:00
Loïc Molinari
ca7e21bb94 gl-renderer: Port wireframe code to new texture utilities
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2025-02-06 08:42:56 +00:00
Loïc Molinari
0c8b6ce945 gl-renderer: Add 3D support to texture utilities
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2025-02-06 08:42:56 +00:00
Loïc Molinari
7e73234313 gl-renderer: Add ARM_rgba8 support to utilities
ARM_rgba8 allows OpenGL ES 2 implementations to support GL_RGBA8 FBO
format.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2025-02-06 08:42:56 +00:00
Loïc Molinari
85dd477466 gl-renderer: Add EXT_texture_format_BGRA8888 support to utilities
EXT_texture_format_BGRA8888 allows OpenGL ES implementations to
support GL_BGRA8_EXT FBO and texture format.

OpenGL implementations handle the spec differently regarding the use
of GL_BGRA8_EXT or GL_BGRA_EXT with TexStorage*D(), TexImage*D() and
RenderbufferStorage(). A recent revision of the spec (and Mesa)
clarifies all that, but in order to support most drivers we simply
check which method is supported by order of preference.

Co-authored-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2025-02-06 08:42:56 +00:00
Loïc Molinari
dcee21f02f gl-renderer: Add OES_required_internalformat support to utilities
Before the creation of the EXT_texture_storage extension,
OES_required_internalformat used to guarantee minimal FBO and texture
precisions to OpenGL ES 1 and 2 implementations using sized internal
formats.

Note that new external format and type combinations (like for instance
GL_RGB and GL_UNSIGNED_BYTE for the GL_RGB565 sized internal format)
should be available when OES_required_internalformat is supported.
This isn't supported by this wrapper for now because of the implicit
conversion in gl_texture_2d_init() that forces a specific type when
EXT_texture_storage isn't available.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2025-02-06 08:42:56 +00:00
Loïc Molinari
43bbd15437 gl-renderer: Add EXT_texture_type_2_10_10_10_REV support
EXT_texture_type_2_10_10_10_REV allows OpenGL ES 2 implementations to
support GL_RGB10_A2 texture format.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2025-02-06 08:42:56 +00:00
Loïc Molinari
db25130e15 gl-renderer: Add EXT_texture_norm16 support to utilities
EXT_texture_norm16 allows OpenGL ES 3 implementations to support
GL_R16_EXT, GL_R16_SNORM_EXT, GL_RG16_EXT, GL_RG16_SNORM_EXT,
GL_RGB16_EXT, GL_RGB16_SNORM_EXT, GL_RGBA16_EXT and
GL_RGBA16_SNORM_EXT 16-bit fixed-point texture and FBO formats.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2025-02-06 08:42:56 +00:00
Loïc Molinari
46603446d7 gl-renderer: Add QCOM_render_sRGB_R8_RG8 support to utilities
QCOM_render_sRGB_R8_RG8 allows OpenGL ES 3 implementations to support
GL_SR8_EXT and GL_SRG8_EXT FBO formats.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2025-02-06 08:42:56 +00:00
Loïc Molinari
e505bbe017 gl-renderer: Add EXT_texture_sRGB_RG8 support to utilities
EXT_texture_sRGB_RG8 allows OpenGL ES 3 implementations to support
GL_SRG8_EXT texture format.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2025-02-06 08:42:56 +00:00
Loïc Molinari
b2d737f1f0 gl-renderer: Add EXT_texture_sRGB_R8 support to utilities
EXT_texture_sRGB_R8 allows OpenGL ES 3 implementations to support
GL_SR8_EXT texture format.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2025-02-06 08:42:56 +00:00
Loïc Molinari
e72d7d963d gl-renderer: Add APPLE_texture_packed_float support to utilities
APPLE_texture_packed_float allows OpenGL ES 2 implementations to
support GL_R11F_G11F_B10F and GL_RGB9_A5 texture formats.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2025-02-06 08:42:56 +00:00
Loïc Molinari
58494e5ba2 gl-renderer: Add NV_packed_float support to utilities
NV_packed_float allows OpenGL ES 2 implementations to support
GL_R11F_G11F_B10F FBO and texture format.

Note that GL_HALF_FLOAT should be available (the spec is a bit
confusing) as type combination with the GL_RGB external format when
both NV_packed_float and OES_texture_half_float are supported on
OpenGL ES 2. This isn't supported by this wrapper for now because of
the implicit conversion in gl_texture_2d_init() that forces a specific
type when EXT_texture_storage isn't available.

NV_packed_float_linear would require a new utility function to
retrieve whether a texture can be linearly interpolated by the texture
samplers or not. This hasn't been added for the other formats because
there's no users for now but this might be added later.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2025-02-06 08:42:56 +00:00
Loïc Molinari
8162058c8d gl-renderer: Add EXT_color_buffer_float support to utilities
EXT_color_buffer_float allows OpenGL ES implementations to support
GL_R16F, GL_RG16F, GL_RGBA16F, GL_R32F, GL_RG32F, GL_RGBA32F and
GL_R11F_G11F_B10F FBO formats. All of these are supported by default
from OpenGL ES 3.2.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2025-02-06 08:42:56 +00:00
Loïc Molinari
2fc9a47e09 gl-renderer: Add EXT_color_buffer_half_float support to utilities
EXT_color_buffer_half_float allows OpenGL ES implementations to
support GL_R16F, GL_RG16F, GL_RGB16F and GL_RGBA16F FBO formats.
GL_R16F, GL_RG16F and GL_RGBA16F are supported by default from OpenGL
ES 3.2.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2025-02-06 08:42:56 +00:00
Loïc Molinari
37a5c249e5 gl-renderer: Add OES_texture_float support to utilities
OES_texture_float allows OpenGL ES 2 implementations to support
GL_R32F, GL_RG32F, GL_RGB32F and GL_RGBA32F texture formats.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2025-02-06 08:42:56 +00:00
Loïc Molinari
9048d752c5 gl-renderer: Add OES_texture_half_float support to utilities
OES_texture_half_float allows OpenGL ES 2 implementations to support
GL_R16F, GL_RG16F, GL_RGB16F and GL_RGBA16F texture formats.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2025-02-06 08:42:56 +00:00
Loïc Molinari
eaf2ec3888 gl-renderer: Add EXT_texture_rg support to utilities
EXT_texture_rg adds support for GL_R8 and GL_RG8 FBOs and textures.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2025-02-06 08:42:56 +00:00
Loïc Molinari
177efc7a59 gl-renderer: Add EXT_texture_storage support to utilities
OpenGL ES 2 implementations support texture immutability and sized
internal formats using the GL_EXT_texture_storage extension.

Co-authored-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2025-02-06 08:42:56 +00:00
Loïc Molinari
0cede83390 gl-renderer: Add OpenGL ES 2 support to texture utilities
Use glTexImage2D() instead of glTexStorage2D() and convert coloured
sized internal formats to base formats in order to support OpenGL ES
2.

Co-authored-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2025-02-06 08:42:56 +00:00
Loïc Molinari
a7611efce9 gl-renderer: Add texture utilities
Add gl_texture_is_format_supported(), gl_texture_2d_init(),
gl_texture_2d_upload() and gl_texture_fini() utilities. The creation
function accepts all the coloured sized internal format from OpenGL ES
3 using glTexStorage2D() to create immutable textures and reduce API
overhead.

Co-authored-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2025-02-06 08:42:56 +00:00
Loïc Molinari
8c74b48493 gl-renderer: Check for OES_EGL_image to create FBOs from EGLImages
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2025-02-06 08:42:56 +00:00
Loïc Molinari
dc7299d69c gl-renderer: Check supported FBO formats
Validate the colour-renderable sized internal formats passed to
gl_fbo_init() using a new gl_fbo_is_format_supported() utility. Sized
internal formats are now required. More formats will progressively be
added depending on the OpenGL ES version and the supported extensions.

Support for RGBA8 FBOs is now required by the GL renderer.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2025-02-06 08:42:56 +00:00
Loïc Molinari
1dc6868947 gl-renderer: Add OpenGL ES 3 sized internal format table
This table will be used as a reference by GL utilities.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2025-02-06 08:42:56 +00:00
Loïc Molinari
c39799b684 gl-renderer: Move GLES headers inclusion to common header
Avoid duplicating the inclusion of the GLES headers by including them
once in gl-renderer-internal.h.

Upgrade GLES3 header to gl32.h.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2025-02-06 08:42:56 +00:00
Loïc Molinari
7f3969c823 gl-renderer: Move utilities to new file gl-utils.c
These utility functions are used (or will be used) in different source
files. This prevents gl-renderer.c from growing too much (the coming
texture utilities are quite verbose) by moving generic functions out.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2025-02-06 08:42:56 +00:00
Loïc Molinari
e3a5589975 gl-renderer: Make space for upcoming extension flags
Next commits will add support for a bunch of extensions. The extension
flag enumeration is sorted alhpabetically. This commit makes some
space for the coming flags and presets the current values in order to
avoid useless diff lines and ease code review.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2025-02-06 08:42:56 +00:00
Robert Mader
6394f7d1ca Set default YUV color coefficients and range to BT.709/limited
As most SDR video content uses that instead of BT.601. Crucially, most
KMS drivers use BT.709 as the default for the COLOR_ENCODING value,
making it the effective default for hardware planes we used before we
started setting an explicit value.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2025-02-04 12:36:12 +00:00
Robert Mader
1b7462011d gl-render: Set default color hints for EGL images
In order to be consistent with our internal YUV shader and KMS plane
output. Note that the extension requires the hints to be ignored for
RGB formats.

Note that the attribs array previously was slightly larger than the
maximum number of attributes required.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2025-02-04 12:36:12 +00:00
Robert Mader
ce79976dfc backend-drm: Set default plane color space and range hints
Upstream KMS drivers currently default to either ITU-R BT.601 YCbCr or
ITU-R BT.709 YCbCr. Ensure consistent behavior by setting a default.
We use BT.601 as that is what our fallback shader uses at the moment.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2025-02-04 12:36:12 +00:00
Robert Mader
5fae3a5141 pixel-formats: Add is_yuv helper
Which will be used in later commits. For now using the sampler_type
works for all existing formats, however should we ever want to use
it for RGB formats this functions needs to get adopted.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2025-02-04 12:36:12 +00:00
Derek Foreman
e22a11513d doc: Add some very sparse perfetto documentation
Just tell people that timeline points are in perfetto, and how to
add a function trace.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-01-24 12:22:13 +00:00
Derek Foreman
0be4403f65 timeline: Add flow ids for surfaces
We add a flow_id when we touch a surface that has no flow id, and clear
it when we flush damage, so a flow line will be drawn connecting any
operations on a surface and terminating in its damage clear.

This is less useful for surfaces that never receive explicit damage after
they're set up, such as background images and the panel, as they might
never show up as a damage track, and have an unterminated flow line.

For surfaces that do show up on a damage track, we can follow them back to
the commit that caused them to update.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-01-24 12:22:13 +00:00
Derek Foreman
313aa041e4 timeline: Post core_flush_damage after clearing damage
This shouldn't cause any problems with WESGR output, since the timing
will still be very close to what it was previously.

With perfetto tracing, this helps with event ordering. The final flush
event will now come after the damage accumulation function calls instead
of before. This is better when we add flow lines in a following commit.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-01-24 12:22:13 +00:00
Derek Foreman
485cb4ab12 timeline: Add the TL_POINTs into perfetto data
Try to roughly achieve feature parity with WESGR by processing the same
timepoint data and feeding it into perfetto, with output and surface
specific tracks.

We can't match the way WESGR draws this information, because perfetto has
a different display paradigm, but we can try to at least make sure all the
same information is visible in an understandable way.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-01-24 12:22:13 +00:00
Derek Foreman
b3635c17f4 timeline: Add weston_timeline_profiling() and use it
When we use perfetto, we'll want to enable the renderer timepoints, which
are currently gated behind weston_log_scope_is_enabled(). So let's make a
function that checks if either the timeline scope or perfetto is enabled.

We do not yet process these timepoints, that comes in a future commit.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-01-24 12:22:13 +00:00
Derek Foreman
da1dca9d77 compositor: Add a bunch of arbitrary perfetto trace points
Just pepper some perfetto tracing about.

These functions are picked mostly to provide some visibility into repaint,
but in the future we might want to add more sites, such as input
processing.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-01-24 12:22:13 +00:00
Derek Foreman
bdfe7a3e58 libweston: Add support for perfetto profiling
This borrows heavily from the Mesa project's perfetto instrumentation, and
for now just adds perfetto to the build and a collection of useful macros
for adding trace points.

The atomics have been cargo culted in - Weston currently has no need of
such things, but I guess they're harmless for now and could be useful if
we consider threads in the future.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-01-24 12:22:13 +00:00
Derek Foreman
738d4b9509 compositor: Refactor assign planes into its own function
This is just so we can have nicer profiling output later.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-01-24 12:22:13 +00:00
Derek Foreman
5d51042e6b timeline: Make an enum for the timepoint strings
I'll be adding perfetto instrumentation, which will want to know the
timepoint name without having to parse it.

For now, just pass an enum and add a helper function to convert to strings.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-01-24 12:22:13 +00:00
Daniel Stone
0c31f7dfd2 drm: Remove workaround for ancient Mesa GBM issue
This issue was fixed several years ago; we don't need to carry the
workaround anymore.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2025-01-23 11:57:42 +00:00
Marius Vlad
cfbf49d7e0 meson.build: Bump to C11 with GNU extensions
Weston seems quite ready for that so let us do it!

This makes the winpr3 Static assert warning message go away, allowing us
to perform a build (as we fail with any type of warnings).

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2025-01-21 19:20:06 +00:00
Marius Vlad
d17e61546e gitlab-ci.yml: Bump CI templates and use FDO_DISTRIBUTION_PLATFORM
This is required to get proper ach image from docker.io (for armv7 builds).

Similar to https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/449

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2025-01-21 19:20:06 +00:00