summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/vc5/vc5_rcl.c
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2018-03-30 16:50:23 -0700
committerEric Anholt <[email protected]>2018-04-12 11:20:50 -0700
commitdd9c476165bd4d76c5aec8f7320b7ed9d961ac7c (patch)
treef63159b562e3f09ad7d4e83add707fd418f8eb3e /src/gallium/drivers/vc5/vc5_rcl.c
parent6a21a582fba74e3566f7b240702c19cbe2559a06 (diff)
broadcom/vc5: Move flush_last_load into load_general, like for stores.
This should avoid mistakes with not flushing as we change the series of loads. Already, it fixes a hopefully unreachable case where we were emitting just the TILE_COORDINATES and not the dummy store that needs to go with it.
Diffstat (limited to 'src/gallium/drivers/vc5/vc5_rcl.c')
-rw-r--r--src/gallium/drivers/vc5/vc5_rcl.c57
1 files changed, 29 insertions, 28 deletions
diff --git a/src/gallium/drivers/vc5/vc5_rcl.c b/src/gallium/drivers/vc5/vc5_rcl.c
index cd43e9d5464..2b1309bc1a9 100644
--- a/src/gallium/drivers/vc5/vc5_rcl.c
+++ b/src/gallium/drivers/vc5/vc5_rcl.c
@@ -34,8 +34,26 @@
#define PIPE_FIRST_COLOR_BUFFER_BIT (ffs(PIPE_CLEAR_COLOR0) - 1)
+/* The HW queues up the load until the tile coordinates show up, but can only
+ * track one at a time. If we need to do more than one load, then we need to
+ * flush out the previous load by emitting the tile coordinates and doing a
+ * dummy store.
+ */
+static void
+flush_last_load(struct vc5_cl *cl)
+{
+ if (V3D_VERSION >= 40)
+ return;
+
+ cl_emit(cl, TILE_COORDINATES_IMPLICIT, coords);
+ cl_emit(cl, STORE_TILE_BUFFER_GENERAL, store) {
+ store.buffer_to_store = NONE;
+ }
+}
+
static void
-load_general(struct vc5_cl *cl, struct pipe_surface *psurf, int buffer)
+load_general(struct vc5_cl *cl, struct pipe_surface *psurf, int buffer,
+ uint32_t pipe_bit, uint32_t *loads_pending)
{
struct vc5_surface *surf = vc5_surface(psurf);
bool separate_stencil = surf->separate_stencil && buffer == STENCIL;
@@ -78,6 +96,10 @@ load_general(struct vc5_cl *cl, struct pipe_surface *psurf, int buffer)
surf->padded_height_of_output_image_in_uif_blocks;
#endif /* V3D_VERSION < 40 */
}
+
+ *loads_pending &= ~pipe_bit;
+ if (*loads_pending)
+ flush_last_load(cl);
}
static void
@@ -171,23 +193,6 @@ zs_buffer_from_pipe_bits(int pipe_clear_bits)
}
}
-/* The HW queues up the load until the tile coordinates show up, but can only
- * track one at a time. If we need to do more than one load, then we need to
- * flush out the previous load by emitting the tile coordinates and doing a
- * dummy store.
- */
-static void
-flush_last_load(struct vc5_cl *cl)
-{
- if (V3D_VERSION >= 40)
- return;
-
- cl_emit(cl, TILE_COORDINATES_IMPLICIT, coords);
- cl_emit(cl, STORE_TILE_BUFFER_GENERAL, store) {
- store.buffer_to_store = NONE;
- }
-}
-
static void
vc5_rcl_emit_loads(struct vc5_job *job, struct vc5_cl *cl)
{
@@ -204,21 +209,17 @@ vc5_rcl_emit_loads(struct vc5_job *job, struct vc5_cl *cl)
continue;
}
- load_general(cl, psurf, RENDER_TARGET_0 + i);
- loads_pending &= ~bit;
-
- if (loads_pending)
- flush_last_load(cl);
+ load_general(cl, psurf, RENDER_TARGET_0 + i,
+ bit, &loads_pending);
}
- if (loads_pending & PIPE_CLEAR_DEPTHSTENCIL &&
+ if ((loads_pending & PIPE_CLEAR_DEPTHSTENCIL) &&
(V3D_VERSION >= 40 ||
(job->zsbuf && job->zsbuf->texture->nr_samples > 1))) {
load_general(cl, job->zsbuf,
- zs_buffer_from_pipe_bits(loads_pending));
- loads_pending &= ~PIPE_CLEAR_DEPTHSTENCIL;
- if (loads_pending)
- cl_emit(cl, TILE_COORDINATES_IMPLICIT, coords);
+ zs_buffer_from_pipe_bits(loads_pending),
+ PIPE_CLEAR_DEPTHSTENCIL,
+ &loads_pending);
}
#if V3D_VERSION < 40