Chris Wilson | 5615ab2 | 2016-03-11 10:48:47 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright © 2009 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 | /** @file gem_exec_whisper.c |
| 26 | * |
| 27 | * Pass around a value to write into a scratch buffer between lots of batches |
| 28 | */ |
| 29 | |
| 30 | #include "igt.h" |
| 31 | #include "igt_gt.h" |
Chris Wilson | 58de785 | 2017-03-24 18:11:08 +0000 | [diff] [blame] | 32 | #include "igt_debugfs.h" |
Chris Wilson | c117213 | 2017-09-24 17:14:36 +0100 | [diff] [blame] | 33 | #include "igt_rand.h" |
Chris Wilson | c6e26e4 | 2016-07-22 12:58:54 +0100 | [diff] [blame] | 34 | #include "igt_sysfs.h" |
Chris Wilson | 5615ab2 | 2016-03-11 10:48:47 +0000 | [diff] [blame] | 35 | |
| 36 | #define LOCAL_I915_EXEC_NO_RELOC (1<<11) |
| 37 | #define LOCAL_I915_EXEC_HANDLE_LUT (1<<12) |
| 38 | |
| 39 | #define LOCAL_I915_EXEC_BSD_SHIFT (13) |
| 40 | #define LOCAL_I915_EXEC_BSD_MASK (3 << LOCAL_I915_EXEC_BSD_SHIFT) |
| 41 | |
| 42 | #define ENGINE_MASK (I915_EXEC_RING_MASK | LOCAL_I915_EXEC_BSD_MASK) |
| 43 | |
Chris Wilson | 8f6ed9e | 2016-03-12 11:20:03 +0000 | [diff] [blame] | 44 | #define VERIFY 0 |
| 45 | |
Chris Wilson | 58de785 | 2017-03-24 18:11:08 +0000 | [diff] [blame] | 46 | static void write_seqno(int dir, unsigned offset) |
Chris Wilson | 5615ab2 | 2016-03-11 10:48:47 +0000 | [diff] [blame] | 47 | { |
| 48 | uint32_t seqno = UINT32_MAX - offset; |
Chris Wilson | 5615ab2 | 2016-03-11 10:48:47 +0000 | [diff] [blame] | 49 | |
Chris Wilson | 58de785 | 2017-03-24 18:11:08 +0000 | [diff] [blame] | 50 | igt_sysfs_printf(dir, "i915_next_seqno", "0x%x", seqno); |
Chris Wilson | 5615ab2 | 2016-03-11 10:48:47 +0000 | [diff] [blame] | 51 | |
| 52 | igt_debug("next seqno set to: 0x%x\n", seqno); |
| 53 | } |
| 54 | |
| 55 | static void check_bo(int fd, uint32_t handle) |
| 56 | { |
| 57 | uint32_t *map; |
| 58 | int i; |
| 59 | |
| 60 | igt_debug("Verifying result\n"); |
| 61 | map = gem_mmap__cpu(fd, handle, 0, 4096, PROT_READ); |
| 62 | gem_set_domain(fd, handle, I915_GEM_DOMAIN_CPU, 0); |
| 63 | for (i = 0; i < 1024; i++) |
| 64 | igt_assert_eq(map[i], i); |
| 65 | munmap(map, 4096); |
| 66 | } |
| 67 | |
Chris Wilson | 8f6ed9e | 2016-03-12 11:20:03 +0000 | [diff] [blame] | 68 | static void verify_reloc(int fd, uint32_t handle, |
| 69 | const struct drm_i915_gem_relocation_entry *reloc) |
| 70 | { |
| 71 | if (VERIFY) { |
| 72 | uint64_t target = 0; |
| 73 | if (intel_gen(intel_get_drm_devid(fd)) >= 8) |
| 74 | gem_read(fd, handle, reloc->offset, &target, 8); |
| 75 | else |
| 76 | gem_read(fd, handle, reloc->offset, &target, 4); |
| 77 | igt_assert_eq_u64(target, |
| 78 | reloc->presumed_offset + reloc->delta); |
| 79 | } |
| 80 | } |
| 81 | |
Chris Wilson | 5615ab2 | 2016-03-11 10:48:47 +0000 | [diff] [blame] | 82 | static int __gem_context_create(int fd, uint32_t *ctx_id) |
| 83 | { |
| 84 | struct drm_i915_gem_context_create arg; |
| 85 | int ret = 0; |
| 86 | |
| 87 | memset(&arg, 0, sizeof(arg)); |
| 88 | if (drmIoctl(fd, DRM_IOCTL_I915_GEM_CONTEXT_CREATE, &arg)) |
| 89 | ret = -errno; |
| 90 | |
| 91 | *ctx_id = arg.ctx_id; |
| 92 | return ret; |
| 93 | } |
| 94 | |
Chris Wilson | bc78776 | 2017-05-18 12:11:59 +0100 | [diff] [blame] | 95 | static bool ignore_engine(int fd, unsigned engine) |
Chris Wilson | 5615ab2 | 2016-03-11 10:48:47 +0000 | [diff] [blame] | 96 | { |
Chris Wilson | 5df2de7 | 2016-03-15 09:52:57 +0000 | [diff] [blame] | 97 | if (engine == 0) |
| 98 | return true; |
| 99 | |
Chris Wilson | bc78776 | 2017-05-18 12:11:59 +0100 | [diff] [blame] | 100 | if (!gem_can_store_dword(fd, engine)) |
Chris Wilson | 5df2de7 | 2016-03-15 09:52:57 +0000 | [diff] [blame] | 101 | return true; |
| 102 | |
| 103 | return false; |
Chris Wilson | 5615ab2 | 2016-03-11 10:48:47 +0000 | [diff] [blame] | 104 | } |
| 105 | |
| 106 | #define CONTEXTS 0x1 |
Chris Wilson | 9eacbd2 | 2016-03-11 14:31:56 +0000 | [diff] [blame] | 107 | #define FDS 0x2 |
Chris Wilson | 83cfed8 | 2016-03-19 14:21:34 +0000 | [diff] [blame] | 108 | #define INTERRUPTIBLE 0x4 |
Chris Wilson | 7b34c51 | 2016-06-04 16:12:28 +0100 | [diff] [blame] | 109 | #define CHAIN 0x8 |
Chris Wilson | 587753b | 2016-09-12 16:06:48 +0100 | [diff] [blame] | 110 | #define FORKED 0x10 |
Chris Wilson | 1a76d88 | 2016-10-01 16:50:51 +0100 | [diff] [blame] | 111 | #define HANG 0x20 |
Chris Wilson | 38dc158 | 2017-04-05 17:09:15 +0100 | [diff] [blame] | 112 | #define SYNC 0x40 |
Chris Wilson | c117213 | 2017-09-24 17:14:36 +0100 | [diff] [blame] | 113 | #define PRIORITY 0x80 |
Chris Wilson | 1a76d88 | 2016-10-01 16:50:51 +0100 | [diff] [blame] | 114 | |
| 115 | struct hang { |
| 116 | struct drm_i915_gem_exec_object2 obj; |
| 117 | struct drm_i915_gem_relocation_entry reloc; |
| 118 | struct drm_i915_gem_execbuffer2 execbuf; |
| 119 | int fd; |
| 120 | }; |
| 121 | |
| 122 | static void init_hang(struct hang *h) |
| 123 | { |
| 124 | uint32_t *batch; |
| 125 | int i, gen; |
| 126 | |
| 127 | h->fd = drm_open_driver(DRIVER_INTEL); |
| 128 | igt_allow_hang(h->fd, 0, 0); |
| 129 | |
| 130 | gen = intel_gen(intel_get_drm_devid(h->fd)); |
| 131 | |
| 132 | memset(&h->execbuf, 0, sizeof(h->execbuf)); |
Chris Wilson | 4de67b2 | 2017-01-02 11:05:21 +0000 | [diff] [blame] | 133 | h->execbuf.buffers_ptr = to_user_pointer(&h->obj); |
Chris Wilson | 1a76d88 | 2016-10-01 16:50:51 +0100 | [diff] [blame] | 134 | h->execbuf.buffer_count = 1; |
| 135 | |
| 136 | memset(&h->obj, 0, sizeof(h->obj)); |
| 137 | h->obj.handle = gem_create(h->fd, 4096); |
| 138 | |
Chris Wilson | 4de67b2 | 2017-01-02 11:05:21 +0000 | [diff] [blame] | 139 | h->obj.relocs_ptr = to_user_pointer(&h->reloc); |
Chris Wilson | 1a76d88 | 2016-10-01 16:50:51 +0100 | [diff] [blame] | 140 | h->obj.relocation_count = 1; |
| 141 | memset(&h->reloc, 0, sizeof(h->reloc)); |
| 142 | |
| 143 | batch = gem_mmap__cpu(h->fd, h->obj.handle, 0, 4096, PROT_WRITE); |
| 144 | gem_set_domain(h->fd, h->obj.handle, |
| 145 | I915_GEM_DOMAIN_CPU, I915_GEM_DOMAIN_CPU); |
| 146 | |
| 147 | h->reloc.target_handle = h->obj.handle; /* recurse */ |
| 148 | h->reloc.presumed_offset = 0; |
| 149 | h->reloc.offset = 5*sizeof(uint32_t); |
| 150 | h->reloc.delta = 0; |
| 151 | h->reloc.read_domains = I915_GEM_DOMAIN_COMMAND; |
| 152 | h->reloc.write_domain = 0; |
| 153 | |
| 154 | i = 0; |
| 155 | batch[i++] = 0xffffffff; |
| 156 | batch[i++] = 0xdeadbeef; |
| 157 | batch[i++] = 0xc00fee00; |
| 158 | batch[i++] = 0x00c00fee; |
| 159 | batch[i] = MI_BATCH_BUFFER_START; |
| 160 | if (gen >= 8) { |
| 161 | batch[i] |= 1 << 8 | 1; |
| 162 | batch[++i] = 0; |
| 163 | batch[++i] = 0; |
| 164 | } else if (gen >= 6) { |
| 165 | batch[i] |= 1 << 8; |
| 166 | batch[++i] = 0; |
| 167 | } else { |
| 168 | batch[i] |= 2 << 6; |
| 169 | batch[++i] = 0; |
| 170 | if (gen < 4) { |
| 171 | batch[i] |= 1; |
| 172 | h->reloc.delta = 1; |
| 173 | } |
| 174 | } |
| 175 | munmap(batch, 4096); |
| 176 | } |
| 177 | |
Chris Wilson | 38dc158 | 2017-04-05 17:09:15 +0100 | [diff] [blame] | 178 | static void submit_hang(struct hang *h, unsigned *engines, int nengine, unsigned flags) |
Chris Wilson | 1a76d88 | 2016-10-01 16:50:51 +0100 | [diff] [blame] | 179 | { |
| 180 | while (nengine--) { |
| 181 | h->execbuf.flags &= ~ENGINE_MASK; |
| 182 | h->execbuf.flags |= *engines++; |
| 183 | gem_execbuf(h->fd, &h->execbuf); |
| 184 | } |
Chris Wilson | 38dc158 | 2017-04-05 17:09:15 +0100 | [diff] [blame] | 185 | if (flags & SYNC) |
| 186 | gem_sync(h->fd, h->obj.handle); |
Chris Wilson | 1a76d88 | 2016-10-01 16:50:51 +0100 | [diff] [blame] | 187 | } |
| 188 | |
| 189 | static void fini_hang(struct hang *h) |
| 190 | { |
| 191 | close(h->fd); |
| 192 | } |
Chris Wilson | 5615ab2 | 2016-03-11 10:48:47 +0000 | [diff] [blame] | 193 | |
Chris Wilson | c117213 | 2017-09-24 17:14:36 +0100 | [diff] [blame] | 194 | #define LOCAL_PARAM_HAS_SCHEDULER 41 |
| 195 | #define LOCAL_CONTEXT_PARAM_PRIORITY 6 |
| 196 | |
| 197 | static bool __has_scheduler(int fd) |
| 198 | { |
| 199 | drm_i915_getparam_t gp; |
| 200 | int has = -1; |
| 201 | |
| 202 | gp.param = LOCAL_PARAM_HAS_SCHEDULER; |
| 203 | gp.value = &has; |
| 204 | drmIoctl(fd, DRM_IOCTL_I915_GETPARAM, &gp); |
| 205 | |
| 206 | return has > 0; |
| 207 | } |
| 208 | |
| 209 | static int __ctx_set_priority(int fd, uint32_t ctx, int prio) |
| 210 | { |
| 211 | struct local_i915_gem_context_param param; |
| 212 | |
| 213 | memset(¶m, 0, sizeof(param)); |
| 214 | param.context = ctx; |
| 215 | param.size = 0; |
| 216 | param.param = LOCAL_CONTEXT_PARAM_PRIORITY; |
| 217 | param.value = prio; |
| 218 | |
| 219 | return __gem_context_set_param(fd, ¶m); |
| 220 | } |
| 221 | |
| 222 | static void ctx_set_priority(int fd, uint32_t ctx) |
| 223 | { |
| 224 | int prio = hars_petruska_f54_1_random_unsafe_max(1024) - 512; |
| 225 | igt_assert_eq(__ctx_set_priority(fd, ctx, prio), 0); |
| 226 | }; |
| 227 | |
Chris Wilson | 2fdf5ac | 2016-03-14 13:41:15 +0000 | [diff] [blame] | 228 | static void whisper(int fd, unsigned engine, unsigned flags) |
Chris Wilson | 5615ab2 | 2016-03-11 10:48:47 +0000 | [diff] [blame] | 229 | { |
Chris Wilson | 3e76584 | 2016-07-02 11:51:29 +0100 | [diff] [blame] | 230 | const uint32_t bbe = MI_BATCH_BUFFER_END; |
Chris Wilson | 5615ab2 | 2016-03-11 10:48:47 +0000 | [diff] [blame] | 231 | const int gen = intel_gen(intel_get_drm_devid(fd)); |
| 232 | struct drm_i915_gem_exec_object2 batches[1024]; |
| 233 | struct drm_i915_gem_relocation_entry inter[1024]; |
| 234 | struct drm_i915_gem_relocation_entry reloc; |
Chris Wilson | 8f6ed9e | 2016-03-12 11:20:03 +0000 | [diff] [blame] | 235 | struct drm_i915_gem_exec_object2 store, scratch; |
| 236 | struct drm_i915_gem_exec_object2 tmp[2]; |
| 237 | struct drm_i915_gem_execbuffer2 execbuf; |
Chris Wilson | 1a76d88 | 2016-10-01 16:50:51 +0100 | [diff] [blame] | 238 | struct hang hang; |
Chris Wilson | 9eacbd2 | 2016-03-11 14:31:56 +0000 | [diff] [blame] | 239 | int fds[64]; |
Chris Wilson | 5615ab2 | 2016-03-11 10:48:47 +0000 | [diff] [blame] | 240 | uint32_t contexts[64]; |
Chris Wilson | 5615ab2 | 2016-03-11 10:48:47 +0000 | [diff] [blame] | 241 | unsigned engines[16]; |
| 242 | unsigned nengine; |
Chris Wilson | 5615ab2 | 2016-03-11 10:48:47 +0000 | [diff] [blame] | 243 | uint32_t batch[16]; |
| 244 | int i, n, pass, loc; |
Chris Wilson | 5dcb026 | 2016-03-26 09:48:16 +0000 | [diff] [blame] | 245 | unsigned int relocations = 0; |
Chris Wilson | 488dc3b | 2016-03-15 09:16:30 +0000 | [diff] [blame] | 246 | unsigned int reloc_migrations = 0; |
Chris Wilson | d5e550f | 2016-03-21 11:58:21 +0000 | [diff] [blame] | 247 | unsigned int reloc_interruptions = 0; |
Chris Wilson | 488dc3b | 2016-03-15 09:16:30 +0000 | [diff] [blame] | 248 | unsigned int eb_migrations = 0; |
Chris Wilson | 5dcb026 | 2016-03-26 09:48:16 +0000 | [diff] [blame] | 249 | uint64_t old_offset; |
Chris Wilson | 58de785 | 2017-03-24 18:11:08 +0000 | [diff] [blame] | 250 | int debugfs; |
| 251 | |
Chris Wilson | c117213 | 2017-09-24 17:14:36 +0100 | [diff] [blame] | 252 | if (flags & PRIORITY) { |
| 253 | int __fd = drm_open_driver(DRIVER_INTEL); |
| 254 | bool has_scheduler = __has_scheduler(__fd); |
| 255 | bool ctx_has_priority = |
| 256 | __ctx_set_priority(__fd, 0, 1) == 0; |
| 257 | close(__fd); |
| 258 | |
| 259 | igt_require(has_scheduler && ctx_has_priority); |
| 260 | } |
| 261 | |
Chris Wilson | 58de785 | 2017-03-24 18:11:08 +0000 | [diff] [blame] | 262 | debugfs = igt_debugfs_dir(fd); |
Chris Wilson | 5615ab2 | 2016-03-11 10:48:47 +0000 | [diff] [blame] | 263 | |
| 264 | nengine = 0; |
Chris Wilson | 2fdf5ac | 2016-03-14 13:41:15 +0000 | [diff] [blame] | 265 | if (engine == -1) { |
| 266 | for_each_engine(fd, engine) { |
Chris Wilson | bc78776 | 2017-05-18 12:11:59 +0100 | [diff] [blame] | 267 | if (!ignore_engine(fd, engine)) |
Chris Wilson | 2fdf5ac | 2016-03-14 13:41:15 +0000 | [diff] [blame] | 268 | engines[nengine++] = engine; |
| 269 | } |
| 270 | } else { |
| 271 | igt_require(gem_has_ring(fd, engine)); |
Chris Wilson | bc78776 | 2017-05-18 12:11:59 +0100 | [diff] [blame] | 272 | igt_require(gem_can_store_dword(fd, engine)); |
Chris Wilson | 2fdf5ac | 2016-03-14 13:41:15 +0000 | [diff] [blame] | 273 | engines[nengine++] = engine; |
| 274 | } |
Chris Wilson | 5615ab2 | 2016-03-11 10:48:47 +0000 | [diff] [blame] | 275 | igt_require(nengine); |
| 276 | |
Chris Wilson | 875c27c | 2017-04-08 13:54:12 +0100 | [diff] [blame] | 277 | if (flags & FDS) |
| 278 | igt_require(gen >= 6); |
| 279 | |
Chris Wilson | fe97e03 | 2017-03-23 10:48:32 +0000 | [diff] [blame] | 280 | if (flags & CONTEXTS) { |
| 281 | igt_require(__gem_context_create(fd, &contexts[0]) == 0); |
| 282 | gem_context_destroy(fd, contexts[0]); |
| 283 | } |
| 284 | |
Chris Wilson | 1a76d88 | 2016-10-01 16:50:51 +0100 | [diff] [blame] | 285 | if (flags & HANG) |
| 286 | init_hang(&hang); |
| 287 | |
Chris Wilson | 587753b | 2016-09-12 16:06:48 +0100 | [diff] [blame] | 288 | intel_detect_and_clear_missed_interrupts(fd); |
| 289 | igt_fork(child, flags & FORKED ? sysconf(_SC_NPROCESSORS_ONLN) : 1) { |
| 290 | memset(&scratch, 0, sizeof(scratch)); |
| 291 | scratch.handle = gem_create(fd, 4096); |
| 292 | scratch.flags = EXEC_OBJECT_WRITE; |
Chris Wilson | 8f6ed9e | 2016-03-12 11:20:03 +0000 | [diff] [blame] | 293 | |
Chris Wilson | 587753b | 2016-09-12 16:06:48 +0100 | [diff] [blame] | 294 | memset(&store, 0, sizeof(store)); |
| 295 | store.handle = gem_create(fd, 4096); |
Chris Wilson | 4de67b2 | 2017-01-02 11:05:21 +0000 | [diff] [blame] | 296 | store.relocs_ptr = to_user_pointer(&reloc); |
Chris Wilson | 587753b | 2016-09-12 16:06:48 +0100 | [diff] [blame] | 297 | store.relocation_count = 1; |
Chris Wilson | 5615ab2 | 2016-03-11 10:48:47 +0000 | [diff] [blame] | 298 | |
Chris Wilson | 587753b | 2016-09-12 16:06:48 +0100 | [diff] [blame] | 299 | memset(&reloc, 0, sizeof(reloc)); |
| 300 | reloc.offset = sizeof(uint32_t); |
| 301 | if (gen < 8 && gen >= 4) |
| 302 | reloc.offset += sizeof(uint32_t); |
| 303 | loc = 8; |
| 304 | if (gen >= 4) |
| 305 | loc += 4; |
| 306 | reloc.read_domains = I915_GEM_DOMAIN_INSTRUCTION; |
| 307 | reloc.write_domain = I915_GEM_DOMAIN_INSTRUCTION; |
Chris Wilson | 5615ab2 | 2016-03-11 10:48:47 +0000 | [diff] [blame] | 308 | |
Chris Wilson | 587753b | 2016-09-12 16:06:48 +0100 | [diff] [blame] | 309 | { |
| 310 | tmp[0] = scratch; |
| 311 | tmp[1] = store; |
| 312 | gem_write(fd, store.handle, 0, &bbe, sizeof(bbe)); |
Chris Wilson | 8f6ed9e | 2016-03-12 11:20:03 +0000 | [diff] [blame] | 313 | |
Chris Wilson | 587753b | 2016-09-12 16:06:48 +0100 | [diff] [blame] | 314 | memset(&execbuf, 0, sizeof(execbuf)); |
Chris Wilson | 4de67b2 | 2017-01-02 11:05:21 +0000 | [diff] [blame] | 315 | execbuf.buffers_ptr = to_user_pointer(tmp); |
Chris Wilson | 587753b | 2016-09-12 16:06:48 +0100 | [diff] [blame] | 316 | execbuf.buffer_count = 2; |
| 317 | execbuf.flags = LOCAL_I915_EXEC_HANDLE_LUT; |
| 318 | execbuf.flags |= LOCAL_I915_EXEC_NO_RELOC; |
| 319 | if (gen < 6) |
| 320 | execbuf.flags |= I915_EXEC_SECURE; |
| 321 | igt_require(__gem_execbuf(fd, &execbuf) == 0); |
| 322 | scratch = tmp[0]; |
| 323 | store = tmp[1]; |
Chris Wilson | 3e76584 | 2016-07-02 11:51:29 +0100 | [diff] [blame] | 324 | } |
| 325 | |
Chris Wilson | 587753b | 2016-09-12 16:06:48 +0100 | [diff] [blame] | 326 | i = 0; |
| 327 | batch[i] = MI_STORE_DWORD_IMM | (gen < 6 ? 1 << 22 : 0); |
| 328 | if (gen >= 8) { |
| 329 | batch[++i] = store.offset + loc; |
| 330 | batch[++i] = (store.offset + loc) >> 32; |
| 331 | } else if (gen >= 4) { |
| 332 | batch[++i] = 0; |
| 333 | batch[++i] = store.offset + loc; |
| 334 | } else { |
| 335 | batch[i]--; |
| 336 | batch[++i] = store.offset + loc; |
| 337 | } |
| 338 | batch[++i] = 0xc0ffee; |
| 339 | igt_assert(loc == sizeof(uint32_t) * i); |
| 340 | batch[++i] = MI_BATCH_BUFFER_END; |
Chris Wilson | 3e76584 | 2016-07-02 11:51:29 +0100 | [diff] [blame] | 341 | |
Chris Wilson | 587753b | 2016-09-12 16:06:48 +0100 | [diff] [blame] | 342 | if (flags & CONTEXTS) { |
Chris Wilson | fe97e03 | 2017-03-23 10:48:32 +0000 | [diff] [blame] | 343 | for (n = 0; n < 64; n++) |
Chris Wilson | 587753b | 2016-09-12 16:06:48 +0100 | [diff] [blame] | 344 | contexts[n] = gem_context_create(fd); |
| 345 | } |
| 346 | if (flags & FDS) { |
Chris Wilson | 587753b | 2016-09-12 16:06:48 +0100 | [diff] [blame] | 347 | for (n = 0; n < 64; n++) |
| 348 | fds[n] = drm_open_driver(DRIVER_INTEL); |
| 349 | } |
Chris Wilson | 5615ab2 | 2016-03-11 10:48:47 +0000 | [diff] [blame] | 350 | |
Chris Wilson | 587753b | 2016-09-12 16:06:48 +0100 | [diff] [blame] | 351 | memset(batches, 0, sizeof(batches)); |
| 352 | for (n = 0; n < 1024; n++) { |
| 353 | batches[n].handle = gem_create(fd, 4096); |
| 354 | gem_write(fd, batches[n].handle, 0, &bbe, sizeof(bbe)); |
| 355 | } |
Chris Wilson | 4de67b2 | 2017-01-02 11:05:21 +0000 | [diff] [blame] | 356 | execbuf.buffers_ptr = to_user_pointer(batches); |
Chris Wilson | 587753b | 2016-09-12 16:06:48 +0100 | [diff] [blame] | 357 | execbuf.buffer_count = 1024; |
| 358 | gem_execbuf(fd, &execbuf); |
Chris Wilson | 5615ab2 | 2016-03-11 10:48:47 +0000 | [diff] [blame] | 359 | |
Chris Wilson | 4de67b2 | 2017-01-02 11:05:21 +0000 | [diff] [blame] | 360 | execbuf.buffers_ptr = to_user_pointer(tmp); |
Chris Wilson | 587753b | 2016-09-12 16:06:48 +0100 | [diff] [blame] | 361 | execbuf.buffer_count = 2; |
Chris Wilson | 5615ab2 | 2016-03-11 10:48:47 +0000 | [diff] [blame] | 362 | |
Chris Wilson | 587753b | 2016-09-12 16:06:48 +0100 | [diff] [blame] | 363 | old_offset = store.offset; |
| 364 | for (n = 0; n < 1024; n++) { |
Chris Wilson | 83cfed8 | 2016-03-19 14:21:34 +0000 | [diff] [blame] | 365 | if (gen >= 8) { |
Chris Wilson | 587753b | 2016-09-12 16:06:48 +0100 | [diff] [blame] | 366 | batch[1] = old_offset + loc; |
| 367 | batch[2] = (old_offset + loc) >> 32; |
Chris Wilson | 83cfed8 | 2016-03-19 14:21:34 +0000 | [diff] [blame] | 368 | } else if (gen >= 4) { |
Chris Wilson | 587753b | 2016-09-12 16:06:48 +0100 | [diff] [blame] | 369 | batch[2] = old_offset + loc; |
Chris Wilson | 83cfed8 | 2016-03-19 14:21:34 +0000 | [diff] [blame] | 370 | } else { |
Chris Wilson | 587753b | 2016-09-12 16:06:48 +0100 | [diff] [blame] | 371 | batch[1] = old_offset + loc; |
Chris Wilson | 9eacbd2 | 2016-03-11 14:31:56 +0000 | [diff] [blame] | 372 | } |
| 373 | |
Chris Wilson | 587753b | 2016-09-12 16:06:48 +0100 | [diff] [blame] | 374 | inter[n] = reloc; |
| 375 | inter[n].presumed_offset = old_offset; |
| 376 | inter[n].delta = loc; |
Chris Wilson | 4de67b2 | 2017-01-02 11:05:21 +0000 | [diff] [blame] | 377 | batches[n].relocs_ptr = to_user_pointer(&inter[n]); |
Chris Wilson | 587753b | 2016-09-12 16:06:48 +0100 | [diff] [blame] | 378 | batches[n].relocation_count = 1; |
| 379 | gem_write(fd, batches[n].handle, 0, batch, sizeof(batch)); |
Chris Wilson | 83cfed8 | 2016-03-19 14:21:34 +0000 | [diff] [blame] | 380 | |
Chris Wilson | 587753b | 2016-09-12 16:06:48 +0100 | [diff] [blame] | 381 | old_offset = batches[n].offset; |
| 382 | } |
Chris Wilson | 83cfed8 | 2016-03-19 14:21:34 +0000 | [diff] [blame] | 383 | |
Chris Wilson | 587753b | 2016-09-12 16:06:48 +0100 | [diff] [blame] | 384 | igt_while_interruptible(flags & INTERRUPTIBLE) { |
| 385 | for (pass = 0; pass < 1024; pass++) { |
| 386 | uint64_t offset; |
Chris Wilson | 83cfed8 | 2016-03-19 14:21:34 +0000 | [diff] [blame] | 387 | |
Chris Wilson | 125e27e | 2016-10-05 17:25:20 +0100 | [diff] [blame] | 388 | if (!(flags & FORKED)) |
Chris Wilson | 58de785 | 2017-03-24 18:11:08 +0000 | [diff] [blame] | 389 | write_seqno(debugfs, pass); |
Chris Wilson | 83cfed8 | 2016-03-19 14:21:34 +0000 | [diff] [blame] | 390 | |
Chris Wilson | 1a76d88 | 2016-10-01 16:50:51 +0100 | [diff] [blame] | 391 | if (flags & HANG) |
Chris Wilson | 38dc158 | 2017-04-05 17:09:15 +0100 | [diff] [blame] | 392 | submit_hang(&hang, engines, nengine, flags); |
Chris Wilson | 1a76d88 | 2016-10-01 16:50:51 +0100 | [diff] [blame] | 393 | |
Chris Wilson | 587753b | 2016-09-12 16:06:48 +0100 | [diff] [blame] | 394 | if (flags & CHAIN) { |
Chris Wilson | 7b34c51 | 2016-06-04 16:12:28 +0100 | [diff] [blame] | 395 | execbuf.flags &= ~ENGINE_MASK; |
| 396 | execbuf.flags |= engines[rand() % nengine]; |
| 397 | } |
Chris Wilson | 587753b | 2016-09-12 16:06:48 +0100 | [diff] [blame] | 398 | |
| 399 | reloc.presumed_offset = scratch.offset; |
| 400 | reloc.delta = 4*pass; |
| 401 | offset = reloc.presumed_offset + reloc.delta; |
| 402 | |
| 403 | i = 0; |
| 404 | if (gen >= 8) { |
| 405 | batch[++i] = offset; |
| 406 | batch[++i] = offset >> 32; |
| 407 | } else if (gen >= 4) { |
| 408 | batch[++i] = 0; |
| 409 | batch[++i] = offset; |
| 410 | } else { |
| 411 | batch[++i] = offset; |
| 412 | } |
| 413 | batch[++i] = ~pass; |
| 414 | gem_write(fd, store.handle, 0, batch, sizeof(batch)); |
| 415 | |
| 416 | tmp[0] = scratch; |
| 417 | igt_assert(tmp[0].flags & EXEC_OBJECT_WRITE); |
| 418 | tmp[1] = store; |
| 419 | verify_reloc(fd, store.handle, &reloc); |
Chris Wilson | 4de67b2 | 2017-01-02 11:05:21 +0000 | [diff] [blame] | 420 | execbuf.buffers_ptr = to_user_pointer(tmp); |
Chris Wilson | 587753b | 2016-09-12 16:06:48 +0100 | [diff] [blame] | 421 | gem_execbuf(fd, &execbuf); |
| 422 | igt_assert_eq_u64(reloc.presumed_offset, tmp[0].offset); |
Chris Wilson | 38dc158 | 2017-04-05 17:09:15 +0100 | [diff] [blame] | 423 | if (flags & SYNC) |
| 424 | gem_sync(fd, tmp[0].handle); |
Chris Wilson | 587753b | 2016-09-12 16:06:48 +0100 | [diff] [blame] | 425 | scratch = tmp[0]; |
| 426 | |
| 427 | gem_write(fd, batches[1023].handle, loc, &pass, sizeof(pass)); |
| 428 | for (n = 1024; --n >= 1; ) { |
| 429 | int this_fd = fd; |
| 430 | uint32_t handle[2]; |
| 431 | |
Chris Wilson | 4de67b2 | 2017-01-02 11:05:21 +0000 | [diff] [blame] | 432 | execbuf.buffers_ptr = to_user_pointer(&batches[n-1]); |
Chris Wilson | 587753b | 2016-09-12 16:06:48 +0100 | [diff] [blame] | 433 | reloc_migrations += batches[n-1].offset != inter[n].presumed_offset; |
| 434 | batches[n-1].offset = inter[n].presumed_offset; |
| 435 | old_offset = inter[n].presumed_offset; |
| 436 | batches[n-1].relocation_count = 0; |
| 437 | batches[n-1].flags |= EXEC_OBJECT_WRITE; |
| 438 | verify_reloc(fd, batches[n].handle, &inter[n]); |
| 439 | |
| 440 | if (flags & FDS) { |
| 441 | this_fd = fds[rand() % 64]; |
| 442 | handle[0] = batches[n-1].handle; |
| 443 | handle[1] = batches[n].handle; |
| 444 | batches[n-1].handle = |
| 445 | gem_open(this_fd, |
| 446 | gem_flink(fd, handle[0])); |
| 447 | batches[n].handle = |
| 448 | gem_open(this_fd, |
| 449 | gem_flink(fd, handle[1])); |
Chris Wilson | c117213 | 2017-09-24 17:14:36 +0100 | [diff] [blame] | 450 | if (flags & PRIORITY) |
| 451 | ctx_set_priority(this_fd, 0); |
Chris Wilson | 587753b | 2016-09-12 16:06:48 +0100 | [diff] [blame] | 452 | } |
| 453 | |
| 454 | if (!(flags & CHAIN)) { |
| 455 | execbuf.flags &= ~ENGINE_MASK; |
| 456 | execbuf.flags |= engines[rand() % nengine]; |
| 457 | } |
Chris Wilson | c117213 | 2017-09-24 17:14:36 +0100 | [diff] [blame] | 458 | if (flags & CONTEXTS) { |
Chris Wilson | 587753b | 2016-09-12 16:06:48 +0100 | [diff] [blame] | 459 | execbuf.rsvd1 = contexts[rand() % 64]; |
Chris Wilson | c117213 | 2017-09-24 17:14:36 +0100 | [diff] [blame] | 460 | if (flags & PRIORITY) |
| 461 | ctx_set_priority(this_fd, execbuf.rsvd1); |
| 462 | } |
| 463 | |
Chris Wilson | 587753b | 2016-09-12 16:06:48 +0100 | [diff] [blame] | 464 | gem_execbuf(this_fd, &execbuf); |
| 465 | if (inter[n].presumed_offset == -1) { |
| 466 | reloc_interruptions++; |
| 467 | inter[n].presumed_offset = batches[n-1].offset; |
| 468 | } |
| 469 | igt_assert_eq_u64(inter[n].presumed_offset, batches[n-1].offset); |
Chris Wilson | 38dc158 | 2017-04-05 17:09:15 +0100 | [diff] [blame] | 470 | |
| 471 | if (flags & SYNC) |
| 472 | gem_sync(this_fd, batches[n-1].handle); |
Chris Wilson | 587753b | 2016-09-12 16:06:48 +0100 | [diff] [blame] | 473 | relocations += inter[n].presumed_offset != old_offset; |
| 474 | |
| 475 | batches[n-1].relocation_count = 1; |
| 476 | batches[n-1].flags &= ~EXEC_OBJECT_WRITE; |
| 477 | |
| 478 | if (this_fd != fd) { |
| 479 | gem_close(this_fd, batches[n-1].handle); |
| 480 | batches[n-1].handle = handle[0]; |
| 481 | |
| 482 | gem_close(this_fd, batches[n].handle); |
| 483 | batches[n].handle = handle[1]; |
| 484 | } |
| 485 | } |
| 486 | execbuf.flags &= ~ENGINE_MASK; |
| 487 | execbuf.rsvd1 = 0; |
Chris Wilson | 4de67b2 | 2017-01-02 11:05:21 +0000 | [diff] [blame] | 488 | execbuf.buffers_ptr = to_user_pointer(&tmp); |
Chris Wilson | 587753b | 2016-09-12 16:06:48 +0100 | [diff] [blame] | 489 | |
| 490 | tmp[0] = tmp[1]; |
| 491 | tmp[0].relocation_count = 0; |
| 492 | tmp[0].flags = EXEC_OBJECT_WRITE; |
| 493 | reloc_migrations += tmp[0].offset != inter[0].presumed_offset; |
| 494 | tmp[0].offset = inter[0].presumed_offset; |
| 495 | old_offset = tmp[0].offset; |
| 496 | tmp[1] = batches[0]; |
| 497 | verify_reloc(fd, batches[0].handle, &inter[0]); |
| 498 | gem_execbuf(fd, &execbuf); |
| 499 | if (inter[0].presumed_offset == -1) { |
Chris Wilson | 5dcb026 | 2016-03-26 09:48:16 +0000 | [diff] [blame] | 500 | reloc_interruptions++; |
Chris Wilson | 587753b | 2016-09-12 16:06:48 +0100 | [diff] [blame] | 501 | inter[0].presumed_offset = tmp[0].offset; |
Chris Wilson | 5dcb026 | 2016-03-26 09:48:16 +0000 | [diff] [blame] | 502 | } |
Chris Wilson | 587753b | 2016-09-12 16:06:48 +0100 | [diff] [blame] | 503 | igt_assert_eq_u64(inter[0].presumed_offset, tmp[0].offset); |
| 504 | relocations += inter[0].presumed_offset != old_offset; |
| 505 | batches[0] = tmp[1]; |
Chris Wilson | 83cfed8 | 2016-03-19 14:21:34 +0000 | [diff] [blame] | 506 | |
Chris Wilson | 587753b | 2016-09-12 16:06:48 +0100 | [diff] [blame] | 507 | tmp[1] = tmp[0]; |
| 508 | tmp[0] = scratch; |
| 509 | igt_assert(tmp[0].flags & EXEC_OBJECT_WRITE); |
| 510 | igt_assert_eq_u64(reloc.presumed_offset, tmp[0].offset); |
Chris Wilson | 4de67b2 | 2017-01-02 11:05:21 +0000 | [diff] [blame] | 511 | igt_assert(tmp[1].relocs_ptr == to_user_pointer(&reloc)); |
Chris Wilson | 587753b | 2016-09-12 16:06:48 +0100 | [diff] [blame] | 512 | tmp[1].relocation_count = 1; |
| 513 | tmp[1].flags &= ~EXEC_OBJECT_WRITE; |
| 514 | verify_reloc(fd, store.handle, &reloc); |
| 515 | gem_execbuf(fd, &execbuf); |
| 516 | eb_migrations += tmp[0].offset != scratch.offset; |
| 517 | eb_migrations += tmp[1].offset != store.offset; |
| 518 | igt_assert_eq_u64(reloc.presumed_offset, tmp[0].offset); |
Chris Wilson | 38dc158 | 2017-04-05 17:09:15 +0100 | [diff] [blame] | 519 | if (flags & SYNC) |
| 520 | gem_sync(fd, tmp[0].handle); |
| 521 | |
Chris Wilson | 587753b | 2016-09-12 16:06:48 +0100 | [diff] [blame] | 522 | store = tmp[1]; |
| 523 | scratch = tmp[0]; |
Chris Wilson | 83cfed8 | 2016-03-19 14:21:34 +0000 | [diff] [blame] | 524 | } |
Chris Wilson | 6291678 | 2016-03-11 14:16:13 +0000 | [diff] [blame] | 525 | } |
Chris Wilson | 587753b | 2016-09-12 16:06:48 +0100 | [diff] [blame] | 526 | igt_info("Number of migrations for execbuf: %d\n", eb_migrations); |
| 527 | igt_info("Number of migrations for reloc: %d, interrupted %d, patched %d\n", reloc_migrations, reloc_interruptions, relocations); |
Chris Wilson | 5615ab2 | 2016-03-11 10:48:47 +0000 | [diff] [blame] | 528 | |
Chris Wilson | 587753b | 2016-09-12 16:06:48 +0100 | [diff] [blame] | 529 | check_bo(fd, scratch.handle); |
| 530 | gem_close(fd, scratch.handle); |
| 531 | gem_close(fd, store.handle); |
| 532 | |
| 533 | if (flags & FDS) { |
| 534 | for (n = 0; n < 64; n++) |
| 535 | close(fds[n]); |
| 536 | } |
| 537 | if (flags & CONTEXTS) { |
| 538 | for (n = 0; n < 64; n++) |
| 539 | gem_context_destroy(fd, contexts[n]); |
| 540 | } |
| 541 | for (n = 0; n < 1024; n++) |
| 542 | gem_close(fd, batches[n].handle); |
| 543 | } |
| 544 | |
| 545 | igt_waitchildren(); |
Chris Wilson | 1a76d88 | 2016-10-01 16:50:51 +0100 | [diff] [blame] | 546 | |
| 547 | if (flags & HANG) |
| 548 | fini_hang(&hang); |
| 549 | else |
| 550 | igt_assert_eq(intel_detect_and_clear_missed_interrupts(fd), 0); |
Chris Wilson | 58de785 | 2017-03-24 18:11:08 +0000 | [diff] [blame] | 551 | |
| 552 | close(debugfs); |
Chris Wilson | 5615ab2 | 2016-03-11 10:48:47 +0000 | [diff] [blame] | 553 | } |
| 554 | |
Chris Wilson | c6e26e4 | 2016-07-22 12:58:54 +0100 | [diff] [blame] | 555 | static void print_welcome(int fd) |
| 556 | { |
| 557 | bool active; |
Chris Wilson | c6e26e4 | 2016-07-22 12:58:54 +0100 | [diff] [blame] | 558 | int dir; |
| 559 | |
| 560 | dir = igt_sysfs_open_parameters(fd); |
| 561 | if (dir < 0) |
| 562 | return; |
| 563 | |
Chris Wilson | b64d10c | 2016-07-22 17:53:51 +0100 | [diff] [blame] | 564 | active = igt_sysfs_get_boolean(dir, "enable_guc_submission"); |
Chris Wilson | c6e26e4 | 2016-07-22 12:58:54 +0100 | [diff] [blame] | 565 | if (active) { |
| 566 | igt_info("Using GuC submission\n"); |
| 567 | goto out; |
| 568 | } |
| 569 | |
Chris Wilson | b64d10c | 2016-07-22 17:53:51 +0100 | [diff] [blame] | 570 | active = igt_sysfs_get_boolean(dir, "enable_execlists"); |
Chris Wilson | c6e26e4 | 2016-07-22 12:58:54 +0100 | [diff] [blame] | 571 | if (active) { |
| 572 | igt_info("Using Execlists submission\n"); |
| 573 | goto out; |
| 574 | } |
| 575 | |
Chris Wilson | b64d10c | 2016-07-22 17:53:51 +0100 | [diff] [blame] | 576 | active = igt_sysfs_get_boolean(dir, "semaphores"); |
Chris Wilson | f565b6c | 2016-09-08 20:59:55 +0100 | [diff] [blame] | 577 | igt_info("Using Legacy submission%s\n", |
Chris Wilson | c6e26e4 | 2016-07-22 12:58:54 +0100 | [diff] [blame] | 578 | active ? ", with semaphores" : ""); |
| 579 | |
| 580 | out: |
| 581 | close(dir); |
| 582 | } |
| 583 | |
Chris Wilson | 5615ab2 | 2016-03-11 10:48:47 +0000 | [diff] [blame] | 584 | igt_main |
| 585 | { |
Chris Wilson | 83cfed8 | 2016-03-19 14:21:34 +0000 | [diff] [blame] | 586 | const struct mode { |
| 587 | const char *name; |
| 588 | unsigned flags; |
| 589 | } modes[] = { |
Chris Wilson | 2b4c35e | 2016-05-20 11:20:49 +0100 | [diff] [blame] | 590 | { "normal", 0 }, |
Chris Wilson | 1a722fa | 2016-03-26 10:54:43 +0000 | [diff] [blame] | 591 | { "interruptible", INTERRUPTIBLE }, |
Chris Wilson | 587753b | 2016-09-12 16:06:48 +0100 | [diff] [blame] | 592 | { "forked", FORKED }, |
Chris Wilson | 38dc158 | 2017-04-05 17:09:15 +0100 | [diff] [blame] | 593 | { "sync", SYNC }, |
Chris Wilson | 7b34c51 | 2016-06-04 16:12:28 +0100 | [diff] [blame] | 594 | { "chain", CHAIN }, |
Chris Wilson | 587753b | 2016-09-12 16:06:48 +0100 | [diff] [blame] | 595 | { "chain-forked", CHAIN | FORKED }, |
| 596 | { "chain-interruptible", CHAIN | INTERRUPTIBLE }, |
Chris Wilson | 38dc158 | 2017-04-05 17:09:15 +0100 | [diff] [blame] | 597 | { "chain-sync", CHAIN | SYNC }, |
Chris Wilson | 83cfed8 | 2016-03-19 14:21:34 +0000 | [diff] [blame] | 598 | { "contexts", CONTEXTS }, |
| 599 | { "contexts-interruptible", CONTEXTS | INTERRUPTIBLE}, |
Chris Wilson | 587753b | 2016-09-12 16:06:48 +0100 | [diff] [blame] | 600 | { "contexts-forked", CONTEXTS | FORKED}, |
Chris Wilson | c117213 | 2017-09-24 17:14:36 +0100 | [diff] [blame] | 601 | { "contexts-priority", CONTEXTS | FORKED | PRIORITY }, |
Chris Wilson | 7b34c51 | 2016-06-04 16:12:28 +0100 | [diff] [blame] | 602 | { "contexts-chain", CONTEXTS | CHAIN }, |
Chris Wilson | 38dc158 | 2017-04-05 17:09:15 +0100 | [diff] [blame] | 603 | { "contexts-sync", CONTEXTS | SYNC }, |
Chris Wilson | 83cfed8 | 2016-03-19 14:21:34 +0000 | [diff] [blame] | 604 | { "fds", FDS }, |
| 605 | { "fds-interruptible", FDS | INTERRUPTIBLE}, |
Chris Wilson | 587753b | 2016-09-12 16:06:48 +0100 | [diff] [blame] | 606 | { "fds-forked", FDS | FORKED}, |
Chris Wilson | c117213 | 2017-09-24 17:14:36 +0100 | [diff] [blame] | 607 | { "fds-priority", FDS | FORKED | PRIORITY }, |
Chris Wilson | 7b34c51 | 2016-06-04 16:12:28 +0100 | [diff] [blame] | 608 | { "fds-chain", FDS | CHAIN}, |
Chris Wilson | 38dc158 | 2017-04-05 17:09:15 +0100 | [diff] [blame] | 609 | { "fds-sync", FDS | SYNC}, |
Chris Wilson | 83cfed8 | 2016-03-19 14:21:34 +0000 | [diff] [blame] | 610 | { NULL } |
| 611 | }; |
Chris Wilson | 5615ab2 | 2016-03-11 10:48:47 +0000 | [diff] [blame] | 612 | int fd; |
| 613 | |
Daniel Vetter | be21fc0 | 2016-06-17 16:04:09 +0200 | [diff] [blame] | 614 | igt_fixture { |
Chris Wilson | 5615ab2 | 2016-03-11 10:48:47 +0000 | [diff] [blame] | 615 | fd = drm_open_driver_master(DRIVER_INTEL); |
Chris Wilson | 9518cb5 | 2017-02-22 15:24:54 +0000 | [diff] [blame] | 616 | igt_require_gem(fd); |
Chris Wilson | bc78776 | 2017-05-18 12:11:59 +0100 | [diff] [blame] | 617 | igt_require(gem_can_store_dword(fd, 0)); |
Chris Wilson | c6e26e4 | 2016-07-22 12:58:54 +0100 | [diff] [blame] | 618 | print_welcome(fd); |
Chris Wilson | 5615ab2 | 2016-03-11 10:48:47 +0000 | [diff] [blame] | 619 | |
Daniel Vetter | be21fc0 | 2016-06-17 16:04:09 +0200 | [diff] [blame] | 620 | igt_fork_hang_detector(fd); |
| 621 | } |
Chris Wilson | 756f3e0 | 2016-03-22 11:33:41 +0000 | [diff] [blame] | 622 | |
Chris Wilson | 83cfed8 | 2016-03-19 14:21:34 +0000 | [diff] [blame] | 623 | for (const struct mode *m = modes; m->name; m++) |
Chris Wilson | 2b4c35e | 2016-05-20 11:20:49 +0100 | [diff] [blame] | 624 | igt_subtest_f("%s", m->name) |
Chris Wilson | 83cfed8 | 2016-03-19 14:21:34 +0000 | [diff] [blame] | 625 | whisper(fd, -1, m->flags); |
Chris Wilson | 2fdf5ac | 2016-03-14 13:41:15 +0000 | [diff] [blame] | 626 | |
| 627 | for (const struct intel_execution_engine *e = intel_execution_engines; |
| 628 | e->name; e++) { |
Chris Wilson | 7b34c51 | 2016-06-04 16:12:28 +0100 | [diff] [blame] | 629 | for (const struct mode *m = modes; m->name; m++) { |
| 630 | if (m->flags & CHAIN) |
| 631 | continue; |
| 632 | |
Chris Wilson | 2b4c35e | 2016-05-20 11:20:49 +0100 | [diff] [blame] | 633 | igt_subtest_f("%s-%s", e->name, m->name) |
Chris Wilson | 83cfed8 | 2016-03-19 14:21:34 +0000 | [diff] [blame] | 634 | whisper(fd, e->exec_id | e->flags, m->flags); |
Chris Wilson | 7b34c51 | 2016-06-04 16:12:28 +0100 | [diff] [blame] | 635 | } |
Chris Wilson | 2fdf5ac | 2016-03-14 13:41:15 +0000 | [diff] [blame] | 636 | } |
Chris Wilson | 9eacbd2 | 2016-03-11 14:31:56 +0000 | [diff] [blame] | 637 | |
Daniel Vetter | be21fc0 | 2016-06-17 16:04:09 +0200 | [diff] [blame] | 638 | igt_fixture { |
| 639 | igt_stop_hang_detector(); |
Chris Wilson | 1a76d88 | 2016-10-01 16:50:51 +0100 | [diff] [blame] | 640 | } |
| 641 | |
| 642 | igt_subtest_group { |
| 643 | for (const struct mode *m = modes; m->name; m++) { |
| 644 | if (m->flags & INTERRUPTIBLE) |
| 645 | continue; |
| 646 | igt_subtest_f("hang-%s", m->name) |
| 647 | whisper(fd, -1, m->flags | HANG); |
| 648 | } |
| 649 | } |
| 650 | |
| 651 | igt_fixture { |
Chris Wilson | 5615ab2 | 2016-03-11 10:48:47 +0000 | [diff] [blame] | 652 | close(fd); |
Daniel Vetter | be21fc0 | 2016-06-17 16:04:09 +0200 | [diff] [blame] | 653 | } |
Chris Wilson | 5615ab2 | 2016-03-11 10:48:47 +0000 | [diff] [blame] | 654 | } |