test/gem_gtt_speed: Add a baseline test for the performance of a CPU mmap

When looking at the pwrite/pread/wc performance, it is useful to judge
that against the performance of an ordinary CPU mmap.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
Chris Wilson
2012-06-04 17:29:20 +01:00
parent b558877f6e
commit 77586dcdf7
4 changed files with 94 additions and 21 deletions
+11 -11
View File
@@ -45,7 +45,7 @@
int main(int argc, char **argv)
{
int fd;
struct drm_i915_gem_mmap gem_mmap;
struct drm_i915_gem_mmap arg;
uint8_t expected[OBJECT_SIZE];
uint8_t buf[OBJECT_SIZE];
uint8_t *addr;
@@ -54,23 +54,23 @@ int main(int argc, char **argv)
fd = drm_open_any();
memset(&gem_mmap, 0, sizeof(gem_mmap));
gem_mmap.handle = 0x10101010;
gem_mmap.offset = 0;
gem_mmap.size = 4096;
memset(&arg, 0, sizeof(arg));
arg.handle = 0x10101010;
arg.offset = 0;
arg.size = 4096;
printf("Testing mmaping of bad object.\n");
ret = ioctl(fd, DRM_IOCTL_I915_GEM_MMAP, &gem_mmap);
ret = ioctl(fd, DRM_IOCTL_I915_GEM_MMAP, &arg);
assert(ret == -1 && errno == ENOENT);
handle = gem_create(fd, OBJECT_SIZE);
printf("Testing mmaping of newly created object.\n");
gem_mmap.handle = handle;
gem_mmap.offset = 0;
gem_mmap.size = OBJECT_SIZE;
ret = ioctl(fd, DRM_IOCTL_I915_GEM_MMAP, &gem_mmap);
arg.handle = handle;
arg.offset = 0;
arg.size = OBJECT_SIZE;
ret = ioctl(fd, DRM_IOCTL_I915_GEM_MMAP, &arg);
assert(ret == 0);
addr = (uint8_t *)(uintptr_t)gem_mmap.addr_ptr;
addr = (uint8_t *)(uintptr_t)arg.addr_ptr;
printf("Testing contents of newly created object.\n");
memset(expected, 0, sizeof(expected));