summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2011-10-16 17:39:06 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2011-10-16 19:39:24 +0100
commiteefa925e3d3e009b21ecc0b428d93a6c732bfa14 (patch)
tree184b93709954ad5e44894137bab6a366aab06d76 /src
parent01f41e624b31af88d433a25eaefce557e7ff3d62 (diff)
sna/accel: Fall-forward for handling a non-copy CopyArea to a dst gpu bo
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src')
-rw-r--r--src/sna/kgem_debug.c6
-rw-r--r--src/sna/kgem_debug_gen3.c1
-rw-r--r--src/sna/sna_accel.c56
3 files changed, 57 insertions, 6 deletions
diff --git a/src/sna/kgem_debug.c b/src/sna/kgem_debug.c
index 2cc7b3a4..ad0a5334 100644
--- a/src/sna/kgem_debug.c
+++ b/src/sna/kgem_debug.c
@@ -255,8 +255,9 @@ decode_2d(struct kgem *kgem, uint32_t offset)
break;
}
- kgem_debug_print(data, offset, 1, "format %s, pitch %d, "
+ kgem_debug_print(data, offset, 1, "format %s, rop %x, pitch %d, "
"clipping %sabled\n", format,
+ (data[1] >> 16) & 0xff,
(short)(data[1] & 0xffff),
data[1] & (1 << 30) ? "en" : "dis");
kgem_debug_print(data, offset, 2, "(%d,%d)\n",
@@ -303,8 +304,9 @@ decode_2d(struct kgem *kgem, uint32_t offset)
break;
}
- kgem_debug_print(data, offset, 1, "format %s, dst pitch %d, "
+ kgem_debug_print(data, offset, 1, "format %s, rop %x, dst pitch %d, "
"clipping %sabled\n", format,
+ (data[1] >> 16) & 0xff,
(short)(data[1] & 0xffff),
data[1] & (1 << 30) ? "en" : "dis");
kgem_debug_print(data, offset, 2, "dst (%d,%d)\n",
diff --git a/src/sna/kgem_debug_gen3.c b/src/sna/kgem_debug_gen3.c
index 17ddb6bd..d152b608 100644
--- a/src/sna/kgem_debug_gen3.c
+++ b/src/sna/kgem_debug_gen3.c
@@ -1156,7 +1156,6 @@ gen3_decode_3d_1d(struct kgem *kgem, uint32_t offset)
if (data[1] & (1 << map)) {
int width, height, pitch, dword;
struct drm_i915_gem_relocation_entry *reloc;
- struct kgem_bo *bo = NULL;
const char *tiling;
reloc = kgem_debug_get_reloc_entry(kgem, &data[i] - kgem->batch);
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 963ff9ba..67693b39 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -1285,13 +1285,63 @@ sna_copy_boxes(DrawablePtr src, DrawablePtr dst, GCPtr gc,
&region);
RegionTranslate(&region, -dst_dx, -dst_dy);
}
- } else {
- if (alu != GXcopy) {
- DBG(("%s: fallback - not a copy and source is on the CPU\n",
+ } else if (alu != GXcopy) {
+ PixmapPtr tmp;
+ int i;
+
+ assert (src_pixmap->drawable.depth != 1);
+
+ DBG(("%s: creating temporary source upload for non-copy alu [%d]\n",
+ __FUNCTION__, alu));
+
+ tmp = sna_pixmap_create_upload(src->pScreen,
+ src->width,
+ src->height,
+ src->depth);
+ if (tmp == NullPixmap)
+ return;
+
+ for (i = 0; i < n; i++) {
+ assert(box->x1 + src_dx >= 0);
+ assert(box->y1 + src_dy >= 0);
+ assert(box->x2 + src_dx <= src_pixmap->drawable.width);
+ assert(box->y2 + src_dy <= src_pixmap->drawable.height);
+
+ assert(box->x1 + dx >= 0);
+ assert(box->y1 + dy >= 0);
+ assert(box->x2 + dx <= tmp->drawable.width);
+ assert(box->y2 + dy <= tmp->drawable.height);
+
+ memcpy_blt(src_pixmap->devPrivate.ptr,
+ tmp->devPrivate.ptr,
+ src_pixmap->drawable.bitsPerPixel,
+ src_pixmap->devKind,
+ tmp->devKind,
+ box[i].x1 + src_dx,
+ box[i].y1 + src_dy,
+ box[i].x1 + dx,
+ box[i].y1 + dy,
+ box[i].x2 - box[i].x1,
+ box[i].y2 - box[i].y1);
+ }
+
+ if (!sna->render.copy_boxes(sna, alu,
+ tmp, sna_pixmap_get_bo(tmp), dx, dy,
+ dst_pixmap, dst_priv->gpu_bo, dst_dx, dst_dy,
+ box, n)) {
+ DBG(("%s: fallback - accelerated copy boxes failed\n",
__FUNCTION__));
+ tmp->drawable.pScreen->DestroyPixmap(tmp);
goto fallback;
}
+ tmp->drawable.pScreen->DestroyPixmap(tmp);
+ RegionTranslate(&region, dst_dx, dst_dy);
+ assert_pixmap_contains_box(dst_pixmap,
+ RegionExtents(&region));
+ sna_damage_add(&dst_priv->gpu_damage, &region);
+ RegionTranslate(&region, -dst_dx, -dst_dy);
+ } else {
if (src_priv) {
RegionTranslate(&region, src_dx, src_dy);
sna_drawable_move_region_to_cpu(&src_pixmap->drawable,