From 4d234f9f17c07940225248dc533a7fa71e7572e6 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Thu, 12 Mar 2020 11:01:53 -0700 Subject: [PATCH] vtest: initialize renderer when the client connects Call vtest_init_renderer when the client connects, instead of before the first command. We want to make vtest_server_run_renderer the main loop when we add multi-client support, and this makes things simpler. Signed-off-by: Chia-I Wu Reviewed-By: Gert Wollny Reviewed-By: Gurchetan Singh --- vtest/vtest_server.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/vtest/vtest_server.c b/vtest/vtest_server.c index b601952..156ade2 100644 --- a/vtest/vtest_server.c +++ b/vtest/vtest_server.c @@ -372,6 +372,11 @@ static void vtest_server_run_renderer(struct vtest_client *client) { int err, ret; + ret = vtest_init_renderer(server.ctx_flags, server.render_device); + if (ret) { + return; + } + do { ret = vtest_wait_for_fd_read(client->in_fd); if (ret < 0) { @@ -431,15 +436,12 @@ static int vtest_client_dispatch_commands(struct vtest_client *client) return 3; } - ret = vtest_init_renderer(server.ctx_flags, server.render_device); - if (ret >= 0) { - ret = vtest_create_context(&client->input, client->out_fd, - header[0], &client->context); - } + ret = vtest_create_context(&client->input, client->out_fd, + header[0], &client->context); if (ret < 0) { return 4; } - printf("%s: vtest initialized.\n", __func__); + printf("%s: client context created.\n", __func__); vtest_set_current_context(client->context); vtest_poll();