virgl: init transfer queue from virgl_context
authorChia-I Wu <olvaffe@gmail.com>
Wed, 15 May 2019 22:52:34 +0000 (15:52 -0700)
committerChia-I Wu <olvaffe@gmail.com>
Thu, 13 Jun 2019 01:20:30 +0000 (18:20 -0700)
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 <olvaffe@gmail.com>
Reviewed-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
src/gallium/drivers/virgl/virgl_context.c
src/gallium/drivers/virgl/virgl_transfer_queue.c
src/gallium/drivers/virgl/virgl_transfer_queue.h

index f1b35fd12575cef4ea0cdb5c00d4f0b4d96e48ab..87c7f5c6a701a1e651047c84f631e817f9124626 100644 (file)
@@ -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));
 
index da2eda41b6ac95550da0ce2d2550188b8bc068cf..020c42ac14c698ec961464f902b0a0f82ebefe71 100644 (file)
@@ -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;
 }
index be02596a9a742c57093c2a964a685a0ea8d4f96b..3fad28ea7b59e10b02e3d46b05944fdba7c5d9b0 100644 (file)
@@ -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);