summaryrefslogtreecommitdiff
path: root/src/sna/sna_trapezoids.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2011-12-15 17:52:20 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2011-12-17 21:26:35 +0000
commit8ef5d8c1955e2e2ee19c64730f600639ac42de55 (patch)
tree35f498c248c7e004cc64350a2f069f3212395b0c /src/sna/sna_trapezoids.c
parent6e47f283711d122d96384a1a82854c11644e6d68 (diff)
sna: Map the upload buffer using an LLC bo
In order to avoid having to perform a copy of the cacheable buffer into GPU space, we can map a bo as cacheable and write directly to its contents. This is only a win on systems that can avoid the clflush, and also we have to go to greater measures to avoid unnecessary serialisation upon that CPU bo. Sadly, we do not yet go to enough length to avoid negatively impacting ShmPutImage, but that does not appear to be a artefact of stalling upon a CPU buffer. Note, LLC is a SandyBridge feature enabled by default in kernel 3.1 and later. In time, we should be able to expose similar support for snoopable buffers for other generations. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/sna_trapezoids.c')
-rw-r--r--src/sna/sna_trapezoids.c44
1 files changed, 24 insertions, 20 deletions
diff --git a/src/sna/sna_trapezoids.c b/src/sna/sna_trapezoids.c
index 27987d87..287f8833 100644
--- a/src/sna/sna_trapezoids.c
+++ b/src/sna/sna_trapezoids.c
@@ -3176,7 +3176,8 @@ trapezoid_span_inplace(CARD8 op, PicturePtr src, PicturePtr dst,
}
region.data = NULL;
- if (!sna_drawable_move_region_to_cpu(dst->pDrawable, &region, true))
+ if (!sna_drawable_move_region_to_cpu(dst->pDrawable, &region,
+ MOVE_READ | MOVE_WRITE))
return true;
pixmap = get_drawable_pixmap(dst->pDrawable);
@@ -3313,16 +3314,20 @@ trapezoid_span_fallback(CARD8 op, PicturePtr src, PicturePtr dst,
region.extents.y2 = dst_y + extents.y2;
region.data = NULL;
- if (!sna_drawable_move_region_to_cpu(dst->pDrawable, &region, true))
+ if (!sna_drawable_move_region_to_cpu(dst->pDrawable, &region,
+ MOVE_READ | MOVE_WRITE))
goto done;
if (dst->alphaMap &&
- !sna_drawable_move_to_cpu(dst->alphaMap->pDrawable, true))
+ !sna_drawable_move_to_cpu(dst->alphaMap->pDrawable,
+ MOVE_READ | MOVE_WRITE))
goto done;
if (src->pDrawable) {
- if (!sna_drawable_move_to_cpu(src->pDrawable, false))
+ if (!sna_drawable_move_to_cpu(src->pDrawable,
+ MOVE_READ))
goto done;
if (src->alphaMap &&
- !sna_drawable_move_to_cpu(src->alphaMap->pDrawable, false))
+ !sna_drawable_move_to_cpu(src->alphaMap->pDrawable,
+ MOVE_READ))
goto done;
}
@@ -3661,20 +3666,18 @@ skip:
static void mark_damaged(PixmapPtr pixmap, struct sna_pixmap *priv,
BoxPtr box, int16_t x, int16_t y)
{
- if (!priv->gpu_only) {
- box->x1 += x; box->x2 += x;
- box->y1 += y; box->y2 += y;
- if (box->x1 <= 0 && box->y1 <= 0 &&
- box->x2 >= pixmap->drawable.width &&
- box->y2 >= pixmap->drawable.height) {
- sna_damage_destroy(&priv->cpu_damage);
- sna_damage_all(&priv->gpu_damage,
- pixmap->drawable.width,
- pixmap->drawable.height);
- } else {
- sna_damage_add_box(&priv->gpu_damage, box);
- sna_damage_subtract_box(&priv->cpu_damage, box);
- }
+ box->x1 += x; box->x2 += x;
+ box->y1 += y; box->y2 += y;
+ if (box->x1 <= 0 && box->y1 <= 0 &&
+ box->x2 >= pixmap->drawable.width &&
+ box->y2 >= pixmap->drawable.height) {
+ sna_damage_destroy(&priv->cpu_damage);
+ sna_damage_all(&priv->gpu_damage,
+ pixmap->drawable.width,
+ pixmap->drawable.height);
+ } else {
+ sna_damage_add_box(&priv->gpu_damage, box);
+ sna_damage_subtract_box(&priv->cpu_damage, box);
}
}
@@ -3887,7 +3890,8 @@ sna_add_traps(PicturePtr picture, INT16 x, INT16 y, int n, xTrap *t)
}
DBG(("%s -- fallback\n", __FUNCTION__));
- if (sna_drawable_move_to_cpu(picture->pDrawable, true))
+ if (sna_drawable_move_to_cpu(picture->pDrawable,
+ MOVE_READ | MOVE_WRITE))
fbAddTraps(picture, x, y, n, t);
}