Lines Matching refs:ring

126 int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,  in amdgpu_ib_schedule()  argument
130 struct amdgpu_device *adev = ring->adev; in amdgpu_ib_schedule()
158 if (!ring->sched.ready) { in amdgpu_ib_schedule()
159 dev_err(adev->dev, "couldn't schedule ib on ring <%s>\n", ring->name); in amdgpu_ib_schedule()
169 (ring->funcs->type == AMDGPU_RING_TYPE_COMPUTE)) { in amdgpu_ib_schedule()
174 alloc_size = ring->funcs->emit_frame_size + num_ibs * in amdgpu_ib_schedule()
175 ring->funcs->emit_ib_size; in amdgpu_ib_schedule()
177 r = amdgpu_ring_alloc(ring, alloc_size); in amdgpu_ib_schedule()
183 need_ctx_switch = ring->current_ctx != fence_ctx; in amdgpu_ib_schedule()
184 if (ring->funcs->emit_pipeline_sync && job && in amdgpu_ib_schedule()
187 amdgpu_vm_need_pipeline_sync(ring, job))) { in amdgpu_ib_schedule()
196 if ((ib->flags & AMDGPU_IB_FLAG_EMIT_MEM_SYNC) && ring->funcs->emit_mem_sync) in amdgpu_ib_schedule()
197 ring->funcs->emit_mem_sync(ring); in amdgpu_ib_schedule()
199 if (ring->funcs->emit_wave_limit && in amdgpu_ib_schedule()
200 ring->hw_prio == AMDGPU_GFX_PIPE_PRIO_HIGH) in amdgpu_ib_schedule()
201 ring->funcs->emit_wave_limit(ring, true); in amdgpu_ib_schedule()
203 if (ring->funcs->insert_start) in amdgpu_ib_schedule()
204 ring->funcs->insert_start(ring); in amdgpu_ib_schedule()
207 r = amdgpu_vm_flush(ring, job, need_pipe_sync); in amdgpu_ib_schedule()
209 amdgpu_ring_undo(ring); in amdgpu_ib_schedule()
214 if (job && ring->funcs->init_cond_exec) in amdgpu_ib_schedule()
215 patch_offset = amdgpu_ring_init_cond_exec(ring); in amdgpu_ib_schedule()
217 amdgpu_device_flush_hdp(adev, ring); in amdgpu_ib_schedule()
222 if (job && ring->funcs->emit_cntxcntl) { in amdgpu_ib_schedule()
225 amdgpu_ring_emit_cntxcntl(ring, status); in amdgpu_ib_schedule()
231 if (job && ring->funcs->emit_frame_cntl) { in amdgpu_ib_schedule()
233 amdgpu_ring_emit_frame_cntl(ring, true, secure); in amdgpu_ib_schedule()
239 if (job && ring->funcs->emit_frame_cntl) { in amdgpu_ib_schedule()
241 amdgpu_ring_emit_frame_cntl(ring, false, secure); in amdgpu_ib_schedule()
243 amdgpu_ring_emit_frame_cntl(ring, true, secure); in amdgpu_ib_schedule()
247 amdgpu_ring_emit_ib(ring, job, ib, status); in amdgpu_ib_schedule()
251 if (job && ring->funcs->emit_frame_cntl) in amdgpu_ib_schedule()
252 amdgpu_ring_emit_frame_cntl(ring, false, secure); in amdgpu_ib_schedule()
254 amdgpu_device_invalidate_hdp(adev, ring); in amdgpu_ib_schedule()
261 amdgpu_ring_emit_fence(ring, job->uf_addr, job->uf_sequence, in amdgpu_ib_schedule()
265 r = amdgpu_fence_emit(ring, f, job, fence_flags); in amdgpu_ib_schedule()
269 amdgpu_vmid_reset(adev, ring->funcs->vmhub, job->vmid); in amdgpu_ib_schedule()
270 amdgpu_ring_undo(ring); in amdgpu_ib_schedule()
274 if (ring->funcs->insert_end) in amdgpu_ib_schedule()
275 ring->funcs->insert_end(ring); in amdgpu_ib_schedule()
277 if (patch_offset != ~0 && ring->funcs->patch_cond_exec) in amdgpu_ib_schedule()
278 amdgpu_ring_patch_cond_exec(ring, patch_offset); in amdgpu_ib_schedule()
280 ring->current_ctx = fence_ctx; in amdgpu_ib_schedule()
281 if (vm && ring->funcs->emit_switch_buffer) in amdgpu_ib_schedule()
282 amdgpu_ring_emit_switch_buffer(ring); in amdgpu_ib_schedule()
284 if (ring->funcs->emit_wave_limit && in amdgpu_ib_schedule()
285 ring->hw_prio == AMDGPU_GFX_PIPE_PRIO_HIGH) in amdgpu_ib_schedule()
286 ring->funcs->emit_wave_limit(ring, false); in amdgpu_ib_schedule()
288 amdgpu_ring_commit(ring); in amdgpu_ib_schedule()
384 struct amdgpu_ring *ring = adev->rings[i]; in amdgpu_ib_ring_tests() local
390 if (!ring->sched.ready || !ring->funcs->test_ib) in amdgpu_ib_ring_tests()
394 if (ring->funcs->type == AMDGPU_RING_TYPE_UVD || in amdgpu_ib_ring_tests()
395 ring->funcs->type == AMDGPU_RING_TYPE_VCE || in amdgpu_ib_ring_tests()
396 ring->funcs->type == AMDGPU_RING_TYPE_UVD_ENC || in amdgpu_ib_ring_tests()
397 ring->funcs->type == AMDGPU_RING_TYPE_VCN_DEC || in amdgpu_ib_ring_tests()
398 ring->funcs->type == AMDGPU_RING_TYPE_VCN_ENC || in amdgpu_ib_ring_tests()
399 ring->funcs->type == AMDGPU_RING_TYPE_VCN_JPEG) in amdgpu_ib_ring_tests()
404 r = amdgpu_ring_test_ib(ring, tmo); in amdgpu_ib_ring_tests()
407 ring->name); in amdgpu_ib_ring_tests()
411 ring->sched.ready = false; in amdgpu_ib_ring_tests()
413 ring->name, r); in amdgpu_ib_ring_tests()
415 if (ring == &adev->gfx.gfx_ring[0]) { in amdgpu_ib_ring_tests()