summaryrefslogtreecommitdiff
path: root/src/sna/sna_accel.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2013-06-25 21:12:23 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2013-06-26 10:02:40 +0100
commite033a28bcb37867f3c947475714e1ef45c868825 (patch)
treef17740e37f5759a072a178f595e39da7d0a3650c /src/sna/sna_accel.c
parentb77c334a26c55d3028971897dcba21407a7a4743 (diff)
sna: Optimize clears to white
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/sna_accel.c')
-rw-r--r--src/sna/sna_accel.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 65d97c74..47b25095 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -1987,8 +1987,9 @@ skip_inplace_map:
assert(!priv->mapped);
if (priv->clear) {
- DBG(("%s: applying clear [%08x]\n",
- __FUNCTION__, priv->clear_color));
+ DBG(("%s: applying clear [%08x] size=%dx%d, stride=%d (total=%d)\n",
+ __FUNCTION__, priv->clear_color, pixmap->drawable.width, pixmap->drawable.height,
+ pixmap->devKind, pixmap->devKind * pixmap->drawable.height));
if (priv->cpu_bo) {
DBG(("%s: syncing CPU bo\n", __FUNCTION__));
@@ -1996,7 +1997,9 @@ skip_inplace_map:
assert(pixmap->devPrivate.ptr == (void *)((unsigned long)priv->cpu_bo->map & ~3));
}
- if (priv->clear_color == 0 || pixmap->drawable.bitsPerPixel == 8) {
+ if (priv->clear_color == 0 ||
+ pixmap->drawable.bitsPerPixel == 8 ||
+ priv->clear_color == (1 << pixmap->drawable.bitsPerPixel) - 1) {
memset(pixmap->devPrivate.ptr, priv->clear_color,
pixmap->devKind * pixmap->drawable.height);
} else {
@@ -14208,7 +14211,8 @@ sna_get_image_blt(DrawablePtr drawable,
pitch = PixmapBytePad(w, pixmap->drawable.depth);
if (priv->clear_color == 0 ||
- pixmap->drawable.bitsPerPixel == 8) {
+ pixmap->drawable.bitsPerPixel == 8 ||
+ priv->clear_color == (1U << pixmap->drawable.bitsPerPixel) - 1) {
memset(dst, priv->clear_color, pitch * h);
} else {
pixman_fill((uint32_t *)dst,