summaryrefslogtreecommitdiffstats
path: root/src/amd/vulkan/radv_device.c
diff options
context:
space:
mode:
authorSamuel Pitoiset <[email protected]>2017-11-10 09:17:58 +0100
committerSamuel Pitoiset <[email protected]>2017-11-13 11:05:26 +0100
commitcd64a4f705ef7e1fc552ef907b9c61ea13593ef4 (patch)
treebaf58405813b70bc5a582586470a7548e69b3776 /src/amd/vulkan/radv_device.c
parent4e16c6a41e29b40ee8830fa95353f1f640b85136 (diff)
radv: use vk_error() everywhere an error is returned
For consistency and it might help for debugging purposes. Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Diffstat (limited to 'src/amd/vulkan/radv_device.c')
-rw-r--r--src/amd/vulkan/radv_device.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index d13b698e8fa..5754816b149 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -184,7 +184,7 @@ radv_physical_device_init(struct radv_physical_device *device,
fd = open(path, O_RDWR | O_CLOEXEC);
if (fd < 0)
- return VK_ERROR_INCOMPATIBLE_DRIVER;
+ return vk_error(VK_ERROR_INCOMPATIBLE_DRIVER);
version = drmGetVersion(fd);
if (!version) {
@@ -196,7 +196,7 @@ radv_physical_device_init(struct radv_physical_device *device,
if (strcmp(version->name, "amdgpu")) {
drmFreeVersion(version);
close(fd);
- return VK_ERROR_INCOMPATIBLE_DRIVER;
+ return vk_error(VK_ERROR_INCOMPATIBLE_DRIVER);
}
drmFreeVersion(version);
@@ -436,7 +436,7 @@ radv_enumerate_devices(struct radv_instance *instance)
max_devices = drmGetDevices2(0, devices, ARRAY_SIZE(devices));
if (max_devices < 1)
- return VK_ERROR_INCOMPATIBLE_DRIVER;
+ return vk_error(VK_ERROR_INCOMPATIBLE_DRIVER);
for (unsigned i = 0; i < (unsigned)max_devices; i++) {
if (devices[i]->available_nodes & 1 << DRM_NODE_RENDER &&
@@ -895,7 +895,7 @@ radv_queue_init(struct radv_device *device, struct radv_queue *queue,
queue->hw_ctx = device->ws->ctx_create(device->ws, queue->priority);
if (!queue->hw_ctx)
- return VK_ERROR_OUT_OF_HOST_MEMORY;
+ return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
return VK_SUCCESS;
}
@@ -1797,7 +1797,7 @@ fail:
queue->device->ws->buffer_destroy(tess_factor_ring_bo);
if (tess_offchip_ring_bo && tess_offchip_ring_bo != queue->tess_offchip_ring_bo)
queue->device->ws->buffer_destroy(tess_offchip_ring_bo);
- return VK_ERROR_OUT_OF_DEVICE_MEMORY;
+ return vk_error(VK_ERROR_OUT_OF_DEVICE_MEMORY);
}
static VkResult radv_alloc_sem_counts(struct radv_winsys_sem_counts *counts,
@@ -1821,14 +1821,14 @@ static VkResult radv_alloc_sem_counts(struct radv_winsys_sem_counts *counts,
if (counts->syncobj_count) {
counts->syncobj = (uint32_t *)malloc(sizeof(uint32_t) * counts->syncobj_count);
if (!counts->syncobj)
- return VK_ERROR_OUT_OF_HOST_MEMORY;
+ return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
}
if (counts->sem_count) {
counts->sem = (struct radeon_winsys_sem **)malloc(sizeof(struct radeon_winsys_sem *) * counts->sem_count);
if (!counts->sem) {
free(counts->syncobj);
- return VK_ERROR_OUT_OF_HOST_MEMORY;
+ return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
}
}
@@ -2227,7 +2227,7 @@ VkResult radv_MapMemory(
return VK_SUCCESS;
}
- return VK_ERROR_MEMORY_MAP_FAILED;
+ return vk_error(VK_ERROR_MEMORY_MAP_FAILED);
}
void radv_UnmapMemory(
@@ -2542,7 +2542,7 @@ VkResult radv_CreateFence(
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (!fence)
- return VK_ERROR_OUT_OF_HOST_MEMORY;
+ return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
memset(fence, 0, sizeof(*fence));
fence->submitted = false;
@@ -2550,7 +2550,7 @@ VkResult radv_CreateFence(
fence->fence = device->ws->create_fence();
if (!fence->fence) {
vk_free2(&device->alloc, pAllocator, fence);
- return VK_ERROR_OUT_OF_HOST_MEMORY;
+ return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
}
*pFence = radv_fence_to_handle(fence);
@@ -2666,7 +2666,7 @@ VkResult radv_CreateSemaphore(
sizeof(*sem), 8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (!sem)
- return VK_ERROR_OUT_OF_HOST_MEMORY;
+ return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
sem->temp_syncobj = 0;
/* create a syncobject if we are going to export this semaphore */
@@ -2676,14 +2676,14 @@ VkResult radv_CreateSemaphore(
int ret = device->ws->create_syncobj(device->ws, &sem->syncobj);
if (ret) {
vk_free2(&device->alloc, pAllocator, sem);
- return VK_ERROR_OUT_OF_HOST_MEMORY;
+ return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
}
sem->sem = NULL;
} else {
sem->sem = device->ws->create_sem(device->ws);
if (!sem->sem) {
vk_free2(&device->alloc, pAllocator, sem);
- return VK_ERROR_OUT_OF_HOST_MEMORY;
+ return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
}
sem->syncobj = 0;
}
@@ -2721,14 +2721,14 @@ VkResult radv_CreateEvent(
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (!event)
- return VK_ERROR_OUT_OF_HOST_MEMORY;
+ return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
event->bo = device->ws->buffer_create(device->ws, 8, 8,
RADEON_DOMAIN_GTT,
RADEON_FLAG_VA_UNCACHED | RADEON_FLAG_CPU_ACCESS | RADEON_FLAG_NO_INTERPROCESS_SHARING);
if (!event->bo) {
vk_free2(&device->alloc, pAllocator, event);
- return VK_ERROR_OUT_OF_DEVICE_MEMORY;
+ return vk_error(VK_ERROR_OUT_OF_DEVICE_MEMORY);
}
event->map = (uint64_t*)device->ws->buffer_map(event->bo);
@@ -3506,7 +3506,7 @@ VkResult radv_GetMemoryFdKHR(VkDevice _device,
bool ret = radv_get_memory_fd(device, memory, pFD);
if (ret == false)
- return VK_ERROR_OUT_OF_DEVICE_MEMORY;
+ return vk_error(VK_ERROR_OUT_OF_DEVICE_MEMORY);
return VK_SUCCESS;
}
@@ -3521,7 +3521,7 @@ VkResult radv_GetMemoryFdPropertiesKHR(VkDevice _device,
*
* Since we only handle opaque handles for now, there are no FD properties.
*/
- return VK_ERROR_INVALID_EXTERNAL_HANDLE_KHR;
+ return vk_error(VK_ERROR_INVALID_EXTERNAL_HANDLE_KHR);
}
VkResult radv_ImportSemaphoreFdKHR(VkDevice _device,
@@ -3534,7 +3534,7 @@ VkResult radv_ImportSemaphoreFdKHR(VkDevice _device,
int ret = device->ws->import_syncobj(device->ws, pImportSemaphoreFdInfo->fd, &syncobj_handle);
if (ret != 0)
- return VK_ERROR_INVALID_EXTERNAL_HANDLE_KHR;
+ return vk_error(VK_ERROR_INVALID_EXTERNAL_HANDLE_KHR);
if (pImportSemaphoreFdInfo->flags & VK_SEMAPHORE_IMPORT_TEMPORARY_BIT_KHR) {
sem->temp_syncobj = syncobj_handle;