summaryrefslogtreecommitdiffstats
path: root/src/intel/isl
diff options
context:
space:
mode:
authorNanley Chery <[email protected]>2016-02-24 12:10:44 -0800
committerNanley Chery <[email protected]>2016-02-26 16:59:36 -0800
commit265d4c415ca6b41bdd9a4a3e9f311d8f6e69cef1 (patch)
tree3d7dd9139b84a5675e920eeebb61cf801aa93042 /src/intel/isl
parent6bb6b5c341a5a75763d565565f164b63cff3388a (diff)
isl: Fix isl_surf_get_image_intratile_offset_el()
Consecutive tiles are separated by the size of the tile, not by the logical tile width. v2: Remove extra subtraction (Ville) Add parenthesis (Jason) v3: Update the unit tests for the function Signed-off-by: Nanley Chery <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/intel/isl')
-rw-r--r--src/intel/isl/isl.c2
-rw-r--r--src/intel/isl/tests/isl_surf_get_image_offset_test.c70
2 files changed, 36 insertions, 36 deletions
diff --git a/src/intel/isl/isl.c b/src/intel/isl/isl.c
index c1d47d5a579..3b6bee10081 100644
--- a/src/intel/isl/isl.c
+++ b/src/intel/isl/isl.c
@@ -1378,7 +1378,7 @@ isl_surf_get_image_intratile_offset_el(const struct isl_device *dev,
uint32_t total_x_offset_B = total_x_offset_el * fmtl->bs;
uint32_t small_x_offset_B = total_x_offset_B % tile_info.width;
uint32_t small_x_offset_el = small_x_offset_B / fmtl->bs;
- uint32_t big_x_offset_B = total_x_offset_B - small_x_offset_B;
+ uint32_t big_x_offset_B = (total_x_offset_B / tile_info.width) * tile_info.size;
*base_address_offset = big_y_offset_B + big_x_offset_B;
*x_offset_el = small_x_offset_el;
diff --git a/src/intel/isl/tests/isl_surf_get_image_offset_test.c b/src/intel/isl/tests/isl_surf_get_image_offset_test.c
index cda8583daeb..34b336e8d81 100644
--- a/src/intel/isl/tests/isl_surf_get_image_offset_test.c
+++ b/src/intel/isl/tests/isl_surf_get_image_offset_test.c
@@ -191,14 +191,14 @@ test_bdw_2d_r8g8b8a8_unorm_512x512_array01_samples01_noaux_tiley0(void)
t_assert_intratile_offset_el(&dev, &surf, 0, 0, 0, 0x0, 0, 0);
t_assert_intratile_offset_el(&dev, &surf, 1, 0, 0, 0x100000, 0, 0);
- t_assert_intratile_offset_el(&dev, &surf, 2, 0, 0, 0x100400, 0, 0);
- t_assert_intratile_offset_el(&dev, &surf, 3, 0, 0, 0x140400, 0, 0);
- t_assert_intratile_offset_el(&dev, &surf, 4, 0, 0, 0x160400, 0, 0);
- t_assert_intratile_offset_el(&dev, &surf, 5, 0, 0, 0x170400, 0, 0);
- t_assert_intratile_offset_el(&dev, &surf, 6, 0, 0, 0x170400, 0, 16);
- t_assert_intratile_offset_el(&dev, &surf, 7, 0, 0, 0x170400, 0, 24);
- t_assert_intratile_offset_el(&dev, &surf, 8, 0, 0, 0x170400, 0, 28);
- t_assert_intratile_offset_el(&dev, &surf, 9, 0, 0, 0x180400, 0, 0);
+ t_assert_intratile_offset_el(&dev, &surf, 2, 0, 0, 0x108000, 0, 0);
+ t_assert_intratile_offset_el(&dev, &surf, 3, 0, 0, 0x148000, 0, 0);
+ t_assert_intratile_offset_el(&dev, &surf, 4, 0, 0, 0x168000, 0, 0);
+ t_assert_intratile_offset_el(&dev, &surf, 5, 0, 0, 0x178000, 0, 0);
+ t_assert_intratile_offset_el(&dev, &surf, 6, 0, 0, 0x178000, 0, 16);
+ t_assert_intratile_offset_el(&dev, &surf, 7, 0, 0, 0x178000, 0, 24);
+ t_assert_intratile_offset_el(&dev, &surf, 8, 0, 0, 0x178000, 0, 28);
+ t_assert_intratile_offset_el(&dev, &surf, 9, 0, 0, 0x188000, 0, 0);
}
static void
@@ -260,41 +260,41 @@ test_bdw_2d_r8g8b8a8_unorm_1024x1024_array06_samples01_noaux_tiley0(void)
/* array layer 0 */
t_assert_intratile_offset_el(&dev, &surf, 0, 0, 0, 0x0, 0, 0);
t_assert_intratile_offset_el(&dev, &surf, 1, 0, 0, 0x400000, 0, 0);
- t_assert_intratile_offset_el(&dev, &surf, 2, 0, 0, 0x400800, 0, 0);
- t_assert_intratile_offset_el(&dev, &surf, 3, 0, 0, 0x500800, 0, 0);
- t_assert_intratile_offset_el(&dev, &surf, 4, 0, 0, 0x580800, 0, 0);
- t_assert_intratile_offset_el(&dev, &surf, 5, 0, 0, 0x5c0800, 0, 0);
- t_assert_intratile_offset_el(&dev, &surf, 6, 0, 0, 0x5e0800, 0, 0);
- t_assert_intratile_offset_el(&dev, &surf, 7, 0, 0, 0x5e0800, 0, 16);
- t_assert_intratile_offset_el(&dev, &surf, 8, 0, 0, 0x5e0800, 0, 24);
- t_assert_intratile_offset_el(&dev, &surf, 9, 0, 0, 0x5e0800, 0, 28);
- t_assert_intratile_offset_el(&dev, &surf, 10, 0, 0, 0x600800, 0, 0);
+ t_assert_intratile_offset_el(&dev, &surf, 2, 0, 0, 0x410000, 0, 0);
+ t_assert_intratile_offset_el(&dev, &surf, 3, 0, 0, 0x510000, 0, 0);
+ t_assert_intratile_offset_el(&dev, &surf, 4, 0, 0, 0x590000, 0, 0);
+ t_assert_intratile_offset_el(&dev, &surf, 5, 0, 0, 0x5d0000, 0, 0);
+ t_assert_intratile_offset_el(&dev, &surf, 6, 0, 0, 0x5f0000, 0, 0);
+ t_assert_intratile_offset_el(&dev, &surf, 7, 0, 0, 0x5f0000, 0, 16);
+ t_assert_intratile_offset_el(&dev, &surf, 8, 0, 0, 0x5f0000, 0, 24);
+ t_assert_intratile_offset_el(&dev, &surf, 9, 0, 0, 0x5f0000, 0, 28);
+ t_assert_intratile_offset_el(&dev, &surf, 10, 0, 0, 0x610000, 0, 0);
/* array layer 1 */
t_assert_intratile_offset_el(&dev, &surf, 0, 1, 0, 0x600000, 0, 4);
t_assert_intratile_offset_el(&dev, &surf, 1, 1, 0, 0xa00000, 0, 4);
- t_assert_intratile_offset_el(&dev, &surf, 2, 1, 0, 0xa00800, 0, 4);
- t_assert_intratile_offset_el(&dev, &surf, 3, 1, 0, 0xb00800, 0, 4);
- t_assert_intratile_offset_el(&dev, &surf, 4, 1, 0, 0xb80800, 0, 4);
- t_assert_intratile_offset_el(&dev, &surf, 5, 1, 0, 0xbc0800, 0, 4);
- t_assert_intratile_offset_el(&dev, &surf, 6, 1, 0, 0xbe0800, 0, 4);
- t_assert_intratile_offset_el(&dev, &surf, 7, 1, 0, 0xbe0800, 0, 20);
- t_assert_intratile_offset_el(&dev, &surf, 8, 1, 0, 0xbe0800, 0, 28);
- t_assert_intratile_offset_el(&dev, &surf, 9, 1, 0, 0xc00800, 0, 0);
- t_assert_intratile_offset_el(&dev, &surf, 10, 1, 0, 0xc00800, 0, 4);
+ t_assert_intratile_offset_el(&dev, &surf, 2, 1, 0, 0xa10000, 0, 4);
+ t_assert_intratile_offset_el(&dev, &surf, 3, 1, 0, 0xb10000, 0, 4);
+ t_assert_intratile_offset_el(&dev, &surf, 4, 1, 0, 0xb90000, 0, 4);
+ t_assert_intratile_offset_el(&dev, &surf, 5, 1, 0, 0xbd0000, 0, 4);
+ t_assert_intratile_offset_el(&dev, &surf, 6, 1, 0, 0xbf0000, 0, 4);
+ t_assert_intratile_offset_el(&dev, &surf, 7, 1, 0, 0xbf0000, 0, 20);
+ t_assert_intratile_offset_el(&dev, &surf, 8, 1, 0, 0xbf0000, 0, 28);
+ t_assert_intratile_offset_el(&dev, &surf, 9, 1, 0, 0xc10000, 0, 0);
+ t_assert_intratile_offset_el(&dev, &surf, 10, 1, 0, 0xc10000, 0, 4);
/* array layer 2 */
t_assert_intratile_offset_el(&dev, &surf, 0, 2, 0, 0xc00000, 0, 8);
t_assert_intratile_offset_el(&dev, &surf, 1, 2, 0, 0x1000000, 0, 8);
- t_assert_intratile_offset_el(&dev, &surf, 2, 2, 0, 0x1000800, 0, 8);
- t_assert_intratile_offset_el(&dev, &surf, 3, 2, 0, 0x1100800, 0, 8);
- t_assert_intratile_offset_el(&dev, &surf, 4, 2, 0, 0x1180800, 0, 8);
- t_assert_intratile_offset_el(&dev, &surf, 5, 2, 0, 0x11c0800, 0, 8);
- t_assert_intratile_offset_el(&dev, &surf, 6, 2, 0, 0x11e0800, 0, 8);
- t_assert_intratile_offset_el(&dev, &surf, 7, 2, 0, 0x11e0800, 0, 24);
- t_assert_intratile_offset_el(&dev, &surf, 8, 2, 0, 0x1200800, 0, 0);
- t_assert_intratile_offset_el(&dev, &surf, 9, 2, 0, 0x1200800, 0, 4);
- t_assert_intratile_offset_el(&dev, &surf, 10, 2, 0, 0x1200800, 0, 8);
+ t_assert_intratile_offset_el(&dev, &surf, 2, 2, 0, 0x1010000, 0, 8);
+ t_assert_intratile_offset_el(&dev, &surf, 3, 2, 0, 0x1110000, 0, 8);
+ t_assert_intratile_offset_el(&dev, &surf, 4, 2, 0, 0x1190000, 0, 8);
+ t_assert_intratile_offset_el(&dev, &surf, 5, 2, 0, 0x11d0000, 0, 8);
+ t_assert_intratile_offset_el(&dev, &surf, 6, 2, 0, 0x11f0000, 0, 8);
+ t_assert_intratile_offset_el(&dev, &surf, 7, 2, 0, 0x11f0000, 0, 24);
+ t_assert_intratile_offset_el(&dev, &surf, 8, 2, 0, 0x1210000, 0, 0);
+ t_assert_intratile_offset_el(&dev, &surf, 9, 2, 0, 0x1210000, 0, 4);
+ t_assert_intratile_offset_el(&dev, &surf, 10, 2, 0, 0x1210000, 0, 8);
/* skip the remaining array layers */
}