If we might tear, we cannot claim we don't tear.
If we read the software clock, we don't use measurements from the KMS
hardware.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Remove the explicit newline in the log message. Since the log may be wrapped by
the viewer, having the newline in there is not helpful.
While at it, rewrap the string to have shorter lines in the source code.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
Check that the view and region completely cover the whole output.
If the view is (partly) semi-transparent, the background region should
cover the area below it - after the changes in the previous commits.
This allows us to remove the now redundant check in the plane selection.
Signed-off-by: Robert Mader <robert.mader@collabora.com>
In the following commits we want to allow semi-transparent views to go
to the primary plane in more cases, e.g when two (or more) instances of
weston-simple-egl are visible on top of a black background.
In that scenario both/all instances would qualify, resulting in the
first candidate to be picked, accidentally making us use underlay
planes. While the visual result would still be correct wherever
supported by the HW (e.g. on the AMD system I mainly test on), it may
break if only overlay planes are supported. Generally it's an unexpected
and unintended change of the plane selection algorithm.
Thus let's be conservative and only consider the background region for
the last visible pnode (the one with the lowes zpos).
This leaves room for further optimizations in the future.
Signed-off-by: Robert Mader <robert.mader@collabora.com>
The background region only contains visible parts of the region, excluding
any regions obscured by pnodes on top of it. If such (partly) opaque pnodes
have been assigned to overlay planes, we should consider them when checking
whether a view can go to the primary/scanout plane.
Signed-off-by: Robert Mader <robert.mader@collabora.com>
To make use of recent optimizations for the is_fully_opaque
calculation, not only relying on the opaque region any more.
Signed-off-by: Robert Mader <robert.mader@collabora.com>
When we switch to the deferred state, we want to complete all outstanding
repaints first - even ones started from the idle handler immediately
after we called weston_backend_set_deferred().
Fixes#1090
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
When we end up with invalid state, we'll be rebuilding the entire state from
scratch. This new rebuilt state would conflict with any outstanding flips,
so we need to wait until all flips are complete to begin the rebuild.
After we set the rebuilt state, we now have to be careful not to allow any
other outputs to attempt flips until the rebuilt state's flip completes,
or we could provoke an EBUSY from the drm device.
Add a recovery state machine to the drm backend to synchronize all of this.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Backends can end up in indeterminate/invalid state and be unable to
process updates.
Add a way for the backend to tell the core to stop scheduling repaints,
and a way for the backend to schedule all the repaints that should have
taken place during the invalid state period.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
The paint node is_fully_opaque and is_fully_blended properties are overriden
when the paint node is censored or used to clear a hole for an underlay plane,
in which case the paint node is forced to be a solid color.
Those properties need to be recomputed when the paint node solid state changes,
that is:
- when the view becomes uncensored
- before assigning planes; if the paint node was overriden late in the repaint
loop to clear a hole for an underlay plane, those properties need to be reset
early in the next repaint loop to properly compute the visibility of
underneath views.
Signed-off-by: Arnaud Vrac <avrac@freebox.fr>
We seem to initialize the uniform with -1 so check against as the test
branch will actually try to use the supplied matrix (although it is
zero in this case).
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
This seems to cause some misuse of buffer handling especially for cases
where the views are being promoted into HW planes. Vulkan clients seem
to crash at start-up while EGL clients seem to avoid being promoted to a
HW plane after changing window state (fullscreen to non-fullscreen).
Revert the now the change to better understand what is going on.
This reverts commit 119ce40714.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Some minor clarifications that the Lua script can searched in the
current working directory or passed in as an absoluate path.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
CVD correction is composed by a linear transformation, so we should be
able to collapse it into a single matrix multiplication:
Y = M * X
Where Y is the result, X is the original color, and M is the CVD
correction matrix.
As we need to perform CVD correction for every pixel, this can be
beneficial for limited hardware.
In this patch we do that, updating the libweston core code and also the
GL-renderer and its fragment shader.
Suggested-by: Christopher Healy <healych@amazon.com>
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
CVD correction have the following format. These are linear
transformations in which M is a 3x3 matrix and X is a RGB vector.
F(X) = M * X
It is well known that CVD simulation/correction is done using straight
alpha values. So when we have alpha premultiplied values, we compute
straight alpha values first, apply the correction and premultiply by
alpha again. But this is not necessary, as we can see mathematically:
a * F(X) = a * (M * X) = M * (a * X) = F(a * X)
So do not convert premultiplied alpha values to straight alpha values
before applying CVD correction. This saves a few operations per pixel.
Note that the same does not apply to color inversion:
F(X) = 1 - X
a * F(X) = a - a * X
F(a * X) = 1 - a * X
=>
a * F(X) != F(a * X)
Suggested-by: Christopher Healy <healych@amazon.com>
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Commit 008884f28 ("compositor: Move dirty buffer handling to paint node
early update") makes the dirty paint node bit being
cleared in the update early function which makes t too late to check in
the paint node update late where we used to accumulate painted frames.
Just move it before the early update to make we still have a way to
print painted frames counter.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
GCC 14.2 UBSan complained:
../../git/weston/tests/ivi-layout-test-plugin.c:73:15: runtime error:
load of address 0x7fbfd8d70ec0 with insufficient space for an object of
type 'const struct runner_test'
By printing the addresses, I concluded that the mentioned address is the
second element in the plugin_test_section. I guess UBSan believes that
only the first element exists. Why not, what's to tell what data
actually is inside the section or where it actually ends.
Strangely though, we use the exact same section trick in
weston-test-runner.c to iterate through all tests, and that one is
apparently fine. One difference is that weston-test-runner is built as a
static_library() while ivi-layout-test-plugin.c is a shared_library().
Anyway, ivi-layout-test-plugin is unlikely to see any development, so
let's just fix the problem in an ugly way, and get rid of the section
trickery. If someone were to add a new RUNNER_TEST() instance and forget
to add the magic into the index, the compiler would greet them with a
defined-but-not-used error.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
In function ‘drm_fb_maybe_import’,
inlined from ‘drm_fb_addfb’ at ../../git/weston/libweston/backend-drm/fb.c:236:8:
../../git/weston/libweston/backend-drm/fb.c:210:31: error: ‘num_planes’ may be used uninitialized [-Werror=maybe-uninitialized]
210 | for (plane = 0; plane < num_planes; plane++) {
Direct-display is mutually exclusive with having GBM BO, because the
point of direct-display is to not import to GBM. We can use this to make
the logic more provable to the compiler, and be more obvious about the
expectation to the human reader.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
{width,height}_from_buffer include the transformations from set_buffer_transform
and set_buffer_scale.
Currently {width,height}_from_buffer are only updated when a commit contains a
new buffer but not for commits with only transformation changes.
If a transform/scale change is commited without new buffer, the old values
remain, which results in incorrect rendering or the client is disconnected
because weston_surface_is_pending_viewport_source_valid() fails.
Make sure to update {width,height}_from_buffer for transformation changes only
to avoid this.
Add a test to verify that the transformations are handled correctly. It is
identical to previous test, except that is spits the buffer attachment and
transformation changes into two commits. So it can reuse the existing images for
validation.
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
In handle_touch_up, check whether the associated output is NULL before calling
notify_touch. This prevents unnecessary logging of "Unmatched touch up event
on seat" when a touch device is not bound to any output, as the absence of an
output is already handled gracefully in handle_touch_with_coords.
Signed-off-by: liang zhou <liang.zhou@gehealthcare.com>
We used to state that backgrounds are 0xAARRGGBB format, then we stopped
because alpha on a background is bad.
However, to get a black background we need a value other than 0, or the
shell just treats it as "no background color" and can use a default image
instead.
Explain how to describe a black background.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
We'll be rebuilding state assuming it's all broken, so we should probably
avoid the reuse path as a precaution.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This fixes a huge bug: we were ignoring the return value from
verify_screen_content(), which meant that tests were always passing.
Also, this adds tests for single-pixel solid color buffers, which are
useful to verify that color effects are actually applied in such cases.
Renderers (as the GL-renderer) may simply use glClear() instead of going
through the full rendering pipeline when drawing solid colors, and we
need to ensure that color effects are applied in those cases as well.
Besides that, some refactoring was done to improve the code.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
When repainting a paint node, if the buffer is a solid color buffer we
may skip the rendering pipeline and directly call glClear() with the
solid color, for optimization purposes.
Currently there's a bug where if the output has an output color effect
set, it is skipped when we have a solid color buffer (as we don't go
through the rendering pipeline, where the effects are implemented).
When we have color-management and the paint node contains a color xform,
we've opted for skipping this optimization and going through the
rendering pipeline for now. However, output color effects are simple,
so let's add the logic to apply them on CPU when we have a solid color
buffer.
Reported-by: Christopher Healy <healych@amazon.com>
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
This avoids hitting the assert that we don't have any paint nodes in
available when the repaint loop starts.
As we only have just a single curtain, in multi-head/outputs case a new
output creation will destroy the previous curtain and we'll end up
hitting the empty paint nodes assert.
Note that this doesn't add any functionality it just makes sure we're actually
capable of running the lua-shell rather than dying.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
When moving the views between two outputs, the view's paint node is
removed from an output's z order list, but no paint_node_changes are set.
The drm-backend uses paint_node_changes to determine if it can reuse state,
so could leave a stale image behind on a plane until something else
triggered new state generation.
Make z_order_link removal dirty the paint node changes to prevent stale
state reuse.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
commit-timing uses presentation feedback to drive its repaint loop, no
need to keep the frame callback.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Users might start the compositor with the scene-graph debug scope which
requires having the clock set-up as implicitly one of the backends needs to be
loaded.
Just avoid doing that until we have one the backends loaded to prevent
a start-up crash.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
This seems to cause a lot of stir in CI as it was failing for half of the
time.
Mark the test as succeeding for now and include the Mesa assert crash to
follow-up. We use that instead of SKIP to we have
WESTON_TEST_SKIP_IS_FAILURE.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
The protocol requires clients to perform an initial commit before they
receive configure events:
> After creating a role-specific object and setting it up (e.g. by sending
> the title, app ID, size constraints, parent, etc), the client must
> perform an initial commit without any buffer attached. The compositor
> will reply with initial wl_surface state such as
> wl_surface.preferred_buffer_scale followed by an xdg_surface.configure
> event. The client must acknowledge it and is then allowed to attach a
> buffer to map the surface.
Previous to this patch various calls such as set_fullscreen() or
set_maximized() would schedule configure events, resulting in clients
being able skip the initial commit. This again made it possible to write
clients that only work on Weston, in violation of the protocol.
For xdg-popups we already tracked the initial commit status. Move it
to xdg-surface, guard schedule_configure() on it and ensure to run the
later on the initial commit.
Incorporate tests that checks if we get configure events when calling
set_fullscreen/set_maximized and tests that uses the main xdg_surface as
a parent to a sub-surface (which initially triggered this issue).
Signed-off-by: Robert Mader <robert.mader@collabora.com>