summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Lespiau <damien.lespiau@intel.com>2013-02-27 14:51:29 +0000
committerBen Widawsky <benjamin.widawsky@intel.com>2013-10-18 09:49:41 -0700
commit09e9f0b216dd7ee06b857ce5fd5cc9cb5ca491dc (patch)
treeb62be8dd94f3b392ecef5b703ec5340999994e99
parent5038b7e4c243b4e9d07db34a33c70adbec044370 (diff)
rendercopy: Add a way to dump an .aub file with the rendercopy bos
v2 (by Ben): Remove libdrm dependency since intel-gpu-tools now requires a higher version anyway. Remove associated #ifdef ENABLE_AUB_DUMP Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> Signed-off-by: Ben Widawsky <benjamin.widawsky@intel.com>
-rw-r--r--lib/drmtest.c10
-rw-r--r--lib/drmtest.h2
-rw-r--r--tests/gem_render_linear_blits.c20
3 files changed, 32 insertions, 0 deletions
diff --git a/lib/drmtest.c b/lib/drmtest.c
index 0e65cdd8..efd8fd32 100644
--- a/lib/drmtest.c
+++ b/lib/drmtest.c
@@ -1216,6 +1216,16 @@ void igt_skip_on_simulation(void)
igt_require(!igt_run_in_simulation());
}
+bool drmtest_dump_aub(void)
+{
+ static int dump_aub = -1;
+
+ if (dump_aub == -1)
+ dump_aub = env_set("IGT_DUMP_AUB", false);
+
+ return dump_aub;
+}
+
/* other helpers */
void igt_exchange_int(void *array, unsigned i, unsigned j)
{
diff --git a/lib/drmtest.h b/lib/drmtest.h
index b7909df8..3a3900ef 100644
--- a/lib/drmtest.h
+++ b/lib/drmtest.h
@@ -304,6 +304,8 @@ bool igt_run_in_simulation(void);
*/
void igt_skip_on_simulation(void);
+bool drmtest_dump_aub(void);
+
/* helpers based upon the libdrm buffer manager */
void igt_init_aperture_trashers(drm_intel_bufmgr *bufmgr);
void igt_trash_aperture(void);
diff --git a/tests/gem_render_linear_blits.c b/tests/gem_render_linear_blits.c
index 0c50614c..1cc50b97 100644
--- a/tests/gem_render_linear_blits.c
+++ b/tests/gem_render_linear_blits.c
@@ -33,6 +33,10 @@
* The goal is to simply ensure the basics work.
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "rendercopy.h"
#define WIDTH 512
@@ -86,6 +90,11 @@ int main(int argc, char **argv)
if (argc > 1)
count = atoi(argv[1]);
+ if (drmtest_dump_aub()) {
+ count = 2;
+ drm_intel_bufmgr_gem_set_aub_filename(bufmgr, "rendercopy.aub");
+ drm_intel_bufmgr_gem_set_aub_dump(bufmgr, true);
+ }
if (count == 0)
count = 3 * gem_aperture_size(fd) / SIZE / 2;
else if (count < 2) {
@@ -126,6 +135,17 @@ int main(int argc, char **argv)
render_copy(batch, &src, 0, 0, WIDTH, HEIGHT, &dst, 0, 0);
start_val[(i + 1) % count] = start_val[i % count];
+
+ /* We're not really here for the test, we just want to dump a
+ * trace of a call to render_copy() */
+ if (drmtest_dump_aub()) {
+ drm_intel_gem_bo_aub_dump_bmp(dst.bo,
+ 0, 0, WIDTH, HEIGHT,
+ AUB_DUMP_BMP_FORMAT_ARGB_8888,
+ STRIDE, 0);
+ drm_intel_bufmgr_gem_set_aub_dump(bufmgr, false);
+ return 0;
+ }
}
for (i = 0; i < count; i++)
check_bo(fd, bo[i]->handle, start_val[i]);