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_CL 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. */
86 * Returned offset for the BO in the GPU address space. This offset
87 * is private to the DRM fd and is valid for the lifetime of the GEM
90 * This offset value will always be nonzero, since various HW
91 * units treat 0 specially.
97 * struct drm_panfrost_mmap_bo - ioctl argument for mapping Panfrost BOs.
99 * This doesn't actually perform an mmap. Instead, it returns the
100 * offset you need to use in an mmap on the DRM device node. This
101 * means that tools like valgrind end up knowing about the mapped
104 * There are currently no values for the flags argument, but it may be
105 * used in a future extension.
107 struct drm_panfrost_mmap_bo
{
108 /** Handle for the object being mapped. */
111 /** offset into the drm node to use for subsequent mmap call. */
115 enum drm_panfrost_param
{
116 DRM_PANFROST_PARAM_GPU_ID
,
119 struct drm_panfrost_get_param
{
126 * Returns the offset for the BO in the GPU address space for this DRM fd.
127 * This is the same value returned by drm_panfrost_create_bo, if that was called
130 struct drm_panfrost_get_bo_offset
{
136 #if defined(__cplusplus)
140 #endif /* _PANFROST_DRM_H_ */