1 /* SPDX-License-Identifier: MIT */
3 * Copyright © 2014-2018 Broadcom
4 * Copyright © 2019 Collabora ltd.
6 #ifndef _PANFROST_DRM_H_
7 #define _PANFROST_DRM_H_
11 #if defined(__cplusplus)
15 #define DRM_PANFROST_SUBMIT 0x00
16 #define DRM_PANFROST_WAIT_BO 0x01
17 #define DRM_PANFROST_CREATE_BO 0x02
18 #define DRM_PANFROST_MMAP_BO 0x03
19 #define DRM_PANFROST_GET_PARAM 0x04
20 #define DRM_PANFROST_GET_BO_OFFSET 0x05
22 #define DRM_IOCTL_PANFROST_SUBMIT DRM_IOW(DRM_COMMAND_BASE + DRM_PANFROST_SUBMIT, struct drm_panfrost_submit)
23 #define DRM_IOCTL_PANFROST_WAIT_BO DRM_IOW(DRM_COMMAND_BASE + DRM_PANFROST_WAIT_BO, struct drm_panfrost_wait_bo)
24 #define DRM_IOCTL_PANFROST_CREATE_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_PANFROST_CREATE_BO, struct drm_panfrost_create_bo)
25 #define DRM_IOCTL_PANFROST_MMAP_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_PANFROST_MMAP_BO, struct drm_panfrost_mmap_bo)
26 #define DRM_IOCTL_PANFROST_GET_PARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_PANFROST_GET_PARAM, struct drm_panfrost_get_param)
27 #define DRM_IOCTL_PANFROST_GET_BO_OFFSET DRM_IOWR(DRM_COMMAND_BASE + DRM_PANFROST_GET_BO_OFFSET, struct drm_panfrost_get_bo_offset)
29 #define PANFROST_JD_REQ_FS (1 << 0)
31 * struct drm_panfrost_submit - ioctl argument for submitting commands to the 3D
34 * This asks the kernel to have the GPU execute a render command list.
36 struct drm_panfrost_submit {
38 /** Address to GPU mapping of job descriptor */
41 /** An optional array of sync objects to wait on before starting this job. */
44 /** Number of sync objects to wait on before starting this job. */
47 /** An optional sync object to place the completion fence in. */
50 /** Pointer to a u32 array of the BOs that are referenced by the job. */
53 /** Number of BO handles passed in (size is that times 4). */
54 __u32 bo_handle_count;
56 /** A combination of PANFROST_JD_REQ_* */
61 * struct drm_panfrost_wait_bo - ioctl argument for waiting for
62 * completion of the last DRM_PANFROST_SUBMIT on a BO.
64 * This is useful for cases where multiple processes might be
65 * rendering to a BO and you want to wait for all rendering to be
68 struct drm_panfrost_wait_bo {
71 __s64 timeout_ns; /* absolute */
75 * struct drm_panfrost_create_bo - ioctl argument for creating Panfrost BOs.
77 * There are currently no values for the flags argument, but it may be
78 * used in a future extension.
80 struct drm_panfrost_create_bo {
83 /** Returned GEM handle for the BO. */
85 /* Pad, must be zero-filled. */
88 * Returned offset for the BO in the GPU address space. This offset
89 * is private to the DRM fd and is valid for the lifetime of the GEM
92 * This offset value will always be nonzero, since various HW
93 * units treat 0 specially.
99 * struct drm_panfrost_mmap_bo - ioctl argument for mapping Panfrost BOs.
101 * This doesn't actually perform an mmap. Instead, it returns the
102 * offset you need to use in an mmap on the DRM device node. This
103 * means that tools like valgrind end up knowing about the mapped
106 * There are currently no values for the flags argument, but it may be
107 * used in a future extension.
109 struct drm_panfrost_mmap_bo {
110 /** Handle for the object being mapped. */
113 /** offset into the drm node to use for subsequent mmap call. */
117 enum drm_panfrost_param {
118 DRM_PANFROST_PARAM_GPU_PROD_ID,
121 struct drm_panfrost_get_param {
128 * Returns the offset for the BO in the GPU address space for this DRM fd.
129 * This is the same value returned by drm_panfrost_create_bo, if that was called
132 struct drm_panfrost_get_bo_offset {
138 #if defined(__cplusplus)
142 #endif /* _PANFROST_DRM_H_ */