1 /* SPDX-License-Identifier: MIT */
3 #ifndef __NOUVEAU_EXEC_H__
4 #define __NOUVEAU_EXEC_H__
6 #include "nouveau_drv.h"
7 #include "nouveau_sched.h"
9 struct nouveau_exec_job_args {
10 struct drm_file *file_priv;
11 struct nouveau_sched *sched;
12 struct nouveau_channel *chan;
15 struct drm_nouveau_sync *s;
20 struct drm_nouveau_sync *s;
25 struct drm_nouveau_exec_push *s;
30 struct nouveau_exec_job {
31 struct nouveau_job base;
32 struct nouveau_fence *fence;
33 struct nouveau_channel *chan;
36 struct drm_nouveau_exec_push *s;
41 #define to_nouveau_exec_job(job) \
42 container_of((job), struct nouveau_exec_job, base)
44 int nouveau_exec_job_init(struct nouveau_exec_job **job,
45 struct nouveau_exec_job_args *args);
47 int nouveau_exec_ioctl_exec(struct drm_device *dev, void *data,
48 struct drm_file *file_priv);
50 static inline unsigned int
51 nouveau_exec_push_max_from_ib_max(int ib_max)
53 /* Limit the number of IBs per job to half the size of the ring in order
54 * to avoid the ring running dry between submissions and preserve one
55 * more slot for the job's HW fence.
57 return ib_max > 1 ? ib_max / 2 - 1 : 0;