From 7852fe54159cb6602a4408b8107b52999890dc79 Mon Sep 17 00:00:00 2001 From: Mark Janes Date: Thu, 25 Jul 2019 10:50:36 -0700 Subject: intel/common: provide common ioctl routine i965 links against libdrm for drmIoctl, but anv and iris both re-implement this routine to avoid the dependency. intel/dev also needs an ioctl wrapper, so lets share the same implementation everywhere. Reviewed-by: Kenneth Graunke Reviewed-by: Lionel Landwerlin --- src/intel/common/gen_gem.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/intel/common/gen_gem.h') diff --git a/src/intel/common/gen_gem.h b/src/intel/common/gen_gem.h index 8df2c249e48..c4dda6de657 100644 --- a/src/intel/common/gen_gem.h +++ b/src/intel/common/gen_gem.h @@ -24,7 +24,9 @@ #ifndef GEN_GEM_H #define GEN_GEM_H +#include #include +#include static inline uint64_t gen_canonical_address(uint64_t v) @@ -54,4 +56,18 @@ gen_48b_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; +} + #endif /* GEN_GEM_H */ -- cgit v1.2.3