Commit 6cc3162d authored by Dave Airlie's avatar Dave Airlie

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's avatarJakob Bornecrantz <jakob@collabora.com>
Reviewed-by: Jakob Bornecrantz's avatarJakob Bornecrantz <jakob@collabora.com>
Signed-off-by: default avatarTomeu Vizoso <tomeu.vizoso@collabora.com>
Signed-off-by: Jakob Bornecrantz's avatarJakob Bornecrantz <jakob@collabora.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent 003007e3
......@@ -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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment