turnip: Fix bo allocation after we stopped using libdrm_freedreno ...
Al this figuring out new errors is why I don't like reinventing the wheel.
This commit is contained in:
parent
f0a24e123f
commit
426f6e46a8
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue