• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright © 2017 Intel Corporation
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice (including the next
12  * paragraph) shall be included in all copies or substantial portions of the
13  * Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21  * IN THE SOFTWARE.
22  */
23 
24 #ifndef IGT_SYNCOBJ_H
25 #define IGT_SYNCOBJ_H
26 
27 #include <stdint.h>
28 #include <stdbool.h>
29 #include <drm.h>
30 
31 #define LOCAL_SYNCOBJ_CREATE_SIGNALED (1 << 0)
32 
33 #define LOCAL_SYNCOBJ_WAIT_FLAGS_WAIT_ALL (1 << 0)
34 #define LOCAL_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT (1 << 1)
35 struct local_syncobj_wait {
36        __u64 handles;
37        /* absolute timeout */
38        __s64 timeout_nsec;
39        __u32 count_handles;
40        __u32 flags;
41        __u32 first_signaled; /* only valid when not waiting all */
42        __u32 pad;
43 };
44 
45 struct local_syncobj_array {
46        __u64 handles;
47        __u32 count_handles;
48        __u32 pad;
49 };
50 
51 #define LOCAL_IOCTL_SYNCOBJ_WAIT	DRM_IOWR(0xC3, struct local_syncobj_wait)
52 #define LOCAL_IOCTL_SYNCOBJ_RESET	DRM_IOWR(0xC4, struct local_syncobj_array)
53 #define LOCAL_IOCTL_SYNCOBJ_SIGNAL	DRM_IOWR(0xC5, struct local_syncobj_array)
54 
55 uint32_t syncobj_create(int fd, uint32_t flags);
56 void syncobj_destroy(int fd, uint32_t handle);
57 int __syncobj_handle_to_fd(int fd, struct drm_syncobj_handle *args);
58 int __syncobj_fd_to_handle(int fd, struct drm_syncobj_handle *args);
59 int syncobj_handle_to_fd(int fd, uint32_t handle, uint32_t flags);
60 uint32_t syncobj_fd_to_handle(int fd, int syncobj_fd, uint32_t flags);
61 void syncobj_import_sync_file(int fd, uint32_t handle, int sync_file);
62 int __syncobj_wait(int fd, struct local_syncobj_wait *args);
63 int syncobj_wait_err(int fd, uint32_t *handles, uint32_t count,
64 		     uint64_t abs_timeout_nsec, uint32_t flags);
65 bool syncobj_wait(int fd, uint32_t *handles, uint32_t count,
66 		  uint64_t abs_timeout_nsec, uint32_t flags,
67 		  uint32_t *first_signaled);
68 void syncobj_reset(int fd, uint32_t *handles, uint32_t count);
69 void syncobj_signal(int fd, uint32_t *handles, uint32_t count);
70 
71 #endif /* IGT_SYNCOBJ_H */
72