Mesa (master): broadcom/vc4: Implement GL_ARB_texture_barrier.

Eric Anholt anholt at kemper.freedesktop.org
Tue Oct 10 17:50:55 UTC 2017


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

Author: Eric Anholt <eric at anholt.net>
Date:   Thu Oct  5 11:08:23 2017 -0700

broadcom/vc4: Implement GL_ARB_texture_barrier.

Improves x11perf -copywinwin100 from ~2000/sec to ~4700/sec.  More
importantly, this is a prerequisite for the new GL_MESA_tile_raster_order
extension.

---

 src/gallium/drivers/vc4/vc4_context.c | 11 +++++++++++
 src/gallium/drivers/vc4/vc4_screen.c  |  2 +-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/vc4/vc4_context.c b/src/gallium/drivers/vc4/vc4_context.c
index 401c160fcc..a9e7ff91f3 100644
--- a/src/gallium/drivers/vc4/vc4_context.c
+++ b/src/gallium/drivers/vc4/vc4_context.c
@@ -66,6 +66,16 @@ vc4_pipe_flush(struct pipe_context *pctx, struct pipe_fence_handle **fence,
         }
 }
 
+/* We can't flush the texture cache within rendering a tile, so we have to
+ * flush all rendering to the kernel so that the next job reading from the
+ * tile gets a flushed cache.
+ */
+static void
+vc4_texture_barrier(struct pipe_context *pctx, unsigned flags)
+{
+        vc4_flush(pctx);
+}
+
 static void
 vc4_invalidate_resource(struct pipe_context *pctx, struct pipe_resource *prsc)
 {
@@ -132,6 +142,7 @@ vc4_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags)
         pctx->destroy = vc4_context_destroy;
         pctx->flush = vc4_pipe_flush;
         pctx->invalidate_resource = vc4_invalidate_resource;
+        pctx->texture_barrier = vc4_texture_barrier;
 
         vc4_draw_init(pctx);
         vc4_state_init(pctx);
diff --git a/src/gallium/drivers/vc4/vc4_screen.c b/src/gallium/drivers/vc4/vc4_screen.c
index 1f587732d2..6b75753215 100644
--- a/src/gallium/drivers/vc4/vc4_screen.c
+++ b/src/gallium/drivers/vc4/vc4_screen.c
@@ -132,6 +132,7 @@ vc4_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
         case PIPE_CAP_TEXTURE_SWIZZLE:
         case PIPE_CAP_GLSL_OPTIMIZE_CONSERVATIVELY:
         case PIPE_CAP_ALLOW_MAPPED_BUFFERS_DURING_EXECUTION:
+        case PIPE_CAP_TEXTURE_BARRIER:
                 return 1;
 
                 /* lying for GL 2.0 */
@@ -178,7 +179,6 @@ vc4_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
         case PIPE_CAP_PREFER_BLIT_BASED_TEXTURE_TRANSFER:
         case PIPE_CAP_CONDITIONAL_RENDER:
         case PIPE_CAP_PRIMITIVE_RESTART:
-        case PIPE_CAP_TEXTURE_BARRIER:
         case PIPE_CAP_SM3:
         case PIPE_CAP_INDEP_BLEND_ENABLE:
         case PIPE_CAP_INDEP_BLEND_FUNC:




More information about the mesa-commit mailing list