Commit graph

10438 commits

Author SHA1 Message Date
Marius Vlad
f85008bb86 compositor: Embed the paint node status when rebuilding z-ordered list
As weston_compositor_build_view_list() marks all the outputs needing a
paint node rebuild of the re-order list, embed the paint node status
update to ALL_DRITY into straight into weston_output_build_z_order_list().

This way we'll latch it on the view list rebuild.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2025-11-19 16:08:16 +02:00
Marius Vlad
881ac6a5cf compositor: De-couple paint node ordered list from the view build list
This de-couples the compositor view build list from the paint node
ordered list to allow a more finer grain over what lists we need to
rebuild upon repaints.

As a consequence to that this avoids a trip over from the compositor
when paint nodes are destroyed and no longer re-created upon rebuilding
the view list.

Fixes: #1070
Fixes: abfe874a ("core: Don't rebuild view list on surface-local changes")

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2025-11-19 15:47:13 +02:00
Marius Vlad
87d2d3e442 gitlab-ci: Build mesa without GLX
And implicitly remove the need to build autoconf and libx11. Removed wget
and xutils-dev as those are not needed anymore.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2025-11-19 14:49:12 +02:00
Robert Mader
8da9b0baec gitlab-ci: Bump Mesa to 25.3.0
Let's use a stable release again, now that we can.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2025-11-17 16:39:10 +01:00
Kurt Kanzenbach
c6484574a6 frontend: Fix VNC mirror screen rotation
The following config allows to mirror the LVDS output to VNC:

|[output]
|name=LVDS-1
|transform=rotate-270
|
|[output]
|name=vnc
|mirror-of=LVDS-1

However, the current code only takes the scale into account, not the
relative transformation. In case of rotate 90 or 270 the width and height
have to be swapped. Add it.

Closes: https://gitlab.freedesktop.org/wayland/weston/-/issues/1076
Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>
2025-11-17 12:11:42 +00:00
Pekka Paalanen
d69e816b54 compositor: fix finish_frame presentation feedback crash
This was brought up in issue 1063. The assertion in
weston_presentation_feedback_present_list() will trigger randomly during
repeated suspend/resume testing, presumably while a client is animating
and asking for presentation feedback.

drm_output_start_repaint_loop() has a path where drmWaitVBlank() is able
to pull a good timestamp for the last vblank. This results in a call to
weston_output_finish_frame() with a good timestamp and
WP_PRESENTATION_FEEDBACK_INVALID in the flags.

Previously it was assumed that in such case the presentation feedback
list cannot have any entries. This assumption is false. It is possible
that while the output is in idle state, a client will post an update to
a surface and ask for presentation feedback on it. This should trigger
drm_output_start_repaint_loop() with a non-empty feedback list.

It is unclear why this problem was not seen in the wild much more often.

Start-repaint-loop does not present anything by definition, it only acts
to synchronize the output repaint loop with the (hardware) scanout
cycle. Therefore no feedback must be sent there. As
WP_PRESENTATION_FEEDBACK_INVALID flag indicates no feedback must be
sent, use it to avoid calling
weston_presentation_feedback_present_list().

References: https://gitlab.freedesktop.org/wayland/weston/-/issues/1063
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-11-13 11:38:34 +02:00
Erico Nunes
1a868b7244 vulkan-renderer: fix VkMemoryDedicatedRequirements usage
This needs to extend the VkMemoryRequirements2 struct, not
VkImageMemoryRequirementsInfo2.

Fixes: ad0f4cf9 ("vulkan-renderer: make dmabuf import dedicated allocation optional")

Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
2025-11-07 14:30:29 +01:00
Pekka Paalanen
12334b3e75 tests: break out on client_capture_output() error
If the Wayland connection died, this code path ended up in an endless
loop, because test-asserts do not abort. Break out to fix this. The
test-assert records the failure, so not need to do more.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-11-06 16:02:37 +02:00
Daniel Stone
65554abd88 screenshooter: Emit warning for output recording
Deprecate the screenshooter recording mode, with the intention of
removing it in libweston 16. Using the PipeWire backend (or similar) is
a far better and more flexible way of capturing output content.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2025-10-28 07:55:43 +00:00
Daniel Stone
6d18e86b06 backend-drm: Deprecate DRM VA-API recorder
The DRM backend has had a VA-API recorder for a while, which pushes the
frames from every redraw into libva for compositor-side recording.

Implementing this manually in the compositor, and configuring it, is
kind of pain. We now have the PipeWire backend which can do
screencasting in a much more flexible way without having to push
everything into the compositor itself, and without having to hardcode
support for one particular encoder framework.

Deprecate this module with the intention of removing it in the Weston 16
cycle, along with screenshare (for similar reasons).

Signed-off-by: Daniel Stone <daniels@collabora.com>
2025-10-28 07:55:43 +00:00
Erico Nunes
53895cac2f vulkan-renderer: support fragment debug binding
Add a debug binding and mode to highlight (green tint) what has
been rendered through vulkan-renderer composition. This is useful
to visually identify/debug clients which have been offloaded to
DRM planes, since those won't go through the renderer composition
process and therefore won't be highlighted the same way.
Since this is the first debug mode in vulkan-renderer, add some
initial infrastructure to handle debug bindings.

Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
2025-10-28 07:43:53 +00:00
Erico Nunes
68d3d3badc vulkan-renderer: fix pipeline specialization constant offsets
The VkSpecializationMapEntry use was incorrect here, it requires the
struct offset to be in the second entry.

Fixes: 8f56d03d ("libweston: Vulkan renderer")

Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
2025-10-28 07:43:53 +00:00
Marius Vlad
7fa306dd81 ivi-shell: Remove black curtain/set output ready in HMI controller
This is basically a revert of 6f94022e ("ivi-shell/layout: Create a
temporary background curtain") to remove the blank/blank
curtain in ivi-shell and use the weston_output_set_ready to notify the
compositor that it is start issueing repaints.

Introduces a new callback in ivi-layout which controllers can call on
their own.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2025-10-27 05:55:51 +00:00
Derek Foreman
777a52ef4d Revert "desktop-shell: Add a placeholder curtain on new outputs"
This reverts commit 0ff5ac0f7b.

Now that we have a way to prevent repaints of empty scene graphs from
the shells, remove the curtains and just have our first paint be
proper content.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-10-27 05:55:51 +00:00
Derek Foreman
0bfcb700b9 compositor/shells: Require shells to flag outputs as ready to allow repaint
We've added a curtain to the shells so at startup we have something to
render, but this causes a flicker if someone is trying to have a seamless
transition from boot to weston.

Add a ready flag that allows the shell to indicate repaints are safe, so
we can remove the curtains and have no wasted frames at startup.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-10-27 05:55:51 +00: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
Derek Foreman
6070dd8069 compositor: Add a WESTON_PAINT_NODE_BUFFER_PARAMS_DIRTY
This already existed for surface, so it is trivial to add.

This will let the upcoming plane state reuse code notice a format change.

This is handy because a client might respond to dmabuf feedback by changing
formats, with the expectation that doing so would land content on a plane.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-10-23 16:22:00 +01:00
Derek Foreman
008884f289 compositor: Move dirty buffer handling to paint node early update
This was in the late update because attaching buffers is something only
the renderer cares about.

However, the upcoming drm plane state re-use patches need to know if the
buffer changed before assign_planes, so we need this in the early update.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-10-23 16:22:00 +01:00
Daniel Stone
6155981cc6 drm: No longer force the use of the first cursor fb
The assert added in 78657c5ff3 will cause
problems when we try to reuse cached drm plane layouts in the future -
instead of asserting on an exact gbm fb, assert that the the fb type
corresponds has the cursor type instead.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2025-10-23 16:22:00 +01:00
Daniel Stone
58614d4f5b drm-backend: Add separate type for dmabuf renderbuffers
Although Vulkan's renderbuffers are dmabufs, the difference between a
client dmabuf and a backend-allocated dmabuf is a very meaningful one.
Add a separate buffer type for BUFFER_DMABUF_BACKEND instead of
overloading BUFFER_DMABUF for this.

This tangentially allows the Vulkan renderer to do direct scanout of
client buffers in mixed mode.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2025-10-23 16:22:00 +01:00
Robert Mader
b688767680 backend-drm: Allow plane-less DRM background for opaque black solid buffers
The DRM documentation states:
> Unless explicitly specified (via CRTC property or otherwise), the active
> area of a CRTC will be black by default. This means portions of the active
> area which are not covered by a plane will be black, and alpha blending of
> any planes with the CRTC background will blend with black at the lowest zpos.

See https://dri.freedesktop.org/docs/drm/gpu/drm-kms.html#plane-abstraction

This means the view for the primary plane does not need to cover the
whole output and black areas of the scene-graph can be left out.
Doing so has various benefits - most importantly it:
1. allows us to use the plane-only path in more situations and with one
less plane, reducing memory bandwidth usage.
2. opens the path to offload arbitrary background colors in the future.

Iterate over the all visible paint nodes, remove solid-opaque-black
views so they are not considered for plane assignment and aggregate a
region that is later used to assign the primary plane.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2025-10-23 12:40:37 +02:00
Robert Mader
fcb4c2a85b tests/drm-offload: Add additional tests
For changes in the next commit.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2025-10-22 10:52:14 +02:00
Robert Mader
c7cdcedbf0 backend-drm: Build scene-graph before assigning planes
So far scene-graph building and plane assignment happened within a single
loop. In the future we want to be able to optimize the scene-graph
before assigning, thus split up the loop into two steps.

No behavioral changes intended.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2025-10-22 10:43:14 +02:00
Roland Kaufmann
564f6687eb backend-rdp: Add keyboard mapping for alternate Dvorak layouts
This changeset adds three variants of the U.S. Dvorak layout to the
table that is used to map a keyboard ID in the RDP backend to an Xkb
configuration. This makes it possible to have these variants
propagated seamlessly from an RDP client into the Wayland compositor.

As the backend-rdp module requires at least version 2.3.0 of the
FreeRDP library to build, the symbols for these variants is already
present in include/freerdp/locale/keyboard.h, included by rdp.h here,
and in libfreerdp/locale/xkb_layout_ids.c which translate the selected
layout in Xkb into the keyboard ID sent over the wire for the RDP
protocol.

Signed-off-by: Roland Kaufmann <rlndkfmn+freerdp@gmail.com>
2025-10-21 23:21:55 +01:00
Derek Foreman
c9a6e2721a gl-renderer: Fix up solid buffer attachments
We've been clobbering non-solid buffers with solid buffer attachment in
situations where we override the real buffer with a placeholder.

If the reason (punch hole, censor) that led to the placeholder is no
longer in effect, and new buffer is attached, we won't render what we should.

Instead, let's not attach anything for the paint node draw_solid case, and
allow gl_buffer_state be NULL when the real buffer is solid. gl_buffer_state
can then always be the correct state for the real buffer, even if we don't
use it.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-10-21 13:56:30 -05:00
Derek Foreman
37a427e4e0 gl-renderer: Set up solids in config_init
Instead of overriding solid draws later on, just set them up in the
init function.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-10-21 13:54:59 -05:00
Derek Foreman
727d976e3c gl-renderer: Make prepare_solid_draw stand alone
Currently it uses some values from the existing sconf, instead let's make
it calculate everything on its own

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-10-21 13:54:59 -05:00
Derek Foreman
095f511d53 gl-renderer: split out textured draw setup
Refactor textured draw setup into a separate function, preparing for a
future where we set up solid draws from init_for_paint_node as well.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-10-21 13:54:21 -05:00
Derek Foreman
37db081f82 gl-renderer: Set texture filters before setting input textures
Turns out gl_shader_config_set_input_textures is what adds the filter
parameters to the sconf, so we must set the filters before calling it.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-10-21 13:53:37 -05:00
Derek Foreman
21f1c575b3 tests: Add a semi-transparent single pixel buffer test
Now that we have a glClear() region optimization for opaque solid surfaces,
we should make sure we test transparent solid surfaces as well.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-10-21 13:53:34 -05:00
Robert Mader
26cab9d562 backend-drm: Use pre-calculated pnode regions from the compositor
Instead of doing duplicated calculations. Apart from being faster and
less code, it should help ensuring correctness of the given regions.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2025-10-21 11:00:32 -05:00
Robert Mader
485e1796af compositor: Fixes for the opaque region
is_fully_opaque notably applies to opaque single-pixel-buffer views
without opaque region. Using it should be purely an optimization.
The check for alpha in turn may fix bugs in certain conditions.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2025-10-21 16:43:40 +02:00
Derek Foreman
e8b2033d82 compositor: Better instrument transform updates
Let's just make them show up in the perfetto traces when they actually
happen, so it's a little easier to see how much benefit we derive from
trying to defer them.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-10-21 08:54:13 -05:00
Pekka Paalanen
d4e39210a3 color-lcms: optimize build_3d_lut()
Previously, inverse_evaluate_lut1d was called 3 * len^3 times. Now it is
called only 3 * len times with the help of pre-computed arrays for red
and green channels. Blue channel does not need an array, because there
were no redundant computations. This is a significant win.

Also, allocate a temporary array rgb_in, so cmsDoTransform() can be
called in batches of len triplets. This seemed to be not that big win. I
tried running cmsDoTransform() over len^2 triplets, but that did not
seem to improve performance.

The test I used creates two 3D LUTs, hence two times for a single run.
My representative timing test results per one 3D LUT:
- before: 16 ms and 19 ms
- after: 7 ms and 10 ms

The measurements were done with this patch:

 static bool
 xform_to_shaper_plus_3dlut(struct weston_color_transform *xform_base,
 			   uint32_t len_shaper, float *shaper,
 			   uint32_t len_lut3d, float *lut3d)
 {
 	struct cmlcms_color_transform *xform = to_cmlcms_xform(xform_base);
 	struct weston_compositor *compositor = xform_base->cm->compositor;
 	bool ret;
+	struct timespec begin, end;
+	unsigned i;

-	ret = build_shaper(xform->lcms_ctx, xform->cmap_3dlut,
+	clock_gettime(CLOCK_MONOTONIC, &begin);
+	for (i = 0; i < 100; i++)
+		ret = build_shaper(xform->lcms_ctx, xform->cmap_3dlut,
 			   len_shaper, shaper);
 	if (!ret)
 		return false;

-	ret = build_3d_lut(compositor, xform->cmap_3dlut,
+	for (i = 0; i < 100; i++)
+		ret = build_3d_lut(compositor, xform->cmap_3dlut,
 			   len_shaper, shaper, len_lut3d, lut3d);
 	if (!ret)
 		return false;
+	clock_gettime(CLOCK_MONOTONIC, &end);
+	fprintf(stderr, "%s: %" PRId64 " ms\n", __func__, timespec_sub_to_msec(&end, &begin));

 	return true;
 }

Using this command:

$ ./tests/test-color-icc-output -f 8 opaque_pixel_conversion

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-10-21 14:23:37 +03:00
Pekka Paalanen
f69bb08738 color-lcms: constify build_3d_lut()
These arrays are read-only here.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-10-21 14:23:37 +03:00
Pekka Paalanen
33ee2c9fb4 color: make 3x1d.fill_in populate a vec3 array
This removes the API impedance mismatch between
weston_color_curve_sample() and weston_color_curve_to_3x1D_LUT() that
was temporarily introduced in the previous commit. That mismatch is now
limited to gl_color_curve_lut_3x1d().

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-10-21 14:23:37 +03:00
Pekka Paalanen
120b88aa0a color: run vec3 through weston_color_curve_sample()
Future development will need to evaluate pipelines with curves and
matrices. Such pipelines naturally operate on vec3, as matrices cannot
be operated one channel at a time. Make weston_color_curve_sample()
operate on arrays of vec3.

Its currently only caller, weston_color_curve_to_3x1D_LUT(), is modified
to employ a temporary array for the API impedance mismatch. This
workaround will be removed later as weston_color_curve_to_3x1D_LUT()
itself will be converted to operate on vec3 arrays.

weston_v3f_array_to_planar() documentation was generated with AI.

weston_color_curve_sample() is restructured a little bit, attempting to
make it simpler to read.

color-operations.h gets the #includes needed to make it self-standing.

Assisted-by: Github Copilot (Claude Sonnet 3.5)
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-10-21 14:23:37 +03:00
Pekka Paalanen
e87eb19877 color,gl-renderer: handle neg. in linpow/powlin
We can handle the mirroring for negative input without conditional this
way. Maybe it's faster, maybe it's not, but I like this style better.

In color-operations we need only one call to the elementary function
rather than two. This helps a lot with code clarity, when we get a vec3
at a time to handle in the future, doing three trivial calls instead of
six with an if-else hassle.

fragment.glsl sheds one layer of function wrapping, which is nice.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-10-21 14:23:37 +03:00
Elliot Chen
bef29b8774 libinput: support ignoring all libinput-based input devices by configuration
For some cases such as remote control, need to disable the interaction
between input device and the weston. It will not affect the use of input
device by other modules or applications.

Signed-off-by: Elliot Chen <elliot.chen@nxp.com>
2025-10-21 12:54:42 +03: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
8591578090 compositor: Update view transform when setting surface size
since abfe874a51 we no longer do a full view list rebuild after a
surface_set_size(), but that was ensuring we always had an up to
date transform in the repaint loop.

Add a weston_view_update_transform() here to dodge the assert in
the repaint loop.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-10-20 12:51:34 -05:00
Derek Foreman
3ec1e38a62 compositor: Remove obsolete clip region calculation
This was missed in e169b77430
when leaving planes in the scene graph meant we no longer needed
to calculate this clip.

It's just a few wasted cycles, so no backport required.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-10-20 12:00:53 +01:00
Derek Foreman
58298e2346 compositor: store and use a clipped view in the paint node
Instead of clipping the visible region to the output, clip the entire
region to the output first and save that, then create the visible region
from that.

Now we have both the clipped and visible view regions that the backends
may want to do plane assignment stored in paint nodes, so we can save
some duplicate math.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-10-20 12:00:53 +01:00
Derek Foreman
48aaf6434d compositor: Move visibility update to before assign_planes
Assign planes in the future could benefit from visibility information on
pnodes being up to date.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-10-20 12:00:53 +01:00
Derek Foreman
3bd055145b compositor: turn paint_node->visible_next into visible
This is a step towards having correct visibility information in
assign_planes. Instead of visible_next and visible, we now have
visible_previous and visible, with visible being set up in the
visibility update function instead of being copied across in
the late update.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-10-20 12:00:53 +01:00
Derek Foreman
de0527bce0 compositor: Pass region to paint_node_damage_below()
In the future I plan to move the paint node visibility calculation, and
in doing so the different callers to paint_node_damage_below() will have
different visibility regions.

Add the region as a parameter.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-10-20 12:00:53 +01:00
Derek Foreman
2abd161023 tests: Add tests for scaled single pixel buffers
Now that we're validating that buffer size must be an integer multiple of
scale, add some tests to make sure it's happening.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-10-18 11:51:05 -05:00
Derek Foreman
dc27dd7e95 compositor: Validate buffer scale
We're supposed to generate an INVALID_SIZE error if the buffer size isn't
an integer multiple of the scale.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-10-18 11:51:05 -05:00
Derek Foreman
8cdf3fb709 compositor: Make convert_size_by_transform_scale static inline
It's a tiny function, instead of exporting for test let's just inline it.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-10-18 11:51:05 -05: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