linux-drm-syncobj-v1: Skip release if there is no timeline

If a surface with an existing buffer has a syncobj surface state created
without committing a new buffer with associated timelines, callers will
see the surface as having a syncobj state and may try to use it, but
calling the signal_release_with_buffer helper at this time will assert
on the lacking release timeline.

As this is a valid situation, remove the assert and replace it with an
early return so that callers do not need to explicitly check for the
presence of valid timelines.

Fixes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3895
This commit is contained in:
Kenny Levinsen 2024-08-28 18:10:10 +02:00
parent 0db4df4c8e
commit beb9a9ad0a

View File

@ -492,7 +492,12 @@ static void release_signaller_handle_buffer_release(struct wl_listener *listener
bool wlr_linux_drm_syncobj_v1_state_signal_release_with_buffer( bool wlr_linux_drm_syncobj_v1_state_signal_release_with_buffer(
struct wlr_linux_drm_syncobj_surface_v1_state *state, struct wlr_buffer *buffer) { struct wlr_linux_drm_syncobj_surface_v1_state *state, struct wlr_buffer *buffer) {
assert(buffer->n_locks > 0); assert(buffer->n_locks > 0);
assert(state->release_timeline != NULL); if (state->release_timeline == NULL) {
// This can happen if an existing surface with a buffer has a
// syncobj_surface_v1_state created but no new buffer with release
// timeline committed.
return true;
}
struct release_signaller *signaller = calloc(1, sizeof(*signaller)); struct release_signaller *signaller = calloc(1, sizeof(*signaller));
if (signaller == NULL) { if (signaller == NULL) {