mirror of
				https://github.com/tiagovignatti/intel-gpu-tools.git
				synced 2025-11-04 03:58:27 +00:00 
			
		
		
		
	igt/gem_fence_thrash: Reduce memory usage
On android platforms with 1Gb RAM gem_fence_thrash was failing with an out of memory error. This patch causes gem_close() to be called when a handle is no longer required rather than relying on the cleanup when the fd is closed. This greatly improves the memory footprint of the test allowing it to run on 1Mb systems. Also fixed a leak of the 'threads' variable. v2: Simplified as per Chris Wilson's suggestion. Signed-off-by: Derek Morton <derek.j.morton@intel.com> [ickle: fix mmap leak from bo_copy()] Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
		
							parent
							
								
									154192a680
								
							
						
					
					
						commit
						471ebbed53
					
				@ -62,8 +62,8 @@ struct test {
 | 
			
		||||
static void *
 | 
			
		||||
bo_create (int fd, int tiling)
 | 
			
		||||
{
 | 
			
		||||
	uint32_t handle;
 | 
			
		||||
	void *ptr;
 | 
			
		||||
	int handle;
 | 
			
		||||
 | 
			
		||||
	handle = gem_create(fd, OBJECT_SIZE);
 | 
			
		||||
 | 
			
		||||
@ -78,8 +78,8 @@ bo_create (int fd, int tiling)
 | 
			
		||||
	ptr = gem_mmap(fd, handle, OBJECT_SIZE, PROT_READ | PROT_WRITE);
 | 
			
		||||
	igt_assert(ptr);
 | 
			
		||||
 | 
			
		||||
	/* XXX: mmap_gtt pulls the bo into the GTT read domain. */
 | 
			
		||||
	gem_sync(fd, handle);
 | 
			
		||||
	gem_set_domain(fd, handle, I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);
 | 
			
		||||
	gem_close(fd, handle);
 | 
			
		||||
 | 
			
		||||
	return ptr;
 | 
			
		||||
}
 | 
			
		||||
@ -100,6 +100,9 @@ bo_copy (void *_arg)
 | 
			
		||||
		sched_yield ();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	munmap(a, OBJECT_SIZE);
 | 
			
		||||
	munmap(b, OBJECT_SIZE);
 | 
			
		||||
 | 
			
		||||
	return NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -188,6 +191,8 @@ static int run_test(int threads_per_fence, void *f, int tiling,
 | 
			
		||||
 | 
			
		||||
		for (n = 0; n < num_threads; n++)
 | 
			
		||||
			pthread_join (threads[n], NULL);
 | 
			
		||||
 | 
			
		||||
		free(threads);
 | 
			
		||||
	} else {
 | 
			
		||||
		void *(*func)(void *) = f;
 | 
			
		||||
		igt_assert(func(&t) == (void *)0);
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user