aboutsummaryrefslogtreecommitdiffstats
path: root/src/freedreno
diff options
context:
space:
mode:
authorJonathan Marek <[email protected]>2019-12-17 17:59:45 -0500
committerJonathan Marek <[email protected]>2019-12-18 19:03:37 -0500
commit4a59bc6df2baf3be1d8bc8dbcd04b7b02df13560 (patch)
tree9ede7a886e787402ac28f874cafe29b76a3da26a /src/freedreno
parentfc2552b6445a1295c18acf8798411da85bbc5387 (diff)
turnip: add cache invalidate to fix input attachment cases
Fixes artifacts in the subpasses demo. Workaround texture cache with input attachments from GMEM by adding a cache invalidate between subpasses. Signed-off-by: Jonathan Marek <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3143>
Diffstat (limited to 'src/freedreno')
-rw-r--r--src/freedreno/vulkan/tu_cmd_buffer.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/freedreno/vulkan/tu_cmd_buffer.c b/src/freedreno/vulkan/tu_cmd_buffer.c
index d654f0bff9b..0080e10ee66 100644
--- a/src/freedreno/vulkan/tu_cmd_buffer.c
+++ b/src/freedreno/vulkan/tu_cmd_buffer.c
@@ -1461,7 +1461,7 @@ tu_cmd_prepare_tile_load_ib(struct tu_cmd_buffer *cmd,
const VkRenderPassBeginInfo *info)
{
const uint32_t tile_load_space =
- 6 + (23+19) * cmd->state.pass->attachment_count +
+ 8 + (23+19) * cmd->state.pass->attachment_count +
21 + (13 * cmd->state.subpass->color_count + 8) + 11;
struct tu_cs sub_cs;
@@ -1483,6 +1483,13 @@ tu_cmd_prepare_tile_load_ib(struct tu_cmd_buffer *cmd,
for (uint32_t i = 0; i < cmd->state.pass->attachment_count; ++i)
tu6_emit_clear_attachment(cmd, &sub_cs, i, info);
+ /* invalidate because reading input attachments will cache GMEM and
+ * the cache isn''t updated when GMEM is written
+ * TODO: is there a no-cache bit for textures?
+ */
+ if (cmd->state.subpass->input_count)
+ tu6_emit_event_write(cmd, &sub_cs, CACHE_INVALIDATE, false);
+
tu6_emit_zs(cmd, cmd->state.subpass, &sub_cs);
tu6_emit_mrt(cmd, cmd->state.subpass, &sub_cs);
tu6_emit_msaa(cmd, cmd->state.subpass, &sub_cs);
@@ -2386,6 +2393,13 @@ tu_CmdNextSubpass(VkCommandBuffer commandBuffer, VkSubpassContents contents)
}
}
+ /* invalidate because reading input attachments will cache GMEM and
+ * the cache isn''t updated when GMEM is written
+ * TODO: is there a no-cache bit for textures?
+ */
+ if (cmd->state.subpass->input_count)
+ tu6_emit_event_write(cmd, cs, CACHE_INVALIDATE, false);
+
/* emit mrt/zs/msaa state for the subpass that is starting */
tu6_emit_zs(cmd, cmd->state.subpass, cs);
tu6_emit_mrt(cmd, cmd->state.subpass, cs);