From ad5eb02eb3f10a41d0f1feba7efc02db87cd06b8 Mon Sep 17 00:00:00 2001 From: Ashutosh Dixit Date: Mon, 15 Mar 2021 15:53:56 -0700 Subject: lib/ioctl_wrappers: Keep IGT working without pread/pwrite ioctls MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Acked-by: Tvrtko Ursulin Reviewed-by: Zbigniew KempczyƄski Signed-off-by: Ashutosh Dixit --- tests/i915/gem_pwrite.c | 1 + 1 file changed, 1 insertion(+) (limited to 'tests/i915/gem_pwrite.c') diff --git a/tests/i915/gem_pwrite.c b/tests/i915/gem_pwrite.c index 98bec558..5fd15e6a 100644 --- a/tests/i915/gem_pwrite.c +++ b/tests/i915/gem_pwrite.c @@ -488,6 +488,7 @@ igt_main_args("s:", NULL, help_str, opt_handler, NULL) igt_fixture { fd = drm_open_driver(DRIVER_INTEL); + gem_require_pread_pwrite(fd); dst = gem_create(fd, object_size); src = malloc(object_size); -- cgit v1.2.3