xf86-video-intel: 3 commits - src/sna/kgem.c src/sna/kgem.h src/sna/sna_accel.c src/sna/sna_io.c
Chris Wilson
ickle at kemper.freedesktop.org
Wed Sep 12 07:02:03 PDT 2012
src/sna/kgem.c | 12 +++++++++---
src/sna/kgem.h | 2 ++
src/sna/sna_accel.c | 21 ++++++++++++---------
src/sna/sna_io.c | 13 +++++++++----
4 files changed, 32 insertions(+), 16 deletions(-)
New commits:
commit e5f137807c318588f546960668345eef34159e26
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Wed Sep 12 14:11:43 2012 +0100
sna: Avoid fallbacks to shadow pixels if FORCE_GPU is in effect
References: https://bugs.freedesktop.org/show_bug.cgi?id=54808
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 e12585e..5bff247 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -2613,9 +2613,12 @@ sna_drawable_use_bo(DrawablePtr drawable, unsigned flags, const BoxRec *box,
}
if (DAMAGE_IS_ALL(priv->cpu_damage)) {
- DBG(("%s: use CPU fast path (all-damaged)\n", __FUNCTION__));
- assert(priv->gpu_damage == NULL);
- goto use_cpu_bo;
+ if ((flags & FORCE_GPU) == 0 || priv->cpu_bo) {
+ DBG(("%s: use CPU fast path (all-damaged), and not forced-gpu\n",
+ __FUNCTION__));
+ assert(priv->gpu_damage == NULL);
+ goto use_cpu_bo;
+ }
}
DBG(("%s: gpu? %d, damaged? %d; cpu? %d, damaged? %d\n", __FUNCTION__,
@@ -2653,9 +2656,10 @@ sna_drawable_use_bo(DrawablePtr drawable, unsigned flags, const BoxRec *box,
}
}
- if (priv->cpu_damage) {
- if ((flags & (PREFER_GPU | FORCE_GPU)) == 0) {
- DBG(("%s: prefer cpu", __FUNCTION__));
+ if ((flags & FORCE_GPU) == 0 && priv->cpu_damage) {
+ if ((flags & PREFER_GPU) == 0) {
+ DBG(("%s: already damaged and prefer cpu",
+ __FUNCTION__));
goto use_cpu_bo;
}
commit 0d17208a66a7e54d4106f8a4034d3a928e28bb62
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Wed Sep 12 14:04:50 2012 +0100
sna: Avoid readback inplace if the target is unmappable
We have to use the tiling indirect path, or else fail.
References: https://bugs.freedesktop.org/show_bug.cgi?id=54808
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/src/sna/sna_io.c b/src/sna/sna_io.c
index 0860dec..d17f387 100644
--- a/src/sna/sna_io.c
+++ b/src/sna/sna_io.c
@@ -80,6 +80,9 @@ static void read_boxes_inplace(struct kgem *kgem,
DBG(("%s x %d, tiling=%d\n", __FUNCTION__, n, bo->tiling));
+ if (!kgem_bo_can_map(kgem, bo))
+ return false;
+
kgem_bo_submit(kgem, bo);
src = kgem_bo_map(kgem, bo);
@@ -114,6 +117,9 @@ static void read_boxes_inplace(struct kgem *kgem,
static bool download_inplace(struct kgem *kgem, struct kgem_bo *bo)
{
+ if (!kgem_bo_can_map(kgem, bo))
+ return false;
+
if (FORCE_INPLACE)
return FORCE_INPLACE > 0;
@@ -531,12 +537,12 @@ static bool upload_inplace(struct kgem *kgem,
const BoxRec *box,
int n, int bpp)
{
- if (FORCE_INPLACE)
- return FORCE_INPLACE > 0;
-
if (!kgem_bo_can_map(kgem, bo))
return false;
+ if (FORCE_INPLACE)
+ return FORCE_INPLACE > 0;
+
/* If we are writing through the GTT, check first if we might be
* able to almagamate a series of small writes into a single
* operation.
commit 4b4abdaae94d164d5d0b2755907e76b9cbe0c988
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Wed Sep 12 13:47:26 2012 +0100
sna: Flush after operating on large buffers
As we know that such operations are likely to be slow and consume
precious GTT space, mark them as candidates for flushing.
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 902cba7..727cb51 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -1286,6 +1286,7 @@ inline static void kgem_bo_move_to_inactive(struct kgem *kgem,
return;
}
+ assert(bo->flush == false);
list_move(&bo->list, &kgem->inactive[bucket(bo)]);
if (bo->map) {
int type = IS_CPU_MAP(bo->map);
@@ -1504,7 +1505,6 @@ static void __kgem_bo_destroy(struct kgem *kgem, struct kgem_bo *bo)
assert(bo->snoop == false);
assert(bo->io == false);
assert(bo->scanout == false);
- assert(bo->flush == false);
if (bo->rq) {
struct list *cache;
@@ -3416,13 +3416,19 @@ create:
bo->pitch = pitch;
if (tiling != I915_TILING_NONE)
bo->tiling = gem_set_tiling(kgem->fd, handle, tiling, pitch);
+ if (bucket >= NUM_CACHE_BUCKETS) {
+ DBG(("%s: marking large bo for automatic flushing\n",
+ __FUNCTION__));
+ bo->flush = true;
+ }
assert(bytes(bo) >= bo->pitch * kgem_aligned_height(kgem, height, bo->tiling));
debug_alloc__bo(kgem, bo);
- DBG((" new pitch=%d, tiling=%d, handle=%d, id=%d\n",
- bo->pitch, bo->tiling, bo->handle, bo->unique_id));
+ DBG((" new pitch=%d, tiling=%d, handle=%d, id=%d, num_pages=%d [%d], bucket=%d\n",
+ bo->pitch, bo->tiling, bo->handle, bo->unique_id,
+ size, num_pages(bo), bucket(bo)));
return bo;
}
diff --git a/src/sna/kgem.h b/src/sna/kgem.h
index 1dc9c67..fb8be3d 100644
--- a/src/sna/kgem.h
+++ b/src/sna/kgem.h
@@ -532,6 +532,8 @@ static inline bool __kgem_bo_is_busy(struct kgem *kgem, struct kgem_bo *bo)
{
DBG(("%s: handle=%d, domain: %d exec? %d, rq? %d\n", __FUNCTION__,
bo->handle, bo->domain, bo->exec != NULL, bo->rq != NULL));
+ if (kgem_flush(kgem))
+ kgem_submit(kgem);
if (bo->rq && !bo->exec)
kgem_retire(kgem);
return kgem_bo_is_busy(bo);
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 4ef9019..e12585e 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -3524,10 +3524,9 @@ sna_put_zpixmap_blt(DrawablePtr drawable, GCPtr gc, RegionPtr region,
}
/* And mark as having a valid GTT mapping for future uploads */
- if (priv->stride &&
- !kgem_bo_is_busy(priv->gpu_bo)) {
+ if (priv->stride && kgem_bo_can_map(&sna->kgem, priv->gpu_bo)) {
pixmap->devPrivate.ptr =
- kgem_bo_map(&sna->kgem, priv->gpu_bo);
+ kgem_bo_map__async(&sna->kgem, priv->gpu_bo);
if (pixmap->devPrivate.ptr) {
priv->mapped = true;
pixmap->devKind = priv->gpu_bo->pitch;
diff --git a/src/sna/sna_io.c b/src/sna/sna_io.c
index 733e542..0860dec 100644
--- a/src/sna/sna_io.c
+++ b/src/sna/sna_io.c
@@ -1165,7 +1165,6 @@ bool sna_replace(struct sna *sna,
pixmap->drawable.height,
pixmap->drawable.bitsPerPixel,
bo->tiling, busy));
- assert(!bo->flush);
if ((busy || !kgem_bo_can_map(kgem, bo)) &&
indirect_replace(sna, pixmap, bo, src, stride))
More information about the xorg-commit
mailing list