tgsi_texture_names[tgsi_tex_target]);
}
-static void
-null_constant_buffer(struct pipe_context *ctx)
+void
+util_test_constant_buffer(struct pipe_context *ctx,
+ struct pipe_resource *constbuf)
{
struct cso_context *cso;
struct pipe_resource *cb;
PIPE_FORMAT_R8G8B8A8_UNORM);
util_set_common_states_and_clear(cso, ctx, cb);
- ctx->set_constant_buffer(ctx, PIPE_SHADER_FRAGMENT, 0, NULL);
+ pipe_set_constant_buffer(ctx, PIPE_SHADER_FRAGMENT, 0, constbuf);
/* Fragment shader. */
{
tgsi_vs_window_space_position(ctx);
null_sampler_view(ctx, TGSI_TEXTURE_2D);
null_sampler_view(ctx, TGSI_TEXTURE_BUFFER);
- null_constant_buffer(ctx);
+ util_test_constant_buffer(ctx, NULL);
ctx->destroy(ctx);
{ "nooptvariant", DBG_NO_OPT_VARIANT, "Disable compiling optimized shader variants." },
{ "testdma", DBG_TEST_DMA, "Invoke SDMA tests and exit." },
+ { "testvmfaultcp", DBG_TEST_VMFAULT_CP, "Invoke a CP VM fault test and exit." },
+ { "testvmfaultsdma", DBG_TEST_VMFAULT_SDMA, "Invoke a SDMA VM fault test and exit." },
+ { "testvmfaultshader", DBG_TEST_VMFAULT_SHADER, "Invoke a shader VM fault test and exit." },
/* features */
{ "nodma", DBG_NO_ASYNC_DMA, "Disable asynchronous DMA" },
#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"
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);
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;
}