From bfb44c24bc1eff850d47984b2cb60c957ffc143d Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Fri, 27 Dec 2013 10:31:22 -0500 Subject: freedreno: be more clever about gmem usage Only need to leave room for depth/stencil if it is actually used, etc. Signed-off-by: Rob Clark --- src/gallium/drivers/freedreno/freedreno_gmem.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) (limited to 'src/gallium/drivers/freedreno/freedreno_gmem.c') diff --git a/src/gallium/drivers/freedreno/freedreno_gmem.c b/src/gallium/drivers/freedreno/freedreno_gmem.c index 47d99d3429c..47f7a310e8c 100644 --- a/src/gallium/drivers/freedreno/freedreno_gmem.c +++ b/src/gallium/drivers/freedreno/freedreno_gmem.c @@ -66,6 +66,13 @@ * resolve. */ +static uint32_t bin_width(struct fd_context *ctx) +{ + if (ctx->screen->gpu_id >= 300) + return 992; + return 512; +} + static void calculate_tiles(struct fd_context *ctx) { @@ -76,19 +83,26 @@ calculate_tiles(struct fd_context *ctx) uint32_t minx, miny, width, height; uint32_t nbins_x = 1, nbins_y = 1; uint32_t bin_w, bin_h; - uint32_t max_width = 992; + uint32_t max_width = bin_width(ctx); uint32_t cpp = 4; uint32_t i, j, t, p, n, xoff, yoff; + bool has_zs = !!(ctx->resolve & (FD_BUFFER_DEPTH | FD_BUFFER_STENCIL)); if (pfb->cbufs[0]) cpp = util_format_get_blocksize(pfb->cbufs[0]->format); - if ((gmem->cpp == cpp) && + if ((gmem->cpp == cpp) && (gmem->has_zs == has_zs) && !memcmp(&gmem->scissor, scissor, sizeof(gmem->scissor))) { /* everything is up-to-date */ return; } + /* if have depth/stencil, we need to leave room: */ + if (has_zs) { + gmem_size /= 2; + max_width /= 2; + } + if (fd_mesa_debug & FD_DBG_DSCIS) { minx = 0; miny = 0; @@ -101,13 +115,6 @@ calculate_tiles(struct fd_context *ctx) height = scissor->maxy - miny; } -// TODO we probably could optimize this a bit if we know that -// Z or stencil is not enabled for any of the draw calls.. -// if (fd_stencil_enabled(ctx->zsa) || fd_depth_enabled(ctx->zsa)) { - gmem_size /= 2; - max_width = 256; -// } - bin_w = align(width, 32); bin_h = align(height, 32); @@ -130,6 +137,7 @@ calculate_tiles(struct fd_context *ctx) gmem->scissor = *scissor; gmem->cpp = cpp; + gmem->has_zs = has_zs; gmem->bin_h = bin_h; gmem->bin_w = bin_w; gmem->nbins_x = nbins_x; -- cgit v1.2.3