summaryrefslogtreecommitdiff
path: root/lib/mesa/src/broadcom/common
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2019-05-23 05:01:20 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2019-05-23 05:01:20 +0000
commite2a3acb64af2657b1181806818eacad061103c23 (patch)
tree7535f61f2c3f8a69404befb400ecca145be4429c /lib/mesa/src/broadcom/common
parent1e3bb66f697283b6bd192f3a000d99d637624079 (diff)
Import Mesa 19.0.5
Diffstat (limited to 'lib/mesa/src/broadcom/common')
-rw-r--r--lib/mesa/src/broadcom/common/v3d_cpu_tiling.h242
-rw-r--r--lib/mesa/src/broadcom/common/v3d_debug.c1
-rw-r--r--lib/mesa/src/broadcom/common/v3d_debug.h1
-rw-r--r--lib/mesa/src/broadcom/common/v3d_limits.h42
4 files changed, 286 insertions, 0 deletions
diff --git a/lib/mesa/src/broadcom/common/v3d_cpu_tiling.h b/lib/mesa/src/broadcom/common/v3d_cpu_tiling.h
new file mode 100644
index 000000000..cb1ee7c96
--- /dev/null
+++ b/lib/mesa/src/broadcom/common/v3d_cpu_tiling.h
@@ -0,0 +1,242 @@
+/*
+ * Copyright © 2017 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.
+ */
+
+/** @file v3d_cpu_tiling.h
+ *
+ * Contains load/store functions common to both v3d and vc4. The utile layout
+ * stayed the same, though the way utiles get laid out has changed.
+ */
+
+static inline void
+v3d_load_utile(void *cpu, uint32_t cpu_stride,
+ void *gpu, uint32_t gpu_stride)
+{
+#if defined(V3D_BUILD_NEON) && defined(PIPE_ARCH_ARM)
+ if (gpu_stride == 8) {
+ __asm__ volatile (
+ /* Load from the GPU in one shot, no interleave, to
+ * d0-d7.
+ */
+ "vldm %[gpu], {q0, q1, q2, q3}\n"
+ /* Store each 8-byte line to cpu-side destination,
+ * incrementing it by the stride each time.
+ */
+ "vst1.8 d0, [%[cpu]], %[cpu_stride]\n"
+ "vst1.8 d1, [%[cpu]], %[cpu_stride]\n"
+ "vst1.8 d2, [%[cpu]], %[cpu_stride]\n"
+ "vst1.8 d3, [%[cpu]], %[cpu_stride]\n"
+ "vst1.8 d4, [%[cpu]], %[cpu_stride]\n"
+ "vst1.8 d5, [%[cpu]], %[cpu_stride]\n"
+ "vst1.8 d6, [%[cpu]], %[cpu_stride]\n"
+ "vst1.8 d7, [%[cpu]]\n"
+ : [cpu] "+r"(cpu)
+ : [gpu] "r"(gpu),
+ [cpu_stride] "r"(cpu_stride)
+ : "q0", "q1", "q2", "q3");
+ return;
+ } else if (gpu_stride == 16) {
+ void *cpu2 = cpu + 8;
+ __asm__ volatile (
+ /* Load from the GPU in one shot, no interleave, to
+ * d0-d7.
+ */
+ "vldm %[gpu], {q0, q1, q2, q3};\n"
+ /* Store each 16-byte line in 2 parts to the cpu-side
+ * destination. (vld1 can only store one d-register
+ * at a time).
+ */
+ "vst1.8 d0, [%[cpu]], %[cpu_stride]\n"
+ "vst1.8 d1, [%[cpu2]],%[cpu_stride]\n"
+ "vst1.8 d2, [%[cpu]], %[cpu_stride]\n"
+ "vst1.8 d3, [%[cpu2]],%[cpu_stride]\n"
+ "vst1.8 d4, [%[cpu]], %[cpu_stride]\n"
+ "vst1.8 d5, [%[cpu2]],%[cpu_stride]\n"
+ "vst1.8 d6, [%[cpu]]\n"
+ "vst1.8 d7, [%[cpu2]]\n"
+ : [cpu] "+r"(cpu),
+ [cpu2] "+r"(cpu2)
+ : [gpu] "r"(gpu),
+ [cpu_stride] "r"(cpu_stride)
+ : "q0", "q1", "q2", "q3");
+ return;
+ }
+#elif defined (PIPE_ARCH_AARCH64)
+ if (gpu_stride == 8) {
+ __asm__ volatile (
+ /* Load from the GPU in one shot, no interleave, to
+ * d0-d7.
+ */
+ "ld1 {v0.2d, v1.2d, v2.2d, v3.2d}, [%[gpu]]\n"
+ /* Store each 8-byte line to cpu-side destination,
+ * incrementing it by the stride each time.
+ */
+ "st1 {v0.D}[0], [%[cpu]], %[cpu_stride]\n"
+ "st1 {v0.D}[1], [%[cpu]], %[cpu_stride]\n"
+ "st1 {v1.D}[0], [%[cpu]], %[cpu_stride]\n"
+ "st1 {v1.D}[1], [%[cpu]], %[cpu_stride]\n"
+ "st1 {v2.D}[0], [%[cpu]], %[cpu_stride]\n"
+ "st1 {v2.D}[1], [%[cpu]], %[cpu_stride]\n"
+ "st1 {v3.D}[0], [%[cpu]], %[cpu_stride]\n"
+ "st1 {v3.D}[1], [%[cpu]]\n"
+ : [cpu] "+r"(cpu)
+ : [gpu] "r"(gpu),
+ [cpu_stride] "r"(cpu_stride)
+ : "v0", "v1", "v2", "v3");
+ return;
+ } else if (gpu_stride == 16) {
+ void *cpu2 = cpu + 8;
+ __asm__ volatile (
+ /* Load from the GPU in one shot, no interleave, to
+ * d0-d7.
+ */
+ "ld1 {v0.2d, v1.2d, v2.2d, v3.2d}, [%[gpu]]\n"
+ /* Store each 16-byte line in 2 parts to the cpu-side
+ * destination. (vld1 can only store one d-register
+ * at a time).
+ */
+ "st1 {v0.D}[0], [%[cpu]], %[cpu_stride]\n"
+ "st1 {v0.D}[1], [%[cpu2]],%[cpu_stride]\n"
+ "st1 {v1.D}[0], [%[cpu]], %[cpu_stride]\n"
+ "st1 {v1.D}[1], [%[cpu2]],%[cpu_stride]\n"
+ "st1 {v2.D}[0], [%[cpu]], %[cpu_stride]\n"
+ "st1 {v2.D}[1], [%[cpu2]],%[cpu_stride]\n"
+ "st1 {v3.D}[0], [%[cpu]]\n"
+ "st1 {v3.D}[1], [%[cpu2]]\n"
+ : [cpu] "+r"(cpu),
+ [cpu2] "+r"(cpu2)
+ : [gpu] "r"(gpu),
+ [cpu_stride] "r"(cpu_stride)
+ : "v0", "v1", "v2", "v3");
+ return;
+ }
+#endif
+
+ for (uint32_t gpu_offset = 0; gpu_offset < 64; gpu_offset += gpu_stride) {
+ memcpy(cpu, gpu + gpu_offset, gpu_stride);
+ cpu += cpu_stride;
+ }
+}
+
+static inline void
+v3d_store_utile(void *gpu, uint32_t gpu_stride,
+ void *cpu, uint32_t cpu_stride)
+{
+#if defined(V3D_BUILD_NEON) && defined(PIPE_ARCH_ARM)
+ if (gpu_stride == 8) {
+ __asm__ volatile (
+ /* Load each 8-byte line from cpu-side source,
+ * incrementing it by the stride each time.
+ */
+ "vld1.8 d0, [%[cpu]], %[cpu_stride]\n"
+ "vld1.8 d1, [%[cpu]], %[cpu_stride]\n"
+ "vld1.8 d2, [%[cpu]], %[cpu_stride]\n"
+ "vld1.8 d3, [%[cpu]], %[cpu_stride]\n"
+ "vld1.8 d4, [%[cpu]], %[cpu_stride]\n"
+ "vld1.8 d5, [%[cpu]], %[cpu_stride]\n"
+ "vld1.8 d6, [%[cpu]], %[cpu_stride]\n"
+ "vld1.8 d7, [%[cpu]]\n"
+ /* Load from the GPU in one shot, no interleave, to
+ * d0-d7.
+ */
+ "vstm %[gpu], {q0, q1, q2, q3}\n"
+ : [cpu] "+r"(cpu)
+ : [gpu] "r"(gpu),
+ [cpu_stride] "r"(cpu_stride)
+ : "q0", "q1", "q2", "q3");
+ return;
+ } else if (gpu_stride == 16) {
+ void *cpu2 = cpu + 8;
+ __asm__ volatile (
+ /* Load each 16-byte line in 2 parts from the cpu-side
+ * destination. (vld1 can only store one d-register
+ * at a time).
+ */
+ "vld1.8 d0, [%[cpu]], %[cpu_stride]\n"
+ "vld1.8 d1, [%[cpu2]],%[cpu_stride]\n"
+ "vld1.8 d2, [%[cpu]], %[cpu_stride]\n"
+ "vld1.8 d3, [%[cpu2]],%[cpu_stride]\n"
+ "vld1.8 d4, [%[cpu]], %[cpu_stride]\n"
+ "vld1.8 d5, [%[cpu2]],%[cpu_stride]\n"
+ "vld1.8 d6, [%[cpu]]\n"
+ "vld1.8 d7, [%[cpu2]]\n"
+ /* Store to the GPU in one shot, no interleave. */
+ "vstm %[gpu], {q0, q1, q2, q3}\n"
+ : [cpu] "+r"(cpu),
+ [cpu2] "+r"(cpu2)
+ : [gpu] "r"(gpu),
+ [cpu_stride] "r"(cpu_stride)
+ : "q0", "q1", "q2", "q3");
+ return;
+ }
+#elif defined (PIPE_ARCH_AARCH64)
+ if (gpu_stride == 8) {
+ __asm__ volatile (
+ /* Load each 8-byte line from cpu-side source,
+ * incrementing it by the stride each time.
+ */
+ "ld1 {v0.D}[0], [%[cpu]], %[cpu_stride]\n"
+ "ld1 {v0.D}[1], [%[cpu]], %[cpu_stride]\n"
+ "ld1 {v1.D}[0], [%[cpu]], %[cpu_stride]\n"
+ "ld1 {v1.D}[1], [%[cpu]], %[cpu_stride]\n"
+ "ld1 {v2.D}[0], [%[cpu]], %[cpu_stride]\n"
+ "ld1 {v2.D}[1], [%[cpu]], %[cpu_stride]\n"
+ "ld1 {v3.D}[0], [%[cpu]], %[cpu_stride]\n"
+ "ld1 {v3.D}[1], [%[cpu]]\n"
+ /* Store to the GPU in one shot, no interleave. */
+ "st1 {v0.2d, v1.2d, v2.2d, v3.2d}, [%[gpu]]\n"
+ : [cpu] "+r"(cpu)
+ : [gpu] "r"(gpu),
+ [cpu_stride] "r"(cpu_stride)
+ : "v0", "v1", "v2", "v3");
+ return;
+ } else if (gpu_stride == 16) {
+ void *cpu2 = cpu + 8;
+ __asm__ volatile (
+ /* Load each 16-byte line in 2 parts from the cpu-side
+ * destination. (vld1 can only store one d-register
+ * at a time).
+ */
+ "ld1 {v0.D}[0], [%[cpu]], %[cpu_stride]\n"
+ "ld1 {v0.D}[1], [%[cpu2]],%[cpu_stride]\n"
+ "ld1 {v1.D}[0], [%[cpu]], %[cpu_stride]\n"
+ "ld1 {v1.D}[1], [%[cpu2]],%[cpu_stride]\n"
+ "ld1 {v2.D}[0], [%[cpu]], %[cpu_stride]\n"
+ "ld1 {v2.D}[1], [%[cpu2]],%[cpu_stride]\n"
+ "ld1 {v3.D}[0], [%[cpu]]\n"
+ "ld1 {v3.D}[1], [%[cpu2]]\n"
+ /* Store to the GPU in one shot, no interleave. */
+ "st1 {v0.2d, v1.2d, v2.2d, v3.2d}, [%[gpu]]\n"
+ : [cpu] "+r"(cpu),
+ [cpu2] "+r"(cpu2)
+ : [gpu] "r"(gpu),
+ [cpu_stride] "r"(cpu_stride)
+ : "v0", "v1", "v2", "v3");
+ return;
+ }
+#endif
+
+ for (uint32_t gpu_offset = 0; gpu_offset < 64; gpu_offset += gpu_stride) {
+ memcpy(gpu + gpu_offset, cpu, gpu_stride);
+ cpu += cpu_stride;
+ }
+}
diff --git a/lib/mesa/src/broadcom/common/v3d_debug.c b/lib/mesa/src/broadcom/common/v3d_debug.c
index 97404448e..4a20dd26e 100644
--- a/lib/mesa/src/broadcom/common/v3d_debug.c
+++ b/lib/mesa/src/broadcom/common/v3d_debug.c
@@ -54,6 +54,7 @@ static const struct debug_control debug_control[] = {
{ "vs", V3D_DEBUG_VS},
{ "cs", V3D_DEBUG_CS},
{ "always_flush", V3D_DEBUG_ALWAYS_FLUSH},
+ { "precompile", V3D_DEBUG_PRECOMPILE},
{ NULL, 0 }
};
diff --git a/lib/mesa/src/broadcom/common/v3d_debug.h b/lib/mesa/src/broadcom/common/v3d_debug.h
index d9f5255e2..83c368e35 100644
--- a/lib/mesa/src/broadcom/common/v3d_debug.h
+++ b/lib/mesa/src/broadcom/common/v3d_debug.h
@@ -55,6 +55,7 @@ extern uint32_t V3D_DEBUG;
#define V3D_DEBUG_NORAST (1 << 11)
#define V3D_DEBUG_ALWAYS_FLUSH (1 << 12)
#define V3D_DEBUG_CLIF (1 << 13)
+#define V3D_DEBUG_PRECOMPILE (1 << 14)
#ifdef HAVE_ANDROID_PLATFORM
#define LOG_TAG "BROADCOM-MESA"
diff --git a/lib/mesa/src/broadcom/common/v3d_limits.h b/lib/mesa/src/broadcom/common/v3d_limits.h
new file mode 100644
index 000000000..e21ee246e
--- /dev/null
+++ b/lib/mesa/src/broadcom/common/v3d_limits.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright © 2019 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.
+ */
+
+#ifndef V3D_LIMITS_H
+#define V3D_LIMITS_H
+
+#define V3D_MAX_FS_INPUTS 64
+#define V3D_MAX_VS_INPUTS 64
+
+/* Not specifically a hardware limit, just coordination between compiler and
+ * driver.
+ */
+#define V3D_MAX_TEXTURE_SAMPLERS 16
+
+/* The HW can do 16384 (15), but we run into hangs when we expose that. */
+#define V3D_MAX_MIP_LEVELS 13
+
+#define V3D_MAX_SAMPLES 4
+
+#define V3D_MAX_DRAW_BUFFERS 4
+
+#endif /* V3D_LIMITS_H */