diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2011-12-19 18:37:08 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2011-12-19 20:11:08 +0000 |
commit | addf66dda7cecaee8e58f53bb4e8d725dfdd2717 (patch) | |
tree | 606f94f6f15f42b2e0b1c2582fab28237e9069bc | |
parent | 9b6ade12346efa5b9cc095ad44c7d71880a19ab0 (diff) |
sna: Tweak the rendering priorities
If the last operation was on the GPU, continue on the GPU if this
operation overlaps any GPU damage or does not overlap CPU damage.
Otherwise, if the last operation was on the CPU only switch to the GPU
if we do not overlap any CPU damage and overlap existing GPU damage.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/sna/sna_accel.c | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c index a88257fa..68fb7007 100644 --- a/src/sna/sna_accel.c +++ b/src/sna/sna_accel.c @@ -1048,20 +1048,29 @@ _sna_drawable_use_gpu_bo(DrawablePtr drawable, extents.y1 += dy; extents.y2 += dy; - if (priv->cpu_damage == NULL) - goto done; - - if (sna_damage_contains_box(priv->cpu_damage, - &extents) == PIXMAN_REGION_OUT) - goto done; - - if (!priv->gpu || priv->gpu_damage == NULL) - return FALSE; + if (priv->gpu) { + if (priv->gpu_damage && + sna_damage_contains_box(priv->gpu_damage, + &extents) != PIXMAN_REGION_OUT) + goto move_to_gpu; + + if (priv->cpu_damage && + sna_damage_contains_box(priv->cpu_damage, + &extents) != PIXMAN_REGION_OUT) + return FALSE; + } else { + if (priv->cpu_damage == NULL || + sna_damage_contains_box(priv->cpu_damage, + &extents) == PIXMAN_REGION_OUT) + goto done; - if (sna_damage_contains_box(priv->gpu_damage, - &extents) == PIXMAN_REGION_OUT) - return FALSE; + if (priv->gpu_damage == NULL || + sna_damage_contains_box(priv->gpu_damage, + &extents) == PIXMAN_REGION_OUT) + return FALSE; + } +move_to_gpu: sna_pixmap_move_area_to_gpu(pixmap, &extents); done: if (sna_damage_contains_box(priv->gpu_damage, |