From e81c07de41c7f6f585a2c6aa0c67b1082b609b8f Mon Sep 17 00:00:00 2001 From: Francisco Jerez Date: Thu, 23 Apr 2020 17:58:48 -0700 Subject: iris: Bracket batch operations which access memory within sync regions. This delimits all batch operations which access memory between iris_batch_sync_region_start() and iris_batch_sync_region_end() calls. This makes sure that any buffer objects accessed within the region are considered in use through the same caching domain until the end of the region. Adding any buffer to the batch validation list outside of a sync region will lead to an assertion failure in a future commit, unless the caller explicitly opted out of the cache tracking mechanism. Reviewed-by: Kenneth Graunke Part-of: --- src/gallium/drivers/iris/iris_query.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/gallium/drivers/iris/iris_query.c') diff --git a/src/gallium/drivers/iris/iris_query.c b/src/gallium/drivers/iris/iris_query.c index 8888a8fd284..aaed40e5e08 100644 --- a/src/gallium/drivers/iris/iris_query.c +++ b/src/gallium/drivers/iris/iris_query.c @@ -711,6 +711,8 @@ iris_get_query_result_resource(struct pipe_context *ctx, struct gen_mi_builder b; gen_mi_builder_init(&b, batch); + iris_batch_sync_region_start(batch); + struct gen_mi_value result = calculate_result_on_gpu(devinfo, &b, q); struct gen_mi_value dst = result_type <= PIPE_QUERY_TYPE_U32 ? gen_mi_mem32(rw_bo(dst_bo, offset)) @@ -723,6 +725,8 @@ iris_get_query_result_resource(struct pipe_context *ctx, } else { gen_mi_store(&b, dst, result); } + + iris_batch_sync_region_end(batch); } static void @@ -763,6 +767,8 @@ set_predicate_for_result(struct iris_context *ice, struct iris_batch *batch = &ice->batches[IRIS_BATCH_RENDER]; struct iris_bo *bo = iris_resource_bo(q->query_state_ref.res); + iris_batch_sync_region_start(batch); + /* The CPU doesn't have the query result yet; use hardware predication */ ice->state.predicate = IRIS_PREDICATE_STATE_USE_BIT; @@ -809,6 +815,8 @@ set_predicate_for_result(struct iris_context *ice, gen_mi_store(&b, query_mem64(q, offsetof(struct iris_query_snapshots, predicate_result)), result); ice->state.compute_predicate = bo; + + iris_batch_sync_region_end(batch); } static void -- cgit v1.2.3