summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/freedreno
diff options
context:
space:
mode:
authorRob Clark <[email protected]>2013-12-27 10:31:22 -0500
committerRob Clark <[email protected]>2014-01-08 16:30:18 -0500
commitbfb44c24bc1eff850d47984b2cb60c957ffc143d (patch)
tree4b2a8c073162a0e3b84dc0fff8d92a0d56892d46 /src/gallium/drivers/freedreno
parent42c5e2a2ed1888d67d89de5b48749a8228a8f167 (diff)
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 <[email protected]>
Diffstat (limited to 'src/gallium/drivers/freedreno')
-rw-r--r--src/gallium/drivers/freedreno/freedreno_gmem.c26
-rw-r--r--src/gallium/drivers/freedreno/freedreno_gmem.h1
2 files changed, 18 insertions, 9 deletions
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;
diff --git a/src/gallium/drivers/freedreno/freedreno_gmem.h b/src/gallium/drivers/freedreno/freedreno_gmem.h
index 1082d542a91..b52557c952b 100644
--- a/src/gallium/drivers/freedreno/freedreno_gmem.h
+++ b/src/gallium/drivers/freedreno/freedreno_gmem.h
@@ -51,6 +51,7 @@ struct fd_gmem_stateobj {
uint16_t bin_h, nbins_y;
uint16_t bin_w, nbins_x;
uint16_t width, height;
+ bool has_zs; /* gmem config using depth/stencil? */
};
void fd_gmem_render_tiles(struct pipe_context *pctx);