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// EGLSync.h: Defines the egl::Sync classes, which support the EGL_KHR_fence_sync,
8// EGL_KHR_wait_sync and EGL 1.5 sync objects.
9
10#ifndef LIBANGLE_EGLSYNC_H_
11#define LIBANGLE_EGLSYNC_H_
12
13#include "libANGLE/Debug.h"
14#include "libANGLE/Error.h"
15#include "libANGLE/RefCountObject.h"
16
17#include "common/angleutils.h"
18
19namespace rx
20{
21class EGLImplFactory;
22class EGLSyncImpl;
23} // namespace rx
24
25namespace gl
26{
27class Context;
28} // namespace gl
29
30namespace egl
31{
32class Sync final : public angle::RefCountObject<Display, angle::Result>, public LabeledObject
33{
34 public:
35 Sync(rx::EGLImplFactory *factory, const SyncID &id, EGLenum type, const AttributeMap &attribs);
36 ~Sync() override;
37
38 void setLabel(EGLLabelKHR label) override;
39 EGLLabelKHR getLabel() const override;
40
41 const SyncID &id() const { return mId; }
42
43 void onDestroy(const Display *display) override;
44
45 Error initialize(const Display *display, const gl::Context *context);
46 Error clientWait(const Display *display,
47 const gl::Context *context,
48 EGLint flags,
49 EGLTime timeout,
50 EGLint *outResult);
51 Error serverWait(const Display *display, const gl::Context *context, EGLint flags);
52 Error signal(const Display *display, const gl::Context *context, EGLint mode);
53 Error getStatus(const Display *display, EGLint *outStatus) const;
54
55 Error copyMetalSharedEventANGLE(const Display *display, void **result) const;
56 Error dupNativeFenceFD(const Display *display, EGLint *result) const;
57
58 EGLenum getType() const { return mType; }
59 const AttributeMap &getAttributeMap() const { return mAttributeMap; }
60 EGLint getCondition() const { return mCondition; }
61 EGLint getNativeFenceFD() const { return mNativeFenceFD; }
62
63 private:
64 std::unique_ptr<rx::EGLSyncImpl> mFence;
65
66 EGLLabelKHR mLabel;
67
68 SyncID mId;
69 EGLenum mType;
70 AttributeMap mAttributeMap;
71 EGLint mCondition;
72 EGLint mNativeFenceFD;
73};
74
75} // namespace egl
76
77#endif // LIBANGLE_FENCE_H_
78

source code of flutter_engine/third_party/angle/src/libANGLE/EGLSync.h