list_action_t action;
compare_transfers_t compare;
struct virgl_transfer *current;
- enum virgl_transfer_queue_lists type;
};
static int
}
static struct virgl_transfer *
-virgl_transfer_queue_find_pending(const struct virgl_transfer_queue *queue,
+virgl_transfer_queue_find_overlap(const struct virgl_transfer_queue *queue,
const struct virgl_hw_res *hw_res,
unsigned level,
const struct pipe_box *box,
bool include_touching)
{
struct virgl_transfer *xfer;
- LIST_FOR_EACH_ENTRY(xfer, &queue->lists[PENDING_LIST], queue_link) {
+ LIST_FOR_EACH_ENTRY(xfer, &queue->transfer_list, queue_link) {
if (transfer_overlap(xfer, hw_res, level, box, include_touching))
return xfer;
}
}
static void remove_transfer(struct virgl_transfer_queue *queue,
- struct list_action_args *args)
+ struct virgl_transfer *queued)
{
- struct virgl_transfer *queued = args->queued;
list_del(&queued->queue_link);
virgl_resource_destroy_transfer(queue->vctx, queued);
}
u_box_union_2d(¤t->base.box, ¤t->base.box, &queued->base.box);
current->offset = current->base.box.x;
- remove_transfer(queue, args);
+ remove_transfer(queue, queued);
queue->num_dwords -= (VIRGL_TRANSFER3D_SIZE + 1);
}
queued->base.stride, queued->l_stride,
queued->offset, queued->base.level);
- remove_transfer(queue, args);
+ remove_transfer(queue, queued);
}
static void transfer_write(struct virgl_transfer_queue *queue,
// the exec buffer command.
virgl_encode_transfer(queue->vs, buf, queued, VIRGL_TRANSFER_TO_HOST);
- remove_transfer(queue, args);
+ remove_transfer(queue, queued);
}
static void compare_and_perform_action(struct virgl_transfer_queue *queue,
{
struct list_action_args args;
struct virgl_transfer *queued, *tmp;
- enum virgl_transfer_queue_lists type = iter->type;
memset(&args, 0, sizeof(args));
args.current = iter->current;
args.data = iter->data;
- LIST_FOR_EACH_ENTRY_SAFE(queued, tmp, &queue->lists[type], queue_link) {
+ LIST_FOR_EACH_ENTRY_SAFE(queued, tmp, &queue->transfer_list, queue_link) {
if (iter->compare(queued, iter->current)) {
args.queued = queued;
iter->action(queue, &args);
{
struct list_action_args args;
struct virgl_transfer *queued, *tmp;
- enum virgl_transfer_queue_lists type = iter->type;
memset(&args, 0, sizeof(args));
args.data = iter->data;
- LIST_FOR_EACH_ENTRY_SAFE(queued, tmp, &queue->lists[type], queue_link) {
+ LIST_FOR_EACH_ENTRY_SAFE(queued, tmp, &queue->transfer_list, queue_link) {
args.queued = queued;
iter->action(queue, &args);
}
struct virgl_winsys *vws = queue->vs->vws;
memset(&iter, 0, sizeof(iter));
- iter.type = PENDING_LIST;
iter.action = transfer_write;
iter.data = queue->tbuf;
perform_action(queue, &iter);
}
}
- list_addtail(&transfer->queue_link, &queue->lists[PENDING_LIST]);
+ list_addtail(&transfer->queue_link, &queue->transfer_list);
queue->num_dwords += dwords;
}
-
void virgl_transfer_queue_init(struct virgl_transfer_queue *queue,
struct virgl_context *vctx)
{
queue->vctx = vctx;
queue->num_dwords = 0;
- for (uint32_t i = 0; i < MAX_LISTS; i++)
- list_inithead(&queue->lists[i]);
+ list_inithead(&queue->transfer_list);
if ((vs->caps.caps.v2.capability_bits & VIRGL_CAP_TRANSFER) &&
vs->vws->supports_encoded_transfers)
memset(&iter, 0, sizeof(iter));
iter.action = transfer_put;
- iter.type = PENDING_LIST;
- perform_action(queue, &iter);
-
- iter.action = remove_transfer;
- iter.type = COMPLETED_LIST;
perform_action(queue, &iter);
if (queue->tbuf)
iter.current = transfer;
iter.compare = transfers_intersect;
iter.action = replace_unmapped_transfer;
- iter.type = PENDING_LIST;
compare_and_perform_action(queue, &iter);
}
struct list_iteration_args iter;
memset(&iter, 0, sizeof(iter));
- iter.type = PENDING_LIST;
if (queue->tbuf) {
uint32_t prior_num_dwords = cbuf->cdw;
cbuf->cdw = 0;
perform_action(queue, &iter);
}
- iter.action = remove_transfer;
- iter.type = COMPLETED_LIST;
- perform_action(queue, &iter);
queue->num_dwords = 0;
return 0;
bool virgl_transfer_queue_is_queued(struct virgl_transfer_queue *queue,
struct virgl_transfer *transfer)
{
- return virgl_transfer_queue_find_pending(queue,
+ return virgl_transfer_queue_find_overlap(queue,
transfer->hw_res,
transfer->base.level,
&transfer->base.box,
assert(!transfer->copy_src_hw_res);
if (transfer->base.resource->target == PIPE_BUFFER) {
- queued = virgl_transfer_queue_find_pending(queue,
+ queued = virgl_transfer_queue_find_overlap(queue,
transfer->hw_res,
transfer->base.level,
&transfer->base.box,