summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/iris/iris_batch.c
diff options
context:
space:
mode:
authorChris Wilson <[email protected]>2018-11-09 15:02:12 +0000
committerKenneth Graunke <[email protected]>2019-02-21 10:26:10 -0800
commitfae74234d9177b2257d878640f36e9ef227badfa (patch)
treef1c85f445193fca22de8ba17b2713cc44540ebff /src/gallium/drivers/iris/iris_batch.c
parent3e332af61111c627d0384a5c3bdc2ce1b279405a (diff)
iris: Tag each submitted batch with a syncobj
(adjusted by Ken to make the signalling sync object immediately on batch reset, rather than batch finish time. this will work better with deferred flushes...)
Diffstat (limited to 'src/gallium/drivers/iris/iris_batch.c')
-rw-r--r--src/gallium/drivers/iris/iris_batch.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/gallium/drivers/iris/iris_batch.c b/src/gallium/drivers/iris/iris_batch.c
index 7367e6136e8..04d71c0bff0 100644
--- a/src/gallium/drivers/iris/iris_batch.c
+++ b/src/gallium/drivers/iris/iris_batch.c
@@ -40,6 +40,7 @@
#include "iris_batch.h"
#include "iris_bufmgr.h"
#include "iris_context.h"
+#include "iris_fence.h"
#include "drm-uapi/i915_drm.h"
@@ -183,6 +184,7 @@ iris_init_batch(struct iris_batch *batch,
assert(batch->hw_ctx_id);
util_dynarray_init(&batch->exec_fences, ralloc_context(NULL));
+ util_dynarray_init(&batch->syncpts, ralloc_context(NULL));
batch->exec_count = 0;
batch->exec_array_size = 100;
@@ -345,6 +347,8 @@ create_batch(struct iris_batch *batch)
static void
iris_batch_reset(struct iris_batch *batch)
{
+ struct iris_screen *screen = batch->screen;
+
iris_bo_unreference(batch->bo);
batch->primary_batch_size = 0;
batch->contains_draw = false;
@@ -352,6 +356,10 @@ iris_batch_reset(struct iris_batch *batch)
create_batch(batch);
assert(batch->bo->index == 0);
+ struct iris_syncpt *syncpt = iris_create_syncpt(screen);
+ iris_batch_add_syncpt(batch, syncpt, I915_EXEC_FENCE_SIGNAL);
+ iris_syncpt_reference(screen, &syncpt, NULL);
+
if (batch->state_sizes)
_mesa_hash_table_clear(batch->state_sizes, NULL);
@@ -372,6 +380,10 @@ iris_batch_free(struct iris_batch *batch)
ralloc_free(batch->exec_fences.mem_ctx);
+ util_dynarray_foreach(&batch->syncpts, struct iris_syncpt *, s)
+ iris_syncpt_reference(screen, s, NULL);
+ ralloc_free(batch->syncpts.mem_ctx);
+
iris_bo_unreference(batch->bo);
batch->bo = NULL;
batch->map = NULL;
@@ -517,6 +529,8 @@ submit_batch(struct iris_batch *batch)
void
_iris_batch_flush(struct iris_batch *batch, const char *file, int line)
{
+ struct iris_screen *screen = batch->screen;
+
if (iris_batch_bytes_used(batch) == 0)
return;
@@ -566,6 +580,10 @@ _iris_batch_flush(struct iris_batch *batch, const char *file, int line)
batch->exec_count = 0;
batch->aperture_space = 0;
+ util_dynarray_foreach(&batch->syncpts, struct iris_syncpt *, s)
+ iris_syncpt_reference(screen, s, NULL);
+ util_dynarray_clear(&batch->syncpts);
+
util_dynarray_clear(&batch->exec_fences);
/* Start a new batch buffer. */