enum virgl_transfer_map_type map_type;
void *map_addr;
- trans = virgl_resource_create_transfer(&vctx->transfer_pool, resource,
+ trans = virgl_resource_create_transfer(vctx, resource,
&vbuf->metadata, level, usage, box);
map_type = virgl_resource_transfer_prepare(vctx, trans);
}
if (!map_addr) {
- virgl_resource_destroy_transfer(&vctx->transfer_pool, trans);
+ virgl_resource_destroy_transfer(vctx, trans);
return NULL;
}
/* We don't need to transfer the contents of staging buffers, since they
* don't have any host-side storage. */
if (pipe_to_virgl_bind(vs, res->bind, res->flags) == VIRGL_BIND_STAGING) {
- virgl_resource_destroy_transfer(&vctx->transfer_pool, trans);
+ virgl_resource_destroy_transfer(vctx, trans);
return;
}
if (trans->base.usage & PIPE_TRANSFER_WRITE) {
if (transfer->usage & PIPE_TRANSFER_FLUSH_EXPLICIT) {
if (trans->range.end <= trans->range.start) {
- virgl_resource_destroy_transfer(&vctx->transfer_pool, trans);
+ virgl_resource_destroy_transfer(vctx, trans);
return;
}
virgl_encode_copy_transfer(vctx, trans);
/* It's now safe for other mappings to use the transfer_uploader. */
vctx->transfer_uploader_in_use = false;
- virgl_resource_destroy_transfer(&vctx->transfer_pool, trans);
+ virgl_resource_destroy_transfer(vctx, trans);
} else {
virgl_transfer_queue_unmap(&vctx->queue, trans);
}
} else
- virgl_resource_destroy_transfer(&vctx->transfer_pool, trans);
+ virgl_resource_destroy_transfer(vctx, trans);
}
static void virgl_buffer_transfer_flush_region(struct pipe_context *ctx,
}
struct virgl_transfer *
-virgl_resource_create_transfer(struct slab_child_pool *pool,
+virgl_resource_create_transfer(struct virgl_context *vctx,
struct pipe_resource *pres,
const struct virgl_resource_metadata *metadata,
unsigned level, unsigned usage,
offset += blocksy * metadata->stride[level];
offset += blocksx * util_format_get_blocksize(format);
- trans = slab_alloc(pool);
+ trans = slab_alloc(&vctx->transfer_pool);
if (!trans)
return NULL;
return trans;
}
-void virgl_resource_destroy_transfer(struct slab_child_pool *pool,
+void virgl_resource_destroy_transfer(struct virgl_context *vctx,
struct virgl_transfer *trans)
{
pipe_resource_reference(&trans->copy_src_res, NULL);
util_range_destroy(&trans->range);
- slab_free(pool, trans);
+ slab_free(&vctx->transfer_pool, trans);
}
void virgl_resource_destroy(struct pipe_screen *screen,
struct virgl_resource_metadata *metadata);
struct virgl_transfer *
-virgl_resource_create_transfer(struct slab_child_pool *pool,
+virgl_resource_create_transfer(struct virgl_context *vctx,
struct pipe_resource *pres,
const struct virgl_resource_metadata *metadata,
unsigned level, unsigned usage,
const struct pipe_box *box);
-void virgl_resource_destroy_transfer(struct slab_child_pool *pool,
+void virgl_resource_destroy_transfer(struct virgl_context *vctx,
struct virgl_transfer *trans);
void virgl_resource_destroy(struct pipe_screen *screen,
enum virgl_transfer_map_type map_type;
void *map_addr;
- trans = virgl_resource_create_transfer(&vctx->transfer_pool, resource,
+ trans = virgl_resource_create_transfer(vctx, resource,
&vtex->metadata, level, usage, box);
trans->resolve_transfer = NULL;
}
if (!map_addr) {
- virgl_resource_destroy_transfer(&vctx->transfer_pool, trans);
+ virgl_resource_destroy_transfer(vctx, trans);
return NULL;
}
struct pipe_resource templ, *resolve_tmp;
struct virgl_transfer *trans;
- trans = virgl_resource_create_transfer(&vctx->transfer_pool, resource,
+ trans = virgl_resource_create_transfer(vctx, resource,
&vtex->metadata, level, usage, box);
if (!trans)
return NULL;
fail:
pipe_resource_reference(&resolve_tmp, NULL);
- virgl_resource_destroy_transfer(&vctx->transfer_pool, trans);
+ virgl_resource_destroy_transfer(vctx, trans);
return NULL;
}
/* We don't need to transfer the contents of staging buffers, since they
* don't have any host-side storage. */
if (pipe_to_virgl_bind(vs, res->bind, res->flags) == VIRGL_BIND_STAGING) {
- virgl_resource_destroy_transfer(&vctx->transfer_pool, trans);
+ virgl_resource_destroy_transfer(vctx, trans);
return;
}
if (trans->resolve_transfer) {
pipe_resource_reference(&trans->resolve_transfer->resource, NULL);
- virgl_resource_destroy_transfer(&vctx->transfer_pool,
+ virgl_resource_destroy_transfer(vctx,
virgl_transfer(trans->resolve_transfer));
}
virgl_encode_copy_transfer(vctx, trans);
/* It's now safe for other mappings to use the transfer_uploader. */
vctx->transfer_uploader_in_use = false;
- virgl_resource_destroy_transfer(&vctx->transfer_pool, trans);
+ virgl_resource_destroy_transfer(vctx, trans);
} else {
virgl_transfer_queue_unmap(&vctx->queue, trans);
}
} else {
- virgl_resource_destroy_transfer(&vctx->transfer_pool, trans);
+ virgl_resource_destroy_transfer(vctx, trans);
}
-
}
static const struct u_resource_vtbl virgl_texture_vtbl =
struct pipe_resource *pres = queued->base.resource;
list_del(&queued->queue_link);
pipe_resource_reference(&pres, NULL);
- virgl_resource_destroy_transfer(&queue->vctx->transfer_pool, queued);
+ virgl_resource_destroy_transfer(queue->vctx, queued);
}
static void replace_unmapped_transfer(struct virgl_transfer_queue *queue,