vc4: Move bin CL trailer to job_submit() time.
authorEric Anholt <eric@anholt.net>
Thu, 8 Sep 2016 21:01:15 +0000 (14:01 -0700)
committerEric Anholt <eric@anholt.net>
Wed, 14 Sep 2016 05:08:03 +0000 (06:08 +0100)
To implement job shuffling, I want to be able to call submit() on specific
jobs, turning vc4_flush() into the context's flush-all-jobs hook.

src/gallium/drivers/vc4/vc4_context.c
src/gallium/drivers/vc4/vc4_job.c

index a85554a43dd1fe08d96e7a19289f8be96bb7d6d4..8b174f3e6b19e1e94640519e0471a78186eb75c0 100644 (file)
@@ -56,17 +56,6 @@ vc4_flush(struct pipe_context *pctx)
                 return;
         }
 
-        /* Increment the semaphore indicating that binning is done and
-         * unblocking the render thread.  Note that this doesn't act until the
-         * FLUSH completes.
-         */
-        cl_ensure_space(&vc4->bcl, 8);
-        struct vc4_cl_out *bcl = cl_start(&vc4->bcl);
-        cl_u8(&bcl, VC4_PACKET_INCREMENT_SEMAPHORE);
-        /* The FLUSH caps all of our bin lists with a VC4_PACKET_RETURN. */
-        cl_u8(&bcl, VC4_PACKET_FLUSH);
-        cl_end(&vc4->bcl, bcl);
-
         if (cbuf && (vc4->resolve & PIPE_CLEAR_COLOR0)) {
                 pipe_surface_reference(&vc4->color_write,
                                        cbuf->texture->nr_samples > 1 ?
index 41660f6ac4daffef78ecddb32dc2be651a7ab6ff..d8c11154e915d36bb2ebe73371745bd41f6b5a96 100644 (file)
@@ -175,6 +175,20 @@ vc4_job_submit(struct vc4_context *vc4)
                 vc4_dump_cl(vc4->bcl.base, cl_offset(&vc4->bcl), false);
         }
 
+        if (cl_offset(&vc4->bcl) > 0) {
+                /* Increment the semaphore indicating that binning is done and
+                 * unblocking the render thread.  Note that this doesn't act
+                 * until the FLUSH completes.
+                 */
+                cl_ensure_space(&vc4->bcl, 8);
+                struct vc4_cl_out *bcl = cl_start(&vc4->bcl);
+                cl_u8(&bcl, VC4_PACKET_INCREMENT_SEMAPHORE);
+                /* The FLUSH caps all of our bin lists with a
+                 * VC4_PACKET_RETURN.
+                 */
+                cl_u8(&bcl, VC4_PACKET_FLUSH);
+                cl_end(&vc4->bcl, bcl);
+        }
         struct drm_vc4_submit_cl submit;
         memset(&submit, 0, sizeof(submit));