*/
/* TODO: Do we need 'offset' if we have 'iova'? */
- uint64_t offset = tu_gem_info_offset(dev, bo->gem_handle);
+ uint64_t offset = tu_gem_info_offset(dev, gem_handle);
if (!offset)
goto fail_info;
- uint64_t iova = tu_gem_info_iova(dev, bo->gem_handle);
+ uint64_t iova = tu_gem_info_iova(dev, gem_handle);
if (!iova)
goto fail_info;
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
result = tu_bo_init_new(device, &mem->bo, pAllocateInfo->allocationSize);
- if (!result) {
+ if (result != VK_SUCCESS) {
vk_free2(&device->alloc, pAllocator, mem);
return result;
}
#include "tu_private.h"
-static int
-tu_ioctl(int fd, unsigned long request, void *arg)
-{
- int ret;
-
- do {
- ret = ioctl(fd, request, arg);
- } while (ret == -1 && (errno == EINTR || errno == EAGAIN));
-
- return ret;
-}
+#include "xf86drm.h"
/**
* Return gem handle on success. Return 0 on failure.
};
- int ret = tu_ioctl(dev->physical_device->local_fd, DRM_MSM_GEM_NEW, &req);
+ int ret = drmCommandWriteRead(dev->physical_device->local_fd, DRM_MSM_GEM_NEW,
+ &req, sizeof(req));
if (ret)
return 0;
.handle = gem_handle,
};
- tu_ioctl(dev->physical_device->local_fd, DRM_IOCTL_GEM_CLOSE, &req);
+ drmIoctl(dev->physical_device->local_fd, DRM_IOCTL_GEM_CLOSE, &req);
}
/** Return UINT64_MAX on error. */
.flags = flags,
};
- int ret = tu_ioctl(dev->physical_device->local_fd, DRM_MSM_GEM_INFO, &req);
+ int ret = drmCommandWriteRead(dev->physical_device->local_fd, DRM_MSM_GEM_INFO,
+ &req, sizeof(req));
if (ret == -1)
return UINT64_MAX;