Module: Mesa
Branch: master
Commit: 8a6391477efcede5639e31db2ff42abe37aaabd1
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=8a6391477efcede5639e31db2ff42abe37aaabd1

Author: Charmaine Lee <charmai...@vmware.com>
Date:   Fri Sep 16 09:50:20 2016 -0700

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 <bri...@vmware.com>

---

 src/gallium/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 a79f43d..ea26c3e 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;
 }

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to