From 962d14f0a75412a2aa81af4d7598ca14b06e0c3c Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 18 Mar 2015 08:58:56 +1000 Subject: vtest: expect explicit initialisation with name this gets the cmdline passes to us --- vtest/vtest.h | 2 +- vtest/vtest_protocol.h | 2 ++ vtest/vtest_renderer.c | 15 +++++++++++++-- vtest/vtest_server.c | 9 ++++++++- 4 files changed, 24 insertions(+), 4 deletions(-) (limited to 'vtest') diff --git a/vtest/vtest.h b/vtest/vtest.h index d91ef51..79eafa0 100644 --- a/vtest/vtest.h +++ b/vtest/vtest.h @@ -2,7 +2,7 @@ #define VTEST_H #include -int vtest_create_renderer(int fd); +int vtest_create_renderer(int fd, uint32_t length); int vtest_send_caps(void); diff --git a/vtest/vtest_protocol.h b/vtest/vtest_protocol.h index c465339..aedc27d 100644 --- a/vtest/vtest_protocol.h +++ b/vtest/vtest_protocol.h @@ -24,6 +24,8 @@ #define VCMD_RESOURCE_BUSY_WAIT 7 +/* pass the process cmd line for debugging */ +#define VCMD_CREATE_RENDERER 8 /* get caps */ /* 0 length cmd */ /* resp VCMD_GET_CAPS + caps */ diff --git a/vtest/vtest_renderer.c b/vtest/vtest_renderer.c index 3611cda..68ec592 100644 --- a/vtest/vtest_renderer.c +++ b/vtest/vtest_renderer.c @@ -65,14 +65,25 @@ int vtest_block_read(int fd, void *buf, int size) return size; } -int vtest_create_renderer(int fd) +int vtest_create_renderer(int fd, uint32_t length) { - const char *vtestname = "vtestname"; + char *vtestname; int ret; renderer.remote_fd = fd; + virgl_renderer_init(&renderer, VIRGL_RENDERER_USE_EGL, &vtest_cbs); + vtestname = malloc(length); + if (!vtestname) + return -1; + + ret = vtest_block_read(renderer.remote_fd, vtestname, length); + if (ret != length) + return -1; + + fprintf(stderr, "string len is %d: %s\n", length, vtestname); + ret = virgl_renderer_context_create(ctx_id, strlen(vtestname), vtestname); return ret; } diff --git a/vtest/vtest_server.c b/vtest/vtest_server.c index 21a4d8e..9e45b1e 100644 --- a/vtest/vtest_server.c +++ b/vtest/vtest_server.c @@ -84,7 +84,7 @@ int run_renderer(int new_fd) int ret; uint32_t header[VTEST_HDR_SIZE]; bool do_fence; - vtest_create_renderer(new_fd); + bool inited = false; again: ret = wait_for_socket_read(new_fd); if (ret < 0) @@ -93,6 +93,12 @@ again: ret = vtest_block_read(new_fd, &header, sizeof(header)); if (ret == 8) { + if (!inited) { + if (header[1] != VCMD_CREATE_RENDERER) + goto fail; + ret = vtest_create_renderer(new_fd, header[0]); + inited = true; + } vtest_poll(); do_fence = false; switch (header[1]) { @@ -118,6 +124,7 @@ again: break; case VCMD_RESOURCE_BUSY_WAIT: ret = vtest_resource_busy_wait(); + break; default: break; } -- cgit v1.2.3