From 6f7372f6644bed5b615d24bedc06fa84488e3c39 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Fri, 5 Feb 2016 15:55:40 +0000 Subject: igt/gem_exec_alignment: Fix off-by-one in buffer objects When reducing the buffer count to fit into the aperture whilst aligned, remember to adjust the pointer so that the batch is the last object! Signed-off-by: Chris Wilson --- tests/gem_exec_alignment.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tests/gem_exec_alignment.c') diff --git a/tests/gem_exec_alignment.c b/tests/gem_exec_alignment.c index 95494f74..4385297b 100644 --- a/tests/gem_exec_alignment.c +++ b/tests/gem_exec_alignment.c @@ -119,7 +119,7 @@ static void many(int fd) uint64_t factor = alignment / max_alignment; execbuf.buffer_count = 2*count / factor; execbuf.buffers_ptr = - (uintptr_t)(execobj + count - execbuf.buffer_count); + (uintptr_t)(execobj + count - execbuf.buffer_count + 1); } igt_debug("testing %lld x alignment=%#llx [%db]\n", @@ -127,7 +127,7 @@ static void many(int fd) (long long)alignment, find_last_bit(alignment)-1); gem_execbuf(fd, &execbuf); - for(i = count - execbuf.buffer_count; i < count; i++) { + for(i = count - execbuf.buffer_count + 1; i < count; i++) { igt_assert_eq_u64(execobj[i].alignment, alignment); igt_assert_eq_u64(execobj[i].offset % alignment, 0); } @@ -197,7 +197,7 @@ static void single(int fd) igt_main { - int fd; + int fd = -1; igt_fixture fd = drm_open_driver(DRIVER_INTEL); -- cgit v1.2.3