From 2bcaa78236447dd696888b9da67103af74c42bc4 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Wed, 16 Jan 2019 14:05:55 -0800 Subject: [PATCH] turnip: update cs->start in tu_cs_end This allows us to assert that there is no dangling command in tu_cs_begin, rather than discarding them silently. --- src/freedreno/vulkan/tu_cs.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/freedreno/vulkan/tu_cs.c b/src/freedreno/vulkan/tu_cs.c index e85925f3a15..cf21d5176c6 100644 --- a/src/freedreno/vulkan/tu_cs.c +++ b/src/freedreno/vulkan/tu_cs.c @@ -104,7 +104,8 @@ tu_cs_add_bo(struct tu_device *dev, struct tu_cs *cs, uint32_t byte_size) VkResult tu_cs_begin(struct tu_device *dev, struct tu_cs *cs, uint32_t reserve_size) { - assert(reserve_size); + /* no dangling command packet */ + assert(cs->start == cs->cur); if (cs->end - cs->cur < reserve_size) { uint32_t new_size = MAX2(16384, reserve_size * sizeof(uint32_t)); @@ -115,7 +116,6 @@ tu_cs_begin(struct tu_device *dev, struct tu_cs *cs, uint32_t reserve_size) if (result != VK_SUCCESS) return result; } - cs->start = cs->cur; return VK_SUCCESS; } @@ -153,6 +153,8 @@ tu_cs_end(struct tu_cs *cs) .offset = (cs->start - (uint32_t *) bo->map) * sizeof(uint32_t), }; + cs->start = cs->cur; + return VK_SUCCESS; } -- 2.30.2