Assertions have two branches, and the fail branch must never be taken,
so it does not make sense to count them in branch coverage. Ignore all
branches on lines matching weston_assert_ regular expression.
The RE must match from the beginning of the line, hence allow leading
whitespace. This is a Python 're' module usage thing. Unfortunately it
is impossible to pass a backslash in a meson.build file as an argument
to a command[1], so let's use a configuration file.
[1]: https://github.com/mesonbuild/meson/issues/1564
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
When we want to scan out a transparent buffer, but know from the
view/surface opaque regions that it's in fact fully opaque, we can help
the hardware out by naming the framebuffer as opaque.
Unfortunately this optimisation has been unsound for a while now.
Firstly, drm_fb caching makes the optimisation racy. We need to cache
the drm_fb for performance reasons, because constantly mapping and
unmapping buffers from the display controller IOMMU can be
excruciatingly slow. But caching it means that our selection of format
is invariant across the buffer's lifetime; we can take an alphaful
buffer, see that it is currently opaque and map it to an opaque
framebuffer format. If the view later becomes non-opaque, we'll still
try to reuse the opaque framebuffer, which is wrong.
Secondly, modifiers may invalidate the optimisation. The observation
that XRGB and ARGB can be transposed for all(.a == 1.0) only holds true
for linear buffers. Non-linear formats such as AFBC and DCC may have
completely different representations for XRGB and ARGB, so it's unsound
to just flip between the two.
The fix for modifiers would be to make the optimisation conditional on
modifier == LINEAR, but since the fix to the temporal soundness issue
with caching is to delete what's there and maybe rebuild it differently
later, let's just do that for now.
Signed-off-by: Daniel Stone <daniels@collabora.com>
From the bug report:
We observed a significant performance regression on OpenGL ES
2.0 hardware (NXP i.MX8M Mini, Vivante GC NanoUltra) after
upgrading from weston 14 to 15 that glmark2-es2-wayland scores
dropped by approximately 23%.
We bisected this to commit be5c662b ("gl-renderer: Add OpenGL ES 2
support to texture swizzles"). The texture2D_swizzle() function
introduced in fragment.glsl uses dynamic vector component indexing
which is very expensive on ES 2.0 GPUs that lack native support
for it.
When the component re-ordering is identity, avoid the swizzle
index uniform completely by using a shader without it.
Fixes: https://gitlab.freedesktop.org/wayland/weston/-/work_items/1120
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
I've not been able to reproduce this, but have a report that this fires
when running Chromium on aarch64.
It seems plausible that we can get here when none of the subsurfaces have
views, and thus the flag won't be set.
Let's make the assert conditional on having views.
Fixes 6a280a8fFixes#1117
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
It can be useful to know what modifier is being used for a plane's content.
This can mostly be inferred from the paint node dumps in the scene graph,
but that still doesn't tell us what modifiers the renderer's buffer uses.
Dump it next to the format.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This adds two new test files:
alpha-modifier-smoke-test.c: contains tests exercising the mechanics of
the protocol, expected errors for misbehaved clients, etc.
alpha-modifier-test.c: contains tests to ensure that the visual changes
from an alpha modifier surface are working as intended. It exercises all
renderers.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
This function is duplicated all over the test files. This moves it to
weston-test-client-helper.c and removes the duplicated code.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
This adds the boilerplate to support the protocol extension and also
the required changes in core compositor, renderers and backends.
Also, the protocol is now advertised to clients.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
surface_set_opaque_region() currently sets the surface->pending.status
WESTON_SURFACE_DIRTY_BUFFER_PARAMS flag, no matter if the newer opaque
region set by client is the same that we have in the pending state.
Instead, let's compare before raising the flag.
This allow us to reduce a chunk of code from
weston_surface_apply_state(), as it would compare the opaque region of
the pending state with the one currently set in surface->opaque before
dirtying views. Now this is not needed anymore.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
The opaque region hint set by client can be ignored when whole surface
is opaque. In this case, the opaque region is the whole surface. So
start ignoring the opaque region hint in such case.
Also, this moves the surface->is_opaque calculation from
weston_surface_attach() to weston_surface_apply_state(), to the same
block in which we use the client opaque region hint. This move is safe
because weston_surface_attach() sets WESTON_SURFACE_DIRTY_BUFFER_PARAMS
when it would recompute is_opaque.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Paint nodes have a member named view_alpha. In the next commits, this
will be combined with the surface alpha modifier factor. So let's rename
it to alpha.
This also renames view_alpha to paint_node_alpha in our renderers.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Similar to "compositor: replace view->alpha with pnode->view_alpha".
Instead of relying on view->alpha, draw_node_translated() should use the
view_alpha value cached in the paint node.
For now this is just a cosmetic change, but it will be needed when we
add support for the alpha modifier protocol extension in the next
commits. Paint node view_alpha will be renamed to alpha and will combine
the view alpha and the surface alpha modifier factor.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Instead of relying on view->alpha, we can use the view_alpha cached in
the paint node in a few functions. These are functions called after
paint_node_update_early(), where view_alpha gets updated.
For now this is just a cosmetic change, but it will be needed when we
add support for the alpha modifier protocol extension in the next
commits. Paint node view_alpha will be renamed to alpha and will combine
the view alpha and the surface alpha modifier factor.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
In function paint_node_update_early() we compute view_alpha late in the
function, and we have function calls earlier that have to access
view->alpha because pnode->view_alpha would still be outdated.
Compute view_alpha earlier and make use of that in these functions.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
pnode->is_fully_opaque and is_fully_transparent are being computed in
several places in function paint_node_update_early(). Years of new
additions resulted in a code that works but is hard to read and reason
about.
This restructures the code and adds a few comments, making it clearer.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
The wl_subsurface documentation says:
> A sub-surface never has the keyboard focus of any seat.
The previous behavior - a protocol violation - caused subtle
issues in clients such as Chromium >= 144.
Signed-off-by: Robert Mader <robert.mader@collabora.com>
I discovered there are things we can make const, so I decided to do it
all over the place. Having things const has documentary value.
drm_color_pipeline describes the hardware, so most uses of it must be const.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
I discovered there are things we can make const, so I decided to do it
all over the place. Having things const has documentary value.
drm_colorop describes the hardware, so most uses of it must be const.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
I discovered there are things we can make const, so I decided to do it
all over the place. Having things const has documentary value.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
I discovered there are things we can make const, so I decided to do it
all over the place. Having things const has documentary value.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
I discovered there are things we can make const, so I decided to do it
all over the place. Having things const has documentary value.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
I discovered there are things we can make const, so I decided to do it
all over the place. Having things const has documentary value.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
I discovered there are things we can make const, so I decided to do it
all over the place. Having things const has documentary value.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
I discovered there are things we can make const, so I decided to do it
all over the place. Having things const has documentary value.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
I discovered there are things we can make const, so I decided to do it
all over the place. Having things const has documentary value.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Look up underscan settings in weston.ini, validate them, and pass them on
to the compositor.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
For now, we're going to use either margin or underscan properties to
set up a symmetrical underscan - that way we have feature parity no
matter which props the driver supports.
We can orthogonally expose the things margins can do that symmetrical
borders can't later with a centering offset option, if we want to.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
These are a more standard way of configuring underscan. Add the properties
for now, we'll hook them up later.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Grab them from the output and set them if necessary. Since nothing can
set them yet, this will always be off/0 currently.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
When a flip fails we can't re-use the state, so make sure the forced
rebuild flag is set for all flip failures, not just flip failures that
stem from a reuse.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
The code always reports the framerate once the first frame appears
that's 5 seconds or more after the frame we started counting on.
However, this time is not guaranteed to be exactly 5 seconds after we
started counting, yet we were treating it as such.
This patch changes it by updating the start time to 5 seconds after the
last measurement, so that the reported value matches the 5 second
interval and the rest of the time is included in this measurement.
It also restarts counting if too much time has elapsed - likely the
window had been hidden and not received frame callbacks, so the
framerate isn't reliable.
Signed-off-by: Benjamin Otte <otte@redhat.com>
Adds a time_since typedef and _Generic annotator - we can typecast any
timestamp to a time_since for annotation, and the result will be the time
in microseconds between the timestamp and the current time (ie: the time
the annotations are being commit)
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This patch seems to fix the following compiler warning (as error) from
GCC 16.1.1:
../../git/weston/libweston/backend-rdp/rdpclip.c: In function ‘clipboard_process_html’:
../../git/weston/libweston/backend-rdp/rdpclip.c:417:31: error: ‘%08u’ directive writing between 8 and 10 bytes into a region of size 0 [-Werror=format-overflow=]
417 | sprintf(cur, "%08u", fragment_start);
| ^~~~
../../git/weston/libweston/backend-rdp/rdpclip.c:417:17: note: ‘sprintf’ output between 9 and 11 bytes into a destination of size 0
417 | sprintf(cur, "%08u", fragment_start);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../git/weston/libweston/backend-rdp/rdpclip.c:420:31: error: ‘%08u’ directive writing between 8 and 10 bytes into a region of size 0 [-Werror=format-overflow=]
420 | sprintf(cur, "%08u", fragment_end);
| ^~~~
../../git/weston/libweston/backend-rdp/rdpclip.c:420:30: note: using the range [0, 4294967295] for directive argument
420 | sprintf(cur, "%08u", fragment_end);
| ^~~~~~
../../git/weston/libweston/backend-rdp/rdpclip.c:420:17: note: ‘sprintf’ output between 9 and 11 bytes into a destination of size 0
420 | sprintf(cur, "%08u", fragment_end);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This is a false-positive, as the destination is fixed via the hardcoded
HTML header and the offsets into it.
First I thought the problem was with the "region of size 0" and could
not make sense of it. Turns out the warnings were triggered by the
potential of formatting numbers longer than 8 decimal characters.
Ensuring the numbers cannot need more than 8 characters makes the
compiler happy.
If the numbers were more than 8 characters, the header would get
corrupted, and the numbers itself would get corrupted. Hence it seems
prudent to just bail off in that case. Input data is not trusted anyway,
and although unlikely, a 100+ MB blob does seem possible in theory.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
With DECLARE_TEST_LIST(), there is no need for the custom ELF section.
We can use a plain variable to refer to the list of test functions.
This makes the test harness more reliable as we are no longer relying on
internal compiler behavior on laying out objects in sections. This is
also obvious to memory access checkers that the accesses are valid.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Replace TEST() macros with explicit static functions and
DECLARE_TEST_LIST() registration for better type safety and to
prepare for removing the custom ELF section.
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Replace TEST() macros with explicit static functions and
DECLARE_TEST_LIST() registration for better type safety and to
prepare for removing the custom ELF section.
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Replace TEST() and TEST_P() macros with explicit static functions and
DECLARE_TEST_LIST() registration for better type safety and to
prepare for removing the custom ELF section.
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Replace TEST() macros with explicit static functions and
DECLARE_TEST_LIST() registration for better type safety and to
prepare for removing the custom ELF section.
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Replace TEST() and TEST_P() macros with explicit static functions and
DECLARE_TEST_LIST() registration for better type safety and to
prepare for removing the custom ELF section.
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Replace TEST() macros with explicit static functions and
DECLARE_TEST_LIST() registration for better type safety and to
prepare for removing the custom ELF section.
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>