vc4: Don't forget to validate code that's got PROG_END on it.
authorEric Anholt <eric@anholt.net>
Fri, 24 Oct 2014 19:50:20 +0000 (20:50 +0100)
committerEric Anholt <eric@anholt.net>
Wed, 29 Oct 2014 00:15:36 +0000 (17:15 -0700)
This signal doesn't terminate the program now, it terminates the program
soon.  So you have to actually validate the code in the instruction.

src/gallium/drivers/vc4/kernel/vc4_validate_shaders.c

index 56c4a1767dc362bf8e3becd500079eea566035f8..fdce0335e12213b8a5d93d8ac2d7349ff05eac08 100644 (file)
@@ -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);