xref: /linux/drivers/gpu/drm/panfrost/panfrost_job.h (revision f9aec1648df09d55436a0e3a94acff1df507751f)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright 2019 Collabora ltd. */
3 
4 #ifndef __PANFROST_JOB_H__
5 #define __PANFROST_JOB_H__
6 
7 #include <uapi/drm/panfrost_drm.h>
8 #include <drm/gpu_scheduler.h>
9 
10 struct panfrost_device;
11 struct panfrost_gem_object;
12 struct panfrost_file_priv;
13 
14 struct panfrost_job {
15 	struct drm_sched_job base;
16 
17 	struct kref refcount;
18 
19 	struct panfrost_device *pfdev;
20 	struct panfrost_file_priv *file_priv;
21 
22 	/* Contains both explicit and implicit fences */
23 	struct xarray deps;
24 	unsigned long last_dep;
25 
26 	/* Fence to be signaled by IRQ handler when the job is complete. */
27 	struct dma_fence *done_fence;
28 
29 	__u64 jc;
30 	__u32 requirements;
31 	__u32 flush_id;
32 
33 	struct panfrost_gem_mapping **mappings;
34 	struct drm_gem_object **bos;
35 	u32 bo_count;
36 
37 	/* Fence to be signaled by drm-sched once its done with the job */
38 	struct dma_fence *render_done_fence;
39 };
40 
41 int panfrost_job_init(struct panfrost_device *pfdev);
42 void panfrost_job_fini(struct panfrost_device *pfdev);
43 int panfrost_job_open(struct panfrost_file_priv *panfrost_priv);
44 void panfrost_job_close(struct panfrost_file_priv *panfrost_priv);
45 int panfrost_job_push(struct panfrost_job *job);
46 void panfrost_job_put(struct panfrost_job *job);
47 void panfrost_job_enable_interrupts(struct panfrost_device *pfdev);
48 int panfrost_job_is_idle(struct panfrost_device *pfdev);
49 
50 #endif
51