1 #ifndef _EGLUNATIVEDISPLAY_HPP
2 #define _EGLUNATIVEDISPLAY_HPP
3 /*-------------------------------------------------------------------------
4 * drawElements Quality Program Tester Core
5 * ----------------------------------------
7 * Copyright 2014 The Android Open Source Project
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
23 * \brief EGL native display abstraction
24 *//*--------------------------------------------------------------------*/
26 #include "tcuDefs.hpp"
27 #include "tcuFactoryRegistry.hpp"
28 #include "egluNativeWindow.hpp"
29 #include "egluNativePixmap.hpp"
30 #include "eglwDefs.hpp"
47 CAPABILITY_GET_DISPLAY_LEGACY = (1<<0), //!< Query EGL display using eglGetDisplay()
48 CAPABILITY_GET_DISPLAY_PLATFORM = (1<<1) //!< Query EGL display using eglGetPlatformDisplay()
51 virtual ~NativeDisplay (void);
53 virtual const eglw::Library& getLibrary (void) const = 0;
55 Capability getCapabilities (void) const { return m_capabilities; }
56 eglw::EGLenum getPlatformType (void) const { return m_platformType; }
57 const char* getPlatformExtensionName (void) const { return (m_platformExtension.empty() ? DE_NULL : m_platformExtension.c_str()); }
59 //! Get EGLNativeDisplayType that can be used with eglGetDisplay(). Default implementation throws tcu::NotSupportedError().
60 virtual eglw::EGLNativeDisplayType getLegacyNative (void);
62 //! Return display pointer that can be used with eglGetPlatformDisplay(). Default implementations throw tcu::NotSupportedError()
63 virtual void* getPlatformNative (void);
65 //! Attributes to pass to eglGetPlatformDisplay(EXT)
66 virtual const eglw::EGLAttrib* getPlatformAttributes (void) const;
69 NativeDisplay (Capability capabilities, eglw::EGLenum platformType, const char* platformExtension);
70 NativeDisplay (Capability capabilities);
73 NativeDisplay (const NativeDisplay&);
74 NativeDisplay& operator= (const NativeDisplay&);
76 const Capability m_capabilities;
77 const eglw::EGLenum m_platformType; //!< EGL platform type, or EGL_NONE if not supported.
78 const std::string m_platformExtension;
81 class NativeDisplayFactory : public tcu::FactoryBase
84 virtual ~NativeDisplayFactory (void);
86 virtual NativeDisplay* createDisplay (const eglw::EGLAttrib* attribList = DE_NULL) const = 0;
88 NativeDisplay::Capability getCapabilities (void) const { return m_capabilities; }
89 eglw::EGLenum getPlatformType (void) const { return m_platformType; }
90 const char* getPlatformExtensionName (void) const { return (m_platformExtension.empty() ? DE_NULL : m_platformExtension.c_str()); }
92 const NativeWindowFactoryRegistry& getNativeWindowRegistry (void) const { return m_nativeWindowRegistry; }
93 const NativePixmapFactoryRegistry& getNativePixmapRegistry (void) const { return m_nativePixmapRegistry; }
96 NativeDisplayFactory (const std::string& name, const std::string& description, NativeDisplay::Capability capabilities);
97 NativeDisplayFactory (const std::string& name, const std::string& description, NativeDisplay::Capability capabilities, eglw::EGLenum platformType, const char* platformExtension);
99 NativeWindowFactoryRegistry m_nativeWindowRegistry;
100 NativePixmapFactoryRegistry m_nativePixmapRegistry;
103 NativeDisplayFactory (const NativeDisplayFactory&);
104 NativeDisplayFactory& operator= (const NativeDisplayFactory&);
106 const NativeDisplay::Capability m_capabilities;
107 const eglw::EGLenum m_platformType;
108 const std::string m_platformExtension;
111 typedef tcu::FactoryRegistry<NativeDisplayFactory> NativeDisplayFactoryRegistry;
115 #endif // _EGLUNATIVEDISPLAY_HPP