From 4e11244e54f2de66d1415b02794685d5421456d5 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Tue, 10 Mar 2020 13:50:45 -0700 Subject: [PATCH] vtest: move max_length into vtest_renderer In preparation for multi-context support. Signed-off-by: Chia-I Wu Reviewed-By: Gert Wollny Reviewed-By: Gurchetan Singh --- vtest/vtest_renderer.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/vtest/vtest_renderer.c b/vtest/vtest_renderer.c index 094d0fe..b128b7c 100644 --- a/vtest/vtest_renderer.c +++ b/vtest/vtest_renderer.c @@ -49,7 +49,6 @@ static int ctx_id = 1; static int fence_id = 1; -static uint32_t max_length = UINT_MAX; struct vtest_renderer { @@ -58,6 +57,8 @@ struct vtest_renderer { unsigned protocol_version; struct util_hash_table *iovec_hash; const char *rendernode_name; + + uint32_t max_length; }; static int last_fence; @@ -87,7 +88,9 @@ struct virgl_renderer_callbacks vtest_cbs = { }; -struct vtest_renderer renderer; +struct vtest_renderer renderer = { + .max_length = UINT_MAX, +}; static unsigned hash_func(void *key) @@ -544,7 +547,7 @@ int vtest_submit_cmd(uint32_t length_dw) uint32_t *cbuf; int ret; - if (length_dw > max_length / 4) { + if (length_dw > renderer.max_length / 4) { return -1; } @@ -600,7 +603,7 @@ int vtest_transfer_get(UNUSED uint32_t length_dw) DECODE_TRANSFER; - if (data_size > max_length) { + if (data_size > renderer.max_length) { return -ENOMEM; } @@ -647,7 +650,7 @@ int vtest_transfer_get_nop(UNUSED uint32_t length_dw) DECODE_TRANSFER; - if (data_size > max_length) { + if (data_size > renderer.max_length) { return -ENOMEM; } @@ -683,7 +686,7 @@ int vtest_transfer_put(UNUSED uint32_t length_dw) DECODE_TRANSFER; - if (data_size > max_length) { + if (data_size > renderer.max_length) { return -ENOMEM; } @@ -733,7 +736,7 @@ int vtest_transfer_put_nop(UNUSED uint32_t length_dw) DECODE_TRANSFER; - if (data_size > max_length) { + if (data_size > renderer.max_length) { return -ENOMEM; } @@ -967,5 +970,5 @@ int vtest_poll(void) void vtest_set_max_length(uint32_t length) { - max_length = length; + renderer.max_length = length; }