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 <olvaffe@gmail.com>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
macos/master
Chia-I Wu 4 years ago
parent c0c079f19d
commit 4e2c25f752
  1. 6
      vtest/vtest_renderer.c
  2. 2
      vtest/vtest_server.c

@ -444,6 +444,9 @@ int vtest_lazy_init_context(struct vtest_context *ctx)
if (ctx->context_initialized) if (ctx->context_initialized)
return 0; return 0;
if (renderer.multi_clients && ctx->protocol_version < 3)
return report_failed_call("protocol version too low", -EINVAL);
if (ctx->capset_id) { if (ctx->capset_id) {
ret = virgl_renderer_context_create_with_flags(ctx->ctx_id, ret = virgl_renderer_context_create_with_flags(ctx->ctx_id,
ctx->capset_id, ctx->capset_id,
@ -530,6 +533,9 @@ int vtest_protocol_version(UNUSED uint32_t length_dw)
version = 0; version = 0;
} }
if (renderer.multi_clients && version < 3)
return report_failed_call("protocol version too low", -EINVAL);
ctx->protocol_version = version; ctx->protocol_version = version;
hdr_buf[VTEST_CMD_LEN] = VCMD_PROTOCOL_VERSION_SIZE; hdr_buf[VTEST_CMD_LEN] = VCMD_PROTOCOL_VERSION_SIZE;

@ -186,7 +186,7 @@ static void vtest_server_parse_args(int argc, char **argv)
server.loop = false; server.loop = false;
break; break;
case OPT_MULTI_CLIENTS: 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; server.multi_clients = true;
break; break;
case OPT_USE_GLX: case OPT_USE_GLX:

Loading…
Cancel
Save