Backport AHB test changes from Khronos review
authorChris Forbes <chrisforbes@google.com>
Thu, 10 May 2018 22:58:21 +0000 (15:58 -0700)
committerChris Forbes <chrisforbes@google.com>
Fri, 11 May 2018 00:07:00 +0000 (17:07 -0700)
Change-Id: I902646e380d18c8c4ee165a7bfe3c6aee6735aa6
Components: Vulkan
Bug: b/79540301
Test: CtsDeqpTestCases

external/vulkancts/modules/vulkan/api/vktApiExternalMemoryTests.cpp

index 7f00b71..9724e19 100644 (file)
@@ -3855,7 +3855,7 @@ deUint32 vkFormatToAhbFormat(deUint64 vkFormat) {
        return 0u;
 }
 
-bool ValidateAHardwareBuffer(vk::VkFormat format, deUint32 requiredAhbUsage, const vk::InstanceDriver& vki, const vk::VkDevice& device) {
+bool ValidateAHardwareBuffer(vk::VkFormat format, deUint32 requiredAhbUsage, const vk::DeviceDriver& vkd, const vk::VkDevice& device) {
        AHardwareBuffer_Desc    hbufferdesc =
        {
                64u,
@@ -3872,6 +3872,9 @@ bool ValidateAHardwareBuffer(vk::VkFormat format, deUint32 requiredAhbUsage, con
        if (!hbuffer)
                return false;
 
+       NativeHandle nativeHandle;
+       nativeHandle = vk::pt::AndroidHardwareBufferPtr(hbuffer);
+
        vk::VkAndroidHardwareBufferFormatPropertiesANDROID formatProperties =
        {
                vk::VK_STRUCTURE_TYPE_ANDROID_HARDWARE_BUFFER_FORMAT_PROPERTIES_ANDROID,
@@ -3890,10 +3893,8 @@ bool ValidateAHardwareBuffer(vk::VkFormat format, deUint32 requiredAhbUsage, con
                0u,
                0u
        };
-       vk::GetAndroidHardwareBufferPropertiesANDROIDFunc func =
-                       (vk::GetAndroidHardwareBufferPropertiesANDROIDFunc)vki.getDeviceProcAddr(device, "vkGetAndroidHardwareBufferPropertiesANDROID");
 
-       VK_CHECK(func(device, vk::pt::AndroidHardwareBufferPtr(hbuffer), &bufferProperties));
+       VK_CHECK(vkd.getAndroidHardwareBufferPropertiesANDROID(device, vk::pt::AndroidHardwareBufferPtr(hbuffer), &bufferProperties));
        TCU_CHECK(formatProperties.format != vk::VK_FORMAT_UNDEFINED);
        TCU_CHECK(formatProperties.format == format);
        TCU_CHECK(formatProperties.externalFormat != 0u);
@@ -3969,7 +3970,7 @@ tcu::TestStatus testAndroidHardwareBufferImageFormat(Context& context, vk::VkFor
                        continue;
 
                // Only test a combination if AHardwareBuffer can be successfully allocated for it.
-               if (!ValidateAHardwareBuffer(format, requiredAhbUsage, vki, *device))
+               if (!ValidateAHardwareBuffer(format, requiredAhbUsage, vkd, *device))
                        continue;
 
                const vk::VkPhysicalDeviceExternalImageFormatInfo       externalInfo            =