turnip: disable tiling as necessary
authorJonathan Marek <jonathan@marek.ca>
Fri, 4 Oct 2019 19:57:28 +0000 (15:57 -0400)
committerJonathan Marek <jonathan@marek.ca>
Tue, 15 Oct 2019 11:56:19 +0000 (07:56 -0400)
Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
src/freedreno/vulkan/tu_image.c

index 9c558407309c934a0abf2c286ec51e4ab06aa410..6ac1d48c1880bb0f13993de1e4a797fd320d71f2 100644 (file)
@@ -185,9 +185,18 @@ tu_image_create(VkDevice _device,
       vk_find_struct_const(pCreateInfo->pNext,
                            EXTERNAL_MEMORY_IMAGE_CREATE_INFO) != NULL;
 
-   image->tile_mode = TILE6_LINEAR;
-   if (pCreateInfo->tiling == VK_IMAGE_TILING_OPTIMAL && !create_info->scanout)
-      image->tile_mode = TILE6_3;
+   image->tile_mode = TILE6_3;
+
+   if (pCreateInfo->tiling == VK_IMAGE_TILING_LINEAR ||
+       /* compressed textures can't use tiling? */
+       vk_format_is_compressed(image->vk_format) ||
+       /* scanout needs to be linear (what about tiling modifiers?) */
+       create_info->scanout ||
+       /* image_to_image copy doesn't deal with tiling+swap */
+       tu6_get_native_format(image->vk_format)->swap ||
+       /* r8g8 formats are tiled different and could break image_to_image copy */
+       (image->cpp == 2 && vk_format_get_nr_components(image->vk_format) == 2))
+      image->tile_mode = TILE6_LINEAR;
 
    setup_slices(image, pCreateInfo);