summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/freedreno/freedreno_gmem.c
diff options
context:
space:
mode:
authorRob Clark <[email protected]>2016-12-03 12:34:10 -0500
committerRob Clark <[email protected]>2016-12-06 18:01:31 -0500
commitc1e9cca6965cb0b7dcb6fa14b08f42e98b25b322 (patch)
treec21c7a8c9d66f404d1bc540fbb354930cbea85fa /src/gallium/drivers/freedreno/freedreno_gmem.c
parent8f4da2ff63edc814d9d84a4f667cc68549cc3511 (diff)
freedreno: pitch alignment should match gmem alignment
Deal w/ differing gmem tile size alignment between generations, and make sure texture pitch matches. Signed-off-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/gallium/drivers/freedreno/freedreno_gmem.c')
-rw-r--r--src/gallium/drivers/freedreno/freedreno_gmem.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/gallium/drivers/freedreno/freedreno_gmem.c b/src/gallium/drivers/freedreno/freedreno_gmem.c
index aeccebd9fd2..c7ac0a23a29 100644
--- a/src/gallium/drivers/freedreno/freedreno_gmem.c
+++ b/src/gallium/drivers/freedreno/freedreno_gmem.c
@@ -110,7 +110,8 @@ calculate_tiles(struct fd_batch *batch)
struct fd_gmem_stateobj *gmem = &ctx->gmem;
struct pipe_scissor_state *scissor = &batch->max_scissor;
struct pipe_framebuffer_state *pfb = &batch->framebuffer;
- const uint32_t gmem_alignment = ctx->screen->gmem_alignment;
+ const uint32_t gmem_alignw = ctx->screen->gmem_alignw;
+ const uint32_t gmem_alignh = ctx->screen->gmem_alignh;
const uint32_t gmem_size = ctx->screen->gmemsize_bytes;
uint32_t minx, miny, width, height;
uint32_t nbins_x = 1, nbins_y = 1;
@@ -149,21 +150,21 @@ calculate_tiles(struct fd_batch *batch)
height = pfb->height;
} else {
/* round down to multiple of alignment: */
- minx = scissor->minx & ~(gmem_alignment - 1);
- miny = scissor->miny & ~(gmem_alignment - 1);
+ minx = scissor->minx & ~(gmem_alignw - 1);
+ miny = scissor->miny & ~(gmem_alignh - 1);
width = scissor->maxx - minx;
height = scissor->maxy - miny;
}
- bin_w = align(width, gmem_alignment);
- bin_h = align(height, gmem_alignment);
+ bin_w = align(width, gmem_alignw);
+ bin_h = align(height, gmem_alignh);
/* first, find a bin width that satisfies the maximum width
* restrictions:
*/
while (bin_w > max_width) {
nbins_x++;
- bin_w = align(width / nbins_x, gmem_alignment);
+ bin_w = align(width / nbins_x, gmem_alignw);
}
if (fd_mesa_debug & FD_DBG_MSGS) {
@@ -180,10 +181,10 @@ calculate_tiles(struct fd_batch *batch)
while (total_size(cbuf_cpp, zsbuf_cpp, bin_w, bin_h, gmem) > gmem_size) {
if (bin_w > bin_h) {
nbins_x++;
- bin_w = align(width / nbins_x, gmem_alignment);
+ bin_w = align(width / nbins_x, gmem_alignw);
} else {
nbins_y++;
- bin_h = align(height / nbins_y, gmem_alignment);
+ bin_h = align(height / nbins_y, gmem_alignh);
}
}