if (!trans)
return NULL;
- trans->base.resource = pres;
+ /* note that trans is not zero-initialized */
+ trans->base.resource = NULL;
+ pipe_resource_reference(&trans->base.resource, pres);
trans->base.level = level;
trans->base.usage = usage;
trans->base.box = *box;
struct virgl_transfer *trans)
{
pipe_resource_reference(&trans->copy_src_res, NULL);
+
util_range_destroy(&trans->range);
+ pipe_resource_reference(&trans->base.resource, NULL);
slab_free(&vctx->transfer_pool, trans);
}
struct list_action_args *args)
{
struct virgl_transfer *queued = args->queued;
- struct pipe_resource *pres = queued->base.resource;
list_del(&queued->queue_link);
- pipe_resource_reference(&pres, NULL);
virgl_resource_destroy_transfer(queue->vctx, queued);
}
int virgl_transfer_queue_unmap(struct virgl_transfer_queue *queue,
struct virgl_transfer *transfer)
{
- struct pipe_resource *res, *pres;
+ struct pipe_resource *res = transfer->base.resource;
struct list_iteration_args iter;
- pres = NULL;
- res = transfer->base.resource;
- pipe_resource_reference(&pres, res);
-
/* We don't support copy transfers in the transfer queue. */
assert(!transfer->copy_src_res);