Commit graph

611 commits

Author SHA1 Message Date
Derek Foreman
3dc300eceb compositor: Store the output destination and buffer source rects in pnode
Instead of having the drm backend calculate these per frame, let's store
them in the paint node when they change.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-05-13 11:20:58 +03:00
Derek Foreman
a9052522ec compositor: Rename valid_transform to simple_transform
This was confusing, because it seemed to magically imply that we could
transform points by invalid transformations.

Rename and better define the variable.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-05-13 11:20:58 +03:00
Derek Foreman
42f70fd23b drm: Perform plane coord math on floats
Do the math on floats before the conversion to fixed point. Later, we'll
move this math to the front end where we'd like to store these values
clamped, but not in the backend specific fixed point format.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-05-13 11:20:58 +03:00
Leandro Ribeiro
3161338b8b backend-drm: offload PQ EOTF using curve colorops
Up to now, we'd not try to offload WESTON_TF_ST2084_PQ through a colorop
of type curve. The kernel supports only PQ 125 EOTF, which is the PQ
EOTF scaled by 125. Same goes for the inverse of the EOTF.

In order to support that, use multiplier colorops to scale things up or
down (depending if we have EOTF or its inverse).

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2026-05-13 10:21:33 +03:00
Leandro Ribeiro
184b9f9956 backend-drm: decompose xform into shaper + 3D cLUT to offload to KMS
When the pipelines do not support our color xform or when the color
manager is unable to convert the color xform into operations that Weston
understands (currently: pre-curve, color mapping and post-curve), we
were simply not trying to offload the transformation.

But we have an alternative: trying to decompose the xform into shaper +
3D cLUT and check if there's a compatible pipeline. This commits adds
the support for that.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2026-05-13 10:21:33 +03:00
Leandro Ribeiro
420c69849a color: rename to_shaper_plus_3dlut() to to_clut()
This name is quite long and awkward to use in certain functions. On ICC
nomenclature, cLUT is a multidimensional LUT with a shaper (1D LUT) in
front of it. So let's just call it to_clut() to simplify.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2026-05-13 10:21:33 +03:00
Leandro Ribeiro
659ae748b3 backend-drm: offload pre-blend color xform
Use the per-plane color pipelines to offload pre-blend Weston color
transformations when possible.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2026-05-13 10:21:33 +03:00
Leandro Ribeiro
158063ea4e backend-drm: add quantization to drm_colorop_3x1d_lut_blob
We may have DRM LUT's for u32 and u16. This allow us to create both
types. Should be useful in the next commit.

u16 is used for legacy GAMMA_LUT, and u32 will be used for the newer
colorops in the next commits.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2026-05-13 10:21:33 +03:00
Leandro Ribeiro
9ae42ba607 backend-drm: add curve_step to struct drm_colorop_3x1d_lut_blob
No behavior change, this should be helpful in the next commits.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2026-05-13 10:21:33 +03:00
Leandro Ribeiro
e03f8c8ef0 backend-drm: move drm_colorop_3x1d_lut_blob functions to colorop.c
Follow-up of "backend-drm: offload post-blend only if libdrm >=
2.4.130". This moves code related to offloading post-blend color xform
to colorops.c, which is built only if libdrm >= 2.4.130 is available.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2026-05-13 10:21:33 +03:00
Leandro Ribeiro
f4fb1db3d8 backend-drm: introduce color pipelines
This adds support to the kernel proposal that introduces per-plane color
pipelines. For now it only manages the lifetime of the kernel objects
related to that.

In the next commits we start using all that to offload Weston pre-blend
color transformations to KMS.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2026-05-13 10:21:33 +03:00
Leandro Ribeiro
73a2a76255 backend-drm: rename drm_colorop_3x1d_lut to drm_colorop_3x1d_lut_blob
We use this struct to cache and avoid creating multiple blobs for the
same 3x1D LUT. So let's rename to better reflect that.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2026-05-13 10:21:33 +03:00
Leandro Ribeiro
1d52621816 backend-drm: few cosmetic changes related to struct drm_colorop_3x1d_lut
Move struct to another part of the header, change a few variable/param
names and replace an useless u64 by u32.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2026-05-13 10:21:33 +03:00
Leandro Ribeiro
7b172960a9 shared: add wl_list asserts
We were missing that, so let's include them.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2026-05-13 10:21:33 +03:00
Leandro Ribeiro
04d4ebd91c shared: rename ec to wc_ for assert macros
We usually use the variable name 'ec' for struct weston_compositor. We
currently use the same in our assert macros, bringing issues.

Rename 'ec' to 'wc_' in our assert macros, avoiding this kind of issue.

Also, this fixes a weston_assert_ macro call in which we forgot to
declare 'ec' before calling it.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2026-05-13 10:21:33 +03:00
Daniel Stone
de75997abc drm-backend: Use explicit synchronisation for Vulkan
We can't rely on Vulkan implementations placing an implicit fence on our
dmabuf, so let's do it ourselves.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2026-05-12 13:54:37 +01:00
Derek Foreman
ddd1cf6f39 drm: Deprecate non-atomic mode sets
We've been keeping these poorly tested paths around long enough, it's time
to deprecate them, to be dropped after the next major release.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-05-11 14:17:21 +03:00
Derek Foreman
978052f9ed drm: Use weston_log_scope_puts when we don't have a format string
We can use __VA_OPT__ to make a macro that automatically selects between
the puts and printf log scope variants.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-04-14 17:12:05 +03:00
Derek Foreman
77eb13f499 drm,renderers: Remove some unnecessary indirection
pnode->view->surface is the same as pnode->surface, always.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-04-09 08:58:15 -05:00
Derek Foreman
f5fb552b57 drm: Fix stale comment that refers to weston_view
This is passed a weston_paint_node, not a weston_view.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-04-09 08:58:15 -05:00
Derek Foreman
6a06562b77 drm: Rename find_plane_for_view
We're passing a paint node already, so let's just change the name.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-04-09 08:58:15 -05:00
Derek Foreman
1ec218026a compositor: Store view alpha in the paint node
This is one of the few things backends and renderers still need to grab
from the view.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-04-09 08:58:15 -05:00
Derek Foreman
d85618a029 drm: rename node to pnode in drm_output_find_plane_for_view
Cosmetic meddling.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-04-09 08:58:15 -05:00
Derek Foreman
a0f860ad70 drm: Stop using weston_view in drm_assign_planes
We can get all these things from surface through paint node.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-04-09 08:58:15 -05:00
Derek Foreman
501f6d31b1 drm: Stop using weston_view in try_paint_node_on_plane
We've removed all need for this now.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-04-09 08:58:15 -05:00
Derek Foreman
9042fd41d7 drm: Store paint node instead of view in plane state
The paint_node life cycle should match the output's, so we should be able
to store it in the state instead of a view.

This gets us closer to having the backends stop caring about views.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-04-09 08:58:15 -05:00
Derek Foreman
6f09ba42bd compositor: Add cursor layer status to paint nodes
Store this in the paint node so we don't have to look it up in the view
in the backends.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-04-09 08:58:15 -05:00
Derek Foreman
838d6d92be drm: Don't use weston_view in drm_output_find_plane_for_view
We can get what we need via the paint node.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-04-09 08:58:15 -05:00
Derek Foreman
c1fcfd288d drm/state-propose: remove output asserts in z_order_list walks
We already validate the paint node list in weston_output_repaint,
immediately after we conditionally rebuild the z_order_list.

These asserts are thus completely redundant, as we've already
performed them in the front end.

My reason for removing this now is to drop weston_view usage
from the backend.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-04-09 08:58:15 -05:00
Derek Foreman
96676d114c drm: Don't use weston_view in drm_fb_get_from_paint_node
We have no need for a weston_view here.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-04-09 08:58:15 -05:00
Derek Foreman
3c53883d78 drm: Use is_fully_opaque from paint node in drm_fb_get_from_paint_node
The paint node early update has already checked this value for us, we
should use that instead of interacting with the view.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-04-09 08:58:15 -05:00
Derek Foreman
9022976412 drm: Log paint node internal names instead of view internal names
Backends work on paint nodes, not views - and the paint node internal
name is a superset of the view internal name anyway, so it's not hard to
figure out which view a paint node belongs to when reading debug text.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-04-09 08:58:15 -05:00
Derek Foreman
ef5164aa06 drm: Pass a paint node to dmabuf_feedback_maybe_update
The failure reason is already part of the paint node, so passing the view
here just makes things a little bit more complicated.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-04-09 08:40:04 -05:00
Derek Foreman
300c41858c drm: Use surface from paint node in drm_fb_get_from_paint_node
One fewer reasons to keep use the weston_view.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-04-09 08:40:04 -05:00
Derek Foreman
b3d18455dd drm: Change node to pnode in drm_output_prepare_cursor_paint_node
Cosmetic meddling.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-04-09 08:40:03 -05:00
Derek Foreman
dd88c1fddd drm: rename node to pnode in drm_output_try_paint_node_on_plane
Cosmetic meddling.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-04-09 08:40:02 -05:00
Derek Foreman
febd93e4da compositor: Replace view_has_valid_buffer with paint_node_had_valid_buffer
Backends should be relying on paint nodes for their information, not
views.

Since we always have a paint node when we want to pass a buffer, we can
pass that instead of a view.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-04-09 08:39:58 -05:00
Derek Foreman
f4a56f057f drm: Pass paint node to drm_fb_compatible_with_plane
The backends shouldn't care about views as much as they do,
so pass the paint node.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-04-09 08:38:03 -05:00
Derek Foreman
69efa21e08 drm: Pass paint node to cursor_bo_update
This doesn't need anything view related, and we already have the node.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-04-09 08:38:03 -05:00
Derek Foreman
4b7586ea15 drm: Don't test reused states
We shouldn't need to test state, because the state that worked previously
should work again. However, to be completely safe against unpredictable
edge cases, we've kept a state check.

Remove that check and instead force a state rebuild in the case of an
application failure.

Keep track of how often this happens so we can fall back to checking
instead of consistently failing state application.

fixes #1081

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-04-08 08:27:02 -05:00
Daniel Stone
fcb195cbd0 drm-backend: Reuse prior state where possible
If we're in a steady state, doing nothing but flipping buffers, we can
try to avoid going through our full routine of brute-forcing an
acceptable plane state, by instead just reusing the old state and
changing only the FB it refers to.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-04-08 08:27:02 -05:00
Derek Foreman
96e9f4e4ba drm: Remove switch in state-propose
Now that only overlay planes are on the handle list, we can simplify this
code a little bit.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-04-01 13:59:54 -05:00
Derek Foreman
bf16894809 drm: Remove cursor and scanout handles from the plane handle list
Just put the "normal" planes on that list. This will allow for
some simplification later.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-04-01 13:59:54 -05:00
Derek Foreman
8b7e72d8fa drm: Allow building a planes-only state with no primary
Some drivers allow a planes-only state as long as something covers
the entire CRTC, and some allow planes-only state even with only
partial coverage.

If we have an fb that we'd like to put on the primary plane, but can't,
we might as well try it on an overlay anyway and see if we can build a
planes-only state without a primary.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-04-01 13:59:52 -05:00
Derek Foreman
d665061f4d drm: special case the primary plane
While not as weird as the cursor plane, the primary plane's case is
pretty weird. Pull it out of the loop and handle it early.

This is really intended to be a step torwards building a planes-only
output state without a primary plane in it at all.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-04-01 13:58:51 -05:00
Derek Foreman
fe686c9646 drm: Check the cursor plane outside of the plane loop
The cursor code is weird, so let it be weird before the loop
that tests normal planes.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-04-01 13:13:51 -05:00
Derek Foreman
a7e35ddac1 drm: refactor plane tests
Pull out a bunch of the plane check code into a function so we can use it
later.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-04-01 12:32:40 -05:00
Derek Foreman
b7844bc8dd drm: Move fence check before underlay check
There's no need to evaluate these in any particular order, but I'm
going to refactor all the check unrelated to underlays into a single
place shortly.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-04-01 12:32:40 -05:00
Derek Foreman
1f900aa553 drm: Check if underlays are present before trying to use them
Trying to use an underlay will always fail if the output doesn't support
them, so add a quick check here.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-04-01 12:32:40 -05:00
Derek Foreman
7833a01b4d drm: Reword comment in find_plane_for_view
The text can be a bit confusing, so try to clarify it a little bit.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-04-01 12:32:40 -05:00