diff options
author | Dave Airlie <airlied@gmail.com> | 2015-03-18 08:58:56 +1000 |
---|---|---|
committer | Dave Airlie <airlied@gmail.com> | 2015-03-18 08:58:56 +1000 |
commit | 962d14f0a75412a2aa81af4d7598ca14b06e0c3c (patch) | |
tree | 20db31ea03d062bbe49f65335cb37e7d9a10c7c2 /vtest | |
parent | 1af42f7a98e34ec170f34e9e6182635dd60fa7fc (diff) |
vtest: expect explicit initialisation with name
this gets the cmdline passes to us
Diffstat (limited to 'vtest')
-rw-r--r-- | vtest/vtest.h | 2 | ||||
-rw-r--r-- | vtest/vtest_protocol.h | 2 | ||||
-rw-r--r-- | vtest/vtest_renderer.c | 15 | ||||
-rw-r--r-- | vtest/vtest_server.c | 9 |
4 files changed, 24 insertions, 4 deletions
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 <errno.h> -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; } |