dma-buf

Header: kmsroots/dma-buf.h

Table of contents (click to go)

Macros

Enums

  1. kmr_dma_buf_sync_flags

Unions

Structs

  1. kmr_dma_buf_import_sync_file_create_info

  2. kmr_dma_buf_export_sync_file

  3. kmr_dma_buf_export_sync_file_create_info

Functions

  1. kmr_dma_buf_import_sync_file_create()

  2. kmr_dma_buf_export_sync_file_create()

  3. kmr_dma_buf_export_sync_file_destroy()

Function Pointers

API Documentation

Similar comments may be found in wlroots dmabuf.h as this API endpoint is largely just a copy of what’s in wlroots.

kmr_dma_buf_sync_flags

enum kmr_dma_buf_sync_flags
KMR_DMA_BUF_SYNC_READ
KMR_DMA_BUF_SYNC_WRITE
KMR_DMA_BUF_SYNC_RW
KMR_DMA_BUF_SYNC_READ
Value set to 1
KMR_DMA_BUF_SYNC_WRITE
Value set to 2
KMR_DMA_BUF_SYNC_RW
Value set to 3

kmr_dma_buf_import_sync_file_create_info

struct kmr_dma_buf_import_sync_file_create_info
uint8_t dmaBufferFdsCount;
int *dmaBufferFds;
int syncFileFd;
kmr_dma_buf_sync_flags syncFlags;
dmaBufferFdsCount
Array size of dmaBufferFds
dmaBufferFds
Pointer to an array of file descriptors to DMA-BUF’s of size dmaBufferFdsCount.
syncFileFd
File descriptor to a graphics API synchronization primitive.
May be acquired in Vulkan via (VkSemaphoreGetFdInfoKHR -> vkGetSemaphoreFdKHR) or
by making a call to kmr_vk_sync_obj_export_external_sync_fd(). Will be closed on
success or failure.
syncFlags
Flags used to determine permission allowed after import

kmr_dma_buf_import_sync_file_create

int kmr_dma_buf_import_sync_file_create(struct kmr_dma_buf_import_sync_file_create_info *importSyncFileInfo);

Import a single file descriptor to a graphics API synchronization primitive into an array of DMA-BUF file descriptors with drmIoctl(DMA_BUF_IOCTL_IMPORT_SYNC_FILE).

Parameters:
importSyncFileInfo
Returns:
on success: 0
on failure: -1

kmr_dma_buf_export_sync_file

struct kmr_dma_buf_export_sync_file
uint8_t syncFileFdsCount;
int *syncFileFds;
syncFileFdsCount
Array size of syncFileFds
syncFileFds
Pointer to an array of file descriptors used for synchronization
of size syncFileFdsCount. These file descriptors may
be imported to a graphics API primitive. In Vulkan you can import via

kmr_dma_buf_export_sync_file_create_info

struct kmr_dma_buf_export_sync_file_create_info
uint8_t dmaBufferFdsCount;
int *dmaBufferFds;
kmr_dma_buf_sync_flags syncFlags;
dmaBufferFdsCount
Array size of dmaBufferFds
dmaBufferFds
Pointer to an array of file descriptors. These file descriptors point to
DMA-BUF’s of size dmaBufferFdsCount.
syncFlags
Flags used to determine permission allowed by file descriptor after export

kmr_dma_buf_export_sync_file_create

struct kmr_dma_buf_export_sync_file *kmr_dma_buf_export_sync_file_create(struct kmr_dma_buf_export_sync_file_create_info *exportSyncFileInfo);

Exports an array of synchronization file descriptors from an array of DMA-BUF file descriptors with drmIoctl(DMA_BUF_IOCTL_EXPORT_SYNC_FILE).

Parameters:
exportSyncFileInfo
Returns:
on success: Pointer to a struct kmr_dma_buf_export_sync_file
on failure: NULL

kmr_dma_buf_export_sync_file_destroy

void kmr_dma_buf_export_sync_file_destroy(struct kmr_dma_buf_export_sync_file *exportSyncFile);

Frees any allocated memory and closes FD’s (if open) created after kmr_dma_buf_export_sync_file_create() call.

Parameters:
exportSyncFile
Pointer to a valid struct kmr_dma_buf_export_sync_file
/* Free'd members with fd's closed */
struct kmr_dma_buf_export_sync_file {
        int *syncFileFds;
}