summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/ioctl_wrappers.c38
-rw-r--r--lib/ioctl_wrappers.h2
-rw-r--r--tests/gem_bad_reloc.c19
-rw-r--r--tests/gem_concurrent_all.c10
-rw-r--r--tests/gem_ctx_exec.c2
-rw-r--r--tests/gem_ctx_thrash.c6
-rw-r--r--tests/gem_mmap_gtt.c6
-rw-r--r--tests/gem_pwrite.c4
-rw-r--r--tests/kms_rotation_crc.c2
9 files changed, 39 insertions, 50 deletions
diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c
index 8c7e939d..a222e1b0 100644
--- a/lib/ioctl_wrappers.c
+++ b/lib/ioctl_wrappers.c
@@ -1226,25 +1226,6 @@ 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:
@@ -1300,6 +1281,25 @@ uint64_t gem_mappable_aperture_size(void)
return pci_dev->regions[bar].size;
}
+/**
+ * gem_global_aperture_size:
+ *
+ * Feature test macro to query the kernel for the global gpu aperture size.
+ * This is the area available for the kernel to perform address translations.
+ *
+ * Returns: The mappable gtt address space size.
+ */
+uint64_t gem_global_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_size;
+}
+
#define LOCAL_I915_PARAM_HAS_EXEC_SOFTPIN 37
/**
* gem_has_softpin:
diff --git a/lib/ioctl_wrappers.h b/lib/ioctl_wrappers.h
index 200b2dab..691dc013 100644
--- a/lib/ioctl_wrappers.h
+++ b/lib/ioctl_wrappers.h
@@ -143,8 +143,8 @@ 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);
bool gem_has_softpin(int fd);
diff --git a/tests/gem_bad_reloc.c b/tests/gem_bad_reloc.c
index a9146e27..9157d229 100644
--- a/tests/gem_bad_reloc.c
+++ b/tests/gem_bad_reloc.c
@@ -44,23 +44,6 @@ IGT_TEST_DESCRIPTION("Simulates SNA behaviour using negative self-relocations"
#define USE_LUT (1 << 12)
-static uint64_t get_page_table_size(int fd)
-{
- int val = gem_gtt_type(fd);
-
- switch (val) {
- case 0:
- case 1:
- return gem_aperture_size(fd);
- case 2:
- return 1ULL << 32;
- case 3:
- return 1ULL << 48;
- }
-
- return 0;
-}
-
/* Simulates SNA behaviour using negative self-relocations for
* STATE_BASE_ADDRESS command packets. If they wrap around (to values greater
* than the total size of the GTT), the GPU will hang.
@@ -71,7 +54,7 @@ static int negative_reloc(int fd, unsigned flags)
struct drm_i915_gem_execbuffer2 execbuf;
struct drm_i915_gem_exec_object2 gem_exec[2];
struct drm_i915_gem_relocation_entry gem_reloc[1000];
- uint64_t gtt_max = get_page_table_size(fd);
+ uint64_t gtt_max = gem_aperture_size(fd);
uint32_t buf[1024] = {MI_BATCH_BUFFER_END};
int i;
diff --git a/tests/gem_concurrent_all.c b/tests/gem_concurrent_all.c
index 74da42ca..5091b268 100644
--- a/tests/gem_concurrent_all.c
+++ b/tests/gem_concurrent_all.c
@@ -1489,6 +1489,16 @@ igt_main
}
igt_fixture {
+ num_buffers = gem_global_aperture_size(fd) / (1024 * 1024);
+ }
+
+ if (c->require()) {
+ snprintf(name, sizeof(name), "%s%s", c->name, "global");
+ for (i = 0; i < ARRAY_SIZE(access_modes); i++)
+ run_modes(name, &access_modes[i], CHECK_RAM);
+ }
+
+ igt_fixture {
num_buffers = gem_aperture_size(fd) / (1024 * 1024);
}
diff --git a/tests/gem_ctx_exec.c b/tests/gem_ctx_exec.c
index 0ba10bd6..93f5b971 100644
--- a/tests/gem_ctx_exec.c
+++ b/tests/gem_ctx_exec.c
@@ -86,7 +86,7 @@ static void big_exec(int fd, uint32_t handle, int ring)
struct drm_i915_gem_execbuffer2 execbuf;
struct drm_i915_gem_exec_object2 *gem_exec;
uint32_t ctx_id1, ctx_id2;
- int num_buffers = gem_available_aperture_size(fd) / 4096;
+ int num_buffers = gem_global_aperture_size(fd) / 4096;
int i;
/* Make sure we only fill half of RAM with gem objects. */
diff --git a/tests/gem_ctx_thrash.c b/tests/gem_ctx_thrash.c
index 129cf457..46b41ced 100644
--- a/tests/gem_ctx_thrash.c
+++ b/tests/gem_ctx_thrash.c
@@ -48,11 +48,7 @@ static unsigned get_num_contexts(int fd)
unsigned count;
/* Compute the number of contexts we can allocate to fill the GGTT */
- if (intel_gen(intel_get_drm_devid(fd)) >= 8)
- ggtt_size = 1ull << 32;
- else
- ggtt_size = 1ull << 31;
-
+ ggtt_size = gem_global_aperture_size(fd);
size = 64 << 10; /* Most gen require at least 64k for ctx */
count = 3 * (ggtt_size / size) / 2;
diff --git a/tests/gem_mmap_gtt.c b/tests/gem_mmap_gtt.c
index 292216ce..984ad723 100644
--- a/tests/gem_mmap_gtt.c
+++ b/tests/gem_mmap_gtt.c
@@ -317,14 +317,14 @@ test_huge_bo(int fd, int huge, int tiling)
*/
if (tiling &&
intel_gen(intel_get_drm_devid(fd)) < 4 &&
- size >= gem_aperture_size(fd) / 2)
+ size >= gem_global_aperture_size(fd) / 2)
size /= 2;
break;
case 0:
size = gem_mappable_aperture_size() + PAGE_SIZE;
break;
default:
- size = gem_aperture_size(fd) + PAGE_SIZE;
+ size = gem_global_aperture_size(fd) + PAGE_SIZE;
break;
}
intel_require_memory(1, size, CHECK_RAM);
@@ -395,7 +395,7 @@ test_huge_copy(int fd, int huge, int tiling_a, int tiling_b)
huge_object_size = gem_mappable_aperture_size() + PAGE_SIZE;
break;
default:
- huge_object_size = gem_aperture_size(fd) + PAGE_SIZE;
+ huge_object_size = gem_global_aperture_size(fd) + PAGE_SIZE;
break;
}
intel_require_memory(2, huge_object_size, CHECK_RAM);
diff --git a/tests/gem_pwrite.c b/tests/gem_pwrite.c
index cbb7b032..42206d7b 100644
--- a/tests/gem_pwrite.c
+++ b/tests/gem_pwrite.c
@@ -84,7 +84,7 @@ static void test_big_cpu(int fd, int scale)
uint64_t offset, size;
uint32_t handle;
- size = scale * gem_aperture_size(fd) >> 2;
+ size = scale * gem_global_aperture_size(fd) >> 2;
intel_require_memory(1, size, CHECK_RAM);
igt_require(gem_mmap__has_wc(fd));
@@ -110,7 +110,7 @@ static void test_big_gtt(int fd, int scale)
uint64_t *ptr;
uint32_t handle;
- size = scale * gem_aperture_size(fd) >> 2;
+ size = scale * gem_global_aperture_size(fd) >> 2;
intel_require_memory(1, size, CHECK_RAM);
igt_require(gem_mmap__has_wc(fd));
diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index f94f8f12..730371e8 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_available_aperture_size(fd);
+ total_aperture_size = gem_global_aperture_size(fd);
igt_require(total_fbs_size < total_aperture_size * 0.9);
igt_plane_set_fb(plane, NULL);