From c22ad827c81f971d36fad56f3f349b2669a86d4f Mon Sep 17 00:00:00 2001 From: Dave Airlie <airlied@redhat.com> Date: Wed, 2 Nov 2022 16:56:35 +1000 Subject: [PATCH] nouveau: add new uapi header file from kernel. This is the apis for vmbind and exec --- include/drm-uapi/nouveau_drm.h | 80 ++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 include/drm-uapi/nouveau_drm.h diff --git a/include/drm-uapi/nouveau_drm.h b/include/drm-uapi/nouveau_drm.h new file mode 100644 index 0000000000000..898d8014c2770 --- /dev/null +++ b/include/drm-uapi/nouveau_drm.h @@ -0,0 +1,80 @@ +#ifndef __NOUVEAU_NEW_DRM_H__ +#define __NOUVEAU_NEW_DRM_H__ + +#if defined(__cplusplus) +extern "C" { +#endif + +struct drm_nouveau_vm_init { + __u64 unmanaged_addr; + __u64 unmanaged_size; +}; + +struct drm_nouveau_vm_bind_op { + __u32 op; +#define DRM_NOUVEAU_VM_BIND_OP_ALLOC 0x0 +#define DRM_NOUVEAU_VM_BIND_OP_FREE 0x1 +#define DRM_NOUVEAU_VM_BIND_OP_MAP 0x2 +#define DRM_NOUVEAU_VM_BIND_OP_UNMAP 0x3 + __u32 flags; +#define DRM_NOUVEAU_VM_BIND_SPARSE (1 << 8) + __u32 handle; + __u64 addr; + __u64 bo_offset; + __u64 range; +}; + +struct drm_nouveau_vm_bind { + __u32 op_count; + __u32 vm_id; + __u32 flags; +#define DRM_NOUVEAU_VM_BIND_RUN_ASYNC 0x1 + __u32 wait_count; + __u32 sig_count; + __u32 _pad; + __u64 wait_ptr; /* ptrs to drm_nouveau_sync arrays */ + __u64 sig_ptr; + __u64 op_ptr; /* ptr to drm_nouveau_vm_bind_op array */ +}; + +struct drm_nouveau_exec_push { + __u64 va; + __u64 va_len; +}; + +struct drm_nouveau_sync { + __u32 flags; +#define DRM_NOUVEAU_SYNC_SYNCOBJ 0x0 +#define DRM_NOUVEAU_SYNC_TIMELINE_SYNCOBJ 0x1 +#define DRM_NOUVEAU_SYNC_DMA_BUF 0x2 +#define DRM_NOUVEAU_SYNC_USER_FENCE 0x3 +#define DRM_NOUVEAU_SYNC_TYPE_MASK 0xf + __u32 handle; + __u64 addr; + __u64 timeline_value; +}; + +struct drm_nouveau_exec { + __u32 channel; + __u32 vm_id; + __u32 push_count; + __u32 wait_count; + __u32 sig_count; + __u32 _pad; + __u64 push_ptr; + __u64 wait_ptr; + __u64 sig_ptr; +}; + +#define DRM_NOUVEAU_VM_INIT 0x10 +#define DRM_NOUVEAU_VM_BIND 0x11 +#define DRM_NOUVEAU_EXEC 0x12 + +#define DRM_IOCTL_NOUVEAU_VM_INIT DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_VM_INIT, struct drm_nouveau_vm_init) +#define DRM_IOCTL_NOUVEAU_VM_BIND DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_VM_BIND, struct drm_nouveau_vm_bind) +#define DRM_IOCTL_NOUVEAU_EXEC DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_EXEC, struct drm_nouveau_exec) +#if defined(__cplusplus) +} +#endif + +#endif /* __NOUVEAU_DRM_H__ */ -- GitLab