diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ioctl_wrappers.c | 19 | ||||
-rw-r--r-- | lib/ioctl_wrappers.h | 1 |
2 files changed, 20 insertions, 0 deletions
diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c index a222e1b0..de56e42d 100644 --- a/lib/ioctl_wrappers.c +++ b/lib/ioctl_wrappers.c @@ -1226,6 +1226,25 @@ bool gem_has_bsd2(int fd) has_bsd2 = gem_has_enable_ring(fd,LOCAL_I915_PARAM_HAS_BSD2); return has_bsd2; } +/** + * gem_available_aperture_size: + * @fd: open i915 drm file descriptor + * + * Feature test macro to query the kernel for the available gpu aperture size + * usable in a batchbuffer. + * + * Returns: The available gtt address space size. + */ +uint64_t gem_available_aperture_size(int fd) +{ + struct drm_i915_gem_get_aperture aperture; + + memset(&aperture, 0, sizeof(aperture)); + aperture.aper_size = 256*1024*1024; + do_ioctl(fd, DRM_IOCTL_I915_GEM_GET_APERTURE, &aperture); + + return aperture.aper_available_size; +} /** * gem_aperture_size: diff --git a/lib/ioctl_wrappers.h b/lib/ioctl_wrappers.h index 691dc013..4683ff5f 100644 --- a/lib/ioctl_wrappers.h +++ b/lib/ioctl_wrappers.h @@ -143,6 +143,7 @@ int gem_gtt_type(int fd); bool gem_uses_ppgtt(int fd); bool gem_uses_full_ppgtt(int fd); int gem_available_fences(int fd); +uint64_t gem_available_aperture_size(int fd); uint64_t gem_aperture_size(int fd); uint64_t gem_global_aperture_size(int fd); uint64_t gem_mappable_aperture_size(void); |