summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIago Toral Quiroga <itoral@igalia.com>2019-12-11 10:10:27 +0100
committerMarge Bot <eric+marge@anholt.net>2020-10-13 21:21:25 +0000
commit9ac32610762f62d4117d359b9bc82a0c1aa8f70f (patch)
treec47aaac21811d4eb01ece7c51d7d28cea9eb1ee8
parentdc005f26771d78906cac283b02a10bb7e5c0e2c6 (diff)
v3dv: add a concept of a command list
Just barebones for now, will expand as necessary as we start emitting actual commands into command lists. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
-rw-r--r--src/broadcom/vulkan/meson.build1
-rw-r--r--src/broadcom/vulkan/v3dv_cl.c54
-rw-r--r--src/broadcom/vulkan/v3dv_cl.h49
-rw-r--r--src/broadcom/vulkan/v3dv_private.h19
4 files changed, 114 insertions, 9 deletions
diff --git a/src/broadcom/vulkan/meson.build b/src/broadcom/vulkan/meson.build
index d8bf8fbb83a..161e1a0c87d 100644
--- a/src/broadcom/vulkan/meson.build
+++ b/src/broadcom/vulkan/meson.build
@@ -53,6 +53,7 @@ v3dv_extensions_h = custom_target(
libv3dv_files = files(
'v3dv_bo.c',
+ 'v3dv_cl.c',
'v3dv_cmd_buffer.c',
'v3dv_debug.c',
'v3dv_debug.h',
diff --git a/src/broadcom/vulkan/v3dv_cl.c b/src/broadcom/vulkan/v3dv_cl.c
new file mode 100644
index 00000000000..0cc86d7c2cb
--- /dev/null
+++ b/src/broadcom/vulkan/v3dv_cl.c
@@ -0,0 +1,54 @@
+/*
+ * Copyright © 2019 Raspberry Pi
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#include "v3dv_private.h"
+
+void
+v3dv_cl_init(struct v3dv_cmd_buffer *cmd_buffer, struct v3dv_cl *cl)
+{
+ cl->base = NULL;
+ cl->next = cl->base;
+ cl->bo = NULL;
+ cl->size = 0;
+ cl->cmd_buffer = cmd_buffer;
+}
+
+void
+v3dv_cl_reset(struct v3dv_cl *cl)
+{
+ /* FIXME: consider keeping the BO when the command buffer is reset with
+ * flag VK_COMMAND_BUFFER_RESET_RELEASE_RESOURCES_BIT.
+ */
+ v3dv_cl_destroy(cl);
+ v3dv_cl_init(cl->cmd_buffer, cl);
+}
+
+void
+v3dv_cl_destroy(struct v3dv_cl *cl)
+{
+ assert(cl);
+ if (cl->bo) {
+ assert(cl->cmd_buffer && cl->cmd_buffer->device);
+ v3dv_bo_free(cl->cmd_buffer->device, cl->bo);
+ }
+}
diff --git a/src/broadcom/vulkan/v3dv_cl.h b/src/broadcom/vulkan/v3dv_cl.h
new file mode 100644
index 00000000000..438ee22fa19
--- /dev/null
+++ b/src/broadcom/vulkan/v3dv_cl.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright © 2019 Raspberry Pi
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#ifndef V3DV_CL_H
+#define V3DV_CL_H
+
+struct v3dv_bo;
+struct v3dv_cmd_buffer;
+struct v3dv_cl;
+
+/**
+ * Undefined structure, used for typechecking that you're passing the pointers
+ * to these functions correctly.
+ */
+struct v3dv_cl_out;
+
+struct v3dv_cl {
+ void *base;
+ struct v3dv_cmd_buffer *cmd_buffer;
+ struct v3dv_cl_out *next;
+ struct v3dv_bo *bo;
+ uint32_t size;
+};
+
+void v3dv_cl_init(struct v3dv_cmd_buffer *cmd_buffer, struct v3dv_cl *cl);
+void v3dv_cl_reset(struct v3dv_cl *cl);
+void v3dv_cl_destroy(struct v3dv_cl *cl);
+
+#endif /* V3DV_CL_H */
diff --git a/src/broadcom/vulkan/v3dv_private.h b/src/broadcom/vulkan/v3dv_private.h
index fc7d1b0c159..7e14c748f01 100644
--- a/src/broadcom/vulkan/v3dv_private.h
+++ b/src/broadcom/vulkan/v3dv_private.h
@@ -55,6 +55,16 @@
#include "v3dv_extensions.h"
#include "v3dv_bo.h"
+/* FIXME: hooks for the packet definition functions. */
+static inline void
+pack_emit_reloc(void *cl, const void *reloc) {}
+
+#define __gen_user_data char
+#define __gen_address_type char
+#define __gen_emit_reloc pack_emit_reloc
+#define __gen_address_offset(reloc) (0)
+#include "v3dv_cl.h"
+
#include "vk_alloc.h"
#include "simulator/v3d_simulator.h"
@@ -74,15 +84,6 @@
#define v3dv_assert(x)
#endif
-/* FIXME: hooks for the packet definition functions. */
-static inline void
-pack_emit_reloc(void *cl, const void *reloc) {}
-
-#define __gen_user_data char
-#define __gen_address_type char
-#define __gen_emit_reloc pack_emit_reloc
-#define __gen_address_offset(reloc) (0)
-
struct v3dv_instance;
#ifdef USE_V3D_SIMULATOR