Lines Matching refs:cork
476 static uint32_t plug_vgem_handle(struct igt_cork *cork, int fd) in plug_vgem_handle() argument
482 cork->vgem.device = drm_open_driver(DRIVER_VGEM); in plug_vgem_handle()
483 igt_require(vgem_has_fences(cork->vgem.device)); in plug_vgem_handle()
487 vgem_create(cork->vgem.device, &bo); in plug_vgem_handle()
488 cork->vgem.fence = vgem_fence_attach(cork->vgem.device, &bo, VGEM_FENCE_WRITE); in plug_vgem_handle()
490 dmabuf = prime_handle_to_fd(cork->vgem.device, bo.handle); in plug_vgem_handle()
497 static void unplug_vgem_handle(struct igt_cork *cork) in unplug_vgem_handle() argument
499 vgem_fence_signal(cork->vgem.device, cork->vgem.fence); in unplug_vgem_handle()
500 close(cork->vgem.device); in unplug_vgem_handle()
503 static uint32_t plug_sync_fd(struct igt_cork *cork) in plug_sync_fd() argument
509 cork->sw_sync.timeline = sw_sync_timeline_create(); in plug_sync_fd()
510 fence = sw_sync_timeline_create_fence(cork->sw_sync.timeline, 1); in plug_sync_fd()
515 static void unplug_sync_fd(struct igt_cork *cork) in unplug_sync_fd() argument
517 sw_sync_timeline_inc(cork->sw_sync.timeline, 1); in unplug_sync_fd()
518 close(cork->sw_sync.timeline); in unplug_sync_fd()
546 uint32_t igt_cork_plug(struct igt_cork *cork, int fd) in igt_cork_plug() argument
548 igt_assert(cork->fd == -1); in igt_cork_plug()
550 switch (cork->type) { in igt_cork_plug()
552 return plug_sync_fd(cork); in igt_cork_plug()
555 return plug_vgem_handle(cork, fd); in igt_cork_plug()
573 void igt_cork_unplug(struct igt_cork *cork) in igt_cork_unplug() argument
575 igt_assert(cork->fd != -1); in igt_cork_unplug()
577 switch (cork->type) { in igt_cork_unplug()
579 unplug_sync_fd(cork); in igt_cork_unplug()
583 unplug_vgem_handle(cork); in igt_cork_unplug()
590 cork->fd = -1; /* Reset cork */ in igt_cork_unplug()