Commit graph

9913 commits

Author SHA1 Message Date
Loïc Molinari
fbe2f27915 tests: Remove zunitc testing framework
This framework isn't used anymore.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2025-02-26 23:50:45 +01:00
Loïc Molinari
9373e76655 shared: Rename NULL and not NULL pointer assertions
Make the NULL assertions more explicit.

weston_assert_ptr_is_null() -> weston_assert_ptr_null()
weston_assert_ptr()         -> weston_assert_ptr_not_null()

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2025-02-26 23:50:45 +01:00
Loïc Molinari
c855bc7af0 tests: Port all test clients to the new test asserts
This commit gets rid of libc's abort() usage in the test suite using
test asserts instead.

Asserts run in the server as plugins aren't converted because they are
shared between server and client.

Co-authored-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2025-02-26 23:50:41 +01:00
Loïc Molinari
d92560a0e4 tests: Port config-parser test to Weston testing framework
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2025-02-26 22:50:51 +01:00
Loïc Molinari
1f169c044c tests: Port timespec test to Weston testing framework
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2025-02-26 22:50:51 +01:00
Loïc Molinari
12819c4151 shared: Let bit asserts take a bit instead of a position
It's much more common to have bits defined as enums than having a
position, so let's just directly take a bit as argument to the bit
asserts. For the few cases where only the position is available, it's
easy to get the right bit using a shift.

The is_pow2_64() helper functions have been added in order to validate
the bit passed as argument and prevent programming errors.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2025-02-26 22:50:51 +01:00
Loïc Molinari
57c3cee7ed tests: Add test asserts based on new Weston assert system
This commit introduces various Weston based asserts for the testing
framework. The goal is to ease test writing and improve readability.

Using custom asserts instead of relying on libc's assert() will also
help providing NDEBUG builds. This is currently not possible because
setting NDEBUG would disable all the asserts in the tests.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2025-02-26 22:50:51 +01:00
Robert Mader
9124a98aec color: update color-management protocol to wp-v1
For a list of changes that got squashed into this commit see
https://gitlab.freedesktop.org/rmader/weston/-/commits/color-management-protocol-wp-v1-bkp

Co-authored-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Signed-off-by: Robert Mader <robert.mader@collabora.com>
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2025-02-26 10:09:43 -03:00
LI Qingwu
6d9c42a7d2 ivi-shell: re-align ivi_layout_interface structure
re-aligned the ivi_layout_interface structure in ivi-layout.c.
purely a formatting update, no functional changes were made.

Signed-off-by: LI Qingwu <Qing-wu.Li@leica-geosystems.com.cn>
2025-02-21 09:25:11 +00:00
LI Qingwu
7e941cf6f1 ivi-shell: Add desktop surface ping timeout notification
Implement new ivi_layout_interface method and signal to forward
desktop client ping timeout events for unresponsive client handling.

Signed-off-by: LI Qingwu <Qing-wu.Li@leica-geosystems.com.cn>
2025-02-21 09:25:11 +00:00
Théo Maillart
2b69bc0811 gl-renderer: clip subimage dimensions to its buffer ones
A window freeze can occur in specific use cases like when using a kiosk
shell. It scales surfaces to fit the compositor size and the transformation
to buffer space can, in some cases, round the size one pixel higher than
the texture size, making glTexSubImage2D() refuse the size argument and
generate a GL_INVALID_VALUE without updating the texture.
This commit ensures the GL renderer doesn't exceed the texture size.

Here is how the issue was reproduced:
	$ weston --renderer=gl --backend=wayland --width=1920 --height=1080 --shell=kiosk
	$ gst-launch-1.0 videotestsrc ! video/x-raw,height=590,width=500 ! waylandsink display=wayland-1

Signed-off-by: Théo Maillart <tmaillart@freebox.fr>
2025-02-21 07:03:56 +00:00
Derek Foreman
bfb2dfae63 compositor: Try an immediate repaint if VRR enabled
When in VRR mode, repainting without a wait might happen instantly,
so do it.

This is likely not the best long term solution, but is ok for now
while weston's vrr support is experimental.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-02-21 06:49:42 +00:00
Derek Foreman
c7cf87fe85 frontend: Enable VRR from the config file
Allow weston.ini to enable game VRR.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-02-21 06:49:42 +00:00
Derek Foreman
8e26bf1ce9 libweston: Add VRR capabilities
Add functions to query output VRR capabilities and set the current VRR
mode.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-02-21 06:49:42 +00:00
Derek Foreman
85d1ca7fab drm-backend: Set VRR_ENABLED property based on output configuration
Set up the VRR_ENABLED instead of always clearing it to 0.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-02-21 06:49:42 +00:00
Derek Foreman
c321cc3020 drm-backend: Add Variable Refresh Rate modes
Query the vrr_capable property for heads, and expose it to frontends.

Currently we only support game mode VRR, but expose VRR capabilities as
an enum in anticipation of supporting QMS VRR in the future.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-02-21 06:49:42 +00:00
Robert Mader
de6f0b870a gitlab-ci: Bump wayland-protocols to 1.41
Disable tests as they require wayland-scanner 1.23.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2025-02-17 17:42:13 +00:00
Loïc Molinari
e72839f52c gl-renderer: Make YUV formats table static
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2025-02-17 15:54:52 +00:00
Loïc Molinari
62c25e8ca0 gl-renderer: Add macro to improve YUV formats table readability
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2025-02-17 15:54:52 +00:00
Loïc Molinari
7974f8f46e gl-renderer: Use .r to access red component in samplers
This is for consistency reasons too.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2025-02-17 15:54:52 +00:00
Loïc Molinari
0ca40593dc gl-renderer: Sample XYUV shader variant using .rgb
This is mostly to improve consistency.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2025-02-17 15:54:52 +00:00
Loïc Molinari
b947955499 gl-renderer: Replace Y_XUXV variant by Y_UV with texture swizzles
Formats using SHADER_VARIANT_Y_XUXV can now use SHADER_VARIANT_Y_UV
instead with swizzle variations in order to simplify the fragment
shader.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2025-02-17 15:54:52 +00:00
Loïc Molinari
51ed256d26 libweston: Replace pixel format's sampler_type with color_model enum
The sampler type, which was initially meant for the GL renderer, is
currently used to derive the color model of pixel formats. This commit
gets rid of this legacy field and replaces it with an explicit one
indicating the color model.

Note that it also fixes the issue that formats wouldn't be considered
YUV if ENABLE_EGL isn't defined because the sampler type field in that
particular case would always be 0.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2025-02-17 15:54:52 +00:00
Loïc Molinari
24b5d91316 gl-renderer: Get legacy EGL buffers info from YUV formats table
Automatise variant and planes selection for legacy EGL buffers support
by using the global information from the YUV formats table and setup
texture swizzles for legacy EGL buffers and dma-buf.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2025-02-17 15:54:52 +00:00
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