Mesa (master): turnip: fall back to sysmem when attachments don't fit into gmem

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Feb 28 14:28:09 UTC 2020


Module: Mesa
Branch: master
Commit: d195eef05d2eb063ab82d680950b40eb9127265e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=d195eef05d2eb063ab82d680950b40eb9127265e

Author: Jonathan Marek <jonathan at marek.ca>
Date:   Thu Feb 27 14:29:05 2020 -0500

turnip: fall back to sysmem when attachments don't fit into gmem

Signed-off-by: Jonathan Marek <jonathan at marek.ca>
Reviewed-by: Eric Anholt <eric at anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3979>

---

 src/freedreno/vulkan/tu_cmd_buffer.c | 10 ++++++++++
 src/freedreno/vulkan/tu_pass.c       |  1 -
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/freedreno/vulkan/tu_cmd_buffer.c b/src/freedreno/vulkan/tu_cmd_buffer.c
index a3d5a93f3a3..9b4ee7637a6 100644
--- a/src/freedreno/vulkan/tu_cmd_buffer.c
+++ b/src/freedreno/vulkan/tu_cmd_buffer.c
@@ -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;
 }
 
diff --git a/src/freedreno/vulkan/tu_pass.c b/src/freedreno/vulkan/tu_pass.c
index eca129ba804..26ce2b4958f 100644
--- a/src/freedreno/vulkan/tu_pass.c
+++ b/src/freedreno/vulkan/tu_pass.c
@@ -81,7 +81,6 @@ compute_gmem_offsets(struct tu_render_pass *pass, uint32_t gmem_size)
    }
 
    pass->gmem_pixels = pixels;
-   assert(pixels);
 }
 
 VkResult



More information about the mesa-commit mailing list