summaryrefslogtreecommitdiff
path: root/tests/gem_tiled_pread_basic.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2016-10-19 15:30:26 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2016-10-19 16:15:07 +0100
commit2c12a7a4ae791c4f88927337a42a218aab76518b (patch)
treefbf9df36b6a35a1774fb2c7b916827b07a9f2108 /tests/gem_tiled_pread_basic.c
parente27626898b87a1602e6af6f7effcacf772ead491 (diff)
igt/gem_tiled_pread_basic: Only print the erroneous location
Emitting a debug message for every pixel tested takes us from 0.4s to 20s on an old Core2. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'tests/gem_tiled_pread_basic.c')
-rw-r--r--tests/gem_tiled_pread_basic.c32
1 files changed, 20 insertions, 12 deletions
diff --git a/tests/gem_tiled_pread_basic.c b/tests/gem_tiled_pread_basic.c
index bad36509..425bb07e 100644
--- a/tests/gem_tiled_pread_basic.c
+++ b/tests/gem_tiled_pread_basic.c
@@ -87,11 +87,16 @@ swizzle_bit(int bit, int offset)
return (offset & (1 << bit)) >> (bit - 6);
}
+struct offset {
+ int base_x, base_y;
+ int tile_x, tile_y;
+};
+
/* Translate from a swizzled offset in the tiled buffer to the corresponding
* value from the original linear buffer.
*/
static uint32_t
-calculate_expected(int offset)
+calculate_expected(int offset, struct offset *dbg)
{
int tile_off = offset & (tile_size - 1);
int tile_base = offset & -tile_size;
@@ -99,15 +104,14 @@ calculate_expected(int offset)
int tiles_per_row = 4*WIDTH / tile_width;
/* base x,y values from the tile (page) index. */
- int base_y = tile_index / tiles_per_row * tile_height;
- int base_x = tile_index % tiles_per_row * (tile_width/4);
+ dbg->base_y = tile_index / tiles_per_row * tile_height;
+ dbg->base_x = tile_index % tiles_per_row * (tile_width/4);
/* x, y offsets within the tile */
- int tile_y = tile_off / tile_width;
- int tile_x = (tile_off % tile_width) / 4;
+ dbg->tile_y = tile_off / tile_width;
+ dbg->tile_x = (tile_off % tile_width) / 4;
- igt_debug("%3d, %3d, %3d,%3d\n", base_x, base_y, tile_x, tile_y);
- return (base_y + tile_y) * WIDTH + base_x + tile_x;
+ return (dbg->base_y + dbg->tile_y) * WIDTH + dbg->base_x + dbg->tile_x;
}
igt_simple_main
@@ -163,7 +167,8 @@ igt_simple_main
* offset it's looking for).
*/
for (j = offset; j < offset + len; j += 4) {
- uint32_t expected_val, found_val;
+ struct offset dbg;
+ uint32_t expected, found;
int swizzled_offset;
const char *swizzle_str;
@@ -200,12 +205,15 @@ igt_simple_main
igt_assert_f(0, "Bad swizzle bits; %d\n",
swizzle);
}
- expected_val = calculate_expected(swizzled_offset);
- found_val = linear[(j - offset) / 4];
- igt_assert_f(expected_val == found_val,
+ expected = calculate_expected(swizzled_offset, &dbg);
+ found = linear[(j - offset) / 4];
+ igt_assert_f(expected == found,
"Bad read [%d]: %d instead of %d at 0x%08x "
+ "[tile (%d, %d) subtile (%d, %d)] "
"for read from 0x%08x to 0x%08x, swizzle=%s\n",
- i, found_val, expected_val, j,
+ i, found, expected, j,
+ dbg.base_x, dbg.base_y,
+ dbg.tile_x, dbg.tile_y,
offset, offset + len,
swizzle_str);
}