summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/i915-perf/i915_perf_recorder.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/tools/i915-perf/i915_perf_recorder.c b/tools/i915-perf/i915_perf_recorder.c
index 4d729b0e..7671f39b 100644
--- a/tools/i915-perf/i915_perf_recorder.c
+++ b/tools/i915-perf/i915_perf_recorder.c
@@ -485,8 +485,8 @@ get_topology(int drm_fd, uint32_t *topology_size)
return NULL;
assert(item.length > 0);
- *topology_size = item.length;
- topo_info = malloc(item.length);
+ *topology_size = ALIGN(item.length, 8);
+ topo_info = calloc(1, *topology_size);
item.data_ptr = (uintptr_t) topo_info;
ret = perf_ioctl(drm_fd, DRM_IOCTL_I915_QUERY, &query);
@@ -501,7 +501,6 @@ write_topology(FILE *output, struct recording_context *ctx)
struct drm_i915_perf_record_header header = {
.type = INTEL_PERF_RECORD_TYPE_DEVICE_TOPOLOGY,
};
- char pad[8] = { 0, };
header.size = sizeof(header) + ctx->topology_size;
if (fwrite(&header, sizeof(header), 1, output) != 1)
@@ -510,12 +509,6 @@ write_topology(FILE *output, struct recording_context *ctx)
if (fwrite(ctx->topology, ctx->topology_size, 1, output) != 1)
return false;
- /* Align the size to align all other packets to 8 bytes. */
- if (ctx->topology_size % 8) {
- if (fwrite(pad, ctx->topology_size % 8, 1, output) != 1)
- return false;
- }
-
return true;
}