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 <olvaffe@gmail.com>
Reviewed-By: Gert Wollny <gert.wollny@collabora.com>
Reviewed-By: Gurchetan Singh <gurchetansingh@chromium.org>
macos/master
Chia-I Wu 5 years ago
parent b88a34d5d3
commit 4d234f9f17
  1. 10
      vtest/vtest_server.c

@ -372,6 +372,11 @@ static void vtest_server_run_renderer(struct vtest_client *client)
{ {
int err, ret; int err, ret;
ret = vtest_init_renderer(server.ctx_flags, server.render_device);
if (ret) {
return;
}
do { do {
ret = vtest_wait_for_fd_read(client->in_fd); ret = vtest_wait_for_fd_read(client->in_fd);
if (ret < 0) { if (ret < 0) {
@ -431,15 +436,12 @@ static int vtest_client_dispatch_commands(struct vtest_client *client)
return 3; return 3;
} }
ret = vtest_init_renderer(server.ctx_flags, server.render_device);
if (ret >= 0) {
ret = vtest_create_context(&client->input, client->out_fd, ret = vtest_create_context(&client->input, client->out_fd,
header[0], &client->context); header[0], &client->context);
}
if (ret < 0) { if (ret < 0) {
return 4; return 4;
} }
printf("%s: vtest initialized.\n", __func__); printf("%s: client context created.\n", __func__);
vtest_set_current_context(client->context); vtest_set_current_context(client->context);
vtest_poll(); vtest_poll();

Loading…
Cancel
Save