mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-02-19 01:40:43 +01:00
virgl/vtest: take handle from host when using protocol version >=3
When the protocol is >=3 multiple contexts may be handled by one host process, and therefore we have to use the handle/resource ID that is assigned by the host. Signed-off-by: Gert Wollny <gert.wollny@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31624>
This commit is contained in:
parent
58498ab806
commit
4e3f21533a
2 changed files with 13 additions and 6 deletions
|
|
@ -294,7 +294,7 @@ static int virgl_vtest_send_resource_create2(struct virgl_vtest_winsys *vws,
|
|||
vtest_hdr[VTEST_CMD_LEN] = VCMD_RES_CREATE2_SIZE;
|
||||
vtest_hdr[VTEST_CMD_ID] = VCMD_RESOURCE_CREATE2;
|
||||
|
||||
res_create_buf[VCMD_RES_CREATE2_RES_HANDLE] = handle;
|
||||
res_create_buf[VCMD_RES_CREATE2_RES_HANDLE] = vws->protocol_version < 3 ? handle : 0;
|
||||
res_create_buf[VCMD_RES_CREATE2_TARGET] = target;
|
||||
res_create_buf[VCMD_RES_CREATE2_FORMAT] = format;
|
||||
res_create_buf[VCMD_RES_CREATE2_BIND] = bind;
|
||||
|
|
@ -313,13 +313,20 @@ static int virgl_vtest_send_resource_create2(struct virgl_vtest_winsys *vws,
|
|||
if (size == 0)
|
||||
return 0;
|
||||
|
||||
if (vws->protocol_version >= 3) {
|
||||
virgl_block_read(vws->sock_fd, vtest_hdr, sizeof(vtest_hdr));
|
||||
assert(vtest_hdr[VTEST_CMD_LEN] == 1);
|
||||
assert(vtest_hdr[VTEST_CMD_ID] == VCMD_RESOURCE_CREATE2);
|
||||
virgl_block_read(vws->sock_fd, &handle, sizeof(handle));
|
||||
}
|
||||
|
||||
*out_fd = virgl_vtest_receive_fd(vws->sock_fd);
|
||||
if (*out_fd < 0) {
|
||||
fprintf(stderr, "failed to get fd\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return handle;
|
||||
}
|
||||
|
||||
int virgl_vtest_send_resource_create(struct virgl_vtest_winsys *vws,
|
||||
|
|
@ -361,7 +368,7 @@ int virgl_vtest_send_resource_create(struct virgl_vtest_winsys *vws,
|
|||
virgl_block_write(vws->sock_fd, &vtest_hdr, sizeof(vtest_hdr));
|
||||
virgl_block_write(vws->sock_fd, &res_create_buf, sizeof(res_create_buf));
|
||||
|
||||
return 0;
|
||||
return handle;
|
||||
}
|
||||
|
||||
int virgl_vtest_submit_cmd(struct virgl_vtest_winsys *vws,
|
||||
|
|
|
|||
|
|
@ -274,9 +274,9 @@ virgl_vtest_winsys_resource_create(struct virgl_winsys *vws,
|
|||
res->height = height;
|
||||
res->width = width;
|
||||
res->size = size;
|
||||
virgl_vtest_send_resource_create(vtws, handle, target, pipe_to_virgl_format(format), bind,
|
||||
width, height, depth, array_size,
|
||||
last_level, nr_samples, size, &fd);
|
||||
handle = virgl_vtest_send_resource_create(vtws, handle, target, pipe_to_virgl_format(format), bind,
|
||||
width, height, depth, array_size,
|
||||
last_level, nr_samples, size, &fd);
|
||||
|
||||
if (vtws->protocol_version >= 2) {
|
||||
if (res->size == 0) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue