mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-10 17:36:11 +00:00
igt/gem_exec_lut_handle: Force slow relocation path
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
c317b788c0
commit
c4ec47b46d
@ -37,6 +37,7 @@
|
||||
#include <sys/time.h>
|
||||
#include "drm.h"
|
||||
#include "ioctl_wrappers.h"
|
||||
#include "igt_debugfs.h"
|
||||
#include "drmtest.h"
|
||||
|
||||
IGT_TEST_DESCRIPTION("Exercises the basic execbuffer using the handle LUT"
|
||||
@ -53,10 +54,11 @@ IGT_TEST_DESCRIPTION("Exercises the basic execbuffer using the handle LUT"
|
||||
#define SKIP_RELOC 0x1
|
||||
#define NO_RELOC 0x2
|
||||
#define CYCLE_BATCH 0x4
|
||||
#define FAULT 0x8
|
||||
|
||||
int target[MAX_NUM_RELOC];
|
||||
struct drm_i915_gem_exec_object2 gem_exec[MAX_NUM_EXEC+1];
|
||||
struct drm_i915_gem_relocation_entry gem_reloc[MAX_NUM_RELOC];
|
||||
struct drm_i915_gem_relocation_entry mem_reloc[MAX_NUM_RELOC];
|
||||
|
||||
static uint32_t state = 0x12345678;
|
||||
|
||||
@ -92,10 +94,14 @@ igt_simple_main
|
||||
} pass[] = {
|
||||
{ .name = "relocation", .flags = 0 },
|
||||
{ .name = "cycle-relocation", .flags = CYCLE_BATCH },
|
||||
{ .name = "fault-relocation", .flags = FAULT },
|
||||
{ .name = "skip-relocs", .flags = SKIP_RELOC },
|
||||
{ .name = "no-relocs", .flags = SKIP_RELOC | NO_RELOC },
|
||||
{ .name = NULL },
|
||||
}, *p;
|
||||
struct drm_i915_gem_relocation_entry *reloc;
|
||||
uint32_t reloc_handle;
|
||||
int size;
|
||||
|
||||
igt_skip_on_simulation();
|
||||
|
||||
@ -111,15 +117,26 @@ igt_simple_main
|
||||
}
|
||||
gem_exec[MAX_NUM_EXEC].handle = cycle[0];
|
||||
|
||||
memset(gem_reloc, 0, sizeof(gem_reloc));
|
||||
memset(mem_reloc, 0, sizeof(mem_reloc));
|
||||
for (n = 0; n < MAX_NUM_RELOC; n++) {
|
||||
gem_reloc[n].offset = 1024;
|
||||
gem_reloc[n].read_domains = I915_GEM_DOMAIN_RENDER;
|
||||
mem_reloc[n].offset = 1024;
|
||||
mem_reloc[n].read_domains = I915_GEM_DOMAIN_RENDER;
|
||||
}
|
||||
|
||||
size = ALIGN(sizeof(mem_reloc), 4096);
|
||||
reloc_handle = gem_create(fd, size);
|
||||
reloc = gem_mmap__cpu(fd, reloc_handle, 0, size, PROT_READ | PROT_WRITE);
|
||||
for (n = 0; n < MAX_NUM_RELOC; n++) {
|
||||
reloc[n].offset = 1024;
|
||||
reloc[n].read_domains = I915_GEM_DOMAIN_RENDER;
|
||||
}
|
||||
munmap(reloc, size);
|
||||
|
||||
igt_require(has_exec_lut(fd));
|
||||
|
||||
for (p = pass; p->name != NULL; p++) {
|
||||
if (p->flags & FAULT)
|
||||
igt_disable_prefault();
|
||||
for (n = 1; n <= MAX_NUM_EXEC; n *= 2) {
|
||||
double elapsed[16][2];
|
||||
double s_x, s_y, s_xx, s_xy;
|
||||
@ -131,8 +148,13 @@ igt_simple_main
|
||||
struct drm_i915_gem_exec_object2 *objects;
|
||||
struct timeval start, end;
|
||||
|
||||
if (p->flags & FAULT)
|
||||
reloc = gem_mmap__cpu(fd, reloc_handle, 0, size, PROT_READ | PROT_WRITE);
|
||||
else
|
||||
reloc = mem_reloc;
|
||||
|
||||
gem_exec[MAX_NUM_EXEC].relocation_count = m;
|
||||
gem_exec[MAX_NUM_EXEC].relocs_ptr = (uintptr_t)gem_reloc;
|
||||
gem_exec[MAX_NUM_EXEC].relocs_ptr = (uintptr_t)reloc;
|
||||
objects = gem_exec + MAX_NUM_EXEC - n;
|
||||
|
||||
memset(&execbuf, 0, sizeof(execbuf));
|
||||
@ -144,8 +166,8 @@ igt_simple_main
|
||||
|
||||
for (j = 0; j < m; j++) {
|
||||
target[j] = hars_petruska_f54_1_random() % n;
|
||||
gem_reloc[j].target_handle = target[j];
|
||||
gem_reloc[j].presumed_offset = 0;
|
||||
reloc[j].target_handle = target[j];
|
||||
reloc[j].presumed_offset = 0;
|
||||
}
|
||||
|
||||
gem_execbuf(fd,&execbuf);
|
||||
@ -153,12 +175,17 @@ igt_simple_main
|
||||
for (count = 0; count < 1000; count++) {
|
||||
if ((p->flags & SKIP_RELOC) == 0) {
|
||||
for (j = 0; j < m; j++)
|
||||
gem_reloc[j].presumed_offset = 0;
|
||||
reloc[j].presumed_offset = 0;
|
||||
if (p->flags & CYCLE_BATCH) {
|
||||
c = (c + 1) % 16;
|
||||
gem_exec[MAX_NUM_EXEC].handle = cycle[c];
|
||||
}
|
||||
}
|
||||
if (p->flags & FAULT) {
|
||||
munmap(reloc, size);
|
||||
reloc = gem_mmap__cpu(fd, reloc_handle, 0, size, PROT_READ | PROT_WRITE);
|
||||
gem_exec[MAX_NUM_EXEC].relocs_ptr = (uintptr_t)reloc;
|
||||
}
|
||||
gem_execbuf(fd, &execbuf);
|
||||
}
|
||||
gettimeofday(&end, NULL);
|
||||
@ -171,19 +198,24 @@ igt_simple_main
|
||||
|
||||
execbuf.flags &= ~LOCAL_I915_EXEC_HANDLE_LUT;
|
||||
for (j = 0; j < m; j++)
|
||||
gem_reloc[j].target_handle = objects[target[j]].handle;
|
||||
reloc[j].target_handle = objects[target[j]].handle;
|
||||
|
||||
gem_execbuf(fd,&execbuf);
|
||||
gettimeofday(&start, NULL);
|
||||
for (count = 0; count < 1000; count++) {
|
||||
if ((p->flags & SKIP_RELOC) == 0) {
|
||||
for (j = 0; j < m; j++)
|
||||
gem_reloc[j].presumed_offset = 0;
|
||||
reloc[j].presumed_offset = 0;
|
||||
if (p->flags & CYCLE_BATCH) {
|
||||
c = (c + 1) % 16;
|
||||
gem_exec[MAX_NUM_EXEC].handle = cycle[c];
|
||||
}
|
||||
}
|
||||
if (p->flags & FAULT) {
|
||||
munmap(reloc, size);
|
||||
reloc = gem_mmap__cpu(fd, reloc_handle, 0, size, PROT_READ | PROT_WRITE);
|
||||
gem_exec[MAX_NUM_EXEC].relocs_ptr = (uintptr_t)reloc;
|
||||
}
|
||||
gem_execbuf(fd, &execbuf);
|
||||
}
|
||||
gettimeofday(&end, NULL);
|
||||
@ -193,6 +225,9 @@ igt_simple_main
|
||||
while (c != 0);
|
||||
gem_exec[MAX_NUM_EXEC].handle = cycle[c];
|
||||
elapsed[i][0] = ELAPSED(&start, &end);
|
||||
|
||||
if (p->flags & FAULT)
|
||||
munmap(reloc, size);
|
||||
}
|
||||
|
||||
igt_info("%s: buffers=%4d:", p->name, n);
|
||||
@ -223,5 +258,7 @@ igt_simple_main
|
||||
|
||||
igt_info("\n");
|
||||
}
|
||||
if (p->flags & FAULT)
|
||||
igt_enable_prefault();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user