freedreno: Move the !MAP_WRITE write batch refcounting to the branch.

For MAP_WRITE, we flush all the batches referencing the BO, so the write
batch will get flushed anyway.  No need to take an extra ref.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11439>
This commit is contained in:
Emma Anholt 2021-06-15 10:43:11 -07:00
parent fd571565d2
commit 09e1fb2bce

View file

@ -664,12 +664,6 @@ static void
flush_resource(struct fd_context *ctx, struct fd_resource *rsc,
unsigned usage) assert_dt
{
struct fd_batch *write_batch = NULL;
fd_screen_lock(ctx->screen);
fd_batch_reference_locked(&write_batch, rsc->track->write_batch);
fd_screen_unlock(ctx->screen);
if (usage & PIPE_MAP_WRITE) {
struct fd_batch *batch, *batches[32] = {};
uint32_t batch_count = 0;
@ -688,11 +682,16 @@ flush_resource(struct fd_context *ctx, struct fd_resource *rsc,
fd_batch_flush(batches[i]);
fd_batch_reference(&batches[i], NULL);
}
} else if (write_batch) {
fd_batch_flush(write_batch);
} else {
struct fd_batch *write_batch = NULL;
fd_screen_lock(ctx->screen);
fd_batch_reference_locked(&write_batch, rsc->track->write_batch);
fd_screen_unlock(ctx->screen);
if (write_batch) {
fd_batch_flush(write_batch);
fd_batch_reference(&write_batch, NULL);
}
}
fd_batch_reference(&write_batch, NULL);
}
static void