Commit 5a838e5d authored by Gerd Hoffmann's avatar Gerd Hoffmann

drm/qxl: simplify qxl_fence_wait

Now that we have the new release_event wait queue we can just
use that in qxl_fence_wait() and simplify the code a lot.
Signed-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
Acked-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
Link: http://patchwork.freedesktop.org/patch/msgid/20210204145712.1531203-10-kraxel@redhat.com
parent 5f6c871f
...@@ -58,55 +58,19 @@ static long qxl_fence_wait(struct dma_fence *fence, bool intr, ...@@ -58,55 +58,19 @@ static long qxl_fence_wait(struct dma_fence *fence, bool intr,
signed long timeout) signed long timeout)
{ {
struct qxl_device *qdev; struct qxl_device *qdev;
struct qxl_release *release;
int count = 0, sc = 0;
bool have_drawable_releases;
unsigned long cur, end = jiffies + timeout; unsigned long cur, end = jiffies + timeout;
qdev = container_of(fence->lock, struct qxl_device, release_lock); qdev = container_of(fence->lock, struct qxl_device, release_lock);
release = container_of(fence, struct qxl_release, base);
have_drawable_releases = release->type == QXL_RELEASE_DRAWABLE;
retry:
sc++;
if (dma_fence_is_signaled(fence)) if (dma_fence_is_signaled(fence))
goto signaled; goto signaled;
qxl_io_notify_oom(qdev); qxl_io_notify_oom(qdev);
if (!wait_event_timeout(qdev->release_event,
for (count = 0; count < 11; count++) { dma_fence_is_signaled(fence),
if (!qxl_queue_garbage_collect(qdev, true)) timeout))
break;
if (dma_fence_is_signaled(fence))
goto signaled;
}
if (dma_fence_is_signaled(fence))
goto signaled;
if (have_drawable_releases || sc < 4) {
if (sc > 2)
/* back off */
usleep_range(500, 1000);
if (time_after(jiffies, end))
return 0; return 0;
if (have_drawable_releases && sc > 300) {
DMA_FENCE_WARN(fence, "failed to wait on release %llu "
"after spincount %d\n",
fence->context & ~0xf0000000, sc);
goto signaled;
}
goto retry;
}
/*
* yeah, original sync_obj_wait gave up after 3 spins when
* have_drawable_releases is not set.
*/
signaled: signaled:
cur = jiffies; cur = jiffies;
if (time_after(cur, end)) if (time_after(cur, end))
......
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