From 1bd53281518742381625aa69ee98a8a0198821d7 Mon Sep 17 00:00:00 2001 From: Courtney Goeltzenleuchter Date: Fri, 17 Aug 2018 07:44:35 -0600 Subject: [PATCH] EGL 1.5 CreatePlatform* Add tests for eglCreatePlatformWindowSurface and eglCreatePlatformPixmapSurface by refactoring tests for the cooresponding extension functions to allow testing both entry points. For Android, add extension and platform tests to device CAPABILITIES. Affects: dEQP-EGL.functional.create_surface.platform_ext_window.* dEQP-EGL.functional.create_surface.platform_ext_pixmap.* dEQP-EGL.functional.create_surface.platform_window.* dEQP-EGL.functional.create_surface.platform_pixmap.* Components: Framework, AOSP VK-GL-CTS issue: 1178 Change-Id: Iaeccf1c6936fe41544b46ebf65aaa3c2d135ccbd --- android/cts/master/egl-master.txt | 42 +++++ .../egl/aosp_mustpass/3.2.5.x/egl-master.txt | 42 +++++ .../egl/aosp_mustpass/master/egl-master.txt | 42 +++++ framework/egl/egluNativePixmap.cpp | 6 + framework/egl/egluNativePixmap.hpp | 8 +- framework/egl/egluNativeWindow.cpp | 6 + framework/egl/egluNativeWindow.hpp | 14 +- framework/egl/egluUtil.cpp | 39 +++- framework/platform/android/tcuAndroidPlatform.cpp | 4 + .../lnx/X11/tcuLnxX11EglDisplayFactory.cpp | 7 +- modules/egl/teglCreateSurfaceTests.cpp | 203 +++++++++++++++------ modules/egl/teglGetProcAddressTests.cpp | 7 +- 12 files changed, 342 insertions(+), 78 deletions(-) diff --git a/android/cts/master/egl-master.txt b/android/cts/master/egl-master.txt index 32b8499..044568c 100644 --- a/android/cts/master/egl-master.txt +++ b/android/cts/master/egl-master.txt @@ -153,6 +153,48 @@ dEQP-EGL.functional.create_surface.pbuffer.rgba8888_no_depth_stencil dEQP-EGL.functional.create_surface.pbuffer.rgba8888_depth_no_stencil dEQP-EGL.functional.create_surface.pbuffer.rgba8888_depth_stencil dEQP-EGL.functional.create_surface.pbuffer.other +dEQP-EGL.functional.create_surface.platform_ext_window.rgb565_no_depth_no_stencil +dEQP-EGL.functional.create_surface.platform_ext_window.rgb565_no_depth_stencil +dEQP-EGL.functional.create_surface.platform_ext_window.rgb565_depth_no_stencil +dEQP-EGL.functional.create_surface.platform_ext_window.rgb565_depth_stencil +dEQP-EGL.functional.create_surface.platform_ext_window.rgb888_no_depth_no_stencil +dEQP-EGL.functional.create_surface.platform_ext_window.rgb888_no_depth_stencil +dEQP-EGL.functional.create_surface.platform_ext_window.rgb888_depth_no_stencil +dEQP-EGL.functional.create_surface.platform_ext_window.rgb888_depth_stencil +dEQP-EGL.functional.create_surface.platform_ext_window.rgba4444_no_depth_no_stencil +dEQP-EGL.functional.create_surface.platform_ext_window.rgba4444_no_depth_stencil +dEQP-EGL.functional.create_surface.platform_ext_window.rgba4444_depth_no_stencil +dEQP-EGL.functional.create_surface.platform_ext_window.rgba4444_depth_stencil +dEQP-EGL.functional.create_surface.platform_ext_window.rgba5551_no_depth_no_stencil +dEQP-EGL.functional.create_surface.platform_ext_window.rgba5551_no_depth_stencil +dEQP-EGL.functional.create_surface.platform_ext_window.rgba5551_depth_no_stencil +dEQP-EGL.functional.create_surface.platform_ext_window.rgba5551_depth_stencil +dEQP-EGL.functional.create_surface.platform_ext_window.rgba8888_no_depth_no_stencil +dEQP-EGL.functional.create_surface.platform_ext_window.rgba8888_no_depth_stencil +dEQP-EGL.functional.create_surface.platform_ext_window.rgba8888_depth_no_stencil +dEQP-EGL.functional.create_surface.platform_ext_window.rgba8888_depth_stencil +dEQP-EGL.functional.create_surface.platform_ext_window.other +dEQP-EGL.functional.create_surface.platform_ext_pixmap.rgb565_no_depth_no_stencil +dEQP-EGL.functional.create_surface.platform_ext_pixmap.rgb565_no_depth_stencil +dEQP-EGL.functional.create_surface.platform_ext_pixmap.rgb565_depth_no_stencil +dEQP-EGL.functional.create_surface.platform_ext_pixmap.rgb565_depth_stencil +dEQP-EGL.functional.create_surface.platform_ext_pixmap.rgb888_no_depth_no_stencil +dEQP-EGL.functional.create_surface.platform_ext_pixmap.rgb888_no_depth_stencil +dEQP-EGL.functional.create_surface.platform_ext_pixmap.rgb888_depth_no_stencil +dEQP-EGL.functional.create_surface.platform_ext_pixmap.rgb888_depth_stencil +dEQP-EGL.functional.create_surface.platform_ext_pixmap.rgba4444_no_depth_no_stencil +dEQP-EGL.functional.create_surface.platform_ext_pixmap.rgba4444_no_depth_stencil +dEQP-EGL.functional.create_surface.platform_ext_pixmap.rgba4444_depth_no_stencil +dEQP-EGL.functional.create_surface.platform_ext_pixmap.rgba4444_depth_stencil +dEQP-EGL.functional.create_surface.platform_ext_pixmap.rgba5551_no_depth_no_stencil +dEQP-EGL.functional.create_surface.platform_ext_pixmap.rgba5551_no_depth_stencil +dEQP-EGL.functional.create_surface.platform_ext_pixmap.rgba5551_depth_no_stencil +dEQP-EGL.functional.create_surface.platform_ext_pixmap.rgba5551_depth_stencil +dEQP-EGL.functional.create_surface.platform_ext_pixmap.rgba8888_no_depth_no_stencil +dEQP-EGL.functional.create_surface.platform_ext_pixmap.rgba8888_no_depth_stencil +dEQP-EGL.functional.create_surface.platform_ext_pixmap.rgba8888_depth_no_stencil +dEQP-EGL.functional.create_surface.platform_ext_pixmap.rgba8888_depth_stencil +dEQP-EGL.functional.create_surface.platform_ext_pixmap.other dEQP-EGL.functional.create_surface.platform_window.rgb565_no_depth_no_stencil dEQP-EGL.functional.create_surface.platform_window.rgb565_no_depth_stencil dEQP-EGL.functional.create_surface.platform_window.rgb565_depth_no_stencil diff --git a/external/openglcts/data/mustpass/egl/aosp_mustpass/3.2.5.x/egl-master.txt b/external/openglcts/data/mustpass/egl/aosp_mustpass/3.2.5.x/egl-master.txt index 9cd2044..cf0e07c 100644 --- a/external/openglcts/data/mustpass/egl/aosp_mustpass/3.2.5.x/egl-master.txt +++ b/external/openglcts/data/mustpass/egl/aosp_mustpass/3.2.5.x/egl-master.txt @@ -153,6 +153,48 @@ dEQP-EGL.functional.create_surface.pbuffer.rgba8888_no_depth_stencil dEQP-EGL.functional.create_surface.pbuffer.rgba8888_depth_no_stencil dEQP-EGL.functional.create_surface.pbuffer.rgba8888_depth_stencil dEQP-EGL.functional.create_surface.pbuffer.other +dEQP-EGL.functional.create_surface.platform_ext_window.rgb565_no_depth_no_stencil +dEQP-EGL.functional.create_surface.platform_ext_window.rgb565_no_depth_stencil +dEQP-EGL.functional.create_surface.platform_ext_window.rgb565_depth_no_stencil +dEQP-EGL.functional.create_surface.platform_ext_window.rgb565_depth_stencil +dEQP-EGL.functional.create_surface.platform_ext_window.rgb888_no_depth_no_stencil +dEQP-EGL.functional.create_surface.platform_ext_window.rgb888_no_depth_stencil +dEQP-EGL.functional.create_surface.platform_ext_window.rgb888_depth_no_stencil +dEQP-EGL.functional.create_surface.platform_ext_window.rgb888_depth_stencil +dEQP-EGL.functional.create_surface.platform_ext_window.rgba4444_no_depth_no_stencil +dEQP-EGL.functional.create_surface.platform_ext_window.rgba4444_no_depth_stencil +dEQP-EGL.functional.create_surface.platform_ext_window.rgba4444_depth_no_stencil +dEQP-EGL.functional.create_surface.platform_ext_window.rgba4444_depth_stencil +dEQP-EGL.functional.create_surface.platform_ext_window.rgba5551_no_depth_no_stencil +dEQP-EGL.functional.create_surface.platform_ext_window.rgba5551_no_depth_stencil +dEQP-EGL.functional.create_surface.platform_ext_window.rgba5551_depth_no_stencil +dEQP-EGL.functional.create_surface.platform_ext_window.rgba5551_depth_stencil +dEQP-EGL.functional.create_surface.platform_ext_window.rgba8888_no_depth_no_stencil +dEQP-EGL.functional.create_surface.platform_ext_window.rgba8888_no_depth_stencil +dEQP-EGL.functional.create_surface.platform_ext_window.rgba8888_depth_no_stencil +dEQP-EGL.functional.create_surface.platform_ext_window.rgba8888_depth_stencil +dEQP-EGL.functional.create_surface.platform_ext_window.other +dEQP-EGL.functional.create_surface.platform_ext_pixmap.rgb565_no_depth_no_stencil +dEQP-EGL.functional.create_surface.platform_ext_pixmap.rgb565_no_depth_stencil +dEQP-EGL.functional.create_surface.platform_ext_pixmap.rgb565_depth_no_stencil +dEQP-EGL.functional.create_surface.platform_ext_pixmap.rgb565_depth_stencil +dEQP-EGL.functional.create_surface.platform_ext_pixmap.rgb888_no_depth_no_stencil +dEQP-EGL.functional.create_surface.platform_ext_pixmap.rgb888_no_depth_stencil +dEQP-EGL.functional.create_surface.platform_ext_pixmap.rgb888_depth_no_stencil +dEQP-EGL.functional.create_surface.platform_ext_pixmap.rgb888_depth_stencil +dEQP-EGL.functional.create_surface.platform_ext_pixmap.rgba4444_no_depth_no_stencil +dEQP-EGL.functional.create_surface.platform_ext_pixmap.rgba4444_no_depth_stencil +dEQP-EGL.functional.create_surface.platform_ext_pixmap.rgba4444_depth_no_stencil +dEQP-EGL.functional.create_surface.platform_ext_pixmap.rgba4444_depth_stencil +dEQP-EGL.functional.create_surface.platform_ext_pixmap.rgba5551_no_depth_no_stencil +dEQP-EGL.functional.create_surface.platform_ext_pixmap.rgba5551_no_depth_stencil +dEQP-EGL.functional.create_surface.platform_ext_pixmap.rgba5551_depth_no_stencil +dEQP-EGL.functional.create_surface.platform_ext_pixmap.rgba5551_depth_stencil +dEQP-EGL.functional.create_surface.platform_ext_pixmap.rgba8888_no_depth_no_stencil +dEQP-EGL.functional.create_surface.platform_ext_pixmap.rgba8888_no_depth_stencil +dEQP-EGL.functional.create_surface.platform_ext_pixmap.rgba8888_depth_no_stencil +dEQP-EGL.functional.create_surface.platform_ext_pixmap.rgba8888_depth_stencil +dEQP-EGL.functional.create_surface.platform_ext_pixmap.other dEQP-EGL.functional.create_surface.platform_window.rgb565_no_depth_no_stencil dEQP-EGL.functional.create_surface.platform_window.rgb565_no_depth_stencil dEQP-EGL.functional.create_surface.platform_window.rgb565_depth_no_stencil diff --git a/external/openglcts/data/mustpass/egl/aosp_mustpass/master/egl-master.txt b/external/openglcts/data/mustpass/egl/aosp_mustpass/master/egl-master.txt index c01c7b1..4b5c512 100644 --- a/external/openglcts/data/mustpass/egl/aosp_mustpass/master/egl-master.txt +++ b/external/openglcts/data/mustpass/egl/aosp_mustpass/master/egl-master.txt @@ -153,6 +153,48 @@ dEQP-EGL.functional.create_surface.pbuffer.rgba8888_no_depth_stencil dEQP-EGL.functional.create_surface.pbuffer.rgba8888_depth_no_stencil dEQP-EGL.functional.create_surface.pbuffer.rgba8888_depth_stencil dEQP-EGL.functional.create_surface.pbuffer.other +dEQP-EGL.functional.create_surface.platform_ext_window.rgb565_no_depth_no_stencil +dEQP-EGL.functional.create_surface.platform_ext_window.rgb565_no_depth_stencil +dEQP-EGL.functional.create_surface.platform_ext_window.rgb565_depth_no_stencil +dEQP-EGL.functional.create_surface.platform_ext_window.rgb565_depth_stencil +dEQP-EGL.functional.create_surface.platform_ext_window.rgb888_no_depth_no_stencil +dEQP-EGL.functional.create_surface.platform_ext_window.rgb888_no_depth_stencil +dEQP-EGL.functional.create_surface.platform_ext_window.rgb888_depth_no_stencil +dEQP-EGL.functional.create_surface.platform_ext_window.rgb888_depth_stencil +dEQP-EGL.functional.create_surface.platform_ext_window.rgba4444_no_depth_no_stencil +dEQP-EGL.functional.create_surface.platform_ext_window.rgba4444_no_depth_stencil +dEQP-EGL.functional.create_surface.platform_ext_window.rgba4444_depth_no_stencil +dEQP-EGL.functional.create_surface.platform_ext_window.rgba4444_depth_stencil +dEQP-EGL.functional.create_surface.platform_ext_window.rgba5551_no_depth_no_stencil +dEQP-EGL.functional.create_surface.platform_ext_window.rgba5551_no_depth_stencil +dEQP-EGL.functional.create_surface.platform_ext_window.rgba5551_depth_no_stencil +dEQP-EGL.functional.create_surface.platform_ext_window.rgba5551_depth_stencil +dEQP-EGL.functional.create_surface.platform_ext_window.rgba8888_no_depth_no_stencil +dEQP-EGL.functional.create_surface.platform_ext_window.rgba8888_no_depth_stencil +dEQP-EGL.functional.create_surface.platform_ext_window.rgba8888_depth_no_stencil +dEQP-EGL.functional.create_surface.platform_ext_window.rgba8888_depth_stencil +dEQP-EGL.functional.create_surface.platform_ext_window.other +dEQP-EGL.functional.create_surface.platform_ext_pixmap.rgb565_no_depth_no_stencil +dEQP-EGL.functional.create_surface.platform_ext_pixmap.rgb565_no_depth_stencil +dEQP-EGL.functional.create_surface.platform_ext_pixmap.rgb565_depth_no_stencil +dEQP-EGL.functional.create_surface.platform_ext_pixmap.rgb565_depth_stencil +dEQP-EGL.functional.create_surface.platform_ext_pixmap.rgb888_no_depth_no_stencil +dEQP-EGL.functional.create_surface.platform_ext_pixmap.rgb888_no_depth_stencil +dEQP-EGL.functional.create_surface.platform_ext_pixmap.rgb888_depth_no_stencil +dEQP-EGL.functional.create_surface.platform_ext_pixmap.rgb888_depth_stencil +dEQP-EGL.functional.create_surface.platform_ext_pixmap.rgba4444_no_depth_no_stencil +dEQP-EGL.functional.create_surface.platform_ext_pixmap.rgba4444_no_depth_stencil +dEQP-EGL.functional.create_surface.platform_ext_pixmap.rgba4444_depth_no_stencil +dEQP-EGL.functional.create_surface.platform_ext_pixmap.rgba4444_depth_stencil +dEQP-EGL.functional.create_surface.platform_ext_pixmap.rgba5551_no_depth_no_stencil +dEQP-EGL.functional.create_surface.platform_ext_pixmap.rgba5551_no_depth_stencil +dEQP-EGL.functional.create_surface.platform_ext_pixmap.rgba5551_depth_no_stencil +dEQP-EGL.functional.create_surface.platform_ext_pixmap.rgba5551_depth_stencil +dEQP-EGL.functional.create_surface.platform_ext_pixmap.rgba8888_no_depth_no_stencil +dEQP-EGL.functional.create_surface.platform_ext_pixmap.rgba8888_no_depth_stencil +dEQP-EGL.functional.create_surface.platform_ext_pixmap.rgba8888_depth_no_stencil +dEQP-EGL.functional.create_surface.platform_ext_pixmap.rgba8888_depth_stencil +dEQP-EGL.functional.create_surface.platform_ext_pixmap.other dEQP-EGL.functional.create_surface.platform_window.rgb565_no_depth_no_stencil dEQP-EGL.functional.create_surface.platform_window.rgb565_no_depth_stencil dEQP-EGL.functional.create_surface.platform_window.rgb565_depth_no_stencil diff --git a/framework/egl/egluNativePixmap.cpp b/framework/egl/egluNativePixmap.cpp index 1f7177f..53b5f59 100644 --- a/framework/egl/egluNativePixmap.cpp +++ b/framework/egl/egluNativePixmap.cpp @@ -47,6 +47,12 @@ void* NativePixmap::getPlatformExtension (void) throw tcu::NotSupportedError("eglu::NativePixmap doesn't support eglCreatePlatformPixmapSurfaceEXT()", DE_NULL, __FILE__, __LINE__); } +void* NativePixmap::getPlatformNative (void) +{ + TCU_CHECK_INTERNAL((m_capabilities & CAPABILITY_CREATE_SURFACE_PLATFORM) == 0); + throw tcu::NotSupportedError("eglu::NativePixmap doesn't support eglCreatePlatformPixmapSurface()", DE_NULL, __FILE__, __LINE__); +} + void NativePixmap::readPixels (tcu::TextureLevel*) { TCU_CHECK_INTERNAL((m_capabilities & CAPABILITY_READ_PIXELS) == 0); diff --git a/framework/egl/egluNativePixmap.hpp b/framework/egl/egluNativePixmap.hpp index 2d3e087..3984248 100644 --- a/framework/egl/egluNativePixmap.hpp +++ b/framework/egl/egluNativePixmap.hpp @@ -44,8 +44,9 @@ public: enum Capability { CAPABILITY_CREATE_SURFACE_LEGACY = (1<<0), //!< EGL surface can be created with eglCreatePixmapSurface() - CAPABILITY_CREATE_SURFACE_PLATFORM_EXTENSION = (1<<1), //!< EGL surface can be created with eglCreatePlatformPixmapSurfaceEXT() - CAPABILITY_READ_PIXELS = (1<<2) + CAPABILITY_CREATE_SURFACE_PLATFORM = (1<<1), //!< EGL surface can be created with eglCreatePlatformPixmapSurface() + CAPABILITY_CREATE_SURFACE_PLATFORM_EXTENSION = (1<<2), //!< EGL surface can be created with eglCreatePlatformPixmapSurfaceEXT() + CAPABILITY_READ_PIXELS = (1<<3) }; virtual ~NativePixmap (void) {} @@ -53,6 +54,9 @@ public: //! Return EGLNativePixmapType that can be used with eglCreatePixmapSurface(). Default implementation throws tcu::NotSupportedError(). virtual eglw::EGLNativePixmapType getLegacyNative (void); + //! Return native pointer that can be used with eglCreatePlatformPixmapSurface(). Default implementation throws tcu::NotSupportedError(). + virtual void* getPlatformNative (void); + //! Return native pointer that can be used with eglCreatePlatformPixmapSurfaceEXT(). Default implementation throws tcu::NotSupportedError(). virtual void* getPlatformExtension (void); diff --git a/framework/egl/egluNativeWindow.cpp b/framework/egl/egluNativeWindow.cpp index 8ffa294..53af09c 100644 --- a/framework/egl/egluNativeWindow.cpp +++ b/framework/egl/egluNativeWindow.cpp @@ -47,6 +47,12 @@ void* NativeWindow::getPlatformExtension (void) throw tcu::NotSupportedError("eglu::NativeWindow doesn't support eglCreatePlatformWindowSurfaceEXT()", DE_NULL, __FILE__, __LINE__); } +void* NativeWindow::getPlatformNative (void) +{ + TCU_CHECK_INTERNAL((m_capabilities & CAPABILITY_CREATE_SURFACE_PLATFORM) == 0); + throw tcu::NotSupportedError("eglu::NativeWindow doesn't support eglCreatePlatformWindowSurface()", DE_NULL, __FILE__, __LINE__); +} + tcu::IVec2 NativeWindow::getSurfaceSize (void) const { TCU_CHECK_INTERNAL((m_capabilities & CAPABILITY_GET_SURFACE_SIZE) == 0); diff --git a/framework/egl/egluNativeWindow.hpp b/framework/egl/egluNativeWindow.hpp index fbaf2c1..5d417c0 100644 --- a/framework/egl/egluNativeWindow.hpp +++ b/framework/egl/egluNativeWindow.hpp @@ -77,11 +77,12 @@ public: { CAPABILITY_CREATE_SURFACE_LEGACY = (1<<0), //!< EGL surface can be created with eglCreateWindowSurface() CAPABILITY_CREATE_SURFACE_PLATFORM_EXTENSION = (1<<1), //!< EGL surface can be created with eglCreatePlatformWindowSurfaceEXT() - CAPABILITY_GET_SURFACE_SIZE = (1<<2), - CAPABILITY_SET_SURFACE_SIZE = (1<<3), - CAPABILITY_GET_SCREEN_SIZE = (1<<4), - CAPABILITY_READ_SCREEN_PIXELS = (1<<5), - CAPABILITY_CHANGE_VISIBILITY = (1<<6) + CAPABILITY_CREATE_SURFACE_PLATFORM = (1<<2), //!< EGL surface can be created with eglCreatePlatformWindowSurface() + CAPABILITY_GET_SURFACE_SIZE = (1<<3), + CAPABILITY_SET_SURFACE_SIZE = (1<<4), + CAPABILITY_GET_SCREEN_SIZE = (1<<5), + CAPABILITY_READ_SCREEN_PIXELS = (1<<6), + CAPABILITY_CHANGE_VISIBILITY = (1<<7) }; virtual ~NativeWindow (void) {} @@ -92,6 +93,9 @@ public: //! Return native pointer that can be used with eglCreatePlatformWindowSurfaceEXT(). Default implementation throws tcu::NotSupportedError(). virtual void* getPlatformExtension (void); + //! Return native pointer that can be used with eglCreatePlatformWindowSurface(). Default implementation throws tcu::NotSupportedError(). + virtual void* getPlatformNative (void); + // Process window events. Defaults to dummy implementation, that does nothing. virtual void processEvents (void) {} diff --git a/framework/egl/egluUtil.cpp b/framework/egl/egluUtil.cpp index 8882097..82b41f3 100644 --- a/framework/egl/egluUtil.cpp +++ b/framework/egl/egluUtil.cpp @@ -85,7 +85,16 @@ bool hasExtension (const Library& egl, EGLDisplay display, const string& str) vector getClientExtensions (const Library& egl) { - return getExtensions(egl, EGL_NO_DISPLAY); + const char* const extensionStr = egl.queryString(EGL_NO_DISPLAY, EGL_EXTENSIONS); + const EGLint eglError = egl.getError(); + if (eglError == EGL_BAD_DISPLAY && extensionStr == DE_NULL) { + // We do not support client extensions + TCU_THROW(NotSupportedError, "EGL_EXT_client_extensions not supported"); + } + + EGLU_CHECK_MSG(egl, "Querying extensions failed"); + + return de::splitString(extensionStr, ' '); } vector getDisplayExtensions (const Library& egl, EGLDisplay display) @@ -281,16 +290,18 @@ void terminateDisplay(const Library& egl, EGLDisplay display) EGLU_CHECK_CALL(egl, terminate(display)); } -//! Create EGL window surface using eglCreateWindowSurface() or eglCreatePlatformWindowSurfaceEXT() +//! Create EGL window surface using eglCreatePlatformWindowSurface, eglCreateWindowSurface() or eglCreatePlatformWindowSurfaceEXT() EGLSurface createWindowSurface (NativeDisplay& nativeDisplay, NativeWindow& window, EGLDisplay display, EGLConfig config, const EGLAttrib* attribList) { const Library& egl = nativeDisplay.getLibrary(); const bool supportsLegacyCreate = (window.getCapabilities() & NativeWindow::CAPABILITY_CREATE_SURFACE_LEGACY) != 0; + const bool supportsPlatformCreate = ((window.getCapabilities() & NativeWindow::CAPABILITY_CREATE_SURFACE_PLATFORM) != 0 + && eglu::getVersion(egl, display) >= eglu::Version(1, 5)); const bool supportsPlatformCreateExtension = (window.getCapabilities() & NativeWindow::CAPABILITY_CREATE_SURFACE_PLATFORM_EXTENSION) != 0; bool usePlatformExt = false; EGLSurface surface = EGL_NO_SURFACE; - TCU_CHECK_INTERNAL(supportsLegacyCreate || supportsPlatformCreateExtension); + TCU_CHECK_INTERNAL(supportsLegacyCreate || supportsPlatformCreateExtension || supportsPlatformCreate); if (supportsPlatformCreateExtension) { @@ -299,11 +310,15 @@ EGLSurface createWindowSurface (NativeDisplay& nativeDisplay, NativeWindow& wind de::contains(platformExts.begin(), platformExts.end(), string(nativeDisplay.getPlatformExtensionName())); } - // \todo [2014-03-13 pyry] EGL 1.5 core support - if (usePlatformExt) + if (supportsPlatformCreate) + { + surface = egl.createPlatformWindowSurface(display, config, window.getPlatformNative(), attribList); + EGLU_CHECK_MSG(egl, "eglCreatePlatformWindowSurface()"); + TCU_CHECK(surface != EGL_NO_SURFACE); + } + else if (usePlatformExt) { const vector legacyAttribs = toLegacyAttribList(attribList); - surface = egl.createPlatformWindowSurfaceEXT(display, config, window.getPlatformExtension(), &legacyAttribs[0]); EGLU_CHECK_MSG(egl, "eglCreatePlatformWindowSurfaceEXT()"); TCU_CHECK(surface != EGL_NO_SURFACE); @@ -328,10 +343,12 @@ EGLSurface createPixmapSurface (NativeDisplay& nativeDisplay, NativePixmap& pixm const Library& egl = nativeDisplay.getLibrary(); const bool supportsLegacyCreate = (pixmap.getCapabilities() & NativePixmap::CAPABILITY_CREATE_SURFACE_LEGACY) != 0; const bool supportsPlatformCreateExtension = (pixmap.getCapabilities() & NativePixmap::CAPABILITY_CREATE_SURFACE_PLATFORM_EXTENSION) != 0; + const bool supportsPlatformCreate = ((pixmap.getCapabilities() & NativePixmap::CAPABILITY_CREATE_SURFACE_PLATFORM) != 0 + && eglu::getVersion(egl, display) >= eglu::Version(1, 5)); bool usePlatformExt = false; EGLSurface surface = EGL_NO_SURFACE; - TCU_CHECK_INTERNAL(supportsLegacyCreate || supportsPlatformCreateExtension); + TCU_CHECK_INTERNAL(supportsLegacyCreate || supportsPlatformCreateExtension || supportsPlatformCreate); if (supportsPlatformCreateExtension) { @@ -340,7 +357,13 @@ EGLSurface createPixmapSurface (NativeDisplay& nativeDisplay, NativePixmap& pixm de::contains(platformExts.begin(), platformExts.end(), string(nativeDisplay.getPlatformExtensionName())); } - if (usePlatformExt) + if (supportsPlatformCreate) + { + surface = egl.createPlatformPixmapSurface(display, config, pixmap.getPlatformNative(), attribList); + EGLU_CHECK_MSG(egl, "eglCreatePlatformPixmapSurface()"); + TCU_CHECK(surface != EGL_NO_SURFACE); + } + else if (usePlatformExt) { const vector legacyAttribs = toLegacyAttribList(attribList); diff --git a/framework/platform/android/tcuAndroidPlatform.cpp b/framework/platform/android/tcuAndroidPlatform.cpp index 2aa0920..16eb5be 100644 --- a/framework/platform/android/tcuAndroidPlatform.cpp +++ b/framework/platform/android/tcuAndroidPlatform.cpp @@ -49,6 +49,8 @@ using namespace eglw; static const eglu::NativeDisplay::Capability DISPLAY_CAPABILITIES = eglu::NativeDisplay::CAPABILITY_GET_DISPLAY_LEGACY; static const eglu::NativeWindow::Capability WINDOW_CAPABILITIES = (eglu::NativeWindow::Capability)(eglu::NativeWindow::CAPABILITY_CREATE_SURFACE_LEGACY | + eglu::NativeWindow::CAPABILITY_CREATE_SURFACE_PLATFORM | + eglu::NativeWindow::CAPABILITY_CREATE_SURFACE_PLATFORM_EXTENSION | eglu::NativeWindow::CAPABILITY_SET_SURFACE_SIZE | eglu::NativeWindow::CAPABILITY_GET_SCREEN_SIZE); @@ -81,6 +83,8 @@ public: virtual ~NativeWindow (void); virtual EGLNativeWindowType getLegacyNative (void) { return m_window->getNativeWindow(); } + virtual EGLNativeWindowType getPlatformExtension (void) { return m_window->getNativeWindow(); } + virtual EGLNativeWindowType getPlatformNative (void) { return m_window->getNativeWindow(); } IVec2 getScreenSize (void) const { return m_window->getSize(); } void setSurfaceSize (IVec2 size); diff --git a/framework/platform/lnx/X11/tcuLnxX11EglDisplayFactory.cpp b/framework/platform/lnx/X11/tcuLnxX11EglDisplayFactory.cpp index afa72c6..89f9564 100644 --- a/framework/platform/lnx/X11/tcuLnxX11EglDisplayFactory.cpp +++ b/framework/platform/lnx/X11/tcuLnxX11EglDisplayFactory.cpp @@ -113,6 +113,7 @@ public: , m_display (x11Display) {} void* getPlatformNative (void) { return m_display->getXDisplay(); } + eglw::EGLNativeDisplayType getPlatformExtension (void) { return reinterpret_cast(m_display->getXDisplay()); } eglw::EGLNativeDisplayType getLegacyNative (void) { return reinterpret_cast(m_display->getXDisplay()); } XlibDisplay& getX11Display (void) { return *m_display; } @@ -128,6 +129,7 @@ class Window : public NativeWindow { public: static const Capability CAPABILITIES = Capability(CAPABILITY_CREATE_SURFACE_LEGACY | + CAPABILITY_CREATE_SURFACE_PLATFORM | CAPABILITY_CREATE_SURFACE_PLATFORM_EXTENSION | CAPABILITY_GET_SURFACE_SIZE | CAPABILITY_SET_SURFACE_SIZE | @@ -137,8 +139,9 @@ public: const WindowParams& params, Visual* visual); - eglw::EGLNativeWindowType getLegacyNative (void) { return reinterpret_cast(m_window.getXID()); } - void* getPlatformNative (void) { return &m_window.getXID(); } + eglw::EGLNativeWindowType getLegacyNative (void) { return reinterpret_cast(m_window.getXID()); } + void* getPlatformExtension (void) { return &m_window.getXID(); } + void* getPlatformNative (void) { return &m_window.getXID(); } IVec2 getSurfaceSize (void) const; void setSurfaceSize (IVec2 size); diff --git a/modules/egl/teglCreateSurfaceTests.cpp b/modules/egl/teglCreateSurfaceTests.cpp index fb36d9a..de9d6d7 100644 --- a/modules/egl/teglCreateSurfaceTests.cpp +++ b/modules/egl/teglCreateSurfaceTests.cpp @@ -37,6 +37,7 @@ #include "tcuCommandLine.hpp" #include "tcuTestLog.hpp" +#include "deStringUtil.hpp" #include "deSTLUtil.hpp" #include "deUniquePtr.hpp" @@ -54,51 +55,87 @@ using namespace eglw; namespace { -void checkEGLPlatformSupport (const Library& egl, const char* platformExt) +#define EGL_MAKE_VERSION(major, minor) (((major) << 12) | (minor)) + +enum ApiType +{ + LEGACY, + EXTENSION, + EGL15 +}; + +void checkEGLPlatformSupport (const Library& egl) { - std::vector extensions = eglu::getClientExtensions(egl); + const vector extensions = eglu::getClientExtensions(egl); + if (!de::contains(extensions.begin(), extensions.end(), "EGL_EXT_platform_base")) + throw tcu::NotSupportedError("Platform extension 'EGL_EXT_platform_base' not supported", "", __FILE__, __LINE__); +} - if (!de::contains(extensions.begin(), extensions.end(), platformExt)) - throw tcu::NotSupportedError((std::string("Platform extension '") + platformExt + "' not supported").c_str(), "", __FILE__, __LINE__); +void checkEGL15Support (const Library& egl, EGLDisplay display) +{ + // The EGL_VERSION string is laid out as follows: + // major_version.minor_version space vendor_specific_info + // Split version from vendor_specific_info + std::vector tokens = de::splitString(egl.queryString(display, EGL_VERSION), ' '); + // split version into major & minor + std::vector values = de::splitString(tokens[0], '.'); + EGLint eglVersion = EGL_MAKE_VERSION(atoi(values[0].c_str()), atoi(values[1].c_str())); + if (eglVersion < EGL_MAKE_VERSION(1, 5)) + throw tcu::NotSupportedError("EGL 1.5 not supported", "", __FILE__, __LINE__); } -EGLSurface createWindowSurface (EGLDisplay display, EGLConfig config, eglu::NativeDisplay& nativeDisplay, eglu::NativeWindow& window, bool useLegacyCreate) +EGLSurface createWindowSurface (EGLDisplay display, EGLConfig config, eglu::NativeDisplay& nativeDisplay, eglu::NativeWindow& window, ApiType createType) { const Library& egl = nativeDisplay.getLibrary(); EGLSurface surface = EGL_NO_SURFACE; - if (useLegacyCreate) - { - surface = egl.createWindowSurface(display, config, window.getLegacyNative(), DE_NULL); - EGLU_CHECK_MSG(egl, "eglCreateWindowSurface() failed"); - } - else + switch (createType) { - checkEGLPlatformSupport(egl, nativeDisplay.getPlatformExtensionName()); - - surface = egl.createPlatformWindowSurfaceEXT(display, config, window.getPlatformExtension(), DE_NULL); - EGLU_CHECK_MSG(egl, "eglCreatePlatformWindowSurfaceEXT() failed"); + case LEGACY: + { + surface = egl.createWindowSurface(display, config, window.getLegacyNative(), DE_NULL); + EGLU_CHECK_MSG(egl, "eglCreateWindowSurface() failed"); + } + break; + case EXTENSION: + { + checkEGLPlatformSupport(egl); + void *nativeWindow = window.getPlatformExtension(); + surface = egl.createPlatformWindowSurfaceEXT(display, config, nativeWindow, DE_NULL); + EGLU_CHECK_MSG(egl, "eglCreatePlatformWindowSurfaceEXT() failed"); + } + break; + case EGL15: + { + checkEGL15Support(egl, display); + surface = egl.createPlatformWindowSurface(display, config, window.getPlatformNative(), DE_NULL); + EGLU_CHECK_MSG(egl, "eglCreatePlatformWindowSurface() failed"); + } } return surface; } -EGLSurface createPixmapSurface (EGLDisplay display, EGLConfig config, eglu::NativeDisplay& nativeDisplay, eglu::NativePixmap& pixmap, bool useLegacyCreate) +EGLSurface createPixmapSurface (EGLDisplay display, EGLConfig config, eglu::NativeDisplay& nativeDisplay, eglu::NativePixmap& pixmap, ApiType createType) { const Library& egl = nativeDisplay.getLibrary(); EGLSurface surface = EGL_NO_SURFACE; - if (useLegacyCreate) + switch (createType) { - surface = egl.createPixmapSurface(display, config, pixmap.getLegacyNative(), DE_NULL); - EGLU_CHECK_MSG(egl, "eglCreatePixmapSurface() failed"); - } - else - { - checkEGLPlatformSupport(egl, nativeDisplay.getPlatformExtensionName()); - - surface = egl.createPlatformPixmapSurfaceEXT(display, config, pixmap.getPlatformExtension(), DE_NULL); - EGLU_CHECK_MSG(egl, "eglCreatePlatformPixmapSurfaceEXT() failed"); + case LEGACY: + surface = egl.createPixmapSurface(display, config, pixmap.getLegacyNative(), DE_NULL); + EGLU_CHECK_MSG(egl, "eglCreatePixmapSurface() failed"); + break; + case EXTENSION: + checkEGLPlatformSupport(egl); + surface = egl.createPlatformPixmapSurfaceEXT(display, config, pixmap.getPlatformExtension(), DE_NULL); + EGLU_CHECK_MSG(egl, "eglCreatePlatformPixmapSurfaceEXT() failed"); + break; + case EGL15: + surface = egl.createPlatformPixmapSurface(display, config, pixmap.getPlatformNative(), DE_NULL); + EGLU_CHECK_MSG(egl, "eglCreatePlatformPixmapSurface() failed"); + break; } return surface; @@ -107,9 +144,9 @@ EGLSurface createPixmapSurface (EGLDisplay display, EGLConfig config, eglu::Nati class CreateWindowSurfaceCase : public SimpleConfigCase { public: - CreateWindowSurfaceCase (EglTestContext& eglTestCtx, const char* name, const char* description, bool useLegacyCreate, const eglu::FilterList& filters) + CreateWindowSurfaceCase (EglTestContext& eglTestCtx, const char* name, const char* description, ApiType createType, const eglu::FilterList& filters) : SimpleConfigCase (eglTestCtx, name, description, filters) - , m_useLegacyCreate (useLegacyCreate) + , m_createType (createType) { } @@ -122,15 +159,26 @@ public: // \todo [2011-03-23 pyry] Iterate thru all possible combinations of EGL_RENDER_BUFFER, EGL_VG_COLORSPACE and EGL_VG_ALPHA_FORMAT - if (m_useLegacyCreate) - { - if ((windowFactory.getCapabilities() & eglu::NativeWindow::CAPABILITY_CREATE_SURFACE_LEGACY) == 0) - TCU_THROW(NotSupportedError, "Native window doesn't support legacy eglCreateWindowSurface()"); - } - else + switch (m_createType) { - if ((windowFactory.getCapabilities() & eglu::NativeWindow::CAPABILITY_CREATE_SURFACE_PLATFORM_EXTENSION) == 0) - TCU_THROW(NotSupportedError, "Native window doesn't support eglCreatePlatformWindowSurfaceEXT()"); + case LEGACY: + { + if ((windowFactory.getCapabilities() & eglu::NativeWindow::CAPABILITY_CREATE_SURFACE_LEGACY) == 0) + TCU_THROW(NotSupportedError, "Native window doesn't support legacy eglCreateWindowSurface()"); + } + break; + case EXTENSION: + { + if ((windowFactory.getCapabilities() & eglu::NativeWindow::CAPABILITY_CREATE_SURFACE_PLATFORM_EXTENSION) == 0) + TCU_THROW(NotSupportedError, "Native window doesn't support eglCreatePlatformWindowSurfaceEXT()"); + } + break; + case EGL15: + { + if ((windowFactory.getCapabilities() & eglu::NativeWindow::CAPABILITY_CREATE_SURFACE_PLATFORM) == 0) + TCU_THROW(NotSupportedError, "Native window doesn't support eglCreatePlatformWindowSurface()"); + } + break; } log << TestLog::Message << "Creating window surface with config ID " << id << TestLog::EndMessage; @@ -140,7 +188,7 @@ public: const int width = 64; const int height = 64; de::UniquePtr window (windowFactory.createWindow(&m_eglTestCtx.getNativeDisplay(), display, config, DE_NULL, eglu::WindowParams(width, height, eglu::parseWindowVisibility(m_testCtx.getCommandLine())))); - eglu::UniqueSurface surface (egl, display, createWindowSurface(display, config, m_eglTestCtx.getNativeDisplay(), *window, m_useLegacyCreate)); + eglu::UniqueSurface surface (egl, display, createWindowSurface(display, config, m_eglTestCtx.getNativeDisplay(), *window, m_createType)); EGLint windowWidth = 0; EGLint windowHeight = 0; @@ -159,15 +207,15 @@ public: } private: - bool m_useLegacyCreate; + ApiType m_createType; }; class CreatePixmapSurfaceCase : public SimpleConfigCase { public: - CreatePixmapSurfaceCase (EglTestContext& eglTestCtx, const char* name, const char* description, bool useLegacyCreate, const eglu::FilterList& filters) + CreatePixmapSurfaceCase (EglTestContext& eglTestCtx, const char* name, const char* description, ApiType createType, const eglu::FilterList& filters) : SimpleConfigCase(eglTestCtx, name, description, filters) - , m_useLegacyCreate (useLegacyCreate) + , m_createType (createType) { } @@ -180,16 +228,27 @@ public: // \todo [2011-03-23 pyry] Iterate thru all possible combinations of EGL_RENDER_BUFFER, EGL_VG_COLORSPACE and EGL_VG_ALPHA_FORMAT - if (m_useLegacyCreate) + switch (m_createType) { - if ((pixmapFactory.getCapabilities() & eglu::NativePixmap::CAPABILITY_CREATE_SURFACE_LEGACY) == 0) - TCU_THROW(NotSupportedError, "Native pixmap doesn't support legacy eglCreatePixmapSurface()"); - } - else - { - if ((pixmapFactory.getCapabilities() & eglu::NativePixmap::CAPABILITY_CREATE_SURFACE_PLATFORM_EXTENSION) == 0) - TCU_THROW(NotSupportedError, "Native pixmap doesn't support eglCreatePlatformPixmapSurfaceEXT()"); - } + case LEGACY: + { + if ((pixmapFactory.getCapabilities() & eglu::NativePixmap::CAPABILITY_CREATE_SURFACE_LEGACY) == 0) + TCU_THROW(NotSupportedError, "Native pixmap doesn't support legacy eglCreatePixmapSurface()"); + } + break; + case EXTENSION: + { + if ((pixmapFactory.getCapabilities() & eglu::NativePixmap::CAPABILITY_CREATE_SURFACE_PLATFORM_EXTENSION) == 0) + TCU_THROW(NotSupportedError, "Native pixmap doesn't support eglCreatePlatformPixmapSurfaceEXT()"); + } + break; + case EGL15: + { + if ((pixmapFactory.getCapabilities() & eglu::NativePixmap::CAPABILITY_CREATE_SURFACE_PLATFORM) == 0) + TCU_THROW(NotSupportedError, "Native pixmap doesn't support eglCreatePlatformPixmapSurface()"); + } + break; + }; log << TestLog::Message << "Creating pixmap surface with config ID " << id << TestLog::EndMessage; EGLU_CHECK_MSG(egl, "init"); @@ -198,7 +257,7 @@ public: const int width = 64; const int height = 64; de::UniquePtr pixmap (pixmapFactory.createPixmap(&m_eglTestCtx.getNativeDisplay(), display, config, DE_NULL, width, height)); - eglu::UniqueSurface surface (egl, display, createPixmapSurface(display, config, m_eglTestCtx.getNativeDisplay(), *pixmap, m_useLegacyCreate)); + eglu::UniqueSurface surface (egl, display, createPixmapSurface(display, config, m_eglTestCtx.getNativeDisplay(), *pixmap, m_createType)); EGLint pixmapWidth = 0; EGLint pixmapHeight = 0; @@ -216,7 +275,7 @@ public: } private: - bool m_useLegacyCreate; + ApiType m_createType; }; class CreatePbufferSurfaceCase : public SimpleConfigCase @@ -301,7 +360,7 @@ void CreateSurfaceTests::init (void) getDefaultFilterLists(filterLists, baseFilters); for (vector::iterator i = filterLists.begin(); i != filterLists.end(); i++) - windowGroup->addChild(new CreateWindowSurfaceCase(m_eglTestCtx, i->getName(), i->getDescription(), true, *i)); + windowGroup->addChild(new CreateWindowSurfaceCase(m_eglTestCtx, i->getName(), i->getDescription(), LEGACY, *i)); } // Pixmap surfaces @@ -316,7 +375,7 @@ void CreateSurfaceTests::init (void) getDefaultFilterLists(filterLists, baseFilters); for (vector::iterator i = filterLists.begin(); i != filterLists.end(); i++) - pixmapGroup->addChild(new CreatePixmapSurfaceCase(m_eglTestCtx, i->getName(), i->getDescription(), true, *i)); + pixmapGroup->addChild(new CreatePixmapSurfaceCase(m_eglTestCtx, i->getName(), i->getDescription(), LEGACY, *i)); } // Pbuffer surfaces @@ -336,7 +395,7 @@ void CreateSurfaceTests::init (void) // Window surfaces with new platform extension { - tcu::TestCaseGroup* windowGroup = new tcu::TestCaseGroup(m_testCtx, "platform_window", "Window surfaces with platform extension"); + tcu::TestCaseGroup* windowGroup = new tcu::TestCaseGroup(m_testCtx, "platform_ext_window", "Window surfaces with platform extension"); addChild(windowGroup); eglu::FilterList baseFilters; @@ -346,12 +405,42 @@ void CreateSurfaceTests::init (void) getDefaultFilterLists(filterLists, baseFilters); for (vector::iterator i = filterLists.begin(); i != filterLists.end(); i++) - windowGroup->addChild(new CreateWindowSurfaceCase(m_eglTestCtx, i->getName(), i->getDescription(), false, *i)); + windowGroup->addChild(new CreateWindowSurfaceCase(m_eglTestCtx, i->getName(), i->getDescription(), EXTENSION, *i)); } // Pixmap surfaces with new platform extension { - tcu::TestCaseGroup* pixmapGroup = new tcu::TestCaseGroup(m_testCtx, "platform_pixmap", "Pixmap surfaces with platform extension"); + tcu::TestCaseGroup* pixmapGroup = new tcu::TestCaseGroup(m_testCtx, "platform_ext_pixmap", "Pixmap surfaces with platform extension"); + addChild(pixmapGroup); + + eglu::FilterList baseFilters; + baseFilters << surfaceType; + + vector filterLists; + getDefaultFilterLists(filterLists, baseFilters); + + for (vector::iterator i = filterLists.begin(); i != filterLists.end(); i++) + pixmapGroup->addChild(new CreatePixmapSurfaceCase(m_eglTestCtx, i->getName(), i->getDescription(), EXTENSION, *i)); + } + // + // Window surfaces with EGL 1.5 CreateWindowSurface + { + tcu::TestCaseGroup* windowGroup = new tcu::TestCaseGroup(m_testCtx, "platform_window", "Window surfaces with EGL 1.5"); + addChild(windowGroup); + + eglu::FilterList baseFilters; + baseFilters << surfaceType; + + vector filterLists; + getDefaultFilterLists(filterLists, baseFilters); + + for (vector::iterator i = filterLists.begin(); i != filterLists.end(); i++) + windowGroup->addChild(new CreateWindowSurfaceCase(m_eglTestCtx, i->getName(), i->getDescription(), EGL15, *i)); + } + + // Pixmap surfaces with EGL 1.5 CreateWindowSurface + { + tcu::TestCaseGroup* pixmapGroup = new tcu::TestCaseGroup(m_testCtx, "platform_pixmap", "Pixmap surfaces with EGL 1.5"); addChild(pixmapGroup); eglu::FilterList baseFilters; @@ -361,7 +450,7 @@ void CreateSurfaceTests::init (void) getDefaultFilterLists(filterLists, baseFilters); for (vector::iterator i = filterLists.begin(); i != filterLists.end(); i++) - pixmapGroup->addChild(new CreatePixmapSurfaceCase(m_eglTestCtx, i->getName(), i->getDescription(), false, *i)); + pixmapGroup->addChild(new CreatePixmapSurfaceCase(m_eglTestCtx, i->getName(), i->getDescription(), EGL15, *i)); } } diff --git a/modules/egl/teglGetProcAddressTests.cpp b/modules/egl/teglGetProcAddressTests.cpp index 71e9e92..d848339 100644 --- a/modules/egl/teglGetProcAddressTests.cpp +++ b/modules/egl/teglGetProcAddressTests.cpp @@ -116,11 +116,10 @@ void GetProcAddressCase::init (void) { m_supported = eglu::getClientExtensions(m_eglTestCtx.getLibrary()); } - catch (const eglu::Error& error) + catch (const tcu::NotSupportedError& error) { - // EGL_BAD_DISPLAY is generated if client extensions are not supported. - if (error.getError() != EGL_BAD_DISPLAY) - throw; + // Ignore case where EGL client extensions are not supported + // that's okay for these tests. } DE_ASSERT(m_display == EGL_NO_DISPLAY); -- 2.7.4