diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2012-03-15 13:18:43 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2012-03-15 13:32:02 +0000 |
commit | 77c9c03b102e6fac2279f0085034557bd68c5112 (patch) | |
tree | 97d4e349fa9fd379d1e3ee8fd6dc0e9b4bdc29fd | |
parent | 0e2fbb6a1c1ad6b0971d07a91a790b0b3236dad3 (diff) |
sna: Fixup the shadow pixmap pointer for move-to-gpu
If we choose not to use the CPU bo for the upload (because we fear the
subsequent synchronisation cost), we need to fixup the shadow pointer
before dereferencing it.
On the move-to-cpu side, the fixup is already performed as we will need
to access the shadow pixels for the subsequent drawing operation.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/sna/sna_accel.c | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c index 63afaaa9..03ac4002 100644 --- a/src/sna/sna_accel.c +++ b/src/sna/sna_accel.c @@ -1751,6 +1751,11 @@ sna_pixmap_move_area_to_gpu(PixmapPtr pixmap, BoxPtr box, unsigned int flags) pixmap, priv->gpu_bo, 0, 0, box, n); if (!ok) { + if (pixmap->devPrivate.ptr == NULL) { + assert(priv->stride && priv->ptr); + pixmap->devPrivate.ptr = priv->ptr; + pixmap->devKind = priv->stride; + } if (n == 1 && !priv->pinned && box->x1 <= 0 && box->y1 <= 0 && box->x2 >= pixmap->drawable.width && @@ -1783,13 +1788,19 @@ sna_pixmap_move_area_to_gpu(PixmapPtr pixmap, BoxPtr box, unsigned int flags) pixmap, priv->cpu_bo, 0, 0, pixmap, priv->gpu_bo, 0, 0, box, 1); - if (!ok) + if (!ok) { + if (pixmap->devPrivate.ptr == NULL) { + assert(priv->stride && priv->ptr); + pixmap->devPrivate.ptr = priv->ptr; + pixmap->devKind = priv->stride; + } ok = sna_write_boxes(sna, pixmap, priv->gpu_bo, 0, 0, pixmap->devPrivate.ptr, pixmap->devKind, 0, 0, box, 1); + } if (!ok) return false; @@ -1806,13 +1817,19 @@ sna_pixmap_move_area_to_gpu(PixmapPtr pixmap, BoxPtr box, unsigned int flags) pixmap, priv->cpu_bo, 0, 0, pixmap, priv->gpu_bo, 0, 0, box, n); - if (!ok) + if (!ok) { + if (pixmap->devPrivate.ptr == NULL) { + assert(priv->stride && priv->ptr); + pixmap->devPrivate.ptr = priv->ptr; + pixmap->devKind = priv->stride; + } ok = sna_write_boxes(sna, pixmap, priv->gpu_bo, 0, 0, pixmap->devPrivate.ptr, pixmap->devKind, 0, 0, box, n); + } if (!ok) return false; @@ -2272,7 +2289,11 @@ sna_pixmap_move_to_gpu(PixmapPtr pixmap, unsigned flags) pixmap, priv->gpu_bo, 0, 0, box, n); if (!ok) { - assert(pixmap->devPrivate.ptr != NULL); + if (pixmap->devPrivate.ptr == NULL) { + assert(priv->stride && priv->ptr); + pixmap->devPrivate.ptr = priv->ptr; + pixmap->devKind = priv->stride; + } if (n == 1 && !priv->pinned && (box->x2 - box->x1) >= pixmap->drawable.width && (box->y2 - box->y1) >= pixmap->drawable.height) { |