vtest: expect explicit initialisation with name

this gets the cmdline passes to us
macos/master
Dave Airlie 10 years ago
parent 1af42f7a98
commit 962d14f0a7
  1. 2
      vtest/vtest.h
  2. 2
      vtest/vtest_protocol.h
  3. 15
      vtest/vtest_renderer.c
  4. 9
      vtest/vtest_server.c

@ -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);

@ -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 */

@ -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;
}

@ -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;
}

Loading…
Cancel
Save