Lines Matching full:job
167 * need to wait for completion before dispatching the job -- in v3d_flush_l2t()
171 * synchronously clean after a job. in v3d_flush_l2t()
184 * signaling job completion. So, we synchronously wait before
250 v3d_lock_bo_reservations(struct v3d_job *job, in v3d_lock_bo_reservations() argument
255 ret = drm_gem_lock_reservations(job->bo, job->bo_count, acquire_ctx); in v3d_lock_bo_reservations()
259 for (i = 0; i < job->bo_count; i++) { in v3d_lock_bo_reservations()
260 ret = drm_gem_fence_array_add_implicit(&job->deps, in v3d_lock_bo_reservations()
261 job->bo[i], true); in v3d_lock_bo_reservations()
263 drm_gem_unlock_reservations(job->bo, job->bo_count, in v3d_lock_bo_reservations()
273 * v3d_lookup_bos() - Sets up job->bo[] with the GEM objects
274 * referenced by the job.
277 * @job: V3D job being set up
280 * the submitted job's BO list. This does the validation of the job's
281 * BO list and reference counting for the lifetime of the job.
289 struct v3d_job *job, in v3d_lookup_bos() argument
297 job->bo_count = bo_count; in v3d_lookup_bos()
299 if (!job->bo_count) { in v3d_lookup_bos()
307 job->bo = kvmalloc_array(job->bo_count, in v3d_lookup_bos()
310 if (!job->bo) { in v3d_lookup_bos()
315 handles = kvmalloc_array(job->bo_count, sizeof(u32), GFP_KERNEL); in v3d_lookup_bos()
324 job->bo_count * sizeof(u32))) { in v3d_lookup_bos()
331 for (i = 0; i < job->bo_count; i++) { in v3d_lookup_bos()
342 job->bo[i] = bo; in v3d_lookup_bos()
354 struct v3d_job *job = container_of(ref, struct v3d_job, refcount); in v3d_job_free() local
359 for (i = 0; i < job->bo_count; i++) { in v3d_job_free()
360 if (job->bo[i]) in v3d_job_free()
361 drm_gem_object_put(job->bo[i]); in v3d_job_free()
363 kvfree(job->bo); in v3d_job_free()
365 xa_for_each(&job->deps, index, fence) { in v3d_job_free()
368 xa_destroy(&job->deps); in v3d_job_free()
370 dma_fence_put(job->irq_fence); in v3d_job_free()
371 dma_fence_put(job->done_fence); in v3d_job_free()
373 pm_runtime_mark_last_busy(job->v3d->drm.dev); in v3d_job_free()
374 pm_runtime_put_autosuspend(job->v3d->drm.dev); in v3d_job_free()
376 kfree(job); in v3d_job_free()
382 struct v3d_render_job *job = container_of(ref, struct v3d_render_job, in v3d_render_job_free() local
386 list_for_each_entry_safe(bo, save, &job->unref_list, unref_head) { in v3d_render_job_free()
393 void v3d_job_put(struct v3d_job *job) in v3d_job_put() argument
395 kref_put(&job->refcount, job->free); in v3d_job_put()
433 struct v3d_job *job, void (*free)(struct kref *ref), in v3d_job_init() argument
439 job->v3d = v3d; in v3d_job_init()
440 job->free = free; in v3d_job_init()
446 xa_init_flags(&job->deps, XA_FLAGS_ALLOC); in v3d_job_init()
452 ret = drm_gem_fence_array_add(&job->deps, in_fence); in v3d_job_init()
456 kref_init(&job->refcount); in v3d_job_init()
460 xa_destroy(&job->deps); in v3d_job_init()
467 struct v3d_job *job, enum v3d_queue queue) in v3d_push_job() argument
471 ret = drm_sched_job_init(&job->base, &v3d_priv->sched_entity[queue], in v3d_push_job()
476 job->done_fence = dma_fence_get(&job->base.s_fence->finished); in v3d_push_job()
478 /* put by scheduler job completion */ in v3d_push_job()
479 kref_get(&job->refcount); in v3d_push_job()
481 drm_sched_entity_push_job(&job->base, &v3d_priv->sched_entity[queue]); in v3d_push_job()
488 struct v3d_job *job, in v3d_attach_fences_and_unlock_reservation() argument
496 for (i = 0; i < job->bo_count; i++) { in v3d_attach_fences_and_unlock_reservation()
498 dma_resv_add_excl_fence(job->bo[i]->resv, in v3d_attach_fences_and_unlock_reservation()
499 job->done_fence); in v3d_attach_fences_and_unlock_reservation()
502 drm_gem_unlock_reservations(job->bo, job->bo_count, acquire_ctx); in v3d_attach_fences_and_unlock_reservation()
504 /* Update the return sync object for the job */ in v3d_attach_fences_and_unlock_reservation()
513 * v3d_submit_cl_ioctl() - Submits a job (frame) to the V3D.
670 * v3d_submit_tfu_ioctl() - Submits a TFU (texture formatting) job to the V3D.
685 struct v3d_tfu_job *job; in v3d_submit_tfu_ioctl() local
691 job = kcalloc(1, sizeof(*job), GFP_KERNEL); in v3d_submit_tfu_ioctl()
692 if (!job) in v3d_submit_tfu_ioctl()
695 ret = v3d_job_init(v3d, file_priv, &job->base, in v3d_submit_tfu_ioctl()
698 kfree(job); in v3d_submit_tfu_ioctl()
702 job->base.bo = kcalloc(ARRAY_SIZE(args->bo_handles), in v3d_submit_tfu_ioctl()
703 sizeof(*job->base.bo), GFP_KERNEL); in v3d_submit_tfu_ioctl()
704 if (!job->base.bo) { in v3d_submit_tfu_ioctl()
705 v3d_job_put(&job->base); in v3d_submit_tfu_ioctl()
709 job->args = *args; in v3d_submit_tfu_ioctl()
712 for (job->base.bo_count = 0; in v3d_submit_tfu_ioctl()
713 job->base.bo_count < ARRAY_SIZE(args->bo_handles); in v3d_submit_tfu_ioctl()
714 job->base.bo_count++) { in v3d_submit_tfu_ioctl()
717 if (!args->bo_handles[job->base.bo_count]) in v3d_submit_tfu_ioctl()
721 args->bo_handles[job->base.bo_count]); in v3d_submit_tfu_ioctl()
724 job->base.bo_count, in v3d_submit_tfu_ioctl()
725 args->bo_handles[job->base.bo_count]); in v3d_submit_tfu_ioctl()
731 job->base.bo[job->base.bo_count] = bo; in v3d_submit_tfu_ioctl()
735 ret = v3d_lock_bo_reservations(&job->base, &acquire_ctx); in v3d_submit_tfu_ioctl()
740 ret = v3d_push_job(v3d_priv, &job->base, V3D_TFU); in v3d_submit_tfu_ioctl()
746 &job->base, &acquire_ctx, in v3d_submit_tfu_ioctl()
748 job->base.done_fence); in v3d_submit_tfu_ioctl()
750 v3d_job_put(&job->base); in v3d_submit_tfu_ioctl()
756 drm_gem_unlock_reservations(job->base.bo, job->base.bo_count, in v3d_submit_tfu_ioctl()
759 v3d_job_put(&job->base); in v3d_submit_tfu_ioctl()
765 * v3d_submit_csd_ioctl() - Submits a CSD (texture formatting) job to the V3D.
780 struct v3d_csd_job *job; in v3d_submit_csd_ioctl() local
792 job = kcalloc(1, sizeof(*job), GFP_KERNEL); in v3d_submit_csd_ioctl()
793 if (!job) in v3d_submit_csd_ioctl()
796 ret = v3d_job_init(v3d, file_priv, &job->base, in v3d_submit_csd_ioctl()
799 kfree(job); in v3d_submit_csd_ioctl()
805 v3d_job_put(&job->base); in v3d_submit_csd_ioctl()
806 kfree(job); in v3d_submit_csd_ioctl()
812 v3d_job_put(&job->base); in v3d_submit_csd_ioctl()
817 job->args = *args; in v3d_submit_csd_ioctl()
829 ret = v3d_push_job(v3d_priv, &job->base, V3D_CSD); in v3d_submit_csd_ioctl()
834 dma_fence_get(job->base.done_fence)); in v3d_submit_csd_ioctl()
849 v3d_job_put(&job->base); in v3d_submit_csd_ioctl()
859 v3d_job_put(&job->base); in v3d_submit_csd_ioctl()