Lines Matching full:fd
89 int (*igt_ioctl)(int fd, unsigned long request, void *arg) = drmIoctl;
95 * @fd: open i915 drm file descriptor
105 gem_handle_to_libdrm_bo(drm_intel_bufmgr *bufmgr, int fd, const char *name, uint32_t handle) in gem_handle_to_libdrm_bo() argument
113 ret = ioctl(fd, DRM_IOCTL_GEM_FLINK, &flink); in gem_handle_to_libdrm_bo()
124 __gem_get_tiling(int fd, struct drm_i915_gem_get_tiling *arg) in __gem_get_tiling() argument
129 if (igt_ioctl(fd, DRM_IOCTL_I915_GEM_GET_TILING, arg)) in __gem_get_tiling()
138 * @fd: open i915 drm file descriptor
148 gem_get_tiling(int fd, uint32_t handle, uint32_t *tiling, uint32_t *swizzle) in gem_get_tiling() argument
155 igt_assert_eq(__gem_get_tiling(fd, &get_tiling), 0); in gem_get_tiling()
163 int __gem_set_tiling(int fd, uint32_t handle, uint32_t tiling, uint32_t stride) in __gem_set_tiling() argument
178 ret = ioctl(fd, DRM_IOCTL_I915_GEM_SET_TILING, &st); in __gem_set_tiling()
190 * @fd: open i915 drm file descriptor
197 void gem_set_tiling(int fd, uint32_t handle, uint32_t tiling, uint32_t stride) in gem_set_tiling() argument
199 igt_assert(__gem_set_tiling(fd, handle, tiling, stride) == 0); in gem_set_tiling()
202 int __gem_set_caching(int fd, uint32_t handle, uint32_t caching) in __gem_set_caching() argument
212 if (igt_ioctl(fd, DRM_IOCTL_I915_GEM_SET_CACHING, &arg)) in __gem_set_caching()
221 * @fd: open i915 drm file descriptor
230 void gem_set_caching(int fd, uint32_t handle, uint32_t caching) in gem_set_caching() argument
232 igt_require(__gem_set_caching(fd, handle, caching) == 0); in gem_set_caching()
237 * @fd: open i915 drm file descriptor
244 uint32_t gem_get_caching(int fd, uint32_t handle) in gem_get_caching() argument
251 ret = ioctl(fd, DRM_IOCTL_I915_GEM_GET_CACHING, &arg); in gem_get_caching()
260 * @fd: open i915 drm file descriptor
267 uint32_t gem_open(int fd, uint32_t name) in gem_open() argument
274 ret = ioctl(fd, DRM_IOCTL_GEM_OPEN, &open_struct); in gem_open()
284 * @fd: open i915 drm file descriptor
293 uint32_t gem_flink(int fd, uint32_t handle) in gem_flink() argument
300 ret = ioctl(fd, DRM_IOCTL_GEM_FLINK, &flink); in gem_flink()
309 * @fd: open i915 drm file descriptor
315 void gem_close(int fd, uint32_t handle) in gem_close() argument
323 do_ioctl(fd, DRM_IOCTL_GEM_CLOSE, &close_bo); in gem_close()
326 int __gem_write(int fd, uint32_t handle, uint64_t offset, const void *buf, uint64_t length) in __gem_write() argument
338 if (drmIoctl(fd, DRM_IOCTL_I915_GEM_PWRITE, &gem_pwrite)) in __gem_write()
345 * @fd: open i915 drm file descriptor
354 void gem_write(int fd, uint32_t handle, uint64_t offset, const void *buf, uint64_t length) in gem_write() argument
356 igt_assert_eq(__gem_write(fd, handle, offset, buf, length), 0); in gem_write()
359 static int __gem_read(int fd, uint32_t handle, uint64_t offset, void *buf, uint64_t length) in __gem_read() argument
371 if (drmIoctl(fd, DRM_IOCTL_I915_GEM_PREAD, &gem_pread)) in __gem_read()
377 * @fd: open i915 drm file descriptor
386 void gem_read(int fd, uint32_t handle, uint64_t offset, void *buf, uint64_t length) in gem_read() argument
388 igt_assert_eq(__gem_read(fd, handle, offset, buf, length), 0); in gem_read()
391 int __gem_set_domain(int fd, uint32_t handle, uint32_t read, uint32_t write) in __gem_set_domain() argument
402 if (igt_ioctl(fd, DRM_IOCTL_I915_GEM_SET_DOMAIN, &set_domain)) in __gem_set_domain()
410 * @fd: open i915 drm file descriptor
420 void gem_set_domain(int fd, uint32_t handle, uint32_t read, uint32_t write) in gem_set_domain() argument
422 igt_assert_eq(__gem_set_domain(fd, handle, read, write), 0); in gem_set_domain()
427 * @fd: open i915 drm file descriptor
435 int gem_wait(int fd, uint32_t handle, int64_t *timeout_ns) in gem_wait() argument
446 if (igt_ioctl(fd, DRM_IOCTL_I915_GEM_WAIT, &wait)) in gem_wait()
457 * @fd: open i915 drm file descriptor
462 void gem_sync(int fd, uint32_t handle) in gem_sync() argument
464 if (gem_wait(fd, handle, NULL)) in gem_sync()
465 gem_set_domain(fd, handle, in gem_sync()
472 bool gem_create__has_stolen_support(int fd) in gem_create__has_stolen_support() argument
484 ioctl(fd, DRM_IOCTL_I915_GETPARAM, &gp); in gem_create__has_stolen_support()
500 uint32_t __gem_create_stolen(int fd, uint64_t size) in __gem_create_stolen() argument
509 ret = igt_ioctl(fd, LOCAL_IOCTL_I915_GEM_CREATE, &create); in __gem_create_stolen()
520 * @fd: open i915 drm file descriptor
529 uint32_t gem_create_stolen(int fd, uint64_t size) in gem_create_stolen() argument
537 do_ioctl(fd, LOCAL_IOCTL_I915_GEM_CREATE, &create); in gem_create_stolen()
543 int __gem_create(int fd, uint64_t size, uint32_t *handle) in __gem_create() argument
550 if (igt_ioctl(fd, DRM_IOCTL_I915_GEM_CREATE, &create) == 0) { in __gem_create()
563 * @fd: open i915 drm file descriptor
571 uint32_t gem_create(int fd, uint64_t size) in gem_create() argument
575 igt_assert_eq(__gem_create(fd, size, &handle), 0); in gem_create()
582 * @fd: open i915 drm file descriptor
588 int __gem_execbuf(int fd, struct drm_i915_gem_execbuffer2 *execbuf) in __gem_execbuf() argument
591 if (igt_ioctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, execbuf)) { in __gem_execbuf()
601 * @fd: open i915 drm file descriptor
607 void gem_execbuf(int fd, struct drm_i915_gem_execbuffer2 *execbuf) in gem_execbuf() argument
609 igt_assert_eq(__gem_execbuf(fd, execbuf), 0); in gem_execbuf()
614 * @fd: open i915 drm file descriptor
620 int __gem_execbuf_wr(int fd, struct drm_i915_gem_execbuffer2 *execbuf) in __gem_execbuf_wr() argument
623 if (igt_ioctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2_WR, execbuf)) { in __gem_execbuf_wr()
633 * @fd: open i915 drm file descriptor
639 void gem_execbuf_wr(int fd, struct drm_i915_gem_execbuffer2 *execbuf) in gem_execbuf_wr() argument
641 igt_assert_eq(__gem_execbuf_wr(fd, execbuf), 0); in gem_execbuf_wr()
646 * @fd: open i915 drm file descriptor
658 int gem_madvise(int fd, uint32_t handle, int state) in gem_madvise() argument
666 do_ioctl(fd, DRM_IOCTL_I915_GEM_MADVISE, &madv); in gem_madvise()
671 int __gem_userptr(int fd, void *ptr, uint64_t size, int read_only, uint32_t flags, uint32_t *handle) in __gem_userptr() argument
682 if (igt_ioctl(fd, DRM_IOCTL_I915_GEM_USERPTR, &userptr)) in __gem_userptr()
691 * @fd: open i915 drm file descriptor
700 void gem_userptr(int fd, void *ptr, uint64_t size, int read_only, uint32_t flags, uint32_t *handle) in gem_userptr() argument
702 igt_assert_eq(__gem_userptr(fd, ptr, size, read_only, flags, handle), 0); in gem_userptr()
707 * @fd: open i915 drm file descriptor
714 void gem_sw_finish(int fd, uint32_t handle) in gem_sw_finish() argument
721 do_ioctl(fd, DRM_IOCTL_I915_GEM_SW_FINISH, &finish); in gem_sw_finish()
726 * @fd: open i915 drm file descriptor
734 bool gem_bo_busy(int fd, uint32_t handle) in gem_bo_busy() argument
741 do_ioctl(fd, DRM_IOCTL_I915_GEM_BUSY, &busy); in gem_bo_busy()
751 * @fd: open i915 drm file descriptor
760 static int gem_gtt_type(int fd) in gem_gtt_type() argument
769 if (ioctl(fd, DRM_IOCTL_I915_GETPARAM, &gp, sizeof(gp))) in gem_gtt_type()
778 * @fd: open i915 drm file descriptor
785 bool gem_uses_ppgtt(int fd) in gem_uses_ppgtt() argument
787 return gem_gtt_type(fd) > 0; in gem_uses_ppgtt()
792 * @fd: open i915 drm file descriptor
800 bool gem_uses_full_ppgtt(int fd) in gem_uses_full_ppgtt() argument
802 return gem_gtt_type(fd) > 1; in gem_uses_full_ppgtt()
807 * @fd: open i915 drm file descriptor
814 int gem_gpu_reset_type(int fd) in gem_gpu_reset_type() argument
822 drmIoctl(fd, DRM_IOCTL_I915_GETPARAM, &gp); in gem_gpu_reset_type()
829 * @fd: open i915 drm file descriptor
837 bool gem_gpu_reset_enabled(int fd) in gem_gpu_reset_enabled() argument
839 return gem_gpu_reset_type(fd) > 0; in gem_gpu_reset_enabled()
844 * @fd: open i915 drm file descriptor
851 bool gem_engine_reset_enabled(int fd) in gem_engine_reset_enabled() argument
853 return gem_gpu_reset_type(fd) > 1; in gem_engine_reset_enabled()
858 * @fd: open i915 drm file descriptor
865 int gem_available_fences(int fd) in gem_available_fences() argument
877 ioctl(fd, DRM_IOCTL_I915_GETPARAM, &gp, sizeof(gp)); in gem_available_fences()
884 bool gem_has_llc(int fd) in gem_has_llc() argument
896 ioctl(fd, DRM_IOCTL_I915_GETPARAM, &gp, sizeof(gp)); in gem_has_llc()
903 static bool has_param(int fd, int param) in has_param() argument
912 if (igt_ioctl(fd, DRM_IOCTL_I915_GETPARAM, &gp)) in has_param()
921 * @fd: open i915 drm file descriptor
929 bool gem_has_bsd(int fd) in gem_has_bsd() argument
933 has_bsd = has_param(fd, I915_PARAM_HAS_BSD); in gem_has_bsd()
939 * @fd: open i915 drm file descriptor
947 bool gem_has_blt(int fd) in gem_has_blt() argument
951 has_blt = has_param(fd, I915_PARAM_HAS_BLT); in gem_has_blt()
957 * @fd: open i915 drm file descriptor
966 bool gem_has_vebox(int fd) in gem_has_vebox() argument
970 has_vebox = has_param(fd, I915_PARAM_HAS_VEBOX); in gem_has_vebox()
977 * @fd: open i915 drm file descriptor
985 bool gem_has_bsd2(int fd) in gem_has_bsd2() argument
989 has_bsd2 = has_param(fd, I915_PARAM_HAS_BSD2); in gem_has_bsd2()
1004 * @fd: open i915 drm file descriptor
1010 uint64_t gem_total_mappable_size(int fd) in gem_total_mappable_size() argument
1015 do_ioctl(fd, LOCAL_IOCTL_I915_GEM_GET_APERTURE, &aperture); in gem_total_mappable_size()
1022 * @fd: open i915 drm file descriptor
1028 uint64_t gem_total_stolen_size(int fd) in gem_total_stolen_size() argument
1033 do_ioctl(fd, LOCAL_IOCTL_I915_GEM_GET_APERTURE, &aperture); in gem_total_stolen_size()
1040 * @fd: open i915 drm file descriptor
1047 uint64_t gem_available_aperture_size(int fd) in gem_available_aperture_size() argument
1053 do_ioctl(fd, DRM_IOCTL_I915_GEM_GET_APERTURE, &aperture); in gem_available_aperture_size()
1060 * @fd: open i915 drm file descriptor
1066 uint64_t gem_aperture_size(int fd) in gem_aperture_size() argument
1075 if (__gem_context_get_param(fd, &p) == 0) { in gem_aperture_size()
1083 do_ioctl(fd, DRM_IOCTL_I915_GEM_GET_APERTURE, &aperture); in gem_aperture_size()
1118 * @fd: open i915 drm file descriptor
1125 uint64_t gem_global_aperture_size(int fd) in gem_global_aperture_size() argument
1131 do_ioctl(fd, DRM_IOCTL_I915_GEM_GET_APERTURE, &aperture); in gem_global_aperture_size()
1138 * @fd: open i915 drm file descriptor
1145 bool gem_has_softpin(int fd) in gem_has_softpin() argument
1157 ioctl(fd, DRM_IOCTL_I915_GETPARAM, &gp, sizeof(gp)); in gem_has_softpin()
1166 * @fd: open i915 drm file descriptor
1173 bool gem_has_exec_fence(int fd) in gem_has_exec_fence() argument
1185 ioctl(fd, DRM_IOCTL_I915_GETPARAM, &gp, sizeof(gp)); in gem_has_exec_fence()
1194 * @fd: open i915 drm file descriptor
1199 void gem_require_caching(int fd) in gem_require_caching() argument
1203 handle = gem_create(fd, 4096); in gem_require_caching()
1204 gem_set_caching(fd, handle, 0); in gem_require_caching()
1205 gem_close(fd, handle); in gem_require_caching()
1210 static void reset_device(int fd) in reset_device() argument
1214 dir = igt_debugfs_dir(fd); in reset_device()
1217 if (ioctl(fd, DRM_IOCTL_I915_GEM_THROTTLE)) { in reset_device()
1226 void igt_require_gem(int fd) in igt_require_gem() argument
1231 igt_require_intel(fd); in igt_require_gem()
1238 snprintf(path, sizeof(path), "/proc/self/fd/%d", fd); in igt_require_gem()
1239 fd = open(path, O_RDWR); in igt_require_gem()
1240 igt_assert_lte(0, fd); in igt_require_gem()
1248 reset_device(fd); in igt_require_gem()
1251 if (ioctl(fd, DRM_IOCTL_I915_GEM_THROTTLE)) in igt_require_gem()
1254 close(fd); in igt_require_gem()
1261 * @fd: open i915 drm file descriptor
1268 void gem_require_ring(int fd, unsigned ring) in gem_require_ring() argument
1270 igt_require(gem_has_ring(fd, ring)); in gem_require_ring()
1275 * @fd: open i915 drm file descriptor
1280 bool gem_has_mocs_registers(int fd) in gem_has_mocs_registers() argument
1282 return intel_gen(intel_get_drm_devid(fd)) >= 9; in gem_has_mocs_registers()
1287 * @fd: open i915 drm file descriptor
1292 void gem_require_mocs_registers(int fd) in gem_require_mocs_registers() argument
1294 igt_require(gem_has_mocs_registers(fd)); in gem_require_mocs_registers()
1301 * @fd: open i915 drm file descriptor
1308 * Returns: The created dma-buf fd handle.
1310 int prime_handle_to_fd(int fd, uint32_t handle) in prime_handle_to_fd() argument
1317 args.fd = -1; in prime_handle_to_fd()
1319 do_ioctl(fd, DRM_IOCTL_PRIME_HANDLE_TO_FD, &args); in prime_handle_to_fd()
1321 return args.fd; in prime_handle_to_fd()
1326 * @fd: open i915 drm file descriptor
1332 * Returns: The created dma-buf fd handle or -1 if the ioctl fails.
1334 int prime_handle_to_fd_for_mmap(int fd, uint32_t handle) in prime_handle_to_fd_for_mmap() argument
1341 args.fd = -1; in prime_handle_to_fd_for_mmap()
1343 if (igt_ioctl(fd, DRM_IOCTL_PRIME_HANDLE_TO_FD, &args) != 0) in prime_handle_to_fd_for_mmap()
1346 return args.fd; in prime_handle_to_fd_for_mmap()
1351 * @fd: open i915 drm file descriptor
1352 * @dma_buf_fd: dma-buf fd handle
1359 uint32_t prime_fd_to_handle(int fd, int dma_buf_fd) in prime_fd_to_handle() argument
1364 args.fd = dma_buf_fd; in prime_fd_to_handle()
1368 do_ioctl(fd, DRM_IOCTL_PRIME_FD_TO_HANDLE, &args); in prime_fd_to_handle()
1375 * @dma_buf_fd: dma-buf fd handle
1397 * @dma_buf_fd: dma-buf fd handle
1416 * @dma_buf_fd: dma-buf fd handle
1433 bool igt_has_fb_modifiers(int fd) in igt_has_fb_modifiers() argument
1441 ret = drmGetCap(fd, DRM_CAP_ADDFB2_MODIFIERS, &cap_modifiers); in igt_has_fb_modifiers()
1452 * @fd: Open DRM file descriptor.
1456 void igt_require_fb_modifiers(int fd) in igt_require_fb_modifiers() argument
1458 igt_require(igt_has_fb_modifiers(fd)); in igt_require_fb_modifiers()
1461 int __kms_addfb(int fd, uint32_t handle, in __kms_addfb() argument
1471 igt_require_fb_modifiers(fd); in __kms_addfb()
1487 ret = igt_ioctl(fd, DRM_IOCTL_MODE_ADDFB2, &f); in __kms_addfb()