• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright 2002 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.cpp: Implements the egl::Sync class.
8 
9 #include "libANGLE/EGLSync.h"
10 
11 #include "angle_gl.h"
12 
13 #include "common/utilities.h"
14 #include "libANGLE/renderer/EGLImplFactory.h"
15 #include "libANGLE/renderer/EGLSyncImpl.h"
16 
17 namespace egl
18 {
19 
Sync(rx::EGLImplFactory * factory,EGLenum type,const AttributeMap & attribs)20 Sync::Sync(rx::EGLImplFactory *factory, EGLenum type, const AttributeMap &attribs)
21     : mFence(factory->createSync(attribs)),
22       mLabel(nullptr),
23       mType(type),
24       mNativeFenceFD(
25           attribs.getAsInt(EGL_SYNC_NATIVE_FENCE_FD_ANDROID, EGL_NO_NATIVE_FENCE_FD_ANDROID))
26 {}
27 
onDestroy(const Display * display)28 void Sync::onDestroy(const Display *display)
29 {
30     ASSERT(mFence);
31     mFence->onDestroy(display);
32     mFence.reset();
33 }
34 
~Sync()35 Sync::~Sync() {}
36 
initialize(const Display * display,const gl::Context * context)37 Error Sync::initialize(const Display *display, const gl::Context *context)
38 {
39     return mFence->initialize(display, context, mType);
40 }
41 
setLabel(EGLLabelKHR label)42 void Sync::setLabel(EGLLabelKHR label)
43 {
44     mLabel = label;
45 }
46 
getLabel() const47 EGLLabelKHR Sync::getLabel() const
48 {
49     return mLabel;
50 }
51 
clientWait(const Display * display,const gl::Context * context,EGLint flags,EGLTime timeout,EGLint * outResult)52 Error Sync::clientWait(const Display *display,
53                        const gl::Context *context,
54                        EGLint flags,
55                        EGLTime timeout,
56                        EGLint *outResult)
57 {
58     return mFence->clientWait(display, context, flags, timeout, outResult);
59 }
60 
serverWait(const Display * display,const gl::Context * context,EGLint flags)61 Error Sync::serverWait(const Display *display, const gl::Context *context, EGLint flags)
62 {
63     return mFence->serverWait(display, context, flags);
64 }
65 
getStatus(const Display * display,EGLint * outStatus) const66 Error Sync::getStatus(const Display *display, EGLint *outStatus) const
67 {
68     return mFence->getStatus(display, outStatus);
69 }
70 
dupNativeFenceFD(const Display * display,EGLint * result) const71 Error Sync::dupNativeFenceFD(const Display *display, EGLint *result) const
72 {
73     return mFence->dupNativeFenceFD(display, result);
74 }
75 
76 }  // namespace egl
77