Lines Matching defs:job

27 nouveau_job_init(struct nouveau_job *job,
33 INIT_LIST_HEAD(&job->entry);
35 job->file_priv = args->file_priv;
36 job->cli = nouveau_cli(args->file_priv);
37 job->sched = sched;
39 job->sync = args->sync;
40 job->resv_usage = args->resv_usage;
42 job->ops = args->ops;
44 job->in_sync.count = args->in_sync.count;
45 if (job->in_sync.count) {
46 if (job->sync)
49 job->in_sync.data = kmemdup(args->in_sync.s,
53 if (!job->in_sync.data)
57 job->out_sync.count = args->out_sync.count;
58 if (job->out_sync.count) {
59 if (job->sync) {
64 job->out_sync.data = kmemdup(args->out_sync.s,
68 if (!job->out_sync.data) {
73 job->out_sync.objs = kcalloc(job->out_sync.count,
74 sizeof(*job->out_sync.objs),
76 if (!job->out_sync.objs) {
81 job->out_sync.chains = kcalloc(job->out_sync.count,
82 sizeof(*job->out_sync.chains),
84 if (!job->out_sync.chains) {
90 ret = drm_sched_job_init(&job->base, &sched->entity,
92 job->file_priv->client_id);
96 job->state = NOUVEAU_JOB_INITIALIZED;
101 kfree(job->out_sync.chains);
103 kfree(job->out_sync.objs);
105 kfree(job->out_sync.data);
107 kfree(job->in_sync.data);
112 nouveau_job_fini(struct nouveau_job *job)
114 dma_fence_put(job->done_fence);
115 drm_sched_job_cleanup(&job->base);
117 job->ops->free(job);
121 nouveau_job_done(struct nouveau_job *job)
123 struct nouveau_sched *sched = job->sched;
126 list_del(&job->entry);
131 nouveau_job_free(struct nouveau_job *job)
133 kfree(job->in_sync.data);
134 kfree(job->out_sync.data);
135 kfree(job->out_sync.objs);
136 kfree(job->out_sync.chains);
140 sync_find_fence(struct nouveau_job *job,
155 ret = drm_syncobj_find_fence(job->file_priv,
165 nouveau_job_add_deps(struct nouveau_job *job)
170 for (i = 0; i < job->in_sync.count; i++) {
171 struct drm_nouveau_sync *sync = &job->in_sync.data[i];
173 ret = sync_find_fence(job, sync, &in_fence);
175 NV_PRINTK(warn, job->cli,
181 ret = drm_sched_job_add_dependency(&job->base, in_fence);
190 nouveau_job_fence_attach_cleanup(struct nouveau_job *job)
194 for (i = 0; i < job->out_sync.count; i++) {
195 struct drm_syncobj *obj = job->out_sync.objs[i];
196 struct dma_fence_chain *chain = job->out_sync.chains[i];
207 nouveau_job_fence_attach_prepare(struct nouveau_job *job)
211 for (i = 0; i < job->out_sync.count; i++) {
212 struct drm_nouveau_sync *sync = &job->out_sync.data[i];
213 struct drm_syncobj **pobj = &job->out_sync.objs[i];
214 struct dma_fence_chain **pchain = &job->out_sync.chains[i];
223 *pobj = drm_syncobj_find(job->file_priv, sync->handle);
225 NV_PRINTK(warn, job->cli,
244 nouveau_job_fence_attach_cleanup(job);
249 nouveau_job_fence_attach(struct nouveau_job *job)
251 struct dma_fence *fence = job->done_fence;
254 for (i = 0; i < job->out_sync.count; i++) {
255 struct drm_nouveau_sync *sync = &job->out_sync.data[i];
256 struct drm_syncobj **pobj = &job->out_sync.objs[i];
257 struct dma_fence_chain **pchain = &job->out_sync.chains[i];
274 nouveau_job_submit(struct nouveau_job *job)
276 struct nouveau_sched *sched = job->sched;
279 .vm = &nouveau_cli_uvmm(job->cli)->base,
285 ret = nouveau_job_add_deps(job);
289 ret = nouveau_job_fence_attach_prepare(job);
293 /* Make sure the job appears on the sched_entity's queue in the same
301 if (job->ops->submit) {
302 ret = job->ops->submit(job, &vm_exec);
307 /* Submit was successful; add the job to the schedulers job list. */
309 list_add(&job->entry, &sched->job_list.head);
312 drm_sched_job_arm(&job->base);
313 job->done_fence = dma_fence_get(&job->base.s_fence->finished);
314 if (job->sync)
315 done_fence = dma_fence_get(job->done_fence);
317 if (job->ops->armed_submit)
318 job->ops->armed_submit(job, &vm_exec);
320 nouveau_job_fence_attach(job);
322 /* Set job state before pushing the job to the scheduler,
323 * such that we do not overwrite the job state set in run().
325 job->state = NOUVEAU_JOB_SUBMIT_SUCCESS;
327 drm_sched_entity_push_job(&job->base);
340 nouveau_job_fence_attach_cleanup(job);
342 job->state = NOUVEAU_JOB_SUBMIT_FAILED;
347 nouveau_job_run(struct nouveau_job *job)
351 fence = job->ops->run(job);
353 job->state = NOUVEAU_JOB_RUN_FAILED;
355 job->state = NOUVEAU_JOB_RUN_SUCCESS;
363 struct nouveau_job *job = to_nouveau_job(sched_job);
365 return nouveau_job_run(job);
372 struct nouveau_job *job = to_nouveau_job(sched_job);
377 if (job->ops->timeout)
378 stat = job->ops->timeout(job);
380 NV_PRINTK(warn, job->cli, "Generic job timeout.\n");
390 struct nouveau_job *job = to_nouveau_job(sched_job);
392 nouveau_job_fini(job);
399 struct nouveau_job *job;
401 job = to_nouveau_job(sched_job);
402 fence = to_nouveau_fence(job->done_fence);