summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Clark <robclark@freedesktop.org>2015-05-13 14:36:03 -0400
committerEmil Velikov <emil.l.velikov@gmail.com>2015-05-20 22:10:34 +0100
commitb1c045c62ffaacb131767345c11b0838111db29c (patch)
tree9d7b675e7f293bc517fe3bf7bedd11bb19824ede
parent21dd729dcc34a9435c5b69eac103056f86b965d2 (diff)
freedreno: fix bug in tile/slot calculation
This was causing corruption with hw binning on a306. Unlikely that it is a306 specific, but rather the smaller gmem size resulted in different tile configuration which was triggering the bug at certain resolutions. Signed-off-by: Rob Clark <robclark@freedesktop.org> Cc: "10.4" and "10.5" and "10.6" <mesa-stable@lists.freedesktop.org> (cherry picked from commit 4925c35660b777ae6b33a1f87a2f74f3436c7c41)
-rw-r--r--src/gallium/drivers/freedreno/freedreno_gmem.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/gallium/drivers/freedreno/freedreno_gmem.c b/src/gallium/drivers/freedreno/freedreno_gmem.c
index 4040d1f7615..8fea6728c15 100644
--- a/src/gallium/drivers/freedreno/freedreno_gmem.c
+++ b/src/gallium/drivers/freedreno/freedreno_gmem.c
@@ -91,6 +91,7 @@ calculate_tiles(struct fd_context *ctx)
uint32_t i, j, t, xoff, yoff;
uint32_t tpp_x, tpp_y;
bool has_zs = !!(ctx->resolve & (FD_BUFFER_DEPTH | FD_BUFFER_STENCIL));
+ int tile_n[ARRAY_SIZE(ctx->pipe)];
if (pfb->cbufs[0])
cpp = util_format_get_blocksize(pfb->cbufs[0]->format);
@@ -213,6 +214,7 @@ calculate_tiles(struct fd_context *ctx)
/* configure tiles: */
t = 0;
yoff = miny;
+ memset(tile_n, 0, sizeof(tile_n));
for (i = 0; i < nbins_y; i++) {
uint32_t bw, bh;
@@ -223,20 +225,17 @@ calculate_tiles(struct fd_context *ctx)
for (j = 0; j < nbins_x; j++) {
struct fd_tile *tile = &ctx->tile[t];
- uint32_t n, p;
+ uint32_t p;
assert(t < ARRAY_SIZE(ctx->tile));
/* pipe number: */
p = ((i / tpp_y) * div_round_up(nbins_x, tpp_x)) + (j / tpp_x);
- /* slot number: */
- n = ((i % tpp_y) * tpp_x) + (j % tpp_x);
-
/* clip bin width: */
bw = MIN2(bin_w, minx + width - xoff);
- tile->n = n;
+ tile->n = tile_n[p]++;
tile->p = p;
tile->bin_w = bw;
tile->bin_h = bh;