assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO);
- uint32_t client_version = pCreateInfo->pApplicationInfo->apiVersion;
+ uint32_t client_version = pCreateInfo->pApplicationInfo ?
+ pCreateInfo->pApplicationInfo->apiVersion :
+ VK_MAKE_VERSION(1, 0, 0);
if (VK_MAKE_VERSION(1, 0, 0) > client_version ||
- client_version > VK_MAKE_VERSION(1, 0, 2)) {
+ client_version > VK_MAKE_VERSION(1, 0, 3)) {
return vk_errorf(VK_ERROR_INCOMPATIBLE_DRIVER,
"Client requested version %d.%d.%d",
VK_VERSION_MAJOR(client_version),
else
instance->alloc = default_alloc;
- instance->apiVersion = pCreateInfo->pApplicationInfo->apiVersion;
+ instance->apiVersion = client_version;
instance->physicalDeviceCount = -1;
_mesa_locale_init();
};
}
+void
+anv_device_get_cache_uuid(void *uuid)
+{
+ memset(uuid, 0, VK_UUID_SIZE);
+ snprintf(uuid, VK_UUID_SIZE, "anv-%s", MESA_GIT_SHA1 + 4);
+}
+
void anv_GetPhysicalDeviceProperties(
VkPhysicalDevice physicalDevice,
VkPhysicalDeviceProperties* pProperties)
};
strcpy(pProperties->deviceName, pdevice->name);
- snprintf((char *)pProperties->pipelineCacheUUID, VK_UUID_SIZE,
- "anv-%s", MESA_GIT_SHA1 + 4);
+ anv_device_get_cache_uuid(pProperties->pipelineCacheUUID);
}
void anv_GetPhysicalDeviceQueueFamilyProperties(
return anv_lookup_entrypoint(pName);
}
+/* The loader wants us to expose a second GetInstanceProcAddr function
+ * to work around certain LD_PRELOAD issues seen in apps.
+ */
+VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vk_icdGetInstanceProcAddr(
+ VkInstance instance,
+ const char* pName);
+
+VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vk_icdGetInstanceProcAddr(
+ VkInstance instance,
+ const char* pName)
+{
+ return anv_GetInstanceProcAddr(instance, pName);
+}
+
PFN_vkVoidFunction anv_GetDeviceProcAddr(
VkDevice device,
const char* pName)
anv_device_submit_simple_batch(struct anv_device *device,
struct anv_batch *batch)
{
- struct anv_state state;
struct drm_i915_gem_execbuffer2 execbuf;
struct drm_i915_gem_exec_object2 exec2_objects[1];
- struct anv_bo *bo = NULL;
+ struct anv_bo bo;
VkResult result = VK_SUCCESS;
uint32_t size;
int64_t timeout;
/* Kernel driver requires 8 byte aligned batch length */
size = align_u32(batch->next - batch->start, 8);
- state = anv_state_pool_alloc(&device->dynamic_state_pool, MAX(size, 64), 32);
- bo = &device->dynamic_state_pool.block_pool->bo;
- memcpy(state.map, batch->start, size);
+ assert(size < device->batch_bo_pool.bo_size);
+ result = anv_bo_pool_alloc(&device->batch_bo_pool, &bo);
+ if (result != VK_SUCCESS)
+ return result;
+
+ memcpy(bo.map, batch->start, size);
+ if (!device->info.has_llc)
+ anv_clflush_range(bo.map, size);
- exec2_objects[0].handle = bo->gem_handle;
+ exec2_objects[0].handle = bo.gem_handle;
exec2_objects[0].relocation_count = 0;
exec2_objects[0].relocs_ptr = 0;
exec2_objects[0].alignment = 0;
- exec2_objects[0].offset = bo->offset;
+ exec2_objects[0].offset = bo.offset;
exec2_objects[0].flags = 0;
exec2_objects[0].rsvd1 = 0;
exec2_objects[0].rsvd2 = 0;
execbuf.buffers_ptr = (uintptr_t) exec2_objects;
execbuf.buffer_count = 1;
- execbuf.batch_start_offset = state.offset;
+ execbuf.batch_start_offset = 0;
execbuf.batch_len = size;
execbuf.cliprects_ptr = 0;
execbuf.num_cliprects = 0;
}
timeout = INT64_MAX;
- ret = anv_gem_wait(device, bo->gem_handle, &timeout);
+ ret = anv_gem_wait(device, bo.gem_handle, &timeout);
if (ret != 0) {
/* We don't know the real error. */
result = vk_errorf(VK_ERROR_OUT_OF_DEVICE_MEMORY, "execbuf2 failed: %m");
}
fail:
- anv_state_pool_free(&device->dynamic_state_pool, state);
+ anv_bo_pool_free(&device->batch_bo_pool, &bo);
return result;
}
device->_loader_data.loaderMagic = ICD_LOADER_MAGIC;
device->instance = physical_device->instance;
+ device->chipset_id = physical_device->chipset_id;
if (pAllocator)
device->alloc = *pAllocator;
case 9:
result = gen9_init_device_state(device);
break;
+ default:
+ /* Shouldn't get here as we don't create physical devices for any other
+ * gens. */
+ unreachable("unhandled gen");
}
if (result != VK_SUCCESS)
goto fail_fd;
"execbuf2 failed: %m");
}
- if (fence) {
- ret = anv_gem_execbuffer(device, &fence->execbuf);
- if (ret != 0) {
- /* We don't know the real error. */
- return vk_errorf(VK_ERROR_OUT_OF_DEVICE_MEMORY,
- "execbuf2 failed: %m");
- }
- }
-
for (uint32_t k = 0; k < cmd_buffer->execbuf2.bo_count; k++)
cmd_buffer->execbuf2.bos[k]->offset = cmd_buffer->execbuf2.objects[k].offset;
}
}
+ if (fence) {
+ ret = anv_gem_execbuffer(device, &fence->execbuf);
+ if (ret != 0) {
+ /* We don't know the real error. */
+ return vk_errorf(VK_ERROR_OUT_OF_DEVICE_MEMORY,
+ "execbuf2 failed: %m");
+ }
+ }
+
return VK_SUCCESS;
}
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_EVENT_CREATE_INFO);
state = anv_state_pool_alloc(&device->dynamic_state_pool,
- sizeof(*event), 4);
+ sizeof(*event), 8);
event = state.map;
event->state = state;
event->semaphore = VK_EVENT_RESET;