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

Commit

Permalink
linux-explicit-synchronization-v1: extract fence from DMA-BUF
Browse files Browse the repository at this point in the history
  • Loading branch information
emersion committed Oct 21, 2021
1 parent 98909f0 commit f80f89b
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions types/wlr_linux_explicit_synchronization_v1.c
Original file line number Diff line number Diff line change
Expand Up @@ -327,13 +327,20 @@ bool wlr_linux_explicit_synchronization_v1_signal_surface_timeline(
uint64_t dst_point) {
struct wlr_linux_surface_synchronization_v1 *surface_sync =
surface_sync_from_surface(explicit_sync, surface);
if (!surface_sync) {
// TODO: fallback to DMA-BUF fence export
return false;
if (surface_sync) {
return wlr_render_timeline_import_sync_file(timeline, dst_point,
surface_sync->current.acquire_fence_fd);
}

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

bool wlr_linux_explicit_synchronization_v1_wait_surface_timeline(
Expand Down

0 comments on commit f80f89b

Please sign in to comment.