Skip to content

Commit 62fe398

Browse files
ashutoshxjlahtine-intel
authored andcommitted
drm/i915/perf: Clear out entire reports after reading if not power of 2 size
Clearing out report id and timestamp as means to detect unlanded reports only works if report size is power of 2. That is, only when report size is a sub-multiple of the OA buffer size can we be certain that reports will land at the same place each time in the OA buffer (after rewind). If report size is not a power of 2, we need to zero out the entire report to be able to detect unlanded reports reliably. v2: Add Fixes tag (Umesh) Fixes: 1cc064d ("drm/i915/perf: Add support for OA media units") Reviewed-by: Umesh Nerlige Ramappa <[email protected]> Reviewed-by: Lionel Landwerlin <[email protected]> Signed-off-by: Ashutosh Dixit <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] (cherry picked from commit 09a3601) Signed-off-by: Joonas Lahtinen <[email protected]>
1 parent 7877cb9 commit 62fe398

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

drivers/gpu/drm/i915/i915_perf.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -877,12 +877,17 @@ static int gen8_append_oa_reports(struct i915_perf_stream *stream,
877877
stream->oa_buffer.last_ctx_id = ctx_id;
878878
}
879879

880-
/*
881-
* Clear out the report id and timestamp as a means to detect unlanded
882-
* reports.
883-
*/
884-
oa_report_id_clear(stream, report32);
885-
oa_timestamp_clear(stream, report32);
880+
if (is_power_of_2(report_size)) {
881+
/*
882+
* Clear out the report id and timestamp as a means
883+
* to detect unlanded reports.
884+
*/
885+
oa_report_id_clear(stream, report32);
886+
oa_timestamp_clear(stream, report32);
887+
} else {
888+
/* Zero out the entire report */
889+
memset(report32, 0, report_size);
890+
}
886891
}
887892

888893
if (start_offset != *offset) {

0 commit comments

Comments
 (0)