diff options
author | Samuel Pitoiset <[email protected]> | 2016-05-27 00:30:17 +0200 |
---|---|---|
committer | Samuel Pitoiset <[email protected]> | 2016-05-28 15:50:03 +0200 |
commit | f07ade6881e0e5bcb7df07b86e45373dbba650a1 (patch) | |
tree | af094824b82834cf487f9b01cc6eca928b8828c1 /src/gallium | |
parent | 357495b94dad4101a5491ed30782574162de58db (diff) |
nvc0: do not always invalidate 3D CBs when using compute
Constant buffers are aliased between 3D and CP on Fermi, but we should
only invalidate them when a compute shader actually uses CBs and not
all the time after a lauching grid.
Signed-off-by: Samuel Pitoiset <[email protected]>
Reviewed-by: Ilia Mirkin <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/drivers/nouveau/nvc0/nvc0_compute.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_compute.c b/src/gallium/drivers/nouveau/nvc0/nvc0_compute.c index 832c085356f..5cc119c0038 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_compute.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_compute.c @@ -149,6 +149,19 @@ nvc0_compute_validate_textures(struct nvc0_context *nvc0) nvc0->dirty_3d |= NVC0_NEW_3D_TEXTURES; } +static inline void +nvc0_compute_invalidate_constbufs(struct nvc0_context *nvc0) +{ + int s; + + /* Invalidate all 3D constbufs because they are aliased with COMPUTE. */ + for (s = 0; s < 5; s++) { + nvc0->constbuf_dirty[s] |= nvc0->constbuf_valid[s]; + nvc0->state.uniform_buffer_bound[s] = 0; + } + nvc0->dirty_3d |= NVC0_NEW_3D_CONSTBUF; +} + static void nvc0_compute_validate_constbufs(struct nvc0_context *nvc0) { @@ -203,6 +216,8 @@ nvc0_compute_validate_constbufs(struct nvc0_context *nvc0) } } + nvc0_compute_invalidate_constbufs(nvc0); + BEGIN_NVC0(push, NVC0_CP(FLUSH), 1); PUSH_DATA (push, NVC0_COMPUTE_FLUSH_CB); } @@ -358,6 +373,8 @@ nvc0_compute_upload_input(struct nvc0_context *nvc0, const void *input) PUSH_DATA (push, 0); PUSH_DATAp(push, input, cp->parm_size / 4); + nvc0_compute_invalidate_constbufs(nvc0); + BEGIN_NVC0(push, NVC0_CP(FLUSH), 1); PUSH_DATA (push, NVC0_COMPUTE_FLUSH_CB); } @@ -369,7 +386,6 @@ nvc0_launch_grid(struct pipe_context *pipe, const struct pipe_grid_info *info) struct nvc0_context *nvc0 = nvc0_context(pipe); struct nouveau_pushbuf *push = nvc0->base.pushbuf; struct nvc0_program *cp = nvc0->compprog; - unsigned s; int ret; ret = !nvc0_state_validate_cp(nvc0, ~0); @@ -439,11 +455,4 @@ nvc0_launch_grid(struct pipe_context *pipe, const struct pipe_grid_info *info) /* TODO: Not sure if this is really necessary. */ nvc0_compute_invalidate_surfaces(nvc0, 5); - - /* Invalidate all 3D constbufs because they are aliased with COMPUTE. */ - nvc0->dirty_3d |= NVC0_NEW_3D_CONSTBUF; - for (s = 0; s < 5; s++) { - nvc0->constbuf_dirty[s] |= nvc0->constbuf_valid[s]; - nvc0->state.uniform_buffer_bound[s] = 0; - } } |