iris: Defer stream output target space allocation until set time

In the future, Marek is planning to make u_threaded_context call
create_stream_output_target() from a different thread than the main
driver thread, which means that we can't safely use uploaders there.

To prepare for this eventual future, just defer the allocation of
the offset BO 'til later.  It's a very small amount of overhead.

Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8964>
This commit is contained in:
Kenneth Graunke 2021-02-01 05:12:30 -08:00
parent 5659460af4
commit e40fafa991
1 changed files with 3 additions and 2 deletions

View File

@ -3709,8 +3709,6 @@ iris_create_stream_output_target(struct pipe_context *ctx,
util_range_add(&res->base, &res->valid_buffer_range, buffer_offset,
buffer_offset + buffer_size);
upload_state(ctx->stream_uploader, &cso->offset, sizeof(uint32_t), 4);
return &cso->base;
}
@ -3800,6 +3798,9 @@ iris_set_stream_output_targets(struct pipe_context *ctx,
continue;
}
if (!tgt->offset.res)
upload_state(ctx->stream_uploader, &tgt->offset, sizeof(uint32_t), 4);
struct iris_resource *res = (void *) tgt->base.buffer;
/* Note that offsets[i] will either be 0, causing us to zero