Lines Matching refs:i915
55 static bool has_class_instance(int i915, uint16_t class, uint16_t instance) in has_class_instance() argument
69 list_engines(int i915, uint32_t class_mask, unsigned int *out) in list_engines() argument
86 if (!has_class_instance(i915, class, instance)) in list_engines()
112 static int __set_engines(int i915, uint32_t ctx, in __set_engines() argument
128 return __gem_context_set_param(i915, &p); in __set_engines()
131 static void set_engines(int i915, uint32_t ctx, in set_engines() argument
135 igt_assert_eq(__set_engines(i915, ctx, ci, count), 0); in set_engines()
138 static int __set_load_balancer(int i915, uint32_t ctx, in __set_load_balancer() argument
168 return __gem_context_set_param(i915, &p); in __set_load_balancer()
171 static void set_load_balancer(int i915, uint32_t ctx, in set_load_balancer() argument
176 igt_assert_eq(__set_load_balancer(i915, ctx, ci, count, ext), 0); in set_load_balancer()
179 static uint32_t load_balancer_create(int i915, in load_balancer_create() argument
185 ctx = gem_context_create(i915); in load_balancer_create()
186 set_load_balancer(i915, ctx, ci, count, NULL); in load_balancer_create()
191 static uint32_t __batch_create(int i915, uint32_t offset) in __batch_create() argument
196 handle = gem_create(i915, ALIGN(offset + 4, 4096)); in __batch_create()
197 gem_write(i915, handle, offset, &bbe, sizeof(bbe)); in __batch_create()
202 static uint32_t batch_create(int i915) in batch_create() argument
204 return __batch_create(i915, 0); in batch_create()
207 static void invalid_balancer(int i915) in invalid_balancer() argument
228 ci = list_engines(i915, 1 << class, &count); in invalid_balancer()
234 p.ctx_id = gem_context_create(i915); in invalid_balancer()
242 gem_context_set_param(i915, &p); in invalid_balancer()
245 igt_assert_eq(__gem_context_set_param(i915, &p), -EFAULT); in invalid_balancer()
248 igt_assert_eq(__gem_context_set_param(i915, &p), -EFAULT); in invalid_balancer()
256 gem_context_set_param(i915, &p); in invalid_balancer()
259 igt_assert_eq(__gem_context_set_param(i915, &p), -EEXIST); in invalid_balancer()
262 igt_assert_eq(__gem_context_set_param(i915, &p), -EEXIST); in invalid_balancer()
265 igt_assert_eq(__gem_context_set_param(i915, &p), -EINVAL); in invalid_balancer()
268 gem_context_set_param(i915, &p); in invalid_balancer()
271 igt_assert_eq(__gem_context_set_param(i915, &p), -EEXIST); in invalid_balancer()
274 igt_assert_eq(__gem_context_set_param(i915, &p), -EFAULT); in invalid_balancer()
276 handle = gem_create(i915, 4096 * 3); in invalid_balancer()
277 ptr = gem_mmap__gtt(i915, handle, 4096 * 3, PROT_WRITE); in invalid_balancer()
278 gem_close(i915, handle); in invalid_balancer()
288 gem_context_set_param(i915, &p); in invalid_balancer()
293 gem_context_set_param(i915, &p); in invalid_balancer()
300 gem_context_set_param(i915, &p); in invalid_balancer()
304 gem_context_set_param(i915, &p); in invalid_balancer()
307 igt_assert_eq(__gem_context_set_param(i915, &p), -EFAULT); in invalid_balancer()
309 igt_assert_eq(__gem_context_set_param(i915, &p), -EFAULT); in invalid_balancer()
312 gem_context_set_param(i915, &p); in invalid_balancer()
316 gem_context_set_param(i915, &p); in invalid_balancer()
319 igt_assert_eq(__gem_context_set_param(i915, &p), -EFAULT); in invalid_balancer()
321 igt_assert_eq(__gem_context_set_param(i915, &p), -EFAULT); in invalid_balancer()
325 gem_context_destroy(i915, p.ctx_id); in invalid_balancer()
330 static void invalid_bonds(int i915) in invalid_bonds() argument
335 .ctx_id = gem_context_create(i915), in invalid_bonds()
344 gem_context_set_param(i915, &p); in invalid_bonds()
354 gem_context_set_param(i915, &p); in invalid_bonds()
357 igt_assert_eq(__gem_context_set_param(i915, &p), -EFAULT); in invalid_bonds()
360 igt_assert_eq(__gem_context_set_param(i915, &p), -E2BIG); in invalid_bonds()
363 igt_assert_eq(__gem_context_set_param(i915, &p), -E2BIG); in invalid_bonds()
365 gem_context_set_param(i915, &p); in invalid_bonds()
367 handle = gem_create(i915, 4096 * 3); in invalid_bonds()
368 ptr = gem_mmap__gtt(i915, handle, 4096 * 3, PROT_WRITE); in invalid_bonds()
369 gem_close(i915, handle); in invalid_bonds()
373 gem_context_set_param(i915, &p); in invalid_bonds()
378 gem_context_set_param(i915, &p); in invalid_bonds()
381 igt_assert_eq(__gem_context_set_param(i915, &p), -EFAULT); in invalid_bonds()
387 gem_context_set_param(i915, &p); in invalid_bonds()
390 igt_assert_eq(__gem_context_set_param(i915, &p), -EFAULT); in invalid_bonds()
393 igt_assert_eq(__gem_context_set_param(i915, &p), -EFAULT); in invalid_bonds()
395 gem_context_destroy(i915, p.ctx_id); in invalid_bonds()
504 static void check_individual_engine(int i915, in check_individual_engine() argument
516 spin = igt_spin_new(i915, .ctx = ctx, .engine = idx + 1); in check_individual_engine()
518 igt_spin_free(i915, spin); in check_individual_engine()
527 static void individual(int i915) in individual() argument
539 ctx = gem_context_create(i915); in individual()
545 ci = list_engines(i915, 1u << class, &count); in individual()
552 set_load_balancer(i915, ctx, ci, count, NULL); in individual()
554 check_individual_engine(i915, ctx, ci, n); in individual()
560 gem_context_destroy(i915, ctx); in individual()
561 gem_quiescent_gpu(i915); in individual()
564 static void bonded(int i915, unsigned int flags) in bonded() argument
577 master = gem_queue_create(i915); in bonded()
593 siblings = list_engines(i915, 1u << class, &count); in bonded()
602 master_engines = list_engines(i915, ~(1u << class), &limit); in bonded()
603 set_engines(i915, master, master_engines, limit); in bonded()
612 ctx = gem_context_clone(i915, in bonded()
615 set_load_balancer(i915, ctx, siblings, count, &bonds[limit - 1]); in bonded()
643 plug = __igt_spin_new(i915, in bonded()
646 .dependency = igt_cork_plug(&cork, i915)); in bonded()
649 spin = __igt_spin_new(i915, in bonded()
658 gem_execbuf(i915, &eb); in bonded()
662 igt_spin_free(i915, plug); in bonded()
666 igt_spin_free(i915, spin); in bonded()
695 gem_context_destroy(i915, ctx); in bonded()
700 gem_context_destroy(i915, master); in bonded()
703 static void indices(int i915) in indices() argument
707 .ctx_id = gem_context_create(i915), in indices()
713 .handle = batch_create(i915), in indices()
728 ci = list_engines(i915, 1u << class, &count); in indices()
762 gem_context_set_param(i915, &p); in indices()
772 gem_execbuf(i915, &eb); in indices()
774 gem_context_destroy(i915, p.ctx_id); in indices()
776 gem_sync(i915, batch.handle); in indices()
777 gem_close(i915, batch.handle); in indices()
789 gem_quiescent_gpu(i915); in indices()
792 static void busy(int i915) in busy() argument
794 uint32_t scratch = gem_create(i915, 4096); in busy()
818 ci = list_engines(i915, 1u << class, &count); in busy()
822 ctx = load_balancer_create(i915, ci, count); in busy()
825 spin[0] = __igt_spin_new(i915, in busy()
828 spin[1] = __igt_spin_new(i915, in busy()
836 do_ioctl(i915, DRM_IOCTL_I915_GEM_BUSY, &busy); in busy()
841 do_ioctl(i915, DRM_IOCTL_I915_GEM_BUSY, &busy); in busy()
846 do_ioctl(i915, DRM_IOCTL_I915_GEM_BUSY, &busy); in busy()
850 igt_spin_free(i915, spin[1]); in busy()
851 igt_spin_free(i915, spin[0]); in busy()
853 gem_context_destroy(i915, ctx); in busy()
856 gem_close(i915, scratch); in busy()
857 gem_quiescent_gpu(i915); in busy()
860 static void full(int i915, unsigned int flags) in full() argument
865 .handle = batch_create(i915), in full()
894 ci = list_engines(i915, 1u << class, &count); in full()
902 fence = igt_cork_plug(&cork, i915); in full()
917 gem_execbuf(i915, &eb); in full()
925 ctx = load_balancer_create(i915, ci, count); in full()
928 spin = __igt_spin_new(i915, .ctx = ctx); in full()
937 gem_execbuf(i915, &eb); in full()
940 gem_context_destroy(i915, ctx); in full()
949 igt_spin_free(i915, spin); in full()
959 gem_quiescent_gpu(i915); in full()
962 gem_close(i915, batch.handle); in full()
963 gem_quiescent_gpu(i915); in full()
966 static void nop(int i915) in nop() argument
969 .handle = batch_create(i915), in nop()
977 ci = list_engines(i915, 1u << class, &count); in nop()
981 ctx = load_balancer_create(i915, ci, count); in nop()
998 gem_execbuf(i915, &execbuf); in nop()
1001 gem_sync(i915, batch.handle); in nop()
1021 gem_execbuf(i915, &execbuf); in nop()
1024 gem_sync(i915, batch.handle); in nop()
1036 .rsvd1 = gem_context_clone(i915, ctx, in nop()
1047 gem_execbuf(i915, &execbuf); in nop()
1050 gem_sync(i915, batch.handle); in nop()
1063 gem_execbuf(i915, &execbuf); in nop()
1066 gem_sync(i915, batch.handle); in nop()
1072 gem_context_destroy(i915, execbuf.rsvd1); in nop()
1077 gem_context_destroy(i915, ctx); in nop()
1081 gem_close(i915, batch.handle); in nop()
1082 gem_quiescent_gpu(i915); in nop()
1085 static void ping(int i915, uint32_t ctx, unsigned int engine) in ping() argument
1088 .handle = batch_create(i915), in ping()
1096 gem_execbuf(i915, &execbuf); in ping()
1097 gem_sync(i915, obj.handle); in ping()
1098 gem_close(i915, obj.handle); in ping()
1101 static void semaphore(int i915) in semaphore() argument
1111 igt_require(gem_scheduler_has_preemption(i915)); in semaphore()
1113 block[0] = gem_context_create(i915); in semaphore()
1114 block[1] = gem_context_create(i915); in semaphore()
1116 scratch = gem_create(i915, 4096); in semaphore()
1117 spin[2] = igt_spin_new(i915, .dependency = scratch); in semaphore()
1123 ci = list_engines(i915, 1u << class, &count); in semaphore()
1134 set_load_balancer(i915, block[i], ci, count, NULL); in semaphore()
1135 spin[i] = __igt_spin_new(i915, in semaphore()
1144 vip = gem_context_create(i915); in semaphore()
1145 set_load_balancer(i915, vip, ci, count, NULL); in semaphore()
1146 ping(i915, vip, 0); in semaphore()
1147 gem_context_destroy(i915, vip); in semaphore()
1150 igt_spin_free(i915, spin[i]); in semaphore()
1154 igt_spin_free(i915, spin[2]); in semaphore()
1155 gem_close(i915, scratch); in semaphore()
1157 gem_context_destroy(i915, block[1]); in semaphore()
1158 gem_context_destroy(i915, block[0]); in semaphore()
1160 gem_quiescent_gpu(i915); in semaphore()
1163 static void smoketest(int i915, int timeout) in smoketest() argument
1166 { .handle = __batch_create(i915, 16380) } in smoketest()
1178 ci = list_engines(i915, 1u << class, &count); in smoketest()
1189 contexts[n] = load_balancer_create(i915, ci, count); in smoketest()
1208 handles[n] = gem_create(i915, 4096); in smoketest()
1213 int fence = igt_cork_plug(&cork, i915); in smoketest()
1224 gem_execbuf(i915, &eb); in smoketest()
1230 gem_sync(i915, handles[n]); in smoketest()
1236 gem_close(i915, handles[n]); in smoketest()
1237 __gem_context_destroy(i915, contexts[n]); in smoketest()
1241 gem_close(i915, batch[0].handle); in smoketest()
1244 static bool has_context_engines(int i915) in has_context_engines() argument
1250 return __gem_context_set_param(i915, &p) == 0; in has_context_engines()
1253 static bool has_load_balancer(int i915) in has_load_balancer() argument
1259 ctx = gem_context_create(i915); in has_load_balancer()
1260 err = __set_load_balancer(i915, ctx, &ci, 1, NULL); in has_load_balancer()
1261 gem_context_destroy(i915, ctx); in has_load_balancer()
1268 int i915 = -1; variable
1273 i915 = drm_open_driver(DRIVER_INTEL);
1274 igt_require_gem(i915);
1276 gem_require_contexts(i915);
1277 igt_require(has_context_engines(i915));
1278 igt_require(has_load_balancer(i915));
1280 igt_fork_hang_detector(i915);
1284 invalid_balancer(i915);
1287 invalid_bonds(i915);
1290 individual(i915);
1293 indices(i915);
1296 busy(i915);
1311 full(i915, p->flags);
1315 nop(i915);
1318 semaphore(i915);
1321 smoketest(i915, 20);
1324 bonded(i915, 0);
1327 bonded(i915, CORK);