Commit graph

9889 commits

Author SHA1 Message Date
Loïc Molinari
de2a4ebc3c clients: Let simple-shm create buffers of requested RGB format
This is a temporary solution to easily test wl_shm support for
different RGB formats. I think it would be better to have a dedicated
client to test all the supported RGB and YUV formats for the wl_shm,
dma-buf import and legacy EGL protocols.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2025-02-17 15:54:52 +00:00
Loïc Molinari
dd66debd46 tests: Add tests for RGB wl_shm format variants
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2025-02-17 15:54:52 +00:00
Loïc Molinari
d254cb14fc tests: Rename yuv-buffer test to shm-buffer
Next commit will add tests for RGB formats.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2025-02-17 15:54:52 +00:00
Loïc Molinari
89e20bcda6 tests: Add support and tests for 16-bit YUV wl_shm format variants
Fixes the offset issue in gl_renderer_attach_shm().

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2025-02-17 15:54:52 +00:00
Loïc Molinari
73d6c2cc85 tests: Add tests for swizzled YUV wl_shm format variants
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2025-02-17 15:54:52 +00:00
Loïc Molinari
ad85a4a2d1 tests: Ensure wl_shm format support before testing
Tests shouldn't fail on platforms lacking support for a particular
format.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2025-02-17 15:54:52 +00:00
Loïc Molinari
b9ae1eb4a9 gl-renderer: Extend YUV formats
Add new formats to the YUV formats table: YVYU, UYVY, VYUY, NV21,
NV61, NV42, YVU420 and YVU4444.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2025-02-17 15:54:52 +00:00
Loïc Molinari
20f246eaef gl-renderer: Add wl_shm support to all declared YUV pixel formats
Support more YUV formats using texture swizzles. Automatise wl_shm
format addition based on the format table using the new texture format
utility gl_texture_is_format_supported().

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2025-02-17 15:54:52 +00:00
Loïc Molinari
cf43e7da9f libweston: Extend RGB formats
Add new formats supported by OpenGL to the pixel formats table: R16,
RG88, GR1616, RG1616, XRGB16161616 and ARGB16161616.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2025-02-17 15:54:52 +00:00
Loïc Molinari
5e267afa6d gl-renderer: Add wl_shm support to all declared RGB pixel formats
Support more RGB formats using texture swizzles. Automatise wl_shm
format addition based on the format table using the new texture format
utility gl_texture_is_format_supported().

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2025-02-17 15:54:52 +00:00
Loïc Molinari
da393fd468 gl-renderer: Cache and defer blend state update to draw call
This slightly minimises state changes.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2025-02-17 15:54:52 +00:00
Loïc Molinari
e18e3b6c4a gl-renderer: Replace RGBX shader variant with texture swizzles
Simplify fragment shader logic by getting rid of the RGBX variant
which can be implemented using texture swizzles instead.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2025-02-17 15:54:52 +00:00
Loïc Molinari
e8160e059d gl-renderer: Relax EXT_texture_format_BGRA8888 requirement
This can now be removed thanks to texture swizzles.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2025-02-17 15:54:52 +00:00
Loïc Molinari
be5c662bae gl-renderer: Add OpenGL ES 2 support to texture swizzles
Fallback to shader based swizzling when OpenGL ES 3 isn't available.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2025-02-17 15:54:52 +00:00
Loïc Molinari
a990e8ceda gl-renderer: Prefer GL_RGBA8 with swizzles over GL_BGRA8_EXT
All the formats are declared as RGBA swizzled variations. Make the
BGRA8888 format do the same for consistency reasons as there shouldn't
be any performance impact for it.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2025-02-17 15:54:52 +00:00
Loïc Molinari
815ccaff92 gl-renderer: Replace channel ordering with texture swizzles
The channel ordering system currently proposes to swizzle components
in the fragment shader for a few combinations. This commit replaces
this system with texture swizzling parameters in order to support all
the possible combinations in a more efficient way.

This will allow to easily add a lot more formats and as a nice side
effect to force components to 0 or 1, which is useful for opaque
formats.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2025-02-17 15:54:52 +00:00
Loïc Molinari
891736793a gl-renderer: Add swizzles to texture parameters utilities
OpenGL ES 3 adds support for texture swizzling parameters in order to
let graphics drivers efficiently swizzle R, G, B and A components at
texture look-up, with the nice feature of allowing 0 and 1 as
supported values.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2025-02-17 15:54:52 +00:00
Loïc Molinari
5342945bb8 gl-renderer: Add texture parameters utilities
Cache and update texture parameters only when changed by storing
minification/magnification filters, wrap modes and their target into a
dedicated gl_texture_parameters structure and by calling new utility
functions to create and flush parameters.

This structure is itself stored into the buffer state for each texture
of a surface and into the output state for border and shadow textures.

The shader config filled before emitting a draw call now just takes a
pointer to the array of texture ids, a pointer to the array of
parameters and the number of textures.

This allows to simplify the logic in gl-renderer.c, to minimise GL
state changes and to let the utility wrapper validate the parameters.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2025-02-17 15:54:52 +00:00
Loïc Molinari
acc40ce2bb gl-renderer: Add EXT_EGL_image_storage support
EXT_EGL_image_storage provides a mechanism for creating texture
objects that are both EGL image targets and immutable. When available,
this makes the texture object target immutable, preventing
respecifications.

While adding support for that extension, it appeared that the
compositor calls attach_buffer() at every buffer updates and that the
texture object is each time respecified to the same EGL image. This
commit additionally prevents any respecification when
EXT_EGL_image_storage isn't available.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2025-02-17 15:54:52 +00:00
Martin Rys
c112760368 input: Add support for LED_COMPOSE and LED_KANA USB HID LEDs
Also bump up the xkbcommon dependency to a newer, 10 year old version,
to be able to remove very old ifdefs.

Signed-off-by: Martin Rys <martin@rys.rs>
2025-02-12 17:04:06 +02:00
gpotter2
59c6015c52 Move shell structures of desktop-shell to the header
Signed-off-by: gpotter2 <10530980+gpotter2@users.noreply.github.com>
2025-02-12 14:13:53 +00:00
Michael Olbrich
6e88a851a4 libweston-desktop: don't try to move child surfaces to not existing layer
The parent surface may not be on a layer. In that case, remove all child
surfaces from their current layer as well.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2025-02-12 13:51:11 +00:00
Marius Vlad
94dd926b99 backend-drm: Clear out the the fb handles
This is purely cosmetic but we do this in other parts as well, when
releasing the GEM handles. Use the macro for no of planes as well when
going over them.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2025-02-07 23:44:18 +02:00
Marius Vlad
3d5772fb06 backend-drm: Abide by the weston-direct-display specification
Turns out it seems we have a missed some spots when using the
weston-direct-display protocol.

Specifically we still seem to be attempting a dma buffer import which
ultimately can reach the GPU. This patch rectifies that in such a way
that we can actually provide a full scanout path for client's (dma)
buffers as to avoid hitting the GPU entirely.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2025-02-07 23:44:15 +02:00
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