• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 #ifndef _TCUOHOSROSENNATIVEDISPLAY_HPP
16 #define _TCUOHOSROSENNATIVEDISPLAY_HPP
17 
18 #include "egluGLContextFactory.hpp"
19 #include "eglwLibrary.hpp"
20 #include "eglwFunctions.hpp"
21 #include "eglwEnums.hpp"
22 #include "deUniquePtr.hpp"
23 
24 namespace tcu
25 {
26 namespace OHOS_ROSEN
27 {
28 namespace egl
29 {
30 
31 using std::string;
32 using de::MovePtr;
33 using de::UniquePtr;
34 using glu::ContextFactory;
35 using eglu::GLContextFactory;
36 using eglu::NativeDisplay;
37 using eglu::NativeDisplayFactory;
38 using eglu::NativeWindow;
39 using eglu::NativeWindowFactory;
40 using eglu::NativePixmap;
41 using eglu::NativePixmapFactory;
42 using eglu::WindowParams;
43 using tcu::TextureLevel;
44 
45 class OhosLibrary : public eglw::DefaultLibrary
46 {
47 public:
OhosLibrary(void)48     OhosLibrary (void)
49         : eglw::DefaultLibrary("libEGL_impl.so")
50     {
51     }
52 
53 // call1_BEGIN
54     eglw::EGLBoolean bindAPI(eglw::EGLenum api) const;
55     eglw::EGLBoolean bindTexImage(eglw::EGLDisplay dpy, eglw::EGLSurface surface, eglw::EGLint buffer) const;
56     eglw::EGLBoolean chooseConfig(eglw::EGLDisplay dpy, const eglw::EGLint *attrib_list, eglw::EGLConfig *configs, eglw::EGLint config_size, eglw::EGLint *num_config) const;
57     eglw::EGLint clientWaitSync(eglw::EGLDisplay dpy, eglw::EGLSync sync, eglw::EGLint flags, eglw::EGLTime timeout) const;
58     eglw::EGLint clientWaitSyncKHR(eglw::EGLDisplay dpy, eglw::EGLSyncKHR sync, eglw::EGLint flags, eglw::EGLTimeKHR timeout) const;
59     eglw::EGLBoolean copyBuffers(eglw::EGLDisplay dpy, eglw::EGLSurface surface, eglw::EGLNativePixmapType target) const;
60     eglw::EGLContext createContext(eglw::EGLDisplay dpy, eglw::EGLConfig config, eglw::EGLContext share_context, const eglw::EGLint *attrib_list) const;
61     eglw::EGLImage createImage(eglw::EGLDisplay dpy, eglw::EGLContext ctx, eglw::EGLenum target, eglw::EGLClientBuffer buffer, const eglw::EGLAttrib *attrib_list) const;
62     eglw::EGLImageKHR createImageKHR(eglw::EGLDisplay dpy, eglw::EGLContext ctx, eglw::EGLenum target, eglw::EGLClientBuffer buffer, const eglw::EGLint *attrib_list) const;
63     eglw::EGLSurface createPbufferFromClientBuffer(eglw::EGLDisplay dpy, eglw::EGLenum buftype, eglw::EGLClientBuffer buffer, eglw::EGLConfig config, const eglw::EGLint *attrib_list) const;
64     eglw::EGLSurface createPbufferSurface(eglw::EGLDisplay dpy, eglw::EGLConfig config, const eglw::EGLint *attrib_list) const;
65     eglw::EGLSurface createPixmapSurface(eglw::EGLDisplay dpy, eglw::EGLConfig config, eglw::EGLNativePixmapType pixmap, const eglw::EGLint *attrib_list) const;
66     eglw::EGLSurface createPlatformPixmapSurface(eglw::EGLDisplay dpy, eglw::EGLConfig config, void *native_pixmap, const eglw::EGLAttrib *attrib_list) const;
67     eglw::EGLSurface createPlatformPixmapSurfaceEXT(eglw::EGLDisplay dpy, eglw::EGLConfig config, void *native_pixmap, const eglw::EGLint *attrib_list) const;
68     eglw::EGLSurface createPlatformWindowSurface(eglw::EGLDisplay dpy, eglw::EGLConfig config, void *native_window, const eglw::EGLAttrib *attrib_list) const;
69     eglw::EGLSurface createPlatformWindowSurfaceEXT(eglw::EGLDisplay dpy, eglw::EGLConfig config, void *native_window, const eglw::EGLint *attrib_list) const;
70     eglw::EGLSync createSync(eglw::EGLDisplay dpy, eglw::EGLenum type, const eglw::EGLAttrib *attrib_list) const;
71     eglw::EGLSyncKHR createSyncKHR(eglw::EGLDisplay dpy, eglw::EGLenum type, const eglw::EGLint *attrib_list) const;
72     eglw::EGLSurface createWindowSurface(eglw::EGLDisplay dpy, eglw::EGLConfig config, eglw::EGLNativeWindowType win, const eglw::EGLint *attrib_list) const;
73     eglw::EGLBoolean destroyContext(eglw::EGLDisplay dpy, eglw::EGLContext ctx) const;
74     eglw::EGLBoolean destroyImage(eglw::EGLDisplay dpy, eglw::EGLImage image) const;
75     eglw::EGLBoolean destroyImageKHR(eglw::EGLDisplay dpy, eglw::EGLImageKHR image) const;
76     eglw::EGLBoolean destroySurface(eglw::EGLDisplay dpy, eglw::EGLSurface surface) const;
77     eglw::EGLBoolean destroySync(eglw::EGLDisplay dpy, eglw::EGLSync sync) const;
78     eglw::EGLBoolean destroySyncKHR(eglw::EGLDisplay dpy, eglw::EGLSyncKHR sync) const;
79     eglw::EGLBoolean getConfigAttrib(eglw::EGLDisplay dpy, eglw::EGLConfig config, eglw::EGLint attribute, eglw::EGLint *value) const;
80     eglw::EGLBoolean getConfigs(eglw::EGLDisplay dpy, eglw::EGLConfig *configs, eglw::EGLint config_size, eglw::EGLint *num_config) const;
81     eglw::EGLContext getCurrentContext() const;
82     eglw::EGLDisplay getCurrentDisplay() const;
83     eglw::EGLSurface getCurrentSurface(eglw::EGLint readdraw) const;
84     eglw::EGLDisplay getDisplay(eglw::EGLNativeDisplayType display_id) const;
85     eglw::EGLint getError() const;
86     eglw::EGLDisplay getPlatformDisplay(eglw::EGLenum platform, void *native_display, const eglw::EGLAttrib *attrib_list) const;
87     eglw::EGLDisplay getPlatformDisplayEXT(eglw::EGLenum platform, void *native_display, const eglw::EGLint *attrib_list) const;
88     eglw::__eglMustCastToProperFunctionPointerType getProcAddress(const char *procname) const;
89     eglw::EGLBoolean getSyncAttrib(eglw::EGLDisplay dpy, eglw::EGLSync sync, eglw::EGLint attribute, eglw::EGLAttrib *value) const;
90     eglw::EGLBoolean getSyncAttribKHR(eglw::EGLDisplay dpy, eglw::EGLSyncKHR sync, eglw::EGLint attribute, eglw::EGLint *value) const;
91     eglw::EGLBoolean initialize(eglw::EGLDisplay dpy, eglw::EGLint *major, eglw::EGLint *minor) const;
92     eglw::EGLBoolean lockSurfaceKHR(eglw::EGLDisplay dpy, eglw::EGLSurface surface, const eglw::EGLint *attrib_list) const;
93     eglw::EGLBoolean makeCurrent(eglw::EGLDisplay dpy, eglw::EGLSurface draw, eglw::EGLSurface read, eglw::EGLContext ctx) const;
94     eglw::EGLenum queryAPI() const;
95     eglw::EGLBoolean queryContext(eglw::EGLDisplay dpy, eglw::EGLContext ctx, eglw::EGLint attribute, eglw::EGLint *value) const;
96     const char* queryString(eglw::EGLDisplay dpy, eglw::EGLint name) const;
97     eglw::EGLBoolean querySurface(eglw::EGLDisplay dpy, eglw::EGLSurface surface, eglw::EGLint attribute, eglw::EGLint *value) const;
98     eglw::EGLBoolean releaseTexImage(eglw::EGLDisplay dpy, eglw::EGLSurface surface, eglw::EGLint buffer) const;
99     eglw::EGLBoolean releaseThread() const;
100     eglw::EGLBoolean setDamageRegionKHR(eglw::EGLDisplay dpy, eglw::EGLSurface surface, eglw::EGLint *rects, eglw::EGLint n_rects) const;
101     eglw::EGLBoolean signalSyncKHR(eglw::EGLDisplay dpy, eglw::EGLSyncKHR sync, eglw::EGLenum mode) const;
102     eglw::EGLBoolean surfaceAttrib(eglw::EGLDisplay dpy, eglw::EGLSurface surface, eglw::EGLint attribute, eglw::EGLint value) const;
103     eglw::EGLBoolean swapBuffers(eglw::EGLDisplay dpy, eglw::EGLSurface surface) const;
104     eglw::EGLBoolean swapBuffersWithDamageKHR(eglw::EGLDisplay dpy, eglw::EGLSurface surface, eglw::EGLint *rects, eglw::EGLint n_rects) const;
105     eglw::EGLBoolean swapInterval(eglw::EGLDisplay dpy, eglw::EGLint interval) const;
106     eglw::EGLBoolean terminate(eglw::EGLDisplay dpy) const;
107     eglw::EGLBoolean unlockSurfaceKHR(eglw::EGLDisplay dpy, eglw::EGLSurface surface) const;
108     eglw::EGLBoolean waitClient() const;
109     eglw::EGLBoolean waitGL() const;
110     eglw::EGLBoolean waitNative(eglw::EGLint engine) const;
111     eglw::EGLBoolean waitSync(eglw::EGLDisplay dpy, eglw::EGLSync sync, eglw::EGLint flags) const;
112     eglw::EGLint waitSyncKHR(eglw::EGLDisplay dpy, eglw::EGLSyncKHR sync, eglw::EGLint flags) const;
113 // call1_END
114 };
115 
116 class OhosDisplay : public NativeDisplay
117 {
118 public:
119     static const Capability CAPABILITIES        = Capability(CAPABILITY_GET_DISPLAY_LEGACY);
120 
121     OhosDisplay                (void);
122     // virtual ~OhosDisplay         (void) {};
123 
124     void*                        getPlatformNative        (void);
125     // eglw::EGLNativeDisplayType    getPlatformExtension    (void);
126     eglw::EGLNativeDisplayType    getLegacyNative            (void);
127 
128     // NativeDisplay&                getOhosDisplay            (void)            { return *this;}
getLibrary(void) const129     const eglw::Library&        getLibrary                (void) const    { return m_library;    }
130     // const eglw::EGLAttrib*        getPlatformAttributes    (void) const    { return DE_NULL; }
131 
132 private:
133     OhosLibrary                        m_library;
134 
135 };
136 
137 } // egl
138 } // OHOS
139 } // tcu
140 #endif // _TCUOHOSROSENNATIVEDISPLAY_HPP