[Intel-gfx] [PATCH] tests/gem_userptr_blits: Expanded userptr test cases

Chris Wilson chris at chris-wilson.co.uk
Wed Jan 29 15:56:26 CET 2014


Not your fault, just exposed under recent testing

On Wed, Jan 29, 2014 at 01:30:54PM +0000, Tvrtko Ursulin wrote:
> +int igt_minor_evictions(int fd, struct igt_eviction_test_ops *ops,
> +			int surface_size, int nr_surfaces)
> +{
> +	uint32_t *bo, *sel;
> +	int n, m, pass, fail;
> +
> +	igt_require((uint64_t)nr_surfaces * surface_size / (1024 * 1024)
> +			< intel_get_total_ram_mb() * 9 / 10);
> +
> +	bo = malloc(3*nr_surfaces*sizeof(*bo));
> +	igt_assert(bo);
> +
> +	for (n = 0; n < 2*nr_surfaces; n++)
> +		bo[n] = ops->create(fd, surface_size);
> +
> +	sel = bo + n;
> +	for (fail = 0, m = 0; fail < 10; fail++) {
> +		for (pass = 0; pass < 100; pass++) {
> +			for (n = 0; n < nr_surfaces; n++, m += 7)

The issue I found was that I had a nr_surface that was divisible by 7...

So we can either keep a table of prime numbers (may come in useful
elsewhere) and pick the prime closest to nr_surfaces, or we can just
tweak nr_surfaces not to be divisible by 7...

So something like:

/* Fudge to avoid duplicate bo during execbuffer */
nr_surfaces /= 7;
nr_surfaces *= 7;
nr_surfaces += 1;

should paper over the mistake.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre



More information about the Intel-gfx mailing list