turnip: fall back to sysmem when attachments don't fit into gmem
authorJonathan Marek <jonathan@marek.ca>
Thu, 27 Feb 2020 19:29:05 +0000 (14:29 -0500)
committerMarge Bot <eric+marge@anholt.net>
Fri, 28 Feb 2020 14:04:20 +0000 (14:04 +0000)
Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3979>

src/freedreno/vulkan/tu_cmd_buffer.c
src/freedreno/vulkan/tu_pass.c

index a3d5a93f3a3c7b0949b1c3735165294d6030051c..9b4ee7637a6581c34c98b4c07250d261b13708ba 100644 (file)
@@ -219,6 +219,12 @@ tu_tiling_config_update_tile_layout(struct tu_tiling_config *tiling,
          align(DIV_ROUND_UP(ra_width, tiling->tile_count.width), tile_align_w);
    }
 
+   /* will force to sysmem, don't bother trying to have a valid tile config
+    * TODO: just skip all GMEM stuff when sysmem is forced?
+    */
+   if (!pixels)
+      return;
+
    /* do not exceed gmem size */
    while (tiling->tile0.extent.width * tiling->tile0.extent.height > pixels) {
       if (tiling->tile0.extent.width > MAX2(tile_align_w, tiling->tile0.extent.height)) {
@@ -767,6 +773,10 @@ use_sysmem_rendering(struct tu_cmd_buffer *cmd)
    if (unlikely(cmd->device->physical_device->instance->debug_flags & TU_DEBUG_SYSMEM))
       return true;
 
+   /* can't fit attachments into gmem */
+   if (!cmd->state.pass->gmem_pixels)
+      return true;
+
    return cmd->state.tiling_config.force_sysmem;
 }
 
index eca129ba804dd1b3bc4db4f8d999797f8ed82c0a..26ce2b4958f7efd872322d60779b3eec2dd23db8 100644 (file)
@@ -81,7 +81,6 @@ compute_gmem_offsets(struct tu_render_pass *pass, uint32_t gmem_size)
    }
 
    pass->gmem_pixels = pixels;
-   assert(pixels);
 }
 
 VkResult