diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2014-06-18 18:41:15 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2014-06-18 18:41:15 +0100 |
commit | 62aaf2ff4f8597067cf387865707baa00ed9a123 (patch) | |
tree | a6b77426217e9aae2b61ba2e8601731ee135a280 /src | |
parent | 83c0f034454ef0f474126a3398e5e790ac5ef842 (diff) |
sna: Skip redundant copies when already cloned
References: https://bugs.freedesktop.org/show_bug.cgi?id=77436
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src')
-rw-r--r-- | src/sna/sna_accel.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c index a2e93c21..c021652a 100644 --- a/src/sna/sna_accel.c +++ b/src/sna/sna_accel.c @@ -6120,18 +6120,25 @@ sna_copy_boxes(DrawablePtr src, DrawablePtr dst, GCPtr gc, goto fallback; } - /* XXX hack for firefox -- subsequent uses of src will be corrupt! */ - if (src_priv && - COW(src_priv->cow) == COW(dst_priv->cow) && - IS_COW_OWNER(dst_priv->cow)) { - DBG(("%s: ignoring cow reference for cousin copy\n", - __FUNCTION__)); - assert(src_priv->cpu_damage == NULL); - assert(dst_priv->move_to_gpu == NULL); - bo = dst_priv->gpu_bo; - damage = NULL; + if (src_priv && COW(src_priv->cow) == COW(dst_priv->cow) && alu == GXcopy) { + if ((dx | dy) == 0) { + DBG(("%s: ignoring cow for no op\n", + __FUNCTION__)); + return; + } else if (IS_COW_OWNER(dst_priv->cow)) { + /* XXX hack for firefox -- subsequent uses of src will be corrupt! */ + DBG(("%s: ignoring cow reference for cousin copy\n", + __FUNCTION__)); + assert(src_priv->cpu_damage == NULL); + assert(dst_priv->move_to_gpu == NULL); + bo = dst_priv->gpu_bo; + damage = NULL; + } else + goto discard_cow; } else { - unsigned hint = copy_prefer_gpu(sna, dst_priv, src_priv, region, src_dx, src_dy); + unsigned hint; +discard_cow: + hint = copy_prefer_gpu(sna, dst_priv, src_priv, region, src_dx, src_dy); if (replaces) { discard_cpu_damage(sna, dst_priv); hint |= REPLACES | IGNORE_CPU; |