aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLionel Landwerlin <[email protected]>2018-10-23 01:39:39 +0100
committerLionel Landwerlin <[email protected]>2018-10-23 14:49:33 +0100
commita8594887bcb848bf5b426664c000f15332e4d372 (patch)
tree60a5bdbcfecf94674a11975d4743eafd229b44ba /src
parent55e7de7b193535133d4324e9f601ae44a0cdd9a7 (diff)
intel/decoders: fix end of batch limit
Pointer arithmetic... v2: s/4/sizeof(uint32_t)/ (Eric) v3: Give bytes to print_batch() in error_decode (Lionel) Make clear what values we're dealing with in error_decode (Lionel) Signed-off-by: Lionel Landwerlin <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> (v2) Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/intel/common/gen_batch_decoder.c2
-rw-r--r--src/intel/tools/aubinator_error_decode.c15
-rw-r--r--src/intel/tools/aubinator_viewer_decoder.cpp2
3 files changed, 10 insertions, 9 deletions
diff --git a/src/intel/common/gen_batch_decoder.c b/src/intel/common/gen_batch_decoder.c
index 827f3dbdd2f..0a36b1678b5 100644
--- a/src/intel/common/gen_batch_decoder.c
+++ b/src/intel/common/gen_batch_decoder.c
@@ -818,7 +818,7 @@ gen_print_batch(struct gen_batch_decode_ctx *ctx,
const uint32_t *batch, uint32_t batch_size,
uint64_t batch_addr)
{
- const uint32_t *p, *end = batch + batch_size;
+ const uint32_t *p, *end = batch + batch_size / sizeof(uint32_t);
int length;
struct gen_group *inst;
diff --git a/src/intel/tools/aubinator_error_decode.c b/src/intel/tools/aubinator_error_decode.c
index d7f9d9f2af1..c581414eb2c 100644
--- a/src/intel/tools/aubinator_error_decode.c
+++ b/src/intel/tools/aubinator_error_decode.c
@@ -292,7 +292,7 @@ struct section {
char *ring_name;
const char *buffer_name;
uint32_t *data;
- int count;
+ int dword_count;
};
#define MAX_SECTIONS 256
@@ -389,11 +389,11 @@ get_gen_batch_bo(void *user_data, uint64_t address)
{
for (int s = 0; s < num_sections; s++) {
if (sections[s].gtt_offset <= address &&
- address < sections[s].gtt_offset + sections[s].count * 4) {
+ address < sections[s].gtt_offset + sections[s].dword_count * 4) {
return (struct gen_batch_decode_bo) {
.addr = sections[s].gtt_offset,
.map = sections[s].data,
- .size = sections[s].count * 4,
+ .size = sections[s].dword_count * 4,
};
}
}
@@ -424,14 +424,14 @@ read_data_file(FILE *file)
if (line[0] == ':' || line[0] == '~') {
uint32_t *data = NULL;
- int count = ascii85_decode(line+1, &data, line[0] == ':');
- if (count == 0) {
+ int dword_count = ascii85_decode(line+1, &data, line[0] == ':');
+ if (dword_count == 0) {
fprintf(stderr, "ASCII85 decode failed.\n");
exit(EXIT_FAILURE);
}
assert(num_sections < MAX_SECTIONS);
sections[num_sections].data = data;
- sections[num_sections].count = count;
+ sections[num_sections].dword_count = dword_count;
num_sections++;
continue;
}
@@ -610,7 +610,8 @@ read_data_file(FILE *file)
strcmp(sections[s].buffer_name, "batch buffer") == 0 ||
strcmp(sections[s].buffer_name, "ring buffer") == 0 ||
strcmp(sections[s].buffer_name, "HW Context") == 0) {
- gen_print_batch(&batch_ctx, sections[s].data, sections[s].count,
+ gen_print_batch(&batch_ctx, sections[s].data,
+ sections[s].dword_count * 4,
sections[s].gtt_offset);
}
}
diff --git a/src/intel/tools/aubinator_viewer_decoder.cpp b/src/intel/tools/aubinator_viewer_decoder.cpp
index 7fe1c3ad1a9..a10d01e94d0 100644
--- a/src/intel/tools/aubinator_viewer_decoder.cpp
+++ b/src/intel/tools/aubinator_viewer_decoder.cpp
@@ -888,7 +888,7 @@ aub_viewer_render_batch(struct aub_viewer_decode_ctx *ctx,
uint64_t batch_addr)
{
struct gen_group *inst;
- const uint32_t *p, *batch = (const uint32_t *) _batch, *end = batch + batch_size;
+ const uint32_t *p, *batch = (const uint32_t *) _batch, *end = batch + batch_size / sizeof(uint32_t);
int length;
for (p = batch; p < end; p += length) {