Without this fix, we have randomly been getting CI failures due to
LeakSanitizer itself crashing after all the tests in a program have
succeeded. This has been happening randomly for a long time, but
https://gitlab.freedesktop.org/wayland/weston/-/merge_requests/1486
made it very reliably repeatable in the job x86_64-debian-full-build
(and no other job) in the test-subsurface-shot program.
--- Fixture 2 (GL) ok: passed 4, skipped 0, failed 0, total 4
Tracer caught signal 11: addr=0x1b8 pc=0x7f6b3ba640f0 sp=0x7f6b2cc77d10
==489==LeakSanitizer has encountered a fatal error.
I was also able to get a core file after twiddling, but there it ended
up with lsan aborting itself rather than a segfault.
We got some clues that use_tls=0 might work around this, from
https://github.com/google/sanitizers/issues/1342https://github.com/google/sanitizers/issues/1409
and some other projects that have cargo-culted the same workaround.
Using that cause more false leaks to appear, so they need to be
suppressed. I suppose we are not interested in catching leaks in glib
using code, so I opted to suppress g_malloc0 altogether. Pinpointing it
better might have required much more slower stack tracing.
wl_shm_buffer_begin_access() uses TLS, so no wonder it gets flagged.
ld-*.so is simply uninteresting to us, and it got flagged too.
Since this might have been fixed already in LeakSanitizer upstream, who
knows, leave some notes to revisit this when we upgrade that in CI.
This fix seems to make the branch of
https://gitlab.freedesktop.org/wayland/weston/-/merge_requests/1486
in my quick testing.
Suggested-by: Derek Foreman <derek.foreman@collabora.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
(cherry picked from commit 3179e0f0e0)
This prevents a potential crash where users of
weston_layer_entry_insert/layer_entry_remove() would see when moving
views into a NULL layer (effectively unmapping the surface/view).
Users that have migrated to the weston_view_move_to_layer() are immune
to this issue because that takes care of paint node destruction.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
(cherry picked from commit 2d3cca3d3e)
The fullscreen should take precedence if the client requests both
window states at the same time.
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
(cherry picked from commit 5dbf96fb6c)
The shell_surface may disappear when keyboard lost focus,
then the shsurf will be NULL.
Have an ahead check for shsurf before calling the callback
in weston_desktop_surface_foreach_child.
Fixes#811
Tested-by: Erkai Ji <erkai.ji@nxp.com>
Signed-off-by: Wujian Sun <wujian.sun_1@nxp.com>
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
(cherry picked from commit 042d02f422)
Just like we already do for planes with proper zpos. Otherwise we'll
often end up choosing the primary plane instead of an overlay one
in `drm_output_find_plane_for_view()`.
Signed-off-by: Robert Mader <robert.mader@collabora.com>
(cherry picked from commit e34e027515)
If a view is non-opaque - such as an overlay over a video - we shouldn't
force it to be on the primary plane, as that's where the underlying
content should be placed, such as the video view.
dc0de9ee already mentioned: "This check should be changed in future to
only filter for opaque views, but that's for another time."
Adding "Fixes" at this is arguably a bug fix:
Fixes: dc0de9ee (backend-drm: Move overlay vs. primary plane check earlier)
Fixes: 2538aacc (backend-drm: Construct a zpos candidate list of planes)
Signed-off-by: Robert Mader <robert.mader@collabora.com>
(cherry picked from commit 5a2509ffb1)
Failure to do so, might cause a crash if the output repaint happens
before the pipewire pipeline started -- calling pixman_region32_fini on
a uninitialized region.
Fixes 2abe4efcf7, "libweston/backends: Move damage flush into backends"
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
(cherry picked from commit b93335a741)
Currently we flush damage for the "primary plane" every repaint, but this
is folly.
The drm backend may skip rendering entirely if using an all-planes
composition. This could leave the renderer plane in a messy state if a
surface on an overlay plane disappears.
Instead, let the backends flush the primary plane damage when they know
they need to render.
Fixes#864
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
(cherry picked from commit 2abe4efcf7)
commit 79212ba9ad fixed a bug by
introducing a new one.
Before that point we could clip paint node damage to stale
visibility data. After that point we post damage for occluded
views, leading to large amounts of pointless drawing.
Add back the clip to visible region, in
weston_output_flush_damage_for_plane(), where we have up to date
visibility region information.
fixes 79212ba9ad
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
(cherry picked from commit e74f2897b9)
This seems to think formats needs to be NULL terminated, but it doesn't
and gl_renderer_get_egl_config asserts that all formats_count elements
are not NULL.
This happens when EGL_KHR_no_config_context is not supported.
Signed-off-by: Ray Smith <rsmith@brightsign.biz>
(cherry picked from commit 885c616589)
Otherwise shseat->focused_ivisurf can point to deleted memory.
This does not happen with the hmi-controller because it explicitly assigns a new
focused surface. But the ivi-shell should not relay on the controller here.
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
(cherry picked from commit d6681cedee)
Fix a crash when right-clicking on a weston-terminal, where
weston_desktop_seat_popup_grab_add_surface() is called with
seat->popup_grab.keyboard.keyboard == NULL in case there is
no keyboard connected.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
(cherry picked from commit b72785e1f6)
The same output might be inited twice on init when the shell panel is disabled,
depending on the order the weston_desktop_shell and wl_output globals are
advertised. This triggers a protocol error as only one background can be created
per output.
Since initializing the output requires the weston_desktop_shell global (to
create the background and panel on this output), the output init call is done
conditionally in two places: in the global registry handler (to handle output
hotplug) and after the initial wl_display_roundtrip call to handle the case
where the weston_desktop_shell global was notified after the outputs.
We now check the output has already been initialized correctly by checking if
the background has been created, instead of the panel which is not always
created.
Signed-off-by: Arnaud Vrac <avrac@freebox.fr>
(cherry picked from commit 59207a7c7c)
In this case the curtain width and height would be calculated using
uninitialized values, triggering warnings in pixman calls.
Signed-off-by: Arnaud Vrac <avrac@freebox.fr>
(cherry picked from commit 03fa71f153)
Clamping of the alpha value is not done properly since the introduction of the
weston_view_set_alpha() helper.
Signed-off-by: Arnaud Vrac <avrac@freebox.fr>
(cherry picked from commit 14e0fff19a)
When reading back for the remote backends we need to convert the extents
of the damage (which is in global coordinates) to output coordinates
to read back the correct region.
We were doing this in a bespoke fashion by adding the output coordinates.
Instead, use weston_matrix_transform_rect() to transform the extents by
the output transform - which includes the scale factor.
This fixes output scale on RDP with the gl renderer.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
(cherry picked from commit 527bc8aeb3)
The gl_renderer_do_read_pixels() is expecting stride in bytes.
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
(cherry picked from commit 623c7b5202)
If we only create the input_panel_surface after we've already created
the window and tried to get some content for it, then we're never going
to enter the input_panel_surface committed handler, so we'll never get
the chance to properly map the surface.
Follow the other surface types by creating the input-panel surface
before we try to attach anything to it.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Fixes: bdf2019e ("desktop-shell: Map input panel surfaces before views")
When the input panel surface gets something committed to it, we have
content and thus the surface has become mapped. Do this from within the
input-panel surface committed handler.
When we want to show the input panel, this is when we map the view. Do
this exactly once as well, and make sure that we don't attempt to map
the view with an unmapped surface.
This regularises the logic to be the same as almost all the other
special surface users.
Signed-off-by: Daniel Stone <daniels@collabora.com>
When editing a text field in chromium deleting the surrounding text with
backspace fails with `The selection range for surrounding text is invalid`
It seems like `(start - keyboard->surrounding_text) - keyboard->surrounding_cursor` evaluates to -1.
As far as i can tell `start - keyboard->surrounding_text` evaluates to
the index in the surrounding_text char arrays that should be deleted.
Signed-off-by: Aske Bækdal Møller <aske@geanix.com>
We can't use the surface damage to determine when to upload new cursor
images because when heads overlap the first repainted head will accumulate
that damage as plane damage.
We can't easily use plane damage either because the plane isn't really
assigned until after an atomic test, which requires the cursor fb to be
current.
Untangle this mess a little by always testing with the first cursor fb,
which is identical to the second in all ways, then replace with the correct
fb in repaint.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Now that overlapping outputs are a thing, we have a problem with vnc
cursors.
The surface->damage used to update the vnc cursor might actually be
flushed by a previous output's repaint cycle, leading to a missing cursor
update to the vnc client.
Instead we should use the damage accumulated on the cursor plane to choose
when to update the cursor. This damage is in output coordinates, so let's
be lazy and just use the presence of damage as an indicator that the
cursor needs an update.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
VISIBILITY_DIRTY is used to apply damage to the plane, but that doesn't
make sense for non-primary planes.
For example, we don't want moving the cursor to result in damage being
registered on the cursor plane.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
When an output repaints, it calculates visibility for its paint nodes,
accumulates damage for all paint nodes across all outputs, and then
paints.
This means that when it's accumulating damage for all paint nodes in
paint_node_add_damage(), it may be accumulating damage to nodes on other
outputs that haven't had their visible regions updates yet.
This leads to clipping with a stale visibility region, and losing damage.
Let's just drop the clip here for now - there are already other places
where paint nodes have to carry damage outside their visible regions.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This is a revert of 72e2da24
The VNC backend will place a single fullscreen surface on a virtual
scanout plane, and send the entire contents of this plane every repaint.
This saves a renderer pass, but moving the mouse over the fullscreen
client results in full screen damage for every mouse motion, similarly
client surfact damage is ignored and every repaint pushes the entire
window content down into Neat VNC.
Due to the way this is implemented, by pushing the scanout plane content
from assign_planes(), the primary plane could post damage and corrupt
the display.
Ideally we could fix this optimization to respect plane damage and do the
scanout plane push from the repaint callback, but since a release is
coming soon let's just strip it out for now.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Stop assuming that NULL represents the stock sRGB color profile. From
now on, query the stock sRGB color profile from the color manager.
This should be internal to libweston (core and the color plugins), and
users of the libweston public API should not be affected by this. They
are still allowed to set an output color profile to the stock sRGB using
NULL.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
In the following commits, we'll create the stock sRGB color profile for
outputs in weston_output_init(), and destroy it in
weston_output_release().
We already have a mock color manager in the tests, but we still need
to add the functions to create/destroy a mock stock sRGB color profile.
This should avoid crashes in the following commits.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
cmlcms_get_hdr_meta() returns early if the output has a color profile
set. That makes sense, because we should be able to get the color
characteristics from the color profiles.
But in the next commits, every output will have a color profile set. To
allow the color-metadata-parsing test, do not return early when
output->color_profile != NULL in cmlcms_get_hdr_meta() anymore.
In the future we'll adjust this function in order to always extract the
color characteristics from color profiles, as output->color_profile
should always be set.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
In the next commit we'll stop using NULL as the stock sRGB color
profile, so add a function to the color manager to allow libweston core
to have access to the stock sRGB profile.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
In the next commit we introduce a function to get the stock sRGB color
profile from the color-manager, so mock a stock color profile in the
color-noop.
It has no valid content, but should make callers happy. This is safe to
do because the color profile is opaque, and only color-noop itself
should have access to its content.
color-lcms already has a stock sRGB color profile, so we don't have
to do anything there.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Directly destroying the cprof is not ideal, because it may hide issues
that we have in the code. If we are destroying a cprof with ref_count
bigger than 1, there's something wrong that we need to fix.
Instead, assert that the stock sRGB cprof has ref_count == 1 when we are
destroying the color manager. And use unref() instead of destroy().
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Ignore any client-supplied offset to subsurface commits to keep the same
consistency we find on other compositor.
Fix: #829
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
If an X window has not been resized yet, and the user clicks (not drags)
on a part of the window frame that can be used to resize, the window
will resize to 512, 512.
This is likely because of the changes in ba82af938 and 2acd2c748
that change resize behaviour but missed updating saved size when the
client's initial configure occurs.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Otherwise we end up with an invalid backend on the shutdown path of the
compositor. This mimics what the wayland back-end does.
Fixes 14c52a942b, 'backend-x11: enable multi-backend support'.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Since hmi-controller adds surfaces to layers when creating ivi surfaces,
the launcher will appear on startup. As before, the launcher surface is
created before the background surface so that the background will appear
on startup.
Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
Activate when a surface is created and change focus when an active
surface is removed. The Surface is added to layers when it is created,
because it must be added to a layer to be active.
Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
The keyboard focus is active, but the desktop surface itself is not
displayed as active. Therefore, the surface should also be displayed as
active, as in kiosk-shell.
Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
Add to handle seet hotplugging so that seats are properly picked up by
ivi-shell when they are dynamically created.
Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
Conditionally create the renderer like other secondary backends.
Now that we have multi-backend support and overlapping outputs, an
interesting use case for the headless backend exists.
We can have a high performance steady state on the drm backend with
all content on scan-out planes, bypassing the renderer. Taking a
screenshot of this would ideally use readback, but some hardware is
incapable of readback, or only capable at certain resolutions.
By using the headless backend as a secondary backend, and creating a
headless output that overlaps the drm outputs, we can take the
screenshot on the headless backend without disrupting the plane
layout on the drm backend.
For this to be efficient, other changes need to be made, but this is
a step in that direction.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>