diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2012-06-29 15:03:12 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2012-06-29 15:15:21 +0100 |
commit | 67b87e4f7cf6c3ab9cfccc9fe43a824bfe84f393 (patch) | |
tree | 71b508fdb7699d2e8648c6896c64932d96086725 /src/sna/sna_dri.c | |
parent | eae5e1275cd11703de2bca67dacd1d57129b561a (diff) |
sna/dri: Optimise clip reduction with copy-to-front to an unclipped Window
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/sna_dri.c')
-rw-r--r-- | src/sna/sna_dri.c | 51 |
1 files changed, 27 insertions, 24 deletions
diff --git a/src/sna/sna_dri.c b/src/sna/sna_dri.c index dddcc738..87ddba06 100644 --- a/src/sna/sna_dri.c +++ b/src/sna/sna_dri.c @@ -451,18 +451,18 @@ sna_dri_copy_to_front(struct sna *sna, DrawablePtr draw, RegionPtr region, struct kgem_bo *bo = NULL; bool flush = false; xf86CrtcPtr crtc; - BoxRec box, *boxes; + BoxRec *boxes; int16_t dx, dy; int n; - box.x1 = draw->x; - box.y1 = draw->y; - box.x2 = draw->x + draw->width; - box.y2 = draw->y + draw->height; + clip.extents.x1 = draw->x; + clip.extents.y1 = draw->y; + clip.extents.x2 = draw->x + draw->width; + clip.extents.y2 = draw->y + draw->height; + clip.data = NULL; if (region) { pixman_region_translate(region, draw->x, draw->y); - pixman_region_init_rects(&clip, &box, 1); pixman_region_intersect(&clip, &clip, region); region = &clip; @@ -476,28 +476,32 @@ sna_dri_copy_to_front(struct sna *sna, DrawablePtr draw, RegionPtr region, if (draw->type != DRAWABLE_PIXMAP) { WindowPtr win = (WindowPtr)draw; - DBG(("%s: draw=(%d, %d), delta=(%d, %d), clip.extents=(%d, %d), (%d, %d)\n", - __FUNCTION__, draw->x, draw->y, - get_drawable_dx(draw), get_drawable_dy(draw), - win->clipList.extents.x1, win->clipList.extents.y1, - win->clipList.extents.x2, win->clipList.extents.y2)); + if (win->clipList.data || + win->clipList.extents.x2 - win->clipList.extents.x1 != draw->width || + win->clipList.extents.y2 - win->clipList.extents.y1 != draw->height) { + DBG(("%s: draw=(%d, %d), delta=(%d, %d), clip.extents=(%d, %d), (%d, %d)\n", + __FUNCTION__, draw->x, draw->y, + get_drawable_dx(draw), get_drawable_dy(draw), + win->clipList.extents.x1, win->clipList.extents.y1, + win->clipList.extents.x2, win->clipList.extents.y2)); + + if (region == NULL) + region = &clip; + + pixman_region_intersect(&clip, &win->clipList, region); + if (!pixman_region_not_empty(&clip)) { + DBG(("%s: all clipped\n", __FUNCTION__)); + return NULL; + } - if (region == NULL) { - pixman_region_init_rects(&clip, &box, 1); region = &clip; } - pixman_region_intersect(region, &win->clipList, region); - if (!pixman_region_not_empty(region)) { - DBG(("%s: all clipped\n", __FUNCTION__)); - return NULL; - } - if (sync && sna_pixmap_is_scanout(sna, pixmap)) { - crtc = sna_covering_crtc(sna->scrn, ®ion->extents, NULL); + crtc = sna_covering_crtc(sna->scrn, &clip.extents, NULL); if (crtc) flush = sna_wait_for_scanline(sna, pixmap, crtc, - ®ion->extents); + &clip.extents); } get_drawable_deltas(draw, pixmap, &dx, &dy); @@ -525,9 +529,8 @@ sna_dri_copy_to_front(struct sna *sna, DrawablePtr draw, RegionPtr region, n = REGION_NUM_RECTS(region); assert(n); } else { - pixman_region_init_rects(&clip, &box, 1); region = &clip; - boxes = &box; + boxes = &clip.extents; n = 1; } sna->render.copy_boxes(sna, GXcopy, @@ -546,7 +549,7 @@ sna_dri_copy_to_front(struct sna *sna, DrawablePtr draw, RegionPtr region, DamageRegionAppend(&pixmap->drawable, region); DamageRegionProcessPending(&pixmap->drawable); - if (region == &clip) + if (clip.data) pixman_region_fini(&clip); return bo; |