kselftests: dmabuf-heaps: Add clearer checks on DMABUF_BEGIN/END_SYNC
Add logic to check the dmabuf sync calls succeed. Cc: Shuah Khan <shuah@kernel.org> Cc: Brian Starkey <brian.starkey@arm.com> Cc: Sumit Semwal <sumit.semwal@linaro.org> Cc: Laura Abbott <labbott@kernel.org> Cc: Hridya Valsaraju <hridya@google.com> Cc: Suren Baghdasaryan <surenb@google.com> Cc: Sandeep Patil <sspatil@google.com> Cc: Daniel Mentz <danielmentz@google.com> Cc: linux-media@vger.kernel.org Cc: dri-devel@lists.freedesktop.org Cc: linux-kselftest@vger.kernel.org Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
This commit is contained in:
Родитель
64ba3d591c
Коммит
50c65a8342
|
@ -130,16 +130,13 @@ static int dmabuf_heap_alloc(int fd, size_t len, unsigned int flags,
|
|||
dmabuf_fd);
|
||||
}
|
||||
|
||||
static void dmabuf_sync(int fd, int start_stop)
|
||||
static int dmabuf_sync(int fd, int start_stop)
|
||||
{
|
||||
struct dma_buf_sync sync = {
|
||||
.flags = start_stop | DMA_BUF_SYNC_RW,
|
||||
};
|
||||
int ret;
|
||||
|
||||
ret = ioctl(fd, DMA_BUF_IOCTL_SYNC, &sync);
|
||||
if (ret)
|
||||
printf("sync failed %d\n", errno);
|
||||
return ioctl(fd, DMA_BUF_IOCTL_SYNC, &sync);
|
||||
}
|
||||
|
||||
#define ONE_MEG (1024 * 1024)
|
||||
|
@ -197,9 +194,18 @@ static int test_alloc_and_import(char *heap_name)
|
|||
}
|
||||
printf("import passed\n");
|
||||
|
||||
dmabuf_sync(dmabuf_fd, DMA_BUF_SYNC_START);
|
||||
ret = dmabuf_sync(dmabuf_fd, DMA_BUF_SYNC_START);
|
||||
if (ret < 0) {
|
||||
printf("Sync start failed!\n");
|
||||
goto out;
|
||||
}
|
||||
|
||||
memset(p, 0xff, ONE_MEG);
|
||||
dmabuf_sync(dmabuf_fd, DMA_BUF_SYNC_END);
|
||||
ret = dmabuf_sync(dmabuf_fd, DMA_BUF_SYNC_END);
|
||||
if (ret < 0) {
|
||||
printf("Sync end failed!\n");
|
||||
goto out;
|
||||
}
|
||||
printf("syncs passed\n");
|
||||
|
||||
close_handle(importer_fd, handle);
|
||||
|
|
Загрузка…
Ссылка в новой задаче