iris_use_pinned_bo(batch, batch->bo, false);
}
+static void
+iris_batch_maybe_noop(struct iris_batch *batch)
+{
+ /* We only insert the NOOP at the beginning of the batch. */
+ assert(iris_batch_bytes_used(batch) == 0);
+
+ if (batch->noop_enabled) {
+ /* Emit MI_BATCH_BUFFER_END to prevent any further command to be
+ * executed.
+ */
+ uint32_t *map = batch->map_next;
+
+ map[0] = (0xA << 23);
+
+ batch->map_next += 4;
+ }
+}
+
static void
iris_batch_reset(struct iris_batch *batch)
{
iris_syncpt_reference(screen, &syncpt, NULL);
iris_cache_sets_clear(batch);
+
+ iris_batch_maybe_noop(batch);
}
void
{
return find_validation_entry(batch, bo) != NULL;
}
+
+/**
+ * Updates the state of the noop feature.
+ */
+uint64_t
+iris_batch_prepare_noop(struct iris_batch *batch, bool noop_enable, uint64_t dirty_flags)
+{
+ if (batch->noop_enabled == noop_enable)
+ return 0;
+
+ batch->noop_enabled = noop_enable;
+
+ iris_batch_flush(batch);
+
+ /* If the batch was empty, flush had no effect, so insert our noop. */
+ if (iris_batch_bytes_used(batch) == 0)
+ iris_batch_maybe_noop(batch);
+
+ /* We only need to update the entire state if we transition from noop ->
+ * not-noop.
+ */
+ return !batch->noop_enabled ? dirty_flags : 0;
+}
int exec_count;
int exec_array_size;
+ /** Whether INTEL_BLACKHOLE_RENDER is enabled in the batch (aka first
+ * instruction is a MI_BATCH_BUFFER_END).
+ */
+ bool noop_enabled;
+
/**
* A list of iris_syncpts associated with this batch.
*
bool iris_batch_references(struct iris_batch *batch, struct iris_bo *bo);
+uint64_t iris_batch_prepare_noop(struct iris_batch *batch,
+ bool noop_enable,
+ uint64_t dirty_flags);
+
#define RELOC_WRITE EXEC_OBJECT_WRITE
void iris_use_pinned_bo(struct iris_batch *batch, struct iris_bo *bo,
#endif
}
+static void
+iris_set_frontend_noop(struct pipe_context *ctx, bool enable)
+{
+ struct iris_context *ice = (struct iris_context *) ctx;
+
+ ice->state.dirty |= iris_batch_prepare_noop(&ice->batches[IRIS_BATCH_RENDER],
+ enable,
+ IRIS_ALL_DIRTY_FOR_RENDER);
+ ice->state.dirty |= iris_batch_prepare_noop(&ice->batches[IRIS_BATCH_COMPUTE],
+ enable,
+ IRIS_ALL_DIRTY_FOR_COMPUTE);
+}
+
void
genX(init_state)(struct iris_context *ice)
{
ctx->create_stream_output_target = iris_create_stream_output_target;
ctx->stream_output_target_destroy = iris_stream_output_target_destroy;
ctx->set_stream_output_targets = iris_set_stream_output_targets;
+ ctx->set_frontend_noop = iris_set_frontend_noop;
ice->vtbl.destroy_state = iris_destroy_state;
ice->vtbl.init_render_context = iris_init_render_context;