From: Chia-I Wu Date: Mon, 8 Jul 2019 23:31:46 +0000 (-0700) Subject: virgl: simplify virgl_transfer_queue_extend X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=48aefcbd6bc1c9cca6bbe94ea98a8e94dd629ec1;p=mesa.git virgl: simplify virgl_transfer_queue_extend We can reuse virgl_transfer_queue_find_pending. Signed-off-by: Chia-I Wu Reviewed-by: Alexandros Frantzis --- 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) {