Commit graph

10517 commits

Author SHA1 Message Date
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
Derek Foreman
52503ba9e6 backend-drm: Add EDID parsing for 'color format'
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2025-10-18 14:02:16 +01:00
Derek Foreman
2c7fd792b5 frontend: Add support for forcing a color format
Allow dictating which color format we'd like to use. This introduces the
front-end side and the core parts, leaving the EDID parsing and DRM
connector property for later patches.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2025-10-18 14:02:16 +01:00
Daniel Stone
0664d5bdc1 output: Record paint_node_changes during repaint
When we're going through assign_planes and repaint, give the backend an
opportunity to see what's changed during this repaint.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2025-10-17 13:51:05 -05:00
Daniel Stone
7f8c5f984e paint-node: Expose weston_paint_node_status
Expose the dirty status as public API so we can use it as a part of
weston_output.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2025-10-17 13:51:04 -05:00
Daniel Stone
abfe874a51 core: Don't rebuild view list on surface-local changes
If a surface changes size or opaque region, or a view changes position,
we don't need to rebuild the entire view list from scratch: we can just
rebuild what's changed and nothing else.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2025-10-17 13:49:21 -05:00
Daniel Stone
562a368fbd core: Remove flush_damage_for_plane return
Nothing uses this, and it was also being set incorrectly, as it would
return true when there was no damage to actually be flushed.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2025-10-17 13:49:21 -05:00
Robert Mader
64c938f5d6 backend-drm: Use paint_node->draw_solid in more cases
In order to streamline our checks and to make it easier to ensure
that we replace paint nodes with solid placeholders correctly.

Fix the failure reason in one case while on it.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2025-10-17 15:56:19 +02:00
Robert Mader
4cb7347407 backend-drm: Use visible_view in more cases
Instead of clipped_view. The former is the part of the later that is
not occluded.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2025-10-17 15:19:47 +02:00
Robert Mader
900ab0d39f backend-drm: Rename surface_overlap to visible_view
To clarify its meaning, especially relative to clipped_view.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2025-10-17 15:07:46 +02:00
Robert Mader
56aeb48f6d backend-drm: Use paint_node->is_fully_opaque in more places
To streamline our checks and to avoid recomputations.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2025-10-17 15:07:46 +02:00
Robert Mader
e9fc189189 paint-node: Consider view-alpha for is_fully_opaque
In order to be more in line with weston_view_is_opaque() - which we
use in most cases to set the value - and ensure the expectations of
existing places in the code are honored, see usages in both
draw_paint_node() implementations.

An exception here are holes - these always need to get painted as fully
opaque in the renderer path.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2025-10-17 15:06:11 +02:00
Pekka Paalanen
c2b60e6651 ci: stop checking allow-collaboration
I heard rumoours this is mostly unnecessary to check nowdays since it is
the default.

The real reason is that it crashes sometimes:

$ ci-fairy check-merge-request --require-allow-collaboration --junit-xml=results.xml
Traceback (most recent call last):
  File "/usr/lib/python3.12/site-packages/gitlab/exceptions.py", line 344, in wrapped_f
    return f(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/gitlab/mixins.py", line 125, in get
    server_data = self.gitlab.http_get(path, **kwargs)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/gitlab/client.py", line 813, in http_get
    result = self.http_request(
             ^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/gitlab/client.py", line 779, in http_request
    raise gitlab.exceptions.GitlabHttpError(
gitlab.exceptions.GitlabHttpError: 403: 403 Forbidden
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "/usr/bin/ci-fairy", line 8, in <module>
    sys.exit(ci_fairy())
             ^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/click/core.py", line 1161, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/click/core.py", line 1082, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/click/core.py", line 1697, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/click/core.py", line 1443, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/click/core.py", line 788, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/click/decorators.py", line 33, in new_func
    return f(get_current_context(), *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/ci_fairy.py", line 1795, in check_merge_request
    mr = p.mergerequests.get(merge_request_iid)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/gitlab/v4/objects/merge_requests.py", line 523, in get
    return cast(ProjectMergeRequest, super().get(id=id, lazy=lazy, **kwargs))
                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/gitlab/exceptions.py", line 346, in wrapped_f
    raise error(e.error_message, e.response_code, e.response_body) from e
gitlab.exceptions.GitlabGetError: 403: 403 Forbidden

Observed in https://gitlab.freedesktop.org/elliot_chen/weston/-/jobs/86174879

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-10-17 09:43:12 +00:00
Derek Foreman
5ee711d374 compositor: Add some comments to paint node members
Just a bit of documentation.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-10-16 11:12:13 -05:00
Derek Foreman
9700ec3bc4 gl-renderer: Fix clear optimization
This should be checking for a valid transform so it doesn't use corners
of an axis aligned bounding box for free-form transformed views.

It should still check surf_xform for color management, but it should only
do that when surf_xform_valid is true.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-10-16 11:12:13 -05:00
Derek Foreman
992ab893f9 compositor: Validate that paint node holes have planes
If the backend says a hole is necessary, it must assign a plane for it.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-10-16 11:12:13 -05:00
Derek Foreman
62e76ee5fb compositor/drm-backend: Move censor check into paint nodes
This test is critical, so only do it once, and throw some asserts around
to make sure we don't mess it up.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-10-16 11:12:13 -05:00
Derek Foreman
25a281a0a8 drm-backend/gl-renderer: move fully transparent check into paint node
Video underlay "holes" are fully transparent but must be rendered
fully opaque. However, they appear to be fully transparent to
the current gl-renderer test which is missing a need_hole check.

Add a paint node attribute for this so it can be more easily
checked in assign_planes and renderers.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-10-16 11:04:31 -05:00
Derek Foreman
99ab4ceaca compositor: Rework paint node update stages to correct recent bugs
Remove maybe_replace_paint_node entirely and place the parts of it
properly between early and late updates.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-10-16 10:25:42 -05:00
Derek Foreman
889a564695 compositor: refactor out placeholder color setting
We'll need this in both the early and late paint node updates soon,
so this saves a couple of lines of code.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-10-16 10:25:42 -05:00
Derek Foreman
cb49b386f2 compositor: Move paint node validation into a function
We're going to assert on a bunch of stuff, so let's put it in a function
to remove clutter.

For now it's trivial, but I'll be adding more tests shortly.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-10-16 10:25:42 -05:00
Derek Foreman
59e2a111fa compositor: Remove is_direct from paint node
It's the same as buffer->direct_display essentially 100% of the time,
except maybe if someone set weston_direct on a single-pixel-buffer, but
that's madness.

Just drop it entirely, and let the only existing reader of the variable
get it from the buffer directly.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-10-16 10:25:42 -05:00