drm-uapi: Sync the panfrost header

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Christoph Pillmayer <christoph.pillmayer@arm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36385>
This commit is contained in:
Faith Ekstrand 2025-07-29 06:29:20 +00:00 committed by Boris Brezillon
parent 8c8864baea
commit 61f7990b9a

View file

@ -24,6 +24,8 @@ extern "C" {
#define DRM_PANFROST_SET_LABEL_BO 0x09 #define DRM_PANFROST_SET_LABEL_BO 0x09
#define DRM_PANFROST_JM_CTX_CREATE 0x0a #define DRM_PANFROST_JM_CTX_CREATE 0x0a
#define DRM_PANFROST_JM_CTX_DESTROY 0x0b #define DRM_PANFROST_JM_CTX_DESTROY 0x0b
#define DRM_PANFROST_SYNC_BO 0x0c
#define DRM_PANFROST_QUERY_BO_INFO 0x0d
#define DRM_IOCTL_PANFROST_SUBMIT DRM_IOW(DRM_COMMAND_BASE + DRM_PANFROST_SUBMIT, struct drm_panfrost_submit) #define DRM_IOCTL_PANFROST_SUBMIT DRM_IOW(DRM_COMMAND_BASE + DRM_PANFROST_SUBMIT, struct drm_panfrost_submit)
#define DRM_IOCTL_PANFROST_WAIT_BO DRM_IOW(DRM_COMMAND_BASE + DRM_PANFROST_WAIT_BO, struct drm_panfrost_wait_bo) #define DRM_IOCTL_PANFROST_WAIT_BO DRM_IOW(DRM_COMMAND_BASE + DRM_PANFROST_WAIT_BO, struct drm_panfrost_wait_bo)
@ -35,6 +37,8 @@ extern "C" {
#define DRM_IOCTL_PANFROST_SET_LABEL_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_PANFROST_SET_LABEL_BO, struct drm_panfrost_set_label_bo) #define DRM_IOCTL_PANFROST_SET_LABEL_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_PANFROST_SET_LABEL_BO, struct drm_panfrost_set_label_bo)
#define DRM_IOCTL_PANFROST_JM_CTX_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_PANFROST_JM_CTX_CREATE, struct drm_panfrost_jm_ctx_create) #define DRM_IOCTL_PANFROST_JM_CTX_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_PANFROST_JM_CTX_CREATE, struct drm_panfrost_jm_ctx_create)
#define DRM_IOCTL_PANFROST_JM_CTX_DESTROY DRM_IOWR(DRM_COMMAND_BASE + DRM_PANFROST_JM_CTX_DESTROY, struct drm_panfrost_jm_ctx_destroy) #define DRM_IOCTL_PANFROST_JM_CTX_DESTROY DRM_IOWR(DRM_COMMAND_BASE + DRM_PANFROST_JM_CTX_DESTROY, struct drm_panfrost_jm_ctx_destroy)
#define DRM_IOCTL_PANFROST_SYNC_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_PANFROST_SYNC_BO, struct drm_panfrost_sync_bo)
#define DRM_IOCTL_PANFROST_QUERY_BO_INFO DRM_IOWR(DRM_COMMAND_BASE + DRM_PANFROST_QUERY_BO_INFO, struct drm_panfrost_query_bo_info)
/* /*
* Unstable ioctl(s): only exposed when the unsafe unstable_ioctls module * Unstable ioctl(s): only exposed when the unsafe unstable_ioctls module
@ -54,32 +58,46 @@ extern "C" {
* This asks the kernel to have the GPU execute a render command list. * This asks the kernel to have the GPU execute a render command list.
*/ */
struct drm_panfrost_submit { struct drm_panfrost_submit {
/**
/** Address to GPU mapping of job descriptor */ * @jc: Address to GPU mapping of job descriptor
*/
__u64 jc; __u64 jc;
/**
/** An optional array of sync objects to wait on before starting this job. */ * @in_syncs: An optional array of sync objects to wait on
* before starting this job.
*/
__u64 in_syncs; __u64 in_syncs;
/**
/** Number of sync objects to wait on before starting this job. */ * @in_sync_count: Number of sync objects to wait on before
* starting this job.
*/
__u32 in_sync_count; __u32 in_sync_count;
/**
/** An optional sync object to place the completion fence in. */ * @out_sync: An optional sync object to place the completion fence in.
*/
__u32 out_sync; __u32 out_sync;
/**
/** Pointer to a u32 array of the BOs that are referenced by the job. */ * @bo_handles: Pointer to a u32 array of the BOs that are
* referenced by the job.
*/
__u64 bo_handles; __u64 bo_handles;
/**
/** Number of BO handles passed in (size is that times 4). */ * @bo_handle_count: Number of BO handles passed in (size is
* that times 4).
*/
__u32 bo_handle_count; __u32 bo_handle_count;
/**
/** A combination of PANFROST_JD_REQ_* */ * @requirements: A combination of PANFROST_JD_REQ_*
*/
__u32 requirements; __u32 requirements;
/**
/** JM context handle. Zero if you want to use the default context. */ * @jm_ctx_handle: JM context handle. Zero if you want to use the
* default context.
*/
__u32 jm_ctx_handle; __u32 jm_ctx_handle;
/**
/** Padding field. MBZ. */ * @pad: Padding field. Must be zero.
*/
__u32 pad; __u32 pad;
}; };
@ -92,14 +110,26 @@ struct drm_panfrost_submit {
* completed. * completed.
*/ */
struct drm_panfrost_wait_bo { struct drm_panfrost_wait_bo {
/**
* @handle: Handle for the object to wait for.
*/
__u32 handle; __u32 handle;
/**
* @pad: Padding, must be zero-filled.
*/
__u32 pad; __u32 pad;
__s64 timeout_ns; /* absolute */ /**
* @timeout_ns: absolute number of nanoseconds to wait.
*/
__s64 timeout_ns;
}; };
/* Valid flags to pass to drm_panfrost_create_bo */ /* Valid flags to pass to drm_panfrost_create_bo.
* PANFROST_BO_WB_MMAP can't be set if PANFROST_BO_HEAP is.
*/
#define PANFROST_BO_NOEXEC 1 #define PANFROST_BO_NOEXEC 1
#define PANFROST_BO_HEAP 2 #define PANFROST_BO_HEAP 2
#define PANFROST_BO_WB_MMAP 4
/** /**
* struct drm_panfrost_create_bo - ioctl argument for creating Panfrost BOs. * struct drm_panfrost_create_bo - ioctl argument for creating Panfrost BOs.
@ -107,16 +137,26 @@ struct drm_panfrost_wait_bo {
* The flags argument is a bit mask of PANFROST_BO_* flags. * The flags argument is a bit mask of PANFROST_BO_* flags.
*/ */
struct drm_panfrost_create_bo { struct drm_panfrost_create_bo {
/**
* @size: size of shmem/BO area to create (bytes)
*/
__u32 size; __u32 size;
/**
* @flags: see PANFROST_BO_* flags
*/
__u32 flags; __u32 flags;
/** Returned GEM handle for the BO. */ /**
* @handle: Returned GEM handle for the BO.
*/
__u32 handle; __u32 handle;
/* Pad, must be zero-filled. */ /**
* @pad: Padding, must be zero-filled.
*/
__u32 pad; __u32 pad;
/** /**
* Returned offset for the BO in the GPU address space. This offset * @offset: Returned offset for the BO in the GPU address space.
* is private to the DRM fd and is valid for the lifetime of the GEM * This offset is private to the DRM fd and is valid for the
* handle. * lifetime of the GEM handle.
* *
* This offset value will always be nonzero, since various HW * This offset value will always be nonzero, since various HW
* units treat 0 specially. * units treat 0 specially.
@ -136,10 +176,17 @@ struct drm_panfrost_create_bo {
* used in a future extension. * used in a future extension.
*/ */
struct drm_panfrost_mmap_bo { struct drm_panfrost_mmap_bo {
/** Handle for the object being mapped. */ /**
* @handle: Handle for the object being mapped.
*/
__u32 handle; __u32 handle;
/**
* @flags: currently not used (should be zero)
*/
__u32 flags; __u32 flags;
/** offset into the drm node to use for subsequent mmap call. */ /**
* @offset: offset into the drm node to use for subsequent mmap call.
*/
__u64 offset; __u64 offset;
}; };
@ -188,6 +235,13 @@ enum drm_panfrost_param {
DRM_PANFROST_PARAM_SYSTEM_TIMESTAMP, DRM_PANFROST_PARAM_SYSTEM_TIMESTAMP,
DRM_PANFROST_PARAM_SYSTEM_TIMESTAMP_FREQUENCY, DRM_PANFROST_PARAM_SYSTEM_TIMESTAMP_FREQUENCY,
DRM_PANFROST_PARAM_ALLOWED_JM_CTX_PRIORITIES, DRM_PANFROST_PARAM_ALLOWED_JM_CTX_PRIORITIES,
DRM_PANFROST_PARAM_SELECTED_COHERENCY,
};
enum drm_panfrost_gpu_coherency {
DRM_PANFROST_GPU_COHERENCY_ACE_LITE = 0,
DRM_PANFROST_GPU_COHERENCY_ACE = 1,
DRM_PANFROST_GPU_COHERENCY_NONE = 31,
}; };
struct drm_panfrost_get_param { struct drm_panfrost_get_param {
@ -196,7 +250,7 @@ struct drm_panfrost_get_param {
__u64 value; __u64 value;
}; };
/** /*
* Returns the offset for the BO in the GPU address space for this DRM fd. * Returns the offset for the BO in the GPU address space for this DRM fd.
* This is the same value returned by drm_panfrost_create_bo, if that was called * This is the same value returned by drm_panfrost_create_bo, if that was called
* from this DRM fd. * from this DRM fd.
@ -244,12 +298,14 @@ struct drm_panfrost_madvise {
* struct drm_panfrost_set_label_bo - ioctl argument for labelling Panfrost BOs. * struct drm_panfrost_set_label_bo - ioctl argument for labelling Panfrost BOs.
*/ */
struct drm_panfrost_set_label_bo { struct drm_panfrost_set_label_bo {
/** @handle: Handle of the buffer object to label. */ /**
* @handle: Handle of the buffer object to label.
*/
__u32 handle; __u32 handle;
/**
/** @pad: MBZ. */ * @pad: Must be zero.
*/
__u32 pad; __u32 pad;
/** /**
* @label: User pointer to a NUL-terminated string * @label: User pointer to a NUL-terminated string
* *
@ -259,6 +315,66 @@ struct drm_panfrost_set_label_bo {
__u64 label; __u64 label;
}; };
/* Valid flags to pass to drm_panfrost_bo_sync_op */
#define PANFROST_BO_SYNC_CPU_CACHE_FLUSH 0
#define PANFROST_BO_SYNC_CPU_CACHE_FLUSH_AND_INVALIDATE 1
/**
* struct drm_panthor_bo_flush_map_op - BO map sync op
*/
struct drm_panfrost_bo_sync_op {
/** @handle: Handle of the buffer object to sync. */
__u32 handle;
/** @type: Type of sync operation. */
__u32 type;
/**
* @offset: Offset into the BO at which the sync range starts.
*
* This will be rounded down to the nearest cache line as needed.
*/
__u32 offset;
/**
* @size: Size of the range to sync
*
* @size + @offset will be rounded up to the nearest cache line as
* needed.
*/
__u32 size;
};
/**
* struct drm_panfrost_sync_bo - ioctl argument for syncing BO maps
*/
struct drm_panfrost_sync_bo {
/** Array of struct drm_panfrost_bo_sync_op */
__u64 ops;
/** Number of BO sync ops */
__u32 op_count;
__u32 pad;
};
/** BO comes from a different subsystem. */
#define DRM_PANFROST_BO_IS_IMPORTED (1 << 0)
struct drm_panfrost_query_bo_info {
/** Handle of the object being queried. */
__u32 handle;
/** Extra flags that are not coming from the BO_CREATE ioctl(). */
__u32 extra_flags;
/** Flags passed at creation time. */
__u32 create_flags;
/** Will be zero on return. */
__u32 pad;
};
/* Definitions for coredump decoding in user space */ /* Definitions for coredump decoding in user space */
#define PANFROSTDUMP_MAJOR 1 #define PANFROSTDUMP_MAJOR 1
#define PANFROSTDUMP_MINOR 0 #define PANFROSTDUMP_MINOR 0
@ -330,10 +446,13 @@ enum drm_panfrost_jm_ctx_priority {
}; };
struct drm_panfrost_jm_ctx_create { struct drm_panfrost_jm_ctx_create {
/** @handle: Handle of the created JM context */ /**
* @handle: Handle of the created JM context
*/
__u32 handle; __u32 handle;
/**
/** @priority: Context priority (see enum drm_panfrost_jm_ctx_priority). */ * @priority: Context priority (see enum drm_panfrost_jm_ctx_priority).
*/
__u32 priority; __u32 priority;
}; };
@ -344,8 +463,9 @@ struct drm_panfrost_jm_ctx_destroy {
* Must be a valid context handle returned by DRM_IOCTL_PANTHOR_JM_CTX_CREATE. * Must be a valid context handle returned by DRM_IOCTL_PANTHOR_JM_CTX_CREATE.
*/ */
__u32 handle; __u32 handle;
/**
/** @pad: Padding field, MBZ. */ * @pad: Padding field, must be zero.
*/
__u32 pad; __u32 pad;
}; };