summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/radeonsi/si_pipe.c
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2017-03-27 16:53:19 +0200
committerMarek Olšák <[email protected]>2017-03-31 21:41:57 +0200
commit322eb13f09e0bce7cf6ee92b6b036a1490630ce5 (patch)
tree2c57f8ae7380eb60c52f57f95b097d47f8a9b03d /src/gallium/drivers/radeonsi/si_pipe.c
parent283c31afa168921e9b8531a9bdd20bc0adc6caf2 (diff)
radeonsi: add tests verifying that VM faults don't hang
GFX9 hangs instead of writing VM faults to dmesg. Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/gallium/drivers/radeonsi/si_pipe.c')
-rw-r--r--src/gallium/drivers/radeonsi/si_pipe.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c
index 1ac5fe5c351..19c9a1710f7 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.c
+++ b/src/gallium/drivers/radeonsi/si_pipe.c
@@ -29,6 +29,7 @@
#include "radeon/radeon_uvd.h"
#include "util/u_memory.h"
#include "util/u_suballoc.h"
+#include "util/u_tests.h"
#include "vl/vl_decoder.h"
#include "../ddebug/dd_util.h"
@@ -780,6 +781,37 @@ static void si_handle_env_var_force_family(struct si_screen *sscreen)
exit(1);
}
+static void si_test_vmfault(struct si_screen *sscreen)
+{
+ struct pipe_context *ctx = sscreen->b.aux_context;
+ struct si_context *sctx = (struct si_context *)ctx;
+ struct pipe_resource *buf =
+ pipe_buffer_create(&sscreen->b.b, 0, PIPE_USAGE_DEFAULT, 64);
+
+ if (!buf) {
+ puts("Buffer allocation failed.");
+ exit(1);
+ }
+
+ r600_resource(buf)->gpu_address = 0; /* cause a VM fault */
+
+ if (sscreen->b.debug_flags & DBG_TEST_VMFAULT_CP) {
+ si_copy_buffer(sctx, buf, buf, 0, 4, 4, 0);
+ ctx->flush(ctx, NULL, 0);
+ puts("VM fault test: CP - done.");
+ }
+ if (sscreen->b.debug_flags & DBG_TEST_VMFAULT_SDMA) {
+ sctx->b.dma_clear_buffer(ctx, buf, 0, 4, 0);
+ ctx->flush(ctx, NULL, 0);
+ puts("VM fault test: SDMA - done.");
+ }
+ if (sscreen->b.debug_flags & DBG_TEST_VMFAULT_SHADER) {
+ util_test_constant_buffer(ctx, buf);
+ puts("VM fault test: Shader - done.");
+ }
+ exit(0);
+}
+
struct pipe_screen *radeonsi_screen_create(struct radeon_winsys *ws)
{
struct si_screen *sscreen = CALLOC_STRUCT(si_screen);
@@ -886,5 +918,10 @@ struct pipe_screen *radeonsi_screen_create(struct radeon_winsys *ws)
if (sscreen->b.debug_flags & DBG_TEST_DMA)
r600_test_dma(&sscreen->b);
+ if (sscreen->b.debug_flags & (DBG_TEST_VMFAULT_CP |
+ DBG_TEST_VMFAULT_SDMA |
+ DBG_TEST_VMFAULT_SHADER))
+ si_test_vmfault(sscreen);
+
return &sscreen->b.b;
}