blob: 44d1378d1a384fa518e450a4fba9adb8a6684e09 [file] [log] [blame]
Jason Ekstrand1f09b852017-08-28 14:10:12 -07001/*
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)
35struct 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
45struct 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
55uint32_t syncobj_create(int fd, uint32_t flags);
56void syncobj_destroy(int fd, uint32_t handle);
57int __syncobj_handle_to_fd(int fd, struct drm_syncobj_handle *args);
58int __syncobj_fd_to_handle(int fd, struct drm_syncobj_handle *args);
59int syncobj_handle_to_fd(int fd, uint32_t handle, uint32_t flags);
60uint32_t syncobj_fd_to_handle(int fd, int syncobj_fd, uint32_t flags);
61void syncobj_import_sync_file(int fd, uint32_t handle, int sync_file);
62int __syncobj_wait(int fd, struct local_syncobj_wait *args);
63int syncobj_wait_err(int fd, uint32_t *handles, uint32_t count,
64 uint64_t abs_timeout_nsec, uint32_t flags);
65bool syncobj_wait(int fd, uint32_t *handles, uint32_t count,
66 uint64_t abs_timeout_nsec, uint32_t flags,
67 uint32_t *first_signaled);
68void syncobj_reset(int fd, uint32_t *handles, uint32_t count);
69void syncobj_signal(int fd, uint32_t *handles, uint32_t count);
70
71#endif /* IGT_SYNCOBJ_H */