Project

General

Profile

Bug #2635 » ugly.diff

really ugly hack - yellowrabbit2010, 07/12/2014 08:21 PM

View differences:

sys/dev/drm/include/drm/ttm/ttm_bo_driver.h
37 37
#include <drm/drm_mm.h>
38 38
#include <drm/drm_global.h>
39 39
#include <sys/tree.h>
40
#include <sys/mutex2.h>
40 41

  
41 42
struct ttm_backend_func {
42 43
	/**
......
561 562
	 * Internal protection.
562 563
	 */
563 564

  
565
	struct mtx wq_mtx;
564 566
	struct timeout_task wq;
565 567

  
566 568
	bool need_dma32;
sys/dev/drm/ttm/ttm_bo.c
592 592
		driver->sync_obj_flush(sync_obj);
593 593
		driver->sync_obj_unref(&sync_obj);
594 594
	}
595
	mtx_lock(&bdev->wq_mtx);
595 596
	taskqueue_enqueue_timeout(taskqueue_thread[0], &bdev->wq,
596 597
	    ((hz / 100) < 1) ? 1 : hz / 100);
598
	mtx_unlock(&bdev->wq_mtx);
597 599
}
598 600

  
599 601
/**
......
753 755
	struct ttm_bo_device *bdev = arg;
754 756

  
755 757
	if (ttm_bo_delayed_delete(bdev, false)) {
758
		mtx_lock(&bdev->wq_mtx);
756 759
		taskqueue_enqueue_timeout(taskqueue_thread[0], &bdev->wq,
757 760
		    ((hz / 100) < 1) ? 1 : hz / 100);
761
		mtx_unlock(&bdev->wq_mtx);
758 762
	}
759 763
}
760 764

  
......
819 823
	int pending;
820 824

  
821 825
	taskqueue_cancel_timeout(taskqueue_thread[0], &bdev->wq, &pending);
822
	if (pending)
826
	if (pending) {
823 827
		taskqueue_drain_timeout(taskqueue_thread[0], &bdev->wq);
828
	}
824 829
	return (pending);
825 830
}
826 831
EXPORT_SYMBOL(ttm_bo_lock_delayed_workqueue);
......
828 833
void ttm_bo_unlock_delayed_workqueue(struct ttm_bo_device *bdev, int resched)
829 834
{
830 835
	if (resched) {
836
		mtx_lock(&bdev->wq_mtx);
831 837
		taskqueue_enqueue_timeout(taskqueue_thread[0], &bdev->wq,
832 838
		    ((hz / 100) < 1) ? 1 : hz / 100);
839
		mtx_unlock(&bdev->wq_mtx);
833 840
	}
834 841
}
835 842
EXPORT_SYMBOL(ttm_bo_unlock_delayed_workqueue);
......
1608 1615
	list_del(&bdev->device_list);
1609 1616
	lockmgr(&glob->device_list_mutex, LK_RELEASE);
1610 1617

  
1611
	if (taskqueue_cancel_timeout(taskqueue_thread[0], &bdev->wq, NULL))
1618
	if (taskqueue_cancel_timeout(taskqueue_thread[0], &bdev->wq, NULL)) {
1612 1619
		taskqueue_drain_timeout(taskqueue_thread[0], &bdev->wq);
1620
	}
1613 1621

  
1614 1622
	while (ttm_bo_delayed_delete(bdev, true))
1615 1623
		;
......
1657 1665
	if (unlikely(ret != 0))
1658 1666
		goto out_no_addr_mm;
1659 1667

  
1668
	mtx_init(&bdev->wq_mtx);
1660 1669
	TIMEOUT_TASK_INIT(taskqueue_thread[0], &bdev->wq, 0,
1661 1670
	    ttm_bo_delayed_workqueue, bdev);
1662 1671
	INIT_LIST_HEAD(&bdev->ddestroy);
(4-4/4)