aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/radeon/r600_pipe_common.c
diff options
context:
space:
mode:
authorNicolai Hähnle <[email protected]>2016-06-20 17:19:28 +0200
committerNicolai Hähnle <[email protected]>2016-06-24 12:36:03 +0200
commitd46a9db840b8f82c079a6610723e8a6c519c46cd (patch)
treed2b48928e991f3d5264c5576a22b343e0c0c420e /src/gallium/drivers/radeon/r600_pipe_common.c
parent80dd7870fe87969e97045ea71b1f6e8180ac9606 (diff)
radeon: check VM faults from DMA flush
Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/gallium/drivers/radeon/r600_pipe_common.c')
-rw-r--r--src/gallium/drivers/radeon/r600_pipe_common.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c
index 289fb364963..8b6f3ab58cd 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.c
+++ b/src/gallium/drivers/radeon/r600_pipe_common.c
@@ -295,11 +295,33 @@ static void r600_flush_dma_ring(void *ctx, unsigned flags,
{
struct r600_common_context *rctx = (struct r600_common_context *)ctx;
struct radeon_winsys_cs *cs = rctx->dma.cs;
+ struct radeon_saved_cs saved;
+ bool check_vm =
+ (rctx->screen->debug_flags & DBG_CHECK_VM) &&
+ rctx->check_vm_faults;
+
+ if (!radeon_emitted(cs, 0)) {
+ if (fence)
+ rctx->ws->fence_reference(fence, rctx->last_sdma_fence);
+ return;
+ }
- if (radeon_emitted(cs, 0))
- rctx->ws->cs_flush(cs, flags, &rctx->last_sdma_fence);
+ if (check_vm)
+ radeon_save_cs(rctx->ws, cs, &saved);
+
+ rctx->ws->cs_flush(cs, flags, &rctx->last_sdma_fence);
if (fence)
rctx->ws->fence_reference(fence, rctx->last_sdma_fence);
+
+ if (check_vm) {
+ /* Use conservative timeout 800ms, after which we won't wait any
+ * longer and assume the GPU is hung.
+ */
+ rctx->ws->fence_wait(rctx->ws, rctx->last_sdma_fence, 800*1000*1000);
+
+ rctx->check_vm_faults(rctx, &saved, RING_DMA);
+ radeon_clear_saved_cs(&saved);
+ }
}
/**