Mesa (virgl-mesa-driver): vtest: add sending command line support
Dave Airlie
airlied at kemper.freedesktop.org
Tue Mar 17 22:59:31 UTC 2015
Module: Mesa
Branch: virgl-mesa-driver
Commit: 2c45846128d497d031f8a983e65c70d93f8462e1
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=2c45846128d497d031f8a983e65c70d93f8462e1
Author: Dave Airlie <airlied at gmail.com>
Date: Wed Mar 18 08:56:56 2015 +1000
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.
---
.../winsys/virgl/vtest/virgl_vtest_socket.c | 29 ++++++++++++++++++++
src/gallium/winsys/virgl/vtest/vtest_protocol.h | 2 ++
2 files changed, 31 insertions(+)
diff --git a/src/gallium/winsys/virgl/vtest/virgl_vtest_socket.c b/src/gallium/winsys/virgl/vtest/virgl_vtest_socket.c
index 715b53d..b8987fe 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 c465339..aedc27d 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 */
More information about the mesa-commit
mailing list