From: Jason Ekstrand Date: Thu, 9 Jul 2015 22:53:03 +0000 (-0700) Subject: vk: Support GetPhysicalDeviceProperties X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=977a469bce41df42508121433c6e2b86534ec362;p=mesa.git vk: Support GetPhysicalDeviceProperties --- diff --git a/include/vulkan/vulkan.h b/include/vulkan/vulkan.h index 173a697ff62..1fec157a054 100644 --- a/include/vulkan/vulkan.h +++ b/include/vulkan/vulkan.h @@ -1302,14 +1302,7 @@ typedef struct { uint32_t deviceId; VkPhysicalDeviceType deviceType; char deviceName[VK_MAX_PHYSICAL_DEVICE_NAME]; - VkDeviceSize maxInlineMemoryUpdateSize; - uint32_t maxBoundDescriptorSets; - uint32_t maxThreadGroupSize; - uint64_t timestampFrequency; - bool32_t multiColorAttachmentClears; - uint32_t maxDescriptorSets; - uint32_t maxViewports; - uint32_t maxColorAttachments; + uint8_t pipelineCacheUUID[VK_UUID_LENGTH]; } VkPhysicalDeviceProperties; typedef struct { @@ -2019,6 +2012,7 @@ typedef VkResult (VKAPI *PFN_vkGetPhysicalDeviceFeatures)(VkPhysicalDevice physi typedef VkResult (VKAPI *PFN_vkGetPhysicalDeviceInfo)(VkPhysicalDevice physicalDevice, VkPhysicalDeviceInfoType infoType, size_t* pDataSize, void* pData); typedef VkResult (VKAPI *PFN_vkGetPhysicalDeviceFormatInfo)(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties* pFormatInfo); typedef VkResult (VKAPI *PFN_vkGetPhysicalDeviceLimits)(VkPhysicalDevice physicalDevice, VkPhysicalDeviceLimits* pLimits); +typedef VkResult (VKAPI *PFN_vkGetPhysicalDeviceProperties)(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties* pProperties); typedef PFN_vkVoidFunction (VKAPI *PFN_vkGetInstanceProcAddr)(VkInstance instance, const char* pName); typedef PFN_vkVoidFunction (VKAPI *PFN_vkGetDeviceProcAddr)(VkDevice device, const char* pName); typedef VkResult (VKAPI *PFN_vkCreateDevice)(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo* pCreateInfo, VkDevice* pDevice); @@ -2158,6 +2152,10 @@ VkResult VKAPI vkGetPhysicalDeviceLimits( VkPhysicalDevice physicalDevice, VkPhysicalDeviceLimits* pLimits); +VkResult VKAPI vkGetPhysicalDeviceProperties( + VkPhysicalDevice physicalDevice, + VkPhysicalDeviceProperties* pProperties); + PFN_vkVoidFunction VKAPI vkGetInstanceProcAddr( VkInstance instance, const char* pName); diff --git a/src/vulkan/device.c b/src/vulkan/device.c index 3f39f61a0da..c5e35bcc049 100644 --- a/src/vulkan/device.c +++ b/src/vulkan/device.c @@ -28,6 +28,7 @@ #include #include "private.h" +#include "mesa/main/git_sha1.h" static int anv_env_get_int(const char *name) @@ -326,7 +327,7 @@ VkResult anv_GetPhysicalDeviceLimits( .primitiveRestartForPatches = UINT32_MAX, .maxSamplerLodBias = 16, .maxSamplerAnisotropy = 16, - .maxViewports = 32, + .maxViewports = 16, .maxDynamicViewportStates = UINT32_MAX, .maxViewportDimensions = { (1 << 14), (1 << 14) }, .viewportBoundsRange = { -1.0, 1.0 }, /* FIXME */ @@ -354,7 +355,7 @@ VkResult anv_GetPhysicalDeviceLimits( .maxSampledImageIntegerSamples = 1, .maxStorageImageSamples = 1, .maxSampleMaskWords = 1, - .timestampFrequency = 0 /* FIXME */, + .timestampFrequency = 1000 * 1000 * 1000 / 80, .maxClipDistances = 0 /* FIXME */, .maxCullDistances = 0 /* FIXME */, .maxCombinedClipAndCullDistances = 0 /* FIXME */, @@ -367,44 +368,39 @@ VkResult anv_GetPhysicalDeviceLimits( return VK_SUCCESS; } +VkResult anv_GetPhysicalDeviceProperties( + VkPhysicalDevice physicalDevice, + VkPhysicalDeviceProperties* pProperties) +{ + ANV_FROM_HANDLE(anv_physical_device, pdevice, physicalDevice); + + *pProperties = (VkPhysicalDeviceProperties) { + .apiVersion = 1, + .driverVersion = 1, + .vendorId = 0x8086, + .deviceId = pdevice->chipset_id, + .deviceType = VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU, + }; + + strcpy(pProperties->deviceName, pdevice->name); + snprintf((char *)pProperties->pipelineCacheUUID, VK_UUID_LENGTH, + "anv-%s", MESA_GIT_SHA1 + 4); + + return VK_SUCCESS; +} + VkResult anv_GetPhysicalDeviceInfo( VkPhysicalDevice physicalDevice, VkPhysicalDeviceInfoType infoType, size_t* pDataSize, void* pData) { - struct anv_physical_device *device = (struct anv_physical_device *) physicalDevice; - VkPhysicalDeviceProperties *properties; VkPhysicalDevicePerformance *performance; VkPhysicalDeviceQueueProperties *queue_properties; VkPhysicalDeviceMemoryProperties *memory_properties; VkDisplayPropertiesWSI *display_properties; - uint64_t ns_per_tick = 80; switch ((uint32_t) infoType) { - case VK_PHYSICAL_DEVICE_INFO_TYPE_PROPERTIES: - properties = pData; - - *pDataSize = sizeof(*properties); - if (pData == NULL) - return VK_SUCCESS; - - properties->apiVersion = 1; - properties->driverVersion = 1; - properties->vendorId = 0x8086; - properties->deviceId = device->chipset_id; - properties->deviceType = VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU; - strcpy(properties->deviceName, device->name); - properties->maxInlineMemoryUpdateSize = 0; - properties->maxBoundDescriptorSets = MAX_SETS; - properties->maxThreadGroupSize = 512; - properties->timestampFrequency = 1000 * 1000 * 1000 / ns_per_tick; - properties->multiColorAttachmentClears = true; - properties->maxDescriptorSets = 8; - properties->maxViewports = 16; - properties->maxColorAttachments = 8; - return VK_SUCCESS; - case VK_PHYSICAL_DEVICE_INFO_TYPE_PERFORMANCE: performance = pData;