1 //
2 // Copyright 2019 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 // SyncEGL.h: Defines the rx::SyncEGL class, the EGL implementation of EGL sync objects.
8 
9 #ifndef LIBANGLE_RENDERER_GL_EGL_SYNCEGL_H_
10 #define LIBANGLE_RENDERER_GL_EGL_SYNCEGL_H_
11 
12 #include "libANGLE/renderer/EGLSyncImpl.h"
13 
14 namespace egl
15 {
16 class AttributeMap;
17 }
18 
19 namespace rx
20 {
21 
22 class FunctionsEGL;
23 
24 class SyncEGL final : public EGLSyncImpl
25 {
26   public:
27     SyncEGL(const egl::AttributeMap &attribs, const FunctionsEGL *egl);
28     ~SyncEGL() override;
29 
30     void onDestroy(const egl::Display *display) override;
31 
32     egl::Error initialize(const egl::Display *display,
33                           const gl::Context *context,
34                           EGLenum type) override;
35     egl::Error clientWait(const egl::Display *display,
36                           const gl::Context *context,
37                           EGLint flags,
38                           EGLTime timeout,
39                           EGLint *outResult) override;
40     egl::Error serverWait(const egl::Display *display,
41                           const gl::Context *context,
42                           EGLint flags) override;
43     egl::Error getStatus(const egl::Display *display, EGLint *outStatus) override;
44 
45     egl::Error dupNativeFenceFD(const egl::Display *display, EGLint *result) const override;
46 
47   private:
48     const FunctionsEGL *mEGL;
49     EGLint mNativeFenceFD;
50 
51     EGLSync mSync;
52 };
53 
54 }  // namespace rx
55 
56 #endif  // LIBANGLE_RENDERER_GL_EGL_IMAGEEGL_H_
57