diff options
author | Chia-I Wu <[email protected]> | 2019-01-28 16:31:54 -0800 |
---|---|---|
committer | Chia-I Wu <[email protected]> | 2019-03-11 10:02:13 -0700 |
commit | 741a4325df3a9c605bf85d2429f4af97a755e407 (patch) | |
tree | 87d0cf50338d769181b3c2faea5a12822c42d799 /src | |
parent | 29f111000399821452e8538ca74ce2de7210ee47 (diff) |
turnip: add tu_cs_sanity_check
It replaces tu_cs_reserve_space_assert and can be called at any
time to sanity check tu_cs.
Diffstat (limited to 'src')
-rw-r--r-- | src/freedreno/vulkan/tu_cmd_buffer.c | 2 | ||||
-rw-r--r-- | src/freedreno/vulkan/tu_cs.c | 4 | ||||
-rw-r--r-- | src/freedreno/vulkan/tu_cs.h | 4 | ||||
-rw-r--r-- | src/freedreno/vulkan/tu_private.h | 4 |
4 files changed, 7 insertions, 7 deletions
diff --git a/src/freedreno/vulkan/tu_cmd_buffer.c b/src/freedreno/vulkan/tu_cmd_buffer.c index 346f5f29ff5..541a37b6dde 100644 --- a/src/freedreno/vulkan/tu_cmd_buffer.c +++ b/src/freedreno/vulkan/tu_cmd_buffer.c @@ -511,7 +511,7 @@ tu6_init_hw(struct tu_cmd_buffer *cmd) tu_cs_emit_pkt4(cs, REG_A6XX_RB_LRZ_CNTL, 1); tu_cs_emit(cs, 0x00000000); - tu_cs_reserve_space_assert(cs); + tu_cs_sanity_check(cs); } static void diff --git a/src/freedreno/vulkan/tu_cs.c b/src/freedreno/vulkan/tu_cs.c index 0e3d4e99b42..f4bec106934 100644 --- a/src/freedreno/vulkan/tu_cs.c +++ b/src/freedreno/vulkan/tu_cs.c @@ -130,7 +130,7 @@ tu_cs_add_bo(struct tu_device *dev, struct tu_cs *cs, uint32_t size) cs->bos[cs->bo_count++] = new_bo; - cs->start = cs->cur = (uint32_t *) new_bo->map; + cs->start = cs->cur = cs->reserved_end = (uint32_t *) new_bo->map; cs->end = cs->start + new_bo->size / sizeof(uint32_t); return VK_SUCCESS; @@ -248,7 +248,7 @@ tu_cs_reset(struct tu_device *dev, struct tu_cs *cs) cs->bos[0] = cs->bos[cs->bo_count - 1]; cs->bo_count = 1; - cs->start = cs->cur = (uint32_t *) cs->bos[0]->map; + cs->start = cs->cur = cs->reserved_end = (uint32_t *) cs->bos[0]->map; cs->end = cs->start + cs->bos[0]->size / sizeof(uint32_t); } diff --git a/src/freedreno/vulkan/tu_cs.h b/src/freedreno/vulkan/tu_cs.h index 43835d147f6..c28d8de76c7 100644 --- a/src/freedreno/vulkan/tu_cs.h +++ b/src/freedreno/vulkan/tu_cs.h @@ -51,9 +51,11 @@ tu_cs_reset(struct tu_device *dev, struct tu_cs *cs); * Assert that we did not exceed the reserved space. */ static inline void -tu_cs_reserve_space_assert(struct tu_cs *cs) +tu_cs_sanity_check(const struct tu_cs *cs) { + assert(cs->start <= cs->cur); assert(cs->cur <= cs->reserved_end); + assert(cs->reserved_end <= cs->end); } /** diff --git a/src/freedreno/vulkan/tu_private.h b/src/freedreno/vulkan/tu_private.h index cd724ea1b9d..205d5c0f13f 100644 --- a/src/freedreno/vulkan/tu_private.h +++ b/src/freedreno/vulkan/tu_private.h @@ -781,10 +781,8 @@ struct tu_cs { uint32_t *start; uint32_t *cur; - uint32_t *end; - - /* for tu_cs_reserve_space_assert */ uint32_t *reserved_end; + uint32_t *end; uint32_t next_bo_size; |