From 514e12b1b8fae55319cbc3702215a305e3d7d60f Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Wed, 15 May 2019 15:52:34 -0700 Subject: [PATCH] virgl: init transfer queue from virgl_context A pipe_transfer is a context object. It is fine for virgl_transfer_queue to have access to the context. Signed-off-by: Chia-I Wu Reviewed-by: Alexandros Frantzis --- src/gallium/drivers/virgl/virgl_context.c | 2 +- src/gallium/drivers/virgl/virgl_transfer_queue.c | 12 +++++++----- src/gallium/drivers/virgl/virgl_transfer_queue.h | 7 +++---- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/gallium/drivers/virgl/virgl_context.c b/src/gallium/drivers/virgl/virgl_context.c index f1b35fd1257..87c7f5c6a70 100644 --- a/src/gallium/drivers/virgl/virgl_context.c +++ b/src/gallium/drivers/virgl/virgl_context.c @@ -1372,7 +1372,7 @@ struct pipe_context *virgl_context_create(struct pipe_screen *pscreen, virgl_init_so_functions(vctx); slab_create_child(&vctx->transfer_pool, &rs->transfer_pool); - virgl_transfer_queue_init(&vctx->queue, rs, &vctx->transfer_pool); + virgl_transfer_queue_init(&vctx->queue, vctx); vctx->encoded_transfers = (rs->vws->supports_encoded_transfers && (rs->caps.caps.v2.capability_bits & VIRGL_CAP_TRANSFER)); diff --git a/src/gallium/drivers/virgl/virgl_transfer_queue.c b/src/gallium/drivers/virgl/virgl_transfer_queue.c index da2eda41b6a..020c42ac14c 100644 --- a/src/gallium/drivers/virgl/virgl_transfer_queue.c +++ b/src/gallium/drivers/virgl/virgl_transfer_queue.c @@ -25,6 +25,7 @@ #include "util/u_inlines.h" #include "virgl_protocol.h" +#include "virgl_context.h" #include "virgl_screen.h" #include "virgl_encode.h" #include "virgl_resource.h" @@ -122,7 +123,7 @@ static void remove_transfer(struct virgl_transfer_queue *queue, struct pipe_resource *pres = queued->base.resource; list_del(&queued->queue_link); pipe_resource_reference(&pres, NULL); - virgl_resource_destroy_transfer(queue->pool, queued); + virgl_resource_destroy_transfer(&queue->vctx->transfer_pool, queued); } static void replace_unmapped_transfer(struct virgl_transfer_queue *queue, @@ -246,11 +247,12 @@ static void add_internal(struct virgl_transfer_queue *queue, void virgl_transfer_queue_init(struct virgl_transfer_queue *queue, - struct virgl_screen *vs, - struct slab_child_pool *pool) + struct virgl_context *vctx) { + struct virgl_screen *vs = virgl_screen(vctx->base.screen); + queue->vs = vs; - queue->pool = pool; + queue->vctx = vctx; queue->num_dwords = 0; for (uint32_t i = 0; i < MAX_LISTS; i++) @@ -282,7 +284,7 @@ void virgl_transfer_queue_fini(struct virgl_transfer_queue *queue) vws->cmd_buf_destroy(queue->tbuf); queue->vs = NULL; - queue->pool = NULL; + queue->vctx = NULL; queue->tbuf = NULL; queue->num_dwords = 0; } diff --git a/src/gallium/drivers/virgl/virgl_transfer_queue.h b/src/gallium/drivers/virgl/virgl_transfer_queue.h index be02596a9a7..3fad28ea7b5 100644 --- a/src/gallium/drivers/virgl/virgl_transfer_queue.h +++ b/src/gallium/drivers/virgl/virgl_transfer_queue.h @@ -29,7 +29,7 @@ struct virgl_cmd_buf; struct virgl_screen; -struct virgl_slab_child_pool; +struct virgl_context; struct virgl_transfer; enum virgl_transfer_queue_lists { @@ -41,14 +41,13 @@ enum virgl_transfer_queue_lists { struct virgl_transfer_queue { struct list_head lists[MAX_LISTS]; struct virgl_screen *vs; - struct slab_child_pool *pool; + struct virgl_context *vctx; struct virgl_cmd_buf *tbuf; uint32_t num_dwords; }; void virgl_transfer_queue_init(struct virgl_transfer_queue *queue, - struct virgl_screen *vs, - struct slab_child_pool *pool); + struct virgl_context *vctx); void virgl_transfer_queue_fini(struct virgl_transfer_queue *queue); -- 2.30.2