[Mesa-dev] [PATCH 1/2] i965: Correct a mistake that always forced texture tiling.

Matt Turner mattst88 at gmail.com
Tue Aug 4 23:18:16 PDT 2015


Regression since commit 3a31876600, when tiling modes were moved into
layout_flags.

The relevant enum values are

   MIPTREE_LAYOUT_ALLOC_YTILED = 1 << 5
   MIPTREE_LAYOUT_ALLOC_XTILED = 1 << 6
   MIPTREE_LAYOUT_ALLOC_ANY_TILED = MIPTREE_LAYOUT_ALLOC_YTILED |
                                    MIPTREE_LAYOUT_ALLOC_XTILED
   MIPTREE_LAYOUT_ALLOC_LINEAR = 1 << 7

so the expression (layout_flags & MIPTREE_LAYOUT_ALLOC_ANY_TILED) can
never produce a value of MIPTREE_LAYOUT_ALLOC_LINEAR.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91513
---
I find this code really weird. MIPTREE_LAYOUT_ALLOC_XTILED is only used
in the two places noted in the commit message, and it wasn't an enum
value in the intel_miptree_tiling_mode type removed in the aforementioned
commit. Even with this patch, the brw_miptree_choose_tiling() function
wouldn't do anything sensible if passed XTILED | ~YTILED in layout_flags.
In fact, that case isn't even handled by the switch statement...

 src/mesa/drivers/dri/i965/brw_tex_layout.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
w
diff --git a/src/m esa/drivers/dri/i965/brw_tex_layout.c b/src/mesa/drivers/dri/i965/brw_tex_layout.c
index fb78b08..8f492e3 100644
--- a/src/mesa/drivers/dri/i965/brw_tex_layout.c
+++ b/src/mesa/drivers/dri/i965/brw_tex_layout.c
@@ -633,11 +633,11 @@ brw_miptree_choose_tiling(struct brw_context *brw,
    switch (layout_flags & MIPTREE_LAYOUT_ALLOC_ANY_TILED) {
    case MIPTREE_LAYOUT_ALLOC_ANY_TILED:
       break;
    case MIPTREE_LAYOUT_ALLOC_YTILED:
       return I915_TILING_Y;
-   case MIPTREE_LAYOUT_ALLOC_LINEAR:
+   case 0:
       return I915_TILING_NONE;
    }
 
    if (mt->num_samples > 1) {
       /* From p82 of the Sandy Bridge PRM, dw3[1] of SURFACE_STATE ("Tiled
-- 
2.3.6



More information about the mesa-dev mailing list