From patchwork Wed Feb 20 14:53:15 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lespiau, Damien" X-Patchwork-Id: 2167671 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork1.kernel.org (Postfix) with ESMTP id A6DC53FDF1 for ; Wed, 20 Feb 2013 14:57:24 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6C7C8E67BB for ; Wed, 20 Feb 2013 06:57:24 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTP id 4562DE67A2 for ; Wed, 20 Feb 2013 06:53:22 -0800 (PST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP; 20 Feb 2013 06:53:19 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.84,702,1355126400"; d="scan'208";a="265103797" Received: from unknown (HELO dyon.amr.corp.intel.com) ([10.255.12.143]) by orsmga001.jf.intel.com with ESMTP; 20 Feb 2013 06:53:18 -0800 From: Damien Lespiau To: intel-gfx@lists.freedesktop.org Date: Wed, 20 Feb 2013 14:53:15 +0000 Message-Id: <1361371996-28166-3-git-send-email-damien.lespiau@intel.com> X-Mailer: git-send-email 1.7.7.5 In-Reply-To: <1361371996-28166-1-git-send-email-damien.lespiau@intel.com> References: <1361371996-28166-1-git-send-email-damien.lespiau@intel.com> Subject: [Intel-gfx] [PATCH 3/4] rendercopy: Add a way to dump an .aub file with the rendercopy bos X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org 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 --- 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]);