diff --git a/src/venus/vkr_ring.h b/src/venus/vkr_ring.h index ee87d2d..8dc83bb 100644 --- a/src/venus/vkr_ring.h +++ b/src/venus/vkr_ring.h @@ -8,8 +8,14 @@ #include "vkr_common.h" -/* this must not exceed UINT32_MAX because the ring head and tail are 32-bit */ -#define VKR_RING_BUFFER_MAX_SIZE UINT32_MAX +/* We read from the ring buffer to a temporary buffer for + * virgl_context::submit_cmd. Until that is changed, we want to put a limit + * on the size of the temporary buffer. It also makes no sense to have huge + * rings. + * + * This must not exceed UINT32_MAX because the ring head and tail are 32-bit. + */ +#define VKR_RING_BUFFER_MAX_SIZE (16u * 1024 * 1024) /* The layout of a ring in a virgl_resource. This is parsed and discarded by * vkr_ring_create. diff --git a/src/venus/vkr_transport.c b/src/venus/vkr_transport.c index 635b49e..31b26a9 100644 --- a/src/venus/vkr_transport.c +++ b/src/venus/vkr_transport.c @@ -177,12 +177,8 @@ vkr_ring_layout_init(struct vkr_ring_layout *layout, }; /* clang-format on */ - if (res->iov_count != 1) { - vkr_log("no scatter-gather support for ring buffers (TODO)"); - return false; - } - - const struct vkr_region res_size = VKR_REGION_INIT(0, res->iov[0].iov_len); + const struct vkr_region res_size = + VKR_REGION_INIT(0, vrend_get_iovec_size(res->iov, res->iov_count)); if (!vkr_region_is_valid(&res_region) || !vkr_region_is_within(&res_region, &res_size)) return false;