[igt-dev] [CI i-g-t] lib/ioctl_wrappers: Handle PREAD/PWRITE ioctls not supported in gem_read/write
Ashutosh Dixit
ashutosh.dixit at intel.com
Sat Aug 29 01:53:32 UTC 2020
Trial patch to replace PREAD/PWRITE ioctls with mmap + memcpy in
gem_read/write. For CI only. Please don't review.
Signed-off-by: Ashutosh Dixit <ashutosh.dixit at intel.com>
---
lib/ioctl_wrappers.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c
index 3781286d8..6955a0a09 100644
--- a/lib/ioctl_wrappers.c
+++ b/lib/ioctl_wrappers.c
@@ -55,6 +55,7 @@
#include "igt_debugfs.h"
#include "igt_sysfs.h"
#include "config.h"
+#include "i915/gem_mman.h"
#ifdef HAVE_VALGRIND
#include <valgrind/valgrind.h>
@@ -353,7 +354,10 @@ 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)
{
- igt_assert_eq(__gem_write(fd, handle, offset, buf, length), 0);
+ void *ptr = gem_mmap__device_coherent(fd, handle, offset, length, PROT_WRITE);
+
+ memcpy(ptr, buf + offset, length);
+ munmap(ptr, length);
}
int __gem_read(int fd, uint32_t handle, uint64_t offset, void *buf, uint64_t length)
@@ -385,7 +389,10 @@ int __gem_read(int fd, uint32_t handle, uint64_t offset, void *buf, uint64_t len
*/
void gem_read(int fd, uint32_t handle, uint64_t offset, void *buf, uint64_t length)
{
- igt_assert_eq(__gem_read(fd, handle, offset, buf, length), 0);
+ void *ptr = gem_mmap__device_coherent(fd, handle, offset, length, PROT_READ);
+
+ memcpy(buf + offset, ptr, length);
+ munmap(ptr, length);
}
int __gem_set_domain(int fd, uint32_t handle, uint32_t read, uint32_t write)
--
2.26.2.108.g048abe1751
More information about the igt-dev
mailing list