Lines Matching full:vc4

42 	struct vc4_dev *vc4 = to_vc4_dev(dev);  in vc4_queue_hangcheck()  local
44 mod_timer(&vc4->hangcheck.timer, in vc4_queue_hangcheck()
74 struct vc4_dev *vc4 = to_vc4_dev(dev); in vc4_get_hang_state_ioctl() local
79 if (WARN_ON_ONCE(vc4->is_vc5)) in vc4_get_hang_state_ioctl()
82 if (!vc4->v3d) { in vc4_get_hang_state_ioctl()
83 DRM_DEBUG("VC4_GET_HANG_STATE with no VC4 V3D probed\n"); in vc4_get_hang_state_ioctl()
87 spin_lock_irqsave(&vc4->job_lock, irqflags); in vc4_get_hang_state_ioctl()
88 kernel_state = vc4->hang_state; in vc4_get_hang_state_ioctl()
90 spin_unlock_irqrestore(&vc4->job_lock, irqflags); in vc4_get_hang_state_ioctl()
100 spin_unlock_irqrestore(&vc4->job_lock, irqflags); in vc4_get_hang_state_ioctl()
104 vc4->hang_state = NULL; in vc4_get_hang_state_ioctl()
105 spin_unlock_irqrestore(&vc4->job_lock, irqflags); in vc4_get_hang_state_ioctl()
154 struct vc4_dev *vc4 = to_vc4_dev(dev); in vc4_save_hang_state() local
168 spin_lock_irqsave(&vc4->job_lock, irqflags); in vc4_save_hang_state()
169 exec[0] = vc4_first_bin_job(vc4); in vc4_save_hang_state()
170 exec[1] = vc4_first_render_job(vc4); in vc4_save_hang_state()
172 spin_unlock_irqrestore(&vc4->job_lock, irqflags); in vc4_save_hang_state()
192 spin_unlock_irqrestore(&vc4->job_lock, irqflags); in vc4_save_hang_state()
230 spin_unlock_irqrestore(&vc4->job_lock, irqflags); in vc4_save_hang_state()
278 spin_lock_irqsave(&vc4->job_lock, irqflags); in vc4_save_hang_state()
279 if (vc4->hang_state) { in vc4_save_hang_state()
280 spin_unlock_irqrestore(&vc4->job_lock, irqflags); in vc4_save_hang_state()
283 vc4->hang_state = kernel_state; in vc4_save_hang_state()
284 spin_unlock_irqrestore(&vc4->job_lock, irqflags); in vc4_save_hang_state()
291 struct vc4_dev *vc4 = to_vc4_dev(dev); in vc4_reset() local
295 mutex_lock(&vc4->power_lock); in vc4_reset()
296 if (vc4->power_refcount) { in vc4_reset()
300 pm_runtime_put_sync_suspend(&vc4->v3d->pdev->dev); in vc4_reset()
301 pm_runtime_get_sync(&vc4->v3d->pdev->dev); in vc4_reset()
303 mutex_unlock(&vc4->power_lock); in vc4_reset()
317 struct vc4_dev *vc4 = in vc4_reset_work() local
320 vc4_save_hang_state(&vc4->base); in vc4_reset_work()
322 vc4_reset(&vc4->base); in vc4_reset_work()
328 struct vc4_dev *vc4 = from_timer(vc4, t, hangcheck.timer); in vc4_hangcheck_elapsed() local
329 struct drm_device *dev = &vc4->base; in vc4_hangcheck_elapsed()
334 spin_lock_irqsave(&vc4->job_lock, irqflags); in vc4_hangcheck_elapsed()
336 bin_exec = vc4_first_bin_job(vc4); in vc4_hangcheck_elapsed()
337 render_exec = vc4_first_render_job(vc4); in vc4_hangcheck_elapsed()
341 spin_unlock_irqrestore(&vc4->job_lock, irqflags); in vc4_hangcheck_elapsed()
357 spin_unlock_irqrestore(&vc4->job_lock, irqflags); in vc4_hangcheck_elapsed()
362 spin_unlock_irqrestore(&vc4->job_lock, irqflags); in vc4_hangcheck_elapsed()
368 schedule_work(&vc4->hangcheck.reset_work); in vc4_hangcheck_elapsed()
374 struct vc4_dev *vc4 = to_vc4_dev(dev); in submit_cl() local
387 struct vc4_dev *vc4 = to_vc4_dev(dev); in vc4_wait_for_seqno() local
392 if (WARN_ON_ONCE(vc4->is_vc5)) in vc4_wait_for_seqno()
395 if (vc4->finished_seqno >= seqno) in vc4_wait_for_seqno()
405 prepare_to_wait(&vc4->job_wait_queue, &wait, in vc4_wait_for_seqno()
414 if (vc4->finished_seqno >= seqno) in vc4_wait_for_seqno()
428 finish_wait(&vc4->job_wait_queue, &wait); in vc4_wait_for_seqno()
437 struct vc4_dev *vc4 = to_vc4_dev(dev); in vc4_flush_caches() local
456 struct vc4_dev *vc4 = to_vc4_dev(dev); in vc4_flush_texture_caches() local
474 struct vc4_dev *vc4 = to_vc4_dev(dev); in vc4_submit_next_bin_job() local
477 if (WARN_ON_ONCE(vc4->is_vc5)) in vc4_submit_next_bin_job()
481 exec = vc4_first_bin_job(vc4); in vc4_submit_next_bin_job()
490 if (exec->perfmon && vc4->active_perfmon != exec->perfmon) in vc4_submit_next_bin_job()
491 vc4_perfmon_start(vc4, exec->perfmon); in vc4_submit_next_bin_job()
504 next = vc4_first_bin_job(vc4); in vc4_submit_next_bin_job()
519 struct vc4_dev *vc4 = to_vc4_dev(dev); in vc4_submit_next_render_job() local
520 struct vc4_exec_info *exec = vc4_first_render_job(vc4); in vc4_submit_next_render_job()
525 if (WARN_ON_ONCE(vc4->is_vc5)) in vc4_submit_next_render_job()
543 struct vc4_dev *vc4 = to_vc4_dev(dev); in vc4_move_job_to_render() local
544 bool was_empty = list_empty(&vc4->render_job_list); in vc4_move_job_to_render()
546 if (WARN_ON_ONCE(vc4->is_vc5)) in vc4_move_job_to_render()
549 list_move_tail(&exec->head, &vc4->render_job_list); in vc4_move_job_to_render()
599 * to vc4, so we don't attach dma-buf fences to them.
685 struct vc4_dev *vc4 = to_vc4_dev(dev); in vc4_queue_submit() local
696 spin_lock_irqsave(&vc4->job_lock, irqflags); in vc4_queue_submit()
698 seqno = ++vc4->emit_seqno; in vc4_queue_submit()
701 dma_fence_init(&fence->base, &vc4_fence_ops, &vc4->job_lock, in vc4_queue_submit()
702 vc4->dma_fence_context, exec->seqno); in vc4_queue_submit()
713 list_add_tail(&exec->head, &vc4->bin_job_list); in vc4_queue_submit()
720 renderjob = vc4_first_render_job(vc4); in vc4_queue_submit()
721 if (vc4_first_bin_job(vc4) == exec && in vc4_queue_submit()
727 spin_unlock_irqrestore(&vc4->job_lock, irqflags); in vc4_queue_submit()
802 struct vc4_dev *vc4 = to_vc4_dev(dev); in vc4_get_bcl() local
902 ret = vc4_v3d_bin_bo_get(vc4, &exec->bin_bo_used); in vc4_get_bcl()
921 struct vc4_dev *vc4 = to_vc4_dev(dev); in vc4_complete_exec() local
951 spin_lock_irqsave(&vc4->job_lock, irqflags); in vc4_complete_exec()
952 vc4->bin_alloc_used &= ~exec->bin_slots; in vc4_complete_exec()
953 spin_unlock_irqrestore(&vc4->job_lock, irqflags); in vc4_complete_exec()
957 vc4_v3d_bin_bo_put(vc4); in vc4_complete_exec()
962 vc4_v3d_pm_put(vc4); in vc4_complete_exec()
968 vc4_job_handle_completed(struct vc4_dev *vc4) in vc4_job_handle_completed() argument
973 if (WARN_ON_ONCE(vc4->is_vc5)) in vc4_job_handle_completed()
976 spin_lock_irqsave(&vc4->job_lock, irqflags); in vc4_job_handle_completed()
977 while (!list_empty(&vc4->job_done_list)) { in vc4_job_handle_completed()
979 list_first_entry(&vc4->job_done_list, in vc4_job_handle_completed()
983 spin_unlock_irqrestore(&vc4->job_lock, irqflags); in vc4_job_handle_completed()
984 vc4_complete_exec(&vc4->base, exec); in vc4_job_handle_completed()
985 spin_lock_irqsave(&vc4->job_lock, irqflags); in vc4_job_handle_completed()
988 list_for_each_entry_safe(cb, cb_temp, &vc4->seqno_cb_list, work.entry) { in vc4_job_handle_completed()
989 if (cb->seqno <= vc4->finished_seqno) { in vc4_job_handle_completed()
995 spin_unlock_irqrestore(&vc4->job_lock, irqflags); in vc4_job_handle_completed()
1009 struct vc4_dev *vc4 = to_vc4_dev(dev); in vc4_queue_seqno_cb() local
1012 if (WARN_ON_ONCE(vc4->is_vc5)) in vc4_queue_seqno_cb()
1018 spin_lock_irqsave(&vc4->job_lock, irqflags); in vc4_queue_seqno_cb()
1019 if (seqno > vc4->finished_seqno) { in vc4_queue_seqno_cb()
1021 list_add_tail(&cb->work.entry, &vc4->seqno_cb_list); in vc4_queue_seqno_cb()
1025 spin_unlock_irqrestore(&vc4->job_lock, irqflags); in vc4_queue_seqno_cb()
1037 struct vc4_dev *vc4 = in vc4_job_done_work() local
1040 vc4_job_handle_completed(vc4); in vc4_job_done_work()
1065 struct vc4_dev *vc4 = to_vc4_dev(dev); in vc4_wait_seqno_ioctl() local
1068 if (WARN_ON_ONCE(vc4->is_vc5)) in vc4_wait_seqno_ioctl()
1079 struct vc4_dev *vc4 = to_vc4_dev(dev); in vc4_wait_bo_ioctl() local
1085 if (WARN_ON_ONCE(vc4->is_vc5)) in vc4_wait_bo_ioctl()
1106 * vc4_submit_cl_ioctl() - Submits a job (frame) to the VC4.
1121 struct vc4_dev *vc4 = to_vc4_dev(dev); in vc4_submit_cl_ioctl() local
1134 if (WARN_ON_ONCE(vc4->is_vc5)) in vc4_submit_cl_ioctl()
1137 if (!vc4->v3d) { in vc4_submit_cl_ioctl()
1138 DRM_DEBUG("VC4_SUBMIT_CL with no VC4 V3D probed\n"); in vc4_submit_cl_ioctl()
1159 exec->dev = vc4; in vc4_submit_cl_ioctl()
1161 ret = vc4_v3d_pm_get(vc4); in vc4_submit_cl_ioctl()
1195 vc4->dma_fence_context)) { in vc4_submit_cl_ioctl()
1254 args->seqno = vc4->emit_seqno; in vc4_submit_cl_ioctl()
1259 vc4_complete_exec(&vc4->base, exec); in vc4_submit_cl_ioctl()
1267 struct vc4_dev *vc4 = to_vc4_dev(dev); in vc4_gem_init() local
1270 if (WARN_ON_ONCE(vc4->is_vc5)) in vc4_gem_init()
1273 vc4->dma_fence_context = dma_fence_context_alloc(1); in vc4_gem_init()
1275 INIT_LIST_HEAD(&vc4->bin_job_list); in vc4_gem_init()
1276 INIT_LIST_HEAD(&vc4->render_job_list); in vc4_gem_init()
1277 INIT_LIST_HEAD(&vc4->job_done_list); in vc4_gem_init()
1278 INIT_LIST_HEAD(&vc4->seqno_cb_list); in vc4_gem_init()
1279 spin_lock_init(&vc4->job_lock); in vc4_gem_init()
1281 INIT_WORK(&vc4->hangcheck.reset_work, vc4_reset_work); in vc4_gem_init()
1282 timer_setup(&vc4->hangcheck.timer, vc4_hangcheck_elapsed, 0); in vc4_gem_init()
1284 INIT_WORK(&vc4->job_done_work, vc4_job_done_work); in vc4_gem_init()
1286 ret = drmm_mutex_init(dev, &vc4->power_lock); in vc4_gem_init()
1290 INIT_LIST_HEAD(&vc4->purgeable.list); in vc4_gem_init()
1292 ret = drmm_mutex_init(dev, &vc4->purgeable.lock); in vc4_gem_init()
1301 struct vc4_dev *vc4 = to_vc4_dev(dev); in vc4_gem_destroy() local
1306 WARN_ON(vc4->emit_seqno != vc4->finished_seqno); in vc4_gem_destroy()
1311 if (vc4->bin_bo) { in vc4_gem_destroy()
1312 drm_gem_object_put(&vc4->bin_bo->base.base); in vc4_gem_destroy()
1313 vc4->bin_bo = NULL; in vc4_gem_destroy()
1316 if (vc4->hang_state) in vc4_gem_destroy()
1317 vc4_free_hang_state(dev, vc4->hang_state); in vc4_gem_destroy()
1323 struct vc4_dev *vc4 = to_vc4_dev(dev); in vc4_gem_madvise_ioctl() local
1329 if (WARN_ON_ONCE(vc4->is_vc5)) in vc4_gem_madvise_ioctl()