summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-01-06 00:21:29 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2012-01-06 00:21:29 +0000
commit69c556c310da544ddb66c2441f5d06dca29fb9f3 (patch)
tree57fdca3f5ef014062fe42d5764529d36fe685033
parent34c4dbe825a45315b05f0bd49539cbcf5de276f1 (diff)
sna: Rearrange use-cpu-bo to avoid reducing GPU damage
If we spot that the region is wholly contained within the CPU damage initially, we can conclude that is not in the GPU damage without reduction. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_render.c33
1 files changed, 20 insertions, 13 deletions
diff --git a/src/sna/sna_render.c b/src/sna/sna_render.c
index 51556815..11b36898 100644
--- a/src/sna/sna_render.c
+++ b/src/sna/sna_render.c
@@ -256,21 +256,28 @@ use_cpu_bo(struct sna *sna, PixmapPtr pixmap, const BoxRec *box)
return NULL;
}
- if (priv->gpu_bo &&
- sna_damage_contains_box(priv->cpu_damage,
- box) == PIXMAN_REGION_OUT) {
- DBG(("%s: has GPU bo and no damage to upload\n", __FUNCTION__));
- return NULL;
- }
+ if (priv->gpu_bo) {
+ switch (sna_damage_contains_box(priv->cpu_damage, box)) {
+ case PIXMAN_REGION_OUT:
+ DBG(("%s: has GPU bo and no damage to upload\n",
+ __FUNCTION__));
+ return NULL;
- if (sna_damage_contains_box(priv->gpu_damage,
- box) != PIXMAN_REGION_OUT) {
- DBG(("%s: box is damaged on the GPU\n", __FUNCTION__));
- return NULL;
- }
+ case PIXMAN_REGION_IN:
+ DBG(("%s: has GPU bo but box is completely on CPU\n",
+ __FUNCTION__));
+ break;
+ default:
+ if (sna_damage_contains_box(priv->gpu_damage,
+ box) != PIXMAN_REGION_OUT) {
+ DBG(("%s: box is damaged on the GPU\n",
+ __FUNCTION__));
+ return NULL;
+ }
+ break;
+ }
- if (priv->gpu_bo) {
- if (priv->gpu_bo != I915_TILING_NONE &&
+ if (priv->gpu_bo->tiling != I915_TILING_NONE &&
priv->cpu_bo->pitch >= 4096) {
DBG(("%s: GPU bo exists and is tiled [%d], upload\n",
__FUNCTION__, priv->gpu_bo->tiling));