freedreno/gmem: Reverse order of alternative tile rows

Similar motivation as c426e21ff1 ("turnip: Reverse the order of walking
pipes or tiles on odd rows."), but instead we just swap the order of
alternate rows of fd_tile the the gmem stateobj.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17303>
This commit is contained in:
Rob Clark 2022-06-29 09:34:00 -07:00 committed by Marge Bot
parent cdb7a3b0e2
commit 81d85be9a5
3 changed files with 15 additions and 0 deletions

View file

@ -427,6 +427,19 @@ gmem_stateobj_init(struct fd_screen *screen, struct gmem_key *key)
yoff += bh;
}
/* Swap the order of alternating rows to form an 'S' pattern, to improve
* cache access patterns (ie. adjacent bins are likely to access adjacent
* portions of textures)
*/
if (!FD_DBG(NOSBIN)) {
for (i = 0; i < gmem->nbins_y; i+=2) {
unsigned col0 = gmem->nbins_y * i;
for (j = 0; j < gmem->nbins_x/2; j++) {
swap(gmem->tile[col0 + j], gmem->tile[col0 + gmem->nbins_x - j - 1]);
}
}
}
if (BIN_DEBUG) {
t = 0;
for (i = 0; i < gmem->nbins_y; i++) {

View file

@ -96,6 +96,7 @@ static const struct debug_named_value fd_debug_options[] = {
{"layout", FD_DBG_LAYOUT, "Dump resource layouts"},
{"nofp16", FD_DBG_NOFP16, "Disable mediump precision lowering"},
{"nohw", FD_DBG_NOHW, "Disable submitting commands to the HW"},
{"nosbin", FD_DBG_NOSBIN, "Execute GMEM bins in raster order instead of 'S' pattern"},
DEBUG_NAMED_VALUE_END
};
/* clang-format on */

View file

@ -96,6 +96,7 @@ enum fd_debug_flag {
FD_DBG_LAYOUT = BITFIELD_BIT(26),
FD_DBG_NOFP16 = BITFIELD_BIT(27),
FD_DBG_NOHW = BITFIELD_BIT(28),
FD_DBG_NOSBIN = BITFIELD_BIT(29),
};
/* clang-format on */