#ifndef GEN_GEM_H
#define GEN_GEM_H
+#include <errno.h>
+#include <stdbool.h>
#include <stdint.h>
+#include <unistd.h>
+#include <sys/ioctl.h>
static inline uint64_t
gen_canonical_address(uint64_t v)
return (uint64_t)(v << shift) >> shift;
}
+/**
+ * Call ioctl, restarting if it is interupted
+ */
+static inline int
+gen_ioctl(int fd, unsigned long request, void *arg)
+{
+ int ret;
+
+ do {
+ ret = ioctl(fd, request, arg);
+ } while (ret == -1 && (errno == EINTR || errno == EAGAIN));
+ return ret;
+}
+
+bool gen_gem_supports_syncobj_wait(int fd);
+
#endif /* GEN_GEM_H */