mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-07 16:06:25 +00:00
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>
This commit is contained in:
parent
beb936f188
commit
0e2071411a
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user