Fixed dEQP-VK.wsi.*.full_screen_exclusive.* tests
authorMarcin Kańtoch <marcin.kantoch@amd.com>
Thu, 14 Jan 2021 18:11:49 +0000 (19:11 +0100)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Fri, 29 Jan 2021 07:56:08 +0000 (07:56 +0000)
Full list of fixes described in the issue.

Components: Vulkan

VK-GL-CTS issue: 2746

Affects:
dEQP-VK.wsi.*.full_screen_exclusive.*

Change-Id: I787fb775a1b3a88c6308d1ab8a7f37d11fa9a049

external/vulkancts/framework/vulkan/vkDefs.cpp
external/vulkancts/framework/vulkan/vkWsiPlatform.cpp
external/vulkancts/framework/vulkan/vkWsiPlatform.hpp
external/vulkancts/modules/vulkan/wsi/vktWsiFullScreenExclusiveTests.cpp
framework/platform/win32/tcuWin32VulkanPlatform.cpp
framework/platform/win32/tcuWin32Window.cpp
framework/platform/win32/tcuWin32Window.hpp

index d8b004e..2055e10 100644 (file)
@@ -96,6 +96,9 @@ void checkWsiResult (VkResult result, const char* msg, const char* file, int lin
        if (result == VK_SUBOPTIMAL_KHR)
                return;
 
+       if (result == VK_ERROR_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT)
+               return;
+
        checkResult(result, msg, file, line);
 }
 
index 5cf0edf..2743821 100644 (file)
@@ -34,6 +34,10 @@ void Window::setVisible (bool visible)
        TCU_THROW(InternalError, "setVisible() called on window not supporting it");
 }
 
+void Window::setForeground(void)
+{
+}
+
 void Window::resize (const tcu::UVec2&)
 {
        TCU_THROW(InternalError, "resize() called on window not supporting it");
index f37087b..9759fa9 100644 (file)
@@ -38,6 +38,7 @@ public:
        virtual                         ~Window                 (void) {}
 
        virtual void            setVisible              (bool visible);
+       virtual void            setForeground   (void);
        virtual void            resize                  (const tcu::UVec2& newSize);
 
 protected:
index ab58de1..f0130aa 100644 (file)
@@ -332,22 +332,35 @@ std::vector<CommandBufferSp> allocateCommandBuffers (const DeviceInterface&               vkd
        return buffers;
 }
 
-tcu::TestStatus fullScreenExclusiveTest (Context& context,
-                                                                                TestParams testParams)
+tcu::TestStatus fullScreenExclusiveTest(Context& context,
+       TestParams testParams)
 {
        if (!de::contains(context.getDeviceExtensions().begin(), context.getDeviceExtensions().end(), "VK_EXT_full_screen_exclusive"))
                TCU_THROW(NotSupportedError, "Extension VK_EXT_full_screen_exclusive not supported");
 
-       const InstanceHelper                                            instHelper                                      (context, testParams.wsiType);
-       const NativeObjects                                                     native                                          (context, instHelper.supportedExtensions, testParams.wsiType);
-       const Unique<VkSurfaceKHR>                                      surface                                         (createSurface(instHelper.vki, instHelper.instance, testParams.wsiType, *native.display, *native.window));
-       const DeviceHelper                                                      devHelper                                       (context, instHelper.vki, instHelper.instance, *surface);
-       const std::vector<VkExtensionProperties>        deviceExtensions                        (enumerateDeviceExtensionProperties(instHelper.vki, devHelper.physicalDevice, DE_NULL));
+       const InstanceHelper                                            instHelper(context, testParams.wsiType);
+       const NativeObjects                                                     native(context, instHelper.supportedExtensions, testParams.wsiType);
+       const Unique<VkSurfaceKHR>                                      surface(createSurface(instHelper.vki, instHelper.instance, testParams.wsiType, *native.display, *native.window));
+       const DeviceHelper                                                      devHelper(context, instHelper.vki, instHelper.instance, *surface);
+       const std::vector<VkExtensionProperties>        deviceExtensions(enumerateDeviceExtensionProperties(instHelper.vki, devHelper.physicalDevice, DE_NULL));
        if (!isExtensionSupported(deviceExtensions, RequiredExtension("VK_EXT_full_screen_exclusive")))
                TCU_THROW(NotSupportedError, "Extension VK_EXT_full_screen_exclusive not supported");
 
        native.window->setVisible(true);
 
+       if (testParams.wsiType == TYPE_WIN32)
+       {
+               native.window->setForeground();
+       }
+
+       // add information about full screen exclusive to VkSwapchainCreateInfoKHR
+       VkSurfaceFullScreenExclusiveInfoEXT                     fseInfo =
+       {
+               VK_STRUCTURE_TYPE_SURFACE_FULL_SCREEN_EXCLUSIVE_INFO_EXT,                       // VkStructureType             sType;
+               DE_NULL,                                                                                                                        // void*                       pNext;
+               testParams.fseType                                                                                                      // VkFullScreenExclusiveEXT    fullScreenExclusive;
+       };
+
        // for Win32 - create structure containing HMONITOR value
 #if ( DE_OS == DE_OS_WIN32 )
        VkSurfaceFullScreenExclusiveWin32InfoEXT        fseWin32Info                            = {
@@ -378,10 +391,13 @@ tcu::TestStatus fullScreenExclusiveTest (Context& context,
                DE_NULL,                                                                                                                        // const void*        pNext;
                *surface                                                                                                                        // VkSurfaceKHR       surface;
        };
+
+       surfaceInfo.pNext = &fseInfo;
+
 #if ( DE_OS == DE_OS_WIN32 )
        if (testParams.wsiType == TYPE_WIN32)
        {
-               surfaceInfo.pNext = &fseWin32Info;
+               fseInfo.pNext = &fseWin32Info;
        }
 #endif
 
@@ -399,13 +415,6 @@ tcu::TestStatus fullScreenExclusiveTest (Context& context,
 
        VkSwapchainCreateInfoKHR                                        swapchainInfo                           = getBasicSwapchainParameters(testParams.wsiType, instHelper.vki, devHelper.physicalDevice, *surface, surfaceFormats[0], native.windowSize, 2);
 
-       // add information about full screen exclusive to VkSwapchainCreateInfoKHR
-       VkSurfaceFullScreenExclusiveInfoEXT                     fseInfo                                         =
-       {
-               VK_STRUCTURE_TYPE_SURFACE_FULL_SCREEN_EXCLUSIVE_INFO_EXT,                       // VkStructureType             sType;
-               DE_NULL,                                                                                                                        // void*                       pNext;
-               testParams.fseType                                                                                                      // VkFullScreenExclusiveEXT    fullScreenExclusive;
-       };
        swapchainInfo.pNext = &fseInfo;
 
 #if ( DE_OS == DE_OS_WIN32 )
@@ -471,14 +480,11 @@ tcu::TestStatus fullScreenExclusiveTest (Context& context,
                                        }
                                        case VK_ERROR_INITIALIZATION_FAILED:
                                        {
-                                               if (frameNdx > 3)
-                                                       throw tcu::TestError("vkAcquireFullScreenExclusiveModeEXT was not able to succeed in first 3 draw frames");
                                                break;
                                        }
                                        case VK_ERROR_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT:
                                        {
                                                context.getTestContext().getLog() << tcu::TestLog::Message << "Got VK_ERROR_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT at vkAcquireFullScreenExclusiveModeEXT. Frame " << frameNdx << tcu::TestLog::EndMessage;
-                                               VK_CHECK(acquireResult);
                                                break;
                                        }
                                        default:
@@ -503,7 +509,7 @@ tcu::TestStatus fullScreenExclusiveTest (Context& context,
                                                                                                                                                  &imageNdx);
                                if (acquireResult == VK_ERROR_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT)
                                        context.getTestContext().getLog() << tcu::TestLog::Message << "Got VK_ERROR_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT at vkAcquireNextImageKHR" << tcu::TestLog::EndMessage;
-                               VK_CHECK(acquireResult);
+                               VK_CHECK_WSI(acquireResult);
                        }
 
                        TCU_CHECK((size_t)imageNdx < swapchainImages.size());
@@ -559,12 +565,19 @@ tcu::TestStatus fullScreenExclusiveTest (Context& context,
                const VkResult releaseResult = vkd.releaseFullScreenExclusiveModeEXT(device, *swapchain);
                if (releaseResult == VK_ERROR_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT)
                        context.getTestContext().getLog() << tcu::TestLog::Message << "Got VK_ERROR_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT at vkReleaseFullScreenExclusiveModeEXT" << tcu::TestLog::EndMessage;
-               VK_CHECK(releaseResult);
+               VK_CHECK_WSI(releaseResult);
        }
 
        native.window->setVisible(false);
 
-       return tcu::TestStatus::pass("Rendering tests succeeded");
+       if (fullScreenAcquired)
+       {
+               return tcu::TestStatus::pass("Rendering tests succeeded");
+       }
+       else
+       {
+               return  tcu::TestStatus(QP_TEST_RESULT_QUALITY_WARNING, "Failed to acquire full screen exclusive, but did not end with an error.");
+       }
 }
 
 void getBasicRenderPrograms (SourceCollections& dst, TestParams)
index 7edefb5..cf31dda 100644 (file)
@@ -60,6 +60,11 @@ public:
                m_window->setVisible(visible);
        }
 
+       void setForeground(void)
+       {
+               m_window->setForeground();
+       }
+
        void resize (const UVec2& newSize)
        {
                m_window->setSize((int)newSize.x(), (int)newSize.y());
index ab9401f..b2f83ff 100644 (file)
@@ -101,6 +101,11 @@ void Window::setVisible (bool visible)
        ShowWindow(m_window, visible ? SW_SHOW : SW_HIDE);
 }
 
+void Window::setForeground(void)
+{
+       SetForegroundWindow(m_window);
+}
+
 void Window::setSize (int width, int height)
 {
        RECT rc;
index 93a90fe..be4a939 100644 (file)
@@ -39,6 +39,7 @@ public:
                                ~Window                         (void);
 
        void            setVisible                      (bool visible);
+       void            setForeground           (void);
        void            setSize                         (int width, int height);
 
        LRESULT         windowProc                      (UINT uMsg, WPARAM wParam, LPARAM lParam);