Commit graph

3175 commits

Author SHA1 Message Date
Robert Ancell
f41430a4eb Check positioner anchor and gravity enums
Signed-off-by: Robert Ancell <robert.ancell@canonical.com>
2026-05-13 16:50:37 +03:00
Derek Foreman
160394b2c3 trace: Use generics to allow flows in const structs
The flow_id set code obnoxiously wants write access to the flow_id always,
which can lead to situations where we can't pass a struct as const to
appease the perfetto code.

Now that we're embracing C generics, we can tell if a struct is const,
update the flow if it's not, and assert if we don't have a valid flow_id
when it is.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-05-13 15:27:51 +03:00
Derek Foreman
ae26cde4f6 compositor,renderers: Store a pointer to the view transform in pnode
This pointer is the same for the life of the view, even if the matrix
changes.

This is a last pedantic step towards preventing renderers from directly
accessing a weston_view.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-05-13 11:20:58 +03:00
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
e05b1e210c color-lcms: properly map power-law curves to tf
Before checking if our LittleCMS curve matches any of our known tf, we
need to map it to one of our well-known LINPOW or POWLIN.

We were doing that, but setting only the g param of the curve. a, b, c,
and d were not being set, resulting in a mismatch when comparing the
curve parameters with the ones in our tf's. As we were not finding any
match, we were always mapping the LittleCMS power-law to the parametric
power-law tf, even if the exponent was 2.2 or 2.4 (which have their own
tf's).

Now we properly set all the parameters before doing the check.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2026-05-13 10:21:33 +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
916a7b499a gl-renderer: change len_shaper and len_lut3d to uint32_t
Fix accidental use of float values for LUT's length.

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
0729bbc551 color: add KMS colorop 1D curves to tf_info
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
Derek Foreman
2e07871e88 trace: Use an unsigned char for the annotation type
This brings the array entry size down to 24 bytes, and we do allocate a lot
of them.

I've lazily fixed a tabs vs spaces style issue at the same time.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-05-12 11:25:19 -05:00
Derek Foreman
a8d6a3ead5 trace: Have single macros for funcs with annotations
Make both a WESTON_TRACE_ANNOTATE_FUNC_FLOW and a
WESTON_TRACE_ANNOTATE_FUNC() that do the preamble, add the annotations,
and flush it out in a single "statement".

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-05-12 10:48:42 -05:00
Derek Foreman
099e4724e6 trace: Add annotations for solid buffers
Added as an example of adding another layer of nesting, to show
the entry point for the Generic (which has no parent), and
a helper function for nesting inside another structure.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-05-12 10:48:42 -05:00
Derek Foreman
0fd4c20660 trace: Add namespaces to keys and use it for weston_buffer
We now track the size of the key string, as well as allow adding empty
"container" annotations that are just a name for nested storage.

When parents are present, the full key name is created by walking them
and prepending them to a string backwards.

Use this to implement a buffer annotation helper and use it in the one
place we're already logging a buffer.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-05-12 10:48:39 -05:00
Derek Foreman
e1200eec22 trace: Add a max size for the key
Not sure we'll ever hit this, but since we're concatenating strings into
a static sized buffer I suppose it's useful to ensure it won't have an
unreadable result.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-05-12 09:22:12 -05:00
Derek Foreman
d8e6906563 trace: Only add to annotation array if we're tracing
Saves some effort when we're not tracing - but if we start tracing in
the middle of creating an annotation it could be missing a couple of
fields.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-05-12 09:22:12 -05:00
Derek Foreman
b4df8bd9e5 trace: Move assertions into individual annotation functions
The int, string, and float annotators will become our atoms when we
start logging larger structs. The functions for complex annotations
will call these many times for a single annotation.

So we should assert in the int, string, and float annotators before
adding there, so the big functions are implicitly checked.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-05-12 09:22:11 -05:00
Derek Foreman
f5f6989a65 trace: Put annotations in a separate file
For now just the three we have, but we'll be adding a bunch of complex
annotations, so having their own place will be cleaner.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-05-12 09:20:38 -05:00
Derek Foreman
6748ed6b57 trace: Add multiple annotations with a single macro
Use recursive macro magic to make a single ANNOTATE macro that processes
a list of annotations.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-05-12 09:20:38 -05:00
Derek Foreman
31ee8848e2 trace: Use generics to simplify annotation usage
Use C's Generic() functionality to make all the annotation usage have a
single entrypoint.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-05-12 09:20:38 -05:00
Derek Foreman
fdb60a480c trace: Put the annotation count inside a struct
This will make it easy to pass the count and annotations at the same time
later when we have complex groupings of annotations.

While we're doing this, make the count an unsigned char instead of an int,
because we'll never have that many.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-05-12 09:19:14 -05: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
Daniel Stone
8168ca3d3e vulkan-renderer: Fix external-queue sync in repaint
When we're performing a queue-family ownership transfer to a foreign
device, we need to transition to GENERAL (because we have no PRESENT_SRC
when we're operating on dmabufs) from the colour attachment stage before
display reads, and we need to transition back to OPTIMAL before the
colour attachment stage.

As external queues have no stage ordering, we use BOTTOM_OF_PIPE to
indicate that we want to synchronise against everything the external
queue may do. For the internal queue though, we don't need to serialise
vertex/tiler work against the layout transition for the colour buffer,
just the work which requires access to the colour attachment.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2026-05-12 13:54:37 +01:00
Daniel Stone
eab8d5e71f vulkan-renderer: Take queue indices in layout transitions
The only differences between this helper and
transfer_image_queue_family() is that this took all the flags apart from
queue indices, and QFOT took none of the flags apart from queue indices.

To make the QFOT case correct, we have to pass almost all the stages and
flags in, so we might as well just use a single helper. Add queue
indices to this helper, which is a no-op for now.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2026-05-12 13:54:37 +01:00
Daniel Stone
730492c8ca vulkan-renderer: Fix stages for sync in texture upload
When we're uploading data to a texture, the hazard we're protecting
against before upload is ensuring reads from the fragment shader are
complete before writes from the transfer queue begin. The
synchronisation after the buffer -> image copy was correct.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2026-05-12 13:54:37 +01:00
Daniel Stone
367731e8b7 vulkan-renderer: Fix stages for sync in create_swapchain
Fix the stages for image-layout transitions to initialise UNDEFINED
images we're going to use for our swapchain.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2026-05-12 13:54:37 +01:00
Daniel Stone
c486055e03 vulkan-renderer: Fix stages for sync in read_pixels
When we're reading back from a framebuffer, we need to sync from
fragment-shader output (i.e. after the final pixels are written to the
framebuffer) before we copy away from it, and sync to fragment-shader
(i.e. before any output touches the framebuffer) before we reuse it
after the copy. The latter is a no-op as we currently do a complete
vkQueueWaitIdle() after read_pixels(), but it removes a future footgun.

Fixes occasional fixes seen in screenshot testing.

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
Marius Vlad
3bd0367970 xdg-shell-v6: Deprecate in favor of xdg-shell stable
For obvious reasons, use xdg-shell stable, most of the issues resolves
adding the same functionality or fixing bugs as we do it with the stable
xdg-shell version.

Deprecate it prior to removal to warn users about using it.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2026-05-08 13:02:13 +03:00
Marius Vlad
f4ba4f49bb renderer-gl: Add Perfetto debug annotations for shader configs
This adds Perfetto debug annotations for printing optimizations, color
vision deficiencies, alpha.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2026-05-05 08:59:21 -05:00
Marius Vlad
b43cc0a5d4 renderer-gl: Add Perfetto debug annotations
This adds Perfetto debug annotations for printing and paint (damage,
blended, opaque) regions.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2026-05-05 08:59:21 -05:00
Marius Vlad
9a708994d5 renderer-gl: Don't compute rects if log scope is not enabled
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2026-05-05 08:59:21 -05:00
Marius Vlad
64ef093397 libweston: Add Perfetto debug annotation for buffer info
This adds annotation at surface attach time.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2026-05-05 08:59:21 -05:00
Marius Vlad
940a2b03d9 libweston: Introduce Perfetto debug annotations
Introduce a bunch of helper macros and flush function that allow in-situ
debug annotation of Perfetto tracks.

This introduces a STR, INT and FLOAT variants to stack debug annotations
into a temporary array and have COMMIT to push that to Perfetto.

There's a maximum imposed limit of 128 entries in the array. Users
shouldn't be concerned with allocating char string arrays as COMMIT will
basically flush all the data in the temporary array to Perfetto.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2026-05-05 08:59:21 -05:00
Marius Vlad
414e85c22d renderer-gl: Be consistent with Perfetto regarding GPU activity
Rename 'timeline' to  'activity' and 'elapsed' to
'active'.

Feels like this it would more familiar to people when analysing
traces and uses the Perfetto naming for consistency. Otherwise I'd
rename 'activity' to 'timeline' for Perfetto track names.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2026-05-05 08:59:21 -05:00
Derek Foreman
e17a219885 renderers/clients: Bump gbm version requirement to 21.3
Drop support for libgbm versions without gbm_bo_create_with_modifiers

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-05-04 12:00:10 -05:00
Marius Vlad
689f6bd9ba renderer-gl: Improve accurancy when printing elapsed time
This avoids truncation to zero, by using an explicit cast to float and
print out properly the last 2 digits.

43 / 1000 = 0.00
43 / 1000.0 = 0.04

Fixes: 2d70cbf037

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2026-05-01 15:39:21 +03:00
Marius Vlad
4e596fca83 renderer-gl: Fix duplicated begin/end timestamps
Fix trivial typo when printing out GPU timeline timestamps.

Fixes: 2d70cbf037

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2026-05-01 15:29:08 +03:00
Derek Foreman
54a25720c6 compositor: Give paint nodes their own flow id
Since a paint node is a combination of surface, view, and output, using
the surface flow in paint node functions can make a confusing twisty mess.

Perfetto flows have in/out degree of one, so we can't properly express the
1 surface to multiple paint nodes relationship with flows.

So for now let's break up the surface and paint node flows, but in the
future we'll have better ways to map multiple flow starts to the same
function via INSTANT events, and we'll be able to better link surface
content update to paint node render.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2026-04-29 10:10:08 -05:00