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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
This adds Perfetto debug annotations for printing optimizations, color
vision deficiencies, alpha.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
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>
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>
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>
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>
The Damaged event is the result of a content update application on a
surface. So it makes sense to put this in the flow for the surface.
The Clean event comes from a render completion that could be driven by any
surface, so it doesn't really make sense to consider it part of surface
flow.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
A few custom shells want to know when the compositor is going to sleep.
This adds a new sleep signal and emits it when DPMS is going off.
To showcase the feature, this adds a sleep signal listener to
desktop-shell whose handler logs a message.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
When we receive dmabuf feedback, we hit the VK_SUBOPTIMAL path and
recreate the swapchain, returning early without submitting work.
However, we've already reset the fence before we do this, so we'll
block forever waiting for work that never comes to signal it.
Instead, we should reset the fence right before we know we're submitting
work.
Fixes: 75c37afa ("clients/simple-vulkan: New Vulkan client example")
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
We currently leak resources and hit asserts if dmabuf is unavailable.
Move the check to before we initialize anything.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Since the commit "color-lcms: extract HDR static metadata from profile"
this was all dead code.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Extract the HDR static metadata type 1 from the output color profile
directly, instead of relying on a separate weston.ini section to provide
the metadata separately.
Weston should tell the monitor what target color volume it is rendering
for. I don't see a reason to be able to control the metadata separately,
and it would add complexity.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
We should just return 0 on success, not return some enum with
a value that happens to be initialized to something that resolves
to 0.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
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>
The point of buffer_transform_split is to ensure that committing only
transform and scale changes gets reflected on screen, without explicit
damage. There is no need to go through the big set of parameter
combinations, it only needs to test that changing each triggers the
damage.
Test setting only scale and only transform separately, so that one
cannot mask bugs with the other.
This brings the screenshot count for buffer_transform_split from 12 down
to 2, which is good for CI running time.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This test was originally written to ensure Weston does not repaint too
much, but it does also test that renderers transform the damage
correctly into the framebuffer.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Continuing my quest to remove weston_view from backends and renderers,
drop gl-renderer's last use of weston_view.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>