broadcom/vc5: Move V3D 3.3 VPM write setup to a separate file.
authorEric Anholt <eric@anholt.net>
Wed, 10 Jan 2018 20:22:38 +0000 (12:22 -0800)
committerEric Anholt <eric@anholt.net>
Sat, 13 Jan 2018 05:56:24 +0000 (21:56 -0800)
For V4.1 texturing, I need the V4.1 XML, so the main compiler needs to
stop including V3.3 XML.

src/broadcom/Makefile.sources
src/broadcom/compiler/meson.build
src/broadcom/compiler/nir_to_vir.c
src/broadcom/compiler/v3d33_vpm_setup.c [new file with mode: 0644]
src/broadcom/compiler/v3d_compiler.h

index 2a6351b9a11bcd83f3325d6828442caf0a017b44..827c1944af6c59b803c59ce846704d07876ae6b4 100644 (file)
@@ -29,6 +29,7 @@ BROADCOM_FILES = \
        compiler/vir_to_qpu.c \
        compiler/qpu_schedule.c \
        compiler/qpu_validate.c \
+       compiler/v3d33_vpm_setup.c \
        compiler/v3d_compiler.h \
        compiler/v3d_nir_lower_io.c \
        compiler/v3d_nir_lower_txf_ms.c \
index 8f2ee7542c0c2b223a4bdfd8ce83b19b52024cb7..8a7211b649ced7b2d24ae4a1123a1632bb4621c8 100644 (file)
@@ -30,6 +30,7 @@ libbroadcom_compiler_files = files(
   'vir_to_qpu.c',
   'qpu_schedule.c',
   'qpu_validate.c',
+  'v3d33_vpm_setup.c',
   'v3d_compiler.h',
   'v3d_nir_lower_io.c',
   'v3d_nir_lower_txf_ms.c',
index 0400a683b714b78e5ea167a88c9e4e64e942bae9..e76a87ca4cb283a1b51a30e887055679f7c89f24 100644 (file)
@@ -1315,22 +1315,7 @@ emit_vpm_write_setup(struct v3d_compile *c)
         if (c->devinfo->ver >= 40)
                 return;
 
-        uint32_t packed;
-        struct V3D33_VPM_GENERIC_BLOCK_WRITE_SETUP unpacked = {
-                V3D33_VPM_GENERIC_BLOCK_WRITE_SETUP_header,
-
-                .horiz = true,
-                .laned = false,
-                .segs = true,
-                .stride = 1,
-                .size = VPM_SETUP_SIZE_32_BIT,
-                .addr = 0,
-        };
-
-        V3D33_VPM_GENERIC_BLOCK_WRITE_SETUP_pack(NULL,
-                                                (uint8_t *)&packed,
-                                                &unpacked);
-        vir_VPMSETUP(c, vir_uniform_ui(c, packed));
+        v3d33_vir_vpm_write_setup(c);
 }
 
 static void
@@ -1443,24 +1428,7 @@ ntq_emit_vpm_read(struct v3d_compile *c,
 
         uint32_t num_components = MIN2(*remaining, 32);
 
-        struct V3D33_VPM_GENERIC_BLOCK_READ_SETUP unpacked = {
-                V3D33_VPM_GENERIC_BLOCK_READ_SETUP_header,
-
-                .horiz = true,
-                .laned = false,
-                /* If the field is 0, that means a read count of 32. */
-                .num = num_components & 31,
-                .segs = true,
-                .stride = 1,
-                .size = VPM_SETUP_SIZE_32_BIT,
-                .addr = c->num_inputs,
-        };
-
-        uint32_t packed;
-        V3D33_VPM_GENERIC_BLOCK_READ_SETUP_pack(NULL,
-                                                (uint8_t *)&packed,
-                                                &unpacked);
-        vir_VPMSETUP(c, vir_uniform_ui(c, packed));
+        v3d33_vir_vpm_read_setup(c, num_components);
 
         *num_components_queued = num_components - 1;
         *remaining -= num_components;
diff --git a/src/broadcom/compiler/v3d33_vpm_setup.c b/src/broadcom/compiler/v3d33_vpm_setup.c
new file mode 100644 (file)
index 0000000..8bce67d
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+ * Copyright © 2016-2018 Broadcom
+ *
+ * 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 "v3d_compiler.h"
+
+/* We don't do any address packing. */
+#define __gen_user_data void
+#define __gen_address_type uint32_t
+#define __gen_address_offset(reloc) (*reloc)
+#define __gen_emit_reloc(cl, reloc)
+#include "broadcom/cle/v3d_packet_v33_pack.h"
+
+void
+v3d33_vir_vpm_read_setup(struct v3d_compile *c, int num_components)
+{
+        struct V3D33_VPM_GENERIC_BLOCK_READ_SETUP unpacked = {
+                V3D33_VPM_GENERIC_BLOCK_READ_SETUP_header,
+
+                .horiz = true,
+                .laned = false,
+                /* If the field is 0, that means a read count of 32. */
+                .num = num_components & 31,
+                .segs = true,
+                .stride = 1,
+                .size = VPM_SETUP_SIZE_32_BIT,
+                .addr = c->num_inputs,
+        };
+
+        uint32_t packed;
+        V3D33_VPM_GENERIC_BLOCK_READ_SETUP_pack(NULL,
+                                                (uint8_t *)&packed,
+                                                &unpacked);
+        vir_VPMSETUP(c, vir_uniform_ui(c, packed));
+}
+
+void
+v3d33_vir_vpm_write_setup(struct v3d_compile *c)
+{
+        uint32_t packed;
+        struct V3D33_VPM_GENERIC_BLOCK_WRITE_SETUP unpacked = {
+                V3D33_VPM_GENERIC_BLOCK_WRITE_SETUP_header,
+
+                .horiz = true,
+                .laned = false,
+                .segs = true,
+                .stride = 1,
+                .size = VPM_SETUP_SIZE_32_BIT,
+                .addr = 0,
+        };
+
+        V3D33_VPM_GENERIC_BLOCK_WRITE_SETUP_pack(NULL,
+                                                (uint8_t *)&packed,
+                                                &unpacked);
+        vir_VPMSETUP(c, vir_uniform_ui(c, packed));
+}
index cb3614edcb65e60f996ffbaa8c70f78725200dbb..15cc16ceb6067f723719c31b4009fbfcdd85673c 100644 (file)
@@ -684,6 +684,9 @@ void v3d_nir_lower_io(nir_shader *s, struct v3d_compile *c);
 void v3d_nir_lower_txf_ms(nir_shader *s, struct v3d_compile *c);
 void vir_lower_uniforms(struct v3d_compile *c);
 
+void v3d33_vir_vpm_read_setup(struct v3d_compile *c, int num_components);
+void v3d33_vir_vpm_write_setup(struct v3d_compile *c);
+
 void v3d_vir_to_qpu(struct v3d_compile *c, struct qpu_reg *temp_registers);
 uint32_t v3d_qpu_schedule_instructions(struct v3d_compile *c);
 void qpu_validate(struct v3d_compile *c);