From 8a6391477efcede5639e31db2ff42abe37aaabd1 Mon Sep 17 00:00:00 2001 From: Charmaine Lee Date: Fri, 16 Sep 2016 09:50:20 -0700 Subject: [PATCH] svga: relax restriction of compressed formats for texture upload This patch relaxes the restriction of compressed formats for texture upload buffer. For now, 3D texture with compressed format is still not supported in the texture upload buffer path. As Brian noted, ETQW does many texture updates with glCompressedTexSubImage. This patch greatly improves the performance of the ETQW trace. Tested with ETQW, MTT piglit, glretrace, conform, viewperf v2: Per Brian's suggestion, removed the subregion boundary check. Reviewed-by: Brian Paul --- .../drivers/svga/svga_resource_texture.c | 25 ++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/svga/svga_resource_texture.c b/src/gallium/drivers/svga/svga_resource_texture.c index a79f43d9fe8..ea26c3e822c 100644 --- a/src/gallium/drivers/svga/svga_resource_texture.c +++ b/src/gallium/drivers/svga/svga_resource_texture.c @@ -1302,10 +1302,29 @@ svga_texture_transfer_map_can_upload(struct svga_context *svga, if (texture->nr_samples > 1) return FALSE; - /* Do not use the upload path with compressed format or rgb9_e5 */ - if (util_format_is_compressed(texture->format) || - texture->format == PIPE_FORMAT_R9G9B9E5_FLOAT) + if (util_format_is_compressed(texture->format)) { + /* XXX Need to take a closer look to see why texture upload + * with 3D texture with compressed format fails + */ + if (texture->target == PIPE_TEXTURE_3D) + return FALSE; + +#ifdef DEBUG + { + struct svga_texture *tex = svga_texture(texture); + unsigned blockw, blockh, bytesPerBlock; + + svga_format_size(tex->key.format, &blockw, &blockh, &bytesPerBlock); + + /* dest box must start on block boundary */ + assert((st->base.box.x % blockw) == 0); + assert((st->base.box.y % blockh) == 0); + } +#endif + } + else if (texture->format == PIPE_FORMAT_R9G9B9E5_FLOAT) { return FALSE; + } return TRUE; } -- 2.30.2