summaryrefslogtreecommitdiff
path: root/tests/i915/gem_userptr_blits.c
diff options
context:
space:
mode:
authorAshutosh Dixit <ashutosh.dixit@intel.com>2021-03-15 15:53:56 -0700
committerAshutosh Dixit <ashutosh.dixit@intel.com>2021-03-17 15:24:36 -0700
commitad5eb02eb3f10a41d0f1feba7efc02db87cd06b8 (patch)
tree95ddc30b5588748c68f6f81f6f01ef6617fd258b /tests/i915/gem_userptr_blits.c
parentb3eff02d5400944dd7b14896037bc9bbf362343e (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 'tests/i915/gem_userptr_blits.c')
-rw-r--r--tests/i915/gem_userptr_blits.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/tests/i915/gem_userptr_blits.c b/tests/i915/gem_userptr_blits.c
index 1bc2d360..7a80c016 100644
--- a/tests/i915/gem_userptr_blits.c
+++ b/tests/i915/gem_userptr_blits.c
@@ -1120,6 +1120,7 @@ static int test_forbidden_ops(int fd)
uint32_t handle;
void *ptr;
+ gem_require_pread_pwrite(fd);
igt_assert(posix_memalign(&ptr, PAGE_SIZE, PAGE_SIZE) == 0);
gem_userptr(fd, ptr, PAGE_SIZE, 0, userptr_flags, &handle);
@@ -1648,6 +1649,7 @@ static void test_readonly_pwrite(int i915)
*/
igt_require(igt_setup_clflush());
+ gem_require_pread_pwrite(i915);
sz = 16 << 12;
pages = mmap(NULL, sz, PROT_WRITE, MAP_ANON | MAP_PRIVATE, -1, 0);