summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/freedreno/vulkan/tu_device.c6
-rw-r--r--src/freedreno/vulkan/tu_gem.c20
2 files changed, 9 insertions, 17 deletions
diff --git a/src/freedreno/vulkan/tu_device.c b/src/freedreno/vulkan/tu_device.c
index 588f2e83f91..4d676d9147a 100644
--- a/src/freedreno/vulkan/tu_device.c
+++ b/src/freedreno/vulkan/tu_device.c
@@ -89,11 +89,11 @@ tu_bo_init_new(struct tu_device *dev, struct tu_bo *bo, uint64_t size)
*/
/* 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;
@@ -1312,7 +1312,7 @@ tu_alloc_memory(struct tu_device *device,
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;
}
diff --git a/src/freedreno/vulkan/tu_gem.c b/src/freedreno/vulkan/tu_gem.c
index ba302a7634f..b8a4c6f8a98 100644
--- a/src/freedreno/vulkan/tu_gem.c
+++ b/src/freedreno/vulkan/tu_gem.c
@@ -30,17 +30,7 @@
#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.
@@ -54,7 +44,8 @@ tu_gem_new(struct tu_device *dev, uint64_t size, uint32_t flags)
};
- 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;
@@ -68,7 +59,7 @@ tu_gem_close(struct tu_device *dev, uint32_t gem_handle)
.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. */
@@ -80,7 +71,8 @@ tu_gem_info(struct tu_device *dev, uint32_t gem_handle, uint32_t flags)
.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;