sna: Discard proxy upload buffer if we choose to render to it

Even if we try to avoid treating an upload buffer as a real GPU target,
we may still choose to migrate the buffer to the GPU in order to keep
other buffers on the GPU. In that case, we do want to create a real GPU
bo.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2012-04-19 10:34:23 +01:00
parent 4cf74d409c
commit cb6a3dc2ed
1 changed files with 7 additions and 0 deletions

View File

@ -2288,6 +2288,13 @@ sna_pixmap_move_to_gpu(PixmapPtr pixmap, unsigned flags)
goto active;
}
if (flags & MOVE_WRITE && priv->gpu_bo && priv->gpu_bo->proxy) {
DBG(("%s: discarding cached upload buffer\n", __FUNCTION__));
assert(priv->gpu_bo->proxy->rq);
kgem_bo_destroy(&sna->kgem, priv->gpu_bo);
priv->gpu_bo = NULL;
}
if ((flags & MOVE_READ) == 0)
sna_damage_destroy(&priv->cpu_damage);