diff options
author | Dave Airlie <airlied@gmail.com> | 2015-03-18 08:56:56 +1000 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2015-06-16 12:34:26 +1000 |
commit | 52dc9021ab858123cdeb0daa01d0d1e62f32e9d4 (patch) | |
tree | 298dd9a276e9d3a85f88db5a28600506b960977c | |
parent | ed73146f974cb4d8183deef9fb2f80b3ff37a38d (diff) |
vtest: add sending command line support
this adds an explicit rendering init command that
passes the cmdline to the remote for debugging help
it also tries to strip off shader_runner and get the test
name.
-rw-r--r-- | src/gallium/winsys/virgl/vtest/virgl_vtest_socket.c | 29 | ||||
-rw-r--r-- | src/gallium/winsys/virgl/vtest/vtest_protocol.h | 2 |
2 files changed, 31 insertions, 0 deletions
diff --git a/src/gallium/winsys/virgl/vtest/virgl_vtest_socket.c b/src/gallium/winsys/virgl/vtest/virgl_vtest_socket.c index 715b53d96a1..b8987fe4911 100644 --- a/src/gallium/winsys/virgl/vtest/virgl_vtest_socket.c +++ b/src/gallium/winsys/virgl/vtest/virgl_vtest_socket.c @@ -9,6 +9,7 @@ #include <sys/un.h> #include <unistd.h> +#include <os/os_process.h> #include <util/u_format.h> /* connect to remote socket */ #define VTEST_SOCKET_NAME "/tmp/.virgl_test" @@ -49,6 +50,33 @@ static int virgl_block_read(int fd, void *buf, int size) return size; } +static int virgl_vtest_send_init(struct virgl_vtest_winsys *vws) +{ + uint32_t buf[VTEST_HDR_SIZE]; + const char *nstr = "virtest"; + char cmdline[64]; + int ret; + + ret = os_get_process_name(cmdline, 63); + if (ret == FALSE) + strcpy(cmdline, nstr); +#if defined(__GLIBC__) || defined(__CYGWIN__) + if (!strcmp(cmdline, "shader_runner")) { + const char *name; + /* hack to get better testname */ + name = program_invocation_short_name; + name += strlen(name) + 1; + strncpy(cmdline, name, 63); + } +#endif + buf[VTEST_CMD_LEN] = strlen(cmdline) + 1; + buf[VTEST_CMD_ID] = VCMD_CREATE_RENDERER; + + virgl_block_write(vws->sock_fd, &buf, sizeof(buf)); + virgl_block_write(vws->sock_fd, (void *)cmdline, strlen(cmdline) + 1); + return 0; +} + int virgl_vtest_connect(struct virgl_vtest_winsys *vws) { struct sockaddr_un un; @@ -70,6 +98,7 @@ int virgl_vtest_connect(struct virgl_vtest_winsys *vws) } while (ret == -EINTR); vws->sock_fd = sock; + virgl_vtest_send_init(vws); return 0; } diff --git a/src/gallium/winsys/virgl/vtest/vtest_protocol.h b/src/gallium/winsys/virgl/vtest/vtest_protocol.h index c465339e4d2..aedc27d354a 100644 --- a/src/gallium/winsys/virgl/vtest/vtest_protocol.h +++ b/src/gallium/winsys/virgl/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 */ |