xf86-video-intel: 3 commits - src/sna/sna_accel.c src/sna/sna_damage.c
Chris Wilson
ickle at kemper.freedesktop.org
Tue Oct 2 03:45:44 PDT 2012
src/sna/sna_accel.c | 57 +++++++++++++++++++++++++++++++--------------------
src/sna/sna_damage.c | 2 +
2 files changed, 37 insertions(+), 22 deletions(-)
New commits:
commit 0ae6c2ccb006a99e8d7bbfff77f98cc58f62ce2f
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Tue Oct 2 11:44:16 2012 +0100
sna: Actually upload the damage when replacing a busy CPU bo for PutImage
Reported-by: Roman Jarosz <kedgedev at gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=55508
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 3523fba..b5e6730 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -2240,6 +2240,7 @@ out:
if ((flags & MOVE_ASYNC_HINT) == 0 && priv->cpu_bo) {
DBG(("%s: syncing cpu bo\n", __FUNCTION__));
kgem_bo_sync__cpu(&sna->kgem, priv->cpu_bo);
+ assert(!kgem_bo_is_busy(priv->cpu_bo));
}
priv->cpu = (flags & MOVE_ASYNC_HINT) == 0;
assert(pixmap->devPrivate.ptr);
@@ -3447,6 +3448,12 @@ static bool upload_inplace(struct sna *sna,
}
}
+ if (priv->cpu_bo && kgem_bo_is_busy(priv->cpu_bo) &&
+ !(priv->gpu_bo && kgem_bo_is_busy(priv->gpu_bo))) {
+ DBG(("%s: yes, CPU bo is busy, but the GPU bo is not\n", __FUNCTION__));
+ return true;
+ }
+
if (!region_inplace(sna, pixmap, region, priv, true)) {
DBG(("%s? no, region not suitable\n", __FUNCTION__));
return false;
@@ -3572,6 +3579,12 @@ sna_put_zpixmap_blt(DrawablePtr drawable, GCPtr gc, RegionPtr region,
priv->gpu_bo = NULL;
}
+ if (priv->mapped) {
+ assert(!priv->shm);
+ pixmap->devPrivate.ptr = NULL;
+ priv->mapped = false;
+ }
+
/* If the GPU is currently accessing the CPU pixmap, then
* we will need to wait for that to finish before we can
* modify the memory.
@@ -3586,25 +3599,19 @@ sna_put_zpixmap_blt(DrawablePtr drawable, GCPtr gc, RegionPtr region,
if (priv->cpu_damage) {
if (!region_subsumes_drawable(region, &pixmap->drawable)) {
sna_damage_subtract(&priv->cpu_damage, region);
- if (!sna_pixmap_move_to_gpu(pixmap,
- MOVE_WRITE))
+ if (!sna_pixmap_move_to_gpu(pixmap, MOVE_READ | MOVE_ASYNC_HINT))
return false;
} else {
sna_damage_destroy(&priv->cpu_damage);
priv->undamaged = false;
}
- assert(priv->cpu_damage == NULL);
}
+ assert(priv->cpu_damage == NULL);
sna_damage_all(&priv->gpu_damage,
pixmap->drawable.width,
pixmap->drawable.height);
sna_pixmap_free_cpu(sna, priv);
- }
-
- if (priv->mapped) {
- assert(!priv->shm);
- pixmap->devPrivate.ptr = NULL;
- priv->mapped = false;
+ assert(pixmap->devPrivate.ptr == NULL);
}
if (pixmap->devPrivate.ptr == NULL &&
@@ -3649,6 +3656,7 @@ sna_put_zpixmap_blt(DrawablePtr drawable, GCPtr gc, RegionPtr region,
pixmap->drawable.height);
sna_pixmap_free_gpu(sna, priv);
priv->undamaged = false;
+ assert(priv->gpu_damage == NULL);
} else {
sna_damage_subtract(&priv->gpu_damage, region);
sna_damage_add(&priv->cpu_damage, region);
commit 52b211cb15b3bfe33a61cafcd8dcc1c9fbf20243
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Mon Oct 1 23:55:37 2012 +0100
sna: Tweak CPU damage partial upload paths
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 b526829..3523fba 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -2351,7 +2351,6 @@ sna_pixmap_mark_active(struct sna *sna, struct sna_pixmap *priv)
!priv->pinned && priv->gpu_bo->proxy == NULL &&
(priv->create & KGEM_CAN_CREATE_LARGE) == 0)
list_move(&priv->inactive, &sna->active_pixmaps);
- priv->cpu = false;
return priv;
}
@@ -2416,12 +2415,6 @@ sna_pixmap_move_area_to_gpu(PixmapPtr pixmap, const BoxRec *box, unsigned int fl
pixmap->devPrivate.ptr = NULL;
priv->mapped = false;
}
- if (pixmap->devPrivate.ptr == NULL) {
- assert(priv->stride);
- pixmap->devPrivate.ptr = priv->ptr;
- pixmap->devKind = priv->stride;
- }
- assert(pixmap->devPrivate.ptr != NULL);
region_set(&r, box);
if (MIGRATE_ALL || region_subsumes_damage(&r, priv->cpu_damage)) {
@@ -2511,7 +2504,7 @@ sna_pixmap_move_area_to_gpu(PixmapPtr pixmap, const BoxRec *box, unsigned int fl
box = REGION_RECTS(&i);
ok = false;
if (use_cpu_bo_for_upload(priv, 0)) {
- DBG(("%s: using CPU bo for upload to GPU\n", __FUNCTION__));
+ DBG(("%s: using CPU bo for upload to GPU, %d boxes\n", __FUNCTION__, n));
ok = sna->render.copy_boxes(sna, GXcopy,
pixmap, priv->cpu_bo, 0, 0,
pixmap, priv->gpu_bo, 0, 0,
@@ -2550,6 +2543,7 @@ sna_pixmap_move_area_to_gpu(PixmapPtr pixmap, const BoxRec *box, unsigned int fl
done:
if (flags & MOVE_WRITE) {
priv->clear = false;
+ priv->cpu = false;
if (priv->cpu_damage == NULL && box_inplace(pixmap, box)) {
DBG(("%s: large operation on undamaged, promoting to full GPU\n",
__FUNCTION__));
@@ -2728,7 +2722,7 @@ create_gpu_bo:
} else {
DBG(("%s: partial GPU damage with no CPU damage, continuing to use GPU\n",
__FUNCTION__));
- goto move_to_gpu;
+ goto done;
}
}
@@ -3159,8 +3153,10 @@ done:
}
active:
- if (flags & MOVE_WRITE)
+ if (flags & MOVE_WRITE) {
priv->clear = false;
+ priv->cpu = false;
+ }
assert(!priv->gpu_bo->proxy || (flags & MOVE_WRITE) == 0);
return sna_pixmap_mark_active(sna, priv);
}
diff --git a/src/sna/sna_damage.c b/src/sna/sna_damage.c
index d726b61..a870cbf 100644
--- a/src/sna/sna_damage.c
+++ b/src/sna/sna_damage.c
@@ -1350,6 +1350,8 @@ static bool __sna_damage_intersect(struct sna_damage *damage,
RegionPtr region, RegionPtr result)
{
assert(damage && damage->mode != DAMAGE_ALL);
+ assert(RegionNotEmpty(region));
+
if (region->extents.x2 <= damage->extents.x1 ||
region->extents.x1 >= damage->extents.x2)
return false;
commit 1fc3fa699c0b4cae5259d9e439f84ede4a6012b2
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Mon Oct 1 22:42:26 2012 +0100
sna: Avoid accumulating damage to the CPU if it is already damaged
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 7001eb8..b526829 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -2622,10 +2622,10 @@ sna_drawable_use_bo(DrawablePtr drawable, unsigned flags, const BoxRec *box,
}
if (DAMAGE_IS_ALL(priv->cpu_damage)) {
+ assert(priv->gpu_damage == NULL);
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;
}
}
@@ -2787,6 +2787,8 @@ done:
DBG(("%s: using GPU bo with damage? %d\n",
__FUNCTION__, *damage != NULL));
assert(priv->gpu_bo->proxy == NULL);
+ assert(priv->clear == false);
+ assert(priv->cpu == false);
return priv->gpu_bo;
use_gpu_bo:
@@ -2857,8 +2859,13 @@ use_cpu_bo:
pixmap->drawable.height)) {
sna_damage_destroy(&priv->gpu_damage);
*damage = NULL;
- } else
- *damage = &priv->cpu_damage;
+ } else {
+ if (sna_damage_contains_box__no_reduce(priv->cpu_damage,
+ ®ion.extents))
+ *damage = NULL;
+ else
+ *damage = &priv->cpu_damage;
+ }
if (priv->shm) {
assert(!priv->flush);
@@ -2875,6 +2882,7 @@ use_cpu_bo:
DBG(("%s: using CPU bo with damage? %d\n",
__FUNCTION__, *damage != NULL));
+ assert(priv->clear == false);
return priv->cpu_bo;
}
@@ -4424,6 +4432,7 @@ sna_copy_boxes(DrawablePtr src, DrawablePtr dst, GCPtr gc,
}
sna_damage_destroy(&dst_priv->cpu_damage);
list_del(&dst_priv->list);
+ dst_priv->cpu = false;
}
if (region->data == NULL)
hint |= IGNORE_CPU;
More information about the xorg-commit
mailing list