Bug 111097 - Can not detect VK_ERROR_OUT_OF_DATE_KHR or VK_SUBOPTIMAL_KHR when window resizing
Summary: Can not detect VK_ERROR_OUT_OF_DATE_KHR or VK_SUBOPTIMAL_KHR when window resi...
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/Vulkan/intel (show other bugs)
Version: 19.1
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Intel 3D Bugs Mailing List
QA Contact: Intel 3D Bugs Mailing List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-07-10 00:26 UTC by xu xing
Modified: 2019-07-21 17:31 UTC (History)
4 users (show)

See Also:
i915 platform:
i915 features:


Attachments
angle_resize_binary_testcase (4.21 MB, application/gzip)
2019-07-12 00:49 UTC, xu xing
Details

Description xu xing 2019-07-10 00:26:37 UTC
When window is resized, vkQueuePresentKHR should return VK_ERROR_OUT_OF_DATE_KHR.
vkAcquireNextImageKHR should return VK_ERROR_OUT_OF_DATE_KHR || VK_SUBOPTIMAL_KHR. 
So that application got a chance to recreate the swap-chain. But on several Linux HD graphics, it always return VK_SUCESS.

These are detailed in the vulkan spec(https://www.khronos.org/registry/vulkan/specs/1.1-extensions/man/html/VkResult.html):
“VK_ERROR_OUT_OF_DATE_KHR A surface has changed in such a way that it is no longer compatible with the swapchain, and further presentation requests using the swapchain will fail. Applications must query the new surface properties and recreate their swapchain if they wish to continue presenting to the surface.
VK_SUBOPTIMAL_KHR A swapchain no longer matches the surface properties exactly, but can still be used to present to the surface successfully."

Reproduce steps:
1. Download angle source and install deps:
git clone https://chromium.googlesource.com/angle/angle
cd angle
python scripts/bootstrap.py
gclient sync
git checkout master
./build/install-build-deps.sh
gn gen out/Release

2.  disable feature 'perFrameWindowSizeQuery' in RendererVk.cpp
+++ b/src/libANGLE/renderer/vulkan/RendererVk.cpp
@@ -1242,7 +1242,7 @@ void RendererVk::initFeatures(const ExtensionNameList &deviceExtensionNames)
     if (IsIntel(mPhysicalDeviceProperties.vendorID) ||
         (IsWindows() && IsAMD(mPhysicalDeviceProperties.vendorID)))
     {
-        mFeatures.perFrameWindowSizeQuery.enabled = true;
+        mFeatures.perFrameWindowSizeQuery.enabled = false;


If you meet fenceInfo unused error, try patch as below:
--- a/src/libANGLE/renderer/vulkan/ContextVk.cpp
+++ b/src/libANGLE/renderer/vulkan/ContextVk.cpp
@@ -683,9 +683,9 @@ angle::Result ContextVk::submitFrame(const VkSubmitInfo &submitInfo,
                                  	vk::PrimaryCommandBuffer &&commandBuffer)
 {
 	ANGLE_TRACE_EVENT0("gpu.angle", "RendererVk::submitFrame");
-	VkFenceCreateInfo fenceInfo = {};
-	fenceInfo.sType         	= VK_STRUCTURE_TYPE_FENCE_CREATE_INFO;
-	fenceInfo.flags         	= 0;
+	//VkFenceCreateInfo fenceInfo = {};
+	//fenceInfo.sType         	= VK_STRUCTURE_TYPE_FENCE_CREATE_INFO;
+	//fenceInfo.flags         	= 0;

3.  Build
ninja -C out/Release

4.  Run test case
./out/Release/angle_end2end_tests --gtest_filter=EGLSurfaceTest.ResizeWindow/ES2_Vulkan_NoFixture

I have reproduced this issue on below platforms:
Mesa 18.0.5/Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor Integrated Graphics Controller (rev 06)/Ubuntu 18.04
Mesa 19.1.1/Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor Integrated Graphics Controller (rev 06)/Ubuntu 18.04
Mesa 19.1.1/Intel I7 7700K/Intel HD Graphics 630 (Kaby Lake GT2)/Ubuntu 19.04

I can not reproduce this on:
OpenGL version string: 4.6.0 NVIDIA 430.26/GeForce GTX 1060/Ubuntu 18.04.
Comment 1 Eric Engestrom 2019-07-11 20:39:48 UTC
Took me a while to get angle to build (they still haven't realized that not all python are python2... what years is this??)

Anyway, this test seems to be doing completely unrelated things, and is consistently failing on some EGL issue and can't even reach the Vulkan bit where I might see the relevant error:

$ out/Release/angle_end2end_tests --gtest_filter=EGLSurfaceTest.ResizeWindow/ES2_Vulkan_NoFixture
1 GPUs:
  0 - Intel device id: 0x5917

Active GPU: 0

Optimus: false
AMD Switchable: false


Skipping tests using configuration ES3_OpenGLES because it is not available.
Skipping tests using configuration ES3_1_OpenGLES because it is not available.
Skipping tests using configuration ES2_OpenGLES because it is not available.
Skipping tests using configuration ES1_OpenGLES because it is not available.
Skipping tests using configuration ES2_OpenGLES_NoFixture because it is not available.
Skipping tests using configuration ES3_OpenGLES_NoFixture because it is not available.
Skipping tests using configuration ES3_1_OpenGLES_NoFixture because it is not available.
Skipping tests using configuration ES2_OpenGLES_NoVirtual because it is not available.
Skipping tests using configuration ES3_OpenGLES_NoVirtual because it is not available.
Note: Google Test filter = EGLSurfaceTest.ResizeWindow/ES2_Vulkan_NoFixture
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from EGLSurfaceTest
[ RUN      ] EGLSurfaceTest.ResizeWindow/ES2_Vulkan_NoFixture
../../src/tests/egl_tests/EGLSurfaceTest.cpp:338: Failure
Expected equality of these values:
  minSize
    Which is: 1
  height
    Which is: 64
[  FAILED  ] EGLSurfaceTest.ResizeWindow/ES2_Vulkan_NoFixture, where GetParam() = ES2_Vulkan_NoFixture (299 ms)
[----------] 1 test from EGLSurfaceTest (299 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (299 ms total)
[  PASSED  ] 0 tests.
[  FAILED  ] 1 test, listed below:
[  FAILED  ] EGLSurfaceTest.ResizeWindow/ES2_Vulkan_NoFixture, where GetParam() = ES2_Vulkan_NoFixture

 1 FAILED TEST


It would be useful to have a test that only tests the relevant stuff ;)

Btw, could you give me an example of bad output you're seeing? (and good output in case it's not obvious)

I'll be away for a week btw, so I probably won't reply until next Thursday, and I definitely won't have time to debug the EGL issue so that I can reach the Vulkan issue before then.
Comment 2 xu xing 2019-07-12 00:49:59 UTC
Created attachment 144768 [details]
angle_resize_binary_testcase
Comment 3 xu xing 2019-07-12 00:54:19 UTC
Infact EGLSurfaceTest.ResizeWindow/ES2_Vulkan_NoFixture is the right to verify this issue.

Also, I attached the binary for you to reproduces.


The pass logs on NV:

:~/angle$ glxinfo | grep "OpenGL version"
OpenGL version string: 4.6.0 NVIDIA 430.26
:~/angle$ ./out/Release/angle_end2end_tests --gtest_filter=EGLSurfaceTest.ResizeWindow/ES2_Vulkan_NoFixture
1 GPUs:
  0 - NVIDIA device id: 0x1C03
       Driver Vendor: Nvidia
       Driver Version: 430.26

Active GPU: 0

Optimus: false
AMD Switchable: false


Skipping tests using configuration ES3_OpenGLES because it is not available.
Skipping tests using configuration ES3_1_OpenGLES because it is not available.
Skipping tests using configuration ES2_OpenGLES because it is not available.
Skipping tests using configuration ES1_OpenGLES because it is not available.
Skipping tests using configuration ES2_OpenGLES_NoFixture because it is not available.
Skipping tests using configuration ES3_OpenGLES_NoFixture because it is not available.
Skipping tests using configuration ES3_1_OpenGLES_NoFixture because it is not available.
Skipping tests using configuration ES2_OpenGLES_NoVirtual because it is not available.
Skipping tests using configuration ES3_OpenGLES_NoVirtual because it is not available.
Note: Google Test filter = EGLSurfaceTest.ResizeWindow/ES2_Vulkan_NoFixture
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from EGLSurfaceTest
[ RUN      ] EGLSurfaceTest.ResizeWindow/ES2_Vulkan_NoFixture
[       OK ] EGLSurfaceTest.ResizeWindow/ES2_Vulkan_NoFixture (285 ms)
[----------] 1 test from EGLSurfaceTest (285 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (285 ms total)
[  PASSED  ] 1 test.


The fail logs on Intel Graphics:
angle$ glxinfo |grep  "OpenGL version"
OpenGL version string: 3.0 Mesa 19.1.1
angle$ ./out/Release/angle_end2end_tests --gtest_filter=EGLSurfaceTest.ResizeWindow/ES2_Vulkan_NoFixture
1 GPUs:
  0 - Intel device id: 0x412

Active GPU: 0

Optimus: false
AMD Switchable: false


Skipping tests using configuration ES3_OpenGLES because it is not available.
Skipping tests using configuration ES3_1_OpenGLES because it is not available.
Skipping tests using configuration ES2_OpenGLES because it is not available.
Skipping tests using configuration ES1_OpenGLES because it is not available.
Skipping tests using configuration ES2_OpenGLES_NoFixture because it is not available.
Skipping tests using configuration ES3_OpenGLES_NoFixture because it is not available.
Skipping tests using configuration ES3_1_OpenGLES_NoFixture because it is not available.
Skipping tests using configuration ES2_OpenGLES_NoVirtual because it is not available.
Skipping tests using configuration ES3_OpenGLES_NoVirtual because it is not available.
Note: Google Test filter = EGLSurfaceTest.ResizeWindow/ES2_Vulkan_NoFixture
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from EGLSurfaceTest
[ RUN      ] EGLSurfaceTest.ResizeWindow/ES2_Vulkan_NoFixture
INTEL-MESA: warning: Haswell Vulkan support is incomplete
Error = 3000, 12288
minSize = 1, height = 64
../../src/tests/egl_tests/EGLSurfaceTest.cpp:340: Failure
Expected equality of these values:
  minSize
    Which is: 1
  height
    Which is: 64
[  FAILED  ] EGLSurfaceTest.ResizeWindow/ES2_Vulkan_NoFixture, where GetParam() = ES2_Vulkan_NoFixture (172 ms)
[----------] 1 test from EGLSurfaceTest (172 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (172 ms total)
[  PASSED  ] 0 tests.
[  FAILED  ] 1 test, listed below:
[  FAILED  ] EGLSurfaceTest.ResizeWindow/ES2_Vulkan_NoFixture, where GetParam() = ES2_Vulkan_NoFixture

 1 FAILED TEST
Comment 5 Eric Engestrom 2019-07-21 17:31:55 UTC
Fixed by:

commit 6f880f128f9862a047a5ba543c2843e14517b1e6
Author: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Date:   Mon Jul 15 09:01:20 2019 +0300

    vulkan/wsi: update swapchain status on vkQueuePresent
    
    With the following chain of events :
    
       vkQueuePresent()
       <- Surface resize
       vkQueuePresent()
    
    We should be able to report SUBOPTIMAL or OUT_OF_DATE on the second
    vkQueuePresent() call. Currently we only look at X11 events in the
    vkAcquireNextImage() path so we're not able to report this.
    
    This change checks the queue of events and process any available ones
    to update the swapchain status.
    
    v2: Be consistent about reporting the current error state of the
        swapchain (Jason)
    
    Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=111097
    Cc: <mesa-stable@lists.freedesktop.org>
    Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.