aubdump: Write header after figuring out the gen

We have to defer figuring out the gen until we have a PCI ID, which we
don't have for sure until the first execbuffer2 ioctl. We can't write
the file header until we have the gen since we need to know the size of
offsets in the file format.  Move the call to write_header() into the
dump_execbuffer2() where we have the gen.

Signed-off-by: Kristian Høgsberg Kristensen <kristian.h.kristensen@intel.com>
This commit is contained in:
Kristian Høgsberg Kristensen 2015-08-10 15:40:04 -07:00
parent 3156305ace
commit 33bc41aa41

View File

@ -328,6 +328,7 @@ dump_execbuffer2(int fd, struct drm_i915_gem_execbuffer2 *execbuffer2)
}
if (gen == 0) {
gen = intel_gen(device);
write_header();
if (verbose)
printf("[intel_aubdump: running, "
@ -549,8 +550,6 @@ init(void)
file = fopen(filename, "w+");
fail_if(file == NULL, "intel_aubdump: failed to open file '%s'\n", filename);
write_header();
}
static void __attribute__ ((destructor))