On Tue, Apr 15, 2014 at 3:37 PM, Chia-I Wu <olvaffe@xxxxxxxxx> wrote: > 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. The intended use is to create a binary and offline alternative of Mesa's INTEL_DEBUG=batch. Right now the binary output can only be decoded with deaub from https://github.com/olvaffe/envytools. But I can update test_decode to accept AUB files if this change is welcomed. deaub is an XML-based (rules-ng-ng based) command/state decoder for GEN6+. I am also curious if there is any interest in it outside deaub (and ilo). > > Signed-off-by: Chia-I Wu <olvaffe@xxxxxxxxx> > --- > 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. > -- > 1.8.5.3 > -- olv@xxxxxxxxxx _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/intel-gfx