summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2014-07-04 12:39:01 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2014-07-04 12:39:01 +0100
commitd3ccb3f3b2a3cb4c8b51d58d185dd10b85e025eb (patch)
treebfc24e91c6ffc232d48516f48455ddf865fd9e98
parent2e0763088f8e159b414cec5c056cc4c91a34766e (diff)
downloadxorg-driver-xf86-video-intel-d3ccb3f3b2a3cb4c8b51d58d185dd10b85e025eb.tar.gz
sna: Convert a clear tile into a solid fill
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_accel.c32
1 files changed, 25 insertions, 7 deletions
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 0b16bd00..b6d41957 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -12601,6 +12601,26 @@ out_gc:
return ret;
}
+inline static bool tile_is_solid(GCPtr gc, uint32_t *pixel)
+{
+ PixmapPtr tile = gc->tile.pixmap;
+ struct sna_pixmap *priv;
+
+ if ((tile->drawable.width | tile->drawable.height) == 1) {
+ DBG(("%s: single pixel tile pixmap, converting to solid fill\n", __FUNCTION__));
+ *pixel = get_pixel(tile);
+ return true;
+ }
+
+ priv = sna_pixmap(tile);
+ if (priv == NULL || !priv->clear)
+ return false;
+
+ DBG(("%s: tile is clear, converting to solid fill\n", __FUNCTION__));
+ *pixel = priv->clear_color;
+ return true;
+}
+
static bool
sna_poly_fill_rect_tiled_blt(DrawablePtr drawable,
struct kgem_bo *bo,
@@ -12617,6 +12637,7 @@ sna_poly_fill_rect_tiled_blt(DrawablePtr drawable,
CARD32 alu = gc->alu;
int tile_width, tile_height;
int16_t dx, dy;
+ uint32_t pixel;
DBG(("%s pixmap=%ld, x %d [(%d, %d)x(%d, %d)...], clipped? %d\n",
__FUNCTION__, pixmap->drawable.serialNumber,
@@ -12626,22 +12647,19 @@ sna_poly_fill_rect_tiled_blt(DrawablePtr drawable,
assert(tile->drawable.depth == drawable->depth);
assert(bo);
- tile_width = tile->drawable.width;
- tile_height = tile->drawable.height;
- if ((tile_width | tile_height) == 1) {
- DBG(("%s: single pixel tile pixmap ,converting to solid fill\n",
- __FUNCTION__));
+ if (tile_is_solid(gc, &pixel))
return sna_poly_fill_rect_blt(drawable, bo, damage,
- gc, get_pixel(tile),
+ gc, pixel,
n, rect,
extents, clipped);
- }
/* XXX [248]x[238] tiling can be reduced to a pattern fill.
* Also we can do the lg2 reduction for BLT and use repeat modes for
* RENDER.
*/
+ tile_width = tile->drawable.width;
+ tile_height = tile->drawable.height;
if ((tile_width | tile_height) == 8) {
bool ret;