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 <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2019-11-17 15:10:56 +00:00
parent cb6bff95ed
commit e628d22673
1 changed files with 3 additions and 3 deletions

View File

@ -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);