diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2015-10-14 14:17:55 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2015-10-19 11:33:01 +0100 |
commit | a22719358d8fc7d4261829847e1ace042575a723 (patch) | |
tree | 60a41f75fa826404afae2faa798992123252fa66 /lib/ioctl_wrappers.c | |
parent | cd99ddead3815aacaa483f27548a3f5e1a7d9353 (diff) |
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 <chris@chris-wilson.co.uk>
Diffstat (limited to 'lib/ioctl_wrappers.c')
-rw-r--r-- | lib/ioctl_wrappers.c | 18 |
1 files changed, 13 insertions, 5 deletions
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; |