Commit 7d8c2f2e by Yuly Novikov Committed by Commit Bot

Hide SwiftShader OS Window in dEQP and end2end tests

This prevents a race between starting Xvfb on test bots and X11 calls in X11Window::setVisible(), which used to cause flaky hangs on Linux SwANGLE bots. Unfortunately, in order to hide SwiftShader OS window, it must be a separate window from other backends, so it is no longer possible to have a single window for all backends, even if we don't reuse EGL Display. The only platform that still uses a single OS Window is Android, since there is only one system window per test application. In addition, all the tests that make OS Window visible explicitly, no longer do this for SwiftShader device. Bug: angleproject:4434 Change-Id: I1a067c22bfeee9288046b9d9566740731c0d627c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2125945 Commit-Queue: Yuly Novikov <ynovikov@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent d2c33b53
......@@ -514,6 +514,12 @@ void dEQPTest<TestModuleIndex>::SetUpTestCase()
std::string configArgString = std::string(gdEQPEGLConfigNameString) + targetConfigName;
argv.push_back(configArgString.c_str());
// Hide SwiftShader window to prevent a race with Xvfb causing hangs on test bots
if (gInitAPI && gInitAPI->second == GPUTestConfig::kAPISwiftShader)
{
argv.push_back("--deqp-visibility=hidden");
}
// Init the platform.
if (!deqp_libtester_init_platform(static_cast<int>(argv.size()), argv.data(),
reinterpret_cast<void *>(&HandlePlatformError)))
......
......@@ -51,7 +51,7 @@ class EGLDirectCompositionTest : public ANGLETest
mOSWindow->initialize("EGLDirectCompositionTest", WINDOWWIDTH, WINDOWHEIGHT);
auto nativeWindow = mOSWindow->getNativeWindow();
mOSWindow->setVisible(true);
setWindowVisible(mOSWindow, true);
// Create DispatcherQueue for window to process compositor callbacks
CreateDispatcherQueue(mDispatcherController);
......
......@@ -23,7 +23,7 @@ class EGLRobustnessTest : public ANGLETest
{
mOSWindow = OSWindow::New();
mOSWindow->initialize("EGLRobustnessTest", 500, 500);
mOSWindow->setVisible(true);
setWindowVisible(mOSWindow, true);
const auto &platform = GetParam().eglParameters;
......
......@@ -405,7 +405,7 @@ TEST_P(EGLSurfaceTest, ResizeWindow)
ANGLE_SKIP_TEST_IF(IsLinux() && isSwiftshader());
// Necessary for a window resizing test if there is no per-frame window size query
mOSWindow->setVisible(true);
setWindowVisible(mOSWindow, true);
GLenum platform = GetParam().getRenderer();
bool platformSupportsZeroSize = platform == EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE ||
......@@ -460,7 +460,7 @@ TEST_P(EGLSurfaceTest, ResizeWindowWithDraw)
ANGLE_SKIP_TEST_IF(IsLinux() && isSwiftshader());
// Necessary for a window resizing test if there is no per-frame window size query
mOSWindow->setVisible(true);
setWindowVisible(mOSWindow, true);
initializeDisplay();
initializeSurfaceWithDefaultConfig();
......@@ -543,7 +543,7 @@ TEST_P(EGLSurfaceTest, ResizeWindowWithDraw)
// Test that the window can be reset repeatedly before surface creation.
TEST_P(EGLSurfaceTest, ResetNativeWindow)
{
mOSWindow->setVisible(true);
setWindowVisible(mOSWindow, true);
initializeDisplay();
......
......@@ -92,7 +92,7 @@ TEST_P(EGLX11VisualHintTest, ValidVisualIDAndClear)
// can use OSWindow to create a window and just grab its visual.
OSWindow *osWindow = OSWindow::New();
osWindow->initialize("EGLX11VisualHintTest", 500, 500);
osWindow->setVisible(true);
setWindowVisible(osWindow, true);
Window xWindow = osWindow->getNativeWindow();
......@@ -162,7 +162,7 @@ TEST_P(EGLX11VisualHintTest, InvalidWindowVisualID)
{
OSWindow *osWindow = OSWindow::New();
osWindow->initialize("EGLX11VisualHintTest", 500, 500);
osWindow->setVisible(true);
setWindowVisible(osWindow, true);
Window xWindow = osWindow->getNativeWindow();
......@@ -186,7 +186,7 @@ TEST_P(EGLX11VisualHintTest, InvalidWindowVisualID)
OSWindow *osWindow = new X11Window(otherVisualId);
osWindow->initialize("EGLX11VisualHintTest", 500, 500);
osWindow->setVisible(true);
setWindowVisible(osWindow, true);
Window xWindow = osWindow->getNativeWindow();
......
......@@ -55,7 +55,7 @@ class DrawBuffersTest : public ANGLETest
}
// This test seems to fail on an nVidia machine when the window is hidden
setWindowVisible(true);
setWindowVisible(getOSWindow(), true);
glGenFramebuffers(1, &mFBO);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, mFBO);
......
......@@ -53,7 +53,7 @@ class MultisampleTest : public ANGLETest
// Create a window, context and surface if multisampling is possible.
mOSWindow = OSWindow::New();
mOSWindow->initialize("MultisampleTest", kWindowSize, kWindowSize);
mOSWindow->setVisible(true);
setWindowVisible(mOSWindow, true);
EGLint contextAttributes[] = {
EGL_CONTEXT_MAJOR_VERSION_KHR,
......
......@@ -420,8 +420,9 @@ void ANGLETestBase::initOSWindow()
windowNameStream << "ANGLE Tests - " << *mCurrentParams;
std::string windowName = windowNameStream.str();
if (mAlwaysForceNewDisplay)
if (IsAndroid())
{
// Only one window per test application on Android, shared among all fixtures
mFixture->osWindow = mOSWindowSingleton;
}
......@@ -433,11 +434,15 @@ void ANGLETestBase::initOSWindow()
std::cerr << "Failed to initialize OS Window.";
}
mOSWindowSingleton = mFixture->osWindow;
if (IsAndroid())
{
// Initialize the single window on Andoird only once
mOSWindowSingleton = mFixture->osWindow;
}
}
// On Linux we must keep the test windows visible. On Windows it doesn't seem to need it.
mFixture->osWindow->setVisible(!IsWindows());
setWindowVisible(getOSWindow(), !IsWindows());
switch (mCurrentParams->driver)
{
......@@ -1226,9 +1231,15 @@ bool ANGLETestBase::isMultisampleEnabled() const
return mFixture->eglWindow->isMultisample();
}
void ANGLETestBase::setWindowVisible(bool isVisible)
void ANGLETestBase::setWindowVisible(OSWindow *osWindow, bool isVisible)
{
mFixture->osWindow->setVisible(isVisible);
// SwiftShader windows are not required to be visible for test correctness,
// moreover, making a SwiftShader window visible flaky hangs on Xvfb, so we keep them hidden.
if (isSwiftshader())
{
return;
}
osWindow->setVisible(isVisible);
}
ANGLETestBase::TestFixture::TestFixture() = default;
......
......@@ -322,7 +322,7 @@ class ANGLETestBase
virtual ~ANGLETestBase();
public:
void setWindowVisible(bool isVisible);
void setWindowVisible(OSWindow *osWindow, bool isVisible);
virtual void overrideWorkaroundsD3D(angle::FeaturesD3D *featuresD3D) {}
virtual void overrideFeaturesVk(angle::FeaturesVk *featuresVulkan) {}
......@@ -526,9 +526,14 @@ class ANGLETestBase
bool mSetUpCalled;
bool mTearDownCalled;
// On most systems we force a new display on every test instance. For these configs we can
// share a single OSWindow instance. With display reuse we need a separate OSWindow for each
// different config. This OSWindow sharing seemed to lead to driver bugs on some platforms.
// Usually, we use an OS Window per "fixture" (a frontend and backend combination).
// This allows:
// 1. Reusing EGL Display on Windows.
// Other platforms have issues with display reuse even if a window per fixture is used.
// 2. Hiding only SwiftShader OS Window on Linux.
// OS Windows for other backends must be visible, to allow driver to communicate with X11.
// However, we must use a single OS Window for all backends on Android,
// since test Application can have only one window.
static OSWindow *mOSWindowSingleton;
static std::map<angle::PlatformParameters, TestFixture> gFixtures;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment