Commit graph

1709 commits

Author SHA1 Message Date
Derek Foreman
85d8c7a5e5 clients: Add a commit-timing test client
Add a simple client that queues up a few future frames and logs how
accurately the requested presentation times were hit.

This used simple-shm as a skeleton, and those copyrights have been retained.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-12-16 10:58:01 -06:00
Derek Foreman
fc2e365c1d compositor: Update to presentation-timing version 2
This fixes a bug in version 1 where we should've been giving a 0 refresh
for VRR, and introduces version 2 where we're allowed to give a compositor
chosen rate for VRR.

We currently chose the mode's native refresh rate.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-12-16 10:21:43 -06:00
Marius Vlad
683d7df164 simple-shm: Allow to make simple-shm fullscreen with just the keyboard
Similarly to simple-egl, teach simple-shm to also do that if pressing
F11. Allows testing stuff much easier -- without installing key-bindings
in the shell.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2025-10-24 22:31:39 +01:00
Victoria Brekenfeld
11f7273545 cliients/dnd: Fix self-only mode
Signed-off-by: Victoria Brekenfeld <github@drakulix.de>
2025-10-21 05:47:29 +00:00
Derek Foreman
5a3f3c7ca7 desktop-shell: Force scale to 1 for single pixel buffer
Now that we use single pixel buffer, we need to be careful to only use
scale of 1, as other scales are supposed to generate an INVALID_SIZE
protocol errors (because the buffer size is not an integer multiple
of the scale).

Right now a bad scale just breaks background repaints, but in the future
we'll properly validate scale, which would cause the shell client to
be disconnected.

Fixes: 6cc8f48cd ("clients: Paint desktop-shell color background with single-pixel-buffer")

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-10-18 11:51:05 -05:00
Robert Mader
8e30a7efc7 clients: screenshot: YUV support
If any output uses a YUV format, instead of trying to composite into a
png, write the raw data into .yuv files for each output.

These files don't contain any metadata yet, thus one may want to convert
them into y4m files with e.g. a command like the this:
ffmpeg -s 1024x768 -r 1 -pix_fmt yuv420p -i ~/wayland-screenshot-output-0-2025-08-01_15-58-24.yuv -c:v copy screenshot.y4m

Note that this may only work for certain pixel formats, such as
DRM_FORMAT_YUV4[20|22|44], and not for e.g. DRM_FORMAT_P010.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2025-10-07 11:48:33 +02:00
Robert Mader
a9fc1fc0f7 clients: screenshot: Fixup --help command line option
Signed-off-by: Robert Mader <robert.mader@collabora.com>
2025-10-07 11:48:33 +02:00
Robert Mader
a09895e907 clients: screenshot: Support dmabuf passthrough for writeback connectors
Instead of relying on the compositor to allocate dmabufs for the
writeback connector and copying the results to the client-provided
shm-buffer, support allocating dmabufs in the client. The compositor
will pass them through to the writeback connector, effectively doing
the equivalent to "passthrough"/"plane-offloading"/"zero-copy".

Based on a patch by Chien Phung Van <chien.phungvan@vn.bosch.com>

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2025-10-06 16:04:18 +02:00
Robert Mader
6cc8f48cd8 clients: Paint desktop-shell color background with single-pixel-buffer
So the buffer has the WESTON_BUFFER_SOLID type, which will make
additional optimizations easier going forward.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2025-10-02 17:05:22 +01:00
Robert Mader
b6f890d249 clients: screenshot: Allow selecting format and capture source
Add support for using writeback connectors as source. Those potentially
support more than one format, thus allow selecting those as well.
While on it, add a verbose flag for useful debug output.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2025-09-25 12:39:26 +02:00
Robert Mader
00902a5921 output-capture: Allow multiple formats and add formats_done event
The writeback output capture source may allow clients to select from
multiple possible formats. Update the protocol and its users
accordingly, and add formats_done event, making the implementation
easier and following common protocol practice.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2025-09-25 11:26:16 +02:00
Robert Mader
ccce6cfdda clients: screenshot: Use shared client-buffer utils
In preparation for dmabuf support.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2025-09-05 11:47:18 +02:00
Robert Mader
4d43e63ab5 clients: screenshot: Sort imports
In preparation for more additions.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2025-09-05 11:47:18 +02:00
Derek Foreman
bf311ff232 screenshooter: Don't fail the first time an output won't capture
Historically, weston-screenshooter attempts a capture on all
wl_outputs, and if any output fails to capture it exits immediately.

These days it's possible to set up the pipewire backend to mirror
a drm backend output. This leads to surprising behaviour if one
tries to screenshot while no pipewire client is in use. Since the
pipewire backend has no buffer to render into at this point, the
screenshot fails. The drm screenshot is then dropped on the floor
because one of the wl_outputs failed to capture.

Avoid this for now by just continuing in the case of such
"graceful failures". Though maybe in the future we should allow
picking a wl_output by name, or have a command line switch to
decide whether to stop after a failure or not.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-09-04 08:54:52 -05:00
Jaeyoon Jung
e91252a943 desktop-shell: Add scale-fit background type
It is similar to scale-crop but fits to the output so that the image
does not get cropped.

Signed-off-by: Jaeyoon Jung <jaeyoon.jung@lge.com>
2025-08-18 16:42:26 +09:00
Erico Nunes
a79e7c3e8d clients/simple-vulkan: move render_done semaphore to image
In some cases it is possible that a frame becomes available by its
fence but the last used swapchain image has still not been returned to
the swapchain. If the render_done semaphore is part of the frame struct
it will be reused and cause a validation error.
To prevent this from happening, move the render_done semaphore to the
image struct so that each of those semaphores is only used when the
associated image is safely acquired from the swapchain.

Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
2025-06-25 14:12:22 +00:00
Marius Vlad
e70cfe319c fullscreen-shell: Deprecate fullscreen-shell and screenshare module
kiosk-shell/xdg-shell is the (more) modern approach, so let's inform
users that fullscreen-shell is going way.

This also adds an explicit dependency of shell-fullscreen for
screenshare. With this change, both screenshare and fullscreen-share
are disabled by default.

Fixes: #848

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2025-05-30 14:31:08 +03:00
Erico Nunes
5536a98e97 clients/simple-dmabuf-vulkan: New Vulkan client example
Example to serve as a reference of a basic Wayland client using
Vulkan with dmabuf. This does not use a traditional Vulkan swapchain
but implements it using imported gbm buffers. Also features use of
linux-explicit-synchronization-unstable-v1 with Vulkan.
Based on weston-simple-dmabuf-egl.

Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
2025-05-23 20:36:05 +01:00
Erico Nunes
75c37afa62 clients/simple-vulkan: New Vulkan client example
Example to serve as a reference of a basic Wayland client using
Vulkan, contained in a single source file and with a minimal set
of dependencies.
Features incremental present (similar to swap_buffers_with_damage
from EGL) which is not commonly used by other Vulkan demos and is
useful to test the compositor.
Based on weston-simple-egl.

Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
2025-05-23 20:36:05 +01:00
Erico Nunes
76431a952f clients/simple-dmabuf-egl: Add missing destructors
Destructors for zwp_linux_explicit_synchronization_v1 and
weston_direct_display_v1 were missing.

Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
2025-05-23 20:36:05 +01:00
Erico Nunes
ae47d27f06 clients/simple-egl: destroy tearing_manager on exit
Add missing tearing_manager destructor call.

Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
2025-04-02 06:34:13 +00:00
Erico Nunes
4fa4665d7a clients/simple-egl: remove duplicated shader program link
This is unnecessary as the program is already linked at this point.

Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
2025-04-02 06:34:13 +00:00
Pekka Paalanen
3fefb5ba44 libweston, clients, tests: implement weston_matrix in terms of weston_mat4f
This converts weston_matrix and weston_vector to use linalg-types
internally. All direct accesses to members had to be converted
everywhere, mostly in the simplest form possible which leaves some
trivially reducable code around.

The intention is that we can now gradually migrate away from
weston_matrix in the future.

Look like one trailing space got accidentally annihilated in
compositor.c.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-04-01 15:59:54 +03:00
Loïc Molinari
6bbc6c1256 gl-renderer: Fix SHM RGB888 and BGR888 endianness
The 24 bpp RGB and BGR SHM formats are meant to be stored little
endian, not big endian.

Fixes a regression in commit 815ccaff.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2025-04-01 12:31:51 +02:00
Marius Vlad
f0ee8be804 terminal: Restore SIGPIPE signal handler to oldact (SIG_DFL)
Prior to executing a new command restore the parent process to the
default SIG_DLF handler as we normally use SIG_IGN it to avoid
crashing on pasted input.

As we seem to be hitting a Broken Pipe message when running
certain scripts, it seem we need to restore back the
default handler.

This is similar to what other folks have been doing in
https://github.com/labwc/labwc/issues/1209.

Fixes: #994

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2025-03-13 10:37:08 +02: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
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
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
Marius Vlad
207fed2710 Revert "shared/helpers.h: Migrate helpers.h to libweston"
This is problematic as we don't have namespacing for these and some of
the macros can interfere with other defines.

This reverts commit 8634c7e349.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2025-01-17 10:18:26 +02:00
Colin Kinloch
5aae333bbb clients/window: Save pending allocation if mapping fullscreen
This means the window will appear at the set size when unsetting
fullscreen.

Signed-off-by: Colin Kinloch <colin.kinloch@collabora.com>
2025-01-13 17:03:48 +02:00
Colin Kinloch
0aeb8e5910 clients/fullscreen: Add option to map window fullscreen
Signed-off-by: Colin Kinloch <colin.kinloch@collabora.com>
2025-01-06 12:17:40 +00:00
Derek Foreman
5b35631545 desktop-shell: Fix background image
Commit 264c205add ignored the fact that a
background color of 0 should fall back to the background image, and
broke that case.

Fixes 264c205add
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2024-12-17 09:36:45 -06:00
Derek Foreman
264c205add desktop-shell: Make backgrounds fully opaque
Non-opaque backgrounds don't make sense, and cause rendering
problems.

Silently set backgrounds fully opaque, and remove any mention of
alpha from the man page.

Kiosk-shell already implicitly forces opaque backgrounds.

Old weston.ini with FF for alpha will always continue to work.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2024-12-11 10:03:37 -06:00
Gyeyoung Baek
483a5a73cb clients/ivi-shell-user-interface.c: Add 'command' config
Previously, commands could only be specified by their path,
so it was not possible to pass arguments.
Use the 'command' config first,
and if it is NULL, fall back to the existing 'path' config.

Signed-off-by: Gyeyoung Baek <gyeyoung976@gmail.com>

Co-authored-by: Michael Olbrich <m.olbrich@pengutronix.de>
2024-12-04 12:36:20 +00:00
Marius Vlad
8634c7e349 shared/helpers.h: Migrate helpers.h to libweston
As weston_windowed_output_get_api needs ARRAY_LENGTH() move helpers to a
libweston/ so other users can re-use that instead of re-defining these
all over. Easier for other front-ends to make use of them.

With this change windowed-output-api.h also includes the helpers header.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2024-11-25 11:26:35 +00:00
Alexey Yerin
d30683341c clients: don't redraw on xdg_toplevel.configure
Signed-off-by: Alexey Yerin <yyp@disroot.org>
Signed-off-by: Kirill Primak <vyivel@eclair.cafe>
2024-11-06 10:12:51 +02:00
Derek Foreman
16dc3b2b7f clients/simple-egl: simplify wait for configure loop
Just move the init function outside of the loop and we can drop the
if/continue.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2024-10-21 10:46:27 +00:00
Joan Torres
a266c5fff5 clients: Add color
Add a client that creates a surface with one color using single pixel buffer.

Set to that surface an image_description created with the parametric creator of
the color management protocol.

This client can get as params:
  1. Width and height
  2. Color channels R, G, B, A
  3. The name of primaries
  4. The name of a transfer function
  5. The min, max, ref luminance levels

Signed-off-by: Joan Torres <joan.torres@suse.com>
2024-09-09 13:51:51 +00:00
Joan Torres
53419eb991 clients/window: Allow rendering frame wihout shadow
Rendering the shadow currently renders some dark color near the border inside
the inner content.

Altough the content is on top of it, if the content has some transparency,
that dark color appears and this might be unwanted.

Add an option to not render the shadow to avoid that problem.

Signed-off-by: Joan Torres <joan.torres@suse.com>
2024-09-09 13:51:51 +00:00
Joan Torres
1b793b7acd color: update color-management protocol to xx-v4
The main differences is the split of cm_surface functionality with
cm_surface and cm_feedback_surface.

There can only be one cm_surface to set, unset image descriptions. When
cm_surface is destroyed, the image description is automatically unset.

There can be multiple feedback_surfaces for one surface though.
Now the "preferred_changed" signal can be an initial event.

Creator params now have a new request: set_luminances.

Signed-off-by: Joan Torres <joan.torres@suse.com>
2024-08-07 13:36:49 +00:00
Loïc Molinari
d1ee47361c helpers: Add FALLTHROUGH macro
Use gcc and clang's 'fallthrough' attribute instead of a comment to
fall through switch statements. This allows to request fall through
inside a block and prevents issues with preprocessed files.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2024-07-04 14:15:04 +00:00
Loïc Molinari
0729ffbdb8 build: Add generic compiler builtins support
Wrap compiler builtins into shared functions with proper generic
implementations. __builtin_clz() isn't wrapped for now because its use
by screenshooter is pretty specific. It will be properly wrapped in
the next commit which needs a round up to the next power of 2
function.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2024-06-27 20:40:37 +00:00
Louis-Francis Ratté-Boulianne
1703d76822 clients: add support for surface compression in simple-egl
When option "-c <bpc>" is specified, the application uses
EGL_EXT_surface_compression extension to compress the window
surface to the given bitrate (bits per component).

Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
2024-06-20 07:57:38 +00:00
Derek Foreman
2819cb51c6 clients/constraints: Fix up buffer handling
Clear the selected buffer pointer immediately before the array walk to
pick a new buffer so we don't accidentally re-use the attached buffer
when it's already in use.

Set the buffer used bit only when we attach and commit a buffer - this way
we don't accidentally consume all our buffers with no way to have them
released.

Clean up buffers based on wl_buffer presence instead of used at end of
run.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2024-06-18 16:43:33 +00:00
Leandro Ribeiro
5e84f9167c clients/image: log some information only if verbose mode is set
This patch adds a new CLI option to weston-image: verbose.

It uses that to decide if we should log some info when the image
contains an ICC file embedded.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2024-06-11 10:15:42 -03:00
Leandro Ribeiro
5933af7a1d clients/image: allow clients to choose rendering intent
Commit "clients/image: use embedded ICC profile to present image" added
the support to present images with embedded ICC profiles being taken
into account. But the rendering intent was hardcoded to perceptual.

In this patch we allow end users to choose other rendering intents
through command line options.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2024-06-11 10:15:42 -03:00
Leandro Ribeiro
d76643ee47 clients/image: print program usage
Add function to print program usage. For now this is kind of useless,
but in the next commit we'll add more functionalities to clients/image
command line options.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2024-06-11 10:15:42 -03:00
Leandro Ribeiro
576680c780 clients/image: use embedded ICC profile to present image
For image files that have an embedded ICC profile, use the CM&HDR
protocol extension to present taking that into account.

We use the CM&HDR extension to create an image description based on the
ICC profile. Also through the CM&HDR extension we take this image
description and set it to be the surface image description of the
surface in which we present the image.

For now, the rendering intent is hardcoded to be perceptual. In the next
commits we'll allow end users to choose the rendering intent through
command line options.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2024-06-11 10:15:42 -03:00
Leandro Ribeiro
dbdcae9801 clients: add widget_set_image_description_icc()
This function takes an ICC fd, creates an image description for that and
sets the widget surface image description to this one.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2024-06-11 10:15:40 -03:00
Daniel Martinez
2bce726992 clients: fix surface viewport memory leak
Signed-off-by: Daniel Martinez <danielmartinez@cock.li>
2024-06-11 09:33:31 +00:00