mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-10 09:26:10 +00:00
igt/gem_exec_whisper: Beware PIN_HIGH
Certain kernels/gen like to move execbuf around for relocations, disrupting our prewritten batches. Be more careful and try and keep the relocation/execobjects accurate. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
1430eb065f
commit
488dc3b1ac
@ -117,6 +117,8 @@ static void whisper(int fd, unsigned engine, unsigned flags)
|
||||
unsigned nengine;
|
||||
uint32_t batch[16];
|
||||
int i, n, pass, loc;
|
||||
unsigned int reloc_migrations = 0;
|
||||
unsigned int eb_migrations = 0;
|
||||
|
||||
nengine = 0;
|
||||
if (engine == -1) {
|
||||
@ -212,6 +214,7 @@ static void whisper(int fd, unsigned engine, unsigned flags)
|
||||
|
||||
write_seqno(pass);
|
||||
|
||||
reloc.presumed_offset = scratch.offset;
|
||||
reloc.delta = 4*pass;
|
||||
offset = reloc.presumed_offset + reloc.delta;
|
||||
|
||||
@ -233,6 +236,8 @@ static void whisper(int fd, unsigned engine, unsigned flags)
|
||||
verify_reloc(fd, store.handle, &reloc);
|
||||
execbuf.buffers_ptr = (uintptr_t)tmp;
|
||||
gem_execbuf(fd, &execbuf);
|
||||
reloc_migrations += reloc.presumed_offset == -1;
|
||||
igt_assert_eq_u64(reloc.presumed_offset, tmp[0].offset);
|
||||
scratch = tmp[0];
|
||||
|
||||
gem_write(fd, batches[1023].handle, loc, &pass, sizeof(pass));
|
||||
@ -263,6 +268,8 @@ static void whisper(int fd, unsigned engine, unsigned flags)
|
||||
if (flags & CONTEXTS)
|
||||
execbuf.rsvd1 = contexts[rand() % 64];
|
||||
gem_execbuf(this_fd, &execbuf);
|
||||
reloc_migrations += inter[n].presumed_offset == -1;
|
||||
inter[n].presumed_offset = batches[n-1].offset;
|
||||
|
||||
batches[n-1].relocation_count = 1;
|
||||
batches[n-1].flags &= ~EXEC_OBJECT_WRITE;
|
||||
@ -282,21 +289,30 @@ static void whisper(int fd, unsigned engine, unsigned flags)
|
||||
tmp[0] = tmp[1];
|
||||
tmp[0].relocation_count = 0;
|
||||
tmp[0].flags = EXEC_OBJECT_WRITE;
|
||||
tmp[0].offset = inter[0].presumed_offset;
|
||||
tmp[1] = batches[0];
|
||||
verify_reloc(fd, batches[0].handle, &inter[0]);
|
||||
gem_execbuf(fd, &execbuf);
|
||||
reloc_migrations += inter[0].presumed_offset == -1;
|
||||
batches[0] = tmp[1];
|
||||
|
||||
tmp[1] = tmp[0];
|
||||
tmp[0] = scratch;
|
||||
igt_assert_eq_u64(reloc.presumed_offset, tmp[0].offset);
|
||||
igt_assert(tmp[1].relocs_ptr == (uintptr_t)&reloc);
|
||||
tmp[1].relocation_count = 1;
|
||||
tmp[1].flags &= ~EXEC_OBJECT_WRITE;
|
||||
verify_reloc(fd, store.handle, &reloc);
|
||||
gem_execbuf(fd, &execbuf);
|
||||
eb_migrations += tmp[0].offset != scratch.offset;
|
||||
eb_migrations += tmp[1].offset != store.offset;
|
||||
reloc_migrations += reloc.presumed_offset == -1;
|
||||
igt_assert_eq_u64(reloc.presumed_offset, tmp[0].offset);
|
||||
store = tmp[1];
|
||||
scratch = tmp[0];
|
||||
}
|
||||
igt_info("Number of migrations for execbuf: %d\n", eb_migrations);
|
||||
igt_info("Number of migrations for reloc: %d\n", reloc_migrations);
|
||||
|
||||
check_bo(fd, scratch.handle);
|
||||
gem_close(fd, scratch.handle);
|
||||
|
Loading…
x
Reference in New Issue
Block a user