Lines Matching full:fman
126 struct vmw_fence_manager *fman = fman_from_fence(fence); in vmw_fence_obj_destroy() local
129 spin_lock(&fman->lock); in vmw_fence_obj_destroy()
131 spin_unlock(&fman->lock); in vmw_fence_obj_destroy()
151 struct vmw_fence_manager *fman = fman_from_fence(fence); in vmw_fence_enable_signaling() local
152 struct vmw_private *dev_priv = fman->dev_priv; in vmw_fence_enable_signaling()
175 static void __vmw_fences_update(struct vmw_fence_manager *fman);
182 struct vmw_fence_manager *fman = fman_from_fence(fence); in vmw_fence_wait() local
183 struct vmw_private *dev_priv = fman->dev_priv; in vmw_fence_wait()
207 __vmw_fences_update(fman); in vmw_fence_wait()
267 struct vmw_fence_manager *fman = in vmw_fence_work_func() local
275 mutex_lock(&fman->goal_irq_mutex); in vmw_fence_work_func()
277 spin_lock(&fman->lock); in vmw_fence_work_func()
278 list_splice_init(&fman->cleanup_list, &list); in vmw_fence_work_func()
279 seqno_valid = fman->seqno_valid; in vmw_fence_work_func()
280 spin_unlock(&fman->lock); in vmw_fence_work_func()
282 if (!seqno_valid && fman->goal_irq_on) { in vmw_fence_work_func()
283 fman->goal_irq_on = false; in vmw_fence_work_func()
284 vmw_goal_waiter_remove(fman->dev_priv); in vmw_fence_work_func()
286 mutex_unlock(&fman->goal_irq_mutex); in vmw_fence_work_func()
294 * hence fman::lock not held. in vmw_fence_work_func()
307 struct vmw_fence_manager *fman = kzalloc(sizeof(*fman), GFP_KERNEL); in vmw_fence_manager_init() local
309 if (unlikely(!fman)) in vmw_fence_manager_init()
312 fman->dev_priv = dev_priv; in vmw_fence_manager_init()
313 spin_lock_init(&fman->lock); in vmw_fence_manager_init()
314 INIT_LIST_HEAD(&fman->fence_list); in vmw_fence_manager_init()
315 INIT_LIST_HEAD(&fman->cleanup_list); in vmw_fence_manager_init()
316 INIT_WORK(&fman->work, &vmw_fence_work_func); in vmw_fence_manager_init()
317 fman->fifo_down = true; in vmw_fence_manager_init()
318 mutex_init(&fman->goal_irq_mutex); in vmw_fence_manager_init()
319 fman->ctx = dma_fence_context_alloc(1); in vmw_fence_manager_init()
321 return fman; in vmw_fence_manager_init()
324 void vmw_fence_manager_takedown(struct vmw_fence_manager *fman) in vmw_fence_manager_takedown() argument
328 (void) cancel_work_sync(&fman->work); in vmw_fence_manager_takedown()
330 spin_lock(&fman->lock); in vmw_fence_manager_takedown()
331 lists_empty = list_empty(&fman->fence_list) && in vmw_fence_manager_takedown()
332 list_empty(&fman->cleanup_list); in vmw_fence_manager_takedown()
333 spin_unlock(&fman->lock); in vmw_fence_manager_takedown()
336 kfree(fman); in vmw_fence_manager_takedown()
339 static int vmw_fence_obj_init(struct vmw_fence_manager *fman, in vmw_fence_obj_init() argument
345 dma_fence_init(&fence->base, &vmw_fence_ops, &fman->lock, in vmw_fence_obj_init()
346 fman->ctx, seqno); in vmw_fence_obj_init()
350 spin_lock(&fman->lock); in vmw_fence_obj_init()
351 if (unlikely(fman->fifo_down)) { in vmw_fence_obj_init()
355 list_add_tail(&fence->head, &fman->fence_list); in vmw_fence_obj_init()
358 spin_unlock(&fman->lock); in vmw_fence_obj_init()
363 static void vmw_fences_perform_actions(struct vmw_fence_manager *fman, in vmw_fences_perform_actions() argument
370 fman->pending_actions[action->type]--; in vmw_fences_perform_actions()
379 list_add_tail(&action->head, &fman->cleanup_list); in vmw_fences_perform_actions()
387 * @fman: Pointer to a fence manager.
399 static bool vmw_fence_goal_new_locked(struct vmw_fence_manager *fman, in vmw_fence_goal_new_locked() argument
405 if (likely(!fman->seqno_valid)) in vmw_fence_goal_new_locked()
408 goal_seqno = vmw_fence_goal_read(fman->dev_priv); in vmw_fence_goal_new_locked()
412 fman->seqno_valid = false; in vmw_fence_goal_new_locked()
413 list_for_each_entry_safe(fence, next_fence, &fman->fence_list, head) { in vmw_fence_goal_new_locked()
415 fman->seqno_valid = true; in vmw_fence_goal_new_locked()
416 vmw_fence_goal_write(fman->dev_priv, in vmw_fence_goal_new_locked()
443 struct vmw_fence_manager *fman = fman_from_fence(fence); in vmw_fence_goal_check_locked() local
449 goal_seqno = vmw_fence_goal_read(fman->dev_priv); in vmw_fence_goal_check_locked()
450 if (likely(fman->seqno_valid && in vmw_fence_goal_check_locked()
454 vmw_fence_goal_write(fman->dev_priv, fence->base.seqno); in vmw_fence_goal_check_locked()
455 fman->seqno_valid = true; in vmw_fence_goal_check_locked()
460 static void __vmw_fences_update(struct vmw_fence_manager *fman) in __vmw_fences_update() argument
467 seqno = vmw_fence_read(fman->dev_priv); in __vmw_fences_update()
469 list_for_each_entry_safe(fence, next_fence, &fman->fence_list, head) { in __vmw_fences_update()
476 vmw_fences_perform_actions(fman, &action_list); in __vmw_fences_update()
487 needs_rerun = vmw_fence_goal_new_locked(fman, seqno); in __vmw_fences_update()
489 new_seqno = vmw_fence_read(fman->dev_priv); in __vmw_fences_update()
496 if (!list_empty(&fman->cleanup_list)) in __vmw_fences_update()
497 (void) schedule_work(&fman->work); in __vmw_fences_update()
500 void vmw_fences_update(struct vmw_fence_manager *fman) in vmw_fences_update() argument
502 spin_lock(&fman->lock); in vmw_fences_update()
503 __vmw_fences_update(fman); in vmw_fences_update()
504 spin_unlock(&fman->lock); in vmw_fences_update()
509 struct vmw_fence_manager *fman = fman_from_fence(fence); in vmw_fence_obj_signaled() local
514 vmw_fences_update(fman); in vmw_fence_obj_signaled()
537 int vmw_fence_create(struct vmw_fence_manager *fman, in vmw_fence_create() argument
548 ret = vmw_fence_obj_init(fman, fence, seqno, in vmw_fence_create()
582 struct vmw_fence_manager *fman, in vmw_user_fence_create() argument
598 ret = vmw_fence_obj_init(fman, &ufence->fence, seqno, in vmw_user_fence_create()
639 void vmw_fence_fifo_down(struct vmw_fence_manager *fman) in vmw_fence_fifo_down() argument
646 * restart when we've released the fman->lock. in vmw_fence_fifo_down()
649 spin_lock(&fman->lock); in vmw_fence_fifo_down()
650 fman->fifo_down = true; in vmw_fence_fifo_down()
651 while (!list_empty(&fman->fence_list)) { in vmw_fence_fifo_down()
653 list_entry(fman->fence_list.prev, struct vmw_fence_obj, in vmw_fence_fifo_down()
656 spin_unlock(&fman->lock); in vmw_fence_fifo_down()
667 vmw_fences_perform_actions(fman, &action_list); in vmw_fence_fifo_down()
672 spin_lock(&fman->lock); in vmw_fence_fifo_down()
674 spin_unlock(&fman->lock); in vmw_fence_fifo_down()
677 void vmw_fence_fifo_up(struct vmw_fence_manager *fman) in vmw_fence_fifo_up() argument
679 spin_lock(&fman->lock); in vmw_fence_fifo_up()
680 fman->fifo_down = false; in vmw_fence_fifo_up()
681 spin_unlock(&fman->lock); in vmw_fence_fifo_up()
781 struct vmw_fence_manager *fman; in vmw_fence_obj_signaled_ioctl() local
790 fman = fman_from_fence(fence); in vmw_fence_obj_signaled_ioctl()
795 spin_lock(&fman->lock); in vmw_fence_obj_signaled_ioctl()
797 spin_unlock(&fman->lock); in vmw_fence_obj_signaled_ioctl()
882 struct vmw_fence_manager *fman = fman_from_fence(fence); in vmw_fence_obj_add_action() local
885 mutex_lock(&fman->goal_irq_mutex); in vmw_fence_obj_add_action()
886 spin_lock(&fman->lock); in vmw_fence_obj_add_action()
888 fman->pending_actions[action->type]++; in vmw_fence_obj_add_action()
894 vmw_fences_perform_actions(fman, &action_list); in vmw_fence_obj_add_action()
899 * This function may set fman::seqno_valid, so it must in vmw_fence_obj_add_action()
905 spin_unlock(&fman->lock); in vmw_fence_obj_add_action()
908 if (!fman->goal_irq_on) { in vmw_fence_obj_add_action()
909 fman->goal_irq_on = true; in vmw_fence_obj_add_action()
910 vmw_goal_waiter_add(fman->dev_priv); in vmw_fence_obj_add_action()
912 vmw_fences_update(fman); in vmw_fence_obj_add_action()
914 mutex_unlock(&fman->goal_irq_mutex); in vmw_fence_obj_add_action()
945 struct vmw_fence_manager *fman = fman_from_fence(fence); in vmw_event_fence_action_queue() local
958 eaction->dev = &fman->dev_priv->drm; in vmw_event_fence_action_queue()
979 struct vmw_fence_manager *fman = fman_from_fence(fence); in vmw_event_fence_action_create() local
980 struct drm_device *dev = &fman->dev_priv->drm; in vmw_event_fence_action_create()