1*61046927SAndroid Build Coastguard Worker /*
2*61046927SAndroid Build Coastguard Worker * Copyright © 2012-2018 Rob Clark <[email protected]>
3*61046927SAndroid Build Coastguard Worker * SPDX-License-Identifier: MIT
4*61046927SAndroid Build Coastguard Worker *
5*61046927SAndroid Build Coastguard Worker * Authors:
6*61046927SAndroid Build Coastguard Worker * Rob Clark <[email protected]>
7*61046927SAndroid Build Coastguard Worker */
8*61046927SAndroid Build Coastguard Worker
9*61046927SAndroid Build Coastguard Worker #ifndef FREEDRENO_DRMIF_H_
10*61046927SAndroid Build Coastguard Worker #define FREEDRENO_DRMIF_H_
11*61046927SAndroid Build Coastguard Worker
12*61046927SAndroid Build Coastguard Worker #include <stdint.h>
13*61046927SAndroid Build Coastguard Worker
14*61046927SAndroid Build Coastguard Worker #include "util/bitset.h"
15*61046927SAndroid Build Coastguard Worker #include "util/list.h"
16*61046927SAndroid Build Coastguard Worker #include "util/u_debug.h"
17*61046927SAndroid Build Coastguard Worker #include "util/u_queue.h"
18*61046927SAndroid Build Coastguard Worker
19*61046927SAndroid Build Coastguard Worker #ifdef __cplusplus
20*61046927SAndroid Build Coastguard Worker extern "C" {
21*61046927SAndroid Build Coastguard Worker #endif
22*61046927SAndroid Build Coastguard Worker
23*61046927SAndroid Build Coastguard Worker struct fd_bo;
24*61046927SAndroid Build Coastguard Worker struct fd_pipe;
25*61046927SAndroid Build Coastguard Worker struct fd_device;
26*61046927SAndroid Build Coastguard Worker
27*61046927SAndroid Build Coastguard Worker enum fd_pipe_id {
28*61046927SAndroid Build Coastguard Worker FD_PIPE_3D = 1,
29*61046927SAndroid Build Coastguard Worker FD_PIPE_2D = 2,
30*61046927SAndroid Build Coastguard Worker /* some devices have two 2d blocks.. not really sure how to
31*61046927SAndroid Build Coastguard Worker * use that yet, so just ignoring the 2nd 2d pipe for now
32*61046927SAndroid Build Coastguard Worker */
33*61046927SAndroid Build Coastguard Worker FD_PIPE_MAX
34*61046927SAndroid Build Coastguard Worker };
35*61046927SAndroid Build Coastguard Worker
36*61046927SAndroid Build Coastguard Worker enum fd_param_id {
37*61046927SAndroid Build Coastguard Worker FD_DEVICE_ID,
38*61046927SAndroid Build Coastguard Worker FD_GMEM_SIZE,
39*61046927SAndroid Build Coastguard Worker FD_GMEM_BASE, /* 64b */
40*61046927SAndroid Build Coastguard Worker FD_GPU_ID,
41*61046927SAndroid Build Coastguard Worker FD_CHIP_ID, /* 64b */
42*61046927SAndroid Build Coastguard Worker FD_MAX_FREQ,
43*61046927SAndroid Build Coastguard Worker FD_TIMESTAMP,
44*61046927SAndroid Build Coastguard Worker FD_NR_PRIORITIES, /* # of rings == # of distinct priority levels */
45*61046927SAndroid Build Coastguard Worker FD_CTX_FAULTS, /* # of per context faults */
46*61046927SAndroid Build Coastguard Worker FD_GLOBAL_FAULTS, /* # of global (all context) faults */
47*61046927SAndroid Build Coastguard Worker FD_SUSPEND_COUNT, /* # of times the GPU has suspended, and potentially lost state */
48*61046927SAndroid Build Coastguard Worker FD_SYSPROF, /* Settable (for CAP_SYS_ADMIN) param for system profiling */
49*61046927SAndroid Build Coastguard Worker FD_VA_SIZE, /* GPU virtual address size */
50*61046927SAndroid Build Coastguard Worker };
51*61046927SAndroid Build Coastguard Worker
52*61046927SAndroid Build Coastguard Worker /**
53*61046927SAndroid Build Coastguard Worker * Helper for fence/seqno comparisions which deals properly with rollover.
54*61046927SAndroid Build Coastguard Worker * Returns true if fence 'a' is before fence 'b'
55*61046927SAndroid Build Coastguard Worker */
56*61046927SAndroid Build Coastguard Worker static inline bool
fd_fence_before(uint32_t a,uint32_t b)57*61046927SAndroid Build Coastguard Worker fd_fence_before(uint32_t a, uint32_t b)
58*61046927SAndroid Build Coastguard Worker {
59*61046927SAndroid Build Coastguard Worker return (int32_t)(a - b) < 0;
60*61046927SAndroid Build Coastguard Worker }
61*61046927SAndroid Build Coastguard Worker
62*61046927SAndroid Build Coastguard Worker static inline bool
fd_fence_after(uint32_t a,uint32_t b)63*61046927SAndroid Build Coastguard Worker fd_fence_after(uint32_t a, uint32_t b)
64*61046927SAndroid Build Coastguard Worker {
65*61046927SAndroid Build Coastguard Worker return (int32_t)(a - b) > 0;
66*61046927SAndroid Build Coastguard Worker }
67*61046927SAndroid Build Coastguard Worker
68*61046927SAndroid Build Coastguard Worker /**
69*61046927SAndroid Build Coastguard Worker * Encapsulates submit out-fence(s), which consist of a 'timestamp' (per-
70*61046927SAndroid Build Coastguard Worker * pipe (submitqueue) sequence number) and optionally, if requested, an
71*61046927SAndroid Build Coastguard Worker * out-fence-fd
72*61046927SAndroid Build Coastguard Worker *
73*61046927SAndroid Build Coastguard Worker * Per submit, there are actually two fences:
74*61046927SAndroid Build Coastguard Worker * 1) The userspace maintained fence, which is used to optimistically
75*61046927SAndroid Build Coastguard Worker * avoid kernel ioctls to query if specific rendering is completed
76*61046927SAndroid Build Coastguard Worker * 2) The kernel maintained fence, which we cannot directly do anything
77*61046927SAndroid Build Coastguard Worker * with, other than pass it back to the kernel
78*61046927SAndroid Build Coastguard Worker *
79*61046927SAndroid Build Coastguard Worker * The userspace fence is mostly internal to the drm layer, but we want
80*61046927SAndroid Build Coastguard Worker * the gallium layer to be able to pass it back to us for things like
81*61046927SAndroid Build Coastguard Worker * fd_pipe_wait(). So this struct encapsulates the two.
82*61046927SAndroid Build Coastguard Worker */
83*61046927SAndroid Build Coastguard Worker struct fd_fence {
84*61046927SAndroid Build Coastguard Worker /**
85*61046927SAndroid Build Coastguard Worker * Note refcnt is *not* atomic, but protected by fence_lock, since the
86*61046927SAndroid Build Coastguard Worker * fence_lock is held in fd_bo_add_fence(), which is the hotpath.
87*61046927SAndroid Build Coastguard Worker */
88*61046927SAndroid Build Coastguard Worker int32_t refcnt;
89*61046927SAndroid Build Coastguard Worker
90*61046927SAndroid Build Coastguard Worker struct fd_pipe *pipe;
91*61046927SAndroid Build Coastguard Worker
92*61046927SAndroid Build Coastguard Worker /**
93*61046927SAndroid Build Coastguard Worker * The ready fence is signaled once the submit is actually flushed down
94*61046927SAndroid Build Coastguard Worker * to the kernel, and fence/fence_fd are populated. You must wait for
95*61046927SAndroid Build Coastguard Worker * this fence to be signaled before reading fence/fence_fd.
96*61046927SAndroid Build Coastguard Worker */
97*61046927SAndroid Build Coastguard Worker struct util_queue_fence ready;
98*61046927SAndroid Build Coastguard Worker
99*61046927SAndroid Build Coastguard Worker uint32_t kfence; /* kernel fence */
100*61046927SAndroid Build Coastguard Worker uint32_t ufence; /* userspace fence */
101*61046927SAndroid Build Coastguard Worker
102*61046927SAndroid Build Coastguard Worker /**
103*61046927SAndroid Build Coastguard Worker * Optional dma_fence fd, returned by submit if use_fence_fd is true
104*61046927SAndroid Build Coastguard Worker */
105*61046927SAndroid Build Coastguard Worker int fence_fd;
106*61046927SAndroid Build Coastguard Worker bool use_fence_fd;
107*61046927SAndroid Build Coastguard Worker };
108*61046927SAndroid Build Coastguard Worker
109*61046927SAndroid Build Coastguard Worker struct fd_fence *fd_fence_new(struct fd_pipe *pipe, bool use_fence_fd);
110*61046927SAndroid Build Coastguard Worker struct fd_fence *fd_fence_ref(struct fd_fence *f);
111*61046927SAndroid Build Coastguard Worker struct fd_fence *fd_fence_ref_locked(struct fd_fence *f);
112*61046927SAndroid Build Coastguard Worker void fd_fence_del(struct fd_fence *f);
113*61046927SAndroid Build Coastguard Worker void fd_fence_del_locked(struct fd_fence *f);
114*61046927SAndroid Build Coastguard Worker void fd_fence_flush(struct fd_fence *f);
115*61046927SAndroid Build Coastguard Worker int fd_fence_wait(struct fd_fence *f);
116*61046927SAndroid Build Coastguard Worker
117*61046927SAndroid Build Coastguard Worker /*
118*61046927SAndroid Build Coastguard Worker * bo flags:
119*61046927SAndroid Build Coastguard Worker */
120*61046927SAndroid Build Coastguard Worker
121*61046927SAndroid Build Coastguard Worker #define FD_BO_CACHED_COHERENT BITSET_BIT(0) /* Default caching is WRITECOMBINE */
122*61046927SAndroid Build Coastguard Worker #define FD_BO_GPUREADONLY BITSET_BIT(1)
123*61046927SAndroid Build Coastguard Worker #define FD_BO_NOMAP BITSET_BIT(2) /* Hint that the bo will not be mmap'd */
124*61046927SAndroid Build Coastguard Worker
125*61046927SAndroid Build Coastguard Worker /* Hint that the bo will be exported/shared: */
126*61046927SAndroid Build Coastguard Worker #define FD_BO_SHARED BITSET_BIT(4)
127*61046927SAndroid Build Coastguard Worker #define FD_BO_SCANOUT BITSET_BIT(5)
128*61046927SAndroid Build Coastguard Worker
129*61046927SAndroid Build Coastguard Worker /* internal bo flags: */
130*61046927SAndroid Build Coastguard Worker #define _FD_BO_NOSYNC BITSET_BIT(7) /* Avoid userspace fencing on control buffers */
131*61046927SAndroid Build Coastguard Worker
132*61046927SAndroid Build Coastguard Worker /* Additional flags hinting usage, only used for tracing. Buffers without
133*61046927SAndroid Build Coastguard Worker * one of these flags set will be presumed to be driver internal.
134*61046927SAndroid Build Coastguard Worker */
135*61046927SAndroid Build Coastguard Worker #define FD_BO_HINT_BUFFER BITSET_BIT(8)
136*61046927SAndroid Build Coastguard Worker #define FD_BO_HINT_IMAGE BITSET_BIT(9)
137*61046927SAndroid Build Coastguard Worker #define FD_BO_HINT_COMMAND BITSET_BIT(10)
138*61046927SAndroid Build Coastguard Worker #define _FD_BO_HINT_HEAP BITSET_BIT(11)
139*61046927SAndroid Build Coastguard Worker #define _FD_BO_HINTS ( \
140*61046927SAndroid Build Coastguard Worker FD_BO_HINT_BUFFER | \
141*61046927SAndroid Build Coastguard Worker FD_BO_HINT_IMAGE | \
142*61046927SAndroid Build Coastguard Worker FD_BO_HINT_COMMAND | \
143*61046927SAndroid Build Coastguard Worker _FD_BO_HINT_HEAP | \
144*61046927SAndroid Build Coastguard Worker 0)
145*61046927SAndroid Build Coastguard Worker
146*61046927SAndroid Build Coastguard Worker /*
147*61046927SAndroid Build Coastguard Worker * bo access flags: (keep aligned to MSM_PREP_x)
148*61046927SAndroid Build Coastguard Worker */
149*61046927SAndroid Build Coastguard Worker #define FD_BO_PREP_READ BITSET_BIT(0)
150*61046927SAndroid Build Coastguard Worker #define FD_BO_PREP_WRITE BITSET_BIT(1)
151*61046927SAndroid Build Coastguard Worker #define FD_BO_PREP_NOSYNC BITSET_BIT(2)
152*61046927SAndroid Build Coastguard Worker #define FD_BO_PREP_FLUSH BITSET_BIT(3)
153*61046927SAndroid Build Coastguard Worker
154*61046927SAndroid Build Coastguard Worker
155*61046927SAndroid Build Coastguard Worker /* device functions:
156*61046927SAndroid Build Coastguard Worker */
157*61046927SAndroid Build Coastguard Worker
158*61046927SAndroid Build Coastguard Worker struct fd_device *fd_device_new(int fd);
159*61046927SAndroid Build Coastguard Worker struct fd_device *fd_device_new_dup(int fd);
160*61046927SAndroid Build Coastguard Worker struct fd_device *fd_device_open(void);
161*61046927SAndroid Build Coastguard Worker struct fd_device *fd_device_ref(struct fd_device *dev);
162*61046927SAndroid Build Coastguard Worker void fd_device_purge(struct fd_device *dev);
163*61046927SAndroid Build Coastguard Worker void fd_device_del(struct fd_device *dev);
164*61046927SAndroid Build Coastguard Worker int fd_device_fd(struct fd_device *dev);
165*61046927SAndroid Build Coastguard Worker
166*61046927SAndroid Build Coastguard Worker enum fd_version {
167*61046927SAndroid Build Coastguard Worker FD_VERSION_MADVISE = 1, /* kernel supports madvise */
168*61046927SAndroid Build Coastguard Worker FD_VERSION_UNLIMITED_CMDS = 1, /* submits w/ >4 cmd buffers (growable ringbuffer) */
169*61046927SAndroid Build Coastguard Worker FD_VERSION_FENCE_FD = 2, /* submit command supports in/out fences */
170*61046927SAndroid Build Coastguard Worker FD_VERSION_GMEM_BASE = 3, /* supports querying GMEM base address */
171*61046927SAndroid Build Coastguard Worker FD_VERSION_SUBMIT_QUEUES = 3, /* submit queues and multiple priority levels */
172*61046927SAndroid Build Coastguard Worker FD_VERSION_BO_IOVA = 3, /* supports fd_bo_get/put_iova() */
173*61046927SAndroid Build Coastguard Worker FD_VERSION_SOFTPIN = 4, /* adds softpin, bo name, and dump flag */
174*61046927SAndroid Build Coastguard Worker FD_VERSION_ROBUSTNESS = 5, /* adds FD_NR_FAULTS and FD_PP_PGTABLE */
175*61046927SAndroid Build Coastguard Worker FD_VERSION_MEMORY_FD = 2, /* supports shared memory objects */
176*61046927SAndroid Build Coastguard Worker FD_VERSION_SUSPENDS = 7, /* Adds MSM_PARAM_SUSPENDS to detect device suspend */
177*61046927SAndroid Build Coastguard Worker FD_VERSION_CACHED_COHERENT = 8, /* Adds cached-coherent support (a6xx+) */
178*61046927SAndroid Build Coastguard Worker FD_VERSION_VA_SIZE = 9,
179*61046927SAndroid Build Coastguard Worker };
180*61046927SAndroid Build Coastguard Worker enum fd_version fd_device_version(struct fd_device *dev);
181*61046927SAndroid Build Coastguard Worker
182*61046927SAndroid Build Coastguard Worker bool fd_has_syncobj(struct fd_device *dev);
183*61046927SAndroid Build Coastguard Worker
184*61046927SAndroid Build Coastguard Worker /* pipe functions:
185*61046927SAndroid Build Coastguard Worker */
186*61046927SAndroid Build Coastguard Worker
187*61046927SAndroid Build Coastguard Worker struct fd_pipe *fd_pipe_new(struct fd_device *dev, enum fd_pipe_id id);
188*61046927SAndroid Build Coastguard Worker struct fd_pipe *fd_pipe_new2(struct fd_device *dev, enum fd_pipe_id id,
189*61046927SAndroid Build Coastguard Worker uint32_t prio);
190*61046927SAndroid Build Coastguard Worker struct fd_pipe *fd_pipe_ref(struct fd_pipe *pipe);
191*61046927SAndroid Build Coastguard Worker struct fd_pipe *fd_pipe_ref_locked(struct fd_pipe *pipe);
192*61046927SAndroid Build Coastguard Worker void fd_pipe_del(struct fd_pipe *pipe);
193*61046927SAndroid Build Coastguard Worker void fd_pipe_purge(struct fd_pipe *pipe);
194*61046927SAndroid Build Coastguard Worker const struct fd_dev_id * fd_pipe_dev_id(struct fd_pipe *pipe);
195*61046927SAndroid Build Coastguard Worker int fd_pipe_get_param(struct fd_pipe *pipe, enum fd_param_id param,
196*61046927SAndroid Build Coastguard Worker uint64_t *value);
197*61046927SAndroid Build Coastguard Worker int fd_pipe_set_param(struct fd_pipe *pipe, enum fd_param_id param,
198*61046927SAndroid Build Coastguard Worker uint64_t value);
199*61046927SAndroid Build Coastguard Worker int fd_pipe_wait(struct fd_pipe *pipe, const struct fd_fence *fence);
200*61046927SAndroid Build Coastguard Worker /* timeout in nanosec */
201*61046927SAndroid Build Coastguard Worker int fd_pipe_wait_timeout(struct fd_pipe *pipe, const struct fd_fence *fence,
202*61046927SAndroid Build Coastguard Worker uint64_t timeout);
203*61046927SAndroid Build Coastguard Worker
204*61046927SAndroid Build Coastguard Worker /* buffer-object functions:
205*61046927SAndroid Build Coastguard Worker */
206*61046927SAndroid Build Coastguard Worker
207*61046927SAndroid Build Coastguard Worker struct fd_bo {
208*61046927SAndroid Build Coastguard Worker struct fd_device *dev;
209*61046927SAndroid Build Coastguard Worker uint32_t size;
210*61046927SAndroid Build Coastguard Worker uint32_t handle;
211*61046927SAndroid Build Coastguard Worker uint32_t name;
212*61046927SAndroid Build Coastguard Worker int32_t refcnt;
213*61046927SAndroid Build Coastguard Worker uint32_t reloc_flags; /* flags like FD_RELOC_DUMP to use for relocs to this BO */
214*61046927SAndroid Build Coastguard Worker uint32_t alloc_flags; /* flags that control allocation/mapping, ie. FD_BO_x */
215*61046927SAndroid Build Coastguard Worker uint64_t iova;
216*61046927SAndroid Build Coastguard Worker void *map;
217*61046927SAndroid Build Coastguard Worker const struct fd_bo_funcs *funcs;
218*61046927SAndroid Build Coastguard Worker
219*61046927SAndroid Build Coastguard Worker enum {
220*61046927SAndroid Build Coastguard Worker NO_CACHE = 0,
221*61046927SAndroid Build Coastguard Worker BO_CACHE = 1,
222*61046927SAndroid Build Coastguard Worker RING_CACHE = 2,
223*61046927SAndroid Build Coastguard Worker } bo_reuse : 2;
224*61046927SAndroid Build Coastguard Worker
225*61046927SAndroid Build Coastguard Worker /* Most recent index in submit's bo table, used to optimize the common
226*61046927SAndroid Build Coastguard Worker * case where a bo is used many times in the same submit.
227*61046927SAndroid Build Coastguard Worker */
228*61046927SAndroid Build Coastguard Worker uint32_t idx;
229*61046927SAndroid Build Coastguard Worker
230*61046927SAndroid Build Coastguard Worker struct list_head node; /* bucket-list entry */
231*61046927SAndroid Build Coastguard Worker time_t free_time; /* time when added to bucket-list */
232*61046927SAndroid Build Coastguard Worker
233*61046927SAndroid Build Coastguard Worker unsigned short nr_fences, max_fences;
234*61046927SAndroid Build Coastguard Worker struct fd_fence **fences;
235*61046927SAndroid Build Coastguard Worker
236*61046927SAndroid Build Coastguard Worker /* In the common case, there is no more than one fence attached.
237*61046927SAndroid Build Coastguard Worker * This provides storage for the fences table until it grows to
238*61046927SAndroid Build Coastguard Worker * be larger than a single element.
239*61046927SAndroid Build Coastguard Worker */
240*61046927SAndroid Build Coastguard Worker struct fd_fence *_inline_fence;
241*61046927SAndroid Build Coastguard Worker };
242*61046927SAndroid Build Coastguard Worker
243*61046927SAndroid Build Coastguard Worker struct fd_bo *_fd_bo_new(struct fd_device *dev, uint32_t size, uint32_t flags);
244*61046927SAndroid Build Coastguard Worker void _fd_bo_set_name(struct fd_bo *bo, const char *fmt, va_list ap);
245*61046927SAndroid Build Coastguard Worker
246*61046927SAndroid Build Coastguard Worker static inline void fd_bo_set_name(struct fd_bo *bo, const char *fmt, ...)
247*61046927SAndroid Build Coastguard Worker _util_printf_format(2, 3);
248*61046927SAndroid Build Coastguard Worker
249*61046927SAndroid Build Coastguard Worker static inline void
fd_bo_set_name(struct fd_bo * bo,const char * fmt,...)250*61046927SAndroid Build Coastguard Worker fd_bo_set_name(struct fd_bo *bo, const char *fmt, ...)
251*61046927SAndroid Build Coastguard Worker {
252*61046927SAndroid Build Coastguard Worker #ifndef NDEBUG
253*61046927SAndroid Build Coastguard Worker va_list ap;
254*61046927SAndroid Build Coastguard Worker va_start(ap, fmt);
255*61046927SAndroid Build Coastguard Worker _fd_bo_set_name(bo, fmt, ap);
256*61046927SAndroid Build Coastguard Worker va_end(ap);
257*61046927SAndroid Build Coastguard Worker #endif
258*61046927SAndroid Build Coastguard Worker }
259*61046927SAndroid Build Coastguard Worker
260*61046927SAndroid Build Coastguard Worker static inline struct fd_bo *fd_bo_new(struct fd_device *dev, uint32_t size,
261*61046927SAndroid Build Coastguard Worker uint32_t flags, const char *fmt, ...)
262*61046927SAndroid Build Coastguard Worker _util_printf_format(4, 5);
263*61046927SAndroid Build Coastguard Worker
264*61046927SAndroid Build Coastguard Worker static inline struct fd_bo *
fd_bo_new(struct fd_device * dev,uint32_t size,uint32_t flags,const char * fmt,...)265*61046927SAndroid Build Coastguard Worker fd_bo_new(struct fd_device *dev, uint32_t size, uint32_t flags, const char *fmt,
266*61046927SAndroid Build Coastguard Worker ...)
267*61046927SAndroid Build Coastguard Worker {
268*61046927SAndroid Build Coastguard Worker struct fd_bo *bo = _fd_bo_new(dev, size, flags);
269*61046927SAndroid Build Coastguard Worker #ifndef NDEBUG
270*61046927SAndroid Build Coastguard Worker if (fmt) {
271*61046927SAndroid Build Coastguard Worker va_list ap;
272*61046927SAndroid Build Coastguard Worker va_start(ap, fmt);
273*61046927SAndroid Build Coastguard Worker _fd_bo_set_name(bo, fmt, ap);
274*61046927SAndroid Build Coastguard Worker va_end(ap);
275*61046927SAndroid Build Coastguard Worker }
276*61046927SAndroid Build Coastguard Worker #endif
277*61046927SAndroid Build Coastguard Worker return bo;
278*61046927SAndroid Build Coastguard Worker }
279*61046927SAndroid Build Coastguard Worker
280*61046927SAndroid Build Coastguard Worker struct fd_bo *fd_bo_from_handle(struct fd_device *dev, uint32_t handle,
281*61046927SAndroid Build Coastguard Worker uint32_t size);
282*61046927SAndroid Build Coastguard Worker struct fd_bo *fd_bo_from_name(struct fd_device *dev, uint32_t name);
283*61046927SAndroid Build Coastguard Worker struct fd_bo *fd_bo_from_dmabuf(struct fd_device *dev, int fd);
284*61046927SAndroid Build Coastguard Worker void fd_bo_mark_for_dump(struct fd_bo *bo);
285*61046927SAndroid Build Coastguard Worker
286*61046927SAndroid Build Coastguard Worker static inline uint64_t
fd_bo_get_iova(struct fd_bo * bo)287*61046927SAndroid Build Coastguard Worker fd_bo_get_iova(struct fd_bo *bo)
288*61046927SAndroid Build Coastguard Worker {
289*61046927SAndroid Build Coastguard Worker /* ancient kernels did not support this */
290*61046927SAndroid Build Coastguard Worker assert(bo->iova != 0);
291*61046927SAndroid Build Coastguard Worker return bo->iova;
292*61046927SAndroid Build Coastguard Worker }
293*61046927SAndroid Build Coastguard Worker
294*61046927SAndroid Build Coastguard Worker struct fd_bo *fd_bo_ref(struct fd_bo *bo);
295*61046927SAndroid Build Coastguard Worker void fd_bo_del(struct fd_bo *bo);
296*61046927SAndroid Build Coastguard Worker void fd_bo_del_array(struct fd_bo **bos, int count);
297*61046927SAndroid Build Coastguard Worker void fd_bo_del_list_nocache(struct list_head *list);
298*61046927SAndroid Build Coastguard Worker int fd_bo_get_name(struct fd_bo *bo, uint32_t *name);
299*61046927SAndroid Build Coastguard Worker uint32_t fd_bo_handle(struct fd_bo *bo);
300*61046927SAndroid Build Coastguard Worker int fd_bo_dmabuf_drm(struct fd_bo *bo);
301*61046927SAndroid Build Coastguard Worker int fd_bo_dmabuf(struct fd_bo *bo);
302*61046927SAndroid Build Coastguard Worker uint32_t fd_bo_size(struct fd_bo *bo);
303*61046927SAndroid Build Coastguard Worker void *fd_bo_map(struct fd_bo *bo);
304*61046927SAndroid Build Coastguard Worker void fd_bo_upload(struct fd_bo *bo, void *src, unsigned off, unsigned len);
305*61046927SAndroid Build Coastguard Worker bool fd_bo_prefer_upload(struct fd_bo *bo, unsigned len);
306*61046927SAndroid Build Coastguard Worker int fd_bo_cpu_prep(struct fd_bo *bo, struct fd_pipe *pipe, uint32_t op);
307*61046927SAndroid Build Coastguard Worker bool fd_bo_is_cached(struct fd_bo *bo);
308*61046927SAndroid Build Coastguard Worker void fd_bo_set_metadata(struct fd_bo *bo, void *metadata, uint32_t metadata_size);
309*61046927SAndroid Build Coastguard Worker int fd_bo_get_metadata(struct fd_bo *bo, void *metadata, uint32_t metadata_size);
310*61046927SAndroid Build Coastguard Worker
311*61046927SAndroid Build Coastguard Worker #ifdef __cplusplus
312*61046927SAndroid Build Coastguard Worker } /* end of extern "C" */
313*61046927SAndroid Build Coastguard Worker #endif
314*61046927SAndroid Build Coastguard Worker
315*61046927SAndroid Build Coastguard Worker #endif /* FREEDRENO_DRMIF_H_ */
316