Lines Matching full:cmdq
31 static void ivpu_cmdq_ring_db(struct ivpu_device *vdev, struct ivpu_cmdq *cmdq) in ivpu_cmdq_ring_db() argument
33 ivpu_hw_reg_db_set(vdev, cmdq->db_id); in ivpu_cmdq_ring_db()
40 struct ivpu_cmdq *cmdq; in ivpu_cmdq_alloc() local
42 cmdq = kzalloc(sizeof(*cmdq), GFP_KERNEL); in ivpu_cmdq_alloc()
43 if (!cmdq) in ivpu_cmdq_alloc()
46 cmdq->mem = ivpu_bo_alloc_internal(vdev, 0, SZ_4K, DRM_IVPU_BO_WC); in ivpu_cmdq_alloc()
47 if (!cmdq->mem) in ivpu_cmdq_alloc()
50 cmdq->db_id = file_priv->ctx.id + engine * ivpu_get_context_count(vdev); in ivpu_cmdq_alloc()
51 cmdq->entry_count = (u32)((cmdq->mem->base.size - sizeof(struct vpu_job_queue_header)) / in ivpu_cmdq_alloc()
54 cmdq->jobq = (struct vpu_job_queue *)cmdq->mem->kvaddr; in ivpu_cmdq_alloc()
55 jobq_header = &cmdq->jobq->header; in ivpu_cmdq_alloc()
61 return cmdq; in ivpu_cmdq_alloc()
64 kfree(cmdq); in ivpu_cmdq_alloc()
68 static void ivpu_cmdq_free(struct ivpu_file_priv *file_priv, struct ivpu_cmdq *cmdq) in ivpu_cmdq_free() argument
70 if (!cmdq) in ivpu_cmdq_free()
73 ivpu_bo_free_internal(cmdq->mem); in ivpu_cmdq_free()
74 kfree(cmdq); in ivpu_cmdq_free()
80 struct ivpu_cmdq *cmdq = file_priv->cmdq[engine]; in ivpu_cmdq_acquire() local
85 if (!cmdq) { in ivpu_cmdq_acquire()
86 cmdq = ivpu_cmdq_alloc(file_priv, engine); in ivpu_cmdq_acquire()
87 if (!cmdq) in ivpu_cmdq_acquire()
89 file_priv->cmdq[engine] = cmdq; in ivpu_cmdq_acquire()
92 if (cmdq->db_registered) in ivpu_cmdq_acquire()
93 return cmdq; in ivpu_cmdq_acquire()
95 ret = ivpu_jsm_register_db(vdev, file_priv->ctx.id, cmdq->db_id, in ivpu_cmdq_acquire()
96 cmdq->mem->vpu_addr, cmdq->mem->base.size); in ivpu_cmdq_acquire()
100 cmdq->db_registered = true; in ivpu_cmdq_acquire()
102 return cmdq; in ivpu_cmdq_acquire()
107 struct ivpu_cmdq *cmdq = file_priv->cmdq[engine]; in ivpu_cmdq_release_locked() local
111 if (cmdq) { in ivpu_cmdq_release_locked()
112 file_priv->cmdq[engine] = NULL; in ivpu_cmdq_release_locked()
113 if (cmdq->db_registered) in ivpu_cmdq_release_locked()
114 ivpu_jsm_unregister_db(file_priv->vdev, cmdq->db_id); in ivpu_cmdq_release_locked()
116 ivpu_cmdq_free(file_priv, cmdq); in ivpu_cmdq_release_locked()
140 struct ivpu_cmdq *cmdq = file_priv->cmdq[engine]; in ivpu_cmdq_reset_locked() local
144 if (cmdq) { in ivpu_cmdq_reset_locked()
145 cmdq->db_registered = false; in ivpu_cmdq_reset_locked()
146 cmdq->jobq->header.head = 0; in ivpu_cmdq_reset_locked()
147 cmdq->jobq->header.tail = 0; in ivpu_cmdq_reset_locked()
180 static int ivpu_cmdq_push_job(struct ivpu_cmdq *cmdq, struct ivpu_job *job) in ivpu_cmdq_push_job() argument
183 struct vpu_job_queue_header *header = &cmdq->jobq->header; in ivpu_cmdq_push_job()
186 u32 next_entry = (tail + 1) % cmdq->entry_count; in ivpu_cmdq_push_job()
191 job->file_priv->ctx.id, job->engine_idx, cmdq->db_id, header->head, tail); in ivpu_cmdq_push_job()
195 entry = &cmdq->jobq->job[tail]; in ivpu_cmdq_push_job()
374 struct ivpu_cmdq *cmdq; in ivpu_direct_job_submission() local
379 cmdq = ivpu_cmdq_acquire(job->file_priv, job->engine_idx); in ivpu_direct_job_submission()
380 if (!cmdq) { in ivpu_direct_job_submission()
397 ret = ivpu_cmdq_push_job(cmdq, job); in ivpu_direct_job_submission()
403 job->engine_idx, cmdq->jobq->header.tail); in ivpu_direct_job_submission()
407 cmdq->jobq->header.head = cmdq->jobq->header.tail; in ivpu_direct_job_submission()
410 ivpu_cmdq_ring_db(vdev, cmdq); in ivpu_direct_job_submission()