blob: f86dfcb5177d9d1a5a66f1c9a6f40bf4dc491dc2 [file] [log] [blame]
Chris Wilson5c810162016-09-08 19:06:54 +01001/*
2 * Copyright © 2016 Intel Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21 * IN THE SOFTWARE.
22 *
23 */
24
25#include "igt.h"
Chris Wilson5c810162016-09-08 19:06:54 +010026#include <unistd.h>
27#include <stdlib.h>
28#include <stdint.h>
29#include <stdio.h>
30#include <string.h>
31#include <fcntl.h>
32#include <inttypes.h>
33#include <errno.h>
34#include <sys/stat.h>
35#include <sys/ioctl.h>
36#include <sys/time.h>
Chris Wilsonef999ae2017-03-01 10:57:06 +000037#include <sys/signal.h>
Chris Wilson5c810162016-09-08 19:06:54 +010038#include <time.h>
Chris Wilsonc460b412017-01-15 21:13:43 +000039
Chris Wilson5c810162016-09-08 19:06:54 +010040#include "drm.h"
41
Chris Wilsonc460b412017-01-15 21:13:43 +000042#include "igt_sysfs.h"
43#include "igt_vgem.h"
44
Chris Wilson5c810162016-09-08 19:06:54 +010045#define LOCAL_I915_EXEC_NO_RELOC (1<<11)
46#define LOCAL_I915_EXEC_HANDLE_LUT (1<<12)
47
48#define LOCAL_I915_EXEC_BSD_SHIFT (13)
49#define LOCAL_I915_EXEC_BSD_MASK (3 << LOCAL_I915_EXEC_BSD_SHIFT)
50
51#define ENGINE_FLAGS (I915_EXEC_RING_MASK | LOCAL_I915_EXEC_BSD_MASK)
52
Chris Wilsonc460b412017-01-15 21:13:43 +000053#define CORK 1
54
Chris Wilsonef999ae2017-03-01 10:57:06 +000055static unsigned int ring_size;
56
Chris Wilsonc460b412017-01-15 21:13:43 +000057struct cork {
58 int device;
59 uint32_t handle;
60 uint32_t fence;
61};
62
63static void plug(int fd, struct cork *c)
64{
65 struct vgem_bo bo;
66 int dmabuf;
67
68 c->device = drm_open_driver(DRIVER_VGEM);
69
70 bo.width = bo.height = 1;
71 bo.bpp = 4;
72 vgem_create(c->device, &bo);
73 c->fence = vgem_fence_attach(c->device, &bo, VGEM_FENCE_WRITE);
74
75 dmabuf = prime_handle_to_fd(c->device, bo.handle);
76 c->handle = prime_fd_to_handle(fd, dmabuf);
77 close(dmabuf);
78}
79
80static void unplug(struct cork *c)
81{
82 vgem_fence_signal(c->device, c->fence);
83 close(c->device);
84}
85
Chris Wilsonef999ae2017-03-01 10:57:06 +000086static void alarm_handler(int sig)
87{
88}
89
90static void set_timeout(int seconds)
91{
92 struct sigaction sa = { .sa_handler = alarm_handler };
93
94 sigaction(SIGALRM, seconds ? &sa : NULL, NULL);
95 alarm(seconds);
96}
97
98static int __execbuf(int fd, struct drm_i915_gem_execbuffer2 *execbuf)
99{
100 return ioctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, execbuf);
101}
102
103static unsigned int measure_ring_size(int fd)
104{
105 struct drm_i915_gem_exec_object2 obj[2];
106 struct drm_i915_gem_execbuffer2 execbuf;
107 const uint32_t bbe = MI_BATCH_BUFFER_END;
108 unsigned int count;
109 struct cork c;
110
111 memset(obj, 0, sizeof(obj));
112 obj[1].handle = gem_create(fd, 4096);
113 gem_write(fd, obj[1].handle, 0, &bbe, sizeof(bbe));
114
115 plug(fd, &c);
116 obj[0].handle = c.handle;
117
118 memset(&execbuf, 0, sizeof(execbuf));
119 execbuf.buffers_ptr = to_user_pointer(obj);
120 execbuf.buffer_count = 2;
121
122 count = 0;
123 set_timeout(1);
124 while (__execbuf(fd, &execbuf) == 0)
125 count++;
126 set_timeout(0);
127
128 unplug(&c);
129 gem_close(fd, obj[1].handle);
130
131 return count;
132}
133
Chris Wilson5c810162016-09-08 19:06:54 +0100134#define RCS_TIMESTAMP (0x2000 + 0x358)
Chris Wilsonc460b412017-01-15 21:13:43 +0000135static void latency_on_ring(int fd,
136 unsigned ring, const char *name,
137 unsigned flags)
Chris Wilson5c810162016-09-08 19:06:54 +0100138{
139 const int gen = intel_gen(intel_get_drm_devid(fd));
140 const int has_64bit_reloc = gen >= 8;
Chris Wilsonc460b412017-01-15 21:13:43 +0000141 struct drm_i915_gem_exec_object2 obj[3];
Chris Wilson5c810162016-09-08 19:06:54 +0100142 struct drm_i915_gem_relocation_entry reloc;
143 struct drm_i915_gem_execbuffer2 execbuf;
Chris Wilsonc460b412017-01-15 21:13:43 +0000144 struct cork c;
Chris Wilson5c810162016-09-08 19:06:54 +0100145 volatile uint32_t *reg;
Chris Wilsonef999ae2017-03-01 10:57:06 +0000146 unsigned repeats = ring_size;
Chris Wilson5c810162016-09-08 19:06:54 +0100147 uint32_t start, end, *map, *results;
148 uint64_t offset;
149 double gpu_latency;
150 int i, j;
151
152 reg = (volatile uint32_t *)((volatile char *)igt_global_mmio + RCS_TIMESTAMP);
153
154 memset(&execbuf, 0, sizeof(execbuf));
Chris Wilsonc460b412017-01-15 21:13:43 +0000155 execbuf.buffers_ptr = to_user_pointer(&obj[1]);
Chris Wilson5c810162016-09-08 19:06:54 +0100156 execbuf.buffer_count = 2;
157 execbuf.flags = ring;
158 execbuf.flags |= LOCAL_I915_EXEC_NO_RELOC | LOCAL_I915_EXEC_HANDLE_LUT;
159
160 memset(obj, 0, sizeof(obj));
Chris Wilsonc460b412017-01-15 21:13:43 +0000161 obj[1].handle = gem_create(fd, 4096);
162 obj[1].flags = EXEC_OBJECT_WRITE;
163 results = gem_mmap__wc(fd, obj[1].handle, 0, 4096, PROT_READ);
Chris Wilson5c810162016-09-08 19:06:54 +0100164
Chris Wilsonc460b412017-01-15 21:13:43 +0000165 obj[2].handle = gem_create(fd, 64*1024);
166 map = gem_mmap__wc(fd, obj[2].handle, 0, 64*1024, PROT_WRITE);
167 gem_set_domain(fd, obj[2].handle,
Chris Wilson5c810162016-09-08 19:06:54 +0100168 I915_GEM_DOMAIN_GTT,
169 I915_GEM_DOMAIN_GTT);
170 map[0] = MI_BATCH_BUFFER_END;
171 gem_execbuf(fd, &execbuf);
172
173 memset(&reloc,0, sizeof(reloc));
Chris Wilsonc460b412017-01-15 21:13:43 +0000174 obj[2].relocation_count = 1;
175 obj[2].relocs_ptr = to_user_pointer(&reloc);
Chris Wilson5c810162016-09-08 19:06:54 +0100176
Chris Wilsonc460b412017-01-15 21:13:43 +0000177 gem_set_domain(fd, obj[2].handle,
Chris Wilson5c810162016-09-08 19:06:54 +0100178 I915_GEM_DOMAIN_GTT,
179 I915_GEM_DOMAIN_GTT);
180
Chris Wilsonc460b412017-01-15 21:13:43 +0000181 reloc.target_handle = flags & CORK ? 1 : 0;
Chris Wilson5c810162016-09-08 19:06:54 +0100182 reloc.read_domains = I915_GEM_DOMAIN_INSTRUCTION;
183 reloc.write_domain = I915_GEM_DOMAIN_INSTRUCTION;
Chris Wilsonc460b412017-01-15 21:13:43 +0000184 reloc.presumed_offset = obj[1].offset;
Chris Wilson5c810162016-09-08 19:06:54 +0100185
Chris Wilsonc460b412017-01-15 21:13:43 +0000186 for (j = 0; j < repeats; j++) {
Chris Wilson5c810162016-09-08 19:06:54 +0100187 execbuf.batch_start_offset = 64 * j;
188 reloc.offset =
189 execbuf.batch_start_offset + sizeof(uint32_t);
190 reloc.delta = sizeof(uint32_t) * j;
191
192 offset = reloc.presumed_offset;
193 offset += reloc.delta;
194
195 i = 16 * j;
196 /* MI_STORE_REG_MEM */
197 map[i++] = 0x24 << 23 | 1;
198 if (has_64bit_reloc)
199 map[i-1]++;
200 map[i++] = RCS_TIMESTAMP; /* ring local! */
201 map[i++] = offset;
202 if (has_64bit_reloc)
203 map[i++] = offset >> 32;
204 map[i++] = MI_BATCH_BUFFER_END;
205 }
206
Chris Wilsonc460b412017-01-15 21:13:43 +0000207 if (flags & CORK) {
208 plug(fd, &c);
209 obj[0].handle = c.handle;
210 execbuf.buffers_ptr = to_user_pointer(&obj[0]);
211 execbuf.buffer_count = 3;
212 }
213
Chris Wilson5c810162016-09-08 19:06:54 +0100214 start = *reg;
Chris Wilsonc460b412017-01-15 21:13:43 +0000215 for (j = 0; j < repeats; j++) {
Chris Wilsona7c9add2017-02-23 02:04:31 +0000216 uint64_t presumed_offset = reloc.presumed_offset;
217
Chris Wilson5c810162016-09-08 19:06:54 +0100218 execbuf.batch_start_offset = 64 * j;
219 reloc.offset =
220 execbuf.batch_start_offset + sizeof(uint32_t);
221 reloc.delta = sizeof(uint32_t) * j;
222
223 gem_execbuf(fd, &execbuf);
Chris Wilsona7c9add2017-02-23 02:04:31 +0000224 igt_assert(reloc.presumed_offset == presumed_offset);
Chris Wilson5c810162016-09-08 19:06:54 +0100225 }
226 end = *reg;
Chris Wilsonc460b412017-01-15 21:13:43 +0000227 igt_assert(reloc.presumed_offset == obj[1].offset);
Chris Wilson5c810162016-09-08 19:06:54 +0100228
Chris Wilsonc460b412017-01-15 21:13:43 +0000229 if (flags & CORK)
230 unplug(&c);
Chris Wilson5c810162016-09-08 19:06:54 +0100231
Chris Wilsonc460b412017-01-15 21:13:43 +0000232 gem_set_domain(fd, obj[1].handle, I915_GEM_DOMAIN_GTT, 0);
233 gpu_latency = (results[repeats-1] - results[0]) / (double)(repeats-1);
234
235 gem_set_domain(fd, obj[2].handle,
Chris Wilson5c810162016-09-08 19:06:54 +0100236 I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);
237
238 execbuf.batch_start_offset = 0;
Chris Wilsonc460b412017-01-15 21:13:43 +0000239 for (j = 0; j < repeats - 1; j++) {
240 offset = obj[2].offset;
Chris Wilson5c810162016-09-08 19:06:54 +0100241 offset += 64 * (j + 1);
242
243 i = 16 * j + (has_64bit_reloc ? 4 : 3);
244 map[i] = MI_BATCH_BUFFER_START;
245 if (gen >= 8) {
246 map[i] |= 1 << 8 | 1;
247 map[i + 1] = offset;
248 map[i + 2] = offset >> 32;
249 } else if (gen >= 6) {
250 map[i] |= 1 << 8;
251 map[i + 1] = offset;
252 } else {
253 map[i] |= 2 << 6;
254 map[i + 1] = offset;
255 if (gen < 4)
256 map[i] |= 1;
257 }
258 }
Chris Wilsonc460b412017-01-15 21:13:43 +0000259 offset = obj[2].offset;
Chris Wilson5c810162016-09-08 19:06:54 +0100260 gem_execbuf(fd, &execbuf);
Chris Wilsonc460b412017-01-15 21:13:43 +0000261 igt_assert(offset == obj[2].offset);
Chris Wilson5c810162016-09-08 19:06:54 +0100262
Chris Wilsonc460b412017-01-15 21:13:43 +0000263 gem_set_domain(fd, obj[1].handle, I915_GEM_DOMAIN_GTT, 0);
Chris Wilson5c810162016-09-08 19:06:54 +0100264 igt_info("%s: dispatch latency: %.2f, execution latency: %.2f (target %.2f)\n",
265 name,
Chris Wilsonc460b412017-01-15 21:13:43 +0000266 (end - start) / (double)repeats,
267 gpu_latency, (results[repeats - 1] - results[0]) / (double)(repeats - 1));
Chris Wilson5c810162016-09-08 19:06:54 +0100268
269 munmap(map, 64*1024);
270 munmap(results, 4096);
Chris Wilson5c810162016-09-08 19:06:54 +0100271 gem_close(fd, obj[1].handle);
Chris Wilsonc460b412017-01-15 21:13:43 +0000272 gem_close(fd, obj[2].handle);
Chris Wilson5c810162016-09-08 19:06:54 +0100273}
274
Chris Wilsonc460b412017-01-15 21:13:43 +0000275static void latency_from_ring(int fd,
276 unsigned ring, const char *name,
277 unsigned flags)
Chris Wilson5c810162016-09-08 19:06:54 +0100278{
279 const struct intel_execution_engine *e;
280 const int gen = intel_gen(intel_get_drm_devid(fd));
281 const int has_64bit_reloc = gen >= 8;
Chris Wilsonc460b412017-01-15 21:13:43 +0000282 struct drm_i915_gem_exec_object2 obj[3];
Chris Wilson5c810162016-09-08 19:06:54 +0100283 struct drm_i915_gem_relocation_entry reloc;
284 struct drm_i915_gem_execbuffer2 execbuf;
Chris Wilsonef999ae2017-03-01 10:57:06 +0000285 const unsigned int repeats = ring_size / 2;
Chris Wilson5c810162016-09-08 19:06:54 +0100286 uint32_t *map, *results;
287 int i, j;
288
289 memset(&execbuf, 0, sizeof(execbuf));
Chris Wilsonc460b412017-01-15 21:13:43 +0000290 execbuf.buffers_ptr = to_user_pointer(&obj[1]);
Chris Wilson5c810162016-09-08 19:06:54 +0100291 execbuf.buffer_count = 2;
292 execbuf.flags = ring;
293 execbuf.flags |= LOCAL_I915_EXEC_NO_RELOC | LOCAL_I915_EXEC_HANDLE_LUT;
294
295 memset(obj, 0, sizeof(obj));
Chris Wilsonc460b412017-01-15 21:13:43 +0000296 obj[1].handle = gem_create(fd, 4096);
297 obj[1].flags = EXEC_OBJECT_WRITE;
298 results = gem_mmap__wc(fd, obj[1].handle, 0, 4096, PROT_READ);
Chris Wilson5c810162016-09-08 19:06:54 +0100299
Chris Wilsonc460b412017-01-15 21:13:43 +0000300 obj[2].handle = gem_create(fd, 64*1024);
301 map = gem_mmap__wc(fd, obj[2].handle, 0, 64*1024, PROT_WRITE);
302 gem_set_domain(fd, obj[2].handle,
Chris Wilson5c810162016-09-08 19:06:54 +0100303 I915_GEM_DOMAIN_GTT,
304 I915_GEM_DOMAIN_GTT);
305 map[0] = MI_BATCH_BUFFER_END;
306 gem_execbuf(fd, &execbuf);
307
308 memset(&reloc,0, sizeof(reloc));
Chris Wilsonc460b412017-01-15 21:13:43 +0000309 obj[2].relocation_count = 1;
310 obj[2].relocs_ptr = to_user_pointer(&reloc);
Chris Wilson5c810162016-09-08 19:06:54 +0100311
Chris Wilsonc460b412017-01-15 21:13:43 +0000312 gem_set_domain(fd, obj[2].handle,
Chris Wilson5c810162016-09-08 19:06:54 +0100313 I915_GEM_DOMAIN_GTT,
314 I915_GEM_DOMAIN_GTT);
315
316 reloc.read_domains = I915_GEM_DOMAIN_INSTRUCTION;
317 reloc.write_domain = I915_GEM_DOMAIN_INSTRUCTION;
Chris Wilsonc460b412017-01-15 21:13:43 +0000318 reloc.presumed_offset = obj[1].offset;
319 reloc.target_handle = flags & CORK ? 1 : 0;
Chris Wilson5c810162016-09-08 19:06:54 +0100320
321 for (e = intel_execution_engines; e->name; e++) {
Chris Wilsonc460b412017-01-15 21:13:43 +0000322 struct cork c;
Chris Wilsonc460b412017-01-15 21:13:43 +0000323
Chris Wilson5c810162016-09-08 19:06:54 +0100324 if (e->exec_id == 0)
325 continue;
326
327 if (!gem_has_ring(fd, e->exec_id | e->flags))
328 continue;
329
Chris Wilsonc460b412017-01-15 21:13:43 +0000330 gem_set_domain(fd, obj[2].handle,
Chris Wilson5c810162016-09-08 19:06:54 +0100331 I915_GEM_DOMAIN_GTT,
332 I915_GEM_DOMAIN_GTT);
333
Chris Wilsonc460b412017-01-15 21:13:43 +0000334 if (flags & CORK) {
335 plug(fd, &c);
336 obj[0].handle = c.handle;
337 execbuf.buffers_ptr = to_user_pointer(&obj[0]);
338 execbuf.buffer_count = 3;
Chris Wilsonc460b412017-01-15 21:13:43 +0000339 }
340
341 for (j = 0; j < repeats; j++) {
Chris Wilson5c810162016-09-08 19:06:54 +0100342 uint64_t offset;
343
344 execbuf.flags &= ~ENGINE_FLAGS;
345 execbuf.flags |= ring;
346
347 execbuf.batch_start_offset = 64 * j;
348 reloc.offset =
349 execbuf.batch_start_offset + sizeof(uint32_t);
350 reloc.delta = sizeof(uint32_t) * j;
351
352 offset = reloc.presumed_offset;
353 offset += reloc.delta;
354
355 i = 16 * j;
356 /* MI_STORE_REG_MEM */
357 map[i++] = 0x24 << 23 | 1;
358 if (has_64bit_reloc)
359 map[i-1]++;
360 map[i++] = RCS_TIMESTAMP; /* ring local! */
361 map[i++] = offset;
362 if (has_64bit_reloc)
363 map[i++] = offset >> 32;
364 map[i++] = MI_BATCH_BUFFER_END;
365
366 gem_execbuf(fd, &execbuf);
367
368 execbuf.flags &= ~ENGINE_FLAGS;
Chris Wilsonc460b412017-01-15 21:13:43 +0000369 execbuf.flags |= e->exec_id | e->flags;
Chris Wilson5c810162016-09-08 19:06:54 +0100370
Chris Wilsonc460b412017-01-15 21:13:43 +0000371 execbuf.batch_start_offset = 64 * (j + repeats);
Chris Wilson5c810162016-09-08 19:06:54 +0100372 reloc.offset =
373 execbuf.batch_start_offset + sizeof(uint32_t);
Chris Wilsonc460b412017-01-15 21:13:43 +0000374 reloc.delta = sizeof(uint32_t) * (j + repeats);
Chris Wilson5c810162016-09-08 19:06:54 +0100375
376 offset = reloc.presumed_offset;
377 offset += reloc.delta;
378
Chris Wilsonc460b412017-01-15 21:13:43 +0000379 i = 16 * (j + repeats);
Chris Wilson5c810162016-09-08 19:06:54 +0100380 /* MI_STORE_REG_MEM */
381 map[i++] = 0x24 << 23 | 1;
382 if (has_64bit_reloc)
383 map[i-1]++;
384 map[i++] = RCS_TIMESTAMP; /* ring local! */
385 map[i++] = offset;
386 if (has_64bit_reloc)
387 map[i++] = offset >> 32;
388 map[i++] = MI_BATCH_BUFFER_END;
389
390 gem_execbuf(fd, &execbuf);
391 }
392
Chris Wilsonc460b412017-01-15 21:13:43 +0000393 if (flags & CORK)
394 unplug(&c);
395
396 gem_set_domain(fd, obj[1].handle,
Chris Wilson5c810162016-09-08 19:06:54 +0100397 I915_GEM_DOMAIN_GTT,
398 I915_GEM_DOMAIN_GTT);
399
400 igt_info("%s-%s delay: %.2f\n",
Chris Wilsonc460b412017-01-15 21:13:43 +0000401 name, e->name, (results[2*repeats-1] - results[0]) / (double)repeats);
Chris Wilson5c810162016-09-08 19:06:54 +0100402 }
403
404 munmap(map, 64*1024);
405 munmap(results, 4096);
Chris Wilson5c810162016-09-08 19:06:54 +0100406 gem_close(fd, obj[1].handle);
Chris Wilsonc460b412017-01-15 21:13:43 +0000407 gem_close(fd, obj[2].handle);
Chris Wilson5c810162016-09-08 19:06:54 +0100408}
409
410static void print_welcome(int fd)
411{
412 bool active;
413 int dir;
414
415 dir = igt_sysfs_open_parameters(fd);
416 if (dir < 0)
417 return;
418
419 active = igt_sysfs_get_boolean(dir, "enable_guc_submission");
420 if (active) {
421 igt_info("Using GuC submission\n");
422 goto out;
423 }
424
425 active = igt_sysfs_get_boolean(dir, "enable_execlists");
426 if (active) {
427 igt_info("Using Execlists submission\n");
428 goto out;
429 }
430
431 active = igt_sysfs_get_boolean(dir, "semaphores");
432 igt_info("Using Legacy submission%s\n",
433 active ? ", with semaphores" : "");
434
435out:
436 close(dir);
437}
438
439igt_main
440{
441 const struct intel_execution_engine *e;
442 int device = -1;
443
444 igt_fixture {
Chris Wilson5c810162016-09-08 19:06:54 +0100445 device = drm_open_driver(DRIVER_INTEL);
Chris Wilson9518cb52017-02-22 15:24:54 +0000446 igt_require_gem(device);
Chris Wilsoncf279432017-05-23 15:44:40 +0100447 gem_require_mmap_wc(device);
448
Chris Wilson5c810162016-09-08 19:06:54 +0100449 print_welcome(device);
Chris Wilsonef999ae2017-03-01 10:57:06 +0000450
451 ring_size = measure_ring_size(device);
452 igt_info("Ring size: %d batches\n", ring_size);
453 igt_require(ring_size > 8);
454 ring_size -= 8; /* leave some spare */
455 if (ring_size > 1024)
456 ring_size = 1024;
Chris Wilsoncf279432017-05-23 15:44:40 +0100457
458 intel_register_access_init(intel_get_pci_device(), false, device);
Chris Wilson5c810162016-09-08 19:06:54 +0100459 }
460
461 igt_subtest_group {
462 igt_fixture
463 igt_require(intel_gen(intel_get_drm_devid(device)) >= 7);
464
465 for (e = intel_execution_engines; e->name; e++) {
466 if (e->exec_id == 0)
467 continue;
468
469 igt_subtest_f("%s-dispatch", e->name) {
470 gem_require_ring(device, e->exec_id | e->flags);
471 latency_on_ring(device,
472 e->exec_id | e->flags,
Chris Wilsonc460b412017-01-15 21:13:43 +0000473 e->name, 0);
Chris Wilson5c810162016-09-08 19:06:54 +0100474 }
Chris Wilsonc460b412017-01-15 21:13:43 +0000475
476 igt_subtest_f("%s-dispatch-queued", e->name) {
477 gem_require_ring(device, e->exec_id | e->flags);
478 latency_on_ring(device,
479 e->exec_id | e->flags,
480 e->name, CORK);
481 }
482
Chris Wilson5c810162016-09-08 19:06:54 +0100483 igt_subtest_f("%s-synchronisation", e->name) {
484 gem_require_ring(device, e->exec_id | e->flags);
485 latency_from_ring(device,
486 e->exec_id | e->flags,
Chris Wilsonc460b412017-01-15 21:13:43 +0000487 e->name, 0);
488 }
489
490 igt_subtest_f("%s-synchronisation-queued", e->name) {
491 gem_require_ring(device, e->exec_id | e->flags);
492 latency_from_ring(device,
493 e->exec_id | e->flags,
494 e->name, CORK);
Chris Wilson5c810162016-09-08 19:06:54 +0100495 }
496 }
497 }
498
499
500 igt_fixture {
501 close(device);
502 }
503}