Mesa (main): gallium/u_threaded: don't reference resource in pipe_transfer
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon May 17 11:05:33 UTC 2021
Module: Mesa
Branch: main
Commit: 6fed423ade729ddd876778c399feae9f9c8b346d
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=6fed423ade729ddd876778c399feae9f9c8b346d
Author: Marek Olšák <marek.olsak at amd.com>
Date: Fri May 7 08:40:35 2021 -0400
gallium/u_threaded: don't reference resource in pipe_transfer
The atomic can be costly, so skip it. This should be safe because
we never have pipe_transfer as the only live reference of a buffer.
Drivers can't do this yet because something needs to hold the resource
reference while a transfer object is being passed via u_threaded_context.
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Reviewed-by: Rob Clark <robdclark at chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10662>
---
src/gallium/auxiliary/util/u_threaded_context.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/gallium/auxiliary/util/u_threaded_context.c b/src/gallium/auxiliary/util/u_threaded_context.c
index 8f3bd71c064..7faf2a8987c 100644
--- a/src/gallium/auxiliary/util/u_threaded_context.c
+++ b/src/gallium/auxiliary/util/u_threaded_context.c
@@ -2011,7 +2011,7 @@ tc_transfer_map(struct pipe_context *_pipe,
return NULL;
}
- tc_set_resource_reference(&ttrans->b.resource, resource);
+ ttrans->b.resource = resource;
ttrans->b.level = 0;
ttrans->b.usage = usage;
ttrans->b.box = *box;
@@ -2213,7 +2213,6 @@ tc_transfer_unmap(struct pipe_context *_pipe, struct pipe_transfer *transfer)
was_staging_transfer = true;
tc_drop_resource_reference(ttrans->staging);
- tc_drop_resource_reference(ttrans->b.resource);
slab_free(&tc->pool_transfers, ttrans);
}
}
More information about the mesa-commit
mailing list