Mir
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
sync_fence.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2013 Canonical Ltd.
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License version 3 as
6  * 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 #ifndef MIR_GRAPHICS_ANDROID_SYNC_FENCE_H_
19 #define MIR_GRAPHICS_ANDROID_SYNC_FENCE_H_
20 
22 #include "mir/fd.h"
23 #include <memory>
24 
25 namespace mir
26 {
27 namespace graphics
28 {
29 namespace android
30 {
31 
33 {
34 public:
35  virtual ~SyncFileOps() = default;
36  virtual int ioctl(int, int, void*) = 0;
37  virtual int dup(int) = 0;
38  virtual int close(int) = 0;
39 };
40 
42 {
43 public:
44  int ioctl(int fd, int req, void* dat);
45  int dup(int fd);
46  int close(int fd);
47 };
48 
49 class SyncFence : public Fence
50 {
51 public:
52  explicit SyncFence(std::shared_ptr<SyncFileOps> const&, Fd fd);
53 
54  void wait();
55  void merge_with(NativeFence& merge_fd);
57 
58 private:
59  SyncFence(SyncFence const&) = delete;
60  SyncFence& operator=(SyncFence const&) = delete;
61 
62  Fd fence_fd;
63  std::shared_ptr<SyncFileOps> const ops;
64 
65  int const infinite_timeout = -1;
66 };
67 
68 }
69 }
70 }
71 #endif /* MIR_GRAPHICS_ANDROID_SYNC_FENCE_H_ */
All things Mir.
Definition: aging_buffer.h:24
int dup(int fd)
Definition: syncfence.cpp:77
Definition: fence.h:32
Definition: fd.h:33
SyncFence(std::shared_ptr< SyncFileOps > const &, Fd fd)
void merge_with(NativeFence &merge_fd)
Definition: syncfence.cpp:43
Definition: sync_fence.h:49
int NativeFence
Definition: fence.h:30
NativeFence copy_native_handle() const
Definition: syncfence.cpp:67
int ioctl(int fd, int req, void *dat)
Definition: syncfence.cpp:72
Definition: sync_fence.h:41
Definition: android_input_receiver.h:32
void wait()
Definition: syncfence.cpp:33
Definition: sync_fence.h:32
virtual int ioctl(int, int, void *)=0
int close(int fd)
Definition: syncfence.cpp:82

Copyright © 2012,2013 Canonical Ltd.
Generated on Fri Oct 10 14:07:14 UTC 2014