diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2013-11-04 11:30:39 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2013-11-04 11:30:39 +0000 |
commit | 94f9beb8fbb31c2b6158e492e02ff05c9ebc674f (patch) | |
tree | 5ef215a34a966a7b8a63c52c82e26e76120886f5 /src/sna/sna_io.c | |
parent | ad3959324c02de2e73e7d1142d42248f7dbb4518 (diff) |
sna: Remove the replace indirection prior to performing write_boxes
As write_boxes itself decides whether or not to stage the upload into
the destination bo, we can destroy the temporary allocation along the
write_boxes fallback path (i.e. after failing to map the destination
bo).
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/sna_io.c')
-rw-r--r-- | src/sna/sna_io.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/src/sna/sna_io.c b/src/sna/sna_io.c index 75d9fe10..0aac61eb 100644 --- a/src/sna/sna_io.c +++ b/src/sna/sna_io.c @@ -1841,6 +1841,11 @@ bool sna_replace(struct sna *sna, PixmapPtr pixmap, } else { BoxRec box; + if (bo != priv->gpu_bo) { + kgem_bo_destroy(&sna->kgem, bo); + bo = priv->gpu_bo; + } + box.x1 = box.y1 = 0; box.x2 = pixmap->drawable.width; box.y2 = pixmap->drawable.height; @@ -1849,7 +1854,7 @@ bool sna_replace(struct sna *sna, PixmapPtr pixmap, bo, 0, 0, src, stride, 0, 0, &box, 1)) - goto err; + return false; } done: @@ -1860,11 +1865,6 @@ done: } return true; - -err: - if (bo != priv->gpu_bo) - kgem_bo_destroy(&sna->kgem, bo); - return false; } bool @@ -1887,7 +1887,8 @@ sna_replace__xor(struct sna *sna, PixmapPtr pixmap, kgem_bo_undo(&sna->kgem, bo); - if (kgem_bo_is_busy(bo)) { + if (!kgem_bo_can_map(&sna->kgem, bo) || + __kgem_bo_is_busy(&sna->kgem, bo)) { struct kgem_bo *new_bo; new_bo = kgem_create_2d(&sna->kgem, @@ -1914,6 +1915,11 @@ sna_replace__xor(struct sna *sna, PixmapPtr pixmap, } else { BoxRec box; + if (bo != priv->gpu_bo) { + kgem_bo_destroy(&sna->kgem, bo); + bo = priv->gpu_bo; + } + box.x1 = box.y1 = 0; box.x2 = pixmap->drawable.width; box.y2 = pixmap->drawable.height; @@ -1923,7 +1929,7 @@ sna_replace__xor(struct sna *sna, PixmapPtr pixmap, src, stride, 0, 0, &box, 1, and, or)) - goto err; + return false; } if (bo != priv->gpu_bo) { @@ -1933,9 +1939,4 @@ sna_replace__xor(struct sna *sna, PixmapPtr pixmap, } return true; - -err: - if (bo != priv->gpu_bo) - kgem_bo_destroy(&sna->kgem, bo); - return false; } |