From 4e2c25f7528c4a2c3be59aa3ef6fef2fd196f818 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Wed, 1 Jul 2020 21:26:38 -0700 Subject: [PATCH] vtest: --multi-clients requires version 3 Protocol version 3 uses server-generated, rather than client-generated, resource ids. Without that, clients could pick conflicting resource ids. Signed-off-by: Chia-I Wu Reviewed-by: Ryan Neph Reviewed-by: Gert Wollny --- vtest/vtest_renderer.c | 6 ++++++ vtest/vtest_server.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/vtest/vtest_renderer.c b/vtest/vtest_renderer.c index 518b510..8861d2d 100644 --- a/vtest/vtest_renderer.c +++ b/vtest/vtest_renderer.c @@ -444,6 +444,9 @@ int vtest_lazy_init_context(struct vtest_context *ctx) if (ctx->context_initialized) return 0; + if (renderer.multi_clients && ctx->protocol_version < 3) + return report_failed_call("protocol version too low", -EINVAL); + if (ctx->capset_id) { ret = virgl_renderer_context_create_with_flags(ctx->ctx_id, ctx->capset_id, @@ -530,6 +533,9 @@ int vtest_protocol_version(UNUSED uint32_t length_dw) version = 0; } + if (renderer.multi_clients && version < 3) + return report_failed_call("protocol version too low", -EINVAL); + ctx->protocol_version = version; hdr_buf[VTEST_CMD_LEN] = VCMD_PROTOCOL_VERSION_SIZE; diff --git a/vtest/vtest_server.c b/vtest/vtest_server.c index 5a2eec8..2bf0cd4 100644 --- a/vtest/vtest_server.c +++ b/vtest/vtest_server.c @@ -186,7 +186,7 @@ static void vtest_server_parse_args(int argc, char **argv) server.loop = false; break; case OPT_MULTI_CLIENTS: - printf("EXPERIMENTAL: clients must know and trust each other\n"); + printf("multi-clients enabled: clients must trust each other\n"); server.multi_clients = true; break; case OPT_USE_GLX: