From patchwork Wed Feb 20 12:11:49 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lespiau, Damien" X-Patchwork-Id: 2167331 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 2985E3FDF1 for ; Wed, 20 Feb 2013 12:12:28 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4020BE6719 for ; Wed, 20 Feb 2013 04:12:28 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by gabe.freedesktop.org (Postfix) with ESMTP id A66E1E5D4F for ; Wed, 20 Feb 2013 04:11:53 -0800 (PST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP; 20 Feb 2013 04:11:53 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.84,701,1355126400"; d="scan'208";a="289538193" Received: from unknown (HELO dyon.amr.corp.intel.com) ([10.255.12.143]) by fmsmga001.fm.intel.com with ESMTP; 20 Feb 2013 04:11:52 -0800 From: Damien Lespiau To: intel-gfx@lists.freedesktop.org Date: Wed, 20 Feb 2013 12:11:49 +0000 Message-Id: <1361362310-15106-2-git-send-email-damien.lespiau@intel.com> X-Mailer: git-send-email 1.7.7.5 In-Reply-To: <1361362310-15106-1-git-send-email-damien.lespiau@intel.com> References: <1361362310-15106-1-git-send-email-damien.lespiau@intel.com> Subject: [Intel-gfx] [PATCH 2/3] intel/aub: Implement a way to specify the output .aub filename 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 Signed-off-by: Damien Lespiau --- intel/intel_bufmgr.h | 3 +++ intel/intel_bufmgr_gem.c | 26 +++++++++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletions(-) diff --git a/intel/intel_bufmgr.h b/intel/intel_bufmgr.h index 8d7f239..15f818e 100644 --- a/intel/intel_bufmgr.h +++ b/intel/intel_bufmgr.h @@ -171,6 +171,9 @@ int drm_intel_gem_bo_get_reloc_count(drm_intel_bo *bo); void drm_intel_gem_bo_clear_relocs(drm_intel_bo *bo, int start); void drm_intel_gem_bo_start_gtt_access(drm_intel_bo *bo, int write_enable); +void +drm_intel_bufmgr_gem_set_aub_filename(drm_intel_bufmgr *bufmgr, + const char *filename); void drm_intel_bufmgr_gem_set_aub_dump(drm_intel_bufmgr *bufmgr, int enable); void drm_intel_gem_bo_aub_dump_bmp(drm_intel_bo *bo, int x1, int y1, int width, int height, diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c index d21547e..eac42ef 100644 --- a/intel/intel_bufmgr_gem.c +++ b/intel/intel_bufmgr_gem.c @@ -127,6 +127,7 @@ typedef struct _drm_intel_bufmgr_gem { unsigned int no_exec : 1; bool fenced_relocs; + char *aub_filename; FILE *aub_file; uint32_t aub_offset; } drm_intel_bufmgr_gem; @@ -1573,6 +1574,7 @@ drm_intel_bufmgr_gem_destroy(drm_intel_bufmgr *bufmgr) free(bufmgr_gem->exec2_objects); free(bufmgr_gem->exec_objects); free(bufmgr_gem->exec_bos); + free(bufmgr_gem->aub_filename); pthread_mutex_destroy(&bufmgr_gem->lock); @@ -2860,6 +2862,23 @@ drm_intel_bufmgr_gem_get_devid(drm_intel_bufmgr *bufmgr) } /** + * Sets the AUB filename. + * + * This function has to be called before drm_intel_bufmgr_gem_set_aub_dump() + * for it to have any effect. + */ +void +drm_intel_bufmgr_gem_set_aub_filename(drm_intel_bufmgr *bufmgr, + const char *filename) +{ + drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *)bufmgr; + + free(bufmgr_gem->aub_filename); + if (filename) + bufmgr_gem->aub_filename = strdup(filename); +} + +/** * Sets up AUB dumping. * * This is a trace file format that can be used with the simulator. @@ -2874,6 +2893,7 @@ drm_intel_bufmgr_gem_set_aub_dump(drm_intel_bufmgr *bufmgr, int enable) int entry = 0x200003; int i; int gtt_size = 0x10000; + const char *filename; if (!enable) { if (bufmgr_gem->aub_file) { @@ -2885,7 +2905,11 @@ drm_intel_bufmgr_gem_set_aub_dump(drm_intel_bufmgr *bufmgr, int enable) if (geteuid() != getuid()) return; - bufmgr_gem->aub_file = fopen("intel.aub", "w+"); + if (bufmgr_gem->aub_filename) + filename = bufmgr_gem->aub_filename; + else + filename = "intel.aub"; + bufmgr_gem->aub_file = fopen(filename, "w+"); if (!bufmgr_gem->aub_file) return;