aboutsummaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/vc4/vc4_validate_shaders.c
AgeCommit message (Collapse)AuthorFilesLines
2016-08-30drm/vc4: Allow some more signals to be packed with uniform resets.Eric Anholt1-2/+8
The intent was to make sure people don't sneak in a small immediate or something to change the interpretation of the uniform update args, but these signals are just fine. Fixes a validation failure in the current X server on some Render operation. Signed-off-by: Eric Anholt <eric@anholt.net>
2016-07-15drm/vc4: Fix a "the the" typo in a comment.Eric Anholt1-1/+1
Signed-off-by: Eric Anholt <eric@anholt.net>
2016-07-15drm/vc4: Add support for branching in shader validation.Eric Anholt1-16/+265
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>
2016-07-15drm/vc4: Add a bitmap of branch targets during shader validation.Eric Anholt1-2/+112
This isn't used yet, it's just a first step toward loop validation. During the main parsing of instructions, we need to know when we hit a new basic block so that we can reset validated state. v2: Fix a stray semicolon after an if block. (caught by kbuild test). Signed-off-by: Eric Anholt <eric@anholt.net>
2016-07-14drm/vc4: Move validation's current/max ip into the validation struct.Eric Anholt1-24/+30
Reduces the argument count for some of the functions, and will be used more with the upcoming looping support. Signed-off-by: Eric Anholt <eric@anholt.net>
2015-12-07drm/vc4: Add an API for creating GPU shaders in GEM BOs.Eric Anholt1-0/+513
Since we have no MMU, the kernel needs to validate that the submitted shader code won't make any accesses to memory that the user doesn't control, which involves banning some operations (general purpose DMA writes), and tracking where we need to write out pointers for other operations (texture sampling). Once it's validated, we return a GEM BO containing the shader, which doesn't allow mapping for write or exporting to other subsystems. v2: Use __u32-style types. Signed-off-by: Eric Anholt <eric@anholt.net>