intel_gpu_dump: Decode the GTT offset of batchbuffers.

This commit is contained in:
Eric Anholt 2009-04-12 17:04:31 -07:00
parent 593a47f00e
commit d69042dde6

View File

@ -1788,6 +1788,7 @@ read_data_file (const char * filename, uint32_t **data_ret, int *count_ret)
char *line = NULL;
size_t line_size;
uint32_t offset, value;
uint32_t gtt_offset = 0, new_gtt_offset;
file = fopen (filename, "r");
if (file == NULL) {
@ -1799,6 +1800,17 @@ read_data_file (const char * filename, uint32_t **data_ret, int *count_ret)
while (getline (&line, &line_size, file) > 0) {
line_number++;
matched = sscanf (line, "--- gtt_offset = 0x%08x\n", &new_gtt_offset);
if (matched == 1) {
if (count) {
printf("buffer at 0x%08x:\n", gtt_offset);
intel_decode (data, count, gtt_offset, devid);
count = 0;
}
gtt_offset = new_gtt_offset;
continue;
}
matched = sscanf (line, "%08x : %08x", &offset, &value);
if (matched !=2 ) {
fprintf (stderr, "Warning: Ignoring unrecognized line at %s:%d:\n%s",
@ -1820,12 +1832,15 @@ read_data_file (const char * filename, uint32_t **data_ret, int *count_ret)
data[count-1] = value;
}
if (count) {
printf("Batchbuffer at 0x%08x:\n", gtt_offset);
intel_decode (data, count, gtt_offset, devid);
}
free (data);
free (line);
fclose (file);
*data_ret = data;
*count_ret = count;
}
/* By default, we'll want to grab the state of the current hardware
@ -1864,9 +1879,5 @@ main (int argc, char *argv[])
read_data_file (filename, &data, &count);
intel_decode (data, count, 0, devid);
free (data);
return 0;
}