st/xorg: If migrating from a sw pixmap to a hw pixmap upload old contents
authorJakob Bornecrantz <jakob@vmware.com>
Fri, 28 Aug 2009 14:56:59 +0000 (16:56 +0200)
committerJakob Bornecrantz <jakob@vmware.com>
Fri, 28 Aug 2009 15:10:58 +0000 (17:10 +0200)
src/gallium/state_trackers/xorg/xorg_exa.c

index 1650a06ca68b02abd7bf060ea6fd6edbbb7e2963..18afa01dbd51a76c46ed6f1dfadec08b6087b3db 100644 (file)
@@ -496,6 +496,21 @@ ExaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height,
                        width, height, pPixData, pPixmap->devKind, 0, 0);
         exa->scrn->transfer_unmap(exa->scrn, transfer);
         exa->scrn->tex_transfer_destroy(transfer);
+    } else if (priv->tex && pPixmap->devPrivate.ptr) {
+       struct pipe_transfer *transfer;
+
+       if (priv->map_count != 0)
+           FatalError("doing ExaModifyPixmapHeader on mapped buffer\n");
+
+       transfer =
+           exa->scrn->get_tex_transfer(exa->scrn, priv->tex, 0, 0, 0,
+                                       PIPE_TRANSFER_WRITE,
+                                       0, 0, width, height);
+        util_copy_rect(exa->scrn->transfer_map(exa->scrn, transfer),
+                       &priv->tex->block, transfer->stride, 0, 0,
+                       width, height, pPixmap->devPrivate.ptr, pPixmap->devKind, 0, 0);
+        exa->scrn->transfer_unmap(exa->scrn, transfer);
+        exa->scrn->tex_transfer_destroy(transfer);
     }
 
     return TRUE;