iris_hw_context_set_priority(screen->bufmgr, batch->hw_ctx_id, priority);
util_dynarray_init(&batch->exec_fences, ralloc_context(NULL));
- util_dynarray_init(&batch->syncpts, ralloc_context(NULL));
+ util_dynarray_init(&batch->syncobjs, ralloc_context(NULL));
batch->exec_count = 0;
batch->exec_array_size = 100;
if (other_entry &&
((other_entry->flags & EXEC_OBJECT_WRITE) || writable)) {
iris_batch_flush(batch->other_batches[b]);
- iris_batch_add_syncpt(batch, batch->other_batches[b]->last_syncpt,
- I915_EXEC_FENCE_WAIT);
+ iris_batch_add_syncobj(batch, batch->other_batches[b]->last_syncobj,
+ I915_EXEC_FENCE_WAIT);
}
}
}
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);
+ struct iris_syncobj *syncobj = iris_create_syncobj(screen);
+ iris_batch_add_syncobj(batch, syncobj, I915_EXEC_FENCE_SIGNAL);
+ iris_syncobj_reference(screen, &syncobj, NULL);
iris_cache_sets_clear(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);
+ util_dynarray_foreach(&batch->syncobjs, struct iris_syncobj *, s)
+ iris_syncobj_reference(screen, s, NULL);
+ ralloc_free(batch->syncobjs.mem_ctx);
- iris_syncpt_reference(screen, &batch->last_syncpt, NULL);
+ iris_syncobj_reference(screen, &batch->last_syncobj, NULL);
iris_bo_unreference(batch->bo);
batch->bo = NULL;
batch->exec_count = 0;
batch->aperture_space = 0;
- struct iris_syncpt *syncpt =
- ((struct iris_syncpt **) util_dynarray_begin(&batch->syncpts))[0];
- iris_syncpt_reference(screen, &batch->last_syncpt, syncpt);
+ struct iris_syncobj *syncobj =
+ ((struct iris_syncobj **) util_dynarray_begin(&batch->syncobjs))[0];
+ iris_syncobj_reference(screen, &batch->last_syncobj, syncobj);
- util_dynarray_foreach(&batch->syncpts, struct iris_syncpt *, s)
- iris_syncpt_reference(screen, s, NULL);
- util_dynarray_clear(&batch->syncpts);
+ util_dynarray_foreach(&batch->syncobjs, struct iris_syncobj *, s)
+ iris_syncobj_reference(screen, s, NULL);
+ util_dynarray_clear(&batch->syncobjs);
util_dynarray_clear(&batch->exec_fences);
bool noop_enabled;
/**
- * A list of iris_syncpts associated with this batch.
+ * A list of iris_syncobjs associated with this batch.
*
* The first list entry will always be a signalling sync-point, indicating
* that this batch has completed. The others are likely to be sync-points
* to wait on before executing the batch.
*/
- struct util_dynarray syncpts;
+ struct util_dynarray syncobjs;
/** A list of drm_i915_exec_fences to have execbuf signal or wait on */
struct util_dynarray exec_fences;
/** The amount of aperture space (in bytes) used by all exec_bos */
int aperture_space;
- /** A sync-point for the last batch that was submitted. */
- struct iris_syncpt *last_syncpt;
+ /** A drm_syncobj for the last batch that was submitted. */
+ struct iris_syncobj *last_syncobj;
/** List of other batches which we might need to flush to use a BO */
struct iris_batch *other_batches[IRIS_BATCH_COUNT - 1];
}
/**
- * Get a pointer to the batch's signalling syncpt. Does not refcount.
+ * Get a pointer to the batch's signalling syncobj. Does not refcount.
*/
-static inline struct iris_syncpt *
-iris_batch_get_signal_syncpt(struct iris_batch *batch)
+static inline struct iris_syncobj *
+iris_batch_get_signal_syncobj(struct iris_batch *batch)
{
- /* The signalling syncpt is the first one in the list. */
- struct iris_syncpt *syncpt =
- ((struct iris_syncpt **) util_dynarray_begin(&batch->syncpts))[0];
- return syncpt;
+ /* The signalling syncobj is the first one in the list. */
+ struct iris_syncobj *syncobj =
+ ((struct iris_syncobj **) util_dynarray_begin(&batch->syncobjs))[0];
+ return syncobj;
}
/**
- * Take a reference to the batch's signalling syncpt.
+ * Take a reference to the batch's signalling syncobj.
*
* Callers can use this to wait for the the current batch under construction
* to complete (after flushing it).
*/
static inline void
-iris_batch_reference_signal_syncpt(struct iris_batch *batch,
- struct iris_syncpt **out_syncpt)
+iris_batch_reference_signal_syncobj(struct iris_batch *batch,
+ struct iris_syncobj **out_syncobj)
{
- struct iris_syncpt *syncpt = iris_batch_get_signal_syncpt(batch);
- iris_syncpt_reference(batch->screen, out_syncpt, syncpt);
+ struct iris_syncobj *syncobj = iris_batch_get_signal_syncobj(batch);
+ iris_syncobj_reference(batch->screen, out_syncobj, syncobj);
}
/**
/**
* Make a new sync-point.
*/
-struct iris_syncpt *
-iris_create_syncpt(struct iris_screen *screen)
+struct iris_syncobj *
+iris_create_syncobj(struct iris_screen *screen)
{
- struct iris_syncpt *syncpt = malloc(sizeof(*syncpt));
+ struct iris_syncobj *syncobj = malloc(sizeof(*syncobj));
- if (!syncpt)
+ if (!syncobj)
return NULL;
- syncpt->handle = gem_syncobj_create(screen->fd, 0);
- assert(syncpt->handle);
+ syncobj->handle = gem_syncobj_create(screen->fd, 0);
+ assert(syncobj->handle);
- pipe_reference_init(&syncpt->ref, 1);
+ pipe_reference_init(&syncobj->ref, 1);
- return syncpt;
+ return syncobj;
}
void
-iris_syncpt_destroy(struct iris_screen *screen, struct iris_syncpt *syncpt)
+iris_syncobj_destroy(struct iris_screen *screen, struct iris_syncobj *syncobj)
{
- gem_syncobj_destroy(screen->fd, syncpt->handle);
- free(syncpt);
+ gem_syncobj_destroy(screen->fd, syncobj->handle);
+ free(syncobj);
}
/**
* \p flags One of I915_EXEC_FENCE_WAIT or I915_EXEC_FENCE_SIGNAL.
*/
void
-iris_batch_add_syncpt(struct iris_batch *batch,
- struct iris_syncpt *syncpt,
- unsigned flags)
+iris_batch_add_syncobj(struct iris_batch *batch,
+ struct iris_syncobj *syncobj,
+ unsigned flags)
{
struct drm_i915_gem_exec_fence *fence =
util_dynarray_grow(&batch->exec_fences, struct drm_i915_gem_exec_fence, 1);
*fence = (struct drm_i915_gem_exec_fence) {
- .handle = syncpt->handle,
+ .handle = syncobj->handle,
.flags = flags,
};
- struct iris_syncpt **store =
- util_dynarray_grow(&batch->syncpts, struct iris_syncpt *, 1);
+ struct iris_syncobj **store =
+ util_dynarray_grow(&batch->syncobjs, struct iris_syncobj *, 1);
*store = NULL;
- iris_syncpt_reference(batch->screen, store, syncpt);
+ iris_syncobj_reference(batch->screen, store, syncobj);
}
/* ------------------------------------------------------------------- */
struct pipe_fence_handle {
struct pipe_reference ref;
- struct iris_syncpt *syncpt[IRIS_BATCH_COUNT];
+ struct iris_syncobj *syncobj[IRIS_BATCH_COUNT];
unsigned count;
};
struct iris_screen *screen = (struct iris_screen *)p_screen;
for (unsigned i = 0; i < fence->count; i++)
- iris_syncpt_reference(screen, &fence->syncpt[i], NULL);
+ iris_syncobj_reference(screen, &fence->syncobj[i], NULL);
free(fence);
}
}
bool
-iris_wait_syncpt(struct pipe_screen *p_screen,
- struct iris_syncpt *syncpt,
- int64_t timeout_nsec)
+iris_wait_syncobj(struct pipe_screen *p_screen,
+ struct iris_syncobj *syncobj,
+ int64_t timeout_nsec)
{
- if (!syncpt)
+ if (!syncobj)
return false;
struct iris_screen *screen = (struct iris_screen *)p_screen;
struct drm_syncobj_wait args = {
- .handles = (uintptr_t)&syncpt->handle,
+ .handles = (uintptr_t)&syncobj->handle,
.count_handles = 1,
.timeout_nsec = timeout_nsec,
};
pipe_reference_init(&fence->ref, 1);
for (unsigned b = 0; b < IRIS_BATCH_COUNT; b++) {
- if (!iris_wait_syncpt(ctx->screen, ice->batches[b].last_syncpt, 0))
+ if (!iris_wait_syncobj(ctx->screen, ice->batches[b].last_syncobj, 0))
continue;
- iris_syncpt_reference(screen, &fence->syncpt[fence->count++],
- ice->batches[b].last_syncpt);
+ iris_syncobj_reference(screen, &fence->syncobj[fence->count++],
+ ice->batches[b].last_syncobj);
}
iris_fence_reference(ctx->screen, out_fence, NULL);
for (unsigned b = 0; b < IRIS_BATCH_COUNT; b++) {
for (unsigned i = 0; i < fence->count; i++) {
- iris_batch_add_syncpt(&ice->batches[b], fence->syncpt[i],
+ iris_batch_add_syncobj(&ice->batches[b], fence->syncobj[i],
I915_EXEC_FENCE_WAIT);
}
}
if (!fence->count)
return true;
- uint32_t handles[ARRAY_SIZE(fence->syncpt)];
+ uint32_t handles[ARRAY_SIZE(fence->syncobj)];
for (unsigned i = 0; i < fence->count; i++)
- handles[i] = fence->syncpt[i]->handle;
+ handles[i] = fence->syncobj[i]->handle;
struct drm_syncobj_wait args = {
.handles = (uintptr_t)handles,
for (unsigned i = 0; i < fence->count; i++) {
struct drm_syncobj_handle args = {
- .handle = fence->syncpt[i]->handle,
+ .handle = fence->syncobj[i]->handle,
.flags = DRM_SYNCOBJ_HANDLE_TO_FD_FLAGS_EXPORT_SYNC_FILE,
.fd = -1,
};
return;
}
- struct iris_syncpt *syncpt = malloc(sizeof(*syncpt));
- syncpt->handle = args.handle;
- pipe_reference_init(&syncpt->ref, 1);
+ struct iris_syncobj *syncobj = malloc(sizeof(*syncobj));
+ syncobj->handle = args.handle;
+ pipe_reference_init(&syncobj->ref, 1);
struct pipe_fence_handle *fence = malloc(sizeof(*fence));
pipe_reference_init(&fence->ref, 1);
- fence->syncpt[0] = syncpt;
+ fence->syncobj[0] = syncobj;
fence->count = 1;
*out = fence;
struct iris_screen;
struct iris_batch;
-struct iris_syncpt {
+/**
+ * A refcounted DRM Sync Object (drm_syncobj).
+ */
+struct iris_syncobj {
struct pipe_reference ref;
uint32_t handle;
};
-void iris_init_context_fence_functions(struct pipe_context *ctx);
-void iris_init_screen_fence_functions(struct pipe_screen *screen);
+struct iris_syncobj *iris_create_syncobj(struct iris_screen *screen);
+void iris_syncobj_destroy(struct iris_screen *, struct iris_syncobj *);
+
+void iris_batch_add_syncobj(struct iris_batch *batch,
+ struct iris_syncobj *syncobj,
+ unsigned flags);
+bool iris_wait_syncobj(struct pipe_screen *screen,
+ struct iris_syncobj *syncobj,
+ int64_t timeout_nsec);
-struct iris_syncpt *iris_create_syncpt(struct iris_screen *screen);
-void iris_syncpt_destroy(struct iris_screen *, struct iris_syncpt *);
-void iris_batch_add_syncpt(struct iris_batch *batch,
- struct iris_syncpt *syncpt,
- unsigned flags);
-bool iris_wait_syncpt(struct pipe_screen *screen,
- struct iris_syncpt *syncpt,
- int64_t timeout_nsec);
static inline void
-iris_syncpt_reference(struct iris_screen *screen,
- struct iris_syncpt **dst,
- struct iris_syncpt *src)
+iris_syncobj_reference(struct iris_screen *screen,
+ struct iris_syncobj **dst,
+ struct iris_syncobj *src)
{
if (pipe_reference(*dst ? &(*dst)->ref : NULL,
- src ? &src->ref: NULL))
- iris_syncpt_destroy(screen, *dst);
+ src ? &src->ref : NULL))
+ iris_syncobj_destroy(screen, *dst);
*dst = src;
}
+/* ------------------------------------------------------------------- */
+
+void iris_init_context_fence_functions(struct pipe_context *ctx);
+void iris_init_screen_fence_functions(struct pipe_screen *screen);
+
#endif
struct iris_state_ref query_state_ref;
struct iris_query_snapshots *map;
- struct iris_syncpt *syncpt;
+ struct iris_syncobj *syncobj;
int batch_idx;
iris_destroy_monitor_object(ctx, query->monitor);
query->monitor = NULL;
} else {
- iris_syncpt_reference(screen, &query->syncpt, NULL);
+ iris_syncobj_reference(screen, &query->syncobj, NULL);
screen->base.fence_reference(ctx->screen, &query->fence, NULL);
}
free(query);
if (q->type == PIPE_QUERY_TIMESTAMP) {
iris_begin_query(ctx, query);
- iris_batch_reference_signal_syncpt(batch, &q->syncpt);
+ iris_batch_reference_signal_syncobj(batch, &q->syncobj);
mark_available(ice, q);
return true;
}
q->query_state_ref.offset +
offsetof(struct iris_query_snapshots, end));
- iris_batch_reference_signal_syncpt(batch, &q->syncpt);
+ iris_batch_reference_signal_syncobj(batch, &q->syncobj);
mark_available(ice, q);
return true;
if (!q->ready) {
struct iris_batch *batch = &ice->batches[q->batch_idx];
- if (q->syncpt == iris_batch_get_signal_syncpt(batch))
+ if (q->syncobj == iris_batch_get_signal_syncobj(batch))
iris_batch_flush(batch);
while (!READ_ONCE(q->map->snapshots_landed)) {
if (wait)
- iris_wait_syncpt(ctx->screen, q->syncpt, INT64_MAX);
+ iris_wait_syncobj(ctx->screen, q->syncobj, INT64_MAX);
else
return false;
}
* now so that progress happens. Either way, copy the snapshots
* landed field to the destination resource.
*/
- if (q->syncpt == iris_batch_get_signal_syncpt(batch))
+ if (q->syncobj == iris_batch_get_signal_syncobj(batch))
iris_batch_flush(batch);
batch->screen->vtbl.copy_mem_mem(batch, dst_bo, offset,