summaryrefslogtreecommitdiff
path: root/intel
diff options
context:
space:
mode:
Diffstat (limited to 'intel')
-rw-r--r--intel/intel_bufmgr.h3
-rw-r--r--intel/intel_bufmgr_gem.c26
2 files changed, 28 insertions, 1 deletions
diff --git a/intel/intel_bufmgr.h b/intel/intel_bufmgr.h
index 8d7f2390..15f818e7 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 7b1ecf17..a51e3f34 100644
--- a/intel/intel_bufmgr_gem.c
+++ b/intel/intel_bufmgr_gem.c
@@ -128,6 +128,7 @@ typedef struct _drm_intel_bufmgr_gem {
unsigned int has_vebox : 1;
bool fenced_relocs;
+ char *aub_filename;
FILE *aub_file;
uint32_t aub_offset;
} drm_intel_bufmgr_gem;
@@ -1574,6 +1575,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);
@@ -2865,6 +2867,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.
@@ -2879,6 +2898,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) {
@@ -2891,7 +2911,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;