1 /* SPDX-License-Identifier: MIT */
3 #ifndef __NOUVEAU_EXEC_H__
4 #define __NOUVEAU_EXEC_H__
6 #include <drm/drm_exec.h>
8 #include "nouveau_drv.h"
9 #include "nouveau_sched.h"
11 struct nouveau_exec_job_args {
12 struct drm_file *file_priv;
13 struct nouveau_sched_entity *sched_entity;
16 struct nouveau_channel *chan;
19 struct drm_nouveau_sync *s;
24 struct drm_nouveau_sync *s;
29 struct drm_nouveau_exec_push *s;
34 struct nouveau_exec_job {
35 struct nouveau_job base;
36 struct nouveau_fence *fence;
37 struct nouveau_channel *chan;
40 struct drm_nouveau_exec_push *s;
45 #define to_nouveau_exec_job(job) \
46 container_of((job), struct nouveau_exec_job, base)
48 int nouveau_exec_job_init(struct nouveau_exec_job **job,
49 struct nouveau_exec_job_args *args);
51 int nouveau_exec_ioctl_exec(struct drm_device *dev, void *data,
52 struct drm_file *file_priv);
54 static inline unsigned int
55 nouveau_exec_push_max_from_ib_max(int ib_max)
57 /* Limit the number of IBs per job to half the size of the ring in order
58 * to avoid the ring running dry between submissions and preserve one
59 * more slot for the job's HW fence.
61 return ib_max > 1 ? ib_max / 2 - 1 : 0;