panfrost: Add notes about the tiler allocations
[mesa.git] / src / gallium / drivers / r300 / r300_texture_desc.c
index df24e44b209a715ef4e4bc77100a4849212538ca..37e7b5fc4e2882e0d3ed907ed04a3d26a6375511 100644 (file)
@@ -25,6 +25,7 @@
 #include "r300_context.h"
 
 #include "util/u_format.h"
+#include <inttypes.h>
 
 /* Returns the number of pixels that the texture should be aligned to
  * in the given dimension. */
@@ -269,15 +270,15 @@ static void r300_setup_miptree(struct r300_screen *screen,
 static void r300_setup_flags(struct r300_resource *tex)
 {
     tex->tex.uses_stride_addressing =
-        !util_is_power_of_two(tex->b.b.width0) ||
+        !util_is_power_of_two_or_zero(tex->b.b.width0) ||
         (tex->tex.stride_in_bytes_override &&
          r300_stride_to_width(tex->b.b.format,
                          tex->tex.stride_in_bytes_override) != tex->b.b.width0);
 
     tex->tex.is_npot =
         tex->tex.uses_stride_addressing ||
-        !util_is_power_of_two(tex->b.b.height0) ||
-        !util_is_power_of_two(tex->b.b.depth0);
+        !util_is_power_of_two_or_zero(tex->b.b.height0) ||
+        !util_is_power_of_two_or_zero(tex->b.b.depth0);
 }
 
 static void r300_setup_cbzb_flags(struct r300_screen *rscreen,
@@ -349,6 +350,7 @@ static void r300_setup_hyperz_properties(struct r300_screen *screen,
     static unsigned hiz_align_y[4] = {8, 8, 8, 32};
 
     if (util_format_is_depth_or_stencil(tex->b.b.format) &&
+        util_format_get_blocksizebits(tex->b.b.format) == 32 &&
         tex->tex.microtile) {
         unsigned i, pipes;
 
@@ -416,6 +418,10 @@ static void r300_setup_cmask_properties(struct r300_screen *screen,
     static unsigned cmask_align_y[4] = {16, 16, 16, 32};
     unsigned pipes, stride, cmask_num_dw, cmask_max_size;
 
+    if (!screen->caps.has_cmask) {
+        return;
+    }
+
     /* We need an AA colorbuffer, no mipmaps. */
     if (tex->b.b.nr_samples <= 1 ||
         tex->b.b.last_level > 0 ||
@@ -609,7 +615,7 @@ void r300_texture_desc_init(struct r300_screen *rscreen,
                 "r300: I got a pre-allocated buffer to use it as a texture "
                 "storage, but the buffer is too small. I'll use the buffer "
                 "anyway, because I can't crash here, but it's dangerous. "
-                "This can be a DDX bug. Got: %iB, Need: %iB, Info:\n",
+                "This can be a DDX bug. Got: %"PRIu64"B, Need: %uB, Info:\n",
                 tex->buf->size, tex->tex.size_in_bytes);
             r300_tex_print_info(tex, "texture_desc_init");
             /* Ooops, what now. Apps will break if we fail this,