xref: /linux/drivers/gpu/drm/vc4/vc4_drv.h (revision 65101d8c9108201118efa7e08f4e2c57f438deb9)
1c8b75bcaSEric Anholt /*
2c8b75bcaSEric Anholt  * Copyright (C) 2015 Broadcom
3c8b75bcaSEric Anholt  *
4c8b75bcaSEric Anholt  * This program is free software; you can redistribute it and/or modify
5c8b75bcaSEric Anholt  * it under the terms of the GNU General Public License version 2 as
6c8b75bcaSEric Anholt  * published by the Free Software Foundation.
7c8b75bcaSEric Anholt  */
8c8b75bcaSEric Anholt 
9cdec4d36SEric Anholt #include <linux/reservation.h>
10b7e8e25bSMasahiro Yamada #include <drm/drmP.h>
119338203cSLaurent Pinchart #include <drm/drm_encoder.h>
12b7e8e25bSMasahiro Yamada #include <drm/drm_gem_cma_helper.h>
139338203cSLaurent Pinchart 
14*65101d8cSBoris Brezillon #include "uapi/drm/vc4_drm.h"
15*65101d8cSBoris Brezillon 
16f3099462SEric Anholt /* Don't forget to update vc4_bo.c: bo_type_names[] when adding to
17f3099462SEric Anholt  * this.
18f3099462SEric Anholt  */
19f3099462SEric Anholt enum vc4_kernel_bo_type {
20f3099462SEric Anholt 	/* Any kernel allocation (gem_create_object hook) before it
21f3099462SEric Anholt 	 * gets another type set.
22f3099462SEric Anholt 	 */
23f3099462SEric Anholt 	VC4_BO_TYPE_KERNEL,
24f3099462SEric Anholt 	VC4_BO_TYPE_V3D,
25f3099462SEric Anholt 	VC4_BO_TYPE_V3D_SHADER,
26f3099462SEric Anholt 	VC4_BO_TYPE_DUMB,
27f3099462SEric Anholt 	VC4_BO_TYPE_BIN,
28f3099462SEric Anholt 	VC4_BO_TYPE_RCL,
29f3099462SEric Anholt 	VC4_BO_TYPE_BCL,
30f3099462SEric Anholt 	VC4_BO_TYPE_KERNEL_CACHE,
31f3099462SEric Anholt 	VC4_BO_TYPE_COUNT
32f3099462SEric Anholt };
33f3099462SEric Anholt 
34*65101d8cSBoris Brezillon /* Performance monitor object. The perform lifetime is controlled by userspace
35*65101d8cSBoris Brezillon  * using perfmon related ioctls. A perfmon can be attached to a submit_cl
36*65101d8cSBoris Brezillon  * request, and when this is the case, HW perf counters will be activated just
37*65101d8cSBoris Brezillon  * before the submit_cl is submitted to the GPU and disabled when the job is
38*65101d8cSBoris Brezillon  * done. This way, only events related to a specific job will be counted.
39*65101d8cSBoris Brezillon  */
40*65101d8cSBoris Brezillon struct vc4_perfmon {
41*65101d8cSBoris Brezillon 	/* Tracks the number of users of the perfmon, when this counter reaches
42*65101d8cSBoris Brezillon 	 * zero the perfmon is destroyed.
43*65101d8cSBoris Brezillon 	 */
44*65101d8cSBoris Brezillon 	refcount_t refcnt;
45*65101d8cSBoris Brezillon 
46*65101d8cSBoris Brezillon 	/* Number of counters activated in this perfmon instance
47*65101d8cSBoris Brezillon 	 * (should be less than DRM_VC4_MAX_PERF_COUNTERS).
48*65101d8cSBoris Brezillon 	 */
49*65101d8cSBoris Brezillon 	u8 ncounters;
50*65101d8cSBoris Brezillon 
51*65101d8cSBoris Brezillon 	/* Events counted by the HW perf counters. */
52*65101d8cSBoris Brezillon 	u8 events[DRM_VC4_MAX_PERF_COUNTERS];
53*65101d8cSBoris Brezillon 
54*65101d8cSBoris Brezillon 	/* Storage for counter values. Counters are incremented by the HW
55*65101d8cSBoris Brezillon 	 * perf counter values every time the perfmon is attached to a GPU job.
56*65101d8cSBoris Brezillon 	 * This way, perfmon users don't have to retrieve the results after
57*65101d8cSBoris Brezillon 	 * each job if they want to track events covering several submissions.
58*65101d8cSBoris Brezillon 	 * Note that counter values can't be reset, but you can fake a reset by
59*65101d8cSBoris Brezillon 	 * destroying the perfmon and creating a new one.
60*65101d8cSBoris Brezillon 	 */
61*65101d8cSBoris Brezillon 	u64 counters[0];
62*65101d8cSBoris Brezillon };
63*65101d8cSBoris Brezillon 
64c8b75bcaSEric Anholt struct vc4_dev {
65c8b75bcaSEric Anholt 	struct drm_device *dev;
66c8b75bcaSEric Anholt 
67c8b75bcaSEric Anholt 	struct vc4_hdmi *hdmi;
68c8b75bcaSEric Anholt 	struct vc4_hvs *hvs;
69d3f5168aSEric Anholt 	struct vc4_v3d *v3d;
7008302c35SEric Anholt 	struct vc4_dpi *dpi;
714078f575SEric Anholt 	struct vc4_dsi *dsi1;
72e4b81f8cSBoris Brezillon 	struct vc4_vec *vec;
7348666d56SDerek Foreman 
7421461365SEric Anholt 	struct vc4_hang_state *hang_state;
7521461365SEric Anholt 
76c826a6e1SEric Anholt 	/* The kernel-space BO cache.  Tracks buffers that have been
77c826a6e1SEric Anholt 	 * unreferenced by all other users (refcounts of 0!) but not
78c826a6e1SEric Anholt 	 * yet freed, so we can do cheap allocations.
79c826a6e1SEric Anholt 	 */
80c826a6e1SEric Anholt 	struct vc4_bo_cache {
81c826a6e1SEric Anholt 		/* Array of list heads for entries in the BO cache,
82c826a6e1SEric Anholt 		 * based on number of pages, so we can do O(1) lookups
83c826a6e1SEric Anholt 		 * in the cache when allocating.
84c826a6e1SEric Anholt 		 */
85c826a6e1SEric Anholt 		struct list_head *size_list;
86c826a6e1SEric Anholt 		uint32_t size_list_size;
87c826a6e1SEric Anholt 
88c826a6e1SEric Anholt 		/* List of all BOs in the cache, ordered by age, so we
89c826a6e1SEric Anholt 		 * can do O(1) lookups when trying to free old
90c826a6e1SEric Anholt 		 * buffers.
91c826a6e1SEric Anholt 		 */
92c826a6e1SEric Anholt 		struct list_head time_list;
93c826a6e1SEric Anholt 		struct work_struct time_work;
94c826a6e1SEric Anholt 		struct timer_list time_timer;
95c826a6e1SEric Anholt 	} bo_cache;
96c826a6e1SEric Anholt 
97f3099462SEric Anholt 	u32 num_labels;
98f3099462SEric Anholt 	struct vc4_label {
99f3099462SEric Anholt 		const char *name;
100c826a6e1SEric Anholt 		u32 num_allocated;
101c826a6e1SEric Anholt 		u32 size_allocated;
102f3099462SEric Anholt 	} *bo_labels;
103c826a6e1SEric Anholt 
104f3099462SEric Anholt 	/* Protects bo_cache and bo_labels. */
105c826a6e1SEric Anholt 	struct mutex bo_lock;
106d5b1a78aSEric Anholt 
107b9f19259SBoris Brezillon 	/* Purgeable BO pool. All BOs in this pool can have their memory
108b9f19259SBoris Brezillon 	 * reclaimed if the driver is unable to allocate new BOs. We also
109b9f19259SBoris Brezillon 	 * keep stats related to the purge mechanism here.
110b9f19259SBoris Brezillon 	 */
111b9f19259SBoris Brezillon 	struct {
112b9f19259SBoris Brezillon 		struct list_head list;
113b9f19259SBoris Brezillon 		unsigned int num;
114b9f19259SBoris Brezillon 		size_t size;
115b9f19259SBoris Brezillon 		unsigned int purged_num;
116b9f19259SBoris Brezillon 		size_t purged_size;
117b9f19259SBoris Brezillon 		struct mutex lock;
118b9f19259SBoris Brezillon 	} purgeable;
119b9f19259SBoris Brezillon 
120cdec4d36SEric Anholt 	uint64_t dma_fence_context;
121cdec4d36SEric Anholt 
122ca26d28bSVarad Gautam 	/* Sequence number for the last job queued in bin_job_list.
123d5b1a78aSEric Anholt 	 * Starts at 0 (no jobs emitted).
124d5b1a78aSEric Anholt 	 */
125d5b1a78aSEric Anholt 	uint64_t emit_seqno;
126d5b1a78aSEric Anholt 
127d5b1a78aSEric Anholt 	/* Sequence number for the last completed job on the GPU.
128d5b1a78aSEric Anholt 	 * Starts at 0 (no jobs completed).
129d5b1a78aSEric Anholt 	 */
130d5b1a78aSEric Anholt 	uint64_t finished_seqno;
131d5b1a78aSEric Anholt 
132ca26d28bSVarad Gautam 	/* List of all struct vc4_exec_info for jobs to be executed in
133ca26d28bSVarad Gautam 	 * the binner.  The first job in the list is the one currently
134ca26d28bSVarad Gautam 	 * programmed into ct0ca for execution.
135d5b1a78aSEric Anholt 	 */
136ca26d28bSVarad Gautam 	struct list_head bin_job_list;
137ca26d28bSVarad Gautam 
138ca26d28bSVarad Gautam 	/* List of all struct vc4_exec_info for jobs that have
139ca26d28bSVarad Gautam 	 * completed binning and are ready for rendering.  The first
140ca26d28bSVarad Gautam 	 * job in the list is the one currently programmed into ct1ca
141ca26d28bSVarad Gautam 	 * for execution.
142ca26d28bSVarad Gautam 	 */
143ca26d28bSVarad Gautam 	struct list_head render_job_list;
144ca26d28bSVarad Gautam 
145d5b1a78aSEric Anholt 	/* List of the finished vc4_exec_infos waiting to be freed by
146d5b1a78aSEric Anholt 	 * job_done_work.
147d5b1a78aSEric Anholt 	 */
148d5b1a78aSEric Anholt 	struct list_head job_done_list;
149d5b1a78aSEric Anholt 	/* Spinlock used to synchronize the job_list and seqno
150d5b1a78aSEric Anholt 	 * accesses between the IRQ handler and GEM ioctls.
151d5b1a78aSEric Anholt 	 */
152d5b1a78aSEric Anholt 	spinlock_t job_lock;
153d5b1a78aSEric Anholt 	wait_queue_head_t job_wait_queue;
154d5b1a78aSEric Anholt 	struct work_struct job_done_work;
155d5b1a78aSEric Anholt 
156*65101d8cSBoris Brezillon 	/* Used to track the active perfmon if any. Access to this field is
157*65101d8cSBoris Brezillon 	 * protected by job_lock.
158*65101d8cSBoris Brezillon 	 */
159*65101d8cSBoris Brezillon 	struct vc4_perfmon *active_perfmon;
160*65101d8cSBoris Brezillon 
161b501baccSEric Anholt 	/* List of struct vc4_seqno_cb for callbacks to be made from a
162b501baccSEric Anholt 	 * workqueue when the given seqno is passed.
163b501baccSEric Anholt 	 */
164b501baccSEric Anholt 	struct list_head seqno_cb_list;
165b501baccSEric Anholt 
166553c942fSEric Anholt 	/* The memory used for storing binner tile alloc, tile state,
167553c942fSEric Anholt 	 * and overflow memory allocations.  This is freed when V3D
168553c942fSEric Anholt 	 * powers down.
169d5b1a78aSEric Anholt 	 */
170553c942fSEric Anholt 	struct vc4_bo *bin_bo;
171553c942fSEric Anholt 
172553c942fSEric Anholt 	/* Size of blocks allocated within bin_bo. */
173553c942fSEric Anholt 	uint32_t bin_alloc_size;
174553c942fSEric Anholt 
175553c942fSEric Anholt 	/* Bitmask of the bin_alloc_size chunks in bin_bo that are
176553c942fSEric Anholt 	 * used.
177553c942fSEric Anholt 	 */
178553c942fSEric Anholt 	uint32_t bin_alloc_used;
179553c942fSEric Anholt 
180553c942fSEric Anholt 	/* Bitmask of the current bin_alloc used for overflow memory. */
181553c942fSEric Anholt 	uint32_t bin_alloc_overflow;
182553c942fSEric Anholt 
183d5b1a78aSEric Anholt 	struct work_struct overflow_mem_work;
184d5b1a78aSEric Anholt 
18536cb6253SEric Anholt 	int power_refcount;
18636cb6253SEric Anholt 
18736cb6253SEric Anholt 	/* Mutex controlling the power refcount. */
18836cb6253SEric Anholt 	struct mutex power_lock;
18936cb6253SEric Anholt 
190d5b1a78aSEric Anholt 	struct {
191d5b1a78aSEric Anholt 		struct timer_list timer;
192d5b1a78aSEric Anholt 		struct work_struct reset_work;
193d5b1a78aSEric Anholt 	} hangcheck;
194d5b1a78aSEric Anholt 
195d5b1a78aSEric Anholt 	struct semaphore async_modeset;
196c8b75bcaSEric Anholt };
197c8b75bcaSEric Anholt 
198c8b75bcaSEric Anholt static inline struct vc4_dev *
199c8b75bcaSEric Anholt to_vc4_dev(struct drm_device *dev)
200c8b75bcaSEric Anholt {
201c8b75bcaSEric Anholt 	return (struct vc4_dev *)dev->dev_private;
202c8b75bcaSEric Anholt }
203c8b75bcaSEric Anholt 
204c8b75bcaSEric Anholt struct vc4_bo {
205c8b75bcaSEric Anholt 	struct drm_gem_cma_object base;
206c826a6e1SEric Anholt 
2077edabee0SEric Anholt 	/* seqno of the last job to render using this BO. */
208d5b1a78aSEric Anholt 	uint64_t seqno;
209d5b1a78aSEric Anholt 
2107edabee0SEric Anholt 	/* seqno of the last job to use the RCL to write to this BO.
2117edabee0SEric Anholt 	 *
2127edabee0SEric Anholt 	 * Note that this doesn't include binner overflow memory
2137edabee0SEric Anholt 	 * writes.
2147edabee0SEric Anholt 	 */
2157edabee0SEric Anholt 	uint64_t write_seqno;
2167edabee0SEric Anholt 
21783753117SEric Anholt 	bool t_format;
21883753117SEric Anholt 
219c826a6e1SEric Anholt 	/* List entry for the BO's position in either
220c826a6e1SEric Anholt 	 * vc4_exec_info->unref_list or vc4_dev->bo_cache.time_list
221c826a6e1SEric Anholt 	 */
222c826a6e1SEric Anholt 	struct list_head unref_head;
223c826a6e1SEric Anholt 
224c826a6e1SEric Anholt 	/* Time in jiffies when the BO was put in vc4->bo_cache. */
225c826a6e1SEric Anholt 	unsigned long free_time;
226c826a6e1SEric Anholt 
227c826a6e1SEric Anholt 	/* List entry for the BO's position in vc4_dev->bo_cache.size_list */
228c826a6e1SEric Anholt 	struct list_head size_head;
229463873d5SEric Anholt 
230463873d5SEric Anholt 	/* Struct for shader validation state, if created by
231463873d5SEric Anholt 	 * DRM_IOCTL_VC4_CREATE_SHADER_BO.
232463873d5SEric Anholt 	 */
233463873d5SEric Anholt 	struct vc4_validated_shader_info *validated_shader;
234cdec4d36SEric Anholt 
235cdec4d36SEric Anholt 	/* normally (resv == &_resv) except for imported bo's */
236cdec4d36SEric Anholt 	struct reservation_object *resv;
237cdec4d36SEric Anholt 	struct reservation_object _resv;
238f3099462SEric Anholt 
239f3099462SEric Anholt 	/* One of enum vc4_kernel_bo_type, or VC4_BO_TYPE_COUNT + i
240f3099462SEric Anholt 	 * for user-allocated labels.
241f3099462SEric Anholt 	 */
242f3099462SEric Anholt 	int label;
243b9f19259SBoris Brezillon 
244b9f19259SBoris Brezillon 	/* Count the number of active users. This is needed to determine
245b9f19259SBoris Brezillon 	 * whether we can move the BO to the purgeable list or not (when the BO
246b9f19259SBoris Brezillon 	 * is used by the GPU or the display engine we can't purge it).
247b9f19259SBoris Brezillon 	 */
248b9f19259SBoris Brezillon 	refcount_t usecnt;
249b9f19259SBoris Brezillon 
250b9f19259SBoris Brezillon 	/* Store purgeable/purged state here */
251b9f19259SBoris Brezillon 	u32 madv;
252b9f19259SBoris Brezillon 	struct mutex madv_lock;
253c8b75bcaSEric Anholt };
254c8b75bcaSEric Anholt 
255c8b75bcaSEric Anholt static inline struct vc4_bo *
256c8b75bcaSEric Anholt to_vc4_bo(struct drm_gem_object *bo)
257c8b75bcaSEric Anholt {
258c8b75bcaSEric Anholt 	return (struct vc4_bo *)bo;
259c8b75bcaSEric Anholt }
260c8b75bcaSEric Anholt 
261cdec4d36SEric Anholt struct vc4_fence {
262cdec4d36SEric Anholt 	struct dma_fence base;
263cdec4d36SEric Anholt 	struct drm_device *dev;
264cdec4d36SEric Anholt 	/* vc4 seqno for signaled() test */
265cdec4d36SEric Anholt 	uint64_t seqno;
266cdec4d36SEric Anholt };
267cdec4d36SEric Anholt 
268cdec4d36SEric Anholt static inline struct vc4_fence *
269cdec4d36SEric Anholt to_vc4_fence(struct dma_fence *fence)
270cdec4d36SEric Anholt {
271cdec4d36SEric Anholt 	return (struct vc4_fence *)fence;
272cdec4d36SEric Anholt }
273cdec4d36SEric Anholt 
274b501baccSEric Anholt struct vc4_seqno_cb {
275b501baccSEric Anholt 	struct work_struct work;
276b501baccSEric Anholt 	uint64_t seqno;
277b501baccSEric Anholt 	void (*func)(struct vc4_seqno_cb *cb);
278b501baccSEric Anholt };
279b501baccSEric Anholt 
280d3f5168aSEric Anholt struct vc4_v3d {
281001bdb55SEric Anholt 	struct vc4_dev *vc4;
282d3f5168aSEric Anholt 	struct platform_device *pdev;
283d3f5168aSEric Anholt 	void __iomem *regs;
284b72a2816SEric Anholt 	struct clk *clk;
285d3f5168aSEric Anholt };
286d3f5168aSEric Anholt 
287c8b75bcaSEric Anholt struct vc4_hvs {
288c8b75bcaSEric Anholt 	struct platform_device *pdev;
289c8b75bcaSEric Anholt 	void __iomem *regs;
290d8dbf44fSEric Anholt 	u32 __iomem *dlist;
291d8dbf44fSEric Anholt 
292d8dbf44fSEric Anholt 	/* Memory manager for CRTCs to allocate space in the display
293d8dbf44fSEric Anholt 	 * list.  Units are dwords.
294d8dbf44fSEric Anholt 	 */
295d8dbf44fSEric Anholt 	struct drm_mm dlist_mm;
29621af94cfSEric Anholt 	/* Memory manager for the LBM memory used by HVS scaling. */
29721af94cfSEric Anholt 	struct drm_mm lbm_mm;
298d8dbf44fSEric Anholt 	spinlock_t mm_lock;
29921af94cfSEric Anholt 
30021af94cfSEric Anholt 	struct drm_mm_node mitchell_netravali_filter;
301c8b75bcaSEric Anholt };
302c8b75bcaSEric Anholt 
303c8b75bcaSEric Anholt struct vc4_plane {
304c8b75bcaSEric Anholt 	struct drm_plane base;
305c8b75bcaSEric Anholt };
306c8b75bcaSEric Anholt 
307c8b75bcaSEric Anholt static inline struct vc4_plane *
308c8b75bcaSEric Anholt to_vc4_plane(struct drm_plane *plane)
309c8b75bcaSEric Anholt {
310c8b75bcaSEric Anholt 	return (struct vc4_plane *)plane;
311c8b75bcaSEric Anholt }
312c8b75bcaSEric Anholt 
313c8b75bcaSEric Anholt enum vc4_encoder_type {
314ab8df60eSBoris Brezillon 	VC4_ENCODER_TYPE_NONE,
315c8b75bcaSEric Anholt 	VC4_ENCODER_TYPE_HDMI,
316c8b75bcaSEric Anholt 	VC4_ENCODER_TYPE_VEC,
317c8b75bcaSEric Anholt 	VC4_ENCODER_TYPE_DSI0,
318c8b75bcaSEric Anholt 	VC4_ENCODER_TYPE_DSI1,
319c8b75bcaSEric Anholt 	VC4_ENCODER_TYPE_SMI,
320c8b75bcaSEric Anholt 	VC4_ENCODER_TYPE_DPI,
321c8b75bcaSEric Anholt };
322c8b75bcaSEric Anholt 
323c8b75bcaSEric Anholt struct vc4_encoder {
324c8b75bcaSEric Anholt 	struct drm_encoder base;
325c8b75bcaSEric Anholt 	enum vc4_encoder_type type;
326c8b75bcaSEric Anholt 	u32 clock_select;
327c8b75bcaSEric Anholt };
328c8b75bcaSEric Anholt 
329c8b75bcaSEric Anholt static inline struct vc4_encoder *
330c8b75bcaSEric Anholt to_vc4_encoder(struct drm_encoder *encoder)
331c8b75bcaSEric Anholt {
332c8b75bcaSEric Anholt 	return container_of(encoder, struct vc4_encoder, base);
333c8b75bcaSEric Anholt }
334c8b75bcaSEric Anholt 
335d3f5168aSEric Anholt #define V3D_READ(offset) readl(vc4->v3d->regs + offset)
336d3f5168aSEric Anholt #define V3D_WRITE(offset, val) writel(val, vc4->v3d->regs + offset)
337c8b75bcaSEric Anholt #define HVS_READ(offset) readl(vc4->hvs->regs + offset)
338c8b75bcaSEric Anholt #define HVS_WRITE(offset, val) writel(val, vc4->hvs->regs + offset)
339c8b75bcaSEric Anholt 
340d5b1a78aSEric Anholt struct vc4_exec_info {
341d5b1a78aSEric Anholt 	/* Sequence number for this bin/render job. */
342d5b1a78aSEric Anholt 	uint64_t seqno;
343d5b1a78aSEric Anholt 
3447edabee0SEric Anholt 	/* Latest write_seqno of any BO that binning depends on. */
3457edabee0SEric Anholt 	uint64_t bin_dep_seqno;
3467edabee0SEric Anholt 
347cdec4d36SEric Anholt 	struct dma_fence *fence;
348cdec4d36SEric Anholt 
349c4ce60dcSEric Anholt 	/* Last current addresses the hardware was processing when the
350c4ce60dcSEric Anholt 	 * hangcheck timer checked on us.
351c4ce60dcSEric Anholt 	 */
352c4ce60dcSEric Anholt 	uint32_t last_ct0ca, last_ct1ca;
353c4ce60dcSEric Anholt 
354d5b1a78aSEric Anholt 	/* Kernel-space copy of the ioctl arguments */
355d5b1a78aSEric Anholt 	struct drm_vc4_submit_cl *args;
356d5b1a78aSEric Anholt 
357d5b1a78aSEric Anholt 	/* This is the array of BOs that were looked up at the start of exec.
358d5b1a78aSEric Anholt 	 * Command validation will use indices into this array.
359d5b1a78aSEric Anholt 	 */
360d5b1a78aSEric Anholt 	struct drm_gem_cma_object **bo;
361d5b1a78aSEric Anholt 	uint32_t bo_count;
362d5b1a78aSEric Anholt 
3637edabee0SEric Anholt 	/* List of BOs that are being written by the RCL.  Other than
3647edabee0SEric Anholt 	 * the binner temporary storage, this is all the BOs written
3657edabee0SEric Anholt 	 * by the job.
3667edabee0SEric Anholt 	 */
3677edabee0SEric Anholt 	struct drm_gem_cma_object *rcl_write_bo[4];
3687edabee0SEric Anholt 	uint32_t rcl_write_bo_count;
3697edabee0SEric Anholt 
370d5b1a78aSEric Anholt 	/* Pointers for our position in vc4->job_list */
371d5b1a78aSEric Anholt 	struct list_head head;
372d5b1a78aSEric Anholt 
373d5b1a78aSEric Anholt 	/* List of other BOs used in the job that need to be released
374d5b1a78aSEric Anholt 	 * once the job is complete.
375d5b1a78aSEric Anholt 	 */
376d5b1a78aSEric Anholt 	struct list_head unref_list;
377d5b1a78aSEric Anholt 
378d5b1a78aSEric Anholt 	/* Current unvalidated indices into @bo loaded by the non-hardware
379d5b1a78aSEric Anholt 	 * VC4_PACKET_GEM_HANDLES.
380d5b1a78aSEric Anholt 	 */
381d5b1a78aSEric Anholt 	uint32_t bo_index[2];
382d5b1a78aSEric Anholt 
383d5b1a78aSEric Anholt 	/* This is the BO where we store the validated command lists, shader
384d5b1a78aSEric Anholt 	 * records, and uniforms.
385d5b1a78aSEric Anholt 	 */
386d5b1a78aSEric Anholt 	struct drm_gem_cma_object *exec_bo;
387d5b1a78aSEric Anholt 
388d5b1a78aSEric Anholt 	/**
389d5b1a78aSEric Anholt 	 * This tracks the per-shader-record state (packet 64) that
390d5b1a78aSEric Anholt 	 * determines the length of the shader record and the offset
391d5b1a78aSEric Anholt 	 * it's expected to be found at.  It gets read in from the
392d5b1a78aSEric Anholt 	 * command lists.
393d5b1a78aSEric Anholt 	 */
394d5b1a78aSEric Anholt 	struct vc4_shader_state {
395d5b1a78aSEric Anholt 		uint32_t addr;
396d5b1a78aSEric Anholt 		/* Maximum vertex index referenced by any primitive using this
397d5b1a78aSEric Anholt 		 * shader state.
398d5b1a78aSEric Anholt 		 */
399d5b1a78aSEric Anholt 		uint32_t max_index;
400d5b1a78aSEric Anholt 	} *shader_state;
401d5b1a78aSEric Anholt 
402d5b1a78aSEric Anholt 	/** How many shader states the user declared they were using. */
403d5b1a78aSEric Anholt 	uint32_t shader_state_size;
404d5b1a78aSEric Anholt 	/** How many shader state records the validator has seen. */
405d5b1a78aSEric Anholt 	uint32_t shader_state_count;
406d5b1a78aSEric Anholt 
407d5b1a78aSEric Anholt 	bool found_tile_binning_mode_config_packet;
408d5b1a78aSEric Anholt 	bool found_start_tile_binning_packet;
409d5b1a78aSEric Anholt 	bool found_increment_semaphore_packet;
410d5b1a78aSEric Anholt 	bool found_flush;
411d5b1a78aSEric Anholt 	uint8_t bin_tiles_x, bin_tiles_y;
412553c942fSEric Anholt 	/* Physical address of the start of the tile alloc array
413553c942fSEric Anholt 	 * (where each tile's binned CL will start)
414553c942fSEric Anholt 	 */
415d5b1a78aSEric Anholt 	uint32_t tile_alloc_offset;
416553c942fSEric Anholt 	/* Bitmask of which binner slots are freed when this job completes. */
417553c942fSEric Anholt 	uint32_t bin_slots;
418d5b1a78aSEric Anholt 
419d5b1a78aSEric Anholt 	/**
420d5b1a78aSEric Anholt 	 * Computed addresses pointing into exec_bo where we start the
421d5b1a78aSEric Anholt 	 * bin thread (ct0) and render thread (ct1).
422d5b1a78aSEric Anholt 	 */
423d5b1a78aSEric Anholt 	uint32_t ct0ca, ct0ea;
424d5b1a78aSEric Anholt 	uint32_t ct1ca, ct1ea;
425d5b1a78aSEric Anholt 
426d5b1a78aSEric Anholt 	/* Pointer to the unvalidated bin CL (if present). */
427d5b1a78aSEric Anholt 	void *bin_u;
428d5b1a78aSEric Anholt 
429d5b1a78aSEric Anholt 	/* Pointers to the shader recs.  These paddr gets incremented as CL
430d5b1a78aSEric Anholt 	 * packets are relocated in validate_gl_shader_state, and the vaddrs
431d5b1a78aSEric Anholt 	 * (u and v) get incremented and size decremented as the shader recs
432d5b1a78aSEric Anholt 	 * themselves are validated.
433d5b1a78aSEric Anholt 	 */
434d5b1a78aSEric Anholt 	void *shader_rec_u;
435d5b1a78aSEric Anholt 	void *shader_rec_v;
436d5b1a78aSEric Anholt 	uint32_t shader_rec_p;
437d5b1a78aSEric Anholt 	uint32_t shader_rec_size;
438d5b1a78aSEric Anholt 
439d5b1a78aSEric Anholt 	/* Pointers to the uniform data.  These pointers are incremented, and
440d5b1a78aSEric Anholt 	 * size decremented, as each batch of uniforms is uploaded.
441d5b1a78aSEric Anholt 	 */
442d5b1a78aSEric Anholt 	void *uniforms_u;
443d5b1a78aSEric Anholt 	void *uniforms_v;
444d5b1a78aSEric Anholt 	uint32_t uniforms_p;
445d5b1a78aSEric Anholt 	uint32_t uniforms_size;
446*65101d8cSBoris Brezillon 
447*65101d8cSBoris Brezillon 	/* Pointer to a performance monitor object if the user requested it,
448*65101d8cSBoris Brezillon 	 * NULL otherwise.
449*65101d8cSBoris Brezillon 	 */
450*65101d8cSBoris Brezillon 	struct vc4_perfmon *perfmon;
451*65101d8cSBoris Brezillon };
452*65101d8cSBoris Brezillon 
453*65101d8cSBoris Brezillon /* Per-open file private data. Any driver-specific resource that has to be
454*65101d8cSBoris Brezillon  * released when the DRM file is closed should be placed here.
455*65101d8cSBoris Brezillon  */
456*65101d8cSBoris Brezillon struct vc4_file {
457*65101d8cSBoris Brezillon 	struct {
458*65101d8cSBoris Brezillon 		struct idr idr;
459*65101d8cSBoris Brezillon 		struct mutex lock;
460*65101d8cSBoris Brezillon 	} perfmon;
461d5b1a78aSEric Anholt };
462d5b1a78aSEric Anholt 
463d5b1a78aSEric Anholt static inline struct vc4_exec_info *
464ca26d28bSVarad Gautam vc4_first_bin_job(struct vc4_dev *vc4)
465d5b1a78aSEric Anholt {
46657b9f569SMasahiro Yamada 	return list_first_entry_or_null(&vc4->bin_job_list,
46757b9f569SMasahiro Yamada 					struct vc4_exec_info, head);
468ca26d28bSVarad Gautam }
469ca26d28bSVarad Gautam 
470ca26d28bSVarad Gautam static inline struct vc4_exec_info *
471ca26d28bSVarad Gautam vc4_first_render_job(struct vc4_dev *vc4)
472ca26d28bSVarad Gautam {
47357b9f569SMasahiro Yamada 	return list_first_entry_or_null(&vc4->render_job_list,
474ca26d28bSVarad Gautam 					struct vc4_exec_info, head);
475d5b1a78aSEric Anholt }
476d5b1a78aSEric Anholt 
4779326e6f2SEric Anholt static inline struct vc4_exec_info *
4789326e6f2SEric Anholt vc4_last_render_job(struct vc4_dev *vc4)
4799326e6f2SEric Anholt {
4809326e6f2SEric Anholt 	if (list_empty(&vc4->render_job_list))
4819326e6f2SEric Anholt 		return NULL;
4829326e6f2SEric Anholt 	return list_last_entry(&vc4->render_job_list,
4839326e6f2SEric Anholt 			       struct vc4_exec_info, head);
4849326e6f2SEric Anholt }
4859326e6f2SEric Anholt 
486c8b75bcaSEric Anholt /**
487463873d5SEric Anholt  * struct vc4_texture_sample_info - saves the offsets into the UBO for texture
488463873d5SEric Anholt  * setup parameters.
489463873d5SEric Anholt  *
490463873d5SEric Anholt  * This will be used at draw time to relocate the reference to the texture
491463873d5SEric Anholt  * contents in p0, and validate that the offset combined with
492463873d5SEric Anholt  * width/height/stride/etc. from p1 and p2/p3 doesn't sample outside the BO.
493463873d5SEric Anholt  * Note that the hardware treats unprovided config parameters as 0, so not all
494463873d5SEric Anholt  * of them need to be set up for every texure sample, and we'll store ~0 as
495463873d5SEric Anholt  * the offset to mark the unused ones.
496463873d5SEric Anholt  *
497463873d5SEric Anholt  * See the VC4 3D architecture guide page 41 ("Texture and Memory Lookup Unit
498463873d5SEric Anholt  * Setup") for definitions of the texture parameters.
499463873d5SEric Anholt  */
500463873d5SEric Anholt struct vc4_texture_sample_info {
501463873d5SEric Anholt 	bool is_direct;
502463873d5SEric Anholt 	uint32_t p_offset[4];
503463873d5SEric Anholt };
504463873d5SEric Anholt 
505463873d5SEric Anholt /**
506463873d5SEric Anholt  * struct vc4_validated_shader_info - information about validated shaders that
507463873d5SEric Anholt  * needs to be used from command list validation.
508463873d5SEric Anholt  *
509463873d5SEric Anholt  * For a given shader, each time a shader state record references it, we need
510463873d5SEric Anholt  * to verify that the shader doesn't read more uniforms than the shader state
511463873d5SEric Anholt  * record's uniform BO pointer can provide, and we need to apply relocations
512463873d5SEric Anholt  * and validate the shader state record's uniforms that define the texture
513463873d5SEric Anholt  * samples.
514463873d5SEric Anholt  */
515463873d5SEric Anholt struct vc4_validated_shader_info {
516463873d5SEric Anholt 	uint32_t uniforms_size;
517463873d5SEric Anholt 	uint32_t uniforms_src_size;
518463873d5SEric Anholt 	uint32_t num_texture_samples;
519463873d5SEric Anholt 	struct vc4_texture_sample_info *texture_samples;
5206d45c81dSEric Anholt 
5216d45c81dSEric Anholt 	uint32_t num_uniform_addr_offsets;
5226d45c81dSEric Anholt 	uint32_t *uniform_addr_offsets;
523c778cc5dSJonas Pfeil 
524c778cc5dSJonas Pfeil 	bool is_threaded;
525463873d5SEric Anholt };
526463873d5SEric Anholt 
527463873d5SEric Anholt /**
528c8b75bcaSEric Anholt  * _wait_for - magic (register) wait macro
529c8b75bcaSEric Anholt  *
530c8b75bcaSEric Anholt  * Does the right thing for modeset paths when run under kdgb or similar atomic
531c8b75bcaSEric Anholt  * contexts. Note that it's important that we check the condition again after
532c8b75bcaSEric Anholt  * having timed out, since the timeout could be due to preemption or similar and
533c8b75bcaSEric Anholt  * we've never had a chance to check the condition before the timeout.
534c8b75bcaSEric Anholt  */
535c8b75bcaSEric Anholt #define _wait_for(COND, MS, W) ({ \
536c8b75bcaSEric Anholt 	unsigned long timeout__ = jiffies + msecs_to_jiffies(MS) + 1;	\
537c8b75bcaSEric Anholt 	int ret__ = 0;							\
538c8b75bcaSEric Anholt 	while (!(COND)) {						\
539c8b75bcaSEric Anholt 		if (time_after(jiffies, timeout__)) {			\
540c8b75bcaSEric Anholt 			if (!(COND))					\
541c8b75bcaSEric Anholt 				ret__ = -ETIMEDOUT;			\
542c8b75bcaSEric Anholt 			break;						\
543c8b75bcaSEric Anholt 		}							\
544c8b75bcaSEric Anholt 		if (W && drm_can_sleep())  {				\
545c8b75bcaSEric Anholt 			msleep(W);					\
546c8b75bcaSEric Anholt 		} else {						\
547c8b75bcaSEric Anholt 			cpu_relax();					\
548c8b75bcaSEric Anholt 		}							\
549c8b75bcaSEric Anholt 	}								\
550c8b75bcaSEric Anholt 	ret__;								\
551c8b75bcaSEric Anholt })
552c8b75bcaSEric Anholt 
553c8b75bcaSEric Anholt #define wait_for(COND, MS) _wait_for(COND, MS, 1)
554c8b75bcaSEric Anholt 
555c8b75bcaSEric Anholt /* vc4_bo.c */
556c826a6e1SEric Anholt struct drm_gem_object *vc4_create_object(struct drm_device *dev, size_t size);
557c8b75bcaSEric Anholt void vc4_free_object(struct drm_gem_object *gem_obj);
558c826a6e1SEric Anholt struct vc4_bo *vc4_bo_create(struct drm_device *dev, size_t size,
559f3099462SEric Anholt 			     bool from_cache, enum vc4_kernel_bo_type type);
560c8b75bcaSEric Anholt int vc4_dumb_create(struct drm_file *file_priv,
561c8b75bcaSEric Anholt 		    struct drm_device *dev,
562c8b75bcaSEric Anholt 		    struct drm_mode_create_dumb *args);
563c8b75bcaSEric Anholt struct dma_buf *vc4_prime_export(struct drm_device *dev,
564c8b75bcaSEric Anholt 				 struct drm_gem_object *obj, int flags);
565d5bc60f6SEric Anholt int vc4_create_bo_ioctl(struct drm_device *dev, void *data,
566d5bc60f6SEric Anholt 			struct drm_file *file_priv);
567463873d5SEric Anholt int vc4_create_shader_bo_ioctl(struct drm_device *dev, void *data,
568463873d5SEric Anholt 			       struct drm_file *file_priv);
569d5bc60f6SEric Anholt int vc4_mmap_bo_ioctl(struct drm_device *dev, void *data,
570d5bc60f6SEric Anholt 		      struct drm_file *file_priv);
57183753117SEric Anholt int vc4_set_tiling_ioctl(struct drm_device *dev, void *data,
57283753117SEric Anholt 			 struct drm_file *file_priv);
57383753117SEric Anholt int vc4_get_tiling_ioctl(struct drm_device *dev, void *data,
57483753117SEric Anholt 			 struct drm_file *file_priv);
57521461365SEric Anholt int vc4_get_hang_state_ioctl(struct drm_device *dev, void *data,
57621461365SEric Anholt 			     struct drm_file *file_priv);
577f3099462SEric Anholt int vc4_label_bo_ioctl(struct drm_device *dev, void *data,
578f3099462SEric Anholt 		       struct drm_file *file_priv);
579b9f19259SBoris Brezillon int vc4_fault(struct vm_fault *vmf);
580463873d5SEric Anholt int vc4_mmap(struct file *filp, struct vm_area_struct *vma);
581cdec4d36SEric Anholt struct reservation_object *vc4_prime_res_obj(struct drm_gem_object *obj);
582463873d5SEric Anholt int vc4_prime_mmap(struct drm_gem_object *obj, struct vm_area_struct *vma);
583cdec4d36SEric Anholt struct drm_gem_object *vc4_prime_import_sg_table(struct drm_device *dev,
584cdec4d36SEric Anholt 						 struct dma_buf_attachment *attach,
585cdec4d36SEric Anholt 						 struct sg_table *sgt);
586463873d5SEric Anholt void *vc4_prime_vmap(struct drm_gem_object *obj);
587f3099462SEric Anholt int vc4_bo_cache_init(struct drm_device *dev);
588c826a6e1SEric Anholt void vc4_bo_cache_destroy(struct drm_device *dev);
589c826a6e1SEric Anholt int vc4_bo_stats_debugfs(struct seq_file *m, void *arg);
590b9f19259SBoris Brezillon int vc4_bo_inc_usecnt(struct vc4_bo *bo);
591b9f19259SBoris Brezillon void vc4_bo_dec_usecnt(struct vc4_bo *bo);
592b9f19259SBoris Brezillon void vc4_bo_add_to_purgeable_pool(struct vc4_bo *bo);
593b9f19259SBoris Brezillon void vc4_bo_remove_from_purgeable_pool(struct vc4_bo *bo);
594c8b75bcaSEric Anholt 
595c8b75bcaSEric Anholt /* vc4_crtc.c */
596c8b75bcaSEric Anholt extern struct platform_driver vc4_crtc_driver;
597c8b75bcaSEric Anholt int vc4_crtc_debugfs_regs(struct seq_file *m, void *arg);
5981bf6ad62SDaniel Vetter bool vc4_crtc_get_scanoutpos(struct drm_device *dev, unsigned int crtc_id,
5991bf6ad62SDaniel Vetter 			     bool in_vblank_irq, int *vpos, int *hpos,
6001bf59f1dSMario Kleiner 			     ktime_t *stime, ktime_t *etime,
6011bf59f1dSMario Kleiner 			     const struct drm_display_mode *mode);
602c8b75bcaSEric Anholt 
603c8b75bcaSEric Anholt /* vc4_debugfs.c */
604c8b75bcaSEric Anholt int vc4_debugfs_init(struct drm_minor *minor);
605c8b75bcaSEric Anholt 
606c8b75bcaSEric Anholt /* vc4_drv.c */
607c8b75bcaSEric Anholt void __iomem *vc4_ioremap_regs(struct platform_device *dev, int index);
608c8b75bcaSEric Anholt 
60908302c35SEric Anholt /* vc4_dpi.c */
61008302c35SEric Anholt extern struct platform_driver vc4_dpi_driver;
61108302c35SEric Anholt int vc4_dpi_debugfs_regs(struct seq_file *m, void *unused);
61208302c35SEric Anholt 
6134078f575SEric Anholt /* vc4_dsi.c */
6144078f575SEric Anholt extern struct platform_driver vc4_dsi_driver;
6154078f575SEric Anholt int vc4_dsi_debugfs_regs(struct seq_file *m, void *unused);
6164078f575SEric Anholt 
617cdec4d36SEric Anholt /* vc4_fence.c */
618cdec4d36SEric Anholt extern const struct dma_fence_ops vc4_fence_ops;
619cdec4d36SEric Anholt 
620d5b1a78aSEric Anholt /* vc4_gem.c */
621d5b1a78aSEric Anholt void vc4_gem_init(struct drm_device *dev);
622d5b1a78aSEric Anholt void vc4_gem_destroy(struct drm_device *dev);
623d5b1a78aSEric Anholt int vc4_submit_cl_ioctl(struct drm_device *dev, void *data,
624d5b1a78aSEric Anholt 			struct drm_file *file_priv);
625d5b1a78aSEric Anholt int vc4_wait_seqno_ioctl(struct drm_device *dev, void *data,
626d5b1a78aSEric Anholt 			 struct drm_file *file_priv);
627d5b1a78aSEric Anholt int vc4_wait_bo_ioctl(struct drm_device *dev, void *data,
628d5b1a78aSEric Anholt 		      struct drm_file *file_priv);
629ca26d28bSVarad Gautam void vc4_submit_next_bin_job(struct drm_device *dev);
630ca26d28bSVarad Gautam void vc4_submit_next_render_job(struct drm_device *dev);
631ca26d28bSVarad Gautam void vc4_move_job_to_render(struct drm_device *dev, struct vc4_exec_info *exec);
632d5b1a78aSEric Anholt int vc4_wait_for_seqno(struct drm_device *dev, uint64_t seqno,
633d5b1a78aSEric Anholt 		       uint64_t timeout_ns, bool interruptible);
634d5b1a78aSEric Anholt void vc4_job_handle_completed(struct vc4_dev *vc4);
635b501baccSEric Anholt int vc4_queue_seqno_cb(struct drm_device *dev,
636b501baccSEric Anholt 		       struct vc4_seqno_cb *cb, uint64_t seqno,
637b501baccSEric Anholt 		       void (*func)(struct vc4_seqno_cb *cb));
638b9f19259SBoris Brezillon int vc4_gem_madvise_ioctl(struct drm_device *dev, void *data,
639b9f19259SBoris Brezillon 			  struct drm_file *file_priv);
640d5b1a78aSEric Anholt 
641c8b75bcaSEric Anholt /* vc4_hdmi.c */
642c8b75bcaSEric Anholt extern struct platform_driver vc4_hdmi_driver;
643c8b75bcaSEric Anholt int vc4_hdmi_debugfs_regs(struct seq_file *m, void *unused);
644c8b75bcaSEric Anholt 
6459a8d5e4aSBoris Brezillon /* vc4_vec.c */
646e4b81f8cSBoris Brezillon extern struct platform_driver vc4_vec_driver;
647e4b81f8cSBoris Brezillon int vc4_vec_debugfs_regs(struct seq_file *m, void *unused);
648e4b81f8cSBoris Brezillon 
649d5b1a78aSEric Anholt /* vc4_irq.c */
650d5b1a78aSEric Anholt irqreturn_t vc4_irq(int irq, void *arg);
651d5b1a78aSEric Anholt void vc4_irq_preinstall(struct drm_device *dev);
652d5b1a78aSEric Anholt int vc4_irq_postinstall(struct drm_device *dev);
653d5b1a78aSEric Anholt void vc4_irq_uninstall(struct drm_device *dev);
654d5b1a78aSEric Anholt void vc4_irq_reset(struct drm_device *dev);
655d5b1a78aSEric Anholt 
656c8b75bcaSEric Anholt /* vc4_hvs.c */
657c8b75bcaSEric Anholt extern struct platform_driver vc4_hvs_driver;
658c8b75bcaSEric Anholt void vc4_hvs_dump_state(struct drm_device *dev);
659c8b75bcaSEric Anholt int vc4_hvs_debugfs_regs(struct seq_file *m, void *unused);
660c8b75bcaSEric Anholt 
661c8b75bcaSEric Anholt /* vc4_kms.c */
662c8b75bcaSEric Anholt int vc4_kms_load(struct drm_device *dev);
663c8b75bcaSEric Anholt 
664c8b75bcaSEric Anholt /* vc4_plane.c */
665c8b75bcaSEric Anholt struct drm_plane *vc4_plane_init(struct drm_device *dev,
666c8b75bcaSEric Anholt 				 enum drm_plane_type type);
667c8b75bcaSEric Anholt u32 vc4_plane_write_dlist(struct drm_plane *plane, u32 __iomem *dlist);
6682f196b7cSDaniel Vetter u32 vc4_plane_dlist_size(const struct drm_plane_state *state);
669b501baccSEric Anholt void vc4_plane_async_set_fb(struct drm_plane *plane,
670b501baccSEric Anholt 			    struct drm_framebuffer *fb);
671463873d5SEric Anholt 
672d3f5168aSEric Anholt /* vc4_v3d.c */
673d3f5168aSEric Anholt extern struct platform_driver vc4_v3d_driver;
674d3f5168aSEric Anholt int vc4_v3d_debugfs_ident(struct seq_file *m, void *unused);
675d3f5168aSEric Anholt int vc4_v3d_debugfs_regs(struct seq_file *m, void *unused);
676553c942fSEric Anholt int vc4_v3d_get_bin_slot(struct vc4_dev *vc4);
677d5b1a78aSEric Anholt 
678d5b1a78aSEric Anholt /* vc4_validate.c */
679d5b1a78aSEric Anholt int
680d5b1a78aSEric Anholt vc4_validate_bin_cl(struct drm_device *dev,
681d5b1a78aSEric Anholt 		    void *validated,
682d5b1a78aSEric Anholt 		    void *unvalidated,
683d5b1a78aSEric Anholt 		    struct vc4_exec_info *exec);
684d5b1a78aSEric Anholt 
685d5b1a78aSEric Anholt int
686d5b1a78aSEric Anholt vc4_validate_shader_recs(struct drm_device *dev, struct vc4_exec_info *exec);
687d5b1a78aSEric Anholt 
688d5b1a78aSEric Anholt struct drm_gem_cma_object *vc4_use_bo(struct vc4_exec_info *exec,
689d5b1a78aSEric Anholt 				      uint32_t hindex);
690d5b1a78aSEric Anholt 
691d5b1a78aSEric Anholt int vc4_get_rcl(struct drm_device *dev, struct vc4_exec_info *exec);
692d5b1a78aSEric Anholt 
693d5b1a78aSEric Anholt bool vc4_check_tex_size(struct vc4_exec_info *exec,
694d5b1a78aSEric Anholt 			struct drm_gem_cma_object *fbo,
695d5b1a78aSEric Anholt 			uint32_t offset, uint8_t tiling_format,
696d5b1a78aSEric Anholt 			uint32_t width, uint32_t height, uint8_t cpp);
697d3f5168aSEric Anholt 
698463873d5SEric Anholt /* vc4_validate_shader.c */
699463873d5SEric Anholt struct vc4_validated_shader_info *
700463873d5SEric Anholt vc4_validate_shader(struct drm_gem_cma_object *shader_obj);
701*65101d8cSBoris Brezillon 
702*65101d8cSBoris Brezillon /* vc4_perfmon.c */
703*65101d8cSBoris Brezillon void vc4_perfmon_get(struct vc4_perfmon *perfmon);
704*65101d8cSBoris Brezillon void vc4_perfmon_put(struct vc4_perfmon *perfmon);
705*65101d8cSBoris Brezillon void vc4_perfmon_start(struct vc4_dev *vc4, struct vc4_perfmon *perfmon);
706*65101d8cSBoris Brezillon void vc4_perfmon_stop(struct vc4_dev *vc4, struct vc4_perfmon *perfmon,
707*65101d8cSBoris Brezillon 		      bool capture);
708*65101d8cSBoris Brezillon struct vc4_perfmon *vc4_perfmon_find(struct vc4_file *vc4file, int id);
709*65101d8cSBoris Brezillon void vc4_perfmon_open_file(struct vc4_file *vc4file);
710*65101d8cSBoris Brezillon void vc4_perfmon_close_file(struct vc4_file *vc4file);
711*65101d8cSBoris Brezillon int vc4_perfmon_create_ioctl(struct drm_device *dev, void *data,
712*65101d8cSBoris Brezillon 			     struct drm_file *file_priv);
713*65101d8cSBoris Brezillon int vc4_perfmon_destroy_ioctl(struct drm_device *dev, void *data,
714*65101d8cSBoris Brezillon 			      struct drm_file *file_priv);
715*65101d8cSBoris Brezillon int vc4_perfmon_get_values_ioctl(struct drm_device *dev, void *data,
716*65101d8cSBoris Brezillon 				 struct drm_file *file_priv);
717