No behavior changes; this is a follow-up of "drm: handle client buffer
destroyed while writeback scheduled".
That commit protects against clients disconnecting while a writeback job
is scheduled, which could otherwise lead to crashes if the buffer is
destroyed before the wb job completes. However, output capture provides
the same functionality: it listens to the client buffer destroy event to
retire the capture task.
Instead of listening to the wl_buffer destroy event, simply listen to
the capture task destroy event. GL renderer already follows this
pattern, and now DRM aligns with it.
See also:
weston_capture_task_buffer_destroy_handler()
weston_capture_task_add_destroy_listener()
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
(cherry picked from commit 04a85ab71c)
No behavior change, just a refactor to make it more clear that the state
is freed after the capture task is retired.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
(cherry picked from commit 7444c29fd2)
An output task may be destroyed by a client disconnect. This causes
problems for our drm backend's asynchronous capture task handler, which
currently has no way to notice this.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
(cherry picked from commit d2bab8a5ee)
Currently when a client buffer gets destroyed, the output capture task
gets destroyed with weston_capture_task_buffer_destroy_handler().
The problem is that we may have a writeback task scheduled, so
wb_state->ct would be pointing to a ct that has already been retired
and destroyed.
In this commit we start handling this case.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
(cherry picked from commit 1152c53e58)
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
This was brought up in issue 1063. The assertion in
weston_presentation_feedback_present_list() will trigger randomly during
repeated suspend/resume testing, presumably while a client is animating
and asking for presentation feedback.
drm_output_start_repaint_loop() has a path where drmWaitVBlank() is able
to pull a good timestamp for the last vblank. This results in a call to
weston_output_finish_frame() with a good timestamp and
WP_PRESENTATION_FEEDBACK_INVALID in the flags.
Previously it was assumed that in such case the presentation feedback
list cannot have any entries. This assumption is false. It is possible
that while the output is in idle state, a client will post an update to
a surface and ask for presentation feedback on it. This should trigger
drm_output_start_repaint_loop() with a non-empty feedback list.
It is unclear why this problem was not seen in the wild much more often.
Start-repaint-loop does not present anything by definition, it only acts
to synchronize the output repaint loop with the (hardware) scanout
cycle. Therefore no feedback must be sent there. As
WP_PRESENTATION_FEEDBACK_INVALID flag indicates no feedback must be
sent, use it to avoid calling
weston_presentation_feedback_present_list().
References: https://gitlab.freedesktop.org/wayland/weston/-/issues/1063
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
(cherry picked from commit d69e816b54)
When we have a mirror, it will be at the same x,y position as the output
it's mirroring. On hot unplug, the current logic results in the mirroring
output being moved to the left by the width of its target output. The
mirror will then be destroyed, and the views can be left dangling outside
of usable space when a hot plug restores the outputs.
Subtly change the reflow logic to only reflow outputs to the right of the
removed output by testing co-ordinates, instead of assuming that every
output in the list is to the right of the previous.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
(cherry picked from commit 1a9cf3bfb6)
Currently we have the following situation: we add a scanout tranche
because if the client re-allocates with another format/modifier, the
chances of being placed in a DRM/KMS plane is higher.
But then we run out of overlay planes. So we remove the scanout tranche,
because the format/modifier available in the renderer tranche are
optimal for rendering.
Now Weston detects again that the format/modifier is what may be
avoiding the view being place in a plane, re-adding the scanout tranche.
And we have an endless loop.
To avoid this, let's accumulate the reasons why placing the view in a
place failed. So if we detect that we don't have planes available, no
matter the format/modifier, we won't add the scanout tranche.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
(cherry picked from commit d3ead778de)
FAILURE_REASONS_ADD_FB_FAILED is defined as (1 << 3), so when we are
accumulating "failure reasons" in a variable we don't need to do the bit
shift again.
This results in an issue, because (1 << FAILURE_REASONS_ADD_FB_FAILED)
results in (1 << (1 << 3)) == (1 << 8).
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
(cherry picked from commit 8b83bb5ceb)
There are a few points in the code where we are wrongly using
FAILURE_REASONS_ADD_FB_FAILED, probably because we didn't have so many
"failure reasons" previously. This update such cases to use enum's that
make sense.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
(cherry picked from commit 3210cec531)
Do not skip all the planes if a single one of them do not support
fences. The other may do.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
(cherry picked from commit b347af2ce0)
The output resized signal sends a struct weston_output as the data, not
a struct weston_head.
Fixes 197c5e0084
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
(cherry picked from commit 52204f55ea)
Fixes the following UBSan error:
../../git/weston/libweston/id-number-allocator.c:140:16: runtime error:
left shift of 1 by 31 places cannot be represented in type 'int'
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
(cherry picked from commit 6773ffa758)
realloc() does not initialize the added memory, it needs to be zeroed
explicitly.
Not zeroing this memory had one severe consequence: if the new
lowest_free_bucket was 0xffffffff, weston_idalloc_get_id() would fail an
assertion.
Otherwise non-zero bits in the added memory would just cause id numbers
to be skipped unnecessarily, which does no harm.
Fixes: https://gitlab.freedesktop.org/wayland/weston/-/issues/1000
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
(cherry picked from commit ed51e9ae43)
No functional change here other than asserting that next_num didn't wrap
around. This reorganization helps adding the code
needed to clear the memory added by xrealloc() in the next patch.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
(cherry picked from commit 2733a95962)
The parent surface may not be on a layer. In that case, remove all child
surfaces from their current layer as well.
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
(cherry picked from commit 6e88a851a4)
Fix weston crash when user click the mouse continuosly while
the video is playing.
Call weston_view_update_transform before calling
weston_coord_global_to_surface to update view->transform.dirty to 0.
Fixes#985
Tested-by: Sooyeon Kang sooyeon8979@gmail.com
Signed-off-by: Sooyeon Kang sooyeon8979@gmail.com
(cherry picked from commit c77a5d386a)
We need this common helper as we don't have access to shared helper, so
just define one in-situ.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
(cherry picked from commit 43f7b7b3bb)
We need to reset the underlay check inside the view evaluation loop,
otherwise once we need an underlay we'll treat every following view as
needing an underlay.
Fixes: 1065d23406 ("backend-drm: Improve plane assignment for underlay platform")
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
(cherry picked from commit 8dbb3e17d0)
As we exit early we never have the chance to mark it as is_direct when
the buffer type is direct_display.
This is required as is_direct is never checked in GL attach part we
end up tripping on invalid renderer_private causing it to assert.
Fixes 2db4f17244f, "compositor: re-order paint node placeholder checks"
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
(cherry picked from commit 9d841e39e8)
Doing these in the wrong order breaks content protection, and breaks
placing direct-display paint nodes on underlays.
Fixes: 827e2276 ("gl-renderer: Draw holes on primary plane for the view on underlay")
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
(cherry picked from commit 53189ebb89)
The buffer_init function added with commit 83b37c0ac4, "renderers: pull
dmabuf initial setup out of attach", doesn't take into consideration the
the buffer's direct-display property.
Previously, gl_renderer_attach_dmabuf, wasn't being called when dmabuf's
direct-display was turned on, but with commit 83b37c0ac4 this has been changed.
So with commit 83b37c0ac4, linux_dmabuf_buffer_get_user_data will never
return a valid gb (gl buffer state), causing a crash using
direct-display extension. This adds an explicit check to return early
when this happens.
Fixes: 83b37c0ac4, "renderers: pull dmabuf initial setup out of attach"
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
(cherry picked from commit bf7b2311e7)
Fix binding-modifier "none" which was defaulting to Super.
Commit [1] introduced the original support for "none" but the logic was
subsequently lost in f7ba35f5.
[1] 553d1248 ("desktop-shell: Allow binding-modifier weston.ini option to be none")
Fixes: #976
Fixes: f7ba35f5 ("kiosk-shell: Enable debug keybindings")
Signed-off-by: Ian Ray <ian.ray@gehealthcare.com>
(cherry picked from commit fc278fb3cc)
We can startup with the display already in type1 content protection mode.
When this happens, we call weston_output_dirty_paint_nodes() on a display
that hasn't yet been enabled. The paint node list isn't initialized yet,
so we crash.
We don't actually need to touch the paint nodes here anyway, as
weston_output_damage() ensures a repaint if the ourput is enabled, and
weston_output_dirty_paint_nodes() just forces calculation of things
unrelated to protection, and we'll override most of that in
maybe_replace_paint_node() if necessary when we get there.
Just drop the weston_output_dirty_paint_nodes() call to stop the
crash.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
(cherry picked from commit 4f2cc67fde)
This checks for a valid resource when getting a xdg_popup. Similar to
the check in get_toplevel.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
(cherry picked from commit 80e47a7161)
Upon xdg_toplevel::destroy we seem to be calling xdg_surface::destroy
destroy handler. Protocol states that we should umap the surface with
client having the posibility to getting another toplevel role for the
same xdg_surface and re-map the window.
This also adds a guard for an unlikely invalid resource.
Fixes: #774
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
(cherry picked from commit 8b5bb588df)
Fixes the following C++ narrow conversion:
/include/libweston-14/libweston/matrix.h: In function ‘weston_coord
weston_coord_truncate(weston_coord)’:
/include/libweston-14/libweston/matrix.h:212:39: error: narrowing
conversion of ‘(int)in.weston_coord::x’ from ‘int’ to ‘double’
[-Werror=narrowing] 212 | return (struct weston_coord){
(int)in.x, (int)in.y };
| ^~~~~~~~~
/home/mvlad/install-new/include/libweston-14/libweston/matrix.h:212:50:
error: narrowing conversion of ‘(int)in.weston_coord::y’ from ‘int’ to
‘double’ [-Werror=narrowing] 212 | return (struct weston_coord){
(int)in.x, (int)in.y };
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
(cherry picked from commit a501acd291)
checks the resource and sends a protocol error if the client tries to
send a request to an inert object then returns out of the request
handler
Signed-off-by: Jeri Li <jeri.li@mediatek.com>
(cherry picked from commit 04f27f1be2)
This change fixes a side-effect of weston_view_move_to_layer helper
which would basically unmap the view because the layer entry list is no
longer visible. Only add the view to panel layer the first time.
Fixes: #956
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
(cherry picked from commit 217fb30847)
Clients need to know the seat name at the time they create mouse and
keyboard objects. This brings Weston in line with other compositors.
The documentation upstream currently is not super clear. It states name
is explicitly sent on bind, capabilities don't mention being sent on
bind in any way.
Signed-off-by: David Edmundson <davidedmundson@kde.org>
(cherry picked from commit fe64eee3ae)
Fix compilation error when `__builtin_clz` is not available by renaming variable 'u' to 'run'
Signed-off-by: Junyu Long <877730493@qq.com>
(cherry picked from commit 312c8bea66)
Since c4eb15d453 we keep a copy of
native mode parameters, however we forgot to initialize the
native mode parameters in some situations, which breaks the
output mirroring code when it sees uninitialized data.
Fixes c4eb15d453Fixes#949
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Attempt to fix the following with clang-18:
../weston-9999/libweston/color-management.c:890:2: error: call to
undeclared function 'static_assert'; ISO C99 and later do not support
implicit function declarations [-Wimplicit-function-declaration] 890 |
static_assert(UINT32_MAX <= SIZE_MAX, | ^
Fixes: #948
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
This would allow output_repaint_timer_handler() to find a backend
as well for the DRM virtual outputs created by DRM virtual API and
with it to trigger a repaint for the outputs created by
plug-ins (remoting and pipewre).
Fixes 1f8c49d5bdd20, 'compositor: repaint backends separately'
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Suggested-by: Michael Olbrich <m.olbrich@pengutronix.de>
With commit a1f8c49d5b, 'compositor: repaint backends
separately' a prepare repaint was introduced. Use it for DRM virtual API
to allow repainting the remoting/pipewire output.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>