Refactor X11 and wayland platforms to run alongside each other
authorSlawomir Cygan <slawomir.cygan@intel.com>
Wed, 11 Jan 2017 16:17:11 +0000 (17:17 +0100)
committerPyry Haulos <phaulos@google.com>
Mon, 22 May 2017 19:32:26 +0000 (15:32 -0400)
This adds a capability for running Vulkan WSI ane EGL tests on both
X11 and wayland compositors from one binary built in 'default' target.

The change replaces X11 & wayland tcu::Platform-s with one common
'linux' platform, that is parametrized by DEQP_SUPPORT_
(X11|GLX|XCB|WAYLAND) at compile time.

This new platform supports creating WSI displays and EGL contexts
for each of compositors enabled at build-time. To choose EGL compositor
use --deqp-egl-display-type=x11 or Wayland.

No functional change is made to 'wayland' target: it is still possible
to build Wayland-only binary using that target.

VK-GL-CTS issue: 83
Components: Framework
Affects: dEQP-VK.wsi.* and all tests using EGL.

Change-Id: I1d8725d1329e1071ac545f765c374d2d7d5a29df

27 files changed:
framework/platform/CMakeLists.txt
framework/platform/lnx/X11/tcuLnxX11.cpp [moved from framework/platform/X11/tcuX11.cpp with 95% similarity]
framework/platform/lnx/X11/tcuLnxX11.hpp [moved from framework/platform/X11/tcuX11.hpp with 87% similarity]
framework/platform/lnx/X11/tcuLnxX11EglDisplayFactory.cpp [moved from framework/platform/X11/tcuX11EglPlatform.cpp with 96% similarity]
framework/platform/lnx/X11/tcuLnxX11EglDisplayFactory.hpp [new file with mode: 0644]
framework/platform/lnx/X11/tcuLnxX11GlxPlatform.cpp [moved from framework/platform/X11/tcuX11GlxPlatform.cpp with 99% similarity]
framework/platform/lnx/X11/tcuLnxX11GlxPlatform.hpp [moved from framework/platform/X11/tcuX11GlxPlatform.hpp with 88% similarity]
framework/platform/lnx/X11/tcuLnxX11Xcb.cpp [moved from framework/platform/X11/tcuX11Xcb.cpp with 98% similarity]
framework/platform/lnx/X11/tcuLnxX11Xcb.hpp [moved from framework/platform/X11/tcuX11Xcb.hpp with 94% similarity]
framework/platform/lnx/tcuLnx.cpp [new file with mode: 0644]
framework/platform/lnx/tcuLnx.hpp [moved from framework/platform/wayland/tcuWaylandEglPlatform.hpp with 56% similarity]
framework/platform/lnx/tcuLnxEglPlatform.cpp [new file with mode: 0644]
framework/platform/lnx/tcuLnxEglPlatform.hpp [moved from framework/platform/X11/tcuX11EglPlatform.hpp with 83% similarity]
framework/platform/lnx/tcuLnxPlatform.cpp [moved from framework/platform/X11/tcuX11Platform.cpp with 70% similarity]
framework/platform/lnx/tcuLnxPlatform.hpp [moved from framework/platform/X11/tcuX11Platform.hpp with 84% similarity]
framework/platform/lnx/tcuLnxVulkanPlatform.cpp [moved from framework/platform/X11/tcuX11VulkanPlatform.cpp with 53% similarity]
framework/platform/lnx/tcuLnxVulkanPlatform.hpp [moved from framework/platform/X11/tcuX11VulkanPlatform.hpp with 87% similarity]
framework/platform/lnx/wayland/tcuLnxWayland.cpp [moved from framework/platform/wayland/tcuWayland.cpp with 94% similarity]
framework/platform/lnx/wayland/tcuLnxWayland.hpp [moved from framework/platform/wayland/tcuWayland.hpp with 86% similarity]
framework/platform/lnx/wayland/tcuLnxWaylandEglDisplayFactory.cpp [moved from framework/platform/wayland/tcuWaylandEglPlatform.cpp with 94% similarity]
framework/platform/lnx/wayland/tcuLnxWaylandEglDisplayFactory.hpp [moved from framework/platform/wayland/tcuWaylandPlatform.hpp with 70% similarity]
framework/platform/wayland/tcuWaylandPlatform.cpp [deleted file]
framework/platform/wayland/tcuWaylandVulkanPlatform.cpp [deleted file]
framework/platform/wayland/tcuWaylandVulkanPlatform.hpp [deleted file]
targets/default/FindWayland.cmake [moved from targets/wayland/FindWayland.cmake with 100% similarity]
targets/default/default.cmake
targets/wayland/wayland.cmake

index b868ac0..d13f8c9 100644 (file)
@@ -19,36 +19,70 @@ if (NOT DEFINED TCUTIL_PLATFORM_SRCS)
                        win32/tcuWin32VulkanPlatform.cpp
                        )
 
-       elseif ((DE_OS_IS_UNIX OR DE_OS_IS_OSX) AND DEQP_USE_X11)
-               message(STATUS "DEQP_SUPPORT_GLX        = ${DEQP_SUPPORT_GLX}")
-               if (DEQP_SUPPORT_GLX)
-                       add_definitions(-DDEQP_SUPPORT_GLX=1)
-               endif ()
+       elseif ((DE_OS_IS_UNIX OR DE_OS_IS_OSX) AND (DEQP_USE_X11 OR DEQP_USE_WAYLAND))
 
                set(TCUTIL_PLATFORM_SRCS
-                       X11/tcuX11.cpp
-                       X11/tcuX11.hpp
-                       X11/tcuX11EglPlatform.hpp
-                       X11/tcuX11EglPlatform.cpp
-                       X11/tcuX11Platform.hpp
-                       X11/tcuX11Platform.cpp
-                       X11/tcuX11VulkanPlatform.hpp
-                       X11/tcuX11VulkanPlatform.cpp
-                       )
-               if (DEQP_USE_XCB)
+                       lnx/tcuLnx.cpp
+                       lnx/tcuLnx.cpp
+                       lnx/tcuLnxPlatform.cpp
+                       lnx/tcuLnxPlatform.hpp
+                       lnx/tcuLnxEglPlatform.hpp
+                       lnx/tcuLnxEglPlatform.cpp
+                       lnx/tcuLnxVulkanPlatform.hpp
+                       lnx/tcuLnxVulkanPlatform.cpp
+               )
+
+               include_directories(lnx)
+
+               if (DEQP_USE_X11)
+                       add_definitions(-DDEQP_SUPPORT_X11=1)
+                       include_directories(lnx/X11)
+
+                       message(STATUS "DEQP_SUPPORT_GLX        = ${DEQP_SUPPORT_GLX}")
+
+                       if (DEQP_SUPPORT_GLX)
+                               add_definitions(-DDEQP_SUPPORT_GLX=1)
+                       endif ()
+
                        set(TCUTIL_PLATFORM_SRCS
                                ${TCUTIL_PLATFORM_SRCS}
-                               X11/tcuX11Xcb.hpp
-                               X11/tcuX11Xcb.cpp
+                               lnx/X11/tcuLnxX11.cpp
+                               lnx/X11/tcuLnxX11.hpp
+                               lnx/X11/tcuLnxX11EglDisplayFactory.hpp
+                               lnx/X11/tcuLnxX11EglDisplayFactory.cpp
                                )
+
+                       if (DEQP_USE_XCB)
+                               set(TCUTIL_PLATFORM_SRCS
+                                       ${TCUTIL_PLATFORM_SRCS}
+                                       lnx/X11/tcuLnxX11Xcb.hpp
+                                       lnx/X11/tcuLnxX11Xcb.cpp
+                                       )
+                       endif()
+
+                       if (DEQP_SUPPORT_GLX)
+                               set(TCUTIL_PLATFORM_SRCS
+                                       ${TCUTIL_PLATFORM_SRCS}
+                                       lnx/X11/tcuLnxX11GlxPlatform.hpp
+                                       lnx/X11/tcuLnxX11GlxPlatform.cpp
+                               )
+                       endif()
                endif()
-               if (DEQP_SUPPORT_GLX)
+
+               if (DEQP_USE_WAYLAND)
+                       add_definitions(-DDEQP_SUPPORT_WAYLAND=1)
+                       include_directories(lnx/wayland)
+
                        set(TCUTIL_PLATFORM_SRCS
                                ${TCUTIL_PLATFORM_SRCS}
-                               X11/tcuX11GlxPlatform.hpp
-                               X11/tcuX11GlxPlatform.cpp
+                               lnx/wayland/tcuLnxWayland.hpp
+                               lnx/wayland/tcuLnxWayland.cpp
+                               lnx/wayland/tcuLnxWaylandEglDisplayFactory.cpp
+                               lnx/wayland/tcuLnxWaylandEglDisplayFactory.hpp
                                )
+                       include_directories(wayland)
                endif()
+
        elseif (DE_OS_IS_ANDROID)
                set(TCUTIL_PLATFORM_SRCS
                        android/tcuAndroidExecService.cpp
@@ -120,10 +154,15 @@ if (DEQP_USE_X11)
        if (DEQP_USE_XCB)
                find_package(XCB REQUIRED)
                target_link_libraries(tcutil-platform ${XCB_LIBRARIES})
-                add_definitions(-DDEQP_SUPPORT_XCB=1)
+               add_definitions(-DDEQP_SUPPORT_XCB=1)
        endif ()
        if (DEQP_SUPPORT_GLX)
          # GLX functions don't currently have wrappers, so link directly to libGL.
          target_link_libraries(tcutil-platform GL)
        endif ()
+       if (DEQP_USE_WAYLAND)
+               find_package(Wayland REQUIRED)
+               target_link_libraries(tcutil-platform ${WAYLAND_LIBRARIES})
+               add_definitions(-DDEQP_SUPPORT_WAYLAND=1)
+       endif ()
 endif ()
similarity index 95%
rename from framework/platform/X11/tcuX11.cpp
rename to framework/platform/lnx/X11/tcuLnxX11.cpp
index ee24d13..84cc387 100644 (file)
@@ -21,7 +21,7 @@
  * \brief X11 utilities.
  *//*--------------------------------------------------------------------*/
 
-#include "tcuX11.hpp"
+#include "tcuLnxX11.hpp"
 #include "gluRenderConfig.hpp"
 #include "deMemory.h"
 
 
 namespace tcu
 {
-namespace x11
-{
-
-EventState::EventState (void)
-       : m_quit(false)
+namespace lnx
 {
-}
-
-EventState::~EventState (void)
-{
-}
-
-void EventState::setQuitFlag (bool quit)
-{
-       de::ScopedLock lock(m_mutex);
-       m_quit = quit;
-}
-
-bool EventState::getQuitFlag (void)
+namespace x11
 {
-       de::ScopedLock lock(m_mutex);
-       return m_quit;
-}
 
 DisplayBase::DisplayBase (EventState& platform)
        : m_eventState  (platform)
@@ -263,4 +244,5 @@ XlibWindow::~XlibWindow (void)
 }
 
 } // x11
+} // lnx
 } // tcu
similarity index 87%
rename from framework/platform/X11/tcuX11.hpp
rename to framework/platform/lnx/X11/tcuLnxX11.hpp
index 02a731b..13ad602 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _TCUX11_HPP
-#define _TCUX11_HPP
+#ifndef _TCULNXX11_HPP
+#define _TCULNXX11_HPP
 /*-------------------------------------------------------------------------
  * drawElements Quality Program Tester Core
  * ----------------------------------------
@@ -26,7 +26,7 @@
 #include "tcuDefs.hpp"
 #include "gluRenderConfig.hpp"
 #include "gluPlatform.hpp"
-#include "deMutex.hpp"
+#include "tcuLnx.hpp"
 
 #include <X11/Xlib.h>
 #include <X11/Xutil.h>
 
 namespace tcu
 {
-namespace x11
-{
-enum
+namespace lnx
 {
-       DEFAULT_WINDOW_WIDTH    = 400,
-       DEFAULT_WINDOW_HEIGHT   = 300
-};
-
-class EventState
+namespace x11
 {
-public:
-                               EventState      (void);
-       virtual         ~EventState     (void);
-       void            setQuitFlag     (bool quit);
-       bool            getQuitFlag     (void);
-
-protected:
-       de::Mutex       m_mutex;
-       bool            m_quit;
-
-private:
-                               EventState      (const EventState&);
-       EventState&     operator=       (const EventState&);
-};
 
 class DisplayBase
 {
@@ -146,6 +126,7 @@ private:
 };
 
 } // x11
+} // lnx
 } // tcu
 
-#endif // _TCUX11_HPP
+#endif // _TCULNXX11_HPP
  *
  *//*!
  * \file
- * \brief X11Egl Platform.
+ * \brief X11Egl Display Factory.
  *//*--------------------------------------------------------------------*/
 
-#include "tcuX11EglPlatform.hpp"
+#include "tcuLnxX11EglDisplayFactory.hpp"
+#include "tcuLnxX11.hpp"
 #include "egluGLContextFactory.hpp"
 #include "eglwLibrary.hpp"
 #include "eglwFunctions.hpp"
 #include "eglwEnums.hpp"
+#include "deUniquePtr.hpp"
 
 namespace tcu
 {
+namespace lnx
+{
 namespace x11
 {
 namespace egl
@@ -286,17 +290,12 @@ NativeDisplay* DisplayFactory::createDisplay (const eglw::EGLAttrib* attribList)
        return new Display(x11Display);
 }
 
-Platform::Platform (EventState& eventState)
+NativeDisplayFactory* createDisplayFactory (EventState& eventState)
 {
-       m_nativeDisplayFactoryRegistry.registerFactory(new DisplayFactory(eventState));
+       return new DisplayFactory(eventState);
 }
 
-MovePtr<ContextFactory> Platform::createContextFactory (void)
-{
-       return MovePtr<ContextFactory>(new GLContextFactory(m_nativeDisplayFactoryRegistry));
-}
-
-
 } // egl
 } // x11
+} // lnx
 } // tcu
diff --git a/framework/platform/lnx/X11/tcuLnxX11EglDisplayFactory.hpp b/framework/platform/lnx/X11/tcuLnxX11EglDisplayFactory.hpp
new file mode 100644 (file)
index 0000000..6096b0e
--- /dev/null
@@ -0,0 +1,45 @@
+#ifndef _TCULNXX11EGLDISPLAYFACTORY_HPP
+#define _TCULNXX11EGLDISPLAYFACTORY_HPP
+/*-------------------------------------------------------------------------
+ * drawElements Quality Program Tester Core
+ * ----------------------------------------
+ *
+ * Copyright 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *//*!
+ * \file
+ * \brief X11Egl Display Factory.
+ *//*--------------------------------------------------------------------*/
+
+#include "tcuLnx.hpp"
+#include "egluNativeDisplay.hpp"
+
+namespace tcu
+{
+namespace lnx
+{
+namespace x11
+{
+namespace egl
+{
+
+eglu::NativeDisplayFactory* createDisplayFactory (EventState& eventState);
+
+}
+} // x11
+} // lnx
+} // tcu
+
+#endif // _TCULNXX11EGLDISPLAYFACTORY_HPP
@@ -21,8 +21,7 @@
  * \brief Platform that uses X11 via GLX.
  *//*--------------------------------------------------------------------*/
 
-#include "tcuX11GlxPlatform.hpp"
-#include "tcuX11Platform.hpp"
+#include "tcuLnxX11GlxPlatform.hpp"
 
 #include "tcuRenderTarget.hpp"
 #include "glwInitFunctions.hpp"
@@ -37,6 +36,8 @@
 
 namespace tcu
 {
+namespace lnx
+{
 namespace x11
 {
 namespace glx
@@ -185,7 +186,7 @@ private:
 
 extern "C"
 {
-       static int tcuX11GlxErrorHandler (::Display* display, XErrorEvent* event)
+       static int tcuLnxX11GlxErrorHandler (::Display* display, XErrorEvent* event)
        {
                char buf[80];
                XGetErrorText(display, event->error_code, buf, sizeof(buf));
@@ -204,7 +205,7 @@ GlxContextFactory::GlxContextFactory (EventState& eventState)
                                        reinterpret_cast<const GLubyte*>("glXCreateContextAttribsARB")))))
        , m_eventState                                  (eventState)
 {
-       XSetErrorHandler(tcuX11GlxErrorHandler);
+       XSetErrorHandler(tcuLnxX11GlxErrorHandler);
 }
 
 RenderContext* GlxContextFactory::createContext (const RenderConfig&   config,
@@ -682,4 +683,5 @@ MovePtr<ContextFactory> createContextFactory (EventState& eventState)
 
 } // glx
 } // x11
+} // lnx
 } // tcu
@@ -1,5 +1,5 @@
-#ifndef _TCUX11GLXPLATFORM_HPP
-#define _TCUX11GLXPLATFORM_HPP
+#ifndef _TCULNXX11GLXPLATFORM_HPP
+#define _TCULNXX11GLXPLATFORM_HPP
 /*-------------------------------------------------------------------------
  * drawElements Quality Program Tester Core
  * ----------------------------------------
 
 #include "gluContextFactory.hpp"
 #include "deUniquePtr.hpp"
-#include "tcuX11.hpp"
+#include "tcuLnxX11.hpp"
 
 namespace tcu
 {
+namespace lnx
+{
 namespace x11
 {
 namespace glx
@@ -37,7 +39,8 @@ namespace glx
 de::MovePtr<glu::ContextFactory> createContextFactory (EventState& eventState);
 
 } // glx
+} // lnx
 } // x11
 } // tcu
 
-#endif // _TCUX11GLXPLATFORM_HPP
+#endif // _TCULNXX11GLXPLATFORM_HPP
similarity index 98%
rename from framework/platform/X11/tcuX11Xcb.cpp
rename to framework/platform/lnx/X11/tcuLnxX11Xcb.cpp
index c224c75..de87b0c 100644 (file)
  * \brief X11 using XCB utilities.
  *//*--------------------------------------------------------------------*/
 
-#include "tcuX11Xcb.hpp"
+#include "tcuLnxX11Xcb.hpp"
 #include "deMemory.h"
 
 namespace tcu
 {
+namespace lnx
+{
 namespace x11
 {
 
@@ -166,4 +168,5 @@ void XcbWindow::setDimensions (int width, int height)
 }
 
 } // xcb
+} // lnx
 } // tcu
similarity index 94%
rename from framework/platform/X11/tcuX11Xcb.hpp
rename to framework/platform/lnx/X11/tcuLnxX11Xcb.hpp
index 82ff9b2..c00c413 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _TCUX11XCB_HPP
-#define _TCUX11XCB_HPP
+#ifndef _TCULNXX11XCB_HPP
+#define _TCULNXX11XCB_HPP
 /*-------------------------------------------------------------------------
  * drawElements Quality Program Tester Core
  * ----------------------------------------
  * \brief X11 using XCB utilities.
  *//*--------------------------------------------------------------------*/
 
-#include "tcuX11.hpp"
+#include "tcuLnxX11.hpp"
 #include <xcb/xcb.h>
 
 namespace tcu
 {
+namespace lnx
+{
 namespace x11
 {
 
@@ -78,6 +80,7 @@ private:
 };
 
 } // x11
+} // lnx
 } // tcu
 
-#endif // _TCUX11XCB_HPP
+#endif // _TCULNXX11XCB_HPP
diff --git a/framework/platform/lnx/tcuLnx.cpp b/framework/platform/lnx/tcuLnx.cpp
new file mode 100644 (file)
index 0000000..32ecd89
--- /dev/null
@@ -0,0 +1,54 @@
+/*-------------------------------------------------------------------------
+ * drawElements Quality Program Tester Core
+ * ----------------------------------------
+ *
+ * Copyright 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *//*!
+ * \file
+ * \brief Linux utilities.
+ *//*--------------------------------------------------------------------*/
+
+#include "tcuLnx.hpp"
+
+
+namespace tcu
+{
+namespace lnx
+{
+
+EventState::EventState (void)
+       : m_quit(false)
+{
+}
+
+EventState::~EventState (void)
+{
+}
+
+void EventState::setQuitFlag (bool quit)
+{
+       de::ScopedLock lock(m_mutex);
+       m_quit = quit;
+}
+
+bool EventState::getQuitFlag (void)
+{
+       de::ScopedLock lock(m_mutex);
+       return m_quit;
+}
+
+} // lnx
+} // tcu
similarity index 56%
rename from framework/platform/wayland/tcuWaylandEglPlatform.hpp
rename to framework/platform/lnx/tcuLnx.hpp
index e28ab2a..ad5cba5 100644 (file)
@@ -1,12 +1,10 @@
-#ifndef _TCUWAYLANDEGLPLATFORM_HPP
-#define _TCUWAYLANDEGLPLATFORM_HPP
+#ifndef _TCULNX_HPP
+#define _TCULNX_HPP
 /*-------------------------------------------------------------------------
  * drawElements Quality Program Tester Core
  * ----------------------------------------
  *
- * Copyright (c) 2014 The Android Open Source Project
- * Copyright (c) 2016 The Khronos Group Inc.
- * Copyright (c) 2016 Mun Gwan-gyeong <elongbug@gmail.com>
+ * Copyright 2017 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  *
  *//*!
  * \file
- * \brief wayland Egl Platform.
+ * \brief Linux utilities.
  *//*--------------------------------------------------------------------*/
 
-#include "deUniquePtr.hpp"
-#include "egluPlatform.hpp"
-#include "gluContextFactory.hpp"
-#include "tcuWayland.hpp"
+#include "tcuDefs.hpp"
+#include "deMutex.hpp"
 
 namespace tcu
 {
-namespace wayland
+// This namespace should be named 'linux', however some compilers still
+// define obsolete 'linux' macro alongside '__linux__'
+namespace lnx
 {
-namespace egl
+enum
 {
+       DEFAULT_WINDOW_WIDTH    = 400,
+       DEFAULT_WINDOW_HEIGHT   = 300
+};
 
-class Platform : public eglu::Platform
+class EventState
 {
 public:
-                                                                               Platform                                (EventState& eventState);
-                                                                               ~Platform                               (void) {}
+                               EventState      (void);
+       virtual         ~EventState     (void);
+       void            setQuitFlag     (bool quit);
+       bool            getQuitFlag     (void);
+
+       protected:
+       de::Mutex       m_mutex;
+       bool            m_quit;
 
-       de::MovePtr<glu::ContextFactory>        createContextFactory    (void);
+private:
+                               EventState      (const EventState&);
+       EventState&     operator=       (const EventState&);
 };
 
-}
-} // wayland
+} // lnx
 } // tcu
 
-#endif // _TCUWAYLANDEGLPLATFORM_HPP
+#endif // _TCULNX_HPP
diff --git a/framework/platform/lnx/tcuLnxEglPlatform.cpp b/framework/platform/lnx/tcuLnxEglPlatform.cpp
new file mode 100644 (file)
index 0000000..22646ca
--- /dev/null
@@ -0,0 +1,63 @@
+/*-------------------------------------------------------------------------
+ * drawElements Quality Program Tester Core
+ * ----------------------------------------
+ *
+ * Copyright (c) 2016 The Khronos Group Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *//*!
+ * \file
+ * \brief Linux EGL Platform.
+ *//*--------------------------------------------------------------------*/
+
+#include "tcuLnxEglPlatform.hpp"
+
+#if defined (DEQP_SUPPORT_X11)
+#      include "tcuLnxX11EglDisplayFactory.hpp"
+#endif // DEQP_SUPPORT_X11
+
+#if defined (DEQP_SUPPORT_WAYLAND)
+#      include "tcuLnxWaylandEglDisplayFactory.hpp"
+#endif // DEQP_SUPPORT_WAYLAND
+
+#include "egluGLContextFactory.hpp"
+
+namespace tcu
+{
+namespace lnx
+{
+namespace egl
+{
+
+Platform::Platform (EventState& eventState)
+{
+#if defined (DEQP_SUPPORT_X11)
+       m_nativeDisplayFactoryRegistry.registerFactory(x11::egl::createDisplayFactory(eventState));
+#endif // DEQP_SUPPORT_X11
+
+#if defined (DEQP_SUPPORT_WAYLAND)
+       m_nativeDisplayFactoryRegistry.registerFactory(wayland::egl::createDisplayFactory(eventState));
+#endif // DEQP_SUPPORT_WAYLAND
+
+}
+
+de::MovePtr<glu::ContextFactory> Platform::createContextFactory (void)
+{
+       return de::MovePtr<glu::ContextFactory>(new eglu::GLContextFactory(m_nativeDisplayFactoryRegistry));
+}
+
+} // egl
+} // linux
+} // tcu
+
similarity index 83%
rename from framework/platform/X11/tcuX11EglPlatform.hpp
rename to framework/platform/lnx/tcuLnxEglPlatform.hpp
index c9517d7..c8b6aaf 100644 (file)
@@ -1,10 +1,10 @@
-#ifndef _TCUX11EGLPLATFORM_HPP
-#define _TCUX11EGLPLATFORM_HPP
+#ifndef _TCULNXEGLPLATFORM_HPP
+#define _TCULNXEGLPLATFORM_HPP
 /*-------------------------------------------------------------------------
  * drawElements Quality Program Tester Core
  * ----------------------------------------
  *
- * Copyright 2014 The Android Open Source Project
+ * Copyright (c) 2016 The Khronos Group Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  *
  *//*!
  * \file
- * \brief X11Egl Platform.
+ * \brief Linux EGL Platform.
  *//*--------------------------------------------------------------------*/
 
-#include "deUniquePtr.hpp"
+#include "tcuLnx.hpp"
 #include "egluPlatform.hpp"
+#include "deUniquePtr.hpp"
 #include "gluContextFactory.hpp"
-#include "tcuX11.hpp"
 
 namespace tcu
 {
-namespace x11
+namespace lnx
 {
 namespace egl
 {
@@ -44,8 +44,8 @@ public:
        de::MovePtr<glu::ContextFactory>        createContextFactory    (void);
 };
 
-}
-} // x11
+} // egl
+} // linux
 } // tcu
 
-#endif // _TCUX11EGLPLATFORM_HPP
+#endif // _TCULNXEGLPLATFORM_HPP
similarity index 70%
rename from framework/platform/X11/tcuX11Platform.cpp
rename to framework/platform/lnx/tcuLnxPlatform.cpp
index 830a463..55e18a8 100644 (file)
@@ -2,7 +2,7 @@
  * drawElements Quality Program Tester Core
  * ----------------------------------------
  *
- * Copyright 2014 The Android Open Source Project
+ * Copyright 2017 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  *
  *//*!
  * \file
- * \brief X11 Platform.
+ * \brief Linux Platform.
  *//*--------------------------------------------------------------------*/
 
-#include "tcuX11Platform.hpp"
-#include "vkWsiPlatform.hpp"
+#include "tcuLnxPlatform.hpp"
+
+#include "tcuLnxVulkanPlatform.hpp"
+#include "tcuLnxEglPlatform.hpp"
 
 #include "deUniquePtr.hpp"
 #include "gluPlatform.hpp"
 #include "vkPlatform.hpp"
-#include "tcuX11.hpp"
-#include "tcuFunctionLibrary.hpp"
-#include "deMemory.h"
-#include "tcuX11VulkanPlatform.hpp"
-#include "tcuX11EglPlatform.hpp"
 
 #if defined (DEQP_SUPPORT_GLX)
-#      include "tcuX11GlxPlatform.hpp"
-#endif
-
-#include <sys/utsname.h>
+#      include "tcuLnxX11GlxPlatform.hpp"
+#endif // DEQP_SUPPORT_GLX
 
 using de::MovePtr;
 using de::UniquePtr;
 
 namespace tcu
 {
-namespace x11
+namespace lnx
 {
 
-class X11GLPlatform : public glu::Platform
+class LinuxGLPlatform : public glu::Platform
 {
 public:
        void            registerFactory (de::MovePtr<glu::ContextFactory> factory)
@@ -56,10 +51,10 @@ public:
        }
 };
 
-class X11Platform : public tcu::Platform
+class LinuxPlatform : public tcu::Platform
 {
 public:
-                                                       X11Platform                     (void);
+                                                       LinuxPlatform           (void);
        bool                                    processEvents           (void) { return !m_eventState.getQuitFlag(); }
 
        const vk::Platform&             getVulkanPlatform       (void) const { return m_vkPlatform; }
@@ -68,26 +63,26 @@ public:
 
 private:
        EventState                              m_eventState;
-       x11::VulkanPlatform             m_vkPlatform;
-       x11::egl::Platform              m_eglPlatform;
-       X11GLPlatform                   m_glPlatform;
+       VulkanPlatform                  m_vkPlatform;
+       egl::Platform                   m_eglPlatform;
+       LinuxGLPlatform                 m_glPlatform;
 };
 
-X11Platform::X11Platform (void)
+LinuxPlatform::LinuxPlatform (void)
        : m_vkPlatform  (m_eventState)
        , m_eglPlatform (m_eventState)
 {
 #if defined (DEQP_SUPPORT_GLX)
-       m_glPlatform.registerFactory(glx::createContextFactory(m_eventState));
+       m_glPlatform.registerFactory(x11::glx::createContextFactory(m_eventState));
 #endif // DEQP_SUPPORT_GLX
 
        m_glPlatform.registerFactory(m_eglPlatform.createContextFactory());
 }
 
-} // x11
+} // lnx
 } // tcu
 
 tcu::Platform* createPlatform (void)
 {
-       return new tcu::x11::X11Platform();
+       return new tcu::lnx::LinuxPlatform();
 }
similarity index 84%
rename from framework/platform/X11/tcuX11Platform.hpp
rename to framework/platform/lnx/tcuLnxPlatform.hpp
index 5b89c09..3f8a842 100644 (file)
@@ -1,10 +1,10 @@
-#ifndef _TCUX11PLATFORM_HPP
-#define _TCUX11PLATFORM_HPP
+#ifndef _TCULNXPLATFORM_HPP
+#define _TCULNXPLATFORM_HPP
 /*-------------------------------------------------------------------------
  * drawElements Quality Program Tester Core
  * ----------------------------------------
  *
- * Copyright 2014 The Android Open Source Project
+ * Copyright 2017 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  *
  *//*!
  * \file
- * \brief X11 Platform.
+ * \brief Linux Platform.
  *//*--------------------------------------------------------------------*/
 
 #include "tcuPlatform.hpp"
 
 tcu::Platform* createPlatform (void);
 
-#endif // _TCUX11PLATFORM_HPP
+#endif // _TCULNXPLATFORM_HPP
  *
  *//*!
  * \file
- * \brief X11Vulkan Platform.
+ * \brief Linux Vulkan Platform.
  *//*--------------------------------------------------------------------*/
 
-#include "tcuX11VulkanPlatform.hpp"
-#include "tcuX11Platform.hpp"
+#include "tcuLnxVulkanPlatform.hpp"
+#include "tcuLnxPlatform.hpp"
 #include "vkWsiPlatform.hpp"
 #include "gluPlatform.hpp"
-#include "tcuX11.hpp"
+#include "tcuLnx.hpp"
 #include "tcuFunctionLibrary.hpp"
 #include "deUniquePtr.hpp"
 #include "deMemory.h"
 using de::MovePtr;
 using de::UniquePtr;
 
-#if defined (DEQP_SUPPORT_XCB)
-#include "tcuX11Xcb.hpp"
-#endif // DEQP_SUPPORT_XCB
+#if defined (DEQP_SUPPORT_X11)
+#      include "tcuLnxX11.hpp"
+#      if defined (DEQP_SUPPORT_XCB)
+#              include "tcuLnxX11Xcb.hpp"
+#      endif // DEQP_SUPPORT_XCB
+#endif // DEQP_SUPPORT_X11
+
+#if defined (DEQP_SUPPORT_WAYLAND)
+#      include "tcuLnxWayland.hpp"
+#endif // DEQP_SUPPORT_WAYLAND
 
 namespace tcu
 {
-namespace x11
+namespace lnx
 {
 
+#if defined (DEQP_SUPPORT_X11)
+
 class VulkanWindowXlib : public vk::wsi::XlibWindowInterface
 {
 public:
-       VulkanWindowXlib (MovePtr<XlibWindow> window)
+       VulkanWindowXlib (MovePtr<x11::XlibWindow> window)
                : vk::wsi::XlibWindowInterface  (vk::pt::XlibWindow(window->getXID()))
                , m_window                                              (window)
        {
@@ -59,36 +68,38 @@ public:
        }
 
 private:
-       UniquePtr<XlibWindow>   m_window;
+       UniquePtr<x11::XlibWindow>      m_window;
 };
 
 class VulkanDisplayXlib : public vk::wsi::XlibDisplayInterface
 {
 public:
-       VulkanDisplayXlib (MovePtr<DisplayBase> display)
-               : vk::wsi::XlibDisplayInterface (vk::pt::XlibDisplayPtr(((XlibDisplay*)display.get())->getXDisplay()))
+       VulkanDisplayXlib (MovePtr<x11::DisplayBase> display)
+               : vk::wsi::XlibDisplayInterface (vk::pt::XlibDisplayPtr(((x11::XlibDisplay*)display.get())->getXDisplay()))
                , m_display     (display)
        {
        }
 
        vk::wsi::Window* createWindow (const Maybe<UVec2>& initialSize) const
        {
-               XlibDisplay*    instance        = (XlibDisplay*)(m_display.get());
-               const deUint32  height          = !initialSize ? (deUint32)DEFAULT_WINDOW_HEIGHT : initialSize->y();
-               const deUint32  width           = !initialSize ? (deUint32)DEFAULT_WINDOW_WIDTH : initialSize->x();
-               return new VulkanWindowXlib(MovePtr<XlibWindow>(new XlibWindow(*instance, (int)width, (int)height, instance->getVisual(0))));
+               x11::XlibDisplay*       instance        = (x11::XlibDisplay*)(m_display.get());
+               const deUint32          height          = !initialSize ? (deUint32)DEFAULT_WINDOW_HEIGHT : initialSize->y();
+               const deUint32          width           = !initialSize ? (deUint32)DEFAULT_WINDOW_WIDTH : initialSize->x();
+               return new VulkanWindowXlib(MovePtr<x11::XlibWindow>(new x11::XlibWindow(*instance, (int)width, (int)height, instance->getVisual(0))));
        }
 
 private:
-       MovePtr<DisplayBase> m_display;
+       MovePtr<x11::DisplayBase> m_display;
 };
 
+#endif // DEQP_SUPPORT_X11
+
 #if defined (DEQP_SUPPORT_XCB)
 
 class VulkanWindowXcb : public vk::wsi::XcbWindowInterface
 {
 public:
-       VulkanWindowXcb (MovePtr<XcbWindow> window)
+       VulkanWindowXcb (MovePtr<x11::XcbWindow> window)
                : vk::wsi::XcbWindowInterface   (vk::pt::XcbWindow(window->getXID()))
                , m_window                                              (window)
        {
@@ -100,30 +111,70 @@ public:
        }
 
 private:
-       UniquePtr<XcbWindow>    m_window;
+       UniquePtr<x11::XcbWindow>       m_window;
 };
 
 class VulkanDisplayXcb : public vk::wsi::XcbDisplayInterface
 {
 public:
-       VulkanDisplayXcb (MovePtr<DisplayBase> display)
-               : vk::wsi::XcbDisplayInterface  (vk::pt::XcbConnectionPtr(((XcbDisplay*)display.get())->getConnection()))
+       VulkanDisplayXcb (MovePtr<x11::DisplayBase> display)
+               : vk::wsi::XcbDisplayInterface  (vk::pt::XcbConnectionPtr(((x11::XcbDisplay*)display.get())->getConnection()))
+               , m_display             (display)
+       {
+       }
+
+       vk::wsi::Window* createWindow (const Maybe<UVec2>& initialSize) const
+       {
+               x11::XcbDisplay*        instance        = (x11::XcbDisplay*)(m_display.get());
+               const deUint32          height          = !initialSize ? (deUint32)DEFAULT_WINDOW_HEIGHT : initialSize->y();
+               const deUint32          width           = !initialSize ? (deUint32)DEFAULT_WINDOW_WIDTH : initialSize->x();
+               return new VulkanWindowXcb(MovePtr<x11::XcbWindow>(new x11::XcbWindow(*instance, (int)width, (int)height, DE_NULL)));
+       }
+
+private:
+       MovePtr<x11::DisplayBase> m_display;
+};
+#endif // DEQP_SUPPORT_XCB
+
+#if defined (DEQP_SUPPORT_WAYLAND)
+class VulkanWindowWayland : public vk::wsi::WaylandWindowInterface
+{
+public:
+       VulkanWindowWayland (MovePtr<wayland::Window> window)
+               : vk::wsi::WaylandWindowInterface       (vk::pt::WaylandSurfacePtr(window->getSurface()))
+               , m_window                                                      (window)
+       {
+       }
+
+       void resize (const UVec2& newSize)
+       {
+               m_window->setDimensions((int)newSize.x(), (int)newSize.y());
+       }
+
+private:
+       UniquePtr<wayland::Window>      m_window;
+};
+
+class VulkanDisplayWayland : public vk::wsi::WaylandDisplayInterface
+{
+public:
+       VulkanDisplayWayland (MovePtr<wayland::Display> display)
+               : vk::wsi::WaylandDisplayInterface      (vk::pt::WaylandDisplayPtr(display->getDisplay()))
                , m_display             (display)
        {
        }
 
        vk::wsi::Window* createWindow (const Maybe<UVec2>& initialSize) const
        {
-               XcbDisplay*             instance        = (XcbDisplay*)(m_display.get());
                const deUint32  height          = !initialSize ? (deUint32)DEFAULT_WINDOW_HEIGHT : initialSize->y();
                const deUint32  width           = !initialSize ? (deUint32)DEFAULT_WINDOW_WIDTH : initialSize->x();
-               return new VulkanWindowXcb(MovePtr<XcbWindow>(new XcbWindow(*instance, (int)width, (int)height, DE_NULL)));
+               return new VulkanWindowWayland(MovePtr<wayland::Window>(new wayland::Window(*m_display, (int)width, (int)height)));
        }
 
 private:
-       MovePtr<DisplayBase> m_display;
+       MovePtr<wayland::Display> m_display;
 };
-#endif // DEQP_SUPPORT_XCB
+#endif // DEQP_SUPPORT_WAYLAND
 
 class VulkanLibrary : public vk::Library
 {
@@ -153,14 +204,22 @@ vk::wsi::Display* VulkanPlatform::createWsiDisplay (vk::wsi::Type wsiType) const
 {
        switch(wsiType)
        {
+#if defined (DEQP_SUPPORT_X11)
        case vk::wsi::TYPE_XLIB:
-               return new VulkanDisplayXlib(MovePtr<DisplayBase>(new XlibDisplay(m_eventState,"")));
+               return new VulkanDisplayXlib(MovePtr<x11::DisplayBase>(new x11::XlibDisplay(m_eventState,"")));
                break;
+#endif // DEQP_SUPPORT_X11
 #if defined (DEQP_SUPPORT_XCB)
        case vk::wsi::TYPE_XCB:
-               return new VulkanDisplayXcb(MovePtr<DisplayBase>(new XcbDisplay(m_eventState,"")));
+               return new VulkanDisplayXcb(MovePtr<x11::DisplayBase>(new x11::XcbDisplay(m_eventState,"")));
                break;
 #endif // DEQP_SUPPORT_XCB
+#if defined (DEQP_SUPPORT_WAYLAND)
+       case vk::wsi::TYPE_WAYLAND:
+               return new VulkanDisplayWayland(MovePtr<wayland::Display>(new wayland::Display(m_eventState, DE_NULL)));
+               break;
+#endif // DEQP_SUPPORT_WAYLAND
+
        default:
                TCU_THROW(NotSupportedError, "WSI type not supported");
 
@@ -194,6 +253,6 @@ void VulkanPlatform::getMemoryLimits (vk::PlatformMemoryLimits& limits) const
        limits.devicePageTableHierarchyLevels           = 3;
 }
 
-} // x11
+} // linux
 } // tcu
 
@@ -1,5 +1,5 @@
-#ifndef _TCUX11VULKANPLATFORM_HPP
-#define _TCUX11VULKANPLATFORM_HPP
+#ifndef _TCULNXVULKANPLATFORM_HPP
+#define _TCULNXVULKANPLATFORM_HPP
 /*-------------------------------------------------------------------------
  * drawElements Quality Program Tester Core
  * ----------------------------------------
  *
  *//*!
  * \file
- * \brief X11Vulkan Platform.
+ * \brief Linux Vulkan Platform.
  *//*--------------------------------------------------------------------*/
 
 #include "vkWsiPlatform.hpp"
 #include "vkPlatform.hpp"
-#include "tcuX11.hpp"
+#include "tcuLnx.hpp"
 
 namespace tcu
 {
-namespace x11
+namespace lnx
+
 {
 
 class VulkanPlatform : public vk::Platform
@@ -46,7 +47,7 @@ private :
 };
 
 
-} // x11
+} // linux
 } // tcu
 
-#endif // _TCUX11VULKANPLATFORM_HPP
+#endif // _TCULNXVULKANPLATFORM_HPP
similarity index 94%
rename from framework/platform/wayland/tcuWayland.cpp
rename to framework/platform/lnx/wayland/tcuLnxWayland.cpp
index 071cbb4..6d12543 100644 (file)
@@ -23,7 +23,7 @@
  * \brief wayland utilities.
  *//*--------------------------------------------------------------------*/
 
-#include "tcuWayland.hpp"
+#include "tcuLnxWayland.hpp"
 #include "gluRenderConfig.hpp"
 #include "deMemory.h"
 
 
 namespace tcu
 {
-namespace wayland
-{
-
-EventState::EventState (void)
-       : m_quit(false)
-{
-}
-
-EventState::~EventState (void)
+namespace lnx
 {
-}
-
-void EventState::setQuitFlag (bool quit)
+namespace wayland
 {
-       de::ScopedLock lock(m_mutex);
-       m_quit = quit;
-}
 
-bool EventState::getQuitFlag (void)
-{
-       de::ScopedLock lock(m_mutex);
-       return m_quit;
-}
 const struct wl_registry_listener Display::s_registryListener =
 {
        Display::handleGlobal,
@@ -231,4 +213,5 @@ Window::~Window (void)
 }
 
 } // wayland
+} // lnx
 } // tcu
similarity index 86%
rename from framework/platform/wayland/tcuWayland.hpp
rename to framework/platform/lnx/wayland/tcuLnxWayland.hpp
index 2a2468c..b5d1f9e 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _TCUWAYLAND_HPP
-#define _TCUWAYLAND_HPP
+#ifndef _TCULNXWAYLAND_HPP
+#define _TCULNXWAYLAND_HPP
 /*-------------------------------------------------------------------------
  * drawElements Quality Program Tester Core
  * ----------------------------------------
 #include "tcuDefs.hpp"
 #include "gluRenderConfig.hpp"
 #include "gluPlatform.hpp"
-#include "deMutex.hpp"
+#include "tcuLnx.hpp"
 
 #include <wayland-client.h>
 #include <wayland-egl.h>
 
 namespace tcu
 {
-namespace wayland
-{
-
-enum
+namespace lnx
 {
-       DEFAULT_WINDOW_WIDTH    = 400,
-       DEFAULT_WINDOW_HEIGHT   = 300
-};
-
-class EventState
+namespace wayland
 {
-public:
-                                                       EventState                              (void);
-       virtual                                 ~EventState                             (void);
-
-       void                                    setQuitFlag                             (bool quit);
-       bool                                    getQuitFlag                             (void);
-
-protected:
-       de::Mutex                               m_mutex;
-       bool                                    m_quit;
-
-private:
-                                                       EventState                              (const EventState&);
-       EventState&                             operator=                               (const EventState&);
-};
 
 class Display
 {
@@ -127,6 +105,7 @@ private:
 };
 
 } // wayland
+} // lnx
 } // tcu
 
-#endif // _TCUWAYLAND_HPP
+#endif // _TCULNXWAYLAND_HPP
  *
  *//*!
  * \file
- * \brief wayland Egl Platform.
+ * \brief wayland Egl Display Factory.
  *//*--------------------------------------------------------------------*/
 
-#include "tcuWaylandEglPlatform.hpp"
+#include "tcuLnxWaylandEglDisplayFactory.hpp"
+#include "tcuLnxWayland.hpp"
 #include "egluGLContextFactory.hpp"
 #include "eglwLibrary.hpp"
 #include "eglwFunctions.hpp"
 #include "eglwEnums.hpp"
+#include "deUniquePtr.hpp"
 
 namespace tcu
 {
+namespace lnx
+{
 namespace wayland
 {
 namespace egl
@@ -187,16 +191,12 @@ NativeDisplay* DisplayFactory::createDisplay (const eglw::EGLAttrib* attribList)
        return new Display(waylandDisplay);
 }
 
-Platform::Platform (EventState& eventState)
-{
-       m_nativeDisplayFactoryRegistry.registerFactory(new DisplayFactory(eventState));
-}
-
-MovePtr<ContextFactory> Platform::createContextFactory (void)
+NativeDisplayFactory* createDisplayFactory (EventState& eventState)
 {
-       return MovePtr<ContextFactory>(new GLContextFactory(m_nativeDisplayFactoryRegistry));
+       return new DisplayFactory(eventState);
 }
 
 } // egl
 } // wayland
+} // lnx
 } // tcu
@@ -1,5 +1,5 @@
-#ifndef _TCUWAYLANDPLATFORM_HPP
-#define _TCUWAYLANDPLATFORM_HPP
+#ifndef _TCULNXWAYLANDEGLDISPLAYFACTORY_HPP
+#define _TCULNXWAYLANDEGLDISPLAYFACTORY_HPP
 /*-------------------------------------------------------------------------
  * drawElements Quality Program Tester Core
  * ----------------------------------------
  *
  *//*!
  * \file
- * \brief Wayland Platform.
+ * \brief wayland Egl Display Factory.
  *//*--------------------------------------------------------------------*/
 
-#include "tcuPlatform.hpp"
+#include "tcuLnx.hpp"
+#include "egluNativeDisplay.hpp"
 
-tcu::Platform* createPlatform (void);
+namespace tcu
+{
+namespace lnx
+{
+namespace wayland
+{
+namespace egl
+{
 
-#endif // _TCUWAYLANDPLATFORM_HPP
+eglu::NativeDisplayFactory* createDisplayFactory (EventState& eventState);
+
+} // egl
+} // wayland
+} // lnx
+} // tcu
+
+#endif // _TCULNXWAYLANDEGLDISPLAYFACTORY_HPP
diff --git a/framework/platform/wayland/tcuWaylandPlatform.cpp b/framework/platform/wayland/tcuWaylandPlatform.cpp
deleted file mode 100644 (file)
index bf3f001..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-/*-------------------------------------------------------------------------
- * drawElements Quality Program Tester Core
- * ----------------------------------------
- *
- * Copyright (c) 2014 The Android Open Source Project
- * Copyright (c) 2016 The Khronos Group Inc.
- * Copyright (c) 2016 Mun Gwan-gyeong <elongbug@gmail.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- *//*!
- * \file
- * \brief wayland Platform.
- *//*--------------------------------------------------------------------*/
-
-#include "tcuWaylandPlatform.hpp"
-#include "tcuWaylandEglPlatform.hpp"
-
-#include "deUniquePtr.hpp"
-#include "gluPlatform.hpp"
-#include "vkPlatform.hpp"
-#include "tcuWayland.hpp"
-#include "tcuWaylandVulkanPlatform.hpp"
-#include "tcuFunctionLibrary.hpp"
-#include "deMemory.h"
-
-#include <sys/utsname.h>
-
-namespace tcu
-{
-namespace wayland
-{
-
-class WaylandGLPlatform : public glu::Platform
-{
-public:
-       void            registerFactory (de::MovePtr<glu::ContextFactory> factory)
-       {
-               m_contextFactoryRegistry.registerFactory(factory.release());
-       }
-};
-
-class WaylandPlatform : public tcu::Platform
-{
-public:
-                                                       WaylandPlatform (void);
-       bool                                    processEvents   (void) { return !m_eventState.getQuitFlag(); }
-       const glu::Platform&    getGLPlatform   (void) const { return m_glPlatform; }
-       const eglu::Platform&   getEGLPlatform  (void) const { return m_eglPlatform; }
-       const vk::Platform&             getVulkanPlatform       (void) const { return m_vkPlatform; }
-
-
-private:
-       EventState                              m_eventState;
-       wayland::egl::Platform  m_eglPlatform;
-       WaylandGLPlatform               m_glPlatform;
-       WaylandVulkanPlatform   m_vkPlatform;
-};
-
-WaylandPlatform::WaylandPlatform (void)
-       : m_eglPlatform (m_eventState)
-       , m_vkPlatform  (m_eventState)
-{
-       m_glPlatform.registerFactory(m_eglPlatform.createContextFactory());
-}
-
-} // wayland
-} // tcu
-
-tcu::Platform* createPlatform (void)
-{
-       return new tcu::wayland::WaylandPlatform();
-}
diff --git a/framework/platform/wayland/tcuWaylandVulkanPlatform.cpp b/framework/platform/wayland/tcuWaylandVulkanPlatform.cpp
deleted file mode 100644 (file)
index 77b686e..0000000
+++ /dev/null
@@ -1,147 +0,0 @@
-/*-------------------------------------------------------------------------
- * drawElements Quality Program Tester Core
- * ----------------------------------------
- *
- * Copyright (c) 2016 The Khronos Group Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- *//*!
- * \file
- * \brief Wayland Vulkan Platform.
- *//*--------------------------------------------------------------------*/
-
-#include "tcuWaylandVulkanPlatform.hpp"
-#include "tcuWaylandPlatform.hpp"
-#include "vkWsiPlatform.hpp"
-#include "gluPlatform.hpp"
-#include "tcuWayland.hpp"
-#include "tcuFunctionLibrary.hpp"
-#include "deUniquePtr.hpp"
-#include "deMemory.h"
-
-#include <sys/utsname.h>
-
-using de::MovePtr;
-using de::UniquePtr;
-
-namespace tcu
-{
-namespace wayland
-{
-
-class VulkanWindowWayland : public vk::wsi::WaylandWindowInterface
-{
-public:
-       VulkanWindowWayland (MovePtr<wayland::Window> window)
-               : vk::wsi::WaylandWindowInterface       (vk::pt::WaylandSurfacePtr(window->getSurface()))
-               , m_window                                                      (window)
-       {
-       }
-
-       void resize (const UVec2& newSize)
-       {
-               m_window->setDimensions((int)newSize.x(), (int)newSize.y());
-       }
-
-private:
-       UniquePtr<wayland::Window>      m_window;
-};
-
-class VulkanDisplayWayland : public vk::wsi::WaylandDisplayInterface
-{
-public:
-       VulkanDisplayWayland (MovePtr<wayland::Display> display)
-               : vk::wsi::WaylandDisplayInterface      (vk::pt::WaylandDisplayPtr(display->getDisplay()))
-               , m_display             (display)
-       {
-       }
-
-       vk::wsi::Window* createWindow (const Maybe<UVec2>& initialSize) const
-       {
-               const deUint32  height          = !initialSize ? (deUint32)DEFAULT_WINDOW_HEIGHT : initialSize->y();
-               const deUint32  width           = !initialSize ? (deUint32)DEFAULT_WINDOW_WIDTH : initialSize->x();
-               return new VulkanWindowWayland(MovePtr<wayland::Window>(new wayland::Window(*m_display, (int)width, (int)height)));
-       }
-
-private:
-       MovePtr<wayland::Display> m_display;
-};
-
-class VulkanLibrary : public vk::Library
-{
-public:
-       VulkanLibrary (void)
-               : m_library     ("libvulkan.so.1")
-               , m_driver      (m_library)
-       {
-       }
-
-       const vk::PlatformInterface& getPlatformInterface (void) const
-       {
-               return m_driver;
-       }
-
-private:
-       const DynamicFunctionLibrary    m_library;
-       const vk::PlatformDriver                m_driver;
-};
-
-WaylandVulkanPlatform::WaylandVulkanPlatform (EventState& eventState)
-       : m_eventState(eventState)
-{
-}
-
-vk::wsi::Display* WaylandVulkanPlatform::createWsiDisplay (vk::wsi::Type wsiType) const
-{
-       switch(wsiType)
-       {
-       case vk::wsi::TYPE_WAYLAND:
-               return new VulkanDisplayWayland(MovePtr<Display>(new Display(m_eventState, DE_NULL)));
-               break;
-       default:
-               TCU_THROW(NotSupportedError, "WSI type not supported");
-
-       };
-}
-
-vk::Library* WaylandVulkanPlatform::createLibrary (void) const
-{
-       return new VulkanLibrary();
-}
-
-void WaylandVulkanPlatform::describePlatform (std::ostream& dst) const
-{
-       utsname         sysInfo;
-       deMemset(&sysInfo, 0, sizeof(sysInfo));
-
-       if (uname(&sysInfo) != 0)
-               throw std::runtime_error("uname() failed");
-
-       dst << "OS: " << sysInfo.sysname << " " << sysInfo.release << " " << sysInfo.version << "\n";
-       dst << "CPU: " << sysInfo.machine << "\n";
-}
-
-void WaylandVulkanPlatform::getMemoryLimits (vk::PlatformMemoryLimits& limits) const
-{
-       limits.totalSystemMemory                                        = 256*1024*1024;
-       limits.totalDeviceLocalMemory                           = 128*1024*1024;
-       limits.deviceMemoryAllocationGranularity        = 64*1024;
-       limits.devicePageSize                                           = 4096;
-       limits.devicePageTableEntrySize                         = 8;
-       limits.devicePageTableHierarchyLevels           = 3;
-}
-
-} // wayland
-} // tcu
-
diff --git a/framework/platform/wayland/tcuWaylandVulkanPlatform.hpp b/framework/platform/wayland/tcuWaylandVulkanPlatform.hpp
deleted file mode 100644 (file)
index dfa5828..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-#ifndef _TCUWAYLANDVULKANPLATFORM_HPP
-#define _TCUWAYLANDVULKANPLATFORM_HPP
-/*-------------------------------------------------------------------------
- * drawElements Quality Program Tester Core
- * ----------------------------------------
- *
- * Copyright (c) 2016 The Khronos Group Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- *//*!
- * \file
- * \brief Wayland Vulkan Platform.
- *//*--------------------------------------------------------------------*/
-
-#include "vkWsiPlatform.hpp"
-#include "vkPlatform.hpp"
-#include "tcuWayland.hpp"
-
-namespace tcu
-{
-namespace wayland
-{
-
-class WaylandVulkanPlatform : public vk::Platform
-{
-public:
-                                               WaylandVulkanPlatform   (EventState& eventState);
-       vk::wsi::Display*       createWsiDisplay                (vk::wsi::Type wsiType) const;
-       vk::Library*            createLibrary                   (void) const;
-       void                            describePlatform                (std::ostream& dst) const;
-       void                            getMemoryLimits                 (vk::PlatformMemoryLimits& limits) const;
-
-private :
-        EventState&            m_eventState;
-};
-
-
-} // wayland
-} // tcu
-
-#endif // _TCUWAYLANDVULKANPLATFORM_HPP
index d4c95bc..6281a63 100644 (file)
@@ -66,4 +66,10 @@ if (DE_OS_IS_UNIX)
                set(DEQP_PLATFORM_LIBRARIES ${XCB_LIBRARIES})
                include_directories(${XCB_INCLUDE_DIR})
        endif ()
+       find_package(Wayland)
+       if (WAYLAND_FOUND)
+               set(DEQP_USE_WAYLAND ON)
+               set(DEQP_PLATFORM_LIBRARIES ${WAYLAND_LIBRARIES})
+               include_directories(${WAYLAND_INCLUDE_DIR})
+       endif ()
 endif ()
index 3de6e7c..8adc417 100644 (file)
@@ -25,7 +25,7 @@ set(DEQP_TARGET_NAME "Wayland")
 set(DEQP_USE_WAYLAND   ON)
 
 # Add FindWayland module
-set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/targets/wayland")
+set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/targets/default")
 
 find_package(Wayland)
 if (NOT WAYLAND_FOUND)
@@ -33,16 +33,4 @@ if (NOT WAYLAND_FOUND)
 endif ()
 
 set(DEQP_PLATFORM_LIBRARIES ${WAYLAND_LIBRARIES})
-include_directories(${WAYLAND_INCLUDE_DIR})
-
-# Platform sources
-set(TCUTIL_PLATFORM_SRCS
-       wayland/tcuWayland.cpp
-       wayland/tcuWayland.hpp
-       wayland/tcuWaylandPlatform.cpp
-       wayland/tcuWaylandPlatform.hpp
-       wayland/tcuWaylandEglPlatform.cpp
-       wayland/tcuWaylandEglPlatform.hpp
-       wayland/tcuWaylandVulkanPlatform.cpp
-       wayland/tcuWaylandVulkanPlatform.hpp
-       )
+include_directories(${WAYLAND_INCLUDE_DIR})
\ No newline at end of file