vc4: Don't forget to validate code that's got PROG_END on it.

This signal doesn't terminate the program now, it terminates the program
soon.  So you have to actually validate the code in the instruction.
This commit is contained in:
Eric Anholt
2014-10-24 20:50:20 +01:00
parent fc1eb614a7
commit 8911879dec
@@ -261,6 +261,7 @@ vc4_validate_shader(struct drm_gem_cma_object *shader_obj,
case QPU_SIG_COLOR_LOAD:
case QPU_SIG_LOAD_TMU0:
case QPU_SIG_LOAD_TMU1:
case QPU_SIG_PROG_END:
if (!check_instruction_writes(inst, validated_shader,
&validation_state)) {
DRM_ERROR("Bad write at ip %d\n", ip);
@@ -270,6 +271,11 @@ vc4_validate_shader(struct drm_gem_cma_object *shader_obj,
if (!check_instruction_reads(inst, validated_shader))
goto fail;
if (sig == QPU_SIG_PROG_END) {
found_shader_end = true;
shader_end_ip = ip;
}
break;
case QPU_SIG_LOAD_IMM:
@@ -280,11 +286,6 @@ vc4_validate_shader(struct drm_gem_cma_object *shader_obj,
}
break;
case QPU_SIG_PROG_END:
found_shader_end = true;
shader_end_ip = ip;
break;
default:
DRM_ERROR("Unsupported QPU signal %d at "
"instruction %d\n", sig, ip);