radv: Store UUID in physical device.
No sense in repeatedly determining it. Also, it might be dependent on the device as shaders get compiled differently for SI/CIK/VI etc. Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
This commit is contained in:
@@ -44,6 +44,13 @@
|
|||||||
#include "util/debug.h"
|
#include "util/debug.h"
|
||||||
struct radv_dispatch_table dtable;
|
struct radv_dispatch_table dtable;
|
||||||
|
|
||||||
|
static void
|
||||||
|
radv_device_get_cache_uuid(void *uuid)
|
||||||
|
{
|
||||||
|
memset(uuid, 0, VK_UUID_SIZE);
|
||||||
|
snprintf(uuid, VK_UUID_SIZE, "radv-%s", RADV_TIMESTAMP);
|
||||||
|
}
|
||||||
|
|
||||||
static VkResult
|
static VkResult
|
||||||
radv_physical_device_init(struct radv_physical_device *device,
|
radv_physical_device_init(struct radv_physical_device *device,
|
||||||
struct radv_instance *instance,
|
struct radv_instance *instance,
|
||||||
@@ -89,6 +96,8 @@ radv_physical_device_init(struct radv_physical_device *device,
|
|||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
radv_device_get_cache_uuid(device->uuid);
|
||||||
|
|
||||||
fprintf(stderr, "WARNING: radv is not a conformant vulkan implementation, testing use only.\n");
|
fprintf(stderr, "WARNING: radv is not a conformant vulkan implementation, testing use only.\n");
|
||||||
device->name = device->rad_info.name;
|
device->name = device->rad_info.name;
|
||||||
return VK_SUCCESS;
|
return VK_SUCCESS;
|
||||||
@@ -361,13 +370,6 @@ void radv_GetPhysicalDeviceFeatures(
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
radv_device_get_cache_uuid(void *uuid)
|
|
||||||
{
|
|
||||||
memset(uuid, 0, VK_UUID_SIZE);
|
|
||||||
snprintf(uuid, VK_UUID_SIZE, "radv-%s", RADV_TIMESTAMP);
|
|
||||||
}
|
|
||||||
|
|
||||||
void radv_GetPhysicalDeviceProperties(
|
void radv_GetPhysicalDeviceProperties(
|
||||||
VkPhysicalDevice physicalDevice,
|
VkPhysicalDevice physicalDevice,
|
||||||
VkPhysicalDeviceProperties* pProperties)
|
VkPhysicalDeviceProperties* pProperties)
|
||||||
@@ -498,7 +500,7 @@ void radv_GetPhysicalDeviceProperties(
|
|||||||
};
|
};
|
||||||
|
|
||||||
strcpy(pProperties->deviceName, pdevice->name);
|
strcpy(pProperties->deviceName, pdevice->name);
|
||||||
radv_device_get_cache_uuid(pProperties->pipelineCacheUUID);
|
memcpy(pProperties->pipelineCacheUUID, pdevice->uuid, VK_UUID_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void radv_GetPhysicalDeviceQueueFamilyProperties(
|
void radv_GetPhysicalDeviceQueueFamilyProperties(
|
||||||
|
@@ -308,8 +308,8 @@ radv_pipeline_cache_load(struct radv_pipeline_cache *cache,
|
|||||||
const void *data, size_t size)
|
const void *data, size_t size)
|
||||||
{
|
{
|
||||||
struct radv_device *device = cache->device;
|
struct radv_device *device = cache->device;
|
||||||
|
struct radv_physical_device *pdevice = &device->instance->physicalDevice;
|
||||||
struct cache_header header;
|
struct cache_header header;
|
||||||
uint8_t uuid[VK_UUID_SIZE];
|
|
||||||
|
|
||||||
if (size < sizeof(header))
|
if (size < sizeof(header))
|
||||||
return;
|
return;
|
||||||
@@ -322,8 +322,7 @@ radv_pipeline_cache_load(struct radv_pipeline_cache *cache,
|
|||||||
return;
|
return;
|
||||||
if (header.device_id != device->instance->physicalDevice.rad_info.pci_id)
|
if (header.device_id != device->instance->physicalDevice.rad_info.pci_id)
|
||||||
return;
|
return;
|
||||||
radv_device_get_cache_uuid(uuid);
|
if (memcmp(header.uuid, pdevice->uuid, VK_UUID_SIZE) != 0)
|
||||||
if (memcmp(header.uuid, uuid, VK_UUID_SIZE) != 0)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
char *end = (void *) data + size;
|
char *end = (void *) data + size;
|
||||||
@@ -405,6 +404,7 @@ VkResult radv_GetPipelineCacheData(
|
|||||||
{
|
{
|
||||||
RADV_FROM_HANDLE(radv_device, device, _device);
|
RADV_FROM_HANDLE(radv_device, device, _device);
|
||||||
RADV_FROM_HANDLE(radv_pipeline_cache, cache, _cache);
|
RADV_FROM_HANDLE(radv_pipeline_cache, cache, _cache);
|
||||||
|
struct radv_physical_device *pdevice = &device->instance->physicalDevice;
|
||||||
struct cache_header *header;
|
struct cache_header *header;
|
||||||
VkResult result = VK_SUCCESS;
|
VkResult result = VK_SUCCESS;
|
||||||
const size_t size = sizeof(*header) + cache->total_size;
|
const size_t size = sizeof(*header) + cache->total_size;
|
||||||
@@ -422,7 +422,7 @@ VkResult radv_GetPipelineCacheData(
|
|||||||
header->header_version = VK_PIPELINE_CACHE_HEADER_VERSION_ONE;
|
header->header_version = VK_PIPELINE_CACHE_HEADER_VERSION_ONE;
|
||||||
header->vendor_id = 0x1002;
|
header->vendor_id = 0x1002;
|
||||||
header->device_id = device->instance->physicalDevice.rad_info.pci_id;
|
header->device_id = device->instance->physicalDevice.rad_info.pci_id;
|
||||||
radv_device_get_cache_uuid(header->uuid);
|
memcpy(header->uuid, pdevice->uuid, VK_UUID_SIZE);
|
||||||
p += header->header_size;
|
p += header->header_size;
|
||||||
|
|
||||||
struct cache_entry *entry;
|
struct cache_entry *entry;
|
||||||
|
@@ -258,6 +258,8 @@ struct radv_physical_device {
|
|||||||
uint32_t pci_vendor_id;
|
uint32_t pci_vendor_id;
|
||||||
uint32_t pci_device_id;
|
uint32_t pci_device_id;
|
||||||
|
|
||||||
|
uint8_t uuid[VK_UUID_SIZE];
|
||||||
|
|
||||||
struct wsi_device wsi_device;
|
struct wsi_device wsi_device;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -453,8 +455,6 @@ struct radv_device {
|
|||||||
float sample_locations_16x[16][2];
|
float sample_locations_16x[16][2];
|
||||||
};
|
};
|
||||||
|
|
||||||
void radv_device_get_cache_uuid(void *uuid);
|
|
||||||
|
|
||||||
struct radv_device_memory {
|
struct radv_device_memory {
|
||||||
struct radeon_winsys_bo *bo;
|
struct radeon_winsys_bo *bo;
|
||||||
uint32_t type_index;
|
uint32_t type_index;
|
||||||
|
Reference in New Issue
Block a user