summaryrefslogtreecommitdiff
path: root/src/sna/sna_accel.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2013-01-15 18:59:15 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2013-01-15 22:24:08 +0000
commit1287c3a24c277cb42930d8af2943b9f7b016f31d (patch)
treef987c9434bb31bf7e7ad48d6db0d255ee180a2c1 /src/sna/sna_accel.c
parentda4972eec57e662b98a7abced6338ceb8a533a48 (diff)
sna: Specialise sna_get_image_blt for clears to avoid sync readback
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.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 27f2920a..a6affcfe 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -13411,6 +13411,26 @@ sna_get_image_blt(DrawablePtr drawable,
if (priv == NULL)
return false;
+ if (priv->clear) {
+ int w = region->extents.x2 - region->extents.x1;
+ int h = region->extents.y2 - region->extents.y1;
+
+ pitch = PixmapBytePad(w, pixmap->drawable.depth);
+ if (priv->clear_color == 0 ||
+ pixmap->drawable.bitsPerPixel == 8) {
+ memset(dst, priv->clear_color, pitch * h);
+ } else {
+ pixman_fill((uint32_t *)dst,
+ pitch/sizeof(uint32_t),
+ pixmap->drawable.bitsPerPixel,
+ 0, 0,
+ w, h,
+ priv->clear_color);
+ }
+
+ return true;
+ }
+
if (!sna->kgem.has_userptr)
return false;