diff options
author | Ashutosh Dixit <ashutosh.dixit@intel.com> | 2021-03-15 15:53:56 -0700 |
---|---|---|
committer | Ashutosh Dixit <ashutosh.dixit@intel.com> | 2021-03-17 15:24:36 -0700 |
commit | ad5eb02eb3f10a41d0f1feba7efc02db87cd06b8 (patch) | |
tree | 95ddc30b5588748c68f6f81f6f01ef6617fd258b /lib/ioctl_wrappers.h | |
parent | b3eff02d5400944dd7b14896037bc9bbf362343e (diff) |
lib/ioctl_wrappers: Keep IGT working without pread/pwrite ioctls
The general direction at this time is to phase out pread/write ioctls
and not support them in future products. This means IGT must handle
the absence of these ioctls. This patch does this by modifying
gem_read() and gem_write() to do the read/write using the pread/pwrite
ioctls first but when these ioctls are unavailable fall back to doing
the read/write using a combination of mmap and memcpy.
Callers who must absolutely use the pread/pwrite ioctls (such as tests
which test these ioctls or must otherwise only use the pread/pwrite
ioctls) must use gem_require_pread_pwrite() to skip when these ioctls
are not available.
v1: Removed __gem_pread, gem_pread, __gem_pwrite and gem_pwrite
introduced previously since they are not necessary,
gem_require_pread_pwrite is sufficient
v2: Fix CI failures in gem_advise and gen9_exec_parse by introducing
gem_require_pread_pwrite
v3: Skip mmap for 0 length read/write's
v4: Remove redundant igt_assert's
v5: Re-run
v6: s/EOPNOTSUPP/-EOPNOTSUPP/
v7: Rebase on latest master, skip gem_exec_parallel@userptr with
gem_require_pread_pwrite
v8: Re-run
v9: Rebase
Acked-by: Dave Airlie <airlied@redhat.com>
Acked-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: Zbigniew KempczyĆski <zbigniew.kempczynski@intel.com>
Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
Diffstat (limited to 'lib/ioctl_wrappers.h')
-rw-r--r-- | lib/ioctl_wrappers.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/ioctl_wrappers.h b/lib/ioctl_wrappers.h index 69e19841..9ea67365 100644 --- a/lib/ioctl_wrappers.h +++ b/lib/ioctl_wrappers.h @@ -71,6 +71,9 @@ int __gem_write(int fd, uint32_t handle, uint64_t offset, const void *buf, uint6 void gem_write(int fd, uint32_t handle, uint64_t offset, const void *buf, uint64_t length); int __gem_read(int fd, uint32_t handle, uint64_t offset, void *buf, uint64_t length); void gem_read(int fd, uint32_t handle, uint64_t offset, void *buf, uint64_t length); +bool gem_has_pwrite(int fd); +bool gem_has_pread(int fd); +void gem_require_pread_pwrite(int fd); int __gem_set_domain(int fd, uint32_t handle, uint32_t read, uint32_t write); void gem_set_domain(int fd, uint32_t handle, uint32_t read, uint32_t write); int gem_wait(int fd, uint32_t handle, int64_t *timeout_ns); |