freedreno/gmem: split out helper to calc # of bins

Gets the `nbins_x`/`y` local vars out of the main layout function,
to prevent any confusion like what was fixed in the previous patch
from sneaking back in.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5189>
This commit is contained in:
Rob Clark
2020-05-23 12:42:00 -07:00
committed by Marge Bot
parent fcecdcd822
commit 6aa3004d60
+23 -14
View File
@@ -218,26 +218,16 @@ layout_gmem(struct gmem_key *key, uint32_t nbins_x, uint32_t nbins_y,
return total <= screen->gmemsize_bytes;
}
static struct fd_gmem_stateobj *
gmem_stateobj_init(struct fd_screen *screen, struct gmem_key *key)
static void
calc_nbins(struct gmem_key *key, struct fd_gmem_stateobj *gmem)
{
struct fd_gmem_stateobj *gmem =
rzalloc(screen->gmem_cache.ht, struct fd_gmem_stateobj);
pipe_reference_init(&gmem->reference, 1);
gmem->screen = screen;
gmem->key = key;
list_inithead(&gmem->node);
const unsigned npipes = screen->num_vsc_pipes;
struct fd_screen *screen = gmem->screen;
uint32_t nbins_x = 1, nbins_y = 1;
uint32_t max_width = bin_width(screen);
uint32_t i, j, t, xoff, yoff;
uint32_t tpp_x, tpp_y;
int tile_n[npipes];
if (fd_mesa_debug & FD_DBG_MSGS) {
debug_printf("binning input: cbuf cpp:");
for (i = 0; i < key->nr_cbufs; i++)
for (unsigned i = 0; i < key->nr_cbufs; i++)
debug_printf(" %d", key->cbuf_cpp[i]);
debug_printf(", zsbuf cpp: %d; %dx%d\n",
key->zsbuf_cpp[0], key->width, key->height);
@@ -276,6 +266,25 @@ gmem_stateobj_init(struct fd_screen *screen, struct gmem_key *key)
layout_gmem(key, nbins_x, nbins_y, gmem);
}
static struct fd_gmem_stateobj *
gmem_stateobj_init(struct fd_screen *screen, struct gmem_key *key)
{
struct fd_gmem_stateobj *gmem =
rzalloc(screen->gmem_cache.ht, struct fd_gmem_stateobj);
pipe_reference_init(&gmem->reference, 1);
gmem->screen = screen;
gmem->key = key;
list_inithead(&gmem->node);
const unsigned npipes = screen->num_vsc_pipes;
uint32_t i, j, t, xoff, yoff;
uint32_t tpp_x, tpp_y;
int tile_n[npipes];
calc_nbins(key, gmem);
DBG("using %d bins of size %dx%d", gmem->nbins_x * gmem->nbins_y,
gmem->bin_w, gmem->bin_h);