summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2013-03-18 14:49:58 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2013-03-18 15:11:24 +0000
commit28371a34fa83f70a7af3c8d3bfd6c7cef9e35073 (patch)
treebb01eae3b0af7d5b590b96684c6eeb4a95e21b06
parent16dac417c8049d65b3641e0f662865772faad61f (diff)
sna: Skip processing an all-clipped-out glyph
Along the slow path, skip all processing of glyphs that are not visible. This is important as the slow path handles the per-glyph redirection case, which is much more expensive. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna.h15
-rw-r--r--src/sna/sna_accel.c15
-rw-r--r--src/sna/sna_glyphs.c10
-rw-r--r--src/sna/sna_io.c15
-rw-r--r--src/sna/sna_tiling.c15
5 files changed, 25 insertions, 45 deletions
diff --git a/src/sna/sna.h b/src/sna/sna.h
index a244b97d..13a5ce32 100644
--- a/src/sna/sna.h
+++ b/src/sna/sna.h
@@ -864,6 +864,21 @@ inline static bool is_clipped(const RegionRec *r,
r->extents.y2 - r->extents.y1 != d->height);
}
+inline static bool
+box_intersect(BoxPtr a, const BoxRec *b)
+{
+ if (a->x1 < b->x1)
+ a->x1 = b->x1;
+ if (a->x2 > b->x2)
+ a->x2 = b->x2;
+ if (a->y1 < b->y1)
+ a->y1 = b->y1;
+ if (a->y2 > b->y2)
+ a->y2 = b->y2;
+
+ return a->x1 < a->x2 && a->y1 < a->y2;
+}
+
unsigned sna_cpu_detect(void);
char *sna_cpu_features_to_string(unsigned features, char *line);
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index f654c1a1..a2528f6c 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -4727,21 +4727,6 @@ typedef void (*sna_copy_func)(DrawablePtr src, DrawablePtr dst, GCPtr gc,
RegionPtr region, int dx, int dy,
Pixel bitPlane, void *closure);
-inline static bool
-box_intersect(BoxPtr a, const BoxRec *b)
-{
- if (a->x1 < b->x1)
- a->x1 = b->x1;
- if (a->x2 > b->x2)
- a->x2 = b->x2;
- if (a->y1 < b->y1)
- a->y1 = b->y1;
- if (a->y2 > b->y2)
- a->y2 = b->y2;
-
- return a->x1 < a->x2 && a->y1 < a->y2;
-}
-
static RegionPtr
sna_do_copy(DrawablePtr src, DrawablePtr dst, GCPtr gc,
int sx, int sy,
diff --git a/src/sna/sna_glyphs.c b/src/sna/sna_glyphs.c
index 3b1cf379..2f44113a 100644
--- a/src/sna/sna_glyphs.c
+++ b/src/sna/sna_glyphs.c
@@ -692,11 +692,21 @@ glyphs_slow(struct sna *sna,
GlyphPtr glyph = *glyphs++;
struct sna_glyph priv;
BoxPtr rects;
+ BoxRec box;
int nrect;
if (!glyph_valid(glyph))
goto next_glyph;
+ box.x1 = x - glyph->info.x;
+ box.y1 = y - glyph->info.y;
+ box.x2 = bound(box.x1, glyph->info.width);
+ box.y2 = bound(box.y1, glyph->info.height);
+
+ if (!box_intersect(&box,
+ &dst->pCompositeClip->extents))
+ goto next_glyph;
+
priv = *sna_glyph(glyph);
if (priv.atlas == NULL) {
if (!glyph_cache(screen, &sna->render, glyph)) {
diff --git a/src/sna/sna_io.c b/src/sna/sna_io.c
index 41322ad2..540f3a60 100644
--- a/src/sna/sna_io.c
+++ b/src/sna/sna_io.c
@@ -41,21 +41,6 @@
/* XXX Need to avoid using GTT fenced access for I915_TILING_Y on 855GM */
-static bool
-box_intersect(BoxPtr a, const BoxRec *b)
-{
- if (a->x1 < b->x1)
- a->x1 = b->x1;
- if (a->x2 > b->x2)
- a->x2 = b->x2;
- if (a->y1 < b->y1)
- a->y1 = b->y1;
- if (a->y2 > b->y2)
- a->y2 = b->y2;
-
- return a->x1 < a->x2 && a->y1 < a->y2;
-}
-
static inline bool upload_too_large(struct sna *sna, int width, int height)
{
return width * height * 4 > sna->kgem.max_upload_tile_size;
diff --git a/src/sna/sna_tiling.c b/src/sna/sna_tiling.c
index 019b50a5..02ab59dd 100644
--- a/src/sna/sna_tiling.c
+++ b/src/sna/sna_tiling.c
@@ -795,21 +795,6 @@ done:
return ret;
}
-static bool
-box_intersect(BoxPtr a, const BoxRec *b)
-{
- if (a->x1 < b->x1)
- a->x1 = b->x1;
- if (a->x2 > b->x2)
- a->x2 = b->x2;
- if (a->y1 < b->y1)
- a->y1 = b->y1;
- if (a->y2 > b->y2)
- a->y2 = b->y2;
-
- return a->x1 < a->x2 && a->y1 < a->y2;
-}
-
bool
sna_tiling_copy_boxes(struct sna *sna, uint8_t alu,
PixmapPtr src, struct kgem_bo *src_bo, int16_t src_dx, int16_t src_dy,