turnip: Set up the correct tiling mode for small attachments.
authorEric Anholt <eric@anholt.net>
Mon, 14 Oct 2019 16:33:42 +0000 (12:33 -0400)
committerJonathan Marek <jonathan@marek.ca>
Tue, 15 Oct 2019 11:56:19 +0000 (07:56 -0400)
Noticed while debugging a tiling-looking issue by comparing our gmem
blit setup to freedreno's.

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
src/freedreno/vulkan/tu_cmd_buffer.c
src/freedreno/vulkan/tu_image.c
src/freedreno/vulkan/tu_private.h

index 34da6d0e88c8034528deba57829b2441535fffb2..863c082912cc3fc5fa87e1e10b6dafdeeed603e4 100644 (file)
@@ -440,7 +440,8 @@ tu6_emit_mrt(struct tu_cmd_buffer *cmd, struct tu_cs *cs)
       const struct tu_image_view *iview = fb->attachments[a].attachment;
       const struct tu_image_level *slice =
          &iview->image->levels[iview->base_mip];
-      const enum a6xx_tile_mode tile_mode = iview->image->tile_mode;
+      const enum a6xx_tile_mode tile_mode =
+         tu6_get_image_tile_mode(iview->image, iview->base_mip);
       uint32_t stride = 0;
       uint32_t offset = 0;
 
@@ -610,13 +611,14 @@ tu6_emit_blit_info(struct tu_cmd_buffer *cmd,
    tu_cs_emit_pkt4(cs, REG_A6XX_RB_BLIT_INFO, 1);
    tu_cs_emit(cs, blit_info);
 
-   /* tile mode? */
    const struct tu_native_format *format =
       tu6_get_native_format(iview->vk_format);
    assert(format && format->rb >= 0);
 
+   enum a6xx_tile_mode tile_mode =
+      tu6_get_image_tile_mode(iview->image, iview->base_mip);
    tu_cs_emit_pkt4(cs, REG_A6XX_RB_BLIT_DST_INFO, 5);
-   tu_cs_emit(cs, A6XX_RB_BLIT_DST_INFO_TILE_MODE(iview->image->tile_mode) |
+   tu_cs_emit(cs, A6XX_RB_BLIT_DST_INFO_TILE_MODE(tile_mode) |
                      A6XX_RB_BLIT_DST_INFO_SAMPLES(samples) |
                      A6XX_RB_BLIT_DST_INFO_COLOR_FORMAT(format->rb) |
                      A6XX_RB_BLIT_DST_INFO_COLOR_SWAP(format->swap));
index 6ac1d48c1880bb0f13993de1e4a797fd320d71f2..50bd1dbbb1929f219a8c90054eca47b785d25b4d 100644 (file)
@@ -39,6 +39,15 @@ image_level_linear(struct tu_image *image, int level)
    return w < 16;
 }
 
+enum a6xx_tile_mode
+tu6_get_image_tile_mode(struct tu_image *image, int level)
+{
+   if (image_level_linear(image, level))
+      return TILE6_LINEAR;
+   else
+      return image->tile_mode;
+}
+
 /* indexed by cpp, including msaa 2x and 4x: */
 static const struct {
    unsigned pitchalign;
index af1c779885e9639ce01631fe798ebc19a7ca0e77..405fa20b4f5fe09b1d97150807d414b836fab36b 100644 (file)
@@ -1297,6 +1297,9 @@ tu_get_levelCount(const struct tu_image *image,
              : range->levelCount;
 }
 
+enum a6xx_tile_mode
+tu6_get_image_tile_mode(struct tu_image *image, int level);
+
 struct tu_image_view
 {
    struct tu_image *image; /**< VkImageViewCreateInfo::image */