aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Clark2016-05-31 10:49:46 -0500
committerRob Clark2016-07-20 18:42:21 -0500
commit0c270df8dfde6d6d7b7adb236cd3325f2c0115bd (patch)
tree279150c6e1a14a18c36a13979fbe4aa770a44652 /freedreno
parent82780c87f9e39ab19dce6ec619ad744a26a0f886 (diff)
downloadexternal-libdrm-0c270df8dfde6d6d7b7adb236cd3325f2c0115bd.tar.gz
external-libdrm-0c270df8dfde6d6d7b7adb236cd3325f2c0115bd.tar.xz
external-libdrm-0c270df8dfde6d6d7b7adb236cd3325f2c0115bd.zip
freedreno: sync uapi
(from drm-next for 4.8) Signed-off-by: Rob Clark <robclark@freedesktop.org>
Diffstat (limited to 'freedreno')
-rw-r--r--freedreno/msm/msm_drm.h109
1 files changed, 70 insertions, 39 deletions
diff --git a/freedreno/msm/msm_drm.h b/freedreno/msm/msm_drm.h
index 6a2a2653..cbf75c3d 100644
--- a/freedreno/msm/msm_drm.h
+++ b/freedreno/msm/msm_drm.h
@@ -28,9 +28,13 @@
28#include <stddef.h> 28#include <stddef.h>
29#include "drm.h" 29#include "drm.h"
30 30
31#if defined(__cplusplus)
32extern "C" {
33#endif
34
31/* Please note that modifications to all structs defined here are 35/* Please note that modifications to all structs defined here are
32 * subject to backwards-compatibility constraints: 36 * subject to backwards-compatibility constraints:
33 * 1) Do not use pointers, use uint64_t instead for 32 bit / 64 bit 37 * 1) Do not use pointers, use __u64 instead for 32 bit / 64 bit
34 * user/kernel compatibility 38 * user/kernel compatibility
35 * 2) Keep fields aligned to their size 39 * 2) Keep fields aligned to their size
36 * 3) Because of how drm_ioctl() works, we can add new fields at 40 * 3) Because of how drm_ioctl() works, we can add new fields at
@@ -51,8 +55,8 @@
51 * same as 'struct timespec' but 32/64b ABI safe. 55 * same as 'struct timespec' but 32/64b ABI safe.
52 */ 56 */
53struct drm_msm_timespec { 57struct drm_msm_timespec {
54 int64_t tv_sec; /* seconds */ 58 __s64 tv_sec; /* seconds */
55 int64_t tv_nsec; /* nanoseconds */ 59 __s64 tv_nsec; /* nanoseconds */
56}; 60};
57 61
58#define MSM_PARAM_GPU_ID 0x01 62#define MSM_PARAM_GPU_ID 0x01
@@ -62,9 +66,9 @@ struct drm_msm_timespec {
62#define MSM_PARAM_TIMESTAMP 0x05 66#define MSM_PARAM_TIMESTAMP 0x05
63 67
64struct drm_msm_param { 68struct drm_msm_param {
65 uint32_t pipe; /* in, MSM_PIPE_x */ 69 __u32 pipe; /* in, MSM_PIPE_x */
66 uint32_t param; /* in, MSM_PARAM_x */ 70 __u32 param; /* in, MSM_PARAM_x */
67 uint64_t value; /* out (get_param) or in (set_param) */ 71 __u64 value; /* out (get_param) or in (set_param) */
68}; 72};
69 73
70/* 74/*
@@ -86,15 +90,15 @@ struct drm_msm_param {
86 MSM_BO_UNCACHED) 90 MSM_BO_UNCACHED)
87 91
88struct drm_msm_gem_new { 92struct drm_msm_gem_new {
89 uint64_t size; /* in */ 93 __u64 size; /* in */
90 uint32_t flags; /* in, mask of MSM_BO_x */ 94 __u32 flags; /* in, mask of MSM_BO_x */
91 uint32_t handle; /* out */ 95 __u32 handle; /* out */
92}; 96};
93 97
94struct drm_msm_gem_info { 98struct drm_msm_gem_info {
95 uint32_t handle; /* in */ 99 __u32 handle; /* in */
96 uint32_t pad; 100 __u32 pad;
97 uint64_t offset; /* out, offset to pass to mmap() */ 101 __u64 offset; /* out, offset to pass to mmap() */
98}; 102};
99 103
100#define MSM_PREP_READ 0x01 104#define MSM_PREP_READ 0x01
@@ -104,13 +108,13 @@ struct drm_msm_gem_info {
104#define MSM_PREP_FLAGS (MSM_PREP_READ | MSM_PREP_WRITE | MSM_PREP_NOSYNC) 108#define MSM_PREP_FLAGS (MSM_PREP_READ | MSM_PREP_WRITE | MSM_PREP_NOSYNC)
105 109
106struct drm_msm_gem_cpu_prep { 110struct drm_msm_gem_cpu_prep {
107 uint32_t handle; /* in */ 111 __u32 handle; /* in */
108 uint32_t op; /* in, mask of MSM_PREP_x */ 112 __u32 op; /* in, mask of MSM_PREP_x */
109 struct drm_msm_timespec timeout; /* in */ 113 struct drm_msm_timespec timeout; /* in */
110}; 114};
111 115
112struct drm_msm_gem_cpu_fini { 116struct drm_msm_gem_cpu_fini {
113 uint32_t handle; /* in */ 117 __u32 handle; /* in */
114}; 118};
115 119
116/* 120/*
@@ -129,11 +133,11 @@ struct drm_msm_gem_cpu_fini {
129 * otherwise EINVAL. 133 * otherwise EINVAL.
130 */ 134 */
131struct drm_msm_gem_submit_reloc { 135struct drm_msm_gem_submit_reloc {
132 uint32_t submit_offset; /* in, offset from submit_bo */ 136 __u32 submit_offset; /* in, offset from submit_bo */
133 uint32_t or; /* in, value OR'd with result */ 137 __u32 or; /* in, value OR'd with result */
134 int32_t shift; /* in, amount of left shift (can be negative) */ 138 __s32 shift; /* in, amount of left shift (can be negative) */
135 uint32_t reloc_idx; /* in, index of reloc_bo buffer */ 139 __u32 reloc_idx; /* in, index of reloc_bo buffer */
136 uint64_t reloc_offset; /* in, offset from start of reloc_bo */ 140 __u64 reloc_offset; /* in, offset from start of reloc_bo */
137}; 141};
138 142
139/* submit-types: 143/* submit-types:
@@ -148,13 +152,13 @@ struct drm_msm_gem_submit_reloc {
148#define MSM_SUBMIT_CMD_IB_TARGET_BUF 0x0002 152#define MSM_SUBMIT_CMD_IB_TARGET_BUF 0x0002
149#define MSM_SUBMIT_CMD_CTX_RESTORE_BUF 0x0003 153#define MSM_SUBMIT_CMD_CTX_RESTORE_BUF 0x0003
150struct drm_msm_gem_submit_cmd { 154struct drm_msm_gem_submit_cmd {
151 uint32_t type; /* in, one of MSM_SUBMIT_CMD_x */ 155 __u32 type; /* in, one of MSM_SUBMIT_CMD_x */
152 uint32_t submit_idx; /* in, index of submit_bo cmdstream buffer */ 156 __u32 submit_idx; /* in, index of submit_bo cmdstream buffer */
153 uint32_t submit_offset; /* in, offset into submit_bo */ 157 __u32 submit_offset; /* in, offset into submit_bo */
154 uint32_t size; /* in, cmdstream size */ 158 __u32 size; /* in, cmdstream size */
155 uint32_t pad; 159 __u32 pad;
156 uint32_t nr_relocs; /* in, number of submit_reloc's */ 160 __u32 nr_relocs; /* in, number of submit_reloc's */
157 uint64_t __user relocs; /* in, ptr to array of submit_reloc's */ 161 __u64 __user relocs; /* in, ptr to array of submit_reloc's */
158}; 162};
159 163
160/* Each buffer referenced elsewhere in the cmdstream submit (ie. the 164/* Each buffer referenced elsewhere in the cmdstream submit (ie. the
@@ -174,9 +178,9 @@ struct drm_msm_gem_submit_cmd {
174#define MSM_SUBMIT_BO_FLAGS (MSM_SUBMIT_BO_READ | MSM_SUBMIT_BO_WRITE) 178#define MSM_SUBMIT_BO_FLAGS (MSM_SUBMIT_BO_READ | MSM_SUBMIT_BO_WRITE)
175 179
176struct drm_msm_gem_submit_bo { 180struct drm_msm_gem_submit_bo {
177 uint32_t flags; /* in, mask of MSM_SUBMIT_BO_x */ 181 __u32 flags; /* in, mask of MSM_SUBMIT_BO_x */
178 uint32_t handle; /* in, GEM handle */ 182 __u32 handle; /* in, GEM handle */
179 uint64_t presumed; /* in/out, presumed buffer address */ 183 __u64 presumed; /* in/out, presumed buffer address */
180}; 184};
181 185
182/* Each cmdstream submit consists of a table of buffers involved, and 186/* Each cmdstream submit consists of a table of buffers involved, and
@@ -184,12 +188,12 @@ struct drm_msm_gem_submit_bo {
184 * (context-restore), and IB buffers needed for per tile/bin draw cmds. 188 * (context-restore), and IB buffers needed for per tile/bin draw cmds.
185 */ 189 */
186struct drm_msm_gem_submit { 190struct drm_msm_gem_submit {
187 uint32_t pipe; /* in, MSM_PIPE_x */ 191 __u32 pipe; /* in, MSM_PIPE_x */
188 uint32_t fence; /* out */ 192 __u32 fence; /* out */
189 uint32_t nr_bos; /* in, number of submit_bo's */ 193 __u32 nr_bos; /* in, number of submit_bo's */
190 uint32_t nr_cmds; /* in, number of submit_cmd's */ 194 __u32 nr_cmds; /* in, number of submit_cmd's */
191 uint64_t __user bos; /* in, ptr to array of submit_bo's */ 195 __u64 __user bos; /* in, ptr to array of submit_bo's */
192 uint64_t __user cmds; /* in, ptr to array of submit_cmd's */ 196 __u64 __user cmds; /* in, ptr to array of submit_cmd's */
193}; 197};
194 198
195/* The normal way to synchronize with the GPU is just to CPU_PREP on 199/* The normal way to synchronize with the GPU is just to CPU_PREP on
@@ -200,11 +204,32 @@ struct drm_msm_gem_submit {
200 * APIs without requiring a dummy bo to synchronize on. 204 * APIs without requiring a dummy bo to synchronize on.
201 */ 205 */
202struct drm_msm_wait_fence { 206struct drm_msm_wait_fence {
203 uint32_t fence; /* in */ 207 __u32 fence; /* in */
204 uint32_t pad; 208 __u32 pad;
205 struct drm_msm_timespec timeout; /* in */ 209 struct drm_msm_timespec timeout; /* in */
206}; 210};
207 211
212/* madvise provides a way to tell the kernel in case a buffers contents
213 * can be discarded under memory pressure, which is useful for userspace
214 * bo cache where we want to optimistically hold on to buffer allocate
215 * and potential mmap, but allow the pages to be discarded under memory
216 * pressure.
217 *
218 * Typical usage would involve madvise(DONTNEED) when buffer enters BO
219 * cache, and madvise(WILLNEED) if trying to recycle buffer from BO cache.
220 * In the WILLNEED case, 'retained' indicates to userspace whether the
221 * backing pages still exist.
222 */
223#define MSM_MADV_WILLNEED 0 /* backing pages are needed, status returned in 'retained' */
224#define MSM_MADV_DONTNEED 1 /* backing pages not needed */
225#define __MSM_MADV_PURGED 2 /* internal state */
226
227struct drm_msm_gem_madvise {
228 __u32 handle; /* in, GEM handle */
229 __u32 madv; /* in, MSM_MADV_x */
230 __u32 retained; /* out, whether backing store still exists */
231};
232
208#define DRM_MSM_GET_PARAM 0x00 233#define DRM_MSM_GET_PARAM 0x00
209/* placeholder: 234/* placeholder:
210#define DRM_MSM_SET_PARAM 0x01 235#define DRM_MSM_SET_PARAM 0x01
@@ -215,7 +240,8 @@ struct drm_msm_wait_fence {
215#define DRM_MSM_GEM_CPU_FINI 0x05 240#define DRM_MSM_GEM_CPU_FINI 0x05
216#define DRM_MSM_GEM_SUBMIT 0x06 241#define DRM_MSM_GEM_SUBMIT 0x06
217#define DRM_MSM_WAIT_FENCE 0x07 242#define DRM_MSM_WAIT_FENCE 0x07
218#define DRM_MSM_NUM_IOCTLS 0x08 243#define DRM_MSM_GEM_MADVISE 0x08
244#define DRM_MSM_NUM_IOCTLS 0x09
219 245
220#define DRM_IOCTL_MSM_GET_PARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_MSM_GET_PARAM, struct drm_msm_param) 246#define DRM_IOCTL_MSM_GET_PARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_MSM_GET_PARAM, struct drm_msm_param)
221#define DRM_IOCTL_MSM_GEM_NEW DRM_IOWR(DRM_COMMAND_BASE + DRM_MSM_GEM_NEW, struct drm_msm_gem_new) 247#define DRM_IOCTL_MSM_GEM_NEW DRM_IOWR(DRM_COMMAND_BASE + DRM_MSM_GEM_NEW, struct drm_msm_gem_new)
@@ -224,5 +250,10 @@ struct drm_msm_wait_fence {
224#define DRM_IOCTL_MSM_GEM_CPU_FINI DRM_IOW (DRM_COMMAND_BASE + DRM_MSM_GEM_CPU_FINI, struct drm_msm_gem_cpu_fini) 250#define DRM_IOCTL_MSM_GEM_CPU_FINI DRM_IOW (DRM_COMMAND_BASE + DRM_MSM_GEM_CPU_FINI, struct drm_msm_gem_cpu_fini)
225#define DRM_IOCTL_MSM_GEM_SUBMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_MSM_GEM_SUBMIT, struct drm_msm_gem_submit) 251#define DRM_IOCTL_MSM_GEM_SUBMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_MSM_GEM_SUBMIT, struct drm_msm_gem_submit)
226#define DRM_IOCTL_MSM_WAIT_FENCE DRM_IOW (DRM_COMMAND_BASE + DRM_MSM_WAIT_FENCE, struct drm_msm_wait_fence) 252#define DRM_IOCTL_MSM_WAIT_FENCE DRM_IOW (DRM_COMMAND_BASE + DRM_MSM_WAIT_FENCE, struct drm_msm_wait_fence)
253#define DRM_IOCTL_MSM_GEM_MADVISE DRM_IOWR(DRM_COMMAND_BASE + DRM_MSM_GEM_MADVISE, struct drm_msm_gem_madvise)
254
255#if defined(__cplusplus)
256}
257#endif
227 258
228#endif /* __MSM_DRM_H__ */ 259#endif /* __MSM_DRM_H__ */