From a22719358d8fc7d4261829847e1ace042575a723 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Wed, 14 Oct 2015 14:17:55 +0100 Subject: lib: Fix querying context GTT size We need a new ioctl to find the correct GTT size to use when submitting execbuffers (as opposed to wishing to know the global GTT size). Signed-off-by: Chris Wilson --- lib/ioctl_wrappers.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'lib/ioctl_wrappers.c') diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c index 36982a73..ce5cc2c0 100644 --- a/lib/ioctl_wrappers.c +++ b/lib/ioctl_wrappers.c @@ -1091,13 +1091,21 @@ uint64_t gem_aperture_size(int fd) static uint64_t aperture_size = 0; if (aperture_size == 0) { - struct drm_i915_gem_get_aperture aperture; + struct local_i915_gem_context_param p; + + memset(&p, 0, sizeof(p)); + p.param = 0x3; + if (ioctl(fd, LOCAL_IOCTL_I915_GEM_CONTEXT_GETPARAM, &p) == 0) { + aperture_size = p.value; + } else { + 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); + memset(&aperture, 0, sizeof(aperture)); + aperture.aper_size = 256*1024*1024; - aperture_size = aperture.aper_size; + do_ioctl(fd, DRM_IOCTL_I915_GEM_GET_APERTURE, &aperture); + aperture_size = aperture.aper_size; + } } return aperture_size; -- cgit v1.2.3