summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2016-01-25 13:51:00 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2016-01-25 14:03:56 +0000
commit0e2071411a4d4e1488a821daf522dffde2809e03 (patch)
tree69e0012c39d0045a771f1ac832ff01fe83ad0314
parentbeb936f1888d3dcd18907097dfac09ef639036ab (diff)
Promote eviction memory sizes and buffer counts to uint64_t
References: https://bugs.freedesktop.org/show_bug.cgi?id=93849 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--tests/eviction_common.c46
-rw-r--r--tests/gem_evict_alignment.c5
-rw-r--r--tests/gem_evict_everything.c9
-rw-r--r--tests/gem_userptr_blits.c6
4 files changed, 35 insertions, 31 deletions
diff --git a/tests/eviction_common.c b/tests/eviction_common.c
index 6c1f17d3..f029530b 100644
--- a/tests/eviction_common.c
+++ b/tests/eviction_common.c
@@ -31,14 +31,13 @@
#include <stdlib.h>
-struct igt_eviction_test_ops
-{
+struct igt_eviction_test_ops {
uint32_t (*create)(int fd, uint64_t size);
void (*flink)(uint32_t old_handle, uint32_t new_handle);
void (*close)(int fd, uint32_t bo);
int (*copy)(int fd, uint32_t dst, uint32_t src,
uint32_t *all_bo, int nr_bos);
- void (*clear)(int fd, uint32_t bo, int size);
+ void (*clear)(int fd, uint32_t bo, uint64_t size);
};
#define FORKING_EVICTIONS_INTERRUPTIBLE (1 << 0)
@@ -58,11 +57,12 @@ static void exchange_uint32_t(void *array, unsigned i, unsigned j)
}
static int minor_evictions(int fd, struct igt_eviction_test_ops *ops,
- int surface_size, int nr_surfaces)
+ uint64_t surface_size,
+ uint64_t nr_surfaces)
{
uint32_t *bo, *sel;
- int n, m, pass, fail;
- int total_surfaces;
+ uint64_t n, m, total_surfaces;
+ int pass, fail;
/* Make sure nr_surfaces is not divisible by seven
* to avoid duplicates in the selection loop below.
@@ -102,11 +102,11 @@ static int minor_evictions(int fd, struct igt_eviction_test_ops *ops,
}
static int major_evictions(int fd, struct igt_eviction_test_ops *ops,
- int surface_size, int nr_surfaces)
+ uint64_t surface_size, uint64_t nr_surfaces)
{
- int n, m, loop;
+ uint64_t n, m;
uint32_t *bo;
- int ret;
+ int ret, loop;
intel_require_memory(nr_surfaces, surface_size, CHECK_RAM);
@@ -130,8 +130,8 @@ static int major_evictions(int fd, struct igt_eviction_test_ops *ops,
}
static void mlocked_evictions(int fd, struct igt_eviction_test_ops *ops,
- int surface_size,
- int surface_count)
+ uint64_t surface_size,
+ uint64_t surface_count)
{
size_t sz, pin;
void *locked;
@@ -159,7 +159,8 @@ static void mlocked_evictions(int fd, struct igt_eviction_test_ops *ops,
igt_fork(child, 1) {
uint32_t *bo;
- int n, ret;
+ uint64_t n;
+ int ret;
bo = malloc(surface_count*sizeof(*bo));
igt_assert(bo);
@@ -195,12 +196,13 @@ static void mlocked_evictions(int fd, struct igt_eviction_test_ops *ops,
}
static int swapping_evictions(int fd, struct igt_eviction_test_ops *ops,
- int surface_size,
- int working_surfaces,
- int trash_surfaces)
+ uint64_t surface_size,
+ uint64_t working_surfaces,
+ uint64_t trash_surfaces)
{
uint32_t *bo;
- int i, n, pass, ret;
+ uint64_t i, n;
+ int pass, ret;
intel_require_memory(working_surfaces, surface_size, CHECK_RAM);
@@ -232,13 +234,15 @@ static int swapping_evictions(int fd, struct igt_eviction_test_ops *ops,
}
static int forking_evictions(int fd, struct igt_eviction_test_ops *ops,
- int surface_size, int working_surfaces,
- int trash_surfaces, unsigned flags)
+ uint64_t surface_size,
+ uint64_t working_surfaces,
+ uint64_t trash_surfaces,
+ unsigned flags)
{
+ const int num_threads = sysconf(_SC_NPROCESSORS_ONLN);
+ uint64_t bo_count, n, l;
uint32_t *bo;
- int n, pass, l, ret;
- int num_threads = sysconf(_SC_NPROCESSORS_ONLN);
- int bo_count;
+ int pass, ret;
intel_require_memory(working_surfaces, surface_size, CHECK_RAM);
diff --git a/tests/gem_evict_alignment.c b/tests/gem_evict_alignment.c
index 14b86162..6fa70f0c 100644
--- a/tests/gem_evict_alignment.c
+++ b/tests/gem_evict_alignment.c
@@ -185,11 +185,10 @@ static void major_evictions(int fd, int size, int count)
free(bo);
}
-int fd;
-
igt_main
{
- int size, count;
+ uint64_t size, count;
+ int fd = -1;
igt_fixture {
fd = drm_open_driver(DRIVER_INTEL);
diff --git a/tests/gem_evict_everything.c b/tests/gem_evict_everything.c
index db6c333b..2e7b33ae 100644
--- a/tests/gem_evict_everything.c
+++ b/tests/gem_evict_everything.c
@@ -130,10 +130,9 @@ copy(int fd, uint32_t dst, uint32_t src, uint32_t *all_bo, int n_bo)
return ret;
}
-static void clear(int fd, uint32_t handle, int size)
+static void clear(int fd, uint32_t handle, uint64_t size)
{
- void *base = gem_mmap__cpu(fd, handle, 0, size, PROT_READ | PROT_WRITE);
-
+ void *base = gem_mmap__cpu(fd, handle, 0, size, PROT_WRITE);
memset(base, 0, size);
munmap(base, size);
}
@@ -183,7 +182,9 @@ static void test_major_evictions(int fd, int size, int count)
igt_main
{
- int size, count, fd;
+ uint64_t size, count;
+ int fd;
+
size = count = 0;
fd = -1;
diff --git a/tests/gem_userptr_blits.c b/tests/gem_userptr_blits.c
index 0e3a0ba4..0972ac9f 100644
--- a/tests/gem_userptr_blits.c
+++ b/tests/gem_userptr_blits.c
@@ -388,7 +388,7 @@ static void flink_userptr_bo(uint32_t old_handle, uint32_t new_handle)
handle_size_map[old_handle]);
}
-static void clear(int fd, uint32_t handle, int size)
+static void clear(int fd, uint32_t handle, uint64_t size)
{
void *ptr = get_handle_ptr(handle);
@@ -1344,7 +1344,7 @@ static void test_invalidate_close_race(int fd, bool overlap)
free(t_data.ptr);
}
-unsigned int total_ram;
+uint64_t total_ram;
uint64_t aperture_size;
int fd, count;
@@ -1376,7 +1376,7 @@ int main(int argc, char **argv)
count = 2 * aperture_size / (1024*1024) / 3;
total_ram = intel_get_total_ram_mb();
- igt_info("Total RAM is %u MiB\n", total_ram);
+ igt_info("Total RAM is %'llu MiB\n", (long long)total_ram);
if (count > total_ram * 3 / 4) {
count = intel_get_total_ram_mb() * 3 / 4;