summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2016-02-18 10:35:10 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2016-02-18 10:36:45 +0000
commit16038908de5ef491c8c795ae48ed880de235c532 (patch)
tree260fe6525f04f490594d68ad7ebb4b9eea2bf103 /lib
parent391b32c3822993a6dd5874d2898b0c16b8eb9d03 (diff)
lib: Restore gem_available_aperture_size()
Missed an error whilst rebasing and trying to modify the previous patch to keep this function intact... Instead, I now have to add this patch to restore gem_available_aperture_size() and its one usage. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'lib')
-rw-r--r--lib/ioctl_wrappers.c19
-rw-r--r--lib/ioctl_wrappers.h1
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);