]> git.baikalelectronics.ru Git - kernel.git/commit
drm/vc4: Add support for branching in shader validation.
authorEric Anholt <eric@anholt.net>
Sat, 2 Jul 2016 19:17:10 +0000 (12:17 -0700)
committerEric Anholt <eric@anholt.net>
Fri, 15 Jul 2016 22:19:50 +0000 (15:19 -0700)
commitb5fa337a12e0bb65c584d4de16cebada6f300639
tree13a537d8fc387d061cdf2d28f0b6599a80aa3237
parentf6f6bebea8aed03411ee8a81a5e6d9300d8a3255
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>
drivers/gpu/drm/vc4/vc4_drv.h
drivers/gpu/drm/vc4/vc4_qpu_defines.h
drivers/gpu/drm/vc4/vc4_validate.c
drivers/gpu/drm/vc4/vc4_validate_shaders.c