From patchwork Tue Apr 15 07:37:06 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chia-I Wu X-Patchwork-Id: 3989751 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 6D3C9BFF02 for ; Tue, 15 Apr 2014 07:37:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6F2AD201DE for ; Tue, 15 Apr 2014 07:37:17 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 8CD872013D for ; Tue, 15 Apr 2014 07:37:16 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3D5B26E198; Tue, 15 Apr 2014 00:37:15 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-ve0-f172.google.com (mail-ve0-f172.google.com [209.85.128.172]) by gabe.freedesktop.org (Postfix) with ESMTP id BD2356E198 for ; Tue, 15 Apr 2014 00:37:13 -0700 (PDT) Received: by mail-ve0-f172.google.com with SMTP id jx11so8869600veb.31 for ; Tue, 15 Apr 2014 00:37:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id; bh=amKm/uQPvajdQO7dvbVcAyhdbLg21k4j7pVM8SJPlg8=; b=SWRALVzLmM8ks0NyjpygQ04H2RSUyX/u3XrIe+hNlvmHZQXOa8++7eTjBVUyDAgcw1 ogfB9UbPZLp+5JjEixWjgh/h+hvPBWhemtawxw7veK8B8LcH+GDfwZFedc7qUX+9VHV7 UkP4anPq2lfkGyWb1kBwalgM2GI7SLkRYmpPTYAJujcct2s0rmA9lMR7PhkaYmZhWg7H zEU9C0DmQdxaexwmJIXC8R+H0vHRzC4mW/bF9gCIbgB4KsqFsWwFvw7Dk8amVCyUBWTn zqTxinrzgv9JJleZ2q+iIR37HE76Ar25oDc9QarG4S0juXlJT9hMvwVPC1VqcIOsAm4z ryvQ== X-Received: by 10.221.55.133 with SMTP id vy5mr79844vcb.17.1397547432929; Tue, 15 Apr 2014 00:37:12 -0700 (PDT) Received: from holycrap.mydomain (122-116-71-67.HINET-IP.hinet.net. [122.116.71.67]) by mx.google.com with ESMTPSA id p8sm22558078veq.8.2014.04.15.00.37.11 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 15 Apr 2014 00:37:12 -0700 (PDT) From: Chia-I Wu To: intel-gfx@lists.freedesktop.org Date: Tue, 15 Apr 2014 15:37:06 +0800 Message-Id: <1397547426-2654-1-git-send-email-olvaffe@gmail.com> X-Mailer: git-send-email 1.8.5.3 Subject: [Intel-gfx] [RFC-PATCH libdrm] intel/aub: allow to dump only states X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add drm_intel_bufmgr_gem_set_aub_state_only to disable dumping of unannotated or untyped data. The result should still be a valid AUB dump, in that it can be fed to the simulator. But it will not trigger execution. This can be used to dump states in binary form. Signed-off-by: Chia-I Wu --- intel/intel_bufmgr.h | 3 +++ intel/intel_bufmgr_gem.c | 47 +++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 46 insertions(+), 4 deletions(-) diff --git a/intel/intel_bufmgr.h b/intel/intel_bufmgr.h index 9383c72..46c25ce 100644 --- a/intel/intel_bufmgr.h +++ b/intel/intel_bufmgr.h @@ -180,6 +180,9 @@ 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_state_only(drm_intel_bufmgr *bufmgr, + int enable); 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 007a6d8..c91cc3f 100644 --- a/intel/intel_bufmgr_gem.c +++ b/intel/intel_bufmgr_gem.c @@ -129,6 +129,7 @@ typedef struct _drm_intel_bufmgr_gem { bool fenced_relocs; char *aub_filename; + int aub_state_only; FILE *aub_file; uint32_t aub_offset; } drm_intel_bufmgr_gem; @@ -2018,6 +2019,7 @@ aub_write_large_trace_block(drm_intel_bo *bo, uint32_t type, uint32_t subtype, static void aub_write_bo(drm_intel_bo *bo) { + drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *) bo->bufmgr; drm_intel_bo_gem *bo_gem = (drm_intel_bo_gem *) bo; uint32_t offset = 0; unsigned i; @@ -2029,19 +2031,42 @@ aub_write_bo(drm_intel_bo *bo) drm_intel_aub_annotation *annotation = &bo_gem->aub_annotations[i]; uint32_t ending_offset = annotation->ending_offset; + bool write; + + if (ending_offset <= offset) + continue; + if (ending_offset > bo->size) ending_offset = bo->size; - if (ending_offset > offset) { + + if (bufmgr_gem->aub_state_only) { + switch (annotation->type) { + case AUB_TRACE_TYPE_BATCH: + case AUB_TRACE_TYPE_CONSTANT_BUFFER: + case AUB_TRACE_TYPE_GENERAL: + case AUB_TRACE_TYPE_SURFACE: + write = true; + break; + default: + write = false; + break; + } + } else { + write = true; + } + + if (write) { aub_write_large_trace_block(bo, annotation->type, annotation->subtype, offset, ending_offset - offset); - offset = ending_offset; } + + offset = ending_offset; } /* Write out any remaining unannotated data */ - if (offset < bo->size) { + if (offset < bo->size && !bufmgr_gem->aub_state_only) { aub_write_large_trace_block(bo, AUB_TRACE_TYPE_NOTYPE, 0, offset, bo->size - offset); } @@ -2170,7 +2195,8 @@ aub_exec(drm_intel_bo *bo, int ring_flag, int used) drm_intel_bufmgr_gem_set_aub_annotations(bo, NULL, 0); /* Dump ring buffer */ - aub_build_dump_ringbuffer(bufmgr_gem, bo_gem->aub_offset, ring_flag); + if (!bufmgr_gem->aub_state_only) + aub_build_dump_ringbuffer(bufmgr_gem, bo_gem->aub_offset, ring_flag); fflush(bufmgr_gem->aub_file); @@ -2974,6 +3000,19 @@ drm_intel_bufmgr_gem_set_aub_filename(drm_intel_bufmgr *bufmgr, } /** + * Sets the AUB dumping rule. + * + * When true, only states are dumped. + */ +void +drm_intel_bufmgr_gem_set_aub_state_only(drm_intel_bufmgr *bufmgr, + int enable) +{ + drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *)bufmgr; + bufmgr_gem->aub_state_only = enable; +} + +/** * Sets up AUB dumping. * * This is a trace file format that can be used with the simulator.