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 (!vc4->v3d) { in vc4_get_hang_state_ioctl()
80 DRM_DEBUG("VC4_GET_HANG_STATE with no VC4 V3D probed\n"); in vc4_get_hang_state_ioctl()
84 spin_lock_irqsave(&vc4->job_lock, irqflags); in vc4_get_hang_state_ioctl()
85 kernel_state = vc4->hang_state; in vc4_get_hang_state_ioctl()
87 spin_unlock_irqrestore(&vc4->job_lock, irqflags); in vc4_get_hang_state_ioctl()
97 spin_unlock_irqrestore(&vc4->job_lock, irqflags); in vc4_get_hang_state_ioctl()
101 vc4->hang_state = NULL; in vc4_get_hang_state_ioctl()
102 spin_unlock_irqrestore(&vc4->job_lock, irqflags); in vc4_get_hang_state_ioctl()
151 struct vc4_dev *vc4 = to_vc4_dev(dev); in vc4_save_hang_state() local
165 spin_lock_irqsave(&vc4->job_lock, irqflags); in vc4_save_hang_state()
166 exec[0] = vc4_first_bin_job(vc4); in vc4_save_hang_state()
167 exec[1] = vc4_first_render_job(vc4); in vc4_save_hang_state()
169 spin_unlock_irqrestore(&vc4->job_lock, irqflags); in vc4_save_hang_state()
189 spin_unlock_irqrestore(&vc4->job_lock, irqflags); in vc4_save_hang_state()
227 spin_unlock_irqrestore(&vc4->job_lock, irqflags); in vc4_save_hang_state()
275 spin_lock_irqsave(&vc4->job_lock, irqflags); in vc4_save_hang_state()
276 if (vc4->hang_state) { in vc4_save_hang_state()
277 spin_unlock_irqrestore(&vc4->job_lock, irqflags); in vc4_save_hang_state()
280 vc4->hang_state = kernel_state; in vc4_save_hang_state()
281 spin_unlock_irqrestore(&vc4->job_lock, irqflags); in vc4_save_hang_state()
288 struct vc4_dev *vc4 = to_vc4_dev(dev); in vc4_reset() local
292 mutex_lock(&vc4->power_lock); in vc4_reset()
293 if (vc4->power_refcount) { in vc4_reset()
297 pm_runtime_put_sync_suspend(&vc4->v3d->pdev->dev); in vc4_reset()
298 pm_runtime_get_sync(&vc4->v3d->pdev->dev); in vc4_reset()
300 mutex_unlock(&vc4->power_lock); in vc4_reset()
314 struct vc4_dev *vc4 = in vc4_reset_work() local
317 vc4_save_hang_state(&vc4->base); in vc4_reset_work()
319 vc4_reset(&vc4->base); in vc4_reset_work()
325 struct vc4_dev *vc4 = from_timer(vc4, t, hangcheck.timer); in vc4_hangcheck_elapsed() local
326 struct drm_device *dev = &vc4->base; in vc4_hangcheck_elapsed()
331 spin_lock_irqsave(&vc4->job_lock, irqflags); in vc4_hangcheck_elapsed()
333 bin_exec = vc4_first_bin_job(vc4); in vc4_hangcheck_elapsed()
334 render_exec = vc4_first_render_job(vc4); in vc4_hangcheck_elapsed()
338 spin_unlock_irqrestore(&vc4->job_lock, irqflags); in vc4_hangcheck_elapsed()
354 spin_unlock_irqrestore(&vc4->job_lock, irqflags); in vc4_hangcheck_elapsed()
359 spin_unlock_irqrestore(&vc4->job_lock, irqflags); in vc4_hangcheck_elapsed()
365 schedule_work(&vc4->hangcheck.reset_work); in vc4_hangcheck_elapsed()
371 struct vc4_dev *vc4 = to_vc4_dev(dev); in submit_cl() local
384 struct vc4_dev *vc4 = to_vc4_dev(dev); in vc4_wait_for_seqno() local
389 if (vc4->finished_seqno >= seqno) in vc4_wait_for_seqno()
399 prepare_to_wait(&vc4->job_wait_queue, &wait, in vc4_wait_for_seqno()
408 if (vc4->finished_seqno >= seqno) in vc4_wait_for_seqno()
422 finish_wait(&vc4->job_wait_queue, &wait); in vc4_wait_for_seqno()
431 struct vc4_dev *vc4 = to_vc4_dev(dev); in vc4_flush_caches() local
450 struct vc4_dev *vc4 = to_vc4_dev(dev); in vc4_flush_texture_caches() local
468 struct vc4_dev *vc4 = to_vc4_dev(dev); in vc4_submit_next_bin_job() local
472 exec = vc4_first_bin_job(vc4); in vc4_submit_next_bin_job()
481 if (exec->perfmon && vc4->active_perfmon != exec->perfmon) in vc4_submit_next_bin_job()
482 vc4_perfmon_start(vc4, exec->perfmon); in vc4_submit_next_bin_job()
493 next = vc4_first_bin_job(vc4); in vc4_submit_next_bin_job()
508 struct vc4_dev *vc4 = to_vc4_dev(dev); in vc4_submit_next_render_job() local
509 struct vc4_exec_info *exec = vc4_first_render_job(vc4); in vc4_submit_next_render_job()
528 struct vc4_dev *vc4 = to_vc4_dev(dev); in vc4_move_job_to_render() local
529 bool was_empty = list_empty(&vc4->render_job_list); in vc4_move_job_to_render()
531 list_move_tail(&exec->head, &vc4->render_job_list); in vc4_move_job_to_render()
582 * to vc4, so we don't attach dma-buf fences to them.
668 struct vc4_dev *vc4 = to_vc4_dev(dev); in vc4_queue_submit() local
679 spin_lock_irqsave(&vc4->job_lock, irqflags); in vc4_queue_submit()
681 seqno = ++vc4->emit_seqno; in vc4_queue_submit()
684 dma_fence_init(&fence->base, &vc4_fence_ops, &vc4->job_lock, in vc4_queue_submit()
685 vc4->dma_fence_context, exec->seqno); in vc4_queue_submit()
696 list_add_tail(&exec->head, &vc4->bin_job_list); in vc4_queue_submit()
703 renderjob = vc4_first_render_job(vc4); in vc4_queue_submit()
704 if (vc4_first_bin_job(vc4) == exec && in vc4_queue_submit()
710 spin_unlock_irqrestore(&vc4->job_lock, irqflags); in vc4_queue_submit()
824 struct vc4_dev *vc4 = to_vc4_dev(dev); in vc4_get_bcl() local
924 ret = vc4_v3d_bin_bo_get(vc4, &exec->bin_bo_used); in vc4_get_bcl()
943 struct vc4_dev *vc4 = to_vc4_dev(dev); in vc4_complete_exec() local
973 spin_lock_irqsave(&vc4->job_lock, irqflags); in vc4_complete_exec()
974 vc4->bin_alloc_used &= ~exec->bin_slots; in vc4_complete_exec()
975 spin_unlock_irqrestore(&vc4->job_lock, irqflags); in vc4_complete_exec()
979 vc4_v3d_bin_bo_put(vc4); in vc4_complete_exec()
984 vc4_v3d_pm_put(vc4); in vc4_complete_exec()
990 vc4_job_handle_completed(struct vc4_dev *vc4) in vc4_job_handle_completed() argument
995 spin_lock_irqsave(&vc4->job_lock, irqflags); in vc4_job_handle_completed()
996 while (!list_empty(&vc4->job_done_list)) { in vc4_job_handle_completed()
998 list_first_entry(&vc4->job_done_list, in vc4_job_handle_completed()
1002 spin_unlock_irqrestore(&vc4->job_lock, irqflags); in vc4_job_handle_completed()
1003 vc4_complete_exec(&vc4->base, exec); in vc4_job_handle_completed()
1004 spin_lock_irqsave(&vc4->job_lock, irqflags); in vc4_job_handle_completed()
1007 list_for_each_entry_safe(cb, cb_temp, &vc4->seqno_cb_list, work.entry) { in vc4_job_handle_completed()
1008 if (cb->seqno <= vc4->finished_seqno) { in vc4_job_handle_completed()
1014 spin_unlock_irqrestore(&vc4->job_lock, irqflags); in vc4_job_handle_completed()
1028 struct vc4_dev *vc4 = to_vc4_dev(dev); in vc4_queue_seqno_cb() local
1035 spin_lock_irqsave(&vc4->job_lock, irqflags); in vc4_queue_seqno_cb()
1036 if (seqno > vc4->finished_seqno) { in vc4_queue_seqno_cb()
1038 list_add_tail(&cb->work.entry, &vc4->seqno_cb_list); in vc4_queue_seqno_cb()
1042 spin_unlock_irqrestore(&vc4->job_lock, irqflags); in vc4_queue_seqno_cb()
1054 struct vc4_dev *vc4 = in vc4_job_done_work() local
1057 vc4_job_handle_completed(vc4); in vc4_job_done_work()
1115 * vc4_submit_cl_ioctl() - Submits a job (frame) to the VC4.
1130 struct vc4_dev *vc4 = to_vc4_dev(dev); in vc4_submit_cl_ioctl() local
1139 if (!vc4->v3d) { in vc4_submit_cl_ioctl()
1140 DRM_DEBUG("VC4_SUBMIT_CL with no VC4 V3D probed\n"); in vc4_submit_cl_ioctl()
1163 ret = vc4_v3d_pm_get(vc4); in vc4_submit_cl_ioctl()
1197 vc4->dma_fence_context)) { in vc4_submit_cl_ioctl()
1256 args->seqno = vc4->emit_seqno; in vc4_submit_cl_ioctl()
1261 vc4_complete_exec(&vc4->base, exec); in vc4_submit_cl_ioctl()
1269 struct vc4_dev *vc4 = to_vc4_dev(dev); in vc4_gem_init() local
1271 vc4->dma_fence_context = dma_fence_context_alloc(1); in vc4_gem_init()
1273 INIT_LIST_HEAD(&vc4->bin_job_list); in vc4_gem_init()
1274 INIT_LIST_HEAD(&vc4->render_job_list); in vc4_gem_init()
1275 INIT_LIST_HEAD(&vc4->job_done_list); in vc4_gem_init()
1276 INIT_LIST_HEAD(&vc4->seqno_cb_list); in vc4_gem_init()
1277 spin_lock_init(&vc4->job_lock); in vc4_gem_init()
1279 INIT_WORK(&vc4->hangcheck.reset_work, vc4_reset_work); in vc4_gem_init()
1280 timer_setup(&vc4->hangcheck.timer, vc4_hangcheck_elapsed, 0); in vc4_gem_init()
1282 INIT_WORK(&vc4->job_done_work, vc4_job_done_work); in vc4_gem_init()
1284 mutex_init(&vc4->power_lock); in vc4_gem_init()
1286 INIT_LIST_HEAD(&vc4->purgeable.list); in vc4_gem_init()
1287 mutex_init(&vc4->purgeable.lock); in vc4_gem_init()
1294 struct vc4_dev *vc4 = to_vc4_dev(dev); in vc4_gem_destroy() local
1299 WARN_ON(vc4->emit_seqno != vc4->finished_seqno); in vc4_gem_destroy()
1304 if (vc4->bin_bo) { in vc4_gem_destroy()
1305 drm_gem_object_put(&vc4->bin_bo->base.base); in vc4_gem_destroy()
1306 vc4->bin_bo = NULL; in vc4_gem_destroy()
1309 if (vc4->hang_state) in vc4_gem_destroy()
1310 vc4_free_hang_state(dev, vc4->hang_state); in vc4_gem_destroy()