diff options
author | Chia-I Wu <[email protected]> | 2019-07-08 16:31:46 -0700 |
---|---|---|
committer | Chia-I Wu <[email protected]> | 2019-07-09 14:26:55 -0700 |
commit | 48aefcbd6bc1c9cca6bbe94ea98a8e94dd629ec1 (patch) | |
tree | 137dfdacd6536ec95ea5cfc8e851d9de1c374bab | |
parent | eae4527551d13fb6df7280b79649d08b1c60f712 (diff) |
virgl: simplify virgl_transfer_queue_extend
We can reuse virgl_transfer_queue_find_pending.
Signed-off-by: Chia-I Wu <[email protected]>
Reviewed-by: Alexandros Frantzis <[email protected]>
-rw-r--r-- | src/gallium/drivers/virgl/virgl_transfer_queue.c | 39 |
1 files changed, 5 insertions, 34 deletions
diff --git a/src/gallium/drivers/virgl/virgl_transfer_queue.c b/src/gallium/drivers/virgl/virgl_transfer_queue.c index ea1e759bc69..10bb1c5d9a1 100644 --- a/src/gallium/drivers/virgl/virgl_transfer_queue.c +++ b/src/gallium/drivers/virgl/virgl_transfer_queue.c @@ -160,14 +160,6 @@ static bool transfers_intersect(struct virgl_transfer *queued, ¤t->base.box, true); } -static void set_queued(UNUSED struct virgl_transfer_queue *queue, - struct list_action_args *args) -{ - struct virgl_transfer *queued = args->queued; - struct virgl_transfer **val = args->data; - *val = queued; -} - static void remove_transfer(struct virgl_transfer_queue *queue, struct list_action_args *args) { @@ -234,26 +226,6 @@ static void compare_and_perform_action(struct virgl_transfer_queue *queue, } } -static void intersect_and_set_queued_once(struct virgl_transfer_queue *queue, - struct list_iteration_args *iter) -{ - 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) { - if (transfers_intersect(queued, iter->current)) { - args.queued = queued; - set_queued(queue, &args); - return; - } - } -} - static void perform_action(struct virgl_transfer_queue *queue, struct list_iteration_args *iter) { @@ -405,17 +377,16 @@ virgl_transfer_queue_extend(struct virgl_transfer_queue *queue, struct virgl_transfer *transfer) { struct virgl_transfer *queued = NULL; - struct list_iteration_args iter; /* We don't support extending from copy transfers. */ assert(!transfer->copy_src_hw_res); if (transfer->base.resource->target == PIPE_BUFFER) { - memset(&iter, 0, sizeof(iter)); - iter.current = transfer; - iter.data = &queued; - iter.type = PENDING_LIST; - intersect_and_set_queued_once(queue, &iter); + queued = virgl_transfer_queue_find_pending(queue, + transfer->hw_res, + transfer->base.level, + &transfer->base.box, + true); } if (queued) { |