vc4: Allow submitting jobs with no bin CL in validation.
authorEric Anholt <eric@anholt.net>
Thu, 9 Apr 2015 20:35:57 +0000 (13:35 -0700)
committerEric Anholt <eric@anholt.net>
Tue, 14 Apr 2015 06:20:45 +0000 (23:20 -0700)
For blitting, we want to fire off an RCL-only job.  This takes a bit of
tweaking in our validation and the simulator support (and corresponding
new code in the kernel).

src/gallium/drivers/vc4/kernel/vc4_drv.h
src/gallium/drivers/vc4/kernel/vc4_gem.c
src/gallium/drivers/vc4/kernel/vc4_validate.c
src/gallium/drivers/vc4/vc4_simulator.c

index 12a3ceff725a86926555f3a94f24cd655a15837a..325f944bf25c88d8a698c44c2d40cbf517655552 100644 (file)
@@ -162,6 +162,7 @@ vc4_validate_cl(struct drm_device *dev,
                 void *unvalidated,
                 uint32_t len,
                 bool is_bin,
+                bool has_bin,
                 struct vc4_exec_info *exec);
 
 int
index c9a75733d6db70aee7e1aa0fd4125b955a601bc1..ac29ab35dbca12bd5e9902e708a4387fe28312f1 100644 (file)
@@ -130,6 +130,7 @@ vc4_cl_validate(struct drm_device *dev, struct vc4_exec_info *exec)
                              bin,
                              args->bin_cl_size,
                              true,
+                             args->bin_cl_size != 0,
                              exec);
        if (ret)
                goto fail;
@@ -139,6 +140,7 @@ vc4_cl_validate(struct drm_device *dev, struct vc4_exec_info *exec)
                              render,
                              args->render_cl_size,
                              false,
+                             args->bin_cl_size != 0,
                              exec);
        if (ret)
                goto fail;
index aeac29e036fe0a9b94ee0785dbecf85169c76c3f..2d04a4a7b9aebeac1f16d88d09344754f344361e 100644 (file)
@@ -702,6 +702,7 @@ vc4_validate_cl(struct drm_device *dev,
                void *unvalidated,
                uint32_t len,
                bool is_bin,
+               bool has_bin,
                struct vc4_exec_info *exec)
 {
        uint32_t dst_offset = 0;
@@ -772,7 +773,7 @@ vc4_validate_cl(struct drm_device *dev,
        if (is_bin) {
                exec->ct0ea = exec->ct0ca + dst_offset;
 
-               if (!exec->found_start_tile_binning_packet) {
+               if (has_bin && !exec->found_start_tile_binning_packet) {
                        DRM_ERROR("Bin CL missing VC4_PACKET_START_TILE_BINNING\n");
                        return -EINVAL;
                }
@@ -786,8 +787,10 @@ vc4_validate_cl(struct drm_device *dev,
                 * increment from the bin CL.  Otherwise a later submit would
                 * have render execute immediately.
                 */
-               if (!exec->found_wait_on_semaphore_packet) {
-                       DRM_ERROR("Render CL missing VC4_PACKET_WAIT_ON_SEMAPHORE\n");
+               if (exec->found_wait_on_semaphore_packet != has_bin) {
+                       DRM_ERROR("Render CL %s VC4_PACKET_WAIT_ON_SEMAPHORE\n",
+                                 exec->found_wait_on_semaphore_packet ?
+                                 "has" : "missing");
                        return -EINVAL;
                }
                exec->ct1ea = exec->ct1ca + dst_offset;
index cd8cc5bb56c9bdc11d49c3029fdc3e9554dc93bf..2f72e722fc558edf6db5b4f30b33df7c716da0b8 100644 (file)
@@ -151,14 +151,16 @@ vc4_simulator_flush(struct vc4_context *vc4, struct drm_vc4_submit_cl *args)
         if (ret)
                 return ret;
 
-        int bfc = simpenrose_do_binning(exec.ct0ca, exec.ct0ea);
-        if (bfc != 1) {
-                fprintf(stderr, "Binning returned %d flushes, should be 1.\n",
-                        bfc);
-                fprintf(stderr, "Relocated binning command list:\n");
-                vc4_dump_cl(screen->simulator_mem_base + exec.ct0ca,
-                            exec.ct0ea - exec.ct0ca, false);
-                abort();
+        if (exec.ct0ca != exec.ct0ea) {
+                int bfc = simpenrose_do_binning(exec.ct0ca, exec.ct0ea);
+                if (bfc != 1) {
+                        fprintf(stderr, "Binning returned %d flushes, should be 1.\n",
+                                bfc);
+                        fprintf(stderr, "Relocated binning command list:\n");
+                        vc4_dump_cl(screen->simulator_mem_base + exec.ct0ca,
+                                    exec.ct0ea - exec.ct0ca, false);
+                        abort();
+                }
         }
         int rfc = simpenrose_do_rendering(exec.ct1ca, exec.ct1ea);
         if (rfc != 1) {