From: Damien Lespiau <damien.lespiau@intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH 3/4] rendercopy: Add a way to dump an .aub file with the rendercopy bos
Date: Wed, 20 Feb 2013 14:53:15 +0000 [thread overview]
Message-ID: <1361371996-28166-3-git-send-email-damien.lespiau@intel.com> (raw)
In-Reply-To: <1361371996-28166-1-git-send-email-damien.lespiau@intel.com>
To not bump the dependency on libdrm for a debug feature, the use of new
libdrm symbols are gated by ENABLE_AUB_DUMP and depends on having the
next (2.4.43) libdrm release.
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
---
configure.ac | 6 ++++++
lib/drmtest.c | 10 ++++++++++
lib/drmtest.h | 2 ++
tests/gem_render_linear_blits.c | 24 ++++++++++++++++++++++++
4 files changed, 42 insertions(+), 0 deletions(-)
diff --git a/configure.ac b/configure.ac
index 5e2dbed..1ba1584 100644
--- a/configure.ac
+++ b/configure.ac
@@ -59,6 +59,12 @@ XORG_DEFAULT_OPTIONS
PKG_CHECK_MODULES(DRM, [libdrm_intel >= 2.4.38 libdrm])
PKG_CHECK_MODULES(PCIACCESS, [pciaccess >= 0.10])
+# check if we libdrm is recent enough for our aub dump code
+PKG_CHECK_EXISTS(AUB, [libdrm_intel >= 2.4.43],
+ [enable_aub_dump=yes], [enable_aub_dump=no])
+AS_IF([test x"$enable_aub_dump" = xyes],
+ [AC_DEFINE(ENABLE_AUB_DUMP,1,[Enable AUB dumps])])
+
# for testdisplay
PKG_CHECK_MODULES(CAIRO, cairo)
PKG_CHECK_MODULES(LIBUDEV, [libudev], [udev=yes], [udev=no])
diff --git a/lib/drmtest.c b/lib/drmtest.c
index 641028c..1146715 100644
--- a/lib/drmtest.c
+++ b/lib/drmtest.c
@@ -595,6 +595,16 @@ bool drmtest_run_quick(void)
return run_quick;
}
+bool drmtest_dump_aub(void)
+{
+ static int dump_aub = -1;
+
+ if (dump_aub == -1)
+ dump_aub = env_set("IGT_DUMP_AUB");
+
+ return dump_aub;
+}
+
/* other helpers */
void drmtest_exchange_int(void *array, unsigned i, unsigned j)
{
diff --git a/lib/drmtest.h b/lib/drmtest.h
index 78732a0..1358491 100644
--- a/lib/drmtest.h
+++ b/lib/drmtest.h
@@ -91,6 +91,8 @@ bool drmtest_only_list_subtests(void);
bool drmtest_run_quick(void);
#define SLOW_QUICK(slow,quick) (drmtest_run_quick() ? (quick) : (slow))
+bool drmtest_dump_aub(void);
+
/* helpers based upon the libdrm buffer manager */
void drmtest_init_aperture_trashers(drm_intel_bufmgr *bufmgr);
void drmtest_trash_aperture(void);
diff --git a/tests/gem_render_linear_blits.c b/tests/gem_render_linear_blits.c
index a7e0189..4c1c6ad 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
@@ -83,6 +87,13 @@ int main(int argc, char **argv)
count = 0;
if (argc > 1)
count = atoi(argv[1]);
+#ifdef ENABLE_AUB_DUMP
+ 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);
+ }
+#endif
if (count == 0)
count = 3 * gem_aperture_size(fd) / SIZE / 2;
else if (count < 2) {
@@ -123,6 +134,19 @@ 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];
+
+#ifdef ENABLE_AUB_DUMP
+ /* 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;
+ }
+#endif
}
for (i = 0; i < count; i++)
check_bo(fd, bo[i]->handle, start_val[i]);
--
1.7.7.5
next prev parent reply other threads:[~2013-02-20 14:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-20 14:53 [PATCH 1/4] lib: Factor out a function to check if an environment variable is set Damien Lespiau
2013-02-20 14:53 ` [PATCH 2/4] lib: Allow to override the device id at run time Damien Lespiau
2013-02-20 14:53 ` Damien Lespiau [this message]
2013-02-20 14:53 ` [PATCH 4/4] build: Guard the inclusions of config.h with HAVE_CONFIG_H Damien Lespiau
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1361371996-28166-3-git-send-email-damien.lespiau@intel.com \
--to=damien.lespiau@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox