Mesa (main): zink: break out transfer map destroy
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Aug 17 21:13:58 UTC 2021
Module: Mesa
Branch: main
Commit: afa867b973c03f5d516ecdb91a4fbf17ecc87e56
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=afa867b973c03f5d516ecdb91a4fbf17ecc87e56
Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date: Fri Jul 30 10:25:28 2021 -0400
zink: break out transfer map destroy
Reviewed-by: Dave Airlie <airlied at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12422>
---
src/gallium/drivers/zink/zink_resource.c | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)
diff --git a/src/gallium/drivers/zink/zink_resource.c b/src/gallium/drivers/zink/zink_resource.c
index 66c7a3f1125..23fd797126f 100644
--- a/src/gallium/drivers/zink/zink_resource.c
+++ b/src/gallium/drivers/zink/zink_resource.c
@@ -1051,6 +1051,19 @@ create_transfer(struct zink_context *ctx, struct pipe_resource *pres, unsigned u
return trans;
}
+static void
+destroy_transfer(struct zink_context *ctx, struct zink_transfer *trans)
+{
+ if (trans->base.b.usage & PIPE_MAP_THREAD_SAFE) {
+ free(trans);
+ } else {
+ /* Don't use pool_transfers_unsync. We are always in the driver
+ * thread. Freeing an object into a different pool is allowed.
+ */
+ slab_free(&ctx->transfer_pool, trans);
+ }
+}
+
static void *
zink_buffer_map(struct pipe_context *pctx,
struct pipe_resource *pres,
@@ -1372,14 +1385,7 @@ transfer_unmap(struct pipe_context *pctx, struct pipe_transfer *ptrans)
pipe_resource_reference(&trans->staging_res, NULL);
pipe_resource_reference(&trans->base.b.resource, NULL);
- if (trans->base.b.usage & PIPE_MAP_THREAD_SAFE) {
- free(trans);
- } else {
- /* Don't use pool_transfers_unsync. We are always in the driver
- * thread. Freeing an object into a different pool is allowed.
- */
- slab_free(&ctx->transfer_pool, ptrans);
- }
+ destroy_transfer(ctx, trans);
}
static void
More information about the mesa-commit
mailing list