summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErik Faye-Lund <erik.faye-lund@collabora.com>2019-04-04 16:52:21 +0200
committerErik Faye-Lund <erik.faye-lund@collabora.com>2019-04-17 07:27:08 +0000
commitac932ff82224d707fd03f615750707cf76c250dd (patch)
treec664e26feda01ccb1afca6def2e224b1f85b12df
parentb08e73308ec23399def414c6f6d5020496ffda9a (diff)
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@collabora.com> Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
-rw-r--r--src/gallium/drivers/virgl/virgl_texture.c12
1 files 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);
}