Mir
egl_sync_fence.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2015 Canonical Ltd.
3  *
4  * This program is free software: you can redistribute it and/or modify it
5  * under the terms of the GNU Lesser General Public License version 3,
6  * as published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
17  */
18 
19 #ifndef MIR_GRAPHICS_EGL_SYNC_FENCE_H_
20 #define MIR_GRAPHICS_EGL_SYNC_FENCE_H_
21 
22 #include "egl_sync_extensions.h"
23 #include "command_stream_sync.h"
24 #include <memory>
25 #include <mutex>
26 
27 namespace mir
28 {
29 namespace graphics
30 {
32 {
33  void raise() override;
34  void reset() override;
35  bool wait_for(std::chrono::nanoseconds ns) override;
36 };
37 
39 {
40 public:
41  EGLSyncFence(std::shared_ptr<EGLSyncExtensions> const&);
42  ~EGLSyncFence();
43 
44  void raise() override;
45  void reset() override;
46  bool wait_for(std::chrono::nanoseconds ns) override;
47 private:
48  void reset(std::unique_lock<std::mutex> const&);
49  bool wait_for(std::unique_lock<std::mutex> const&, std::chrono::nanoseconds ns);
50 
51  std::shared_ptr<EGLSyncExtensions> const egl;
52  std::chrono::nanoseconds const default_timeout{
53  std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::milliseconds(1))};
54 
55  std::mutex mutex;
56  EGLDisplay fence_display;
57  EGLSyncKHR sync_point;
58 };
59 
60 }
61 }
62 
63 #endif /* MIR_GRAPHICS_EGL_SYNC_FENCE_H_ */
All things Mir.
Definition: atomic_callback.h:25
Definition: egl_sync_fence.h:31
Definition: egl_sync_fence.h:38
Definition: command_stream_sync.h:28

Copyright © 2012-2015 Canonical Ltd.
Generated on Thu Sep 8 14:50:19 UTC 2016