turnip: inline tu_cs_check_space
authorChia-I Wu <olvaffe@gmail.com>
Wed, 16 Jan 2019 22:12:53 +0000 (14:12 -0800)
committerChia-I Wu <olvaffe@gmail.com>
Mon, 11 Mar 2019 17:01:41 +0000 (10:01 -0700)
This allows the fast path (size check) to be inlined.

src/freedreno/vulkan/tu_cs.c
src/freedreno/vulkan/tu_cs.h

index cf21d5176c6d730cc5419f556bf12f73fc0627e4..efc38b1775723ac3f9b6e4b81d5c8fab106ad92c 100644 (file)
@@ -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);
-}
index 03a371bdfa1782931b001a2dda7dd41c1278604b..a81652ce353096836b4e0345ae3ac10fd1e3da8d 100644 (file)
@@ -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.