Add test for VK_KHR_driver_properties
authorMaciej Jesionowski <maciej.jesionowski@amd.com>
Tue, 3 Apr 2018 11:52:00 +0000 (13:52 +0200)
committerAlexander Galazin <alexander.galazin@arm.com>
Wed, 19 Sep 2018 15:28:00 +0000 (17:28 +0200)
New tests:
dEQP-VK.api.driver_properties.properties

Components: Vulkan
VK-GL-CTS issue: 1098

Change-Id: Ifcb774700c45f76e48a03b147472a506d274c192
(cherry picked from commit eb5806aab57fdf89850be8916e194c3d3b54c8d9)

16 files changed:
AndroidGen.mk
android/cts/master/vk-master.txt
external/vulkancts/framework/vulkan/vkBasicTypes.inl
external/vulkancts/framework/vulkan/vkGetStructureTypeImpl.inl
external/vulkancts/framework/vulkan/vkStrUtil.inl
external/vulkancts/framework/vulkan/vkStrUtilImpl.inl
external/vulkancts/framework/vulkan/vkStructTypes.inl
external/vulkancts/framework/vulkan/vkTypeUtil.inl
external/vulkancts/modules/vulkan/api/CMakeLists.txt
external/vulkancts/modules/vulkan/api/vktApiDriverPropertiesTests.cpp [new file with mode: 0644]
external/vulkancts/modules/vulkan/api/vktApiDriverPropertiesTests.hpp [new file with mode: 0644]
external/vulkancts/modules/vulkan/api/vktApiTests.cpp
external/vulkancts/mustpass/1.1.2/vk-default-no-waivers.txt
external/vulkancts/mustpass/1.1.2/vk-default.txt
external/vulkancts/scripts/gen_framework.py
external/vulkancts/scripts/src/vulkan.h.in

index 3647b83..d1338e1 100644 (file)
@@ -65,6 +65,7 @@ LOCAL_SRC_FILES := \
        external/vulkancts/modules/vulkan/api/vktApiDescriptorPoolTests.cpp \
        external/vulkancts/modules/vulkan/api/vktApiDescriptorSetTests.cpp \
        external/vulkancts/modules/vulkan/api/vktApiDeviceInitializationTests.cpp \
+       external/vulkancts/modules/vulkan/api/vktApiDriverPropertiesTests.cpp \
        external/vulkancts/modules/vulkan/api/vktApiExternalMemoryTests.cpp \
        external/vulkancts/modules/vulkan/api/vktApiFeatureInfo.cpp \
        external/vulkancts/modules/vulkan/api/vktApiFillBufferTests.cpp \
index d9850f6..69d2a45 100755 (executable)
@@ -4,6 +4,7 @@ dEQP-VK.info.platform
 dEQP-VK.info.memory_limits
 dEQP-VK.api.version_check.version
 dEQP-VK.api.version_check.entry_points
+dEQP-VK.api.driver_properties.properties
 dEQP-VK.api.smoke.create_sampler
 dEQP-VK.api.smoke.create_shader
 dEQP-VK.api.smoke.triangle
index a3c585c..35deb28 100644 (file)
@@ -5,6 +5,8 @@
 #define VK_API_VERSION_1_1                                     (static_cast<deUint32>                  (VK_MAKE_VERSION(1, 1, 0)))
 #define VK_MAX_PHYSICAL_DEVICE_NAME_SIZE       (static_cast<size_t>                    (256))
 #define VK_MAX_EXTENSION_NAME_SIZE                     (static_cast<size_t>                    (256))
+#define VK_MAX_DRIVER_NAME_SIZE_KHR                    (static_cast<size_t>                    (256))
+#define VK_MAX_DRIVER_INFO_SIZE_KHR                    (static_cast<size_t>                    (256))
 #define VK_UUID_SIZE                                           (static_cast<size_t>                    (16))
 #define VK_LUID_SIZE                                           (static_cast<size_t>                    (8))
 #define VK_MAX_MEMORY_TYPES                                    (static_cast<size_t>                    (32))
index 1ed5020..def240d 100644 (file)
@@ -841,6 +841,11 @@ template<> VkStructureType getStructureType<VkImageFormatListCreateInfoKHR> (voi
        return VK_STRUCTURE_TYPE_IMAGE_FORMAT_LIST_CREATE_INFO_KHR;
 }
 
+template<> VkStructureType getStructureType<VkPhysicalDeviceDriverPropertiesKHR> (void)
+{
+       return VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES_KHR;
+}
+
 template<> VkStructureType getStructureType<VkDebugReportCallbackCreateInfoEXT> (void)
 {
        return VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT;
index ef29603..8ebd354 100644 (file)
@@ -518,6 +518,8 @@ std::ostream&       operator<<      (std::ostream& s, const VkDisplayModeProperties2KHR& va
 std::ostream&  operator<<      (std::ostream& s, const VkDisplayPlaneInfo2KHR& value);
 std::ostream&  operator<<      (std::ostream& s, const VkDisplayPlaneCapabilities2KHR& value);
 std::ostream&  operator<<      (std::ostream& s, const VkImageFormatListCreateInfoKHR& value);
+std::ostream&  operator<<      (std::ostream& s, const VkConformanceVersionKHR& value);
+std::ostream&  operator<<      (std::ostream& s, const VkPhysicalDeviceDriverPropertiesKHR& value);
 std::ostream&  operator<<      (std::ostream& s, const VkDebugReportCallbackCreateInfoEXT& value);
 std::ostream&  operator<<      (std::ostream& s, const VkPipelineRasterizationStateRasterizationOrderAMD& value);
 std::ostream&  operator<<      (std::ostream& s, const VkDebugMarkerObjectNameInfoEXT& value);
index 93512de..5417f96 100644 (file)
@@ -5373,6 +5373,30 @@ std::ostream& operator<< (std::ostream& s, const VkImageFormatListCreateInfoKHR&
        return s;
 }
 
+std::ostream& operator<< (std::ostream& s, const VkConformanceVersionKHR& value)
+{
+       s << "VkConformanceVersionKHR = {\n";
+       s << "\tmajor = " << value.major << '\n';
+       s << "\tminor = " << value.minor << '\n';
+       s << "\tsubminor = " << value.subminor << '\n';
+       s << "\tpatch = " << value.patch << '\n';
+       s << '}';
+       return s;
+}
+
+std::ostream& operator<< (std::ostream& s, const VkPhysicalDeviceDriverPropertiesKHR& value)
+{
+       s << "VkPhysicalDeviceDriverPropertiesKHR = {\n";
+       s << "\tsType = " << value.sType << '\n';
+       s << "\tpNext = " << value.pNext << '\n';
+       s << "\tdriverID = " << value.driverID << '\n';
+       s << "\tdriverName = " << '\n' << tcu::formatArray(tcu::Format::HexIterator<char>(DE_ARRAY_BEGIN(value.driverName)), tcu::Format::HexIterator<char>(DE_ARRAY_END(value.driverName))) << '\n';
+       s << "\tdriverInfo = " << '\n' << tcu::formatArray(tcu::Format::HexIterator<char>(DE_ARRAY_BEGIN(value.driverInfo)), tcu::Format::HexIterator<char>(DE_ARRAY_END(value.driverInfo))) << '\n';
+       s << "\tconformanceVersion = " << value.conformanceVersion << '\n';
+       s << '}';
+       return s;
+}
+
 std::ostream& operator<< (std::ostream& s, const VkDebugReportCallbackCreateInfoEXT& value)
 {
        s << "VkDebugReportCallbackCreateInfoEXT = {\n";
index bbad92b..c2d7f0c 100644 (file)
@@ -2328,6 +2328,24 @@ struct VkImageFormatListCreateInfoKHR
        const VkFormat* pViewFormats;
 };
 
+struct VkConformanceVersionKHR
+{
+       deUint8 major;
+       deUint8 minor;
+       deUint8 subminor;
+       deUint8 patch;
+};
+
+struct VkPhysicalDeviceDriverPropertiesKHR
+{
+       VkStructureType                 sType;
+       void*                                   pNext;
+       deUint32                                driverID;
+       char                                    driverName[VK_MAX_DRIVER_NAME_SIZE_KHR];
+       char                                    driverInfo[VK_MAX_DRIVER_INFO_SIZE_KHR];
+       VkConformanceVersionKHR conformanceVersion;
+};
+
 struct VkDebugReportCallbackCreateInfoEXT
 {
        VkStructureType                                 sType;
index b5c4fe6..c8247cb 100644 (file)
@@ -422,6 +422,16 @@ inline VkPresentRegionKHR makePresentRegionKHR (deUint32 rectangleCount, const V
        return res;
 }
 
+inline VkConformanceVersionKHR makeConformanceVersionKHR (deUint8 major, deUint8 minor, deUint8 subminor, deUint8 patch)
+{
+       VkConformanceVersionKHR res;
+       res.major               = major;
+       res.minor               = minor;
+       res.subminor    = subminor;
+       res.patch               = patch;
+       return res;
+}
+
 inline VkIndirectCommandsTokenNVX makeIndirectCommandsTokenNVX (VkIndirectCommandsTokenTypeNVX tokenType, VkBuffer buffer, VkDeviceSize offset)
 {
        VkIndirectCommandsTokenNVX res;
index d08768c..1e75ea7 100644 (file)
@@ -11,6 +11,8 @@ set(DEQP_VK_API_SRCS
        vktApiSmokeTests.hpp
        vktApiDeviceInitializationTests.cpp
        vktApiDeviceInitializationTests.hpp
+       vktApiDriverPropertiesTests.cpp
+       vktApiDriverPropertiesTests.hpp
        vktApiObjectManagementTests.cpp
        vktApiObjectManagementTests.hpp
        vktApiBufferTests.cpp
diff --git a/external/vulkancts/modules/vulkan/api/vktApiDriverPropertiesTests.cpp b/external/vulkancts/modules/vulkan/api/vktApiDriverPropertiesTests.cpp
new file mode 100644 (file)
index 0000000..d9e5958
--- /dev/null
@@ -0,0 +1,165 @@
+/*-------------------------------------------------------------------------
+* Vulkan Conformance Tests
+* ------------------------
+*
+* Copyright (c) 2018 Advanced Micro Devices, Inc.
+* Copyright (c) 2018 The Khronos Group Inc.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*      http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+*//*!
+* \file
+* \brief VK_KHR_driver_properties tests
+*//*--------------------------------------------------------------------*/
+
+#include "vktApiDriverPropertiesTests.hpp"
+#include "vktTestGroupUtil.hpp"
+#include "vktTestCaseUtil.hpp"
+#include "vkQueryUtil.hpp"
+#include "vkTypeUtil.hpp"
+
+using namespace vk;
+
+namespace vkt
+{
+namespace api
+{
+namespace
+{
+
+static const deUint32 knownDriverIds[] =
+{
+       // Specified in the Vulkan registry (vk.xml)
+       1,      // author = "Advanced Micro Devices, Inc."   comment = "AMD proprietary driver"
+       2,      // author = "Advanced Micro Devices, Inc."   comment = "AMD open-source driver"
+       3,      // author = "Mesa open source project"       comment = "Mesa RADV driver"
+       4,      // author = "NVIDIA Corporation"             comment = "NVIDIA proprietary driver"
+       5,      // author = "Intel Corporation"              comment = "Intel proprietary Windows driver"
+       6,      // author = "Intel Corporation"              comment = "Intel open-source Mesa driver"
+       7,      // author = "Imagination Technologies"       comment = "Imagination proprietary driver"
+       8,      // author = "Qualcomm Technologies, Inc."    comment = "Qualcomm proprietary driver"
+       9,      // author = "Arm Limited"                    comment = "Arm proprietary driver"
+};
+
+static const VkConformanceVersionKHR knownConformanceVersions[] =
+{
+       makeConformanceVersionKHR(1, 1, 2, 1),
+       makeConformanceVersionKHR(1, 1, 2, 0),
+       makeConformanceVersionKHR(1, 1, 1, 3),
+       makeConformanceVersionKHR(1, 1, 1, 2),
+       makeConformanceVersionKHR(1, 1, 1, 1),
+       makeConformanceVersionKHR(1, 1, 1, 0),
+       makeConformanceVersionKHR(1, 1, 0, 3),
+       makeConformanceVersionKHR(1, 0, 2, 6),
+       makeConformanceVersionKHR(1, 0, 2, 5),
+       makeConformanceVersionKHR(1, 0, 2, 4),
+       makeConformanceVersionKHR(1, 0, 2, 3),
+       makeConformanceVersionKHR(1, 0, 2, 2),
+       makeConformanceVersionKHR(1, 0, 2, 1),
+       makeConformanceVersionKHR(1, 0, 2, 0),
+};
+
+DE_INLINE bool isNullTerminated(const char* str, const deUint32 maxSize)
+{
+       return deStrnlen(str, maxSize) < maxSize;
+}
+
+DE_INLINE bool operator==(const VkConformanceVersionKHR& a, const VkConformanceVersionKHR& b)
+{
+       return ((a.major == b.major)            &&
+                       (a.minor == b.minor)            &&
+                       (a.subminor == b.subminor)      &&
+                       (a.patch == b.patch));
+}
+
+tcu::TestStatus testQueryProperties (Context& context)
+{
+       // Check extension support
+
+       if (!isDeviceExtensionSupported(context.getUsedApiVersion(), context.getDeviceExtensions(), "VK_KHR_driver_properties"))
+               TCU_THROW(NotSupportedError, "Unsupported extension: VK_KHR_driver_properties");
+
+       // Query the driver properties
+
+       const VkPhysicalDevice                          physDevice                      = context.getPhysicalDevice();
+       const int                                                       memsetPattern           = 0xaa;
+       VkPhysicalDeviceProperties2                     deviceProperties2;
+       VkPhysicalDeviceDriverPropertiesKHR     deviceDriverProperties;
+
+       deMemset(&deviceDriverProperties, memsetPattern, sizeof(deviceDriverProperties));
+       deviceDriverProperties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES_KHR;
+       deviceDriverProperties.pNext = DE_NULL;
+
+       deMemset(&deviceProperties2, memsetPattern, sizeof(deviceProperties2));
+       deviceProperties2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2;
+       deviceProperties2.pNext = &deviceDriverProperties;
+
+       context.getInstanceInterface().getPhysicalDeviceProperties2(physDevice, &deviceProperties2);
+
+       // Verify the returned values
+
+       bool match = false;
+
+       for (const deUint32* pDriverId = knownDriverIds; (pDriverId != DE_ARRAY_END(knownDriverIds)) && !match; ++pDriverId)
+       {
+               if (deviceDriverProperties.driverID == *pDriverId)
+               {
+                       match = true;
+
+                       if (!isNullTerminated(deviceDriverProperties.driverName, VK_MAX_DRIVER_NAME_SIZE_KHR))
+                               TCU_FAIL("Driver name is not a null-terminated string");
+
+                       if (deviceDriverProperties.driverName[0] == 0)
+                               TCU_FAIL("Driver name is empty");
+
+                       if (!isNullTerminated(deviceDriverProperties.driverInfo, VK_MAX_DRIVER_INFO_SIZE_KHR))
+                               TCU_FAIL("Driver info is not a null-terminated string");
+
+                       bool conformanceVersionMatch = false;
+
+                       for (const VkConformanceVersionKHR* pConformanceVersion  = knownConformanceVersions;
+                                                                                               pConformanceVersion != DE_ARRAY_END(knownConformanceVersions);
+                                                                                         ++pConformanceVersion)
+                       {
+                               if (deviceDriverProperties.conformanceVersion == *pConformanceVersion)
+                               {
+                                       conformanceVersionMatch = true;
+                                       break;
+                               }
+                       }
+
+                       if (!conformanceVersionMatch)
+                               TCU_FAIL("Wrong driver conformance version");
+               }
+       }
+
+       if (!match)
+               TCU_FAIL("Driver ID did not match any known driver");
+
+       return tcu::TestStatus::pass("Pass");
+}
+
+void createTestCases (tcu::TestCaseGroup* group)
+{
+       addFunctionCase(group, "properties", "Query VkPhysicalDeviceDriverPropertiesKHR and check its values", testQueryProperties);
+}
+
+} // anonymous
+
+tcu::TestCaseGroup*    createDriverPropertiesTests(tcu::TestContext& testCtx)
+{
+       return createTestGroup(testCtx, "driver_properties", "VK_KHR_driver_properties tests", createTestCases);
+}
+
+} // api
+} // vkt
diff --git a/external/vulkancts/modules/vulkan/api/vktApiDriverPropertiesTests.hpp b/external/vulkancts/modules/vulkan/api/vktApiDriverPropertiesTests.hpp
new file mode 100644 (file)
index 0000000..7fa039a
--- /dev/null
@@ -0,0 +1,40 @@
+#ifndef _VKTAPIDRIVERPROPERTIESTESTS_HPP
+#define _VKTAPIDRIVERPROPERTIESTESTS_HPP
+/*-------------------------------------------------------------------------
+ * Vulkan Conformance Tests
+ * ------------------------
+ *
+ * Copyright (c) 2018 Advanced Micro Devices, Inc.
+ * Copyright (c) 2018 The Khronos Group Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *//*!
+ * \file
+ * \brief VK_KHR_driver_properties tests
+ *//*--------------------------------------------------------------------*/
+
+#include "tcuDefs.hpp"
+#include "tcuTestCase.hpp"
+
+namespace vkt
+{
+namespace api
+{
+
+tcu::TestCaseGroup*    createDriverPropertiesTests     (tcu::TestContext& testCtx);
+
+} // api
+} // vkt
+
+#endif // _VKTAPIDRIVERPROPERTIESTESTS_HPP
index 04d7843..3d854f2 100644 (file)
@@ -26,6 +26,7 @@
 #include "vktTestGroupUtil.hpp"
 #include "vktApiSmokeTests.hpp"
 #include "vktApiDeviceInitializationTests.hpp"
+#include "vktApiDriverPropertiesTests.hpp"
 #include "vktApiObjectManagementTests.hpp"
 #include "vktApiBufferTests.hpp"
 #include "vktApiBufferViewCreateTests.hpp"
@@ -66,6 +67,7 @@ void createApiTests (tcu::TestCaseGroup* apiTests)
        tcu::TestContext&       testCtx         = apiTests->getTestContext();
 
        apiTests->addChild(createVersionSanityCheckTests        (testCtx));
+       apiTests->addChild(createDriverPropertiesTests          (testCtx));
        apiTests->addChild(createSmokeTests                                     (testCtx));
        apiTests->addChild(api::createFeatureInfoTests          (testCtx));
        apiTests->addChild(createDeviceInitializationTests      (testCtx));
index b92ff8c..7f4d25e 100644 (file)
@@ -4,6 +4,7 @@ dEQP-VK.info.platform
 dEQP-VK.info.memory_limits
 dEQP-VK.api.version_check.version
 dEQP-VK.api.version_check.entry_points
+dEQP-VK.api.driver_properties.properties
 dEQP-VK.api.smoke.create_sampler
 dEQP-VK.api.smoke.create_shader
 dEQP-VK.api.smoke.triangle
index 4bde02d..f6ecc0c 100644 (file)
@@ -4,6 +4,7 @@ dEQP-VK.info.platform
 dEQP-VK.info.memory_limits
 dEQP-VK.api.version_check.version
 dEQP-VK.api.version_check.entry_points
+dEQP-VK.api.driver_properties.properties
 dEQP-VK.api.smoke.create_sampler
 dEQP-VK.api.smoke.create_shader
 dEQP-VK.api.smoke.triangle
index 4fb499a..8384151 100644 (file)
@@ -46,6 +46,8 @@ DEFINITIONS                   = [
        ("VK_API_VERSION_1_1",                                  "deUint32"),
        ("VK_MAX_PHYSICAL_DEVICE_NAME_SIZE",    "size_t"),
        ("VK_MAX_EXTENSION_NAME_SIZE",                  "size_t"),
+       ("VK_MAX_DRIVER_NAME_SIZE_KHR",                 "size_t"),
+       ("VK_MAX_DRIVER_INFO_SIZE_KHR",                 "size_t"),
        ("VK_UUID_SIZE",                                                "size_t"),
        ("VK_LUID_SIZE",                                                "size_t"),
        ("VK_MAX_MEMORY_TYPES",                                 "size_t"),
index 04de561..89ebb0d 100755 (executable)
@@ -6215,6 +6215,28 @@ VKAPI_ATTR void VKAPI_CALL vkGetDescriptorSetLayoutSupportKHR(
     VkDescriptorSetLayoutSupport*               pSupport);
 #endif
 
+#define VK_KHR_driver_properties 1
+#define VK_MAX_DRIVER_NAME_SIZE_KHR       256
+#define VK_MAX_DRIVER_INFO_SIZE_KHR       256
+#define VK_KHR_DRIVER_PROPERTIES_SPEC_VERSION 1
+#define VK_KHR_DRIVER_PROPERTIES_EXTENSION_NAME "VK_KHR_driver_properties"
+
+typedef struct VkConformanceVersionKHR {
+    uint8_t    major;
+    uint8_t    minor;
+    uint8_t    subminor;
+    uint8_t    patch;
+} VkConformanceVersionKHR;
+
+typedef struct VkPhysicalDeviceDriverPropertiesKHR {
+    VkStructureType            sType;
+    void*                      pNext;
+    uint32_t                   driverID;
+    char                       driverName[VK_MAX_DRIVER_NAME_SIZE_KHR];
+    char                       driverInfo[VK_MAX_DRIVER_INFO_SIZE_KHR];
+    VkConformanceVersionKHR    conformanceVersion;
+} VkPhysicalDeviceDriverPropertiesKHR;
+
 #define VK_EXT_debug_report 1
 VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDebugReportCallbackEXT)