Commit 0352029e authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau: support synchronous pushbuf submission

This is useful for debugging GPU hangs.
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent ea13e5ab
...@@ -688,7 +688,7 @@ nouveau_gem_ioctl_pushbuf(struct drm_device *dev, void *data, ...@@ -688,7 +688,7 @@ nouveau_gem_ioctl_pushbuf(struct drm_device *dev, void *data,
struct validate_op op; struct validate_op op;
struct nouveau_fence *fence = NULL; struct nouveau_fence *fence = NULL;
int i, j, ret = 0; int i, j, ret = 0;
bool do_reloc = false; bool do_reloc = false, sync = false;
if (unlikely(!abi16)) if (unlikely(!abi16))
return -ENOMEM; return -ENOMEM;
...@@ -705,6 +705,8 @@ nouveau_gem_ioctl_pushbuf(struct drm_device *dev, void *data, ...@@ -705,6 +705,8 @@ nouveau_gem_ioctl_pushbuf(struct drm_device *dev, void *data,
if (unlikely(atomic_read(&chan->killed))) if (unlikely(atomic_read(&chan->killed)))
return nouveau_abi16_put(abi16, -ENODEV); return nouveau_abi16_put(abi16, -ENODEV);
sync = req->vram_available & NOUVEAU_GEM_PUSHBUF_SYNC;
req->vram_available = drm->gem.vram_available; req->vram_available = drm->gem.vram_available;
req->gart_available = drm->gem.gart_available; req->gart_available = drm->gem.gart_available;
if (unlikely(req->nr_push == 0)) if (unlikely(req->nr_push == 0))
...@@ -852,6 +854,13 @@ nouveau_gem_ioctl_pushbuf(struct drm_device *dev, void *data, ...@@ -852,6 +854,13 @@ nouveau_gem_ioctl_pushbuf(struct drm_device *dev, void *data,
goto out; goto out;
} }
if (sync) {
if (!(ret = nouveau_fence_wait(fence, false, false))) {
if ((ret = dma_fence_get_status(&fence->base)) == 1)
ret = 0;
}
}
out: out:
validate_fini(&op, chan, fence, bo); validate_fini(&op, chan, fence, bo);
nouveau_fence_unref(&fence); nouveau_fence_unref(&fence);
......
...@@ -110,6 +110,7 @@ struct drm_nouveau_gem_pushbuf { ...@@ -110,6 +110,7 @@ struct drm_nouveau_gem_pushbuf {
__u64 push; __u64 push;
__u32 suffix0; __u32 suffix0;
__u32 suffix1; __u32 suffix1;
#define NOUVEAU_GEM_PUSHBUF_SYNC (1ULL << 0)
__u64 vram_available; __u64 vram_available;
__u64 gart_available; __u64 gart_available;
}; };
......
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