Mesa (master): r300g: fix microtiling on RS6xx

Marek Olšák mareko at kemper.freedesktop.org
Sun Aug 1 20:44:38 UTC 2010


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

Author: Marek Olšák <maraeo at gmail.com>
Date:   Sun Aug  1 16:42:53 2010 +0200

r300g: fix microtiling on RS6xx

Getting tiling right has always been tricky.
There are so many subtle details...

---

 src/gallium/drivers/r300/r300_texture_desc.c |   22 ++++++++++++++++++----
 1 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/r300/r300_texture_desc.c b/src/gallium/drivers/r300/r300_texture_desc.c
index 343089b..5d690e8 100644
--- a/src/gallium/drivers/r300/r300_texture_desc.c
+++ b/src/gallium/drivers/r300/r300_texture_desc.c
@@ -136,13 +136,27 @@ static unsigned r300_texture_get_stride(struct r300_screen *screen,
 
         stride = util_format_get_stride(desc->b.b.format, width);
 
-        /* Some IGPs need a minimum stride of 64 bytes, hmm...
-         * This doesn't seem to apply to tiled textures, according to r300c. */
-        if (!desc->microtile && !desc->macrotile[level] &&
+        /* Some IGPs need a minimum stride of 64 bytes, hmm... */
+        if (!desc->macrotile[level] &&
             (screen->caps.family == CHIP_FAMILY_RS600 ||
              screen->caps.family == CHIP_FAMILY_RS690 ||
              screen->caps.family == CHIP_FAMILY_RS740)) {
-            return stride < 64 ? 64 : stride;
+            unsigned min_stride;
+
+            if (desc->microtile) {
+                unsigned tile_height =
+                        r300_get_pixel_alignment(desc->b.b.format,
+                                                 desc->b.b.nr_samples,
+                                                 desc->microtile,
+                                                 desc->macrotile[level],
+                                                 DIM_HEIGHT);
+
+                min_stride = 64 / tile_height;
+            } else {
+                min_stride = 64;
+            }
+
+            return stride < min_stride ? min_stride : stride;
         }
 
         /* The alignment to 32 bytes is sort of implied by the layout... */




More information about the mesa-commit mailing list