diff options
author | Ilia Mirkin <[email protected]> | 2014-07-01 00:49:34 -0400 |
---|---|---|
committer | Ilia Mirkin <[email protected]> | 2014-07-03 20:08:41 -0400 |
commit | 9a37eb8adb6558a4abf47774b583cb582a0ae116 (patch) | |
tree | 78202d7b41dcba2014cbcafb323dcdb3bdf91046 /src/gallium/drivers/nouveau/nvc0/nvc0_context.c | |
parent | 5d4f5218bb71cb387f1a57ea08125245e5039e94 (diff) |
nvc0: add a memory barrier when there are persistent UBOs
Signed-off-by: Ilia Mirkin <[email protected]>
Cc: "10.2" <[email protected]>
Diffstat (limited to 'src/gallium/drivers/nouveau/nvc0/nvc0_context.c')
-rw-r--r-- | src/gallium/drivers/nouveau/nvc0/nvc0_context.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_context.c b/src/gallium/drivers/nouveau/nvc0/nvc0_context.c index e5040c46332..5928c994c5d 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_context.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_context.c @@ -60,7 +60,7 @@ static void nvc0_memory_barrier(struct pipe_context *pipe, unsigned flags) { struct nvc0_context *nvc0 = nvc0_context(pipe); - int i; + int i, s; if (flags & PIPE_BARRIER_MAPPED_BUFFER) { for (i = 0; i < nvc0->num_vtxbufs; ++i) { @@ -73,6 +73,26 @@ nvc0_memory_barrier(struct pipe_context *pipe, unsigned flags) if (nvc0->idxbuf.buffer && nvc0->idxbuf.buffer->flags & PIPE_RESOURCE_FLAG_MAP_PERSISTENT) nvc0->base.vbo_dirty = TRUE; + + for (s = 0; s < 5 && !nvc0->cb_dirty; ++s) { + uint32_t valid = nvc0->constbuf_valid[s]; + + while (valid && !nvc0->cb_dirty) { + const unsigned i = ffs(valid) - 1; + struct pipe_resource *res; + + valid &= ~(1 << i); + if (nvc0->constbuf[s][i].user) + continue; + + res = nvc0->constbuf[s][i].u.buf; + if (!res) + continue; + + if (res->flags & PIPE_RESOURCE_FLAG_MAP_PERSISTENT) + nvc0->cb_dirty = TRUE; + } + } } } |