svga: allow copy box in svga_transfer_dma_band()
authorCharmaine Lee <charmainel@vmware.com>
Tue, 31 May 2016 23:33:52 +0000 (16:33 -0700)
committerBrian Paul <brianp@vmware.com>
Thu, 2 Jun 2016 21:03:41 +0000 (15:03 -0600)
Instead of just allow copy of a rectangle in svga_transfer_dma_band(),
this patch allows it to copy a box, hence allows copy a 3d texture
in one transfer.

Fixes black screen in running Heaven after commit fb9fe35. (Bug 1663282)

Tested with Heaven, glretrace, piglit.

Reviewed-by: Sinclair Yeh <syeh@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
src/gallium/drivers/svga/svga_resource_texture.c

index b7e8549b7828b7192f7f168ff5b1ec7d5e4d919c..b2c302835df0bb6d71e7b2005b62a887339d6b8b 100644 (file)
@@ -51,7 +51,9 @@ static void
 svga_transfer_dma_band(struct svga_context *svga,
                        struct svga_transfer *st,
                        SVGA3dTransferType transfer,
-                       unsigned y, unsigned h, unsigned srcy,
+                       unsigned x, unsigned y, unsigned z,
+                       unsigned w, unsigned h, unsigned d,
+                       unsigned srcx, unsigned srcy, unsigned srcz,
                        SVGA3dSurfaceDMAFlags flags)
 {
    struct svga_texture *texture = svga_texture(st->base.resource);
@@ -60,27 +62,27 @@ svga_transfer_dma_band(struct svga_context *svga,
 
    assert(!st->use_direct_map);
 
-   box.x = st->base.box.x;
+   box.x = x;
    box.y = y;
-   box.z = st->base.box.z;
-   box.w = st->base.box.width;
+   box.z = z;
+   box.w = w;
    box.h = h;
-   box.d = 1;
-   box.srcx = 0;
+   box.d = d;
+   box.srcx = srcx;
    box.srcy = srcy;
-   box.srcz = 0;
+   box.srcz = srcz;
 
    SVGA_DBG(DEBUG_DMA, "dma %s sid %p, face %u, (%u, %u, %u) - "
             "(%u, %u, %u), %ubpp\n",
             transfer == SVGA3D_WRITE_HOST_VRAM ? "to" : "from",
             texture->handle,
             st->slice,
-            st->base.box.x,
+            x,
             y,
-            box.z,
-            st->base.box.x + st->base.box.width,
+            z,
+            x + w,
             y + h,
-            box.z + 1,
+            z + 1,
             util_format_get_blocksize(texture->b.b.format) * 8 /
             (util_format_get_blockwidth(texture->b.b.format)
              * util_format_get_blockheight(texture->b.b.format)));
@@ -119,7 +121,9 @@ svga_transfer_dma(struct svga_context *svga,
    if (!st->swbuf) {
       /* Do the DMA transfer in a single go */
       svga_transfer_dma_band(svga, st, transfer,
-                             st->base.box.y, st->base.box.height, 0,
+                             st->base.box.x, st->base.box.y, st->base.box.z,
+                             st->base.box.width, st->base.box.height, st->base.box.depth,
+                             0, 0, 0,
                              flags);
 
       if (transfer == SVGA3D_READ_HOST_VRAM) {
@@ -170,7 +174,10 @@ svga_transfer_dma(struct svga_context *svga,
             }
          }
 
-         svga_transfer_dma_band(svga, st, transfer, y, h, srcy, flags);
+         svga_transfer_dma_band(svga, st, transfer,
+                                st->base.box.x, y, st->base.box.z,
+                                st->base.box.width, h, st->base.box.depth,
+                                0, srcy, 0, flags);
 
          /*
           * Prevent the texture contents to be discarded on the next band