From e628d22673dfa494230e6f79ceff7d178137c71a Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Sun, 17 Nov 2019 15:10:56 +0000 Subject: [PATCH] sna: Fix overflow calculation for number of boxes that fit We detect when the number of boxes we wished to emit into the batch would overflow, but then miscalculated the number that would actually fit. References: https://bugs.freedesktop.org/show_bug.cgi?id=112296 Signed-off-by: Chris Wilson --- src/sna/sna_io.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sna/sna_io.c b/src/sna/sna_io.c index 03509f03..de5ac5e6 100644 --- a/src/sna/sna_io.c +++ b/src/sna/sna_io.c @@ -491,7 +491,7 @@ fallback: nbox_this_time = tmp_nbox; rem = kgem_batch_space(kgem); if (10*nbox_this_time > rem) - nbox_this_time = rem / 8; + nbox_this_time = rem / 10; if (2*nbox_this_time > KGEM_RELOC_SIZE(kgem) - kgem->nreloc) nbox_this_time = (KGEM_RELOC_SIZE(kgem) - kgem->nreloc) / 2; assert(nbox_this_time); @@ -1061,7 +1061,7 @@ tile: nbox_this_time = nbox; rem = kgem_batch_space(kgem); if (10*nbox_this_time > rem) - nbox_this_time = rem / 8; + nbox_this_time = rem / 10; if (2*nbox_this_time > KGEM_RELOC_SIZE(kgem) - kgem->nreloc) nbox_this_time = (KGEM_RELOC_SIZE(kgem) - kgem->nreloc) / 2; assert(nbox_this_time); @@ -1563,7 +1563,7 @@ tile: nbox_this_time = nbox; rem = kgem_batch_space(kgem); if (10*nbox_this_time > rem) - nbox_this_time = rem / 8; + nbox_this_time = rem / 10; if (2*nbox_this_time > KGEM_RELOC_SIZE(kgem) - kgem->nreloc) nbox_this_time = (KGEM_RELOC_SIZE(kgem) - kgem->nreloc) / 2; assert(nbox_this_time);