pan/bit: Add verbose printing for tests
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Wed, 1 Apr 2020 20:45:09 +0000 (16:45 -0400)
committerMarge Bot <eric+marge@anholt.net>
Sun, 5 Apr 2020 23:26:04 +0000 (23:26 +0000)
We'd like to dump both the generated IR (so we know exactly what's being
tested) as well as the compiled program (so we know what's running for
comparison).

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4458>

src/panfrost/bifrost/test/bi_test_pack.c

index c693f8509f56e0e0e7bf6c337a7e6996786d5661..36e392602f5a3d86fd1cbd72db2c2e47f409773e 100644 (file)
@@ -26,6 +26,8 @@
 
 #include "bit.h"
 #include "bi_print.h"
+#include "util/half_float.h"
+#include "bifrost/disassemble.h"
 
 /* Instruction packing tests */
 
@@ -142,8 +144,15 @@ bit_test_single(struct panfrost_device *dev,
         panfrost_program prog;
         bi_pack(ctx, &prog.compiled);
 
-        return bit_vertex(dev, prog, input, 16, NULL, 0,
+        bool succ = bit_vertex(dev, prog, input, 16, NULL, 0,
                         s.r, 16, debug);
+
+        if (debug >= BIT_DEBUG_ALL || (!succ && debug >= BIT_DEBUG_FAIL)) {
+                bi_print_shader(ctx, stderr);
+                disassemble_bifrost(stderr, prog.compiled.data, prog.compiled.size, true);
+        }
+
+        return succ;
 }
 
 /* Utilities for generating tests */