From d195eef05d2eb063ab82d680950b40eb9127265e Mon Sep 17 00:00:00 2001 From: Jonathan Marek Date: Thu, 27 Feb 2020 14:29:05 -0500 Subject: [PATCH] turnip: fall back to sysmem when attachments don't fit into gmem Signed-off-by: Jonathan Marek Reviewed-by: Eric Anholt Part-of: --- 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 -- 2.30.2