DMABUF Sync File

DMABUF Sync File — DMABUF importing/exporting fencing support library

Functions

Includes

#include <dmabuf_sync_file.h>

Description

Functions

has_dmabuf_export_sync_file ()

bool
has_dmabuf_export_sync_file (int fd);

Check if the kernel supports exporting a sync file from dmabuf.

Parameters

fd

The open drm fd

 

has_dmabuf_import_sync_file ()

bool
has_dmabuf_import_sync_file (int fd);

Check if the kernel supports importing a sync file into a dmabuf.

Parameters

fd

The open drm fd

 

dmabuf_export_sync_file ()

int
dmabuf_export_sync_file (int dmabuf,
                         uint32_t flags);

Take a snapshot of the current dma-resv fences in the dmabuf, and export as a syncfile. The flags should at least specify either DMA_BUF_SYNC_WRITE or DMA_BUF_SYNC_READ, depending on if we care about the read or write fences.

Parameters

dmabuf

The dmabuf fd

 

flags

The flags to control the behaviour

 

dmabuf_import_sync_file ()

void
dmabuf_import_sync_file (int dmabuf,
                         uint32_t flags,
                         int sync_fd);

Import the sync file sync_fd , into the dmabuf. The flags should at least specify DMA_BUF_SYNC_WRITE or DMA_BUF_SYNC_READ, depending on if we are importing the sync_fd as a read or write fence.

Parameters

dmabuf

The dmabuf fd

 

flags

The flags to control the behaviour

 

sync_fd

The sync file (i.e our fence) to import

 

dmabuf_import_timeline_fence ()

void
dmabuf_import_timeline_fence (int dmabuf,
                              uint32_t flags,
                              int timeline,
                              uint32_t seqno);

Create a new fence as part of timeline , and import as a sync file into the dmabuf. The flags should at least specify DMA_BUF_SYNC_WRITE or DMA_BUF_SYNC_READ, depending on if we are importing the new fence as a read or write fence.

Parameters

dmabuf

The dmabuf fd

 

flags

The flags to control the behaviour

 

timeline

The sync file timeline where the new fence is created

 

seqno

The sequence number to use for the fence

 

dmabuf_busy ()

bool
dmabuf_busy (int dmabuf,
             uint32_t flags);

Check if the fences in the dmabuf are still busy. The flags should at least specify DMA_BUF_SYNC_WRITE or DMA_BUF_SYNC_READ, depending on if we are checking if the read or read fences have all signalled. Or DMA_BUF_SYNC_RW if we care about both.

Parameters

dmabuf

The dmabuf fd

 

flags

The flags to control the behaviour

 

sync_file_busy ()

bool
sync_file_busy (int sync_file);

Check if the sync_file is still busy or not.

Parameters

sync_file

The sync file to check

 

dmabuf_sync_file_busy ()

bool
dmabuf_sync_file_busy (int dmabuf,
                       uint32_t flags);

Export the current fences in dmabuf as a sync file and check if still busy. The flags should at least contain DMA_BUF_SYNC_WRITE or DMA_BUF_SYNC_READ, to specify which fences are to be exported from the dmabuf and checked if busy. Or DMA_BUF_SYNC_RW if we care about both.

Parameters

dmabuf

The dmabuf fd

 

flags

The flags to control the behaviour

 

Types and Values