Skip to content

Commit 0352029

Browse files
author
Ben Skeggs
committed
drm/nouveau: support synchronous pushbuf submission
This is useful for debugging GPU hangs. Signed-off-by: Ben Skeggs <[email protected]>
1 parent ea13e5a commit 0352029

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

drivers/gpu/drm/nouveau/nouveau_gem.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,7 @@ nouveau_gem_ioctl_pushbuf(struct drm_device *dev, void *data,
688688
struct validate_op op;
689689
struct nouveau_fence *fence = NULL;
690690
int i, j, ret = 0;
691-
bool do_reloc = false;
691+
bool do_reloc = false, sync = false;
692692

693693
if (unlikely(!abi16))
694694
return -ENOMEM;
@@ -705,6 +705,8 @@ nouveau_gem_ioctl_pushbuf(struct drm_device *dev, void *data,
705705
if (unlikely(atomic_read(&chan->killed)))
706706
return nouveau_abi16_put(abi16, -ENODEV);
707707

708+
sync = req->vram_available & NOUVEAU_GEM_PUSHBUF_SYNC;
709+
708710
req->vram_available = drm->gem.vram_available;
709711
req->gart_available = drm->gem.gart_available;
710712
if (unlikely(req->nr_push == 0))
@@ -852,6 +854,13 @@ nouveau_gem_ioctl_pushbuf(struct drm_device *dev, void *data,
852854
goto out;
853855
}
854856

857+
if (sync) {
858+
if (!(ret = nouveau_fence_wait(fence, false, false))) {
859+
if ((ret = dma_fence_get_status(&fence->base)) == 1)
860+
ret = 0;
861+
}
862+
}
863+
855864
out:
856865
validate_fini(&op, chan, fence, bo);
857866
nouveau_fence_unref(&fence);

include/uapi/drm/nouveau_drm.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ struct drm_nouveau_gem_pushbuf {
110110
__u64 push;
111111
__u32 suffix0;
112112
__u32 suffix1;
113+
#define NOUVEAU_GEM_PUSHBUF_SYNC (1ULL << 0)
113114
__u64 vram_available;
114115
__u64 gart_available;
115116
};

0 commit comments

Comments
 (0)