diff options
author | Chia-I Wu <[email protected]> | 2019-01-16 14:12:53 -0800 |
---|---|---|
committer | Chia-I Wu <[email protected]> | 2019-03-11 10:01:41 -0700 |
commit | 39ba2b20d112c6235d89683a68314a48fb5571f4 (patch) | |
tree | 17ce1feed65e711ccf1506fe97aac89c79fe36c7 | |
parent | 2bcaa78236447dd696888b9da67103af74c42bc4 (diff) |
turnip: inline tu_cs_check_space
This allows the fast path (size check) to be inlined.
-rw-r--r-- | src/freedreno/vulkan/tu_cs.c | 16 | ||||
-rw-r--r-- | src/freedreno/vulkan/tu_cs.h | 18 |
2 files changed, 16 insertions, 18 deletions
diff --git a/src/freedreno/vulkan/tu_cs.c b/src/freedreno/vulkan/tu_cs.c index cf21d5176c6..efc38b17757 100644 --- a/src/freedreno/vulkan/tu_cs.c +++ b/src/freedreno/vulkan/tu_cs.c @@ -180,19 +180,3 @@ tu_cs_reset(struct tu_device *dev, struct tu_cs *cs) cs->entry_count = 0; } - -/** - * Reserve space from a command stream for \a size uint32_t values. - */ -VkResult -tu_cs_check_space(struct tu_device *dev, struct tu_cs *cs, size_t size) -{ - if (cs->end - cs->cur >= size) - return VK_SUCCESS; - - VkResult result = tu_cs_end(cs); - if (result != VK_SUCCESS) - return result; - - return tu_cs_begin(dev, cs, size); -} diff --git a/src/freedreno/vulkan/tu_cs.h b/src/freedreno/vulkan/tu_cs.h index 03a371bdfa1..a81652ce353 100644 --- a/src/freedreno/vulkan/tu_cs.h +++ b/src/freedreno/vulkan/tu_cs.h @@ -37,8 +37,22 @@ VkResult tu_cs_end(struct tu_cs *cs); void tu_cs_reset(struct tu_device *dev, struct tu_cs *cs); -VkResult -tu_cs_check_space(struct tu_device *dev, struct tu_cs *cs, size_t size); + +/** + * Reserve space from a command stream for \a size uint32_t values. + */ +static inline VkResult +tu_cs_check_space(struct tu_device *dev, struct tu_cs *cs, size_t size) +{ + if (cs->end - cs->cur >= size) + return VK_SUCCESS; + + VkResult result = tu_cs_end(cs); + if (result != VK_SUCCESS) + return result; + + return tu_cs_begin(dev, cs, size); +} /** * Emit a uint32_t value into a command stream, without boundary checking. |