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