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

Author: Marek Olšák <[email protected]>
Date:   Sun Feb 14 04:57:09 2010 +0100

r300g: enable micro- and macrotiling for all textures and renderbuffers

---

 src/gallium/drivers/r300/r300_texture.c |   39 +++++++++++++++++++++++++++++++
 1 files changed, 39 insertions(+), 0 deletions(-)

diff --git a/src/gallium/drivers/r300/r300_texture.c 
b/src/gallium/drivers/r300/r300_texture.c
index 04e326e..0736155 100644
--- a/src/gallium/drivers/r300/r300_texture.c
+++ b/src/gallium/drivers/r300/r300_texture.c
@@ -724,6 +724,42 @@ static void r300_setup_flags(struct r300_texture* tex)
                    !util_is_power_of_two(tex->tex.height0);
 }
 
+static void r300_setup_tiling(struct pipe_screen *screen,
+                              struct r300_texture *tex)
+{
+    enum pipe_format format = tex->tex.format;
+    boolean rv350_mode = r300_screen(screen)->caps->family >= 
CHIP_FAMILY_RV350;
+
+    if (util_format_is_compressed(format)) {
+        return;
+    }
+
+    if (tex->tex.width0 == 1 ||
+        tex->tex.height0 == 1) {
+        return;
+    }
+
+    /* Set microtiling. */
+    switch (util_format_get_blocksize(format)) {
+        case 1:
+        case 4:
+            tex->microtile = R300_BUFFER_TILED;
+            break;
+
+        /* XXX Square-tiling doesn't work with kernel older than 2.6.34,
+         * XXX need to check the DRM version */
+        /*case 2:
+        case 8:
+            tex->microtile = R300_BUFFER_SQUARETILED;
+            break;*/
+    }
+
+    /* Set macrotiling. */
+    if (r300_texture_macro_switch(tex, 0, rv350_mode)) {
+        tex->macrotile = R300_BUFFER_TILED;
+    }
+}
+
 /* Create a new texture. */
 static struct pipe_texture* r300_texture_create(struct pipe_screen* screen,
                                          const struct pipe_texture* template)
@@ -741,6 +777,9 @@ static struct pipe_texture* r300_texture_create(struct 
pipe_screen* screen,
     tex->tex.screen = screen;
 
     r300_setup_flags(tex);
+    if (!(template->tex_usage & R300_TEXTURE_USAGE_TRANSFER)) {
+        r300_setup_tiling(screen, tex);
+    }
     r300_setup_miptree(rscreen, tex);
     r300_setup_texture_state(rscreen, tex);
 

_______________________________________________
mesa-commit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to