1 // 2 // Copyright 2020 The ANGLE Project Authors. All rights reserved. 3 // Use of this source code is governed by a BSD-style license that can be 4 // found in the LICENSE file. 5 // 6 7 // EGL_KHR_reusable_sync 8 9 #ifndef LIBANGLE_RENDERER_EGLREUSABLESYNC_H_ 10 #define LIBANGLE_RENDERER_EGLREUSABLESYNC_H_ 11 12 #include "libANGLE/AttributeMap.h" 13 #include "libANGLE/renderer/EGLSyncImpl.h" 14 15 #include "common/angleutils.h" 16 17 #include <condition_variable> 18 19 namespace rx 20 { 21 22 class ReusableSync final : public EGLSyncImpl 23 { 24 public: 25 ReusableSync(const egl::AttributeMap &attribs); 26 ~ReusableSync() override; 27 28 void onDestroy(const egl::Display *display) override; 29 30 egl::Error initialize(const egl::Display *display, 31 const gl::Context *context, 32 EGLenum type) override; 33 egl::Error clientWait(const egl::Display *display, 34 const gl::Context *context, 35 EGLint flags, 36 EGLTime timeout, 37 EGLint *outResult) override; 38 egl::Error serverWait(const egl::Display *display, 39 const gl::Context *context, 40 EGLint flags) override; 41 egl::Error signal(const egl::Display *display, 42 const gl::Context *context, 43 EGLint mode) override; 44 egl::Error getStatus(const egl::Display *display, EGLint *outStatus) override; 45 46 private: 47 EGLint mStatus; 48 std::condition_variable mCondVar; 49 std::unique_lock<std::mutex> mMutex; 50 }; 51 52 } // namespace rx 53 54 #endif // LIBANGLE_RENDERER_EGLREUSABLESYNC_H_ 55