1 /*
2                                     __
3                                    / _|
4   __ _ _   _ _ __ ___  _ __ __ _  | |_ ___  ___ ___
5  / _` | | | | '__/ _ \| '__/ _` | |  _/ _ \/ __/ __|
6 | (_| | |_| | | | (_) | | | (_| | | || (_) \__ \__ \
7  \__,_|\__,_|_|  \___/|_|  \__,_| |_| \___/|___/___/
8 
9 Copyright (C) 2017 The Android Open Source Project.
10 Copyright (C) 2018-2019 Aurora Free Open Source Software.
11 
12 This file is part of the Aurora Free Open Source Software. This
13 organization promote free and open source software that you can
14 redistribute and/or modify under the terms of the GNU Lesser General
15 Public License Version 3 as published by the Free Software Foundation or
16 (at your option) any later version approved by the Aurora Free Open Source
17 Software Organization. The license is available in the package root path
18 as 'LICENSE' file. Please review the following information to ensure the
19 GNU Lesser General Public License version 3 requirements will be met:
20 https://www.gnu.org/licenses/lgpl.html .
21 
22 Alternatively, this file may be used under the terms of the GNU General
23 Public License version 3 or later as published by the Free Software
24 Foundation. Please review the following information to ensure the GNU
25 General Public License requirements will be met:
26 https://www.gnu.org/licenses/gpl-3.0.html.
27 
28 NOTE: All products, services or anything associated to trademarks and
29 service marks used or referenced on this file are the property of their
30 respective companies/owners or its subsidiaries. Other names and brands
31 may be claimed as the property of others.
32 
33 For more info about intellectual property visit: aurorafoss.org or
34 directly send an email to: contact (at) aurorafoss.org .
35 
36 This file has bindings for an existing code, part of The Android Open Source
37 Project implementation. Check it out at android.googlesource.com .
38 */
39 
40 module aurorafw.android.platform.sync;
41 
42 /**
43  * @addtogroup Sync
44  * @{
45  */
46 
47 /**
48  * @file aurorafw/android/platform/sync.d
49  */
50 
51 version (Android):
52 extern (C):
53 @system:
54 nothrow:
55 @nogc:
56 
57 /* Fences indicate the status of an asynchronous task. They are initially
58  * in unsignaled state (0), and make a one-time transition to either signaled
59  * (1) or error (< 0) state. A sync file is a collection of one or more fences;
60  * the sync file's status is error if any of its fences are in error state,
61  * signaled if all of the child fences are signaled, or unsignaled otherwise.
62  *
63  * Sync files are created by various device APIs in response to submitting
64  * tasks to the device. Standard file descriptor lifetime syscalls like dup()
65  * and close() are used to manage sync file lifetime.
66  *
67  * The poll(), ppoll(), or select() syscalls can be used to wait for the sync
68  * file to change status, or (with a timeout of zero) to check its status.
69  *
70  * The functions below provide a few additional sync-specific operations.
71  */
72 
73 /**
74  * Merge two sync files.
75  *
76  * This produces a new sync file with the given name which has the union of the
77  * two original sync file's fences; redundant fences may be removed.
78  *
79  * If one of the input sync files is signaled or invalid, then this function
80  * may behave like dup(): the new file descriptor refers to the valid/unsignaled
81  * sync file with its original name, rather than a new sync file.
82  *
83  * The original fences remain valid, and the caller is responsible for closing
84  * them.
85  *
86  * Available since API level 26.
87  */
88 int sync_merge (const(char)* name, int fd1, int fd2);
89 
90 /**
91  * Retrieve detailed information about a sync file and its fences.
92  *
93  * The returned sync_file_info must be freed by calling sync_file_info_free().
94  *
95  * Available since API level 26.
96  */
97 sync_file_info_* sync_file_info (int fd);
98 
99 /**
100  * Get the array of fence infos from the sync file's info.
101  *
102  * The returned array is owned by the parent sync file info, and has
103  * info->num_fences entries.
104  *
105  * Available since API level 26.
106  */
107 
108 // This header should compile in C, but some C++ projects enable
109 // warnings-as-error for C-style casts.
110 sync_fence_info* sync_get_fence_info (const(sync_file_info_)* info);
111 
112 /**
113  * Free a struct sync_file_info structure
114  *
115  * Available since API level 26.
116  */
117 void sync_file_info_free (sync_file_info_* info);
118 
119 /* __ANDROID_API__ >= 26 */
120 
121 /* ANDROID_SYNC_H */
122 
123 /** @} */