summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2013-11-28 13:03:29 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2013-11-28 13:03:29 +0000
commit64f1fbb465bdd092c4ea4aafe10382ebe7b84ecb (patch)
treef5f234358baa481a5894b90d9db0c23f8960e1ab
parent1200aae4815cdbc6a4f242c264b2736e6fe0fa12 (diff)
sna: Tidy a split conditional in an picture upload
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_render.c66
1 files changed, 32 insertions, 34 deletions
diff --git a/src/sna/sna_render.c b/src/sna/sna_render.c
index 6f13c214..c183b285 100644
--- a/src/sna/sna_render.c
+++ b/src/sna/sna_render.c
@@ -1203,41 +1203,8 @@ sna_render_picture_extract(struct sna *sna,
}
src_bo = use_cpu_bo(sna, pixmap, &box, true);
- if (src_bo == NULL) {
+ if (src_bo == NULL)
src_bo = move_to_gpu(pixmap, &box, false);
- if (src_bo == NULL) {
- struct sna_pixmap *priv = sna_pixmap(pixmap);
- if (priv) {
- RegionRec region;
-
- region.extents = box;
- region.data = NULL;
- if (!sna_drawable_move_region_to_cpu(&pixmap->drawable,
- &region, MOVE_READ))
- return 0;
-
- assert(!priv->mapped);
- if (pixmap->devPrivate.ptr == NULL)
- return 0; /* uninitialised */
- }
-
- bo = kgem_upload_source_image(&sna->kgem,
- pixmap->devPrivate.ptr,
- &box,
- pixmap->devKind,
- pixmap->drawable.bitsPerPixel);
- if (priv != NULL && bo != NULL &&
- box.x2 - box.x1 == pixmap->drawable.width &&
- box.y2 - box.y1 == pixmap->drawable.height) {
- DBG(("%s: adding upload cache to pixmap=%ld\n",
- __FUNCTION__, pixmap->drawable.serialNumber));
- assert(priv->gpu_damage == NULL);
- assert(priv->gpu_bo == NULL);
- assert(bo->proxy != NULL);
- kgem_proxy_bo_attach(bo, &priv->gpu_bo);
- }
- }
- }
if (src_bo) {
bo = kgem_create_2d(&sna->kgem, w, h,
pixmap->drawable.bitsPerPixel,
@@ -1265,6 +1232,37 @@ sna_render_picture_extract(struct sna *sna,
bo = NULL;
}
}
+ } else {
+ struct sna_pixmap *priv = sna_pixmap(pixmap);
+ if (priv) {
+ RegionRec region;
+
+ region.extents = box;
+ region.data = NULL;
+ if (!sna_drawable_move_region_to_cpu(&pixmap->drawable,
+ &region, MOVE_READ))
+ return 0;
+
+ assert(!priv->mapped);
+ if (pixmap->devPrivate.ptr == NULL)
+ return 0; /* uninitialised */
+ }
+
+ bo = kgem_upload_source_image(&sna->kgem,
+ pixmap->devPrivate.ptr,
+ &box,
+ pixmap->devKind,
+ pixmap->drawable.bitsPerPixel);
+ if (priv != NULL && bo != NULL &&
+ box.x2 - box.x1 == pixmap->drawable.width &&
+ box.y2 - box.y1 == pixmap->drawable.height) {
+ DBG(("%s: adding upload cache to pixmap=%ld\n",
+ __FUNCTION__, pixmap->drawable.serialNumber));
+ assert(priv->gpu_damage == NULL);
+ assert(priv->gpu_bo == NULL);
+ assert(bo->proxy != NULL);
+ kgem_proxy_bo_attach(bo, &priv->gpu_bo);
+ }
}
if (bo == NULL) {