blob: a5bf2e5e0b57f117ffdfd72abb36c6c6a7815ee0 [file] [log] [blame]
Eric Anholtc8b75bc2015-03-02 13:01:12 -08001/*
2 * Copyright (C) 2015 Broadcom
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
Eric Anholtcdec4d32017-04-12 12:12:02 -07009#include <linux/reservation.h>
Masahiro Yamadab7e8e252017-05-18 13:29:38 +090010#include <drm/drmP.h>
Laurent Pinchart93382032016-11-28 20:51:09 +020011#include <drm/drm_encoder.h>
Masahiro Yamadab7e8e252017-05-18 13:29:38 +090012#include <drm/drm_gem_cma_helper.h>
Laurent Pinchart93382032016-11-28 20:51:09 +020013
Eric Anholtc8b75bc2015-03-02 13:01:12 -080014struct vc4_dev {
15 struct drm_device *dev;
16
17 struct vc4_hdmi *hdmi;
18 struct vc4_hvs *hvs;
Eric Anholtd3f51682015-03-02 13:01:12 -080019 struct vc4_v3d *v3d;
Eric Anholt08302c32016-02-10 11:42:32 -080020 struct vc4_dpi *dpi;
Eric Anholt4078f572017-01-31 11:29:11 -080021 struct vc4_dsi *dsi1;
Boris Brezillone4b81f82016-12-02 14:48:10 +010022 struct vc4_vec *vec;
Derek Foreman48666d52015-07-02 11:19:54 -050023
24 struct drm_fbdev_cma *fbdev;
Eric Anholtc826a6e2015-10-09 20:25:07 -070025
Eric Anholt21461362015-10-30 10:09:02 -070026 struct vc4_hang_state *hang_state;
27
Eric Anholtc826a6e2015-10-09 20:25:07 -070028 /* The kernel-space BO cache. Tracks buffers that have been
29 * unreferenced by all other users (refcounts of 0!) but not
30 * yet freed, so we can do cheap allocations.
31 */
32 struct vc4_bo_cache {
33 /* Array of list heads for entries in the BO cache,
34 * based on number of pages, so we can do O(1) lookups
35 * in the cache when allocating.
36 */
37 struct list_head *size_list;
38 uint32_t size_list_size;
39
40 /* List of all BOs in the cache, ordered by age, so we
41 * can do O(1) lookups when trying to free old
42 * buffers.
43 */
44 struct list_head time_list;
45 struct work_struct time_work;
46 struct timer_list time_timer;
47 } bo_cache;
48
49 struct vc4_bo_stats {
50 u32 num_allocated;
51 u32 size_allocated;
52 u32 num_cached;
53 u32 size_cached;
54 } bo_stats;
55
56 /* Protects bo_cache and the BO stats. */
57 struct mutex bo_lock;
Eric Anholtd5b1a782015-11-30 12:13:37 -080058
Eric Anholtcdec4d32017-04-12 12:12:02 -070059 uint64_t dma_fence_context;
60
Varad Gautamca26d282016-02-17 19:08:21 +053061 /* Sequence number for the last job queued in bin_job_list.
Eric Anholtd5b1a782015-11-30 12:13:37 -080062 * Starts at 0 (no jobs emitted).
63 */
64 uint64_t emit_seqno;
65
66 /* Sequence number for the last completed job on the GPU.
67 * Starts at 0 (no jobs completed).
68 */
69 uint64_t finished_seqno;
70
Varad Gautamca26d282016-02-17 19:08:21 +053071 /* List of all struct vc4_exec_info for jobs to be executed in
72 * the binner. The first job in the list is the one currently
73 * programmed into ct0ca for execution.
Eric Anholtd5b1a782015-11-30 12:13:37 -080074 */
Varad Gautamca26d282016-02-17 19:08:21 +053075 struct list_head bin_job_list;
76
77 /* List of all struct vc4_exec_info for jobs that have
78 * completed binning and are ready for rendering. The first
79 * job in the list is the one currently programmed into ct1ca
80 * for execution.
81 */
82 struct list_head render_job_list;
83
Eric Anholtd5b1a782015-11-30 12:13:37 -080084 /* List of the finished vc4_exec_infos waiting to be freed by
85 * job_done_work.
86 */
87 struct list_head job_done_list;
88 /* Spinlock used to synchronize the job_list and seqno
89 * accesses between the IRQ handler and GEM ioctls.
90 */
91 spinlock_t job_lock;
92 wait_queue_head_t job_wait_queue;
93 struct work_struct job_done_work;
94
Eric Anholtb501bac2015-11-30 12:34:01 -080095 /* List of struct vc4_seqno_cb for callbacks to be made from a
96 * workqueue when the given seqno is passed.
97 */
98 struct list_head seqno_cb_list;
99
Eric Anholt553c9422017-03-27 16:10:25 -0700100 /* The memory used for storing binner tile alloc, tile state,
101 * and overflow memory allocations. This is freed when V3D
102 * powers down.
Eric Anholtd5b1a782015-11-30 12:13:37 -0800103 */
Eric Anholt553c9422017-03-27 16:10:25 -0700104 struct vc4_bo *bin_bo;
105
106 /* Size of blocks allocated within bin_bo. */
107 uint32_t bin_alloc_size;
108
109 /* Bitmask of the bin_alloc_size chunks in bin_bo that are
110 * used.
111 */
112 uint32_t bin_alloc_used;
113
114 /* Bitmask of the current bin_alloc used for overflow memory. */
115 uint32_t bin_alloc_overflow;
116
Eric Anholtd5b1a782015-11-30 12:13:37 -0800117 struct work_struct overflow_mem_work;
118
Eric Anholt36cb6252016-02-08 12:59:02 -0800119 int power_refcount;
120
121 /* Mutex controlling the power refcount. */
122 struct mutex power_lock;
123
Eric Anholtd5b1a782015-11-30 12:13:37 -0800124 struct {
Eric Anholtd5b1a782015-11-30 12:13:37 -0800125 struct timer_list timer;
126 struct work_struct reset_work;
127 } hangcheck;
128
129 struct semaphore async_modeset;
Eric Anholtc8b75bc2015-03-02 13:01:12 -0800130};
131
132static inline struct vc4_dev *
133to_vc4_dev(struct drm_device *dev)
134{
135 return (struct vc4_dev *)dev->dev_private;
136}
137
138struct vc4_bo {
139 struct drm_gem_cma_object base;
Eric Anholtc826a6e2015-10-09 20:25:07 -0700140
Eric Anholt7edabee2016-09-27 09:03:13 -0700141 /* seqno of the last job to render using this BO. */
Eric Anholtd5b1a782015-11-30 12:13:37 -0800142 uint64_t seqno;
143
Eric Anholt7edabee2016-09-27 09:03:13 -0700144 /* seqno of the last job to use the RCL to write to this BO.
145 *
146 * Note that this doesn't include binner overflow memory
147 * writes.
148 */
149 uint64_t write_seqno;
150
Eric Anholtc826a6e2015-10-09 20:25:07 -0700151 /* List entry for the BO's position in either
152 * vc4_exec_info->unref_list or vc4_dev->bo_cache.time_list
153 */
154 struct list_head unref_head;
155
156 /* Time in jiffies when the BO was put in vc4->bo_cache. */
157 unsigned long free_time;
158
159 /* List entry for the BO's position in vc4_dev->bo_cache.size_list */
160 struct list_head size_head;
Eric Anholt463873d2015-11-30 11:41:40 -0800161
162 /* Struct for shader validation state, if created by
163 * DRM_IOCTL_VC4_CREATE_SHADER_BO.
164 */
165 struct vc4_validated_shader_info *validated_shader;
Eric Anholtcdec4d32017-04-12 12:12:02 -0700166
167 /* normally (resv == &_resv) except for imported bo's */
168 struct reservation_object *resv;
169 struct reservation_object _resv;
Eric Anholtc8b75bc2015-03-02 13:01:12 -0800170};
171
172static inline struct vc4_bo *
173to_vc4_bo(struct drm_gem_object *bo)
174{
175 return (struct vc4_bo *)bo;
176}
177
Eric Anholtcdec4d32017-04-12 12:12:02 -0700178struct vc4_fence {
179 struct dma_fence base;
180 struct drm_device *dev;
181 /* vc4 seqno for signaled() test */
182 uint64_t seqno;
183};
184
185static inline struct vc4_fence *
186to_vc4_fence(struct dma_fence *fence)
187{
188 return (struct vc4_fence *)fence;
189}
190
Eric Anholtb501bac2015-11-30 12:34:01 -0800191struct vc4_seqno_cb {
192 struct work_struct work;
193 uint64_t seqno;
194 void (*func)(struct vc4_seqno_cb *cb);
195};
196
Eric Anholtd3f51682015-03-02 13:01:12 -0800197struct vc4_v3d {
Eric Anholt001bdb52016-02-05 17:41:49 -0800198 struct vc4_dev *vc4;
Eric Anholtd3f51682015-03-02 13:01:12 -0800199 struct platform_device *pdev;
200 void __iomem *regs;
Eric Anholtb72a2812017-04-28 15:42:21 -0700201 struct clk *clk;
Eric Anholtd3f51682015-03-02 13:01:12 -0800202};
203
Eric Anholtc8b75bc2015-03-02 13:01:12 -0800204struct vc4_hvs {
205 struct platform_device *pdev;
206 void __iomem *regs;
Eric Anholtd8dbf442015-12-28 13:25:41 -0800207 u32 __iomem *dlist;
208
209 /* Memory manager for CRTCs to allocate space in the display
210 * list. Units are dwords.
211 */
212 struct drm_mm dlist_mm;
Eric Anholt21af94c2015-10-20 16:06:57 +0100213 /* Memory manager for the LBM memory used by HVS scaling. */
214 struct drm_mm lbm_mm;
Eric Anholtd8dbf442015-12-28 13:25:41 -0800215 spinlock_t mm_lock;
Eric Anholt21af94c2015-10-20 16:06:57 +0100216
217 struct drm_mm_node mitchell_netravali_filter;
Eric Anholtc8b75bc2015-03-02 13:01:12 -0800218};
219
220struct vc4_plane {
221 struct drm_plane base;
222};
223
224static inline struct vc4_plane *
225to_vc4_plane(struct drm_plane *plane)
226{
227 return (struct vc4_plane *)plane;
228}
229
230enum vc4_encoder_type {
Boris Brezillonab8df602016-12-02 14:48:07 +0100231 VC4_ENCODER_TYPE_NONE,
Eric Anholtc8b75bc2015-03-02 13:01:12 -0800232 VC4_ENCODER_TYPE_HDMI,
233 VC4_ENCODER_TYPE_VEC,
234 VC4_ENCODER_TYPE_DSI0,
235 VC4_ENCODER_TYPE_DSI1,
236 VC4_ENCODER_TYPE_SMI,
237 VC4_ENCODER_TYPE_DPI,
238};
239
240struct vc4_encoder {
241 struct drm_encoder base;
242 enum vc4_encoder_type type;
243 u32 clock_select;
244};
245
246static inline struct vc4_encoder *
247to_vc4_encoder(struct drm_encoder *encoder)
248{
249 return container_of(encoder, struct vc4_encoder, base);
250}
251
Eric Anholtd3f51682015-03-02 13:01:12 -0800252#define V3D_READ(offset) readl(vc4->v3d->regs + offset)
253#define V3D_WRITE(offset, val) writel(val, vc4->v3d->regs + offset)
Eric Anholtc8b75bc2015-03-02 13:01:12 -0800254#define HVS_READ(offset) readl(vc4->hvs->regs + offset)
255#define HVS_WRITE(offset, val) writel(val, vc4->hvs->regs + offset)
256
Eric Anholtd5b1a782015-11-30 12:13:37 -0800257struct vc4_exec_info {
258 /* Sequence number for this bin/render job. */
259 uint64_t seqno;
260
Eric Anholt7edabee2016-09-27 09:03:13 -0700261 /* Latest write_seqno of any BO that binning depends on. */
262 uint64_t bin_dep_seqno;
263
Eric Anholtcdec4d32017-04-12 12:12:02 -0700264 struct dma_fence *fence;
265
Eric Anholtc4ce60d2016-02-08 11:19:14 -0800266 /* Last current addresses the hardware was processing when the
267 * hangcheck timer checked on us.
268 */
269 uint32_t last_ct0ca, last_ct1ca;
270
Eric Anholtd5b1a782015-11-30 12:13:37 -0800271 /* Kernel-space copy of the ioctl arguments */
272 struct drm_vc4_submit_cl *args;
273
274 /* This is the array of BOs that were looked up at the start of exec.
275 * Command validation will use indices into this array.
276 */
277 struct drm_gem_cma_object **bo;
278 uint32_t bo_count;
279
Eric Anholt7edabee2016-09-27 09:03:13 -0700280 /* List of BOs that are being written by the RCL. Other than
281 * the binner temporary storage, this is all the BOs written
282 * by the job.
283 */
284 struct drm_gem_cma_object *rcl_write_bo[4];
285 uint32_t rcl_write_bo_count;
286
Eric Anholtd5b1a782015-11-30 12:13:37 -0800287 /* Pointers for our position in vc4->job_list */
288 struct list_head head;
289
290 /* List of other BOs used in the job that need to be released
291 * once the job is complete.
292 */
293 struct list_head unref_list;
294
295 /* Current unvalidated indices into @bo loaded by the non-hardware
296 * VC4_PACKET_GEM_HANDLES.
297 */
298 uint32_t bo_index[2];
299
300 /* This is the BO where we store the validated command lists, shader
301 * records, and uniforms.
302 */
303 struct drm_gem_cma_object *exec_bo;
304
305 /**
306 * This tracks the per-shader-record state (packet 64) that
307 * determines the length of the shader record and the offset
308 * it's expected to be found at. It gets read in from the
309 * command lists.
310 */
311 struct vc4_shader_state {
312 uint32_t addr;
313 /* Maximum vertex index referenced by any primitive using this
314 * shader state.
315 */
316 uint32_t max_index;
317 } *shader_state;
318
319 /** How many shader states the user declared they were using. */
320 uint32_t shader_state_size;
321 /** How many shader state records the validator has seen. */
322 uint32_t shader_state_count;
323
324 bool found_tile_binning_mode_config_packet;
325 bool found_start_tile_binning_packet;
326 bool found_increment_semaphore_packet;
327 bool found_flush;
328 uint8_t bin_tiles_x, bin_tiles_y;
Eric Anholt553c9422017-03-27 16:10:25 -0700329 /* Physical address of the start of the tile alloc array
330 * (where each tile's binned CL will start)
331 */
Eric Anholtd5b1a782015-11-30 12:13:37 -0800332 uint32_t tile_alloc_offset;
Eric Anholt553c9422017-03-27 16:10:25 -0700333 /* Bitmask of which binner slots are freed when this job completes. */
334 uint32_t bin_slots;
Eric Anholtd5b1a782015-11-30 12:13:37 -0800335
336 /**
337 * Computed addresses pointing into exec_bo where we start the
338 * bin thread (ct0) and render thread (ct1).
339 */
340 uint32_t ct0ca, ct0ea;
341 uint32_t ct1ca, ct1ea;
342
343 /* Pointer to the unvalidated bin CL (if present). */
344 void *bin_u;
345
346 /* Pointers to the shader recs. These paddr gets incremented as CL
347 * packets are relocated in validate_gl_shader_state, and the vaddrs
348 * (u and v) get incremented and size decremented as the shader recs
349 * themselves are validated.
350 */
351 void *shader_rec_u;
352 void *shader_rec_v;
353 uint32_t shader_rec_p;
354 uint32_t shader_rec_size;
355
356 /* Pointers to the uniform data. These pointers are incremented, and
357 * size decremented, as each batch of uniforms is uploaded.
358 */
359 void *uniforms_u;
360 void *uniforms_v;
361 uint32_t uniforms_p;
362 uint32_t uniforms_size;
363};
364
365static inline struct vc4_exec_info *
Varad Gautamca26d282016-02-17 19:08:21 +0530366vc4_first_bin_job(struct vc4_dev *vc4)
Eric Anholtd5b1a782015-11-30 12:13:37 -0800367{
Masahiro Yamada57b9f562016-09-13 03:35:20 +0900368 return list_first_entry_or_null(&vc4->bin_job_list,
369 struct vc4_exec_info, head);
Varad Gautamca26d282016-02-17 19:08:21 +0530370}
371
372static inline struct vc4_exec_info *
373vc4_first_render_job(struct vc4_dev *vc4)
374{
Masahiro Yamada57b9f562016-09-13 03:35:20 +0900375 return list_first_entry_or_null(&vc4->render_job_list,
376 struct vc4_exec_info, head);
Eric Anholtd5b1a782015-11-30 12:13:37 -0800377}
378
Eric Anholt9326e6f2016-07-26 13:47:14 -0700379static inline struct vc4_exec_info *
380vc4_last_render_job(struct vc4_dev *vc4)
381{
382 if (list_empty(&vc4->render_job_list))
383 return NULL;
384 return list_last_entry(&vc4->render_job_list,
385 struct vc4_exec_info, head);
386}
387
Eric Anholtc8b75bc2015-03-02 13:01:12 -0800388/**
Eric Anholt463873d2015-11-30 11:41:40 -0800389 * struct vc4_texture_sample_info - saves the offsets into the UBO for texture
390 * setup parameters.
391 *
392 * This will be used at draw time to relocate the reference to the texture
393 * contents in p0, and validate that the offset combined with
394 * width/height/stride/etc. from p1 and p2/p3 doesn't sample outside the BO.
395 * Note that the hardware treats unprovided config parameters as 0, so not all
396 * of them need to be set up for every texure sample, and we'll store ~0 as
397 * the offset to mark the unused ones.
398 *
399 * See the VC4 3D architecture guide page 41 ("Texture and Memory Lookup Unit
400 * Setup") for definitions of the texture parameters.
401 */
402struct vc4_texture_sample_info {
403 bool is_direct;
404 uint32_t p_offset[4];
405};
406
407/**
408 * struct vc4_validated_shader_info - information about validated shaders that
409 * needs to be used from command list validation.
410 *
411 * For a given shader, each time a shader state record references it, we need
412 * to verify that the shader doesn't read more uniforms than the shader state
413 * record's uniform BO pointer can provide, and we need to apply relocations
414 * and validate the shader state record's uniforms that define the texture
415 * samples.
416 */
417struct vc4_validated_shader_info {
418 uint32_t uniforms_size;
419 uint32_t uniforms_src_size;
420 uint32_t num_texture_samples;
421 struct vc4_texture_sample_info *texture_samples;
Eric Anholt6d45c812016-07-02 12:17:10 -0700422
423 uint32_t num_uniform_addr_offsets;
424 uint32_t *uniform_addr_offsets;
Jonas Pfeilc778cc52016-11-08 00:18:39 +0100425
426 bool is_threaded;
Eric Anholt463873d2015-11-30 11:41:40 -0800427};
428
429/**
Eric Anholtc8b75bc2015-03-02 13:01:12 -0800430 * _wait_for - magic (register) wait macro
431 *
432 * Does the right thing for modeset paths when run under kdgb or similar atomic
433 * contexts. Note that it's important that we check the condition again after
434 * having timed out, since the timeout could be due to preemption or similar and
435 * we've never had a chance to check the condition before the timeout.
436 */
437#define _wait_for(COND, MS, W) ({ \
438 unsigned long timeout__ = jiffies + msecs_to_jiffies(MS) + 1; \
439 int ret__ = 0; \
440 while (!(COND)) { \
441 if (time_after(jiffies, timeout__)) { \
442 if (!(COND)) \
443 ret__ = -ETIMEDOUT; \
444 break; \
445 } \
446 if (W && drm_can_sleep()) { \
447 msleep(W); \
448 } else { \
449 cpu_relax(); \
450 } \
451 } \
452 ret__; \
453})
454
455#define wait_for(COND, MS) _wait_for(COND, MS, 1)
456
457/* vc4_bo.c */
Eric Anholtc826a6e2015-10-09 20:25:07 -0700458struct drm_gem_object *vc4_create_object(struct drm_device *dev, size_t size);
Eric Anholtc8b75bc2015-03-02 13:01:12 -0800459void vc4_free_object(struct drm_gem_object *gem_obj);
Eric Anholtc826a6e2015-10-09 20:25:07 -0700460struct vc4_bo *vc4_bo_create(struct drm_device *dev, size_t size,
461 bool from_cache);
Eric Anholtc8b75bc2015-03-02 13:01:12 -0800462int vc4_dumb_create(struct drm_file *file_priv,
463 struct drm_device *dev,
464 struct drm_mode_create_dumb *args);
465struct dma_buf *vc4_prime_export(struct drm_device *dev,
466 struct drm_gem_object *obj, int flags);
Eric Anholtd5bc60f2015-01-18 09:33:17 +1300467int vc4_create_bo_ioctl(struct drm_device *dev, void *data,
468 struct drm_file *file_priv);
Eric Anholt463873d2015-11-30 11:41:40 -0800469int vc4_create_shader_bo_ioctl(struct drm_device *dev, void *data,
470 struct drm_file *file_priv);
Eric Anholtd5bc60f2015-01-18 09:33:17 +1300471int vc4_mmap_bo_ioctl(struct drm_device *dev, void *data,
472 struct drm_file *file_priv);
Eric Anholt21461362015-10-30 10:09:02 -0700473int vc4_get_hang_state_ioctl(struct drm_device *dev, void *data,
474 struct drm_file *file_priv);
Eric Anholt463873d2015-11-30 11:41:40 -0800475int vc4_mmap(struct file *filp, struct vm_area_struct *vma);
Eric Anholtcdec4d32017-04-12 12:12:02 -0700476struct reservation_object *vc4_prime_res_obj(struct drm_gem_object *obj);
Eric Anholt463873d2015-11-30 11:41:40 -0800477int vc4_prime_mmap(struct drm_gem_object *obj, struct vm_area_struct *vma);
Eric Anholtcdec4d32017-04-12 12:12:02 -0700478struct drm_gem_object *vc4_prime_import_sg_table(struct drm_device *dev,
479 struct dma_buf_attachment *attach,
480 struct sg_table *sgt);
Eric Anholt463873d2015-11-30 11:41:40 -0800481void *vc4_prime_vmap(struct drm_gem_object *obj);
Eric Anholtc826a6e2015-10-09 20:25:07 -0700482void vc4_bo_cache_init(struct drm_device *dev);
483void vc4_bo_cache_destroy(struct drm_device *dev);
484int vc4_bo_stats_debugfs(struct seq_file *m, void *arg);
Eric Anholtc8b75bc2015-03-02 13:01:12 -0800485
486/* vc4_crtc.c */
487extern struct platform_driver vc4_crtc_driver;
Derek Foreman26fc78f2016-11-24 12:11:55 -0600488bool vc4_event_pending(struct drm_crtc *crtc);
Eric Anholtc8b75bc2015-03-02 13:01:12 -0800489int vc4_crtc_debugfs_regs(struct seq_file *m, void *arg);
Daniel Vetter1bf6ad62017-05-09 16:03:28 +0200490bool vc4_crtc_get_scanoutpos(struct drm_device *dev, unsigned int crtc_id,
491 bool in_vblank_irq, int *vpos, int *hpos,
492 ktime_t *stime, ktime_t *etime,
493 const struct drm_display_mode *mode);
Eric Anholtc8b75bc2015-03-02 13:01:12 -0800494
495/* vc4_debugfs.c */
496int vc4_debugfs_init(struct drm_minor *minor);
Eric Anholtc8b75bc2015-03-02 13:01:12 -0800497
498/* vc4_drv.c */
499void __iomem *vc4_ioremap_regs(struct platform_device *dev, int index);
500
Eric Anholt08302c32016-02-10 11:42:32 -0800501/* vc4_dpi.c */
502extern struct platform_driver vc4_dpi_driver;
503int vc4_dpi_debugfs_regs(struct seq_file *m, void *unused);
504
Eric Anholt4078f572017-01-31 11:29:11 -0800505/* vc4_dsi.c */
506extern struct platform_driver vc4_dsi_driver;
507int vc4_dsi_debugfs_regs(struct seq_file *m, void *unused);
508
Eric Anholtcdec4d32017-04-12 12:12:02 -0700509/* vc4_fence.c */
510extern const struct dma_fence_ops vc4_fence_ops;
511
Eric Anholtd5b1a782015-11-30 12:13:37 -0800512/* vc4_gem.c */
513void vc4_gem_init(struct drm_device *dev);
514void vc4_gem_destroy(struct drm_device *dev);
515int vc4_submit_cl_ioctl(struct drm_device *dev, void *data,
516 struct drm_file *file_priv);
517int vc4_wait_seqno_ioctl(struct drm_device *dev, void *data,
518 struct drm_file *file_priv);
519int vc4_wait_bo_ioctl(struct drm_device *dev, void *data,
520 struct drm_file *file_priv);
Varad Gautamca26d282016-02-17 19:08:21 +0530521void vc4_submit_next_bin_job(struct drm_device *dev);
522void vc4_submit_next_render_job(struct drm_device *dev);
523void vc4_move_job_to_render(struct drm_device *dev, struct vc4_exec_info *exec);
Eric Anholtd5b1a782015-11-30 12:13:37 -0800524int vc4_wait_for_seqno(struct drm_device *dev, uint64_t seqno,
525 uint64_t timeout_ns, bool interruptible);
526void vc4_job_handle_completed(struct vc4_dev *vc4);
Eric Anholtb501bac2015-11-30 12:34:01 -0800527int vc4_queue_seqno_cb(struct drm_device *dev,
528 struct vc4_seqno_cb *cb, uint64_t seqno,
529 void (*func)(struct vc4_seqno_cb *cb));
Eric Anholtd5b1a782015-11-30 12:13:37 -0800530
Eric Anholtc8b75bc2015-03-02 13:01:12 -0800531/* vc4_hdmi.c */
532extern struct platform_driver vc4_hdmi_driver;
533int vc4_hdmi_debugfs_regs(struct seq_file *m, void *unused);
534
Boris Brezillon9a8d5e42017-05-23 16:36:27 +0200535/* vc4_vec.c */
Boris Brezillone4b81f82016-12-02 14:48:10 +0100536extern struct platform_driver vc4_vec_driver;
537int vc4_vec_debugfs_regs(struct seq_file *m, void *unused);
538
Eric Anholtd5b1a782015-11-30 12:13:37 -0800539/* vc4_irq.c */
540irqreturn_t vc4_irq(int irq, void *arg);
541void vc4_irq_preinstall(struct drm_device *dev);
542int vc4_irq_postinstall(struct drm_device *dev);
543void vc4_irq_uninstall(struct drm_device *dev);
544void vc4_irq_reset(struct drm_device *dev);
545
Eric Anholtc8b75bc2015-03-02 13:01:12 -0800546/* vc4_hvs.c */
547extern struct platform_driver vc4_hvs_driver;
548void vc4_hvs_dump_state(struct drm_device *dev);
549int vc4_hvs_debugfs_regs(struct seq_file *m, void *unused);
550
551/* vc4_kms.c */
552int vc4_kms_load(struct drm_device *dev);
553
554/* vc4_plane.c */
555struct drm_plane *vc4_plane_init(struct drm_device *dev,
556 enum drm_plane_type type);
557u32 vc4_plane_write_dlist(struct drm_plane *plane, u32 __iomem *dlist);
Daniel Vetter2f196b72016-06-02 16:21:44 +0200558u32 vc4_plane_dlist_size(const struct drm_plane_state *state);
Eric Anholtb501bac2015-11-30 12:34:01 -0800559void vc4_plane_async_set_fb(struct drm_plane *plane,
560 struct drm_framebuffer *fb);
Eric Anholt463873d2015-11-30 11:41:40 -0800561
Eric Anholtd3f51682015-03-02 13:01:12 -0800562/* vc4_v3d.c */
563extern struct platform_driver vc4_v3d_driver;
564int vc4_v3d_debugfs_ident(struct seq_file *m, void *unused);
565int vc4_v3d_debugfs_regs(struct seq_file *m, void *unused);
Eric Anholt553c9422017-03-27 16:10:25 -0700566int vc4_v3d_get_bin_slot(struct vc4_dev *vc4);
Eric Anholtd5b1a782015-11-30 12:13:37 -0800567
568/* vc4_validate.c */
569int
570vc4_validate_bin_cl(struct drm_device *dev,
571 void *validated,
572 void *unvalidated,
573 struct vc4_exec_info *exec);
574
575int
576vc4_validate_shader_recs(struct drm_device *dev, struct vc4_exec_info *exec);
577
578struct drm_gem_cma_object *vc4_use_bo(struct vc4_exec_info *exec,
579 uint32_t hindex);
580
581int vc4_get_rcl(struct drm_device *dev, struct vc4_exec_info *exec);
582
583bool vc4_check_tex_size(struct vc4_exec_info *exec,
584 struct drm_gem_cma_object *fbo,
585 uint32_t offset, uint8_t tiling_format,
586 uint32_t width, uint32_t height, uint8_t cpp);
Eric Anholtd3f51682015-03-02 13:01:12 -0800587
Eric Anholt463873d2015-11-30 11:41:40 -0800588/* vc4_validate_shader.c */
589struct vc4_validated_shader_info *
590vc4_validate_shader(struct drm_gem_cma_object *shader_obj);