summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/sna/kgem.c4
-rw-r--r--src/sna/kgem.h2
-rw-r--r--src/sna/sna_accel.c5
3 files changed, 10 insertions, 1 deletions
diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index b44c7347..5880c787 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -768,6 +768,10 @@ void kgem_init(struct kgem *kgem, int fd, struct pci_device *dev, int gen)
DBG(("%s: semaphores enabled? %d\n", __FUNCTION__,
kgem->has_semaphores));
+ kgem->can_blt_cpu = gen == 0 || gen >= 30;
+ DBG(("%s: can blt to cpu? %d\n", __FUNCTION__,
+ kgem->can_blt_cpu));
+
if (!is_hw_supported(kgem, dev)) {
xf86DrvMsg(kgem_get_screen_index(kgem), X_WARNING,
"Detected unsupported/dysfunctional hardware, disabling acceleration.\n");
diff --git a/src/sna/kgem.h b/src/sna/kgem.h
index e5db6fd7..c3545476 100644
--- a/src/sna/kgem.h
+++ b/src/sna/kgem.h
@@ -160,6 +160,8 @@ struct kgem {
uint32_t has_cache_level :1;
uint32_t has_llc :1;
+ uint32_t can_blt_cpu :1;
+
uint16_t fence_max;
uint16_t half_cpu_cache_pages;
uint32_t aperture_total, aperture_high, aperture_low, aperture_mappable;
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 406cbfab..9627a06e 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -1070,7 +1070,7 @@ sna_pixmap_create_mappable_gpu(PixmapPtr pixmap)
static inline bool use_cpu_bo_for_write(struct sna *sna,
struct sna_pixmap *priv)
{
- return priv->cpu_bo != NULL && sna->kgem.gen >= 30;
+ return priv->cpu_bo != NULL && sna->kgem.can_blt_cpu;
}
static inline bool use_cpu_bo_for_read(struct sna_pixmap *priv)
@@ -2455,6 +2455,9 @@ use_cpu_bo:
if (priv->cpu_bo == NULL)
return NULL;
+ if (!to_sna_from_pixmap(pixmap)->kgem.can_blt_cpu)
+ return NULL;
+
if (flags == 0 && !kgem_bo_is_busy(priv->cpu_bo))
return NULL;