diff options
author | Rob Clark <robdclark@gmail.com> | 2016-07-13 09:49:53 -0400 |
---|---|---|
committer | Rob Clark <robdclark@gmail.com> | 2016-07-30 09:23:42 -0400 |
commit | 00bed8a794de3d80a46b65b9ab23c6df83e416a8 (patch) | |
tree | 7098b39af0e3a10665314e97487e6773c2c9312f /src/gallium/drivers/freedreno/freedreno_batch_cache.c | |
parent | c44163876a2858aea219a08bd2e048b76953cff9 (diff) |
freedreno: threaded batch flush
With the state accessed from GMEM+submit factored out of fd_context and
into fd_batch, now it is possible to punt this off to a helper thread.
And more importantly, since there are cases where one context might
force the batch-cache to flush another context's batches (ie. when there
are too many in-flight batches), using a per-context helper thread keeps
various different flushes for a given context serialized.
TODO as with batch-cache, there are a few places where we'll need a
mutex to protect critical sections, which is completely missing at the
moment.
Signed-off-by: Rob Clark <robdclark@gmail.com>
Diffstat (limited to 'src/gallium/drivers/freedreno/freedreno_batch_cache.c')
-rw-r--r-- | src/gallium/drivers/freedreno/freedreno_batch_cache.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/gallium/drivers/freedreno/freedreno_batch_cache.c b/src/gallium/drivers/freedreno/freedreno_batch_cache.c index c947a559df9..635f2a7c994 100644 --- a/src/gallium/drivers/freedreno/freedreno_batch_cache.c +++ b/src/gallium/drivers/freedreno/freedreno_batch_cache.c @@ -128,19 +128,24 @@ uint32_t fd_bc_flush(struct fd_batch_cache *cache, struct fd_context *ctx) { struct hash_entry *entry; - uint32_t timestamp = 0; + struct fd_batch *last_batch = NULL; hash_table_foreach(cache->ht, entry) { struct fd_batch *batch = NULL; fd_batch_reference(&batch, (struct fd_batch *)entry->data); if (batch->ctx == ctx) { - fd_batch_flush(batch); - timestamp = MAX2(timestamp, fd_ringbuffer_timestamp(batch->gmem)); + fd_batch_reference(&last_batch, batch); + fd_batch_flush(batch, false); } fd_batch_reference(&batch, NULL); } - return timestamp; + if (last_batch) { + fd_batch_sync(last_batch); + fd_batch_reference(&last_batch, NULL); + } + + return ctx->last_fence; } void @@ -238,7 +243,7 @@ fd_bc_alloc_batch(struct fd_batch_cache *cache, struct fd_context *ctx) fd_batch_reference(&flush_batch, cache->batches[i]); } DBG("%p: too many batches! flush forced!", flush_batch); - fd_batch_flush(flush_batch); + fd_batch_flush(flush_batch, true); /* While the resources get cleaned up automatically, the flush_batch * doesn't get removed from the dependencies of other batches, so |