Commit 0a3233fa by Maksim Sisov Committed by Commit Bot

X11 and Ozone: fix compilation of tests.

For use_x11 && use_ozone build, use X11 backend by default. For ozone only, continue using Ozone impl, which is basically gbm. Bug: chromium:1085700 Change-Id: Iac104e983135e566b0d42a58e00d3c83b430d6dc Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2346276Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
parent 27391a09
......@@ -45,6 +45,10 @@
#endif
// clang-format on
#if defined(ANGLE_USE_X11)
# include <X11/Xlib.h>
#endif
namespace tcu
{
namespace
......@@ -366,7 +370,7 @@ ANGLENativeDisplayFactory::ANGLENativeDisplayFactory(
mNativeDisplay(bitCast<eglw::EGLNativeDisplayType>(EGL_DEFAULT_DISPLAY)),
mPlatformAttributes(std::move(platformAttributes))
{
#if (DE_OS == DE_OS_UNIX)
#if (DE_OS == DE_OS_UNIX) && defined(ANGLE_USE_X11)
// Make sure to only open the X display once so that it can be used by the EGL display as well
// as pixmaps
mNativeDisplay = bitCast<eglw::EGLNativeDisplayType>(XOpenDisplay(nullptr));
......
......@@ -76,8 +76,9 @@ TEST_P(EGLX11VisualHintTest, InvalidVisualID)
static const int gInvalidVisualId = -1;
auto attributes = getDisplayAttributes(gInvalidVisualId);
EGLDisplay display =
eglGetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE, EGL_DEFAULT_DISPLAY, attributes.data());
EGLDisplay display = eglGetPlatformDisplayEXT(
EGL_PLATFORM_ANGLE_ANGLE, reinterpret_cast<_XDisplay *>(EGL_DEFAULT_DISPLAY),
attributes.data());
ASSERT_TRUE(display != EGL_NO_DISPLAY);
ASSERT_TRUE(EGL_FALSE == eglInitialize(display, nullptr, nullptr));
......@@ -100,9 +101,10 @@ TEST_P(EGLX11VisualHintTest, ValidVisualIDAndClear)
ASSERT_NE(0, XGetWindowAttributes(mDisplay, xWindow, &windowAttributes));
int visualId = windowAttributes.visual->visualid;
auto attributes = getDisplayAttributes(visualId);
EGLDisplay display =
eglGetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE, EGL_DEFAULT_DISPLAY, attributes.data());
auto attributes = getDisplayAttributes(visualId);
EGLDisplay display = eglGetPlatformDisplayEXT(
EGL_PLATFORM_ANGLE_ANGLE, reinterpret_cast<_XDisplay *>(EGL_DEFAULT_DISPLAY),
attributes.data());
ASSERT_NE(EGL_NO_DISPLAY, display);
ASSERT_TRUE(EGL_TRUE == eglInitialize(display, nullptr, nullptr));
......@@ -174,9 +176,10 @@ TEST_P(EGLX11VisualHintTest, InvalidWindowVisualID)
OSWindow::Delete(&osWindow);
}
auto attributes = getDisplayAttributes(visualId);
EGLDisplay display =
eglGetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE, EGL_DEFAULT_DISPLAY, attributes.data());
auto attributes = getDisplayAttributes(visualId);
EGLDisplay display = eglGetPlatformDisplayEXT(
EGL_PLATFORM_ANGLE_ANGLE, reinterpret_cast<_XDisplay *>(EGL_DEFAULT_DISPLAY),
attributes.data());
ASSERT_NE(EGL_NO_DISPLAY, display);
ASSERT_TRUE(EGL_TRUE == eglInitialize(display, nullptr, nullptr));
......
......@@ -56,7 +56,12 @@ if (is_fuchsia) {
"fuchsia/ScenicWindow.cpp",
"fuchsia/ScenicWindow.h",
]
} else if (use_ozone) {
} else if (use_ozone && !angle_use_x11) {
# Use X11 impl by default otherwise switch to fake Ozone impl that does not
# seem to do anything real.
# TODO(msisov): probably, we need to have a proper support for different
# Ozone backends, and be able to switch between them for proper tests.
# For example, Wayland, X11, etc.
_util_sources += [
"ozone/OzonePixmap.cpp",
"ozone/OzoneWindow.cpp",
......
......@@ -398,7 +398,7 @@ EGLNativeWindowType X11Window::getNativeWindow() const
EGLNativeDisplayType X11Window::getNativeDisplay() const
{
return mDisplay;
return reinterpret_cast<EGLNativeDisplayType>(mDisplay);
}
void X11Window::messageLoop()
......
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