diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2013-06-11 14:23:57 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2013-06-11 23:20:15 +0100 |
commit | 15b92c98755c709f41e59baeb206e5a3e56e3178 (patch) | |
tree | d6de35f9d37ceb370b6e0915f610baa8f9178194 /src | |
parent | 1392f296a3fc94bb64abe4c3370c2f3cd52bef9f (diff) |
sna: Make sure the source is coherent on the CPU before uploading
Similar to 7d91051c, but along the render path rather than CopyArea.
Makes the presumption that for the upload path the region is stored on
the CPU explicit.
References: https://bugs.freedesktop.org/show_bug.cgi?id=61628
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src')
-rw-r--r-- | src/sna/sna_render.c | 49 |
1 files changed, 30 insertions, 19 deletions
diff --git a/src/sna/sna_render.c b/src/sna/sna_render.c index 6e95e554..330bfadf 100644 --- a/src/sna/sna_render.c +++ b/src/sna/sna_render.c @@ -523,21 +523,20 @@ static struct kgem_bo *upload(struct sna *sna, priv = sna_pixmap(pixmap); if (priv) { + RegionRec region; + if (priv->cpu_damage == NULL) + return NULL; /* uninitialised */ + + region.extents = *box; + region.data = NULL; + if (!sna_drawable_move_region_to_cpu(&pixmap->drawable, + ®ion, MOVE_READ)) return NULL; - /* As we know this box is on the CPU just fixup the shadow */ - if (priv->mapped) { - pixmap->devPrivate.ptr = NULL; - priv->mapped = false; - } - if (pixmap->devPrivate.ptr == NULL) { - if (priv->ptr == NULL) /* uninitialised */ - return NULL; - assert(priv->stride); - pixmap->devPrivate.ptr = PTR(priv->ptr); - pixmap->devKind = priv->stride; - } + assert(!priv->mapped); + if (pixmap->devPrivate.ptr == NULL) + return NULL; /* uninitialised */ } bo = kgem_upload_source_image(&sna->kgem, @@ -1188,20 +1187,32 @@ sna_render_picture_extract(struct sna *sna, 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, + ®ion, 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 (bo != NULL && + if (priv != NULL && bo != NULL && box.x2 - box.x1 == pixmap->drawable.width && box.y2 - box.y1 == pixmap->drawable.height) { - struct sna_pixmap *priv = sna_pixmap(pixmap); - if (priv) { - assert(priv->gpu_damage == NULL); - assert(priv->gpu_bo == NULL); - kgem_proxy_bo_attach(bo, &priv->gpu_bo); - } + assert(priv->gpu_damage == NULL); + assert(priv->gpu_bo == NULL); + kgem_proxy_bo_attach(bo, &priv->gpu_bo); } } } |