From: Erik Faye-Lund Date: Thu, 4 Apr 2019 14:52:21 +0000 (+0200) Subject: virgl: make unmap queuing a bit more straight-forward X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ac932ff82224d707fd03f615750707cf76c250dd;p=mesa.git 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 Reviewed-by: Gurchetan Singh --- 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); }