Lines Matching full:server
93 struct vtest_server server = { variable
129 list_inithead(&server.new_clients); in main()
130 list_inithead(&server.active_clients); in main()
131 list_inithead(&server.inactive_clients); in main()
133 if (server.do_fork) { in main()
142 if (!server.main_server) { in main()
182 server.do_fork = false; in vtest_server_parse_args()
185 server.do_fork = false; in vtest_server_parse_args()
186 server.loop = false; in vtest_server_parse_args()
190 server.multi_clients = true; in vtest_server_parse_args()
193 server.use_glx = true; in vtest_server_parse_args()
196 server.use_egl_surfaceless = true; in vtest_server_parse_args()
199 server.use_gles = true; in vtest_server_parse_args()
202 server.render_device = optarg; in vtest_server_parse_args()
216 server.read_file = argv[optind]; in vtest_server_parse_args()
217 server.loop = false; in vtest_server_parse_args()
218 server.do_fork = false; in vtest_server_parse_args()
219 server.multi_clients = false; in vtest_server_parse_args()
222 server.ctx_flags = VIRGL_RENDERER_USE_EGL; in vtest_server_parse_args()
223 if (server.use_glx) { in vtest_server_parse_args()
224 if (server.use_egl_surfaceless || server.use_gles) { in vtest_server_parse_args()
228 server.ctx_flags = VIRGL_RENDERER_USE_GLX; in vtest_server_parse_args()
230 if (server.use_egl_surfaceless) in vtest_server_parse_args()
231 server.ctx_flags |= VIRGL_RENDERER_USE_SURFACELESS; in vtest_server_parse_args()
232 if (server.use_gles) in vtest_server_parse_args()
233 server.ctx_flags |= VIRGL_RENDERER_USE_GLES; in vtest_server_parse_args()
239 server.use_glx = getenv("VTEST_USE_GLX") != NULL; in vtest_server_getenv()
240 server.use_egl_surfaceless = getenv("VTEST_USE_EGL_SURFACELESS") != NULL; in vtest_server_getenv()
241 server.use_gles = getenv("VTEST_USE_GLES") != NULL; in vtest_server_getenv()
242 server.render_device = getenv("VTEST_RENDERNODE"); in vtest_server_getenv()
301 list_addtail(&client->head, &server.new_clients); in vtest_server_add_client()
311 in_fd = open(server.read_file, O_RDONLY); in vtest_server_open_read_file()
333 server.socket = socket(PF_UNIX, SOCK_STREAM, 0); in vtest_server_open_socket()
334 if (server.socket < 0) { in vtest_server_open_socket()
341 snprintf(un.sun_path, sizeof(un.sun_path), "%s", server.socket_name); in vtest_server_open_socket()
345 if (bind(server.socket, (struct sockaddr *)&un, sizeof(un)) < 0) { in vtest_server_open_socket()
349 if (listen(server.socket, 1) < 0){ in vtest_server_open_socket()
369 LIST_FOR_EACH_ENTRY(client, &server.active_clients, head) { in vtest_server_wait_clients()
375 if (server.socket >= 0 && (max_fd < 0 || server.multi_clients)) { in vtest_server_wait_clients()
376 FD_SET(server.socket, &read_fds); in vtest_server_wait_clients()
377 max_fd = MAX2(server.socket, max_fd); in vtest_server_wait_clients()
381 if (!LIST_IS_EMPTY(&server.new_clients)) { in vtest_server_wait_clients()
385 fprintf(stderr, "server has no fd to wait\n"); in vtest_server_wait_clients()
395 LIST_FOR_EACH_ENTRY(client, &server.active_clients, head) { in vtest_server_wait_clients()
401 if (server.socket >= 0 && FD_ISSET(server.socket, &read_fds)) { in vtest_server_wait_clients()
402 int new_fd = accept(server.socket, NULL, NULL); in vtest_server_wait_clients()
434 LIST_FOR_EACH_ENTRY_SAFE(client, tmp, &server.active_clients, head) { in vtest_server_dispatch_clients()
446 list_addtail(&client->head, &server.inactive_clients); in vtest_server_dispatch_clients()
459 server.main_server = false; in vtest_server_fork()
460 server.do_fork = false; in vtest_server_fork()
461 server.loop = false; in vtest_server_fork()
462 server.multi_clients = false; in vtest_server_fork()
472 LIST_FOR_EACH_ENTRY_SAFE(client, tmp, &server.new_clients, head) { in vtest_server_fork_clients()
476 list_addtail(&client->head, &server.inactive_clients); in vtest_server_fork_clients()
480 list_addtail(&client->head, &server.active_clients); in vtest_server_fork_clients()
483 LIST_FOR_EACH_ENTRY_SAFE(client, tmp, &server.new_clients, head) { in vtest_server_fork_clients()
485 list_addtail(&client->head, &server.inactive_clients); in vtest_server_fork_clients()
496 LIST_FOR_EACH_ENTRY_SAFE(client, tmp, &server.new_clients, head) { in vtest_server_activate_clients()
497 list_addtail(&client->head, &server.active_clients); in vtest_server_activate_clients()
499 list_inithead(&server.new_clients); in vtest_server_activate_clients()
507 LIST_FOR_EACH_ENTRY_SAFE(client, tmp, &server.active_clients, head) { in vtest_server_inactivate_clients()
508 list_addtail(&client->head, &server.inactive_clients); in vtest_server_inactivate_clients()
510 list_inithead(&server.active_clients); in vtest_server_inactivate_clients()
517 LIST_FOR_EACH_ENTRY_SAFE(client, tmp, &server.inactive_clients, head) { in vtest_server_tidy_clients()
533 list_inithead(&server.inactive_clients); in vtest_server_tidy_clients()
540 if (server.read_file) { in vtest_server_run()
547 const bool was_empty = LIST_IS_EMPTY(&server.active_clients); in vtest_server_run()
553 if (server.do_fork) { in vtest_server_run()
560 is_empty = LIST_IS_EMPTY(&server.active_clients); in vtest_server_run()
562 int ret = vtest_init_renderer(server.ctx_flags, server.render_device); in vtest_server_run()
574 if (!server.loop) { in vtest_server_run()
676 if (server.socket != -1) { in vtest_server_close_socket()
677 close(server.socket); in vtest_server_close_socket()
678 server.socket = -1; in vtest_server_close_socket()