sna: Do not force use of the CPU bo if replacing a busy GPU bo

To minimise waiting for the SHM pixmap afterwards.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2013-08-18 10:11:49 +01:00
parent f1cbf13bb1
commit 4486ae2d82
1 changed files with 3 additions and 3 deletions

View File

@ -4962,7 +4962,7 @@ source_prefer_gpu(struct sna *sna, struct sna_pixmap *priv,
static bool use_shm_bo(struct sna *sna,
struct kgem_bo *bo,
struct sna_pixmap *priv,
int alu)
int alu, bool replaces)
{
if (priv == NULL || priv->cpu_bo == NULL) {
DBG(("%s: no, not attached\n", __FUNCTION__));
@ -4979,7 +4979,7 @@ static bool use_shm_bo(struct sna *sna,
return true;
}
if (__kgem_bo_is_busy(&sna->kgem, bo)) {
if (!replaces && __kgem_bo_is_busy(&sna->kgem, bo)) {
DBG(("%s: yes, dst is busy\n", __FUNCTION__));
return true;
}
@ -5227,7 +5227,7 @@ sna_copy_boxes(DrawablePtr src, DrawablePtr dst, GCPtr gc,
if (bo != dst_priv->gpu_bo)
goto fallback;
if (use_shm_bo(sna, bo, src_priv, alu)) {
if (use_shm_bo(sna, bo, src_priv, alu, replaces)) {
bool ret;
DBG(("%s: region overlaps CPU damage, copy from CPU bo (shm? %d)\n",