diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2016-02-18 10:35:10 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2016-02-18 10:36:45 +0000 |
commit | 16038908de5ef491c8c795ae48ed880de235c532 (patch) | |
tree | 260fe6525f04f490594d68ad7ebb4b9eea2bf103 | |
parent | 391b32c3822993a6dd5874d2898b0c16b8eb9d03 (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>
-rw-r--r-- | lib/ioctl_wrappers.c | 19 | ||||
-rw-r--r-- | lib/ioctl_wrappers.h | 1 | ||||
-rw-r--r-- | tests/kms_rotation_crc.c | 2 |
3 files changed, 21 insertions, 1 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); diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c index 730371e8..f94f8f12 100644 --- a/tests/kms_rotation_crc.c +++ b/tests/kms_rotation_crc.c @@ -418,7 +418,7 @@ static void test_plane_rotation_exhaust_fences(data_t *data, enum igt_plane plan * for creating (MAX_FENCES+1) framebuffers. */ total_fbs_size = size * (MAX_FENCES + 1); - total_aperture_size = gem_global_aperture_size(fd); + total_aperture_size = gem_available_aperture_size(fd); igt_require(total_fbs_size < total_aperture_size * 0.9); igt_plane_set_fb(plane, NULL); |