summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/vc4/vc4_qpu_defines.h
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2016-07-02 12:17:10 -0700
committerEric Anholt <eric@anholt.net>2016-07-15 15:19:50 -0700
commit6d45c81d229d71da54d374143e7d6abad4c0cf31 (patch)
tree13a537d8fc387d061cdf2d28f0b6599a80aa3237 /drivers/gpu/drm/vc4/vc4_qpu_defines.h
parent93aa9ae3e5523e49e4e5abacd4dbee0e4ab2d931 (diff)
downloadlinux-6d45c81d229d71da54d374143e7d6abad4c0cf31.tar.gz
linux-6d45c81d229d71da54d374143e7d6abad4c0cf31.tar.bz2
linux-6d45c81d229d71da54d374143e7d6abad4c0cf31.zip
drm/vc4: Add support for branching in shader validation.
We're already checking that branch instructions are between the start of the shader and the proper PROG_END sequence. The other thing we need to make branching safe is to verify that the shader doesn't read past the end of the uniforms stream. To do that, we require that at any basic block reading uniforms have the following instructions: load_imm temp, <next offset within uniform stream> add unif_addr, temp, unif The instructions are generated by userspace, and the kernel verifies that the load_imm is of the expected offset, and that the add adds it to a uniform. We track which uniform in the stream that is, and at draw call time fix up the uniform stream to have the address of the start of the shader's uniforms at that location. Signed-off-by: Eric Anholt <eric@anholt.net>
Diffstat (limited to 'drivers/gpu/drm/vc4/vc4_qpu_defines.h')
-rw-r--r--drivers/gpu/drm/vc4/vc4_qpu_defines.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/gpu/drm/vc4/vc4_qpu_defines.h b/drivers/gpu/drm/vc4/vc4_qpu_defines.h
index 82ef0e525d55..6d0745720a17 100644
--- a/drivers/gpu/drm/vc4/vc4_qpu_defines.h
+++ b/drivers/gpu/drm/vc4/vc4_qpu_defines.h
@@ -270,6 +270,9 @@ enum qpu_unpack_r4 {
#define QPU_OP_ADD_SHIFT 24
#define QPU_OP_ADD_MASK QPU_MASK(28, 24)
+#define QPU_LOAD_IMM_SHIFT 0
+#define QPU_LOAD_IMM_MASK QPU_MASK(31, 0)
+
#define QPU_BRANCH_TARGET_SHIFT 0
#define QPU_BRANCH_TARGET_MASK QPU_MASK(31, 0)