Commit 27ce65f6 authored by Dave Airlie's avatar Dave Airlie

Revert "nouveau: rip out busy fence waits"

This reverts commit d45bb9c5.

Just got a report that this causes some suspend/resume issues,
so back it out and I'll investigate it later.
Reported-by: default avatarMike Galbraith <efault@gmx.de>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent 4eb39974
...@@ -898,7 +898,7 @@ nouveau_bo_move_m2mf(struct ttm_buffer_object *bo, int evict, ...@@ -898,7 +898,7 @@ nouveau_bo_move_m2mf(struct ttm_buffer_object *bo, int evict,
* Without this the operation can timeout and we'll fallback to a * Without this the operation can timeout and we'll fallback to a
* software copy, which might take several minutes to finish. * software copy, which might take several minutes to finish.
*/ */
nouveau_fence_wait(fence, false); nouveau_fence_wait(fence, false, false);
ret = ttm_bo_move_accel_cleanup(bo, &fence->base, evict, false, ret = ttm_bo_move_accel_cleanup(bo, &fence->base, evict, false,
new_reg); new_reg);
nouveau_fence_unref(&fence); nouveau_fence_unref(&fence);
......
...@@ -72,7 +72,7 @@ nouveau_channel_idle(struct nouveau_channel *chan) ...@@ -72,7 +72,7 @@ nouveau_channel_idle(struct nouveau_channel *chan)
ret = nouveau_fence_new(&fence, chan); ret = nouveau_fence_new(&fence, chan);
if (!ret) { if (!ret) {
ret = nouveau_fence_wait(fence, false); ret = nouveau_fence_wait(fence, false, false);
nouveau_fence_unref(&fence); nouveau_fence_unref(&fence);
} }
......
...@@ -128,7 +128,7 @@ static void nouveau_dmem_page_free(struct page *page) ...@@ -128,7 +128,7 @@ static void nouveau_dmem_page_free(struct page *page)
static void nouveau_dmem_fence_done(struct nouveau_fence **fence) static void nouveau_dmem_fence_done(struct nouveau_fence **fence)
{ {
if (fence) { if (fence) {
nouveau_fence_wait(*fence, false); nouveau_fence_wait(*fence, true, false);
nouveau_fence_unref(fence); nouveau_fence_unref(fence);
} else { } else {
/* /*
......
...@@ -311,11 +311,39 @@ nouveau_fence_wait_legacy(struct dma_fence *f, bool intr, long wait) ...@@ -311,11 +311,39 @@ nouveau_fence_wait_legacy(struct dma_fence *f, bool intr, long wait)
return timeout - t; return timeout - t;
} }
static int
nouveau_fence_wait_busy(struct nouveau_fence *fence, bool intr)
{
int ret = 0;
while (!nouveau_fence_done(fence)) {
if (time_after_eq(jiffies, fence->timeout)) {
ret = -EBUSY;
break;
}
__set_current_state(intr ?
TASK_INTERRUPTIBLE :
TASK_UNINTERRUPTIBLE);
if (intr && signal_pending(current)) {
ret = -ERESTARTSYS;
break;
}
}
__set_current_state(TASK_RUNNING);
return ret;
}
int int
nouveau_fence_wait(struct nouveau_fence *fence, bool intr) nouveau_fence_wait(struct nouveau_fence *fence, bool lazy, bool intr)
{ {
long ret; long ret;
if (!lazy)
return nouveau_fence_wait_busy(fence, intr);
ret = dma_fence_wait_timeout(&fence->base, intr, 15 * HZ); ret = dma_fence_wait_timeout(&fence->base, intr, 15 * HZ);
if (ret < 0) if (ret < 0)
return ret; return ret;
......
...@@ -23,7 +23,7 @@ void nouveau_fence_unref(struct nouveau_fence **); ...@@ -23,7 +23,7 @@ void nouveau_fence_unref(struct nouveau_fence **);
int nouveau_fence_emit(struct nouveau_fence *); int nouveau_fence_emit(struct nouveau_fence *);
bool nouveau_fence_done(struct nouveau_fence *); bool nouveau_fence_done(struct nouveau_fence *);
int nouveau_fence_wait(struct nouveau_fence *, bool intr); int nouveau_fence_wait(struct nouveau_fence *, bool lazy, bool intr);
int nouveau_fence_sync(struct nouveau_bo *, struct nouveau_channel *, bool exclusive, bool intr); int nouveau_fence_sync(struct nouveau_bo *, struct nouveau_channel *, bool exclusive, bool intr);
struct nouveau_fence_chan { struct nouveau_fence_chan {
......
...@@ -928,7 +928,7 @@ nouveau_gem_ioctl_pushbuf(struct drm_device *dev, void *data, ...@@ -928,7 +928,7 @@ nouveau_gem_ioctl_pushbuf(struct drm_device *dev, void *data,
} }
if (sync) { if (sync) {
if (!(ret = nouveau_fence_wait(fence, false))) { if (!(ret = nouveau_fence_wait(fence, false, false))) {
if ((ret = dma_fence_get_status(&fence->base)) == 1) if ((ret = dma_fence_get_status(&fence->base)) == 1)
ret = 0; ret = 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment