summaryrefslogtreecommitdiff
path: root/lib/ioctl_wrappers.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2016-02-25 21:43:01 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2016-03-01 13:25:07 +0000
commitaed69b56d4c63a19594440be6679307b2781ae2c (patch)
treec378ad1952669e651c11a89e1e2136a70db06fb7 /lib/ioctl_wrappers.c
parent925e5e1caef9b56bd53df457735514b644c7a399 (diff)
lib: Add read/write direction support for dmabuf synchronisation
Allow read-only synchronisation on dmabuf mmaps, useful to allow concurrent read-read testing between the CPU and GPU. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'lib/ioctl_wrappers.c')
-rw-r--r--lib/ioctl_wrappers.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c
index 40712606..5d497293 100644
--- a/lib/ioctl_wrappers.c
+++ b/lib/ioctl_wrappers.c
@@ -1539,12 +1539,15 @@ off_t prime_get_size(int dma_buf_fd)
* prime_sync_start
* @dma_buf_fd: dma-buf fd handle
*/
-void prime_sync_start(int dma_buf_fd)
+void prime_sync_start(int dma_buf_fd, bool write)
{
struct local_dma_buf_sync sync_start;
memset(&sync_start, 0, sizeof(sync_start));
- sync_start.flags = LOCAL_DMA_BUF_SYNC_START | LOCAL_DMA_BUF_SYNC_RW;
+ sync_start.flags = LOCAL_DMA_BUF_SYNC_START;
+ sync_start.flags |= LOCAL_DMA_BUF_SYNC_READ;
+ if (write)
+ sync_start.flags |= LOCAL_DMA_BUF_SYNC_WRITE;
do_ioctl(dma_buf_fd, LOCAL_DMA_BUF_IOCTL_SYNC, &sync_start);
}
@@ -1552,12 +1555,15 @@ void prime_sync_start(int dma_buf_fd)
* prime_sync_end
* @dma_buf_fd: dma-buf fd handle
*/
-void prime_sync_end(int dma_buf_fd)
+void prime_sync_end(int dma_buf_fd, bool write)
{
struct local_dma_buf_sync sync_end;
memset(&sync_end, 0, sizeof(sync_end));
- sync_end.flags = LOCAL_DMA_BUF_SYNC_END | LOCAL_DMA_BUF_SYNC_RW;
+ sync_end.flags = LOCAL_DMA_BUF_SYNC_END;
+ sync_end.flags |= LOCAL_DMA_BUF_SYNC_READ;
+ if (write)
+ sync_end.flags |= LOCAL_DMA_BUF_SYNC_WRITE;
do_ioctl(dma_buf_fd, LOCAL_DMA_BUF_IOCTL_SYNC, &sync_end);
}