From 6397c12f32431616555c8de29ee40aac51e69401 Mon Sep 17 00:00:00 2001 From: Charmaine Lee Date: Thu, 23 Jun 2016 09:21:11 -0700 Subject: [PATCH] svga: force direct map for transfering multiple slices 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 --- .../drivers/svga/svga_resource_texture.c | 39 ++++++++++++------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/src/gallium/drivers/svga/svga_resource_texture.c b/src/gallium/drivers/svga/svga_resource_texture.c index f8305d58ad7..0e21f5ea512 100644 --- a/src/gallium/drivers/svga/svga_resource_texture.c +++ b/src/gallium/drivers/svga/svga_resource_texture.c @@ -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 += -- 2.30.2