1 #ifndef _TCUQNXSCREENPLATFORM_HPP 2 #define _TCUQNXSCREENPLATFORM_HPP 3 /*------------------------------------------------------------------------- 4 * drawElements Quality Program Tester Core 5 * ---------------------------------------- 6 * 7 * Copyright (c) 2024 NVIDIA CORPORATION. 8 * 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 12 * 13 * http://www.apache.org/licenses/LICENSE-2.0 14 * 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. 20 * 21 *//*! 22 * \file 23 * \brief QNX Screen Platform definition. 24 *//*--------------------------------------------------------------------*/ 25 26 #include "tcuDefs.hpp" 27 #include "egluPlatform.hpp" 28 #include "gluPlatform.hpp" 29 #include "tcuPlatform.hpp" 30 #include "egluNativeDisplay.hpp" 31 #include "egluNativeWindow.hpp" 32 #include "egluGLContextFactory.hpp" 33 #include "eglwLibrary.hpp" 34 #include "eglwFunctions.hpp" 35 #include "eglwEnums.hpp" 36 37 #include <dlfcn.h> 38 #include <screen/screen.h> 39 40 namespace tcu 41 { 42 namespace QnxScreen 43 { 44 45 class Platform : public tcu::Platform, private eglu::Platform, private glu::Platform 46 { 47 public: 48 Platform(void); 49 ~Platform(void); 50 getGLPlatform(void) const51 virtual const glu::Platform &getGLPlatform(void) const 52 { 53 return static_cast<const glu::Platform &>(*this); 54 } 55 getEGLPlatform(void) const56 virtual const eglu::Platform &getEGLPlatform(void) const 57 { 58 return static_cast<const eglu::Platform &>(*this); 59 } 60 }; 61 62 class Library : public eglw::DefaultLibrary 63 { 64 public: Library(void)65 Library(void) : eglw::DefaultLibrary("libEGL.so") 66 { 67 } 68 }; 69 70 class Display : public eglu::NativeDisplay 71 { 72 private: 73 void LoadLibscreen(void); 74 void CreateScreenContext(void); 75 void DestroyScreenContext(void); 76 77 public: 78 Display(void); 79 ~Display(void); 80 getLegacyNative(void)81 eglw::EGLNativeDisplayType getLegacyNative(void) 82 { 83 return m_display; 84 } getLibrary(void) const85 const eglw::Library &getLibrary(void) const 86 { 87 return m_library; 88 } 89 eglw::EGLNativeDisplayType *m_display; 90 Library m_library; 91 }; 92 93 class DisplayFactory : public eglu::NativeDisplayFactory 94 { 95 public: 96 DisplayFactory(void); ~DisplayFactory(void)97 ~DisplayFactory(void) 98 { 99 } 100 101 eglu::NativeDisplay *createDisplay(const eglw::EGLAttrib *attribList) const; 102 }; 103 104 class Window : public eglu::NativeWindow 105 { 106 public: 107 Window(eglu::NativeDisplay *display, int width, int height, eglw::EGLDisplay eglDisplay, eglw::EGLConfig config); 108 ~Window(void); 109 getLegacyNative(void)110 eglw::EGLNativeWindowType getLegacyNative(void) 111 { 112 return m_nativeWindow; 113 } 114 115 private: 116 eglw::EGLNativeWindowType m_nativeWindow; 117 screen_window_t m_screenWindow{nullptr}; 118 }; 119 120 class WindowFactory : public eglu::NativeWindowFactory 121 { 122 public: WindowFactory(void)123 WindowFactory(void) 124 : eglu::NativeWindowFactory("window", "QNX Screen Window", eglu::NativeWindow::CAPABILITY_CREATE_SURFACE_LEGACY) 125 { 126 } ~WindowFactory(void)127 ~WindowFactory(void) 128 { 129 } 130 131 eglu::NativeWindow *createWindow(eglu::NativeDisplay *display, const eglu::WindowParams ¶ms) const; 132 133 eglu::NativeWindow *createWindow(eglu::NativeDisplay *display, eglw::EGLDisplay eglDisplay, eglw::EGLConfig config, 134 const eglw::EGLAttrib *attribList, const eglu::WindowParams ¶ms) const; 135 }; 136 137 } // namespace QnxScreen 138 } // namespace tcu 139 140 #endif // _TCUQNXSCREENPLATFORM_HPP