struct fd_gmem_stateobj *gmem = &ctx->gmem;
struct pipe_scissor_state *scissor = &batch->max_scissor;
struct pipe_framebuffer_state *pfb = &batch->framebuffer;
- uint32_t gmem_size = ctx->screen->gmemsize_bytes;
+ const uint32_t gmem_alignment = ctx->screen->gmem_alignment;
+ const uint32_t gmem_size = ctx->screen->gmemsize_bytes;
uint32_t minx, miny, width, height;
uint32_t nbins_x = 1, nbins_y = 1;
uint32_t bin_w, bin_h;
width = pfb->width;
height = pfb->height;
} else {
- minx = scissor->minx & ~31; /* round down to multiple of 32 */
- miny = scissor->miny & ~31;
+ /* round down to multiple of alignment: */
+ minx = scissor->minx & ~(gmem_alignment - 1);
+ miny = scissor->miny & ~(gmem_alignment - 1);
width = scissor->maxx - minx;
height = scissor->maxy - miny;
}
- bin_w = align(width, 32);
- bin_h = align(height, 32);
+ bin_w = align(width, gmem_alignment);
+ bin_h = align(height, gmem_alignment);
/* first, find a bin width that satisfies the maximum width
* restrictions:
*/
while (bin_w > max_width) {
nbins_x++;
- bin_w = align(width / nbins_x, 32);
+ bin_w = align(width / nbins_x, gmem_alignment);
}
if (fd_mesa_debug & FD_DBG_MSGS) {
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, 32);
+ bin_w = align(width / nbins_x, gmem_alignment);
} else {
nbins_y++;
- bin_h = align(height / nbins_y, 32);
+ bin_h = align(height / nbins_y, gmem_alignment);
}
}