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
#include <drm/drm_mm.h>
#include <drm/drm_global.h>
#include <sys/tree.h>
#include <sys/mutex2.h>
struct ttm_backend_func {
/**
......
* Internal protection.
*/
struct mtx wq_mtx;
struct timeout_task wq;
bool need_dma32;
sys/dev/drm/ttm/ttm_bo.c
driver->sync_obj_flush(sync_obj);
driver->sync_obj_unref(&sync_obj);
}
mtx_lock(&bdev->wq_mtx);
taskqueue_enqueue_timeout(taskqueue_thread[0], &bdev->wq,
((hz / 100) < 1) ? 1 : hz / 100);
mtx_unlock(&bdev->wq_mtx);
}
/**
......
struct ttm_bo_device *bdev = arg;
if (ttm_bo_delayed_delete(bdev, false)) {
mtx_lock(&bdev->wq_mtx);
taskqueue_enqueue_timeout(taskqueue_thread[0], &bdev->wq,
((hz / 100) < 1) ? 1 : hz / 100);
mtx_unlock(&bdev->wq_mtx);
}
}
......
int pending;
taskqueue_cancel_timeout(taskqueue_thread[0], &bdev->wq, &pending);
if (pending)
if (pending) {
taskqueue_drain_timeout(taskqueue_thread[0], &bdev->wq);
}
return (pending);
}
EXPORT_SYMBOL(ttm_bo_lock_delayed_workqueue);
......
void ttm_bo_unlock_delayed_workqueue(struct ttm_bo_device *bdev, int resched)
{
if (resched) {
mtx_lock(&bdev->wq_mtx);
taskqueue_enqueue_timeout(taskqueue_thread[0], &bdev->wq,
((hz / 100) < 1) ? 1 : hz / 100);
mtx_unlock(&bdev->wq_mtx);
}
}
EXPORT_SYMBOL(ttm_bo_unlock_delayed_workqueue);
......
list_del(&bdev->device_list);
lockmgr(&glob->device_list_mutex, LK_RELEASE);
if (taskqueue_cancel_timeout(taskqueue_thread[0], &bdev->wq, NULL))
if (taskqueue_cancel_timeout(taskqueue_thread[0], &bdev->wq, NULL)) {
taskqueue_drain_timeout(taskqueue_thread[0], &bdev->wq);
}
while (ttm_bo_delayed_delete(bdev, true))
;
......
if (unlikely(ret != 0))
goto out_no_addr_mm;
mtx_init(&bdev->wq_mtx);
TIMEOUT_TASK_INIT(taskqueue_thread[0], &bdev->wq, 0,
ttm_bo_delayed_workqueue, bdev);
INIT_LIST_HEAD(&bdev->ddestroy);
(4-4/4)