anv: Add support for the ICD loader
This commit is contained in:
@@ -109,6 +109,7 @@ VkResult anv_CreateCommandBuffer(
|
|||||||
if (cmd_buffer == NULL)
|
if (cmd_buffer == NULL)
|
||||||
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
|
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||||
|
|
||||||
|
cmd_buffer->_loader_data.loaderMagic = ICD_LOADER_MAGIC;
|
||||||
cmd_buffer->device = device;
|
cmd_buffer->device = device;
|
||||||
|
|
||||||
result = anv_cmd_buffer_init_batch_bo_chain(cmd_buffer);
|
result = anv_cmd_buffer_init_batch_bo_chain(cmd_buffer);
|
||||||
|
@@ -45,6 +45,7 @@ anv_physical_device_init(struct anv_physical_device *device,
|
|||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
return vk_errorf(VK_ERROR_UNAVAILABLE, "failed to open %s: %m", path);
|
return vk_errorf(VK_ERROR_UNAVAILABLE, "failed to open %s: %m", path);
|
||||||
|
|
||||||
|
device->_loader_data.loaderMagic = ICD_LOADER_MAGIC;
|
||||||
device->instance = instance;
|
device->instance = instance;
|
||||||
device->path = path;
|
device->path = path;
|
||||||
|
|
||||||
@@ -159,6 +160,7 @@ VkResult anv_CreateInstance(
|
|||||||
if (!instance)
|
if (!instance)
|
||||||
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
|
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||||
|
|
||||||
|
instance->_loader_data.loaderMagic = ICD_LOADER_MAGIC;
|
||||||
instance->pAllocUserData = alloc_callbacks->pUserData;
|
instance->pAllocUserData = alloc_callbacks->pUserData;
|
||||||
instance->pfnAlloc = alloc_callbacks->pfnAlloc;
|
instance->pfnAlloc = alloc_callbacks->pfnAlloc;
|
||||||
instance->pfnFree = alloc_callbacks->pfnFree;
|
instance->pfnFree = alloc_callbacks->pfnFree;
|
||||||
@@ -523,6 +525,7 @@ PFN_vkVoidFunction anv_GetDeviceProcAddr(
|
|||||||
static VkResult
|
static VkResult
|
||||||
anv_queue_init(struct anv_device *device, struct anv_queue *queue)
|
anv_queue_init(struct anv_device *device, struct anv_queue *queue)
|
||||||
{
|
{
|
||||||
|
queue->_loader_data.loaderMagic = ICD_LOADER_MAGIC;
|
||||||
queue->device = device;
|
queue->device = device;
|
||||||
queue->pool = &device->surface_state_pool;
|
queue->pool = &device->surface_state_pool;
|
||||||
|
|
||||||
@@ -596,6 +599,7 @@ VkResult anv_CreateDevice(
|
|||||||
if (!device)
|
if (!device)
|
||||||
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
|
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||||
|
|
||||||
|
device->_loader_data.loaderMagic = ICD_LOADER_MAGIC;
|
||||||
device->instance = physical_device->instance;
|
device->instance = physical_device->instance;
|
||||||
|
|
||||||
/* XXX(chadv): Can we dup() physicalDevice->fd here? */
|
/* XXX(chadv): Can we dup() physicalDevice->fd here? */
|
||||||
|
@@ -57,6 +57,13 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define ICD_LOADER_MAGIC 0x01CDC0DE
|
||||||
|
|
||||||
|
typedef union _VK_LOADER_DATA {
|
||||||
|
uintptr_t loaderMagic;
|
||||||
|
void *loaderData;
|
||||||
|
} VK_LOADER_DATA;
|
||||||
|
|
||||||
#define anv_noreturn __attribute__((__noreturn__))
|
#define anv_noreturn __attribute__((__noreturn__))
|
||||||
#define anv_printflike(a, b) __attribute__((__format__(__printf__, a, b)))
|
#define anv_printflike(a, b) __attribute__((__format__(__printf__, a, b)))
|
||||||
|
|
||||||
@@ -381,6 +388,8 @@ extern struct anv_dispatch_table dtable;
|
|||||||
|
|
||||||
|
|
||||||
struct anv_physical_device {
|
struct anv_physical_device {
|
||||||
|
VK_LOADER_DATA _loader_data;
|
||||||
|
|
||||||
struct anv_instance * instance;
|
struct anv_instance * instance;
|
||||||
uint32_t chipset_id;
|
uint32_t chipset_id;
|
||||||
const char * path;
|
const char * path;
|
||||||
@@ -390,6 +399,8 @@ struct anv_physical_device {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct anv_instance {
|
struct anv_instance {
|
||||||
|
VK_LOADER_DATA _loader_data;
|
||||||
|
|
||||||
void * pAllocUserData;
|
void * pAllocUserData;
|
||||||
PFN_vkAllocFunction pfnAlloc;
|
PFN_vkAllocFunction pfnAlloc;
|
||||||
PFN_vkFreeFunction pfnFree;
|
PFN_vkFreeFunction pfnFree;
|
||||||
@@ -427,6 +438,8 @@ struct anv_meta_state {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct anv_queue {
|
struct anv_queue {
|
||||||
|
VK_LOADER_DATA _loader_data;
|
||||||
|
|
||||||
struct anv_device * device;
|
struct anv_device * device;
|
||||||
|
|
||||||
struct anv_state_pool * pool;
|
struct anv_state_pool * pool;
|
||||||
@@ -447,6 +460,8 @@ struct anv_queue {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct anv_device {
|
struct anv_device {
|
||||||
|
VK_LOADER_DATA _loader_data;
|
||||||
|
|
||||||
struct anv_instance * instance;
|
struct anv_instance * instance;
|
||||||
uint32_t chipset_id;
|
uint32_t chipset_id;
|
||||||
struct brw_device_info info;
|
struct brw_device_info info;
|
||||||
@@ -832,6 +847,8 @@ enum anv_cmd_buffer_exec_mode {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct anv_cmd_buffer {
|
struct anv_cmd_buffer {
|
||||||
|
VK_LOADER_DATA _loader_data;
|
||||||
|
|
||||||
struct anv_device * device;
|
struct anv_device * device;
|
||||||
|
|
||||||
struct list_head pool_link;
|
struct list_head pool_link;
|
||||||
|
Reference in New Issue
Block a user