Lines Matching refs:blitq
315 drm_via_blitq_t *blitq = dev_priv->blit_queues + engine; in via_dmablit_handler() local
322 engine, from_irq, (unsigned long) blitq); in via_dmablit_handler()
325 spin_lock(&blitq->blit_lock); in via_dmablit_handler()
327 spin_lock_irqsave(&blitq->blit_lock, irqsave); in via_dmablit_handler()
329 done_transfer = blitq->is_active && in via_dmablit_handler()
331 done_transfer = done_transfer || (blitq->aborting && !(status & VIA_DMA_CSR_DE)); in via_dmablit_handler()
333 cur = blitq->cur; in via_dmablit_handler()
336 blitq->blits[cur]->aborted = blitq->aborting; in via_dmablit_handler()
337 blitq->done_blit_handle++; in via_dmablit_handler()
338 wake_up(blitq->blit_queue + cur); in via_dmablit_handler()
343 blitq->cur = cur; in via_dmablit_handler()
351 blitq->is_active = 0; in via_dmablit_handler()
352 blitq->aborting = 0; in via_dmablit_handler()
353 schedule_work(&blitq->wq); in via_dmablit_handler()
355 } else if (blitq->is_active && time_after_eq(jiffies, blitq->end)) { in via_dmablit_handler()
362 blitq->aborting = 1; in via_dmablit_handler()
363 blitq->end = jiffies + HZ; in via_dmablit_handler()
366 if (!blitq->is_active) { in via_dmablit_handler()
367 if (blitq->num_outstanding) { in via_dmablit_handler()
368 via_fire_dmablit(dev, blitq->blits[cur], engine); in via_dmablit_handler()
369 blitq->is_active = 1; in via_dmablit_handler()
370 blitq->cur = cur; in via_dmablit_handler()
371 blitq->num_outstanding--; in via_dmablit_handler()
372 blitq->end = jiffies + HZ; in via_dmablit_handler()
373 if (!timer_pending(&blitq->poll_timer)) in via_dmablit_handler()
374 mod_timer(&blitq->poll_timer, jiffies + 1); in via_dmablit_handler()
376 if (timer_pending(&blitq->poll_timer)) in via_dmablit_handler()
377 del_timer(&blitq->poll_timer); in via_dmablit_handler()
383 spin_unlock(&blitq->blit_lock); in via_dmablit_handler()
385 spin_unlock_irqrestore(&blitq->blit_lock, irqsave); in via_dmablit_handler()
395 via_dmablit_active(drm_via_blitq_t *blitq, int engine, uint32_t handle, wait_queue_head_t **queue) in via_dmablit_active() argument
401 spin_lock_irqsave(&blitq->blit_lock, irqsave); in via_dmablit_active()
407 active = ((blitq->done_blit_handle - handle) > (1 << 23)) && in via_dmablit_active()
408 ((blitq->cur_blit_handle - handle) <= (1 << 23)); in via_dmablit_active()
411 slot = handle - blitq->done_blit_handle + blitq->cur - 1; in via_dmablit_active()
414 *queue = blitq->blit_queue + slot; in via_dmablit_active()
417 spin_unlock_irqrestore(&blitq->blit_lock, irqsave); in via_dmablit_active()
431 drm_via_blitq_t *blitq = dev_priv->blit_queues + engine; in via_dmablit_sync() local
435 if (via_dmablit_active(blitq, engine, handle, &queue)) { in via_dmablit_sync()
437 !via_dmablit_active(blitq, engine, handle, NULL)); in via_dmablit_sync()
459 drm_via_blitq_t *blitq = from_timer(blitq, t, poll_timer); in via_dmablit_timer() local
460 struct drm_device *dev = blitq->dev; in via_dmablit_timer()
462 (blitq - ((drm_via_private_t *)dev->dev_private)->blit_queues); in via_dmablit_timer()
469 if (!timer_pending(&blitq->poll_timer)) { in via_dmablit_timer()
470 mod_timer(&blitq->poll_timer, jiffies + 1); in via_dmablit_timer()
495 drm_via_blitq_t *blitq = container_of(work, drm_via_blitq_t, wq); in via_dmablit_workqueue() local
496 struct drm_device *dev = blitq->dev; in via_dmablit_workqueue()
503 (blitq - ((drm_via_private_t *)dev->dev_private)->blit_queues)); in via_dmablit_workqueue()
505 spin_lock_irqsave(&blitq->blit_lock, irqsave); in via_dmablit_workqueue()
507 while (blitq->serviced != blitq->cur) { in via_dmablit_workqueue()
509 cur_released = blitq->serviced++; in via_dmablit_workqueue()
513 if (blitq->serviced >= VIA_NUM_BLIT_SLOTS) in via_dmablit_workqueue()
514 blitq->serviced = 0; in via_dmablit_workqueue()
516 cur_sg = blitq->blits[cur_released]; in via_dmablit_workqueue()
517 blitq->num_free++; in via_dmablit_workqueue()
519 spin_unlock_irqrestore(&blitq->blit_lock, irqsave); in via_dmablit_workqueue()
521 wake_up(&blitq->busy_queue); in via_dmablit_workqueue()
526 spin_lock_irqsave(&blitq->blit_lock, irqsave); in via_dmablit_workqueue()
529 spin_unlock_irqrestore(&blitq->blit_lock, irqsave); in via_dmablit_workqueue()
543 drm_via_blitq_t *blitq; in via_init_dmablit() local
548 blitq = dev_priv->blit_queues + i; in via_init_dmablit()
549 blitq->dev = dev; in via_init_dmablit()
550 blitq->cur_blit_handle = 0; in via_init_dmablit()
551 blitq->done_blit_handle = 0; in via_init_dmablit()
552 blitq->head = 0; in via_init_dmablit()
553 blitq->cur = 0; in via_init_dmablit()
554 blitq->serviced = 0; in via_init_dmablit()
555 blitq->num_free = VIA_NUM_BLIT_SLOTS - 1; in via_init_dmablit()
556 blitq->num_outstanding = 0; in via_init_dmablit()
557 blitq->is_active = 0; in via_init_dmablit()
558 blitq->aborting = 0; in via_init_dmablit()
559 spin_lock_init(&blitq->blit_lock); in via_init_dmablit()
561 init_waitqueue_head(blitq->blit_queue + j); in via_init_dmablit()
562 init_waitqueue_head(&blitq->busy_queue); in via_init_dmablit()
563 INIT_WORK(&blitq->wq, via_dmablit_workqueue); in via_init_dmablit()
564 timer_setup(&blitq->poll_timer, via_dmablit_timer, 0); in via_init_dmablit()
677 via_dmablit_grab_slot(drm_via_blitq_t *blitq, int engine) in via_dmablit_grab_slot() argument
682 DRM_DEBUG("Num free is %d\n", blitq->num_free); in via_dmablit_grab_slot()
683 spin_lock_irqsave(&blitq->blit_lock, irqsave); in via_dmablit_grab_slot()
684 while (blitq->num_free == 0) { in via_dmablit_grab_slot()
685 spin_unlock_irqrestore(&blitq->blit_lock, irqsave); in via_dmablit_grab_slot()
687 VIA_WAIT_ON(ret, blitq->busy_queue, HZ, blitq->num_free > 0); in via_dmablit_grab_slot()
691 spin_lock_irqsave(&blitq->blit_lock, irqsave); in via_dmablit_grab_slot()
694 blitq->num_free--; in via_dmablit_grab_slot()
695 spin_unlock_irqrestore(&blitq->blit_lock, irqsave); in via_dmablit_grab_slot()
705 via_dmablit_release_slot(drm_via_blitq_t *blitq) in via_dmablit_release_slot() argument
709 spin_lock_irqsave(&blitq->blit_lock, irqsave); in via_dmablit_release_slot()
710 blitq->num_free++; in via_dmablit_release_slot()
711 spin_unlock_irqrestore(&blitq->blit_lock, irqsave); in via_dmablit_release_slot()
712 wake_up(&blitq->busy_queue); in via_dmablit_release_slot()
725 drm_via_blitq_t *blitq; in via_dmablit() local
736 blitq = dev_priv->blit_queues + engine; in via_dmablit()
737 if (0 != (ret = via_dmablit_grab_slot(blitq, engine))) in via_dmablit()
740 via_dmablit_release_slot(blitq); in via_dmablit()
744 via_dmablit_release_slot(blitq); in via_dmablit()
748 spin_lock_irqsave(&blitq->blit_lock, irqsave); in via_dmablit()
750 blitq->blits[blitq->head++] = vsg; in via_dmablit()
751 if (blitq->head >= VIA_NUM_BLIT_SLOTS) in via_dmablit()
752 blitq->head = 0; in via_dmablit()
753 blitq->num_outstanding++; in via_dmablit()
754 xfer->sync.sync_handle = ++blitq->cur_blit_handle; in via_dmablit()
756 spin_unlock_irqrestore(&blitq->blit_lock, irqsave); in via_dmablit()