mirror of
				https://github.com/tiagovignatti/intel-gpu-tools.git
				synced 2025-11-03 19:47:15 +00:00 
			
		
		
		
	tests: use igt_fail instead of exit(param != 0)
Mostly a sed job with too manual fixups: - one case of using _exit instead of exit - and one case which under some conditions use 77, so convert that check to an igt_skip. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
		
							parent
							
								
									b30d95f33c
								
							
						
					
					
						commit
						5e25fcc285
					
				@ -161,7 +161,7 @@ int main(int argc, char **argv)
 | 
			
		||||
				if (cpu_ptr[j] != val0) {
 | 
			
		||||
					printf("mismatch at %i, got: %i, expected: %i\n",
 | 
			
		||||
					       j, cpu_ptr[j], val0);
 | 
			
		||||
					exit(1);
 | 
			
		||||
					igt_fail(1);
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			drm_intel_bo_unmap(scratch_bo);
 | 
			
		||||
@ -199,21 +199,21 @@ int main(int argc, char **argv)
 | 
			
		||||
				if (gtt_ptr[j] != val0) {
 | 
			
		||||
					printf("mismatch at %i, partial=[%d+%d] got: %i, expected: %i\n",
 | 
			
		||||
					       j, start, len, gtt_ptr[j], val0);
 | 
			
		||||
					exit(1);
 | 
			
		||||
					igt_fail(1);
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			for (; j < start + len; j++) {
 | 
			
		||||
				if (gtt_ptr[j] != val1) {
 | 
			
		||||
					printf("mismatch at %i, partial=[%d+%d] got: %i, expected: %i\n",
 | 
			
		||||
					       j, start, len, gtt_ptr[j], val1);
 | 
			
		||||
					exit(1);
 | 
			
		||||
					igt_fail(1);
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			for (; j < BO_SIZE; j++) {
 | 
			
		||||
				if (gtt_ptr[j] != val0) {
 | 
			
		||||
					printf("mismatch at %i, partial=[%d+%d] got: %i, expected: %i\n",
 | 
			
		||||
					       j, start, len, gtt_ptr[j], val0);
 | 
			
		||||
					exit(1);
 | 
			
		||||
					igt_fail(1);
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			drm_intel_gem_bo_unmap_gtt(staging_bo);
 | 
			
		||||
@ -244,7 +244,7 @@ int main(int argc, char **argv)
 | 
			
		||||
				if (cpu_ptr[j] != val0) {
 | 
			
		||||
					printf("mismatch in read at %i, got: %i, expected: %i\n",
 | 
			
		||||
					       j, cpu_ptr[j], val0);
 | 
			
		||||
					exit(1);
 | 
			
		||||
					igt_fail(1);
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			drm_intel_bo_unmap(scratch_bo);
 | 
			
		||||
@ -271,21 +271,21 @@ int main(int argc, char **argv)
 | 
			
		||||
				if (gtt_ptr[j] != val1) {
 | 
			
		||||
					printf("mismatch at %i, partial=[%d+%d] got: %i, expected: %i\n",
 | 
			
		||||
					       j, start, len, gtt_ptr[j], val1);
 | 
			
		||||
					exit(1);
 | 
			
		||||
					igt_fail(1);
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			for (; j < start + len; j++) {
 | 
			
		||||
				if (gtt_ptr[j] != val2) {
 | 
			
		||||
					printf("mismatch at %i, partial=[%d+%d] got: %i, expected: %i\n",
 | 
			
		||||
					       j, start, len, gtt_ptr[j], val2);
 | 
			
		||||
					exit(1);
 | 
			
		||||
					igt_fail(1);
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			for (; j < BO_SIZE; j++) {
 | 
			
		||||
				if (gtt_ptr[j] != val1) {
 | 
			
		||||
					printf("mismatch at %i, partial=[%d+%d] got: %i, expected: %i\n",
 | 
			
		||||
					       j, start, len, gtt_ptr[j], val1);
 | 
			
		||||
					exit(1);
 | 
			
		||||
					igt_fail(1);
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			drm_intel_gem_bo_unmap_gtt(staging_bo);
 | 
			
		||||
 | 
			
		||||
@ -102,7 +102,7 @@ int main(int argc, char **argv)
 | 
			
		||||
	bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
 | 
			
		||||
	if (!bufmgr) {
 | 
			
		||||
		fprintf(stderr, "failed to init libdrm\n");
 | 
			
		||||
		exit(-1);
 | 
			
		||||
		igt_fail(-1);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	drm_intel_bufmgr_gem_enable_reuse(bufmgr);
 | 
			
		||||
 | 
			
		||||
@ -125,7 +125,7 @@ static void run_on_ring(int fd, unsigned ring_id, const char *ring_name)
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if (exec(fd, handle_new, split, >t_offset_new, 0))
 | 
			
		||||
			exit(1);
 | 
			
		||||
			igt_fail(1);
 | 
			
		||||
 | 
			
		||||
		if (split > 0) {
 | 
			
		||||
			/* Check that we've managed to collide in the tlb. */
 | 
			
		||||
 | 
			
		||||
@ -162,7 +162,7 @@ int main(int argc, char *argv[])
 | 
			
		||||
		ret = pthread_join(threads[i], &retval);
 | 
			
		||||
		thread_status = *(int *)retval;
 | 
			
		||||
		if (!ret && thread_status)
 | 
			
		||||
			exit(thread_status);
 | 
			
		||||
			igt_fail(thread_status);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	free(returns);
 | 
			
		||||
 | 
			
		||||
@ -101,7 +101,7 @@ int main(int argc, char **argv)
 | 
			
		||||
 | 
			
		||||
	if (argc != 1) {
 | 
			
		||||
		fprintf(stderr, "usage: %s\n", argv[0]);
 | 
			
		||||
		exit(-1);
 | 
			
		||||
		igt_fail(-1);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	fd = drm_open_any();
 | 
			
		||||
@ -114,26 +114,26 @@ int main(int argc, char **argv)
 | 
			
		||||
	bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
 | 
			
		||||
	if (!bufmgr) {
 | 
			
		||||
		fprintf(stderr, "failed to init libdrm\n");
 | 
			
		||||
		exit(-1);
 | 
			
		||||
		igt_fail(-1);
 | 
			
		||||
	}
 | 
			
		||||
	drm_intel_bufmgr_gem_enable_reuse(bufmgr);
 | 
			
		||||
 | 
			
		||||
	batch = intel_batchbuffer_alloc(bufmgr, devid);
 | 
			
		||||
	if (!batch) {
 | 
			
		||||
		fprintf(stderr, "failed to create batch buffer\n");
 | 
			
		||||
		exit(-1);
 | 
			
		||||
		igt_fail(-1);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	target_buffer = drm_intel_bo_alloc(bufmgr, "target bo", 4096, 4096);
 | 
			
		||||
	if (!target_buffer) {
 | 
			
		||||
		fprintf(stderr, "failed to alloc target buffer\n");
 | 
			
		||||
		exit(-1);
 | 
			
		||||
		igt_fail(-1);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	blt_bo = drm_intel_bo_alloc(bufmgr, "target bo", 4*4096*4096, 4096);
 | 
			
		||||
	if (!blt_bo) {
 | 
			
		||||
		fprintf(stderr, "failed to alloc blt buffer\n");
 | 
			
		||||
		exit(-1);
 | 
			
		||||
		igt_fail(-1);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	dummy_reloc_loop();
 | 
			
		||||
 | 
			
		||||
@ -143,20 +143,20 @@ int main(int argc, char **argv)
 | 
			
		||||
	bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
 | 
			
		||||
	if (!bufmgr) {
 | 
			
		||||
		fprintf(stderr, "failed to init libdrm\n");
 | 
			
		||||
		exit(-1);
 | 
			
		||||
		igt_fail(-1);
 | 
			
		||||
	}
 | 
			
		||||
	drm_intel_bufmgr_gem_enable_reuse(bufmgr);
 | 
			
		||||
 | 
			
		||||
	batch = intel_batchbuffer_alloc(bufmgr, devid);
 | 
			
		||||
	if (!batch) {
 | 
			
		||||
		fprintf(stderr, "failed to create batch buffer\n");
 | 
			
		||||
		exit(-1);
 | 
			
		||||
		igt_fail(-1);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	target_buffer = drm_intel_bo_alloc(bufmgr, "target bo", 4096, 4096);
 | 
			
		||||
	if (!target_buffer) {
 | 
			
		||||
		fprintf(stderr, "failed to alloc target buffer\n");
 | 
			
		||||
		exit(-1);
 | 
			
		||||
		igt_fail(-1);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	igt_subtest("render") {
 | 
			
		||||
 | 
			
		||||
@ -146,7 +146,7 @@ static void multi_write_domain(int fd)
 | 
			
		||||
 | 
			
		||||
	if (ret == 0 || errno != EINVAL) {
 | 
			
		||||
		fprintf(stderr, "multiple write domains not rejected\n");
 | 
			
		||||
		exit(1);
 | 
			
		||||
		igt_fail(1);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -173,7 +173,7 @@ int main(int argc, char **argv)
 | 
			
		||||
		ret = run_batch();
 | 
			
		||||
		if (ret != -EINVAL) {
 | 
			
		||||
			fprintf(stderr, "(cpu, 0) reloc not rejected\n");
 | 
			
		||||
			exit(1);
 | 
			
		||||
			igt_fail(1);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		BEGIN_BATCH(2);
 | 
			
		||||
@ -183,7 +183,7 @@ int main(int argc, char **argv)
 | 
			
		||||
		ret = run_batch();
 | 
			
		||||
		if (ret != -EINVAL) {
 | 
			
		||||
			fprintf(stderr, "(cpu, cpu) reloc not rejected\n");
 | 
			
		||||
			exit(1);
 | 
			
		||||
			igt_fail(1);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@ -195,7 +195,7 @@ int main(int argc, char **argv)
 | 
			
		||||
		ret = run_batch();
 | 
			
		||||
		if (ret != -EINVAL) {
 | 
			
		||||
			fprintf(stderr, "(gtt, 0) reloc not rejected\n");
 | 
			
		||||
			exit(1);
 | 
			
		||||
			igt_fail(1);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		BEGIN_BATCH(2);
 | 
			
		||||
@ -205,7 +205,7 @@ int main(int argc, char **argv)
 | 
			
		||||
		ret = run_batch();
 | 
			
		||||
		if (ret != -EINVAL) {
 | 
			
		||||
			fprintf(stderr, "(gtt, gtt) reloc not rejected\n");
 | 
			
		||||
			exit(1);
 | 
			
		||||
			igt_fail(1);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@ -223,7 +223,7 @@ int main(int argc, char **argv)
 | 
			
		||||
		ret = run_batch();
 | 
			
		||||
		if (ret != -EINVAL) {
 | 
			
		||||
			fprintf(stderr, "conflicting write domains not rejected\n");
 | 
			
		||||
			exit(1);
 | 
			
		||||
			igt_fail(1);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
#endif
 | 
			
		||||
@ -240,7 +240,7 @@ int main(int argc, char **argv)
 | 
			
		||||
		ret = run_batch();
 | 
			
		||||
		if (ret != -EINVAL) {
 | 
			
		||||
			fprintf(stderr, "invalid gpu read domains not rejected\n");
 | 
			
		||||
			exit(1);
 | 
			
		||||
			igt_fail(1);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		BEGIN_BATCH(2);
 | 
			
		||||
@ -251,7 +251,7 @@ int main(int argc, char **argv)
 | 
			
		||||
		ret = run_batch();
 | 
			
		||||
		if (ret != -EINVAL) {
 | 
			
		||||
			fprintf(stderr, "invalid gpu domain not rejected\n");
 | 
			
		||||
			exit(1);
 | 
			
		||||
			igt_fail(1);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -116,7 +116,7 @@ int main(int argc, char **argv)
 | 
			
		||||
 | 
			
		||||
		for (reloc_ofs = 4096; reloc_ofs < batch_size; reloc_ofs += 4096)
 | 
			
		||||
			if (exec(fd, handle, reloc_ofs))
 | 
			
		||||
				exit(1);
 | 
			
		||||
				igt_fail(1);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	gem_close(fd, handle);
 | 
			
		||||
 | 
			
		||||
@ -231,7 +231,7 @@ static void run(int object_size)
 | 
			
		||||
 | 
			
		||||
		gettimeofday(&start, NULL);
 | 
			
		||||
		if (gem_exec(fd, &execbuf, count))
 | 
			
		||||
			exit(1);
 | 
			
		||||
			igt_fail(1);
 | 
			
		||||
		gem_sync(fd, handle);
 | 
			
		||||
		gettimeofday(&end, NULL);
 | 
			
		||||
		printf("Time to blt %d bytes x %6d:	%7.3fµs, %s\n",
 | 
			
		||||
 | 
			
		||||
@ -97,7 +97,7 @@ static void loop(int fd, uint32_t handle, unsigned ring_id, const char *ring_nam
 | 
			
		||||
 | 
			
		||||
		gettimeofday(&start, NULL);
 | 
			
		||||
		if (exec(fd, handle, count, ring_id))
 | 
			
		||||
			exit(1);
 | 
			
		||||
			igt_fail(1);
 | 
			
		||||
		gettimeofday(&end, NULL);
 | 
			
		||||
		printf("Time to exec x %d:		%7.3fµs (ring=%s)\n",
 | 
			
		||||
		       count, elapsed(&start, &end, count), ring_name);
 | 
			
		||||
 | 
			
		||||
@ -132,7 +132,7 @@ _bo_write_verify(struct test *t)
 | 
			
		||||
			if (v != i) {
 | 
			
		||||
				printf("tiling %s: write failed at %d (%x)\n",
 | 
			
		||||
				       tile_str[t->tiling], i, v);
 | 
			
		||||
				_exit(-1);
 | 
			
		||||
				igt_fail(-1);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
@ -141,7 +141,7 @@ _bo_write_verify(struct test *t)
 | 
			
		||||
			if (v != i) {
 | 
			
		||||
				printf("tiling %s: verify failed at %d (%x)\n",
 | 
			
		||||
				       tile_str[t->tiling], i, v);
 | 
			
		||||
				exit(-2);
 | 
			
		||||
				igt_fail(-2);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@ -74,7 +74,7 @@ int main(int argc, char **argv)
 | 
			
		||||
	if (argc != 2) {
 | 
			
		||||
		fprintf(stderr, "usage: %s <disabled pipe number>\n",
 | 
			
		||||
			argv[0]);
 | 
			
		||||
		exit(-1);
 | 
			
		||||
		igt_fail(-1);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	bad_pipe = atoi(argv[1]);
 | 
			
		||||
 | 
			
		||||
@ -66,7 +66,7 @@ test_large_object(int fd)
 | 
			
		||||
	if (ret) {
 | 
			
		||||
		fprintf(stderr, "object creation failed: %s\n",
 | 
			
		||||
			strerror(errno));
 | 
			
		||||
		exit(ret);
 | 
			
		||||
		igt_fail(ret);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	pin.handle = create.handle;
 | 
			
		||||
@ -74,7 +74,7 @@ test_large_object(int fd)
 | 
			
		||||
	if (ret) {
 | 
			
		||||
		fprintf(stderr, "pin failed: %s\n",
 | 
			
		||||
			strerror(errno));
 | 
			
		||||
		exit(ret);
 | 
			
		||||
		igt_fail(ret);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	gem_write(fd, create.handle, 0, data, obj_size);
 | 
			
		||||
 | 
			
		||||
@ -83,7 +83,7 @@ int main(int argc, char **argv)
 | 
			
		||||
 | 
			
		||||
	if (argc != 1) {
 | 
			
		||||
		fprintf(stderr, "usage: %s\n", argv[0]);
 | 
			
		||||
		exit(-1);
 | 
			
		||||
		igt_fail(-1);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	fd = drm_open_any();
 | 
			
		||||
@ -101,14 +101,14 @@ int main(int argc, char **argv)
 | 
			
		||||
	bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
 | 
			
		||||
	if (!bufmgr) {
 | 
			
		||||
		fprintf(stderr, "failed to init libdrm\n");
 | 
			
		||||
		exit(-1);
 | 
			
		||||
		igt_fail(-1);
 | 
			
		||||
	}
 | 
			
		||||
	drm_intel_bufmgr_gem_enable_reuse(bufmgr);
 | 
			
		||||
 | 
			
		||||
	batch = intel_batchbuffer_alloc(bufmgr, devid);
 | 
			
		||||
	if (!batch) {
 | 
			
		||||
		fprintf(stderr, "failed to create batch buffer\n");
 | 
			
		||||
		exit(-1);
 | 
			
		||||
		igt_fail(-1);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	mi_lri_loop();
 | 
			
		||||
 | 
			
		||||
@ -123,7 +123,7 @@ static void test_partial_reads(void)
 | 
			
		||||
			if (tmp[j] != val) {
 | 
			
		||||
				printf("mismatch at %i, got: %i, expected: %i\n",
 | 
			
		||||
				       j, tmp[j], val);
 | 
			
		||||
				exit(1);
 | 
			
		||||
				igt_fail(1);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
@ -159,21 +159,21 @@ static void test_partial_writes(void)
 | 
			
		||||
			if (gtt_ptr[j] != val) {
 | 
			
		||||
				printf("mismatch at %i, got: %i, expected: %i\n",
 | 
			
		||||
				       j, tmp[j], val);
 | 
			
		||||
				exit(1);
 | 
			
		||||
				igt_fail(1);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		for (; j < start + len; j++) {
 | 
			
		||||
			if (gtt_ptr[j] != tmp[0]) {
 | 
			
		||||
				printf("mismatch at %i, got: %i, expected: %i\n",
 | 
			
		||||
				       j, tmp[j], i);
 | 
			
		||||
				exit(1);
 | 
			
		||||
				igt_fail(1);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		for (; j < BO_SIZE; j++) {
 | 
			
		||||
			if (gtt_ptr[j] != val) {
 | 
			
		||||
				printf("mismatch at %i, got: %i, expected: %i\n",
 | 
			
		||||
				       j, tmp[j], val);
 | 
			
		||||
				exit(1);
 | 
			
		||||
				igt_fail(1);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		drm_intel_gem_bo_unmap_gtt(staging_bo);
 | 
			
		||||
@ -204,7 +204,7 @@ static void test_partial_read_writes(void)
 | 
			
		||||
			if (tmp[j] != val) {
 | 
			
		||||
				printf("mismatch in read at %i, got: %i, expected: %i\n",
 | 
			
		||||
				       j, tmp[j], val);
 | 
			
		||||
				exit(1);
 | 
			
		||||
				igt_fail(1);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
@ -229,21 +229,21 @@ static void test_partial_read_writes(void)
 | 
			
		||||
			if (gtt_ptr[j] != val) {
 | 
			
		||||
				printf("mismatch at %i, got: %i, expected: %i\n",
 | 
			
		||||
				       j, tmp[j], val);
 | 
			
		||||
				exit(1);
 | 
			
		||||
				igt_fail(1);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		for (; j < start + len; j++) {
 | 
			
		||||
			if (gtt_ptr[j] != tmp[0]) {
 | 
			
		||||
				printf("mismatch at %i, got: %i, expected: %i\n",
 | 
			
		||||
				       j, tmp[j], tmp[0]);
 | 
			
		||||
				exit(1);
 | 
			
		||||
				igt_fail(1);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		for (; j < BO_SIZE; j++) {
 | 
			
		||||
			if (gtt_ptr[j] != val) {
 | 
			
		||||
				printf("mismatch at %i, got: %i, expected: %i\n",
 | 
			
		||||
				       j, tmp[j], val);
 | 
			
		||||
				exit(1);
 | 
			
		||||
				igt_fail(1);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		drm_intel_gem_bo_unmap_gtt(staging_bo);
 | 
			
		||||
 | 
			
		||||
@ -75,7 +75,7 @@ store_pipe_control_loop(void)
 | 
			
		||||
		target_bo = drm_intel_bo_alloc(bufmgr, "target bo", 4096, 4096);
 | 
			
		||||
		if (!target_bo) {
 | 
			
		||||
			fprintf(stderr, "failed to alloc target buffer\n");
 | 
			
		||||
			exit(-1);
 | 
			
		||||
			igt_fail(-1);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		/* gem_storedw_batches_loop.c is a bit overenthusiastic with
 | 
			
		||||
@ -122,7 +122,7 @@ store_pipe_control_loop(void)
 | 
			
		||||
			fprintf(stderr,
 | 
			
		||||
				"value mismatch: cur 0x%08x, stored 0x%08x\n",
 | 
			
		||||
				buf[0], val);
 | 
			
		||||
			exit(-1);
 | 
			
		||||
			igt_fail(-1);
 | 
			
		||||
		}
 | 
			
		||||
		buf[0] = 0; /* let batch write it again */
 | 
			
		||||
		drm_intel_bo_unmap(target_bo);
 | 
			
		||||
@ -141,7 +141,7 @@ int main(int argc, char **argv)
 | 
			
		||||
 | 
			
		||||
	if (argc != 1) {
 | 
			
		||||
		fprintf(stderr, "usage: %s\n", argv[0]);
 | 
			
		||||
		exit(-1);
 | 
			
		||||
		igt_fail(-1);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	fd = drm_open_any();
 | 
			
		||||
@ -150,7 +150,7 @@ int main(int argc, char **argv)
 | 
			
		||||
	bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
 | 
			
		||||
	if (!bufmgr) {
 | 
			
		||||
		fprintf(stderr, "failed to init libdrm\n");
 | 
			
		||||
		exit(-1);
 | 
			
		||||
		igt_fail(-1);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (IS_GEN2(devid) || IS_GEN3(devid)) {
 | 
			
		||||
@ -169,7 +169,7 @@ int main(int argc, char **argv)
 | 
			
		||||
	batch = intel_batchbuffer_alloc(bufmgr, devid);
 | 
			
		||||
	if (!batch) {
 | 
			
		||||
		fprintf(stderr, "failed to create batch buffer\n");
 | 
			
		||||
		exit(-1);
 | 
			
		||||
		igt_fail(-1);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	store_pipe_control_loop();
 | 
			
		||||
 | 
			
		||||
@ -71,8 +71,11 @@ int main(int argc, char *argv[])
 | 
			
		||||
	fd = drm_open_any();
 | 
			
		||||
 | 
			
		||||
	reg_read.offset = 0x2358;
 | 
			
		||||
	if (drmIoctl(fd, REG_READ_IOCTL, ®_read))
 | 
			
		||||
		exit(errno == EINVAL ? 77 : EXIT_FAILURE);
 | 
			
		||||
	if (drmIoctl(fd, REG_READ_IOCTL, ®_read)) {
 | 
			
		||||
		if (errno == EINVAL)
 | 
			
		||||
			igt_skip();
 | 
			
		||||
		igt_fail(1);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	reg_read.val = timer_query(fd);
 | 
			
		||||
	sleep(1);
 | 
			
		||||
 | 
			
		||||
@ -190,7 +190,7 @@ int main(int argc, char **argv)
 | 
			
		||||
		drm_intel_bo_get_subdata(pc_target_bo[i], 0, 4, &test);
 | 
			
		||||
		if (test != 0xdeadbeef) {
 | 
			
		||||
			fprintf(stderr, "mismatch in buffer %i: 0x%08x instead of 0xdeadbeef\n", i, test);
 | 
			
		||||
			exit(1);
 | 
			
		||||
			igt_fail(1);
 | 
			
		||||
		}
 | 
			
		||||
		drm_intel_bo_unreference(pc_target_bo[i]);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@ -97,7 +97,7 @@ int main(int argc, char **argv)
 | 
			
		||||
 | 
			
		||||
	if (argc != 1) {
 | 
			
		||||
		fprintf(stderr, "usage: %s\n", argv[0]);
 | 
			
		||||
		exit(-1);
 | 
			
		||||
		igt_fail(-1);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	fd = drm_open_any();
 | 
			
		||||
@ -111,20 +111,20 @@ int main(int argc, char **argv)
 | 
			
		||||
	bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
 | 
			
		||||
	if (!bufmgr) {
 | 
			
		||||
		fprintf(stderr, "failed to init libdrm\n");
 | 
			
		||||
		exit(-1);
 | 
			
		||||
		igt_fail(-1);
 | 
			
		||||
	}
 | 
			
		||||
	drm_intel_bufmgr_gem_enable_reuse(bufmgr);
 | 
			
		||||
 | 
			
		||||
	batch = intel_batchbuffer_alloc(bufmgr, devid);
 | 
			
		||||
	if (!batch) {
 | 
			
		||||
		fprintf(stderr, "failed to create batch buffer\n");
 | 
			
		||||
		exit(-1);
 | 
			
		||||
		igt_fail(-1);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	target_buffer = drm_intel_bo_alloc(bufmgr, "target bo", 4096, 4096);
 | 
			
		||||
	if (!target_buffer) {
 | 
			
		||||
		fprintf(stderr, "failed to alloc target buffer\n");
 | 
			
		||||
		exit(-1);
 | 
			
		||||
		igt_fail(-1);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	store_dword_loop(fd);
 | 
			
		||||
 | 
			
		||||
@ -556,7 +556,7 @@ static void print_usage(const char *s)
 | 
			
		||||
	printf("    -p --prewrap=n        set seqno to WRAP - n for each testrun\n");
 | 
			
		||||
	printf("    -r --norandom         dont randomize prewrap space\n");
 | 
			
		||||
	printf("    -i --buffers          number of buffers to copy\n");
 | 
			
		||||
	exit(-1);
 | 
			
		||||
	igt_fail(-1);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void parse_options(int argc, char **argv)
 | 
			
		||||
 | 
			
		||||
@ -63,7 +63,7 @@ store_dword_loop(int divider)
 | 
			
		||||
		cmd_bo = drm_intel_bo_alloc(bufmgr, "cmd bo", 4096, 4096);
 | 
			
		||||
		if (!cmd_bo) {
 | 
			
		||||
			fprintf(stderr, "failed to alloc cmd bo\n");
 | 
			
		||||
			exit(-1);
 | 
			
		||||
			igt_fail(-1);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		drm_intel_bo_map(cmd_bo, 1);
 | 
			
		||||
@ -77,7 +77,7 @@ store_dword_loop(int divider)
 | 
			
		||||
		ret = drm_intel_bo_references(cmd_bo, target_bo);
 | 
			
		||||
		if (ret) {
 | 
			
		||||
			fprintf(stderr, "failed to link cmd & target bos\n");
 | 
			
		||||
			exit(-1);
 | 
			
		||||
			igt_fail(-1);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		ret = drm_intel_bo_emit_reloc(cmd_bo, 8, target_bo, 0,
 | 
			
		||||
@ -85,7 +85,7 @@ store_dword_loop(int divider)
 | 
			
		||||
					      I915_GEM_DOMAIN_INSTRUCTION);
 | 
			
		||||
		if (ret) {
 | 
			
		||||
			fprintf(stderr, "failed to emit reloc\n");
 | 
			
		||||
			exit(-1);
 | 
			
		||||
			igt_fail(-1);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		buf[4] = MI_BATCH_BUFFER_END;
 | 
			
		||||
@ -96,13 +96,13 @@ store_dword_loop(int divider)
 | 
			
		||||
		ret = drm_intel_bo_references(cmd_bo, target_bo);
 | 
			
		||||
		if (ret != 1) {
 | 
			
		||||
			fprintf(stderr, "bad bo reference count: %d\n", ret);
 | 
			
		||||
			exit(-1);
 | 
			
		||||
			igt_fail(-1);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		ret = drm_intel_bo_exec(cmd_bo, 6 * 4, NULL, 0, 0);
 | 
			
		||||
		if (ret) {
 | 
			
		||||
			fprintf(stderr, "bo exec failed: %d\n", ret);
 | 
			
		||||
			exit(-1);
 | 
			
		||||
			igt_fail(-1);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if (i % divider != 0)
 | 
			
		||||
@ -117,7 +117,7 @@ store_dword_loop(int divider)
 | 
			
		||||
			fprintf(stderr,
 | 
			
		||||
				"value mismatch: cur 0x%08x, stored 0x%08x\n",
 | 
			
		||||
				buf[0], 0x42000000 | val);
 | 
			
		||||
			exit(-1);
 | 
			
		||||
			igt_fail(-1);
 | 
			
		||||
		}
 | 
			
		||||
		buf[0] = 0; /* let batch write it again */
 | 
			
		||||
		drm_intel_bo_unmap(target_bo);
 | 
			
		||||
@ -140,7 +140,7 @@ int main(int argc, char **argv)
 | 
			
		||||
 | 
			
		||||
	if (argc != 1) {
 | 
			
		||||
		fprintf(stderr, "usage: %s\n", argv[0]);
 | 
			
		||||
		exit(-1);
 | 
			
		||||
		igt_fail(-1);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	fd = drm_open_any();
 | 
			
		||||
@ -159,14 +159,14 @@ int main(int argc, char **argv)
 | 
			
		||||
	bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
 | 
			
		||||
	if (!bufmgr) {
 | 
			
		||||
		fprintf(stderr, "failed to init libdrm\n");
 | 
			
		||||
		exit(-1);
 | 
			
		||||
		igt_fail(-1);
 | 
			
		||||
	}
 | 
			
		||||
//	drm_intel_bufmgr_gem_enable_reuse(bufmgr);
 | 
			
		||||
 | 
			
		||||
	target_bo = drm_intel_bo_alloc(bufmgr, "target bo", 4096, 4096);
 | 
			
		||||
	if (!target_bo) {
 | 
			
		||||
		fprintf(stderr, "failed to alloc target buffer\n");
 | 
			
		||||
		exit(-1);
 | 
			
		||||
		igt_fail(-1);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	store_dword_loop(1);
 | 
			
		||||
 | 
			
		||||
@ -83,7 +83,7 @@ store_dword_loop(int divider)
 | 
			
		||||
			fprintf(stderr,
 | 
			
		||||
				"value mismatch: cur 0x%08x, stored 0x%08x\n",
 | 
			
		||||
				buf[0], val);
 | 
			
		||||
			exit(-1);
 | 
			
		||||
			igt_fail(-1);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		drm_intel_bo_unmap(target_buffer);
 | 
			
		||||
@ -107,7 +107,7 @@ int main(int argc, char **argv)
 | 
			
		||||
 | 
			
		||||
	if (argc != 1) {
 | 
			
		||||
		fprintf(stderr, "usage: %s\n", argv[0]);
 | 
			
		||||
		exit(-1);
 | 
			
		||||
		igt_fail(-1);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	fd = drm_open_any();
 | 
			
		||||
@ -131,20 +131,20 @@ int main(int argc, char **argv)
 | 
			
		||||
	bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
 | 
			
		||||
	if (!bufmgr) {
 | 
			
		||||
		fprintf(stderr, "failed to init libdrm\n");
 | 
			
		||||
		exit(-1);
 | 
			
		||||
		igt_fail(-1);
 | 
			
		||||
	}
 | 
			
		||||
	drm_intel_bufmgr_gem_enable_reuse(bufmgr);
 | 
			
		||||
 | 
			
		||||
	batch = intel_batchbuffer_alloc(bufmgr, devid);
 | 
			
		||||
	if (!batch) {
 | 
			
		||||
		fprintf(stderr, "failed to create batch buffer\n");
 | 
			
		||||
		exit(-1);
 | 
			
		||||
		igt_fail(-1);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	target_buffer = drm_intel_bo_alloc(bufmgr, "target bo", 4096, 4096);
 | 
			
		||||
	if (!target_buffer) {
 | 
			
		||||
		fprintf(stderr, "failed to alloc target buffer\n");
 | 
			
		||||
		exit(-1);
 | 
			
		||||
		igt_fail(-1);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	store_dword_loop(1);
 | 
			
		||||
 | 
			
		||||
@ -83,7 +83,7 @@ store_dword_loop(int divider)
 | 
			
		||||
			fprintf(stderr,
 | 
			
		||||
				"value mismatch: cur 0x%08x, stored 0x%08x\n",
 | 
			
		||||
				buf[0], val);
 | 
			
		||||
			exit(-1);
 | 
			
		||||
			igt_fail(-1);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		drm_intel_bo_unmap(target_buffer);
 | 
			
		||||
@ -107,7 +107,7 @@ int main(int argc, char **argv)
 | 
			
		||||
 | 
			
		||||
	if (argc != 1) {
 | 
			
		||||
		fprintf(stderr, "usage: %s\n", argv[0]);
 | 
			
		||||
		exit(-1);
 | 
			
		||||
		igt_fail(-1);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	fd = drm_open_any();
 | 
			
		||||
@ -137,20 +137,20 @@ int main(int argc, char **argv)
 | 
			
		||||
	bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
 | 
			
		||||
	if (!bufmgr) {
 | 
			
		||||
		fprintf(stderr, "failed to init libdrm\n");
 | 
			
		||||
		exit(-1);
 | 
			
		||||
		igt_fail(-1);
 | 
			
		||||
	}
 | 
			
		||||
	drm_intel_bufmgr_gem_enable_reuse(bufmgr);
 | 
			
		||||
 | 
			
		||||
	batch = intel_batchbuffer_alloc(bufmgr, devid);
 | 
			
		||||
	if (!batch) {
 | 
			
		||||
		fprintf(stderr, "failed to create batch buffer\n");
 | 
			
		||||
		exit(-1);
 | 
			
		||||
		igt_fail(-1);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	target_buffer = drm_intel_bo_alloc(bufmgr, "target bo", 4096, 4096);
 | 
			
		||||
	if (!target_buffer) {
 | 
			
		||||
		fprintf(stderr, "failed to alloc target buffer\n");
 | 
			
		||||
		exit(-1);
 | 
			
		||||
		igt_fail(-1);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	store_dword_loop(1);
 | 
			
		||||
 | 
			
		||||
@ -83,7 +83,7 @@ store_dword_loop(int divider)
 | 
			
		||||
			fprintf(stderr,
 | 
			
		||||
				"value mismatch: cur 0x%08x, stored 0x%08x\n",
 | 
			
		||||
				buf[0], val);
 | 
			
		||||
			exit(-1);
 | 
			
		||||
			igt_fail(-1);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		drm_intel_bo_unmap(target_buffer);
 | 
			
		||||
@ -107,7 +107,7 @@ int main(int argc, char **argv)
 | 
			
		||||
 | 
			
		||||
	if (argc != 1) {
 | 
			
		||||
		fprintf(stderr, "usage: %s\n", argv[0]);
 | 
			
		||||
		exit(-1);
 | 
			
		||||
		igt_fail(-1);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	fd = drm_open_any();
 | 
			
		||||
@ -125,20 +125,20 @@ int main(int argc, char **argv)
 | 
			
		||||
	bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
 | 
			
		||||
	if (!bufmgr) {
 | 
			
		||||
		fprintf(stderr, "failed to init libdrm\n");
 | 
			
		||||
		exit(-1);
 | 
			
		||||
		igt_fail(-1);
 | 
			
		||||
	}
 | 
			
		||||
	drm_intel_bufmgr_gem_enable_reuse(bufmgr);
 | 
			
		||||
 | 
			
		||||
	batch = intel_batchbuffer_alloc(bufmgr, devid);
 | 
			
		||||
	if (!batch) {
 | 
			
		||||
		fprintf(stderr, "failed to create batch buffer\n");
 | 
			
		||||
		exit(-1);
 | 
			
		||||
		igt_fail(-1);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	target_buffer = drm_intel_bo_alloc(bufmgr, "target bo", 4096, 4096);
 | 
			
		||||
	if (!target_buffer) {
 | 
			
		||||
		fprintf(stderr, "failed to alloc target buffer\n");
 | 
			
		||||
		exit(-1);
 | 
			
		||||
		igt_fail(-1);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	store_dword_loop(1);
 | 
			
		||||
 | 
			
		||||
@ -79,7 +79,7 @@ store_dword_loop(int divider)
 | 
			
		||||
			fprintf(stderr,
 | 
			
		||||
				"value mismatch: cur 0x%08x, stored 0x%08x\n",
 | 
			
		||||
				buf[0], val);
 | 
			
		||||
			exit(-1);
 | 
			
		||||
			igt_fail(-1);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		drm_intel_bo_unmap(target_buffer);
 | 
			
		||||
@ -109,20 +109,20 @@ int main(int argc, char **argv)
 | 
			
		||||
	bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
 | 
			
		||||
	if (!bufmgr) {
 | 
			
		||||
		fprintf(stderr, "failed to init libdrm\n");
 | 
			
		||||
		exit(-1);
 | 
			
		||||
		igt_fail(-1);
 | 
			
		||||
	}
 | 
			
		||||
	drm_intel_bufmgr_gem_enable_reuse(bufmgr);
 | 
			
		||||
 | 
			
		||||
	batch = intel_batchbuffer_alloc(bufmgr, intel_get_drm_devid(fd));
 | 
			
		||||
	if (!batch) {
 | 
			
		||||
		fprintf(stderr, "failed to create batch buffer\n");
 | 
			
		||||
		exit(-1);
 | 
			
		||||
		igt_fail(-1);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	target_buffer = drm_intel_bo_alloc(bufmgr, "target bo", 4096, 4096);
 | 
			
		||||
	if (!target_buffer) {
 | 
			
		||||
		fprintf(stderr, "failed to alloc target buffer\n");
 | 
			
		||||
		exit(-1);
 | 
			
		||||
		igt_fail(-1);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	store_dword_loop(1);
 | 
			
		||||
 | 
			
		||||
@ -209,7 +209,7 @@ static void cpucpy2d(uint32_t *src, unsigned src_stride, unsigned src_x, unsigne
 | 
			
		||||
			    printf("mismatch at tile %i pos %i, read %i, expected %i, diff %i\n",
 | 
			
		||||
				    logical_tile_no, i*options.tile_size + j, tmp, expect, (int) tmp - expect);
 | 
			
		||||
			    if (options.trace_tile >= 0 && options.fail)
 | 
			
		||||
				    exit(1);
 | 
			
		||||
				    igt_fail(1);
 | 
			
		||||
			    failed++;
 | 
			
		||||
			}
 | 
			
		||||
			/* when not aborting, correct any errors */
 | 
			
		||||
@ -217,7 +217,7 @@ static void cpucpy2d(uint32_t *src, unsigned src_stride, unsigned src_x, unsigne
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	if (failed && options.fail)
 | 
			
		||||
		exit(1);
 | 
			
		||||
		igt_fail(1);
 | 
			
		||||
 | 
			
		||||
	if (failed > stats.max_failed_reads)
 | 
			
		||||
		stats.max_failed_reads = failed;
 | 
			
		||||
 | 
			
		||||
@ -146,7 +146,7 @@ static void test_partial_reads(void)
 | 
			
		||||
			if (tmp[j] != val) {
 | 
			
		||||
				printf("mismatch at %i, got: %i, expected: %i\n",
 | 
			
		||||
				       start + j, tmp[j], val);
 | 
			
		||||
				exit(1);
 | 
			
		||||
				igt_fail(1);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
@ -180,21 +180,21 @@ static void test_partial_writes(void)
 | 
			
		||||
			if (compare_tmp[j] != val) {
 | 
			
		||||
				printf("amismatch at %i, got: %i, expected: %i\n",
 | 
			
		||||
				       j, tmp[j], val);
 | 
			
		||||
				exit(1);
 | 
			
		||||
				igt_fail(1);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		for (; j < start + len; j++) {
 | 
			
		||||
			if (compare_tmp[j] != tmp[0]) {
 | 
			
		||||
				printf("bmismatch at %i, got: %i, expected: %i\n",
 | 
			
		||||
				       j, tmp[j], i);
 | 
			
		||||
				exit(1);
 | 
			
		||||
				igt_fail(1);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		for (; j < BO_SIZE; j++) {
 | 
			
		||||
			if (compare_tmp[j] != val) {
 | 
			
		||||
				printf("cmismatch at %i, got: %i, expected: %i\n",
 | 
			
		||||
				       j, tmp[j], val);
 | 
			
		||||
				exit(1);
 | 
			
		||||
				igt_fail(1);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		drm_intel_gem_bo_unmap_gtt(staging_bo);
 | 
			
		||||
@ -223,7 +223,7 @@ static void test_partial_read_writes(void)
 | 
			
		||||
			if (tmp[j] != val) {
 | 
			
		||||
				printf("mismatch in read at %i, got: %i, expected: %i\n",
 | 
			
		||||
				       start + j, tmp[j], val);
 | 
			
		||||
				exit(1);
 | 
			
		||||
				igt_fail(1);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
@ -248,21 +248,21 @@ static void test_partial_read_writes(void)
 | 
			
		||||
			if (compare_tmp[j] != val) {
 | 
			
		||||
				printf("mismatch at %i, got: %i, expected: %i\n",
 | 
			
		||||
				       j, tmp[j], val);
 | 
			
		||||
				exit(1);
 | 
			
		||||
				igt_fail(1);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		for (; j < start + len; j++) {
 | 
			
		||||
			if (compare_tmp[j] != tmp[0]) {
 | 
			
		||||
				printf("mismatch at %i, got: %i, expected: %i\n",
 | 
			
		||||
				       j, tmp[j], tmp[0]);
 | 
			
		||||
				exit(1);
 | 
			
		||||
				igt_fail(1);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		for (; j < BO_SIZE; j++) {
 | 
			
		||||
			if (compare_tmp[j] != val) {
 | 
			
		||||
				printf("mismatch at %i, got: %i, expected: %i\n",
 | 
			
		||||
				       j, tmp[j], val);
 | 
			
		||||
				exit(1);
 | 
			
		||||
				igt_fail(1);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		drm_intel_gem_bo_unmap_gtt(staging_bo);
 | 
			
		||||
 | 
			
		||||
@ -142,7 +142,7 @@ main(int argc, char **argv)
 | 
			
		||||
			if (data[j] != j) {
 | 
			
		||||
				fprintf(stderr, "mismatch at %i: %i\n",
 | 
			
		||||
						j, data[j]);
 | 
			
		||||
				exit(1);
 | 
			
		||||
				igt_fail(1);
 | 
			
		||||
			}
 | 
			
		||||
		munmap(data, sizeof(linear));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -143,7 +143,7 @@ main(int argc, char **argv)
 | 
			
		||||
			if (data[j] != j) {
 | 
			
		||||
				fprintf(stderr, "mismatch at %i: %i\n",
 | 
			
		||||
						j, data[j]);
 | 
			
		||||
				exit(1);
 | 
			
		||||
				igt_fail(1);
 | 
			
		||||
			}
 | 
			
		||||
		munmap(data, LINEAR_DWORDS);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@ -62,7 +62,7 @@ int main(int argc, char **argv)
 | 
			
		||||
	bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
 | 
			
		||||
	if (!bufmgr) {
 | 
			
		||||
		fprintf(stderr, "failed to init libdrm\n");
 | 
			
		||||
		exit(-1);
 | 
			
		||||
		igt_fail(-1);
 | 
			
		||||
	}
 | 
			
		||||
	/* don't enable buffer reuse!! */
 | 
			
		||||
	//drm_intel_bufmgr_gem_enable_reuse(bufmgr);
 | 
			
		||||
@ -76,7 +76,7 @@ int main(int argc, char **argv)
 | 
			
		||||
		load_bo = drm_intel_bo_alloc(bufmgr, "target bo", 1024*4096, 4096);
 | 
			
		||||
		if (!load_bo) {
 | 
			
		||||
			fprintf(stderr, "failed to alloc target buffer\n");
 | 
			
		||||
			exit(-1);
 | 
			
		||||
			igt_fail(-1);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		BEGIN_BATCH(8);
 | 
			
		||||
 | 
			
		||||
@ -69,7 +69,7 @@ static void run_test(int ring, const char *testname)
 | 
			
		||||
	target_bo = drm_intel_bo_alloc(bufmgr, "target bo", 4096, 4096);
 | 
			
		||||
	if (!target_bo) {
 | 
			
		||||
		fprintf(stderr, "failed to alloc target buffer\n");
 | 
			
		||||
		exit(-1);
 | 
			
		||||
		igt_fail(-1);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* Need to map first so that we can do our own domain mangement with
 | 
			
		||||
@ -184,7 +184,7 @@ int main(int argc, char **argv)
 | 
			
		||||
	bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
 | 
			
		||||
	if (!bufmgr) {
 | 
			
		||||
		fprintf(stderr, "failed to init libdrm\n");
 | 
			
		||||
		exit(-1);
 | 
			
		||||
		igt_fail(-1);
 | 
			
		||||
	}
 | 
			
		||||
	/* don't enable buffer reuse!! */
 | 
			
		||||
	//drm_intel_bufmgr_gem_enable_reuse(bufmgr);
 | 
			
		||||
@ -195,13 +195,13 @@ int main(int argc, char **argv)
 | 
			
		||||
	dummy_bo = drm_intel_bo_alloc(bufmgr, "dummy bo", 4096, 4096);
 | 
			
		||||
	if (!dummy_bo) {
 | 
			
		||||
		fprintf(stderr, "failed to alloc dummy buffer\n");
 | 
			
		||||
		exit(-1);
 | 
			
		||||
		igt_fail(-1);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	load_bo = drm_intel_bo_alloc(bufmgr, "load bo", 1024*4096, 4096);
 | 
			
		||||
	if (!load_bo) {
 | 
			
		||||
		fprintf(stderr, "failed to alloc load buffer\n");
 | 
			
		||||
		exit(-1);
 | 
			
		||||
		igt_fail(-1);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	for (i = 0; i < ARRAY_SIZE(tests); i++) {
 | 
			
		||||
 | 
			
		||||
@ -397,7 +397,7 @@ static void check_state(struct test_output *o, struct event_state *es)
 | 
			
		||||
	    (diff.tv_sec > 0 || (diff.tv_sec == 0 && diff.tv_usec > 2000))) {
 | 
			
		||||
		fprintf(stderr, "%s ts delayed for too long: %is, %iusec\n",
 | 
			
		||||
			es->name, (int)diff.tv_sec, (int)diff.tv_usec);
 | 
			
		||||
		exit(5);
 | 
			
		||||
		igt_fail(5);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (es->count == 0)
 | 
			
		||||
@ -410,7 +410,7 @@ static void check_state(struct test_output *o, struct event_state *es)
 | 
			
		||||
		timersub(&es->current_ts, &es->last_received_ts, &diff);
 | 
			
		||||
		fprintf(stderr, "timerdiff %is, %ius\n",
 | 
			
		||||
			(int) diff.tv_sec, (int) diff.tv_usec);
 | 
			
		||||
		exit(6);
 | 
			
		||||
		igt_fail(6);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* This bounding matches the one in DRM_IOCTL_WAIT_VBLANK. */
 | 
			
		||||
@ -420,7 +420,7 @@ static void check_state(struct test_output *o, struct event_state *es)
 | 
			
		||||
		if (es->current_seq - (es->last_seq + es->seq_step) > 1UL << 23) {
 | 
			
		||||
			fprintf(stderr, "unexpected %s seq %u, should be >= %u\n",
 | 
			
		||||
				es->name, es->current_seq, es->last_seq + es->seq_step);
 | 
			
		||||
			exit(10);
 | 
			
		||||
			igt_fail(10);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@ -432,14 +432,14 @@ static void check_state(struct test_output *o, struct event_state *es)
 | 
			
		||||
			fprintf(stderr, "inter-%s ts jitter: %is, %ius\n",
 | 
			
		||||
				es->name,
 | 
			
		||||
				(int) diff.tv_sec, (int) diff.tv_usec);
 | 
			
		||||
			exit(9);
 | 
			
		||||
			igt_fail(9);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if (es->current_seq != es->last_seq + es->seq_step) {
 | 
			
		||||
			fprintf(stderr, "unexpected %s seq %u, expected %u\n",
 | 
			
		||||
					es->name, es->current_seq,
 | 
			
		||||
					es->last_seq + es->seq_step);
 | 
			
		||||
			exit(9);
 | 
			
		||||
			igt_fail(9);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@ -467,7 +467,7 @@ static void check_state_correlation(struct test_output *o,
 | 
			
		||||
		fprintf(stderr,
 | 
			
		||||
			"timestamp mismatch between %s and %s (diff %.4f sec)\n",
 | 
			
		||||
			es1->name, es2->name, usec_diff / 1000 / 1000);
 | 
			
		||||
		exit(14);
 | 
			
		||||
		igt_fail(14);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -613,7 +613,7 @@ static void eat_error_state(struct test_output *o)
 | 
			
		||||
 | 
			
		||||
	if (atoi(tmp) != 0) {
 | 
			
		||||
		fprintf(stderr, "no gpu hang detected, stop_rings is still %s\n", tmp);
 | 
			
		||||
		exit(20);
 | 
			
		||||
		igt_fail(20);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	close(fd);
 | 
			
		||||
@ -725,7 +725,7 @@ static unsigned int run_test_step(struct test_output *o)
 | 
			
		||||
				   &o->id, 1, &o->mode)) {
 | 
			
		||||
			fprintf(stderr, "failed to restore output mode: %s\n",
 | 
			
		||||
				strerror(errno));
 | 
			
		||||
			exit(7);
 | 
			
		||||
			igt_fail(7);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@ -772,7 +772,7 @@ static unsigned int run_test_step(struct test_output *o)
 | 
			
		||||
			fprintf(stderr, "failed to pan (%dx%d@%dHz): %s\n",
 | 
			
		||||
				o->fb_width, o->fb_height,
 | 
			
		||||
				o->mode.vrefresh, strerror(errno));
 | 
			
		||||
			exit(7);
 | 
			
		||||
			igt_fail(7);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@ -786,7 +786,7 @@ static unsigned int run_test_step(struct test_output *o)
 | 
			
		||||
				   NULL, 0, NULL)) {
 | 
			
		||||
			fprintf(stderr, "failed to disable output: %s\n",
 | 
			
		||||
				strerror(errno));
 | 
			
		||||
			exit(7);
 | 
			
		||||
			igt_fail(7);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@ -879,7 +879,7 @@ static void check_final_state(struct test_output *o, struct event_state *es,
 | 
			
		||||
{
 | 
			
		||||
	if (es->count == 0) {
 | 
			
		||||
		fprintf(stderr, "no %s event received\n", es->name);
 | 
			
		||||
		exit(12);
 | 
			
		||||
		igt_fail(12);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* Verify we drop no frames, but only if it's not a TV encoder, since
 | 
			
		||||
@ -893,7 +893,7 @@ static void check_final_state(struct test_output *o, struct event_state *es,
 | 
			
		||||
		if (count < expected * 99/100) {
 | 
			
		||||
			fprintf(stderr, "dropped frames, expected %d, counted %d, encoder type %d\n",
 | 
			
		||||
				expected, count, o->encoder->encoder_type);
 | 
			
		||||
			exit(3);
 | 
			
		||||
			igt_fail(3);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@ -931,10 +931,10 @@ static unsigned int wait_for_events(struct test_output *o)
 | 
			
		||||
	if (ret <= 0) {
 | 
			
		||||
		fprintf(stderr, "select timed out or error (ret %d)\n",
 | 
			
		||||
				ret);
 | 
			
		||||
		exit(1);
 | 
			
		||||
		igt_fail(1);
 | 
			
		||||
	} else if (FD_ISSET(0, &fds)) {
 | 
			
		||||
		fprintf(stderr, "no fds active, breaking\n");
 | 
			
		||||
		exit(2);
 | 
			
		||||
		igt_fail(2);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	do_or_die(drmHandleEvent(drm_fd, &evctx));
 | 
			
		||||
@ -1005,7 +1005,7 @@ static void run_test_on_crtc(struct test_output *o, int crtc_idx, int duration)
 | 
			
		||||
 | 
			
		||||
	if (!o->fb_ids[0] || !o->fb_ids[1] || !o->fb_ids[2]) {
 | 
			
		||||
		fprintf(stderr, "failed to create fbs\n");
 | 
			
		||||
		exit(3);
 | 
			
		||||
		igt_fail(3);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	paint_flip_mode(&o->fb_info[0], false);
 | 
			
		||||
@ -1035,7 +1035,7 @@ static void run_test_on_crtc(struct test_output *o, int crtc_idx, int duration)
 | 
			
		||||
 | 
			
		||||
	if (do_page_flip(o, o->fb_ids[1], true)) {
 | 
			
		||||
		fprintf(stderr, "failed to page flip: %s\n", strerror(errno));
 | 
			
		||||
		exit(4);
 | 
			
		||||
		igt_fail(4);
 | 
			
		||||
	}
 | 
			
		||||
	wait_for_events(o);
 | 
			
		||||
 | 
			
		||||
@ -1077,7 +1077,7 @@ static int run_test(int duration, int flags, const char *test_name)
 | 
			
		||||
	if (!resources) {
 | 
			
		||||
		fprintf(stderr, "drmModeGetResources failed: %s\n",
 | 
			
		||||
			strerror(errno));
 | 
			
		||||
		exit(5);
 | 
			
		||||
		igt_fail(5);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* Find any connected displays */
 | 
			
		||||
 | 
			
		||||
@ -571,7 +571,7 @@ int main(int argc, char **argv)
 | 
			
		||||
#define xtest(name) \
 | 
			
		||||
	igt_subtest(#name) \
 | 
			
		||||
		if (test_##name()) \
 | 
			
		||||
			exit(2);
 | 
			
		||||
			igt_fail(2);
 | 
			
		||||
 | 
			
		||||
	xtest(i915_nv_import_twice);
 | 
			
		||||
	xtest(i915_nv_import_twice_check_flink_name);
 | 
			
		||||
 | 
			
		||||
@ -506,7 +506,7 @@ int main(int argc, char **argv)
 | 
			
		||||
#define xtest(name) \
 | 
			
		||||
	igt_subtest(#name) \
 | 
			
		||||
		if (test_##name()) \
 | 
			
		||||
			exit(2);
 | 
			
		||||
			igt_fail(2);
 | 
			
		||||
 | 
			
		||||
	xtest(i915_nv_sharing);
 | 
			
		||||
	xtest(nv_i915_sharing);
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user