提交 7c5ee536 编写于 作者: M Matthew Garrett 提交者: Dave Airlie

ttm: Provide an API for starting and stopping the delayed workqueue

We want to be able to prevent the delayed workqueue from changing state
while we're reclocking, so add an API to block and unblock it.
Signed-off-by: NMatthew Garrett <mjg@redhat.com>
Signed-off-by: NDave Airlie <airlied@redhat.com>
上级 8f5b5e63
...@@ -604,6 +604,20 @@ void ttm_bo_unref(struct ttm_buffer_object **p_bo) ...@@ -604,6 +604,20 @@ void ttm_bo_unref(struct ttm_buffer_object **p_bo)
} }
EXPORT_SYMBOL(ttm_bo_unref); EXPORT_SYMBOL(ttm_bo_unref);
int ttm_bo_lock_delayed_workqueue(struct ttm_bo_device *bdev)
{
return cancel_delayed_work_sync(&bdev->wq);
}
EXPORT_SYMBOL(ttm_bo_lock_delayed_workqueue);
void ttm_bo_unlock_delayed_workqueue(struct ttm_bo_device *bdev, int resched)
{
if (resched)
schedule_delayed_work(&bdev->wq,
((HZ / 100) < 1) ? 1 : HZ / 100);
}
EXPORT_SYMBOL(ttm_bo_unlock_delayed_workqueue);
static int ttm_bo_evict(struct ttm_buffer_object *bo, bool interruptible, static int ttm_bo_evict(struct ttm_buffer_object *bo, bool interruptible,
bool no_wait_reserve, bool no_wait_gpu) bool no_wait_reserve, bool no_wait_gpu)
{ {
......
...@@ -361,6 +361,23 @@ extern int ttm_bo_validate(struct ttm_buffer_object *bo, ...@@ -361,6 +361,23 @@ extern int ttm_bo_validate(struct ttm_buffer_object *bo,
*/ */
extern void ttm_bo_unref(struct ttm_buffer_object **bo); extern void ttm_bo_unref(struct ttm_buffer_object **bo);
/**
* ttm_bo_lock_delayed_workqueue
*
* Prevent the delayed workqueue from running.
* Returns
* True if the workqueue was queued at the time
*/
extern int ttm_bo_lock_delayed_workqueue(struct ttm_bo_device *bdev);
/**
* ttm_bo_unlock_delayed_workqueue
*
* Allows the delayed workqueue to run.
*/
extern void ttm_bo_unlock_delayed_workqueue(struct ttm_bo_device *bdev,
int resched);
/** /**
* ttm_bo_synccpu_write_grab * ttm_bo_synccpu_write_grab
* *
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册