sna: Discard active GPU buffers before uploading into them

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2014-05-17 20:59:38 +01:00
parent f5e4305846
commit 65301412ec
1 changed files with 17 additions and 2 deletions

View File

@ -4491,8 +4491,12 @@ try_upload_tiled_x(PixmapPtr pixmap, RegionRec *region,
}
if (priv->gpu_bo && replaces) {
DBG(("%s: discarding cached upload proxy\n", __FUNCTION__));
sna_pixmap_free_gpu(sna, priv);
if (UNDO)
kgem_bo_undo(&sna->kgem, priv->gpu_bo);
if (__kgem_bo_is_busy(&sna->kgem, priv->gpu_bo)) {
DBG(("%s: discarding cached upload proxy\n", __FUNCTION__));
sna_pixmap_free_gpu(sna, priv);
}
replaces = true; /* Mark it all GPU damaged afterwards */
}
assert(priv->gpu_bo == NULL || priv->gpu_bo->proxy == NULL);
@ -4503,6 +4507,17 @@ try_upload_tiled_x(PixmapPtr pixmap, RegionRec *region,
return false;
}
if (priv->gpu_damage &&
region_subsumes_damage(region, priv->gpu_damage)) {
if (UNDO)
kgem_bo_undo(&sna->kgem, priv->gpu_bo);
if (__kgem_bo_is_busy(&sna->kgem, priv->gpu_bo)) {
DBG(("%s: discarding dirty pixmap\n", __FUNCTION__));
sna_pixmap_free_gpu(sna, priv);
}
replaces = true; /* Mark it all GPU damaged afterwards */
}
if (priv->gpu_bo == NULL &&
!create_upload_tiled_x(&sna->kgem, pixmap, priv, replaces))
return false;