summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/sna/kgem.h8
-rw-r--r--src/sna/sna_accel.c6
2 files changed, 11 insertions, 3 deletions
diff --git a/src/sna/kgem.h b/src/sna/kgem.h
index 4819dd6f..ac634887 100644
--- a/src/sna/kgem.h
+++ b/src/sna/kgem.h
@@ -297,6 +297,14 @@ static inline bool kgem_ring_is_idle(struct kgem *kgem, int ring)
return __kgem_ring_is_idle(kgem, ring);
}
+static inline bool kgem_is_idle(struct kgem *kgem)
+{
+ if (!kgem->need_retire)
+ return true;
+
+ return kgem_ring_is_idle(kgem, kgem->ring);
+}
+
void _kgem_submit(struct kgem *kgem);
static inline void kgem_submit(struct kgem *kgem)
{
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 253ad873..e82fb20b 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -4345,7 +4345,7 @@ sna_pixmap_is_gpu(PixmapPtr pixmap)
}
static int
-source_prefer_gpu(struct sna_pixmap *priv)
+source_prefer_gpu(struct sna *sna, struct sna_pixmap *priv)
{
if (priv == NULL) {
DBG(("%s: source unattached, use cpu\n", __FUNCTION__));
@@ -4368,7 +4368,7 @@ source_prefer_gpu(struct sna_pixmap *priv)
}
if (DAMAGE_IS_ALL(priv->cpu_damage))
- return 0;
+ return priv->cpu_bo && kgem_is_idle(&sna->kgem);
DBG(("%s: source has GPU bo? %d\n",
__FUNCTION__, priv->gpu_bo != NULL));
@@ -4466,7 +4466,7 @@ sna_copy_boxes(DrawablePtr src, DrawablePtr dst, GCPtr gc,
if (dst_priv == NULL)
goto fallback;
- hint = source_prefer_gpu(src_priv) ?:
+ hint = source_prefer_gpu(sna, src_priv) ?:
region_inplace(sna, dst_pixmap, region,
dst_priv, alu_overwrites(alu));
if (dst_priv->cpu_damage && alu_overwrites(alu)) {