All of lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t v2] tools/i915-perf-recorder: fix topology alignment issue
@ 2020-04-01 11:55 Lionel Landwerlin
  2020-04-01 11:57 ` Chris Wilson
  2020-04-01 14:27 ` [igt-dev] ✗ Fi.CI.BAT: failure for tools/i915-perf-recorder: fix topology alignment issue (rev2) Patchwork
  0 siblings, 2 replies; 3+ messages in thread
From: Lionel Landwerlin @ 2020-04-01 11:55 UTC (permalink / raw)
  To: igt-dev

The additional alignment added when writing into the output was not
accounted in the header. This is preventing reading the recorded data.

Instead of adding the alignment when writing, just account for it when
querying the topology.

v2: Use calloc
    Drop unused var

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: f08865e58cd3 ("tools: add i915 perf recorder tool")
---
 tools/i915-perf/i915_perf_recorder.c | 11 ++---------
 1 file 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;
 }
 
-- 
2.26.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [igt-dev] [PATCH i-g-t v2] tools/i915-perf-recorder: fix topology alignment issue
  2020-04-01 11:55 [igt-dev] [PATCH i-g-t v2] tools/i915-perf-recorder: fix topology alignment issue Lionel Landwerlin
@ 2020-04-01 11:57 ` Chris Wilson
  2020-04-01 14:27 ` [igt-dev] ✗ Fi.CI.BAT: failure for tools/i915-perf-recorder: fix topology alignment issue (rev2) Patchwork
  1 sibling, 0 replies; 3+ messages in thread
From: Chris Wilson @ 2020-04-01 11:57 UTC (permalink / raw)
  To: Lionel Landwerlin, igt-dev

Quoting Lionel Landwerlin (2020-04-01 12:55:13)
> The additional alignment added when writing into the output was not
> accounted in the header. This is preventing reading the recorded data.
> 
> Instead of adding the alignment when writing, just account for it when
> querying the topology.
> 
> v2: Use calloc
>     Drop unused var
> 
> Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
> Fixes: f08865e58cd3 ("tools: add i915 perf recorder tool")
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [igt-dev] ✗ Fi.CI.BAT: failure for tools/i915-perf-recorder: fix topology alignment issue (rev2)
  2020-04-01 11:55 [igt-dev] [PATCH i-g-t v2] tools/i915-perf-recorder: fix topology alignment issue Lionel Landwerlin
  2020-04-01 11:57 ` Chris Wilson
@ 2020-04-01 14:27 ` Patchwork
  1 sibling, 0 replies; 3+ messages in thread
From: Patchwork @ 2020-04-01 14:27 UTC (permalink / raw)
  To: Lionel Landwerlin; +Cc: igt-dev

== Series Details ==

Series: tools/i915-perf-recorder: fix topology alignment issue (rev2)
URL   : https://patchwork.freedesktop.org/series/75360/
State : failure

== Summary ==

Series 75360 revision 2 was fully merged or fully failed: no git log

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-04-01 14:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-01 11:55 [igt-dev] [PATCH i-g-t v2] tools/i915-perf-recorder: fix topology alignment issue Lionel Landwerlin
2020-04-01 11:57 ` Chris Wilson
2020-04-01 14:27 ` [igt-dev] ✗ Fi.CI.BAT: failure for tools/i915-perf-recorder: fix topology alignment issue (rev2) Patchwork

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.