Merge pull request #26220 from 78andyp/blurayfixes
[xbmc.git] / xbmc / utils / EGLFence.h
blob03c246b60b67b67e8995a96378f3c96d3994ac85
1 /*
2 * Copyright (C) 2017-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.
7 */
9 #pragma once
11 #include "system_egl.h"
13 #include <EGL/eglext.h>
15 namespace KODI
17 namespace UTILS
19 namespace EGL
22 class CEGLFence
24 public:
25 explicit CEGLFence(EGLDisplay display);
26 CEGLFence(CEGLFence const& other) = delete;
27 CEGLFence& operator=(CEGLFence const& other) = delete;
29 void CreateFence();
30 void DestroyFence();
31 bool IsSignaled();
33 #if defined(EGL_ANDROID_native_fence_sync) && defined(EGL_KHR_fence_sync)
34 void CreateKMSFence(int fd);
35 void CreateGPUFence();
36 EGLint FlushFence();
37 void WaitSyncGPU();
38 void WaitSyncCPU();
39 #endif
41 private:
42 EGLDisplay m_display{nullptr};
43 EGLSyncKHR m_fence{nullptr};
45 PFNEGLCREATESYNCKHRPROC m_eglCreateSyncKHR{nullptr};
46 PFNEGLDESTROYSYNCKHRPROC m_eglDestroySyncKHR{nullptr};
47 PFNEGLGETSYNCATTRIBKHRPROC m_eglGetSyncAttribKHR{nullptr};
49 #if defined(EGL_ANDROID_native_fence_sync) && defined(EGL_KHR_fence_sync)
50 EGLSyncKHR CreateFence(int fd);
52 EGLSyncKHR m_gpuFence{EGL_NO_SYNC_KHR};
53 EGLSyncKHR m_kmsFence{EGL_NO_SYNC_KHR};
55 PFNEGLDUPNATIVEFENCEFDANDROIDPROC m_eglDupNativeFenceFDANDROID{nullptr};
56 PFNEGLCLIENTWAITSYNCKHRPROC m_eglClientWaitSyncKHR{nullptr};
57 PFNEGLWAITSYNCKHRPROC m_eglWaitSyncKHR{nullptr};
58 #endif