vtest: Add ping protocol version cmd

As we don't have yet a proper way of negotiating a common protocol
version to use between clients and the server, we introduce a command
without reply arguments that allows us to figure out if the server is
new enough to handle negotiation of the protocol version.

Tested-by: Jakob Bornecrantz <jakob@collabora.com>
Reviewed-by: Jakob Bornecrantz <jakob@collabora.com>
Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
macos/master
Dave Airlie 6 years ago
parent 003007e3e4
commit 6cc3162d45
  1. 2
      vtest/vtest.h
  2. 4
      vtest/vtest_protocol.h
  3. 13
      vtest/vtest_renderer.c
  4. 3
      vtest/vtest_server.c

@ -42,6 +42,8 @@ int vtest_resource_busy_wait(void);
int vtest_renderer_create_fence(void);
int vtest_poll(void);
int vtest_ping_protocol_version(void);
void vtest_destroy_renderer(void);
#endif

@ -54,6 +54,8 @@
/* 0 length cmd */
/* resp VCMD_GET_CAPS + caps */
#define VCMD_PING_PROTOCOL_VERSION 10
#define VCMD_RES_CREATE_SIZE 10
#define VCMD_RES_CREATE_RES_HANDLE 0
#define VCMD_RES_CREATE_TARGET 1
@ -88,4 +90,6 @@
#define VCMD_BUSY_WAIT_HANDLE 0
#define VCMD_BUSY_WAIT_FLAGS 1
#define VCMD_PING_PROTOCOL_VERSION_SIZE 0
#endif

@ -162,6 +162,19 @@ end:
return ret;
}
int vtest_ping_protocol_version(void)
{
uint32_t hdr_buf[VTEST_HDR_SIZE];
int ret;
hdr_buf[VTEST_CMD_LEN] = VCMD_PING_PROTOCOL_VERSION_SIZE;
hdr_buf[VTEST_CMD_ID] = VCMD_PING_PROTOCOL_VERSION;
ret = vtest_block_write(renderer.out_fd, hdr_buf, sizeof(hdr_buf));
if (ret < 0)
return ret;
return 0;
}
void vtest_destroy_renderer(void)
{
virgl_renderer_context_destroy(ctx_id);

@ -132,6 +132,9 @@ again:
case VCMD_GET_CAPS2:
ret = vtest_send_caps2();
break;
case VCMD_PING_PROTOCOL_VERSION:
ret = vtest_ping_protocol_version();
break;
default:
break;
}

Loading…
Cancel
Save