Skip to content
This repository was archived by the owner on Nov 1, 2021. It is now read-only.

Commit eb623cb

Browse files
committed
linux-explicit-synchronization-v1: extract fence from DMA-BUF
1 parent 0d4a801 commit eb623cb

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

types/wlr_linux_explicit_synchronization_v1.c

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -327,13 +327,20 @@ bool wlr_linux_explicit_synchronization_v1_signal_surface_timeline(
327327
uint64_t dst_point) {
328328
struct wlr_linux_surface_synchronization_v1 *surface_sync =
329329
surface_sync_from_surface(explicit_sync, surface);
330-
if (!surface_sync) {
331-
// TODO: fallback to DMA-BUF fence export
332-
return false;
330+
if (surface_sync) {
331+
return wlr_render_timeline_import_sync_file(timeline, dst_point,
332+
surface_sync->current.acquire_fence_fd);
333333
}
334334

335-
return wlr_render_timeline_import_sync_file(timeline, dst_point,
336-
surface_sync->current.acquire_fence_fd);
335+
// Client doesn't support explicit sync, try to extract the fence from the
336+
// DMA-BUF
337+
struct wlr_dmabuf_attributes dmabuf;
338+
if (surface->buffer == NULL ||
339+
!wlr_buffer_get_dmabuf(&surface->buffer->base, &dmabuf)) {
340+
return false;
341+
}
342+
return wlr_render_timeline_import_dmabuf(timeline, dst_point,
343+
dmabuf.fd[0]);
337344
}
338345

339346
bool wlr_linux_explicit_synchronization_v1_wait_surface_timeline(

0 commit comments

Comments
 (0)