Mesa (master): virgl: make unmap queuing a bit more straight-forward
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Apr 17 07:41:24 UTC 2019
Module: Mesa
Branch: master
Commit: ac932ff82224d707fd03f615750707cf76c250dd
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ac932ff82224d707fd03f615750707cf76c250dd
Author: Erik Faye-Lund <erik.faye-lund at collabora.com>
Date: Thu Apr 4 16:52:21 2019 +0200
virgl: make unmap queuing a bit more straight-forward
It's hard to read the code that decides if we want to queue up an unmap
or destroy the transfer right away. So let's make it a bit simpler, by
setting a bool in case we want to queue it.
Signed-off-by: Erik Faye-Lund <erik.faye-lund at collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh at chromium.org>
---
src/gallium/drivers/virgl/virgl_texture.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/gallium/drivers/virgl/virgl_texture.c b/src/gallium/drivers/virgl/virgl_texture.c
index a17c0941282..cae7921d683 100644
--- a/src/gallium/drivers/virgl/virgl_texture.c
+++ b/src/gallium/drivers/virgl/virgl_texture.c
@@ -173,6 +173,7 @@ static void virgl_texture_transfer_unmap(struct pipe_context *ctx,
struct virgl_context *vctx = virgl_context(ctx);
struct virgl_transfer *trans = virgl_transfer(transfer);
struct virgl_resource *vtex = virgl_resource(transfer->resource);
+ bool queue_unmap = false;
if (transfer->usage & PIPE_TRANSFER_WRITE &&
(transfer->usage & PIPE_TRANSFER_FLUSH_EXPLICIT) == 0) {
@@ -182,13 +183,14 @@ static void virgl_texture_transfer_unmap(struct pipe_context *ctx,
trans->base.stride, trans->l_stride,
trans->offset, transfer->level);
} else
- virgl_transfer_queue_unmap(&vctx->queue, trans);
+ queue_unmap = true;
}
- if (trans->resolve_tmp) {
- pipe_resource_reference((struct pipe_resource **)&trans->resolve_tmp, NULL);
- virgl_resource_destroy_transfer(&vctx->transfer_pool, trans);
- } else if (!(trans->base.usage & PIPE_TRANSFER_WRITE))
+ pipe_resource_reference((struct pipe_resource **)&trans->resolve_tmp, NULL);
+
+ if (queue_unmap)
+ virgl_transfer_queue_unmap(&vctx->queue, trans);
+ else
virgl_resource_destroy_transfer(&vctx->transfer_pool, trans);
}
More information about the mesa-commit
mailing list