sna: Align active upload buffers to the next page for reuse

If we write to the same page as it already active on the GPU then
despite the invalidation performed at the beginning of each batch, we do
not seem to correctly sample the new data.

References: https://bugs.freedesktop.org/show_bug.cgi?id=51422
References: https://bugs.freedesktop.org/show_bug.cgi?id=52299
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2012-08-28 22:23:22 +01:00
parent 9e0305a392
commit deaa1cac26
1 changed files with 6 additions and 1 deletions

View File

@ -1910,13 +1910,18 @@ static void kgem_finish_buffers(struct kgem *kgem)
}
if (bo->mmapped) {
int used;
assert(!bo->need_io);
used = ALIGN(bo->used + PAGE_SIZE-1, PAGE_SIZE);
if (!DBG_NO_UPLOAD_ACTIVE &&
bo->used + PAGE_SIZE <= bytes(&bo->base) &&
used + PAGE_SIZE <= bytes(&bo->base) &&
(kgem->has_llc || !IS_CPU_MAP(bo->base.map))) {
DBG(("%s: retaining upload buffer (%d/%d)\n",
__FUNCTION__, bo->used, bytes(&bo->base)));
assert(!bo->base.snoop);
bo->used = used;
list_move(&bo->base.list,
&kgem->active_buffers);
continue;