freedreno/gmem: don't assume scissor opt when estimating # of bins
authorRob Clark <robdclark@chromium.org>
Sat, 9 May 2020 19:29:43 +0000 (12:29 -0700)
committerMarge Bot <eric+marge@anholt.net>
Tue, 12 May 2020 18:16:48 +0000 (18:16 +0000)
We potentially don't know yet what the resulting scissor bounds are, so
we can't assume this when estimating number of bins per pipe for VSC
size calculations.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4976>

src/gallium/drivers/freedreno/freedreno_gmem.c

index e3065f8671ebf503bd9510e9e26aeff69e0ea6c5..382eb59a384219ad29598d93b044e38950253f61 100644 (file)
@@ -353,7 +353,7 @@ __fd_gmem_destroy(struct fd_gmem_stateobj *gmem)
 }
 
 static struct gmem_key *
-gmem_key_init(struct fd_batch *batch, bool assume_zs)
+gmem_key_init(struct fd_batch *batch, bool assume_zs, bool no_scis_opt)
 {
        struct fd_screen *screen = batch->ctx->screen;
        struct pipe_framebuffer_state *pfb = &batch->framebuffer;
@@ -382,7 +382,7 @@ gmem_key_init(struct fd_batch *batch, bool assume_zs)
                key->cbuf_cpp[i] *= pfb->samples;
        }
 
-       if (fd_mesa_debug & FD_DBG_NOSCIS) {
+       if ((fd_mesa_debug & FD_DBG_NOSCIS) || no_scis_opt) {
                key->minx = 0;
                key->miny = 0;
                key->width = pfb->width;
@@ -412,12 +412,12 @@ gmem_key_init(struct fd_batch *batch, bool assume_zs)
 }
 
 static struct fd_gmem_stateobj *
-lookup_gmem_state(struct fd_batch *batch, bool assume_zs)
+lookup_gmem_state(struct fd_batch *batch, bool assume_zs, bool no_scis_opt)
 {
        struct fd_screen *screen = batch->ctx->screen;
        struct fd_gmem_cache *cache = &screen->gmem_cache;
        struct fd_gmem_stateobj *gmem = NULL;
-       struct gmem_key *key = gmem_key_init(batch, assume_zs);
+       struct gmem_key *key = gmem_key_init(batch, assume_zs, no_scis_opt);
        uint32_t hash = gmem_key_hash(key);
 
        fd_screen_lock(screen);
@@ -610,7 +610,7 @@ fd_gmem_render_tiles(struct fd_batch *batch)
                render_sysmem(batch);
                ctx->stats.batch_sysmem++;
        } else {
-               struct fd_gmem_stateobj *gmem = lookup_gmem_state(batch, false);
+               struct fd_gmem_stateobj *gmem = lookup_gmem_state(batch, false, false);
                batch->gmem_state = gmem;
                fd_log(batch, "%p: rendering %dx%d tiles %ux%u (%s/%s)",
                        batch, pfb->width, pfb->height, gmem->nbins_x, gmem->nbins_y,
@@ -639,7 +639,7 @@ fd_gmem_estimate_bins_per_pipe(struct fd_batch *batch)
 {
        struct pipe_framebuffer_state *pfb = &batch->framebuffer;
        struct fd_screen *screen = batch->ctx->screen;
-       struct fd_gmem_stateobj *gmem = lookup_gmem_state(batch, !!pfb->zsbuf);
+       struct fd_gmem_stateobj *gmem = lookup_gmem_state(batch, !!pfb->zsbuf, true);
        unsigned nbins = gmem->maxpw * gmem->maxph;
 
        fd_screen_lock(screen);