summaryrefslogtreecommitdiffstats
path: root/src/freedreno/vulkan/tu_private.h
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2019-01-28 14:33:20 -0800
committerChia-I Wu <[email protected]>2019-03-11 10:02:13 -0700
commitf59c3814232d5735aba6bed9de506e59321e4170 (patch)
treeeff029331d6d393f1cfbf9eaaf378fa8c1ce8c0a /src/freedreno/vulkan/tu_private.h
parent5c63fc626f98def10d20971161e672f9e7cd341c (diff)
turnip: add tu_cs_mode
Add tu_cs_mode and TU_CS_MODE_EXTERNAL. When in TU_CS_MODE_EXTERNAL, tu_cs wraps an external buffer and can not grow. This also moves tu_cs* up in tu_private.h, such that other structs can embed tu_cs_entry.
Diffstat (limited to 'src/freedreno/vulkan/tu_private.h')
-rw-r--r--src/freedreno/vulkan/tu_private.h78
1 files changed, 51 insertions, 27 deletions
diff --git a/src/freedreno/vulkan/tu_private.h b/src/freedreno/vulkan/tu_private.h
index 205d5c0f13f..af397950a94 100644
--- a/src/freedreno/vulkan/tu_private.h
+++ b/src/freedreno/vulkan/tu_private.h
@@ -447,6 +447,57 @@ tu_bo_finish(struct tu_device *dev, struct tu_bo *bo);
VkResult
tu_bo_map(struct tu_device *dev, struct tu_bo *bo);
+struct tu_cs_entry
+{
+ /* No ownership */
+ const struct tu_bo *bo;
+
+ uint32_t size;
+ uint64_t offset;
+};
+
+enum tu_cs_mode
+{
+
+ /*
+ * A command stream in TU_CS_MODE_GROW mode grows automatically whenever it
+ * is full. tu_cs_begin must be called before command packet emission and
+ * tu_cs_end must be called after.
+ *
+ * This mode may create multiple entries internally. The entries must be
+ * submitted together.
+ */
+ TU_CS_MODE_GROW,
+
+ /*
+ * A command stream in TU_CS_MODE_EXTERNAL mode wraps an external,
+ * fixed-size buffer. tu_cs_begin and tu_cs_end are optional and have no
+ * effect on it.
+ *
+ * This mode does not create any entry or any BO.
+ */
+ TU_CS_MODE_EXTERNAL,
+};
+
+struct tu_cs
+{
+ uint32_t *start;
+ uint32_t *cur;
+ uint32_t *reserved_end;
+ uint32_t *end;
+
+ enum tu_cs_mode mode;
+ uint32_t next_bo_size;
+
+ struct tu_cs_entry *entries;
+ uint32_t entry_count;
+ uint32_t entry_capacity;
+
+ struct tu_bo **bos;
+ uint32_t bo_count;
+ uint32_t bo_capacity;
+};
+
struct tu_device_memory
{
struct tu_bo bo;
@@ -768,33 +819,6 @@ tu_bo_list_add(struct tu_bo_list *list,
VkResult
tu_bo_list_merge(struct tu_bo_list *list, const struct tu_bo_list *other);
-struct tu_cs_entry
-{
- /* No ownership */
- const struct tu_bo *bo;
-
- uint32_t size;
- uint64_t offset;
-};
-
-struct tu_cs
-{
- uint32_t *start;
- uint32_t *cur;
- uint32_t *reserved_end;
- uint32_t *end;
-
- uint32_t next_bo_size;
-
- struct tu_cs_entry *entries;
- uint32_t entry_count;
- uint32_t entry_capacity;
-
- struct tu_bo **bos;
- uint32_t bo_count;
- uint32_t bo_capacity;
-};
-
struct tu_cmd_buffer
{
VK_LOADER_DATA _loader_data;