xf86-video-intel: 3 commits - src/sna/sna_accel.c
Chris Wilson
ickle at kemper.freedesktop.org
Fri May 24 04:57:51 PDT 2013
src/sna/sna_accel.c | 50 ++++++++++++++++++++++++++++++++++++--------------
1 file changed, 36 insertions(+), 14 deletions(-)
New commits:
commit f6c35e58c1bb94ccfa04723db76d7164d5772f11
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Fri May 24 12:43:16 2013 +0100
sna: Do not undo a bo if we may fallback
If we undo the pending operations to a bo, then fallback we cause
corruption. For example, see wine and its 1-bit rendering.
Fixes regression from
commit 07a4400fffe4f83df3debe62abd2c37b45f8f0c0 [2.21.7]
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Fri May 10 11:59:59 2013 +0100
sna: Attempt to discard overwritten operations before CopyArea
Also we need to be more careful and consider alu when marking the
operation as 'replaces'.
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 f795dfb..d0a48b2 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -4600,6 +4600,7 @@ sna_copy_boxes(DrawablePtr src, DrawablePtr dst, GCPtr gc,
src_dx, src_dy);
replaces = n == 1 &&
+ alu_overwrites(alu) &&
box->x1 <= 0 &&
box->y1 <= 0 &&
box->x2 >= dst_pixmap->drawable.width &&
@@ -4649,13 +4650,13 @@ sna_copy_boxes(DrawablePtr src, DrawablePtr dst, GCPtr gc,
bo = sna_drawable_use_bo(&dst_pixmap->drawable, hint,
®ion->extents, &damage);
if (bo) {
- if (replaces)
- kgem_bo_undo(&sna->kgem, bo);
-
if (src_priv && src_priv->clear) {
DBG(("%s: applying src clear[%08x] to dst\n",
__FUNCTION__, src_priv->clear_color));
if (n == 1) {
+ if (replaces)
+ kgem_bo_undo(&sna->kgem, bo);
+
if (!sna->render.fill_one(sna,
dst_pixmap, bo,
src_priv->clear_color,
@@ -4666,6 +4667,16 @@ sna_copy_boxes(DrawablePtr src, DrawablePtr dst, GCPtr gc,
__FUNCTION__));
goto fallback;
}
+
+ if (replaces && bo == dst_priv->gpu_bo) {
+ dst_priv->clear = true;
+ dst_priv->clear_color = src_priv->clear_color;
+ sna_damage_all(&dst_priv->gpu_damage,
+ dst_pixmap->drawable.width,
+ dst_pixmap->drawable.height);
+ sna_damage_destroy(&dst_priv->cpu_damage);
+ list_del(&dst_priv->flush_list);
+ }
} else {
struct sna_fill_op fill;
@@ -4681,11 +4692,6 @@ sna_copy_boxes(DrawablePtr src, DrawablePtr dst, GCPtr gc,
fill.done(sna, &fill);
}
- if (replaces && bo == dst_priv->gpu_bo) {
- dst_priv->clear = true;
- dst_priv->clear_color = src_priv->clear_color;
- }
-
if (damage)
sna_damage_add(damage, region);
return;
@@ -4696,7 +4702,10 @@ sna_copy_boxes(DrawablePtr src, DrawablePtr dst, GCPtr gc,
sna_pixmap_move_to_gpu(src_pixmap, MOVE_READ | MOVE_ASYNC_HINT)) {
DBG(("%s: move whole src_pixmap to GPU and copy\n",
__FUNCTION__));
- if (replaces &&
+ if (replaces)
+ kgem_bo_undo(&sna->kgem, bo);
+
+ if (replaces && alu == GXcopy &&
src_pixmap->drawable.width == dst_pixmap->drawable.width &&
src_pixmap->drawable.height == dst_pixmap->drawable.height) {
assert(src_pixmap->drawable.depth == dst_pixmap->drawable.depth);
@@ -4745,6 +4754,9 @@ sna_copy_boxes(DrawablePtr src, DrawablePtr dst, GCPtr gc,
MOVE_READ | MOVE_ASYNC_HINT))
goto fallback;
+ if (replaces)
+ kgem_bo_undo(&sna->kgem, bo);
+
if (!sna->render.copy_boxes(sna, alu,
src_pixmap, src_priv->gpu_bo, src_dx, src_dy,
dst_pixmap, bo, 0, 0,
@@ -4778,6 +4790,9 @@ sna_copy_boxes(DrawablePtr src, DrawablePtr dst, GCPtr gc,
if (!ret)
goto fallback;
+ if (replaces)
+ kgem_bo_undo(&sna->kgem, bo);
+
if (src_priv->shm) {
assert(!src_priv->flush);
sna_add_flush_pixmap(sna, src_priv, src_priv->cpu_bo);
commit 818702d3dc48964e4fd11afe8f2fce431ae913c0
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Fri May 24 12:15:42 2013 +0100
sna: Discard COW before migrating CPU damage to the GPU
At that point, the GPU bo will no longer be a clone of the source and so
we need to decouple it and make ourselves a fresh copy.
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 cb75b27..f795dfb 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -68,7 +68,7 @@
#define USE_CPU_BO 1
#define USE_USERPTR_UPLOADS 1
#define USE_USERPTR_DOWNLOADS 1
-#define USE_COW 1
+#define USE_COW 0
#define MIGRATE_ALL 0
#define DBG_NO_CPU_UPLOAD 0
@@ -2580,8 +2580,6 @@ done:
out:
if (flags & MOVE_WRITE) {
- if (priv->cow)
- sna_pixmap_undo_cow(sna, priv, priv->gpu_damage ? MOVE_READ : 0);
priv->source_count = SOURCE_BIAS;
assert(priv->gpu_bo == NULL || priv->gpu_bo->proxy == NULL);
assert(priv->gpu_bo || priv->gpu_damage == NULL);
@@ -2719,7 +2717,7 @@ sna_pixmap_move_area_to_gpu(PixmapPtr pixmap, const BoxRec *box, unsigned int fl
assert(!wedged(sna));
assert(priv->gpu_damage == NULL || priv->gpu_bo);
- if (flags & MOVE_WRITE && priv->cow) {
+ if (priv->cow && (flags & MOVE_WRITE || priv->cpu_damage)) {
unsigned cow = MOVE_READ;
if ((flags & MOVE_READ) == 0) {
@@ -3429,7 +3427,7 @@ sna_pixmap_move_to_gpu(PixmapPtr pixmap, unsigned flags)
assert(priv->gpu_damage == NULL || priv->gpu_bo);
- if (flags & MOVE_WRITE && priv->cow) {
+ if (priv->cow && (flags & MOVE_WRITE || priv->cpu_damage)) {
if (!sna_pixmap_undo_cow(sna, priv, flags & MOVE_READ))
return false;
@@ -4701,6 +4699,8 @@ sna_copy_boxes(DrawablePtr src, DrawablePtr dst, GCPtr gc,
if (replaces &&
src_pixmap->drawable.width == dst_pixmap->drawable.width &&
src_pixmap->drawable.height == dst_pixmap->drawable.height) {
+ assert(src_pixmap->drawable.depth == dst_pixmap->drawable.depth);
+ assert(src_pixmap->drawable.bitsPerPixel == dst_pixmap->drawable.bitsPerPixel);
if (sna_pixmap_make_cow(sna, src_priv, dst_priv)) {
assert(dst_priv->gpu_bo == src_priv->gpu_bo);
sna_damage_all(&dst_priv->gpu_damage,
commit 2b9723767612702f4cfa2f73ffced83c46eccddf
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Fri May 24 11:46:36 2013 +0100
sna: Do make a clone of a GPU bo that is itself a cache
As we do not attempt to undo the cache status upon the clone.
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 64981a4..cb75b27 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -1663,6 +1663,9 @@ sna_pixmap_make_cow(struct sna *sna,
if (!USE_COW)
return false;
+ if (src_priv->gpu_bo->proxy)
+ return false;
+
DBG(("%s: make cow src=%ld, dst=%ld, handle=%ld\n",
__FUNCTION__,
src_priv->pixmap->drawable.serialNumber,
@@ -1795,6 +1798,7 @@ _sna_pixmap_move_to_cpu(PixmapPtr pixmap, unsigned int flags)
pixmap_inplace(sna, pixmap, priv, true) &&
sna_pixmap_create_mappable_gpu(pixmap, true)) {
DBG(("%s: write inplace\n", __FUNCTION__));
+ assert(priv->cow == NULL);
assert(!priv->shm);
assert(priv->gpu_bo->exec == NULL);
assert((flags & MOVE_READ) == 0 || priv->cpu_damage == NULL);
@@ -1856,6 +1860,7 @@ skip_inplace_map:
pixmap_inplace(sna, pixmap, priv, (flags & MOVE_READ) == 0) &&
sna_pixmap_create_mappable_gpu(pixmap, (flags & MOVE_READ) == 0)) {
DBG(("%s: try to operate inplace (GTT)\n", __FUNCTION__));
+ assert(priv->cow == NULL);
assert((flags & MOVE_READ) == 0 || priv->cpu_damage == NULL);
/* XXX only sync for writes? */
kgem_bo_submit(&sna->kgem, priv->gpu_bo);
@@ -1897,6 +1902,7 @@ skip_inplace_map:
((flags & (MOVE_WRITE | MOVE_ASYNC_HINT)) == 0 ||
!__kgem_bo_is_busy(&sna->kgem, priv->gpu_bo))) {
DBG(("%s: try to operate inplace (CPU)\n", __FUNCTION__));
+ assert(priv->cow == NULL);
assert(!priv->mapped);
pixmap->devPrivate.ptr =
@@ -2238,6 +2244,7 @@ sna_drawable_move_region_to_cpu(DrawablePtr drawable,
region_inplace(sna, pixmap, region, priv, (flags & MOVE_READ) == 0) &&
sna_pixmap_create_mappable_gpu(pixmap, false)) {
DBG(("%s: try to operate inplace\n", __FUNCTION__));
+ assert(priv->cow == NULL);
/* XXX only sync for writes? */
kgem_bo_submit(&sna->kgem, priv->gpu_bo);
assert(priv->gpu_bo->exec == NULL);
More information about the xorg-commit
mailing list