diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2012-03-18 10:55:27 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2012-03-18 15:11:30 +0000 |
commit | 28c089781fdf74a9bac2e138e65383748558fcc1 (patch) | |
tree | e5e235c57d64a31fff3bc280d51cb00ba6035a4d | |
parent | 79258fe560d08dd3dd22b4782360e1597e54948c (diff) |
sna: Fixup the cpu shadow mappings before uploading the box
On the off-chance we arrive here with a pointer to the GTT mapping.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/sna/sna_render.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/src/sna/sna_render.c b/src/sna/sna_render.c index 8be3e72f..542cdb95 100644 --- a/src/sna/sna_render.c +++ b/src/sna/sna_render.c @@ -442,6 +442,7 @@ static struct kgem_bo *upload(struct sna *sna, PixmapPtr pixmap, BoxPtr box) { + struct sna_pixmap *priv; struct kgem_bo *bo; DBG(("%s: box=(%d, %d), (%d, %d), pixmap=%dx%d\n", @@ -451,6 +452,19 @@ static struct kgem_bo *upload(struct sna *sna, assert(box->x2 <= pixmap->drawable.width); assert(box->y2 <= pixmap->drawable.height); + priv = sna_pixmap(pixmap); + if (priv) { + /* 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) { + pixmap->devPrivate.ptr = priv->ptr; + pixmap->devKind = priv->stride; + } + } + bo = kgem_upload_source_image(&sna->kgem, pixmap->devPrivate.ptr, box, pixmap->devKind, @@ -463,13 +477,11 @@ static struct kgem_bo *upload(struct sna *sna, channel->scale[0] = 1.f/channel->width; channel->scale[1] = 1.f/channel->height; - if (pixmap->usage_hint == 0 && + if (priv && + pixmap->usage_hint == 0 && channel->width == pixmap->drawable.width && - channel->height == pixmap->drawable.height) { - struct sna_pixmap *priv = sna_pixmap(pixmap); - if (priv) - kgem_proxy_bo_attach(bo, &priv->gpu_bo); - } + channel->height == pixmap->drawable.height) + kgem_proxy_bo_attach(bo, &priv->gpu_bo); } return bo; |