Lines Matching refs:i915
29 static int ctx_create_ioctl(int i915, struct drm_i915_gem_context_create_ext *arg) in ctx_create_ioctl() argument
34 if (igt_ioctl(i915, DRM_IOCTL_I915_GEM_CONTEXT_CREATE_EXT, arg)) { in ctx_create_ioctl()
43 static bool has_ctx_clone(int i915) in has_ctx_clone() argument
53 return ctx_create_ioctl(i915, &create) == -ENOENT; in has_ctx_clone()
56 static void invalid_clone(int i915) in invalid_clone() argument
66 igt_assert_eq(ctx_create_ioctl(i915, &create), 0); in invalid_clone()
67 gem_context_destroy(i915, create.ctx_id); in invalid_clone()
70 igt_assert_eq(ctx_create_ioctl(i915, &create), -EINVAL); in invalid_clone()
74 igt_assert_eq(ctx_create_ioctl(i915, &create), -EFAULT); in invalid_clone()
76 igt_assert_eq(ctx_create_ioctl(i915, &create), -E2BIG); in invalid_clone()
80 igt_assert_eq(ctx_create_ioctl(i915, &create), -ENOENT); in invalid_clone()
84 static void clone_flags(int i915) in clone_flags() argument
101 igt_require(__gem_context_set_param(i915, &set.param) == 0); in clone_flags()
105 igt_assert_eq(ctx_create_ioctl(i915, &create), 0); in clone_flags()
108 gem_context_get_param(i915, &set.param); in clone_flags()
112 gem_context_get_param(i915, &set.param); in clone_flags()
118 gem_context_destroy(i915, create.ctx_id); in clone_flags()
122 gem_context_set_param(i915, &set.param); in clone_flags()
124 igt_assert_eq(ctx_create_ioctl(i915, &create), 0); in clone_flags()
127 gem_context_get_param(i915, &set.param); in clone_flags()
133 gem_context_destroy(i915, create.ctx_id); in clone_flags()
139 igt_assert_eq(ctx_create_ioctl(i915, &create), 0); in clone_flags()
144 gem_context_get_param(i915, &set.param); in clone_flags()
149 gem_context_get_param(i915, &set.param); in clone_flags()
152 gem_context_destroy(i915, create.ctx_id); in clone_flags()
153 ext.clone_id = gem_context_create(i915); in clone_flags()
156 gem_context_destroy(i915, ext.clone_id); in clone_flags()
159 static void clone_engines(int i915) in clone_engines() argument
180 igt_require(__gem_context_set_param(i915, &set.param) == 0); in clone_engines()
184 igt_assert_eq(ctx_create_ioctl(i915, &create), 0); in clone_engines()
190 gem_context_get_param(i915, &set.param); in clone_engines()
196 gem_context_get_param(i915, &set.param); in clone_engines()
202 gem_context_destroy(i915, create.ctx_id); in clone_engines()
215 gem_context_set_param(i915, &set.param); in clone_engines()
217 igt_assert_eq(ctx_create_ioctl(i915, &create), 0); in clone_engines()
222 gem_context_get_param(i915, &set.param); in clone_engines()
227 gem_context_destroy(i915, create.ctx_id); in clone_engines()
235 igt_assert_eq(ctx_create_ioctl(i915, &create), 0); in clone_engines()
241 gem_context_get_param(i915, &set.param); in clone_engines()
244 gem_context_destroy(i915, create.ctx_id); in clone_engines()
248 igt_assert_eq(ctx_create_ioctl(i915, &create), 0); in clone_engines()
254 gem_context_get_param(i915, &set.param); in clone_engines()
257 ext.clone_id = gem_context_create(i915); in clone_engines()
260 gem_context_destroy(i915, ext.clone_id); in clone_engines()
263 static void clone_scheduler(int i915) in clone_scheduler() argument
279 igt_require(__gem_context_set_param(i915, &set.param) == 0); in clone_scheduler()
283 igt_assert_eq(ctx_create_ioctl(i915, &create), 0); in clone_scheduler()
286 gem_context_get_param(i915, &set.param); in clone_scheduler()
290 gem_context_get_param(i915, &set.param); in clone_scheduler()
295 gem_context_destroy(i915, create.ctx_id); in clone_scheduler()
299 gem_context_set_param(i915, &set.param); in clone_scheduler()
301 igt_assert_eq(ctx_create_ioctl(i915, &create), 0); in clone_scheduler()
304 gem_context_get_param(i915, &set.param); in clone_scheduler()
309 gem_context_destroy(i915, create.ctx_id); in clone_scheduler()
315 igt_assert_eq(ctx_create_ioctl(i915, &create), 0); in clone_scheduler()
319 gem_context_get_param(i915, &set.param); in clone_scheduler()
323 gem_context_get_param(i915, &set.param); in clone_scheduler()
326 gem_context_destroy(i915, create.ctx_id); in clone_scheduler()
327 ext.clone_id = gem_context_create(i915); in clone_scheduler()
330 gem_context_destroy(i915, ext.clone_id); in clone_scheduler()
333 static uint32_t __batch_create(int i915, uint32_t offset) in __batch_create() argument
338 handle = gem_create(i915, ALIGN(offset + 4, 4096)); in __batch_create()
339 gem_write(i915, handle, offset, &bbe, sizeof(bbe)); in __batch_create()
344 static uint32_t batch_create(int i915) in batch_create() argument
346 return __batch_create(i915, 0); in batch_create()
349 static void check_same_vm(int i915, uint32_t ctx_a, uint32_t ctx_b) in check_same_vm() argument
352 .handle = batch_create(i915), in check_same_vm()
362 gem_execbuf(i915, &eb); in check_same_vm()
368 gem_execbuf(i915, &eb); in check_same_vm()
371 gem_sync(i915, batch.handle); in check_same_vm()
372 gem_close(i915, batch.handle); in check_same_vm()
374 gem_quiescent_gpu(i915); /* evict the vma */ in check_same_vm()
377 static void clone_vm(int i915) in clone_vm() argument
392 igt_require(__gem_context_set_param(i915, &set) == -ENOENT); in clone_vm()
395 i915 = gem_reopen_driver(i915); in clone_vm()
397 set.ctx_id = gem_context_create(i915); in clone_vm()
398 gem_context_get_param(i915, &set); in clone_vm()
400 gem_context_destroy(i915, set.ctx_id); in clone_vm()
402 vm_id[1] = gem_vm_create(i915); in clone_vm()
407 igt_assert_eq(ctx_create_ioctl(i915, &create), 0); in clone_vm()
408 check_same_vm(i915, ext.clone_id, create.ctx_id); in clone_vm()
409 gem_context_destroy(i915, create.ctx_id); in clone_vm()
413 gem_context_set_param(i915, &set); in clone_vm()
415 igt_assert_eq(ctx_create_ioctl(i915, &create), 0); in clone_vm()
416 check_same_vm(i915, ext.clone_id, create.ctx_id); in clone_vm()
417 gem_context_destroy(i915, create.ctx_id); in clone_vm()
419 ext.clone_id = gem_context_create(i915); in clone_vm()
422 gem_context_destroy(i915, ext.clone_id); in clone_vm()
425 gem_vm_destroy(i915, vm_id[i]); in clone_vm()
427 close(i915); in clone_vm()
432 int i915 = -1; variable
435 i915 = drm_open_driver(DRIVER_INTEL);
436 igt_require_gem(i915);
437 gem_require_contexts(i915);
439 igt_require(has_ctx_clone(i915));
440 igt_fork_hang_detector(i915);
444 invalid_clone(i915);
447 clone_engines(i915);
450 clone_flags(i915);
453 clone_scheduler(i915);
456 clone_vm(i915);
460 close(i915);