2 * Copyright (C) 2005-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
11 #include "GLContext.h"
12 #include "threads/CriticalSection.h"
16 #include "system_egl.h"
18 #include <EGL/eglext.h>
19 #ifdef HAVE_EGLEXTANGLE
20 #include <EGL/eglext_angle.h>
22 #include <EGL/eglextchromium.h>
24 #include <X11/Xutil.h>
26 class CGLContextEGL
: public CGLContext
29 explicit CGLContextEGL(Display
*dpy
, EGLint renderingApi
);
30 ~CGLContextEGL() override
;
31 bool Refresh(bool force
, int screen
, Window glWindow
, bool &newContext
) override
;
32 bool CreatePB() override
;
33 void Destroy() override
;
34 void Detach() override
;
35 void SetVSync(bool enable
) override
;
36 void SwapBuffers() override
;
37 void QueryExtensions() override
;
38 uint64_t GetVblankTiming(uint64_t &msc
, uint64_t &interval
) override
;
40 bool BindTextureUploadContext();
41 bool UnbindTextureUploadContext();
44 EGLint m_renderingApi
;
45 EGLDisplay m_eglDisplay
= EGL_NO_DISPLAY
;
46 EGLSurface m_eglSurface
= EGL_NO_SURFACE
;
47 EGLContext m_eglContext
= EGL_NO_CONTEXT
;
48 EGLConfig m_eglConfig
;
50 bool SuitableCheck(EGLDisplay eglDisplay
, EGLConfig config
);
51 EGLConfig
GetEGLConfig(EGLDisplay eglDisplay
, XVisualInfo
*vInfo
);
52 PFNEGLGETSYNCVALUESCHROMIUMPROC m_eglGetSyncValuesCHROMIUM
= nullptr;
53 PFNEGLGETPLATFORMDISPLAYEXTPROC m_eglGetPlatformDisplayEXT
= nullptr;
62 uint64_t interval
= 0;
65 CCriticalSection m_syncLock
;
69 EGLContext m_eglUploadContext
= EGL_NO_CONTEXT
;
70 mutable CCriticalSection m_textureUploadLock
;