svga: force direct map for transfering multiple slices
authorCharmaine Lee <charmainel@vmware.com>
Thu, 23 Jun 2016 16:21:11 +0000 (09:21 -0700)
committerBrian Paul <brianp@vmware.com>
Tue, 28 Jun 2016 19:43:23 +0000 (13:43 -0600)
With commit fb9fe35, we start using transfer_inline_write
for memcpy of TexSubImage. But SurfaceDMA command does not work
well with texture array. This patch forces direct map when
transfering multiple slices of a texture array.

Fixes piglit regression "texelFetch fs sampler1DArray"

Tested with MTT piglit, glretrace, conform.

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

index f8305d58ad7b0b3ccddbcb8b7aa5db9756bc9c29..0e21f5ea5123e58a724fb641bbb026bd72003017 100644 (file)
@@ -350,6 +350,30 @@ svga_texture_transfer_map(struct pipe_context *pipe,
    if (!st)
       return NULL;
 
+   st->base.level = level;
+   st->base.usage = usage;
+   st->base.box = *box;
+
+   switch (tex->b.b.target) {
+   case PIPE_TEXTURE_CUBE:
+      st->slice = st->base.box.z;
+      st->base.box.z = 0;   /* so we don't apply double offsets below */
+      break;
+   case PIPE_TEXTURE_2D_ARRAY:
+   case PIPE_TEXTURE_1D_ARRAY:
+      st->slice = st->base.box.z;
+      st->base.box.z = 0;   /* so we don't apply double offsets below */
+
+      /* Force direct map for transfering multiple slices */
+      if (st->base.box.depth > 1)
+         use_direct_map = svga_have_gb_objects(svga);
+
+      break;
+   default:
+      st->slice = 0;
+      break;
+   }
+
    {
       unsigned w, h;
       if (use_direct_map) {
@@ -370,24 +394,9 @@ svga_texture_transfer_map(struct pipe_context *pipe,
 
    pipe_resource_reference(&st->base.resource, texture);
 
-   st->base.level = level;
-   st->base.usage = usage;
-   st->base.box = *box;
    st->base.stride = nblocksx*util_format_get_blocksize(texture->format);
    st->base.layer_stride = st->base.stride * nblocksy;
 
-   switch (tex->b.b.target) {
-   case PIPE_TEXTURE_CUBE:
-   case PIPE_TEXTURE_2D_ARRAY:
-   case PIPE_TEXTURE_1D_ARRAY:
-      st->slice = st->base.box.z;
-      st->base.box.z = 0;   /* so we don't apply double offsets below */
-      break;
-   default:
-      st->slice = 0;
-      break;
-   }
-
    if (usage & PIPE_TRANSFER_WRITE) {
       /* record texture upload for HUD */
       svga->hud.num_bytes_uploaded +=