xf86-video-intel: 4 commits - src/sna/sna_accel.c src/sna/sna_dri.c
Chris Wilson
ickle at kemper.freedesktop.org
Mon Mar 11 03:43:06 PDT 2013
src/sna/sna_accel.c | 29 ++++++++++++++++++++++++-----
src/sna/sna_dri.c | 52 ++++++++++++++++++++++++++++------------------------
2 files changed, 52 insertions(+), 29 deletions(-)
New commits:
commit 25a63b32c7b549ffb3c7f14de4bf2731d044eb39
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Mon Mar 11 10:42:08 2013 +0000
sna: Tighten checking for coherent maps
Remember all the special cases where we can use a CPU mmap as a
temporary substitute for a GTT mapping.
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index e9f29d0..35c2a90 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -1361,6 +1361,20 @@ void sna_pixmap_destroy(PixmapPtr pixmap)
sna_destroy_pixmap(pixmap);
}
+static inline bool has_coherent_map(struct sna *sna,
+ struct kgem_bo *bo)
+{
+ assert(bo->map);
+
+ if (!IS_CPU_MAP(bo->map))
+ return true;
+
+ if (bo->tiling != I915_TILING_NONE)
+ return false;
+
+ return bo->domain == DOMAIN_CPU || sna->kgem.has_llc;
+}
+
static inline bool pixmap_inplace(struct sna *sna,
PixmapPtr pixmap,
struct sna_pixmap *priv,
@@ -1373,7 +1387,7 @@ static inline bool pixmap_inplace(struct sna *sna,
return false;
if (priv->mapped)
- return !IS_CPU_MAP(priv->gpu_bo->map) || sna->kgem.has_llc;
+ return has_coherent_map(sna, priv->gpu_bo);
if (!write_only && priv->cpu_damage)
return false;
@@ -1564,7 +1578,7 @@ _sna_pixmap_move_to_cpu(PixmapPtr pixmap, unsigned int flags)
if (!priv->mapped)
goto skip_inplace_map;
- assert(!IS_CPU_MAP(priv->gpu_bo->map) || sna->kgem.has_llc);
+ assert(has_coherent_map(sna, priv->gpu_bo));
pixmap->devKind = priv->gpu_bo->pitch;
assert(priv->gpu_bo->proxy == NULL);
@@ -1622,7 +1636,7 @@ skip_inplace_map:
pixmap->devPrivate.ptr = kgem_bo_map(&sna->kgem, priv->gpu_bo);
priv->mapped = pixmap->devPrivate.ptr != NULL;
if (priv->mapped) {
- assert(!IS_CPU_MAP(priv->gpu_bo->map) || sna->kgem.has_llc);
+ assert(has_coherent_map(sna, priv->gpu_bo));
pixmap->devKind = priv->gpu_bo->pitch;
if (flags & MOVE_WRITE) {
assert(priv->gpu_bo->proxy == NULL);
@@ -1869,7 +1883,7 @@ static inline bool region_inplace(struct sna *sna,
if (priv->mapped) {
DBG(("%s: yes, already mapped, continuiung\n", __FUNCTION__));
- return !IS_CPU_MAP(priv->gpu_bo->map);
+ return has_coherent_map(sna, priv->gpu_bo);
}
if (priv->flush) {
@@ -1984,7 +1998,7 @@ sna_drawable_move_region_to_cpu(DrawablePtr drawable,
pixmap->devPrivate.ptr = kgem_bo_map(&sna->kgem, priv->gpu_bo);
priv->mapped = pixmap->devPrivate.ptr != NULL;
if (priv->mapped) {
- assert(!IS_CPU_MAP(priv->gpu_bo->map) || sna->kgem.has_llc);
+ assert(has_coherent_map(sna, priv->gpu_bo));
pixmap->devKind = priv->gpu_bo->pitch;
if (flags & MOVE_WRITE) {
if (!DAMAGE_IS_ALL(priv->gpu_damage)) {
commit 210d474a96d3adf7338b49ee2c234893b54bbb2c
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Sun Mar 10 16:40:35 2013 +0000
sna: Tweak CPU mappings to be only used if a read is required
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index ae6d3c1..e9f29d0 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -1634,6 +1634,7 @@ skip_inplace_map:
list_del(&priv->list);
priv->clear = false;
}
+ priv->cpu = false;
assert_pixmap_damage(pixmap);
DBG(("%s: operate inplace (GTT)\n", __FUNCTION__));
@@ -1649,6 +1650,7 @@ skip_inplace_map:
}
if (priv->gpu_damage && priv->cpu_damage == NULL &&
+ (flags & MOVE_READ || priv->gpu_bo->domain == DOMAIN_CPU || sna->kgem.has_llc) &&
priv->gpu_bo->tiling == I915_TILING_NONE &&
((flags & (MOVE_WRITE | MOVE_ASYNC_HINT)) == 0 ||
!__kgem_bo_is_busy(&sna->kgem, priv->gpu_bo))) {
@@ -1672,6 +1674,7 @@ skip_inplace_map:
priv->clear = false;
}
+ assert(IS_CPU_MAP(priv->gpu_bo->map));
kgem_bo_sync__cpu_full(&sna->kgem, priv->gpu_bo,
FORCE_FULL_SYNC || flags & MOVE_WRITE);
assert_pixmap_damage(pixmap);
@@ -1781,6 +1784,7 @@ done:
if (priv->cpu_bo) {
if ((flags & MOVE_ASYNC_HINT) == 0) {
DBG(("%s: syncing CPU bo\n", __FUNCTION__));
+ assert(IS_CPU_MAP(priv->cpu_bo->map));
kgem_bo_sync__cpu_full(&sna->kgem, priv->cpu_bo,
FORCE_FULL_SYNC || flags & MOVE_WRITE);
assert(!priv->shm || !kgem_bo_is_busy(priv->cpu_bo));
@@ -2312,6 +2316,7 @@ out:
}
if ((flags & MOVE_ASYNC_HINT) == 0 && priv->cpu_bo) {
DBG(("%s: syncing cpu bo\n", __FUNCTION__));
+ assert(IS_CPU_MAP(priv->cpu_bo->map));
kgem_bo_sync__cpu_full(&sna->kgem, priv->cpu_bo,
FORCE_FULL_SYNC || flags & MOVE_WRITE);
}
commit 35f50a98fde7a4ebe6871bd23475948a2a530633
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Sun Mar 10 15:51:45 2013 +0000
sna/dri: Flatten _sna_dri_destroy_buffer()
One level of indentation can be trivially removed with an earlier return.
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/src/sna/sna_dri.c b/src/sna/sna_dri.c
index 9da27cb..6e60570 100644
--- a/src/sna/sna_dri.c
+++ b/src/sna/sna_dri.c
@@ -420,40 +420,41 @@ static void _sna_dri_destroy_buffer(struct sna *sna, DRI2Buffer2Ptr buffer)
__FUNCTION__, buffer, private->bo->handle, private->refcnt,
private->pixmap ? private->pixmap->drawable.serialNumber : 0));
assert(private->refcnt > 0);
+ if (--private->refcnt)
+ return;
- if (--private->refcnt == 0) {
- if (private->pixmap) {
- PixmapPtr pixmap = private->pixmap;
- struct sna_pixmap *priv = sna_pixmap(pixmap);
+ assert(private->bo);
+ if (private->pixmap) {
+ PixmapPtr pixmap = private->pixmap;
+ struct sna_pixmap *priv = sna_pixmap(pixmap);
- assert(sna_pixmap_get_buffer(pixmap) == buffer);
- assert(priv->gpu_bo == private->bo);
- assert(priv->gpu_bo->flush);
- assert(priv->pinned & PIN_DRI);
- assert(priv->flush);
+ assert(sna_pixmap_get_buffer(pixmap) == buffer);
+ assert(priv->gpu_bo == private->bo);
+ assert(priv->gpu_bo->flush);
+ assert(priv->pinned & PIN_DRI);
+ assert(priv->flush);
- /* Undo the DRI markings on this pixmap */
- DBG(("%s: releasing last DRI pixmap=%ld, scanout?=%d\n",
- __FUNCTION__,
- pixmap->drawable.serialNumber,
- pixmap == sna->front));
+ /* Undo the DRI markings on this pixmap */
+ DBG(("%s: releasing last DRI pixmap=%ld, scanout?=%d\n",
+ __FUNCTION__,
+ pixmap->drawable.serialNumber,
+ pixmap == sna->front));
- list_del(&priv->list);
+ list_del(&priv->list);
- priv->gpu_bo->flush = false;
- priv->pinned &= ~PIN_DRI;
+ priv->gpu_bo->flush = false;
+ priv->pinned &= ~PIN_DRI;
- priv->flush = false;
- sna_accel_watch_flush(sna, -1);
+ priv->flush = false;
+ sna_accel_watch_flush(sna, -1);
- sna_pixmap_set_buffer(pixmap, NULL);
- pixmap->drawable.pScreen->DestroyPixmap(pixmap);
- } else
- private->bo->flush = false;
+ sna_pixmap_set_buffer(pixmap, NULL);
+ pixmap->drawable.pScreen->DestroyPixmap(pixmap);
+ } else
+ private->bo->flush = false;
- kgem_bo_destroy(&sna->kgem, private->bo);
- free(buffer);
- }
+ kgem_bo_destroy(&sna->kgem, private->bo);
+ free(buffer);
}
static void sna_dri_destroy_buffer(DrawablePtr draw, DRI2Buffer2Ptr buffer)
commit b81ee116d36845e55f71be2db391f93c1b681d5d
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Sun Mar 10 14:15:46 2013 +0000
sna/dri: Add a couple more basic assertions
To catch bad reference counting and loss of flush.
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/src/sna/sna_dri.c b/src/sna/sna_dri.c
index ebcbdcf..9da27cb 100644
--- a/src/sna/sna_dri.c
+++ b/src/sna/sna_dri.c
@@ -419,6 +419,7 @@ static void _sna_dri_destroy_buffer(struct sna *sna, DRI2Buffer2Ptr buffer)
DBG(("%s: %p [handle=%d] -- refcnt=%d, pixmap=%ld\n",
__FUNCTION__, buffer, private->bo->handle, private->refcnt,
private->pixmap ? private->pixmap->drawable.serialNumber : 0));
+ assert(private->refcnt > 0);
if (--private->refcnt == 0) {
if (private->pixmap) {
@@ -427,6 +428,8 @@ static void _sna_dri_destroy_buffer(struct sna *sna, DRI2Buffer2Ptr buffer)
assert(sna_pixmap_get_buffer(pixmap) == buffer);
assert(priv->gpu_bo == private->bo);
+ assert(priv->gpu_bo->flush);
+ assert(priv->pinned & PIN_DRI);
assert(priv->flush);
/* Undo the DRI markings on this pixmap */
@@ -446,7 +449,7 @@ static void _sna_dri_destroy_buffer(struct sna *sna, DRI2Buffer2Ptr buffer)
sna_pixmap_set_buffer(pixmap, NULL);
pixmap->drawable.pScreen->DestroyPixmap(pixmap);
} else
- private->bo->flush = 0;
+ private->bo->flush = false;
kgem_bo_destroy(&sna->kgem, private->bo);
free(buffer);
More information about the xorg-commit
mailing list