This introduces a new .ini config option: output-straight-alpha. It's
currently only supported by the headless backend, and it forces
renderers to produce straight alpha framebuffers for headless backend
outputs.
For now, only the GL renderer supports creating straight alpha
framebuffers (the support was introduced in "backend-drm: add support
for KMS devices with only coverage blend mode").
This is useful mostly for testing, and the main motivation to add such
support in our DRM-backend and GL-renderer was to be able to support KMS
devices that only supports straight alpha framebuffers.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
The majority of KMS devices support pre-multiplied encoded framebuffers.
But a few of them don't. This adds support for such devices.
In-shader blending is required for this, and it shouldn't work on
devices that don't support it. For now this works only with the
GL-renderer.
Note: this should never work with test quirks
gl_force_full_redraw_of_shadow_fb and blending_impl ==
WESTON_BLENDING_IMPL_FF.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
In setup_shader_blending_or_shadow(), we can have a test quirk forcing
usage of in-shader blending. But not all devices support that.
Weston currently handles this by skipping the test on these devices
rather than taking the failure paths in
setup_shader_blending_or_shadow(). Otherwise, people would not be able
to locally run the test suite on devices that don't support in-shader
blending.
After deciding to skip the test, simply return from the function instead
of falling back to shadow buffer usage. Neither in-shader blending or
shadow buffer are going to be used, as
weston_compositor_exit_with_code(RESULT_SKIP) was already called.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
In function setup_shader_blending_or_shadow(), needs_shadow is a hard
requirement, while needs_fb_curves isn't.
When needs_fb_curves is true, we try to create an in-shader blender
(which makes use of fb curves) and, if that fails, we fallback to a
shadow buffer (avoiding fb curves completely).
The term "need" makes things a bit confusing, as the fallback path is
allowed. So rename needs_fb_curves to has_blend_to_output, making the
fallback path more natural.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
No behavior changes.
Function gl_renderer_output_create() currently has a bunch of code to
setup an in-shader blender or a shadow buffer. This moves such code to a
specific function setup_shader_blending_or_shadow(), improving
readability.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Before "backend-drm: add support for blend mode plane property", we had
no way to specify the blend mode for a plane on Weston, so we'd always
use the default one (PREMULT).
Instead, let's choose BLEND_MODE_NONE if possible (opaque content),
allowing the KMS driver to skip blending and being more efficient.
We add the support for using BLEND_COVERAGE in the next commits.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Let's follow the code design of the other properties: init them with
_DEFAULT. In the setter function we ensure they are >= 0 and < COUNT,
just like we do with other properties.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Add an assert macro to check that two enums are not equal. Also adds the
respective test_assert_enum_ne().
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
In next commit we'll add weston_assert_enum_ne(), so let's rename the
existing weston_assert_enum() to weston_assert_enum_eq() to make the
names consistent.
This also renames the test asserts (test_assert_enum() to
test_assert_enum_eq()).
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Allow width and height to be different than the real screen size
when performing a writeback screenshot.
If the writeback device automatically scales to buffer size, this
will let us use that feature.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Firefox and EFL applications use surface commits with no state change other
than a frame callback.
The dirty-bit based repaint skipping optimization in commit
73e0bb2829 stopped that from working.
Add a new dirty bit for frame callbacks so these clients schedule something
to fire the callback again.
Fixes 73e0bb2829Fixes#1114
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Drop the open-coding of plane_add_prop() in
drm_color_pipeline_program().
The debug print ordering changes, but one can see the beginning of the
colorops in the pipeline by looking for the colorop whose ID gets
programmed into WDRM_PLANE_COLOR_PIPELINE.
struct drm_plane::pipeline_props_id becomes unused and is removed.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
The values were printed as "name (hex)", but the property IDs were
printed as "dec (name)". This started to look really funny with the enum
names.
Let's just do "prop-name (raw id) -> fancy-value (raw value)" instead.
Looks much nicer.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Simplify the code by calling colorop_add_prop() directly. The reported
error details remain the same.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This allows to use colorop_add_prop_enum() for WDRM_COLOROP_CURVE_1D,
reducing the code complexity.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Enforcing the colorop, that is, ensuring it is not bypassed, is common
to all colorops, so we can pull it into front.
The aim is to get rid of colorop_program(), because it assumes that
every colorop has only one property to program. This makes using
colorop_add_prop_enum() difficult.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This is a specialized alternative to colorop_add_prop() for setting
enumerated property values. The debug print will print the value name
which helps humans to make sense of it.
set_interp() is replaced with this, colorop_add_prop_enum() does the
same checks and more while not being any less type-safe.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This is a specialized alternative to plane_add_prop() for setting
enumerated property values. The debug print will print the value name
which helps humans to make sense of it.
This corrects an UAPI confusion by doing a proper dynamic mapping
from property strings into integers used in the KMS UAPI.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This is a specialized alternative to connector_add_prop() for setting
enumerated property values. Using it will save some code in the callers
and the debug print will print the value name which helps humans to make
sense of it.
The bounds checking is concentrated into the new function too.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
drm_plane_state_duplicate() currently shallows copy the pipeline_state
pointer. The problem is that later the duplicated plane_state gets
destroyed, and it ends up destroying the color pipeline state as well.
So let's ref count to the color pipeline state in
drm_plane_state_duplicate(), avoiding use-after-free crashes.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
And also rename drm_color_pipeline_state_destroy() to unref().
In the next commit we'll make use of this. For now this has no behavior
change.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Add `--disable-drm-state-reuse`, forcing a DRM state rebuild on every
frame. This can be handy in for debugging with `weston-debug
drm-backend`.
In order to disencentivize usage as a workaround in case of bugs,
require `--debug` to be enabled as well.
Signed-off-by: Robert Mader <robert.mader@collabora.com>
This is for configuring the 'color format' DRM connector property.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
This is the last part to support the 'color format' DRM connector.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Signed-off-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Set up a few different image descriptions on the output, and ensure that
the protocol delivers them as output and surface-preferred image
descriptions correctly.
Expands test coverage. Found one existing bug fixed by
"color: fix sending power TF exponent".
I was lazy, and did not bother checking the ICC file contents.
This prepares for testing the surface-preferred parametric image
description, but first it will need the compositor implementation.
The config file formatting should be useful for future color managed
screenshot tests.
There is no need to test all the feature and rendering intent
advertisements, that's done in color-management-protocol-test.c and
protocol errors should catch lack of support anyway.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
It will be nice to have an arbitrary but proper ICC profile for testing
ICC profile loading.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
image_description_info_destroy() closes it, and we might want to inspect
the fd in a test. Do not close it on 'done' event.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Claim all renderer capability flags. Whether the renderer actually
implements these or not cannot be discovered, because the no-op renderer
never produces an image that could be checked.
I leave explicit sync out, because I believe that would need some stubs
to create phony fences that are externally observable.
With these flags, color management protocol tests won't need to
initialize GL-renderer.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
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>