vkr: add support for larger rings

Now that vkr_ring supports iov, we can allow larger rings.  This also
adjusts VKR_RING_BUFFER_MAX_SIZE to be realistic.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
macos/master
Chia-I Wu 3 years ago
parent 6691ebec9f
commit 9b8e4a6b50
  1. 10
      src/venus/vkr_ring.h
  2. 8
      src/venus/vkr_transport.c

@ -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.

@ -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;

Loading…
Cancel
Save