diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2011-09-09 14:06:53 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2011-09-09 15:26:04 +0100 |
commit | 27e42b4e1216099f4a6aa7fddeb1e83b87124b6e (patch) | |
tree | 0bcbf2f810c3b297efafa21c66e1f791f783a5b3 | |
parent | 2e1bf7e1b44db16d0c322f17535fc6a6fa07353b (diff) |
sna: Prefer memcpy_blt over fbBlt
We know we have compatible formats since we have a gpu_bo attached to
the pixmap, so we can use the simpler direct memcpy rather than calling
fbPutZImage/fbBlt.
On my i3-330m, this improves putimage500 from 730 to 1100 ops/s.
Reported-by: Michael Larabel <Michael@phoronix.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/sna/sna_accel.c | 37 |
1 files changed, 26 insertions, 11 deletions
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c index a493722d..55aeb70e 100644 --- a/src/sna/sna_accel.c +++ b/src/sna/sna_accel.c @@ -982,7 +982,11 @@ sna_put_image_blt(DrawablePtr drawable, GCPtr gc, RegionPtr region, struct sna *sna = to_sna_from_drawable(drawable); PixmapPtr pixmap = get_drawable_pixmap(drawable); struct sna_pixmap *priv = sna_pixmap(pixmap); + char *dst_bits; + int dst_stride; + BoxRec *box; int16_t dx, dy; + int n; if (!priv->gpu_bo) return false; @@ -1035,18 +1039,27 @@ sna_put_image_blt(DrawablePtr drawable, GCPtr gc, RegionPtr region, } get_drawable_deltas(drawable, pixmap, &dx, &dy); - dx += drawable->x; - dy += drawable->y; + x += dx + drawable->x; + y += dx + drawable->y; + + DBG(("%s: upload(%d, %d, %d, %d)\n", __FUNCTION__, x, y, w, h)); + + dst_stride = pixmap->devKind; + dst_bits = pixmap->devPrivate.ptr; + + /* Region is pre-clipped and translated into pixmap space */ + box = REGION_RECTS(region); + n = REGION_NUM_RECTS(region); + do { + memcpy_blt(bits, dst_bits, + pixmap->drawable.bitsPerPixel, + stride, dst_stride, + box->x1 - x, box->y1 - y, + box->x1, box->y1, + box->x2 - box->x1, box->y2 - box->y1); + box++; + } while (--n); - DBG(("%s: fbPutZImage(%d[+%d], %d[+%d], %d, %d)\n", - __FUNCTION__, - x+dx, pixmap->drawable.x, - y+dy, pixmap->drawable.y, - w, h)); - fbPutZImage(&pixmap->drawable, region, - GXcopy, ~0U, - x + dx, y + dy, w, h, - (FbStip*)bits, stride/sizeof(FbStip)); return true; } @@ -1353,6 +1366,8 @@ fallback: box++; } while (--n); } else { + DBG(("%s: alu==GXcopy? %d, reverse? %d, upsidedown? %d, bpp? %d\n", + __FUNCTION__, alu == GXcopy, reverse, upsidedown, bpp)); dst_bits = dst_pixmap->devPrivate.ptr; src_bits = src_pixmap->devPrivate.ptr; |