mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2026-08-17 03:13:02 +00:00
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:
+14
-1
@@ -311,7 +311,7 @@ uint32_t gem_create(int fd, int size)
|
||||
return create.handle;
|
||||
}
|
||||
|
||||
void *gem_mmap(int fd, uint32_t handle, int size, int prot)
|
||||
void *gem_mmap__gtt(int fd, uint32_t handle, int size, int prot)
|
||||
{
|
||||
struct drm_i915_gem_mmap_gtt mmap_arg;
|
||||
void *ptr;
|
||||
@@ -327,6 +327,19 @@ void *gem_mmap(int fd, uint32_t handle, int size, int prot)
|
||||
return ptr;
|
||||
}
|
||||
|
||||
void *gem_mmap__cpu(int fd, uint32_t handle, int size, int prot)
|
||||
{
|
||||
struct drm_i915_gem_mmap mmap_arg;
|
||||
|
||||
mmap_arg.handle = handle;
|
||||
mmap_arg.offset = 0;
|
||||
mmap_arg.size = size;
|
||||
if (drmIoctl(fd, DRM_IOCTL_I915_GEM_MMAP, &mmap_arg))
|
||||
return NULL;
|
||||
|
||||
return (void *)(uintptr_t)mmap_arg.addr_ptr;
|
||||
}
|
||||
|
||||
uint64_t gem_aperture_size(int fd)
|
||||
{
|
||||
struct drm_i915_gem_get_aperture aperture;
|
||||
|
||||
+5
-1
@@ -52,7 +52,11 @@ void gem_set_domain(int fd, uint32_t handle,
|
||||
uint32_t read_domains, uint32_t write_domain);
|
||||
void gem_sync(int fd, uint32_t handle);
|
||||
uint32_t gem_create(int fd, int size);
|
||||
void *gem_mmap(int fd, uint32_t handle, int size, int prot);
|
||||
|
||||
void *gem_mmap__gtt(int fd, uint32_t handle, int size, int prot);
|
||||
void *gem_mmap__cpu(int fd, uint32_t handle, int size, int prot);
|
||||
#define gem_mmap gem_mmap__gtt
|
||||
|
||||
uint64_t gem_aperture_size(int fd);
|
||||
uint64_t gem_mappable_aperture_size(void);
|
||||
int gem_madvise(int fd, uint32_t handle, int state);
|
||||
|
||||
Reference in New Issue
Block a user