Mesa (master): broadcom/vc5: Move the BCL epilogue code to a per-version compile.

Eric Anholt anholt at kemper.freedesktop.org
Tue Mar 27 00:49:26 UTC 2018


Module: Mesa
Branch: master
Commit: 1fa820cef861b0f2efd001cfb3c4adecf2fa549b
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=1fa820cef861b0f2efd001cfb3c4adecf2fa549b

Author: Eric Anholt <eric at anholt.net>
Date:   Fri Mar 23 15:19:05 2018 -0700

broadcom/vc5: Move the BCL epilogue code to a per-version compile.

I need to do some new packets for transform feedback on 4.1.

---

 src/gallium/drivers/vc5/Makefile.sources |  1 +
 src/gallium/drivers/vc5/meson.build      |  1 +
 src/gallium/drivers/vc5/v3dx_context.h   |  2 ++
 src/gallium/drivers/vc5/v3dx_job.c       | 59 ++++++++++++++++++++++++++++++++
 src/gallium/drivers/vc5/vc5_job.c        | 28 +++------------
 5 files changed, 67 insertions(+), 24 deletions(-)

diff --git a/src/gallium/drivers/vc5/Makefile.sources b/src/gallium/drivers/vc5/Makefile.sources
index 0259ecc99b..c1e4e0b023 100644
--- a/src/gallium/drivers/vc5/Makefile.sources
+++ b/src/gallium/drivers/vc5/Makefile.sources
@@ -28,6 +28,7 @@ C_SOURCES := \
 VC5_PER_VERSION_SOURCES = \
 	v3dx_context.h \
 	v3dx_format_table.c \
+	v3dx_job.c \
 	v3dx_simulator.c \
 	vc5_draw.c \
 	vc5_emit.c \
diff --git a/src/gallium/drivers/vc5/meson.build b/src/gallium/drivers/vc5/meson.build
index 005bf2f9b8..4f20c2697e 100644
--- a/src/gallium/drivers/vc5/meson.build
+++ b/src/gallium/drivers/vc5/meson.build
@@ -44,6 +44,7 @@ files_libvc5 = files(
 
 files_per_version = files(
   'v3dx_format_table.c',
+  'v3dx_job.c',
   'v3dx_simulator.c',
   'vc5_draw.c',
   'vc5_emit.c',
diff --git a/src/gallium/drivers/vc5/v3dx_context.h b/src/gallium/drivers/vc5/v3dx_context.h
index addc7433b3..f9edd1c636 100644
--- a/src/gallium/drivers/vc5/v3dx_context.h
+++ b/src/gallium/drivers/vc5/v3dx_context.h
@@ -34,6 +34,8 @@ void v3dX(emit_rcl)(struct vc5_job *job);
 void v3dX(draw_init)(struct pipe_context *pctx);
 void v3dX(state_init)(struct pipe_context *pctx);
 
+void v3dX(bcl_epilogue)(struct vc5_context *vc5, struct vc5_job *job);
+
 void v3dX(simulator_init_regs)(struct v3d_hw *v3d);
 int v3dX(simulator_get_param_ioctl)(struct v3d_hw *v3d,
                                     struct drm_vc5_get_param *args);
diff --git a/src/gallium/drivers/vc5/v3dx_job.c b/src/gallium/drivers/vc5/v3dx_job.c
new file mode 100644
index 0000000000..d4b0adfea0
--- /dev/null
+++ b/src/gallium/drivers/vc5/v3dx_job.c
@@ -0,0 +1,59 @@
+/*
+ * Copyright © 2014-2017 Broadcom
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+/** @file v3dx_job.c
+ *
+ * V3D version-specific functions for submitting VC5 render jobs to the
+ * kernel.
+ */
+
+#include "vc5_context.h"
+#include "broadcom/cle/v3dx_pack.h"
+
+void v3dX(bcl_epilogue)(struct vc5_context *vc5, struct vc5_job *job)
+{
+                vc5_cl_ensure_space_with_branch(&job->bcl,
+                                                7 +
+                                                cl_packet_length(OCCLUSION_QUERY_COUNTER));
+
+                if (job->oq_enabled) {
+                        /* Disable the OQ at the end of the CL, so that the
+                         * draw calls at the start of the CL don't inherit the
+                         * OQ counter.
+                         */
+                        cl_emit(&job->bcl, OCCLUSION_QUERY_COUNTER, counter);
+                }
+
+                /* Increment the semaphore indicating that binning is done and
+                 * unblocking the render thread.  Note that this doesn't act
+                 * until the FLUSH completes.
+                 */
+                cl_emit(&job->bcl, INCREMENT_SEMAPHORE, incr);
+
+                /* The FLUSH_ALL emits any unwritten state changes in each
+                 * tile.  We can use this to reset any state that needs to be
+                 * present at the start of the next tile, as we do with
+                 * OCCLUSION_QUERY_COUNTER above.
+                 */
+                cl_emit(&job->bcl, FLUSH_ALL_STATE, flush);
+}
diff --git a/src/gallium/drivers/vc5/vc5_job.c b/src/gallium/drivers/vc5/vc5_job.c
index 213a978e3c..0d0405bf66 100644
--- a/src/gallium/drivers/vc5/vc5_job.c
+++ b/src/gallium/drivers/vc5/vc5_job.c
@@ -383,30 +383,10 @@ vc5_job_submit(struct vc5_context *vc5, struct vc5_job *job)
                 v3d33_emit_rcl(job);
 
         if (cl_offset(&job->bcl) > 0) {
-                vc5_cl_ensure_space_with_branch(&job->bcl,
-                                                7 +
-                                                cl_packet_length(OCCLUSION_QUERY_COUNTER));
-
-                if (job->oq_enabled) {
-                        /* Disable the OQ at the end of the CL, so that the
-                         * draw calls at the start of the CL don't inherit the
-                         * OQ counter.
-                         */
-                        cl_emit(&job->bcl, OCCLUSION_QUERY_COUNTER, counter);
-                }
-
-                /* Increment the semaphore indicating that binning is done and
-                 * unblocking the render thread.  Note that this doesn't act
-                 * until the FLUSH completes.
-                 */
-                cl_emit(&job->bcl, INCREMENT_SEMAPHORE, incr);
-
-                /* The FLUSH_ALL emits any unwritten state changes in each
-                 * tile.  We can use this to reset any state that needs to be
-                 * present at the start of the next tile, as we do with
-                 * OCCLUSION_QUERY_COUNTER above.
-                 */
-                cl_emit(&job->bcl, FLUSH_ALL_STATE, flush);
+                if (screen->devinfo.ver >= 41)
+                        v3d41_bcl_epilogue(vc5, job);
+                else
+                        v3d33_bcl_epilogue(vc5, job);
         }
 
         job->submit.bcl_end = job->bcl.bo->offset + cl_offset(&job->bcl);




More information about the mesa-commit mailing list