mirror of
				https://github.com/tiagovignatti/intel-gpu-tools.git
				synced 2025-11-03 19:47:15 +00:00 
			
		
		
		
	igt/gem_streaming_writes: Bind into the GTT early
If we are using a streaming GGTT write into the source, we need to trigger an early fault in order to obtain a mappable offset. This is required when later we start reserving execbuf object top-down to try and avoid mappable space! Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
		
							parent
							
								
									cd306d4e65
								
							
						
					
					
						commit
						40ebf95163
					
				@ -364,6 +364,24 @@ void igt_exit(void) __attribute__((noreturn));
 | 
				
			|||||||
				  "error: %#x " #ncmp " %#x\n", __n1, __n2); \
 | 
									  "error: %#x " #ncmp " %#x\n", __n1, __n2); \
 | 
				
			||||||
	} while (0)
 | 
						} while (0)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * igt_assert_cmpu64:
 | 
				
			||||||
 | 
					 * @n1: first value
 | 
				
			||||||
 | 
					 * @cmp: compare operator
 | 
				
			||||||
 | 
					 * @ncmp: negated version of @cmp
 | 
				
			||||||
 | 
					 * @n2: second value
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Like igt_assert_cmpuint(), but for larger ints.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					#define igt_assert_cmpu64(n1, cmp, ncmp, n2) \
 | 
				
			||||||
 | 
						do { \
 | 
				
			||||||
 | 
							uint64_t __n1 = (n1), __n2 = (n2); \
 | 
				
			||||||
 | 
							if (__n1 cmp __n2) ; else \
 | 
				
			||||||
 | 
							__igt_fail_assert(IGT_LOG_DOMAIN, __FILE__, __LINE__, __func__, \
 | 
				
			||||||
 | 
									  #n1 " " #cmp " " #n2, \
 | 
				
			||||||
 | 
									  "error: %#llx " #ncmp " %#llx\n", (long long)__n1, (long long)__n2); \
 | 
				
			||||||
 | 
						} while (0)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * igt_assert_cmpdouble:
 | 
					 * igt_assert_cmpdouble:
 | 
				
			||||||
 * @n1: first value
 | 
					 * @n1: first value
 | 
				
			||||||
@ -404,6 +422,15 @@ void igt_exit(void) __attribute__((noreturn));
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
#define igt_assert_eq_u32(n1, n2) igt_assert_cmpuint(n1, ==, !=, n2)
 | 
					#define igt_assert_eq_u32(n1, n2) igt_assert_cmpuint(n1, ==, !=, n2)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * igt_assert_eq_u64:
 | 
				
			||||||
 | 
					 * @n1: first integer
 | 
				
			||||||
 | 
					 * @n2: second integer
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Like igt_assert_eq_u32(), but for uint64_t.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					#define igt_assert_eq_u64(n1, n2) igt_assert_cmpu64(n1, ==, !=, n2)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * igt_assert_eq_double:
 | 
					 * igt_assert_eq_double:
 | 
				
			||||||
 * @n1: first double
 | 
					 * @n1: first double
 | 
				
			||||||
 | 
				
			|||||||
@ -103,6 +103,7 @@ static void test_streaming(int fd, int mode, int sync)
 | 
				
			|||||||
		break;
 | 
							break;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	igt_assert(s);
 | 
						igt_assert(s);
 | 
				
			||||||
 | 
						*s = 0; /* fault the object into the mappable range first (for GTT) */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	d = gem_mmap__cpu(fd, dst, 0, OBJECT_SIZE, PROT_READ);
 | 
						d = gem_mmap__cpu(fd, dst, 0, OBJECT_SIZE, PROT_READ);
 | 
				
			||||||
	igt_assert(d);
 | 
						igt_assert(d);
 | 
				
			||||||
@ -138,6 +139,9 @@ static void test_streaming(int fd, int mode, int sync)
 | 
				
			|||||||
		reloc[2*i+1].read_domains = I915_GEM_DOMAIN_RENDER;
 | 
							reloc[2*i+1].read_domains = I915_GEM_DOMAIN_RENDER;
 | 
				
			||||||
		reloc[2*i+1].write_domain = 0;
 | 
							reloc[2*i+1].write_domain = 0;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						igt_assert(__gem_execbuf(fd, &execbuf) == 0);
 | 
				
			||||||
 | 
						igt_assert_eq_u64(__src_offset, src_offset);
 | 
				
			||||||
 | 
						igt_assert_eq_u64(__dst_offset, dst_offset);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	exec[2].relocation_count = 2;
 | 
						exec[2].relocation_count = 2;
 | 
				
			||||||
	execbuf.buffer_count = 3;
 | 
						execbuf.buffer_count = 3;
 | 
				
			||||||
@ -212,8 +216,8 @@ static void test_streaming(int fd, int mode, int sync)
 | 
				
			|||||||
			execbuf.batch_start_offset = 64*n;
 | 
								execbuf.batch_start_offset = 64*n;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			gem_execbuf(fd, &execbuf);
 | 
								gem_execbuf(fd, &execbuf);
 | 
				
			||||||
			igt_assert(__src_offset == src_offset);
 | 
								igt_assert_eq_u64(__src_offset, src_offset);
 | 
				
			||||||
			igt_assert(__dst_offset == dst_offset);
 | 
								igt_assert_eq_u64(__dst_offset, dst_offset);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			batch[b].offset = exec[2].offset;
 | 
								batch[b].offset = exec[2].offset;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@ -292,6 +296,7 @@ static void test_batch(int fd, int mode, int reverse)
 | 
				
			|||||||
		break;
 | 
							break;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	igt_assert(base);
 | 
						igt_assert(base);
 | 
				
			||||||
 | 
						*base = 0; /* fault the object into the mappable range first */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	gem_write(fd, exec[2].handle, 0, tmp, sizeof(tmp));
 | 
						gem_write(fd, exec[2].handle, 0, tmp, sizeof(tmp));
 | 
				
			||||||
	memset(&execbuf, 0, sizeof(execbuf));
 | 
						memset(&execbuf, 0, sizeof(execbuf));
 | 
				
			||||||
@ -349,8 +354,8 @@ static void test_batch(int fd, int mode, int reverse)
 | 
				
			|||||||
			base[k++] = MI_BATCH_BUFFER_END;
 | 
								base[k++] = MI_BATCH_BUFFER_END;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			gem_execbuf(fd, &execbuf);
 | 
								gem_execbuf(fd, &execbuf);
 | 
				
			||||||
			igt_assert(__src_offset == src_offset);
 | 
								igt_assert_eq_u64(__src_offset, src_offset);
 | 
				
			||||||
			igt_assert(__dst_offset == dst_offset);
 | 
								igt_assert_eq_u64(__dst_offset, dst_offset);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		gem_set_domain(fd, dst, I915_GEM_DOMAIN_CPU, 0);
 | 
							gem_set_domain(fd, dst, I915_GEM_DOMAIN_CPU, 0);
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user