When the destroy signal is fired, child views will disassociate
themselves from the parent. This means that we can no longer see what
the child views are - and that recursive unmapping does not work.
Make sure that views are fully unmapped before anything else happens in
destroy, so we can recursively unmap child views.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Make sure that in a 1 -> 2 -> 3 -> 4 parent->child subsurface nesting,
destroying surface 2 also immediately unmaps 3 and 4.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Per the wl_subsurface spec:
A sub-surface becomes mapped, when a non-NULL wl_buffer is applied
and the parent surface is mapped. The order of which one happens
first is irrelevant. A sub-surface is hidden if the parent becomes
hidden, or if a NULL wl_buffer is applied. These rules apply
recursively through the tree of surfaces.
[...]
If the parent wl_surface object is destroyed, the sub-surface is
unmapped.
The terminology is kind of loose. My reading of this is that we should
'unmap' (hide from display, remove from input/focus consideration, etc)
a subsurface immediately when a parent is destroyed.
However, if the child surface is then paired with another parent which
is itself mapped, then the child surface should immediately be mapped,
because it has a non-NULL buffer already applied, and the parent surface
is mapped.
By marking the surface as 'unmapped' on parent destroy, we were removing
it from the scene graph, but also I think breaking the rules on mapping
by requiring another commit when it was reassociated with another,
already mapped, surface.
Removing the explicit surface unmap leaves the surface in the 'mapped'
state, but without any views, which I believe has the intended effect.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Quoth the spec:
A sub-surface becomes mapped, when a non-NULL wl_buffer is applied
and the parent surface is mapped. The order of which one happens
first is irrelevant. A sub-surface is hidden if the parent becomes
hidden, or if a NULL wl_buffer is applied. These rules apply
recursively through the tree of surfaces.
We currently apply this rule through reconstructing the view_list at
repaint time, materialising new views and garbage-collecting unwanted
views as appropriate. Since this can be a costly operation, it's best if
we move this closer to the source.
This makes the core recursively unmap any child views when the parent is
unmapped. Future commits will do the same for mapping new views.
Signed-off-by: Daniel Stone <daniels@collabora.com>
View transform parents can be set by anyone. parent_view, on the other
hand, is only set for subsurfaces.
Signed-off-by: Daniel Stone <daniels@collabora.com>
This is heading towards being able to materialise subsurface views
closer to the source. weston_view_create() - being used only by
window-management code - will ultimately create all required subsurface
views as well. The internal variant will be used by this and also by the
subsurface code as required.
Signed-off-by: Daniel Stone <daniels@collabora.com>
This indicates that more than just the content changing, the form of the
buffer has changed in a way which may not be like-for-like to the
previous buffer but require significant reinterpretation. Examples
include the format, opacity, colour state, etc.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Both wl_surface.damage and wl_surface.damage_buffer explicitly refer to
the 'pending buffer'. wl_surface.attach states that there is no pending
buffer after the commit is processed, so it follows that a commit which
includes damage but no attach will not process any damage.
Change surface-commit processing to ignore all damage unless a buffer
was attached in the same commit cycle.
(Thanks to @pH5 for his spec analysis which I've just paraphrased here.)
Signed-off-by: Daniel Stone <daniels@collabora.com>
Instead of having a bool for whether or not a buffer has been attached
in this commit cycle, use a status bitmask.
Signed-off-by: Daniel Stone <daniels@collabora.com>
The only time we need to go through recalculating the surface size is
when either the buffer dimensions or the surface transforms have
changed. Now that we have dirty flags, use them to avoid a calculation
where required.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Instead of passing an output to weston_compositor_build_view_list(),
have it set up all the output z_order_lists at once.
This is a preamble for MR !1285 which wants to maintain a compositor
wide dirty bit for the view list.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Moves the output specific stuff into one place, after the view_list is
already properly set up.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
A video mode change would be needed to change the underlying renderer
framebuffer. All other backends make uses of this so let's do it for the
DRM-backend as well.
This would also be needed for the output capture to function properly as
we need call weston_output_update_capture_info() when a new mode set has
set. Otherwise we'd run into mismatched dimensions for the current mode
versus the dimensions set-up initially in weston_output_capture_source_info.
Signed-off-by: marius vlad <marius.vlad@collabora.com>
The list of client breakpoints was used for both client tests and plugin
tests - anything that uses the weston-test module - but was only
initialised in the client-test path. Make it unconditional.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Fixes: efde2fa0b1 ("tests: Add client<->compositor breakpoint support")
Turn the Pixman/GL if/else conditionals into switch cases to make it
easier to add support for other renderers in the future.
Also makes sure that weston --backend=wayland --renderer=noop fails
with an error message instead of segfaulting.
Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
This is a very simple test, mostly intended as a demonstration of the
new client<->compositor breakpoint infrastructure. It ensures that for a
simple test surface, a paint node has been created in the output's
paint-node list, reflecting the properties of the attached buffer.
This is an example of properties which are not observable by regular
clients.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Add support for clients to request the server insert breakpoints at
various points in its processing. These breakpoints are handled
internally by semaphores (visible to tests through helpers): when the
server reaches the specified point, it will pause execution until the
client allows it to restart.
A weston_compositor pointer returned at each breakpoint allows the
client to reach across the thread boundary and access the server's
internal data structures. This can be used to, for example, inspect
paint nodes, internal damage, or any other work which is not necessarily
client-visible.
The majority of tests will not need to use this infrastructure; it is
only intended for tightly-coupled tests which can very specifically
dictate and anticipate the server's execution flow.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Keep a tracking set of every weston_output created by the compositor,
and use this to listen to the repaint signal.
This currently does nothing, but will later be used to listen to repaint
signals as a client breakpoint type.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Make sure every test handler now gets a copy of wet_testsuite_data,
which we'll later use for client<->compositor synchronisation.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Currently we have some device tests which run in a single iteration
once, then in lots of iterations after that.
The single-iteration case is useless, so remove it, which has the happy
side effect of not breaking when we change the test signature.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Apparently the old behaviour was to silently succeed if program execution
failed. Setting check: true not only avoids a Meson deprecation warning
for not passing it, but gives us a more clear indication what goes on
when, e.g. breathe doesn't run.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Turn the Pixman/GL if/else conditionals into switch cases to make it
easier to add support for others renderer in the future.
Also makes sure that weston --backend=x11 --renderer=noop fails
with an error message instead of starting with the GL renderer.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
There are some cases in which we are seeing segment breaks like this in
the debug scopes: (0.00, 0.00]. A segment whose domain goes from 0 to 0
makes no sense.
This happens because we are printing the breaks with only two decimal
places. Increase that to four, in order to have more accurate
information in the debug scopes.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
There's a case we were missing when printing the tone curves: the ones
with zero segments.
These are 16-bit sampled curves. Start taking them into account.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
If backend initialization fails, weston_compositor_shutdown() is called
twice, once right away in weston_compositor_load_backend(), and once in
weston_compositor_destroy().
Remove the first and fix a segfault when trying to weston_plane_remove()
the primary plane a second time.
Fixes: 90c11cf40e ("libweston: move weston_compositor_shutdown call out of backends")
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
This will help us to debug our color pipeline optimizer without the
need to craft special ICC profiles for that. In this initial patch,
we are able to add matrices and curve sets to the pipeline and assure
that the optimizer is doing the right thing.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
At the moment, when we merge two curve sets it becomes a sampled one.
With this change, we start merging power-law curve sets and keeping them
as parametric, as we'd rather have a parametric curve than a sampled
one.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
At the moment, when we merge curves we transform them into sampled
curves, even if they were parametric before.
If we have two inverse parametric curve sets in sequence in the color
pipeline, we can drop them both, as merging them would result in the
identity curve. If we don't do that and merge the resulting identity
with another curve set, we'll end up with a sampled curve.
Start dropping inverse curve sets in sequence. This change help us in
the following scenarios:
pipeline:
curve set A, curve set B (inverse of A), curve set C (parametric)
Merging A and B results in identity, and merging that with C results in
a sampled curve. With our changes, we end up with curve set C intact,
and we'd rather end up with a parametric curve than with a sampled one.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Move code that depend on cmsGetToneCurveSegment() to a new file:
color-curve-segments.c
This help us to eliminate #if HAVE_CMS_GET_TONE_CURVE_SEGMENT scattered
around color-transform.c, making the code clearer and helping to avoid
mistakes.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
clang 17 complains that `fourcc` in `gl_renderer_fill_buffer_info()` is
uninitialized in the default case, because it fails to recognize that
if hit, that case will `assert(0)`. To get rid of this complaint, we can
just apply clang's suggestion and initialize the variable with 0 when
declaring it.
Signed-off-by: Max Ihlenfeldt <max@igalia.com>
We already only conditionally use base.offset when an icon exists. We
should also avoid trying to create a coordinate with a NULL icon, as it
will fire an assert().
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
The event-test moves a client off of all the outputs to check for an
output leave event, but our move_client() code waits on a frame callback
to continue.
The fact that weston currently generates this frame callback is not
something we should enforce in a test, as it could (should) change in
the future.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Ever since commit 3012934 some rotations have been broken. This is because
I transposed xy and yx in the cairo_matrix_init() call.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
If we want to support multiple backends, the compositor must take care
to call this once, at the appropriate moment, so stop letting the
backends handle compositor shutdown themselves.
Move the weston_compositor_shutdown() calls from the backend::destroy
callbacks into weston_compositor_destroy() and the calls in the backend
creation error paths into weston_compositor_load_backend().
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Add a weston_backend::shutdown callback to split out the part of
weston_backend::destroy that needs to be done before compositor
shutdown.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Before this patch, we would leak the drm_output if there was a pending
flip during shutdown.
Now we destroy the drm_output even if there's a pending flip (only
during shutdown, as we don't want to wait until flip completion to
destroy the output).
Also, it fixes a problem where weston_output_enable() is called right
after weston_output_enable() or weston_output_disable() and it could
fail to find available DRM objects (as they are only released after
the flip completion).
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>