From 9a638bc7c2626e757321655068169b0cd588d88b Mon Sep 17 00:00:00 2001 From: Gurchetan Singh Date: Wed, 12 Dec 2018 10:08:06 -0800 Subject: virgl/vtest: plumb support for shared memory Signed-off-by: Gurchetan Singh Reviewed-By: Gert Wollny Reviewed-By: Piotr Rak --- src/gallium/winsys/virgl/vtest/virgl_vtest_socket.c | 9 ++++++--- src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.c | 3 ++- src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.h | 4 ++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/gallium/winsys/virgl/vtest/virgl_vtest_socket.c b/src/gallium/winsys/virgl/vtest/virgl_vtest_socket.c index 5baeaf4c952..71c10d9c523 100644 --- a/src/gallium/winsys/virgl/vtest/virgl_vtest_socket.c +++ b/src/gallium/winsys/virgl/vtest/virgl_vtest_socket.c @@ -278,7 +278,8 @@ static int virgl_vtest_send_resource_create2(struct virgl_vtest_winsys *vws, uint32_t array_size, uint32_t last_level, uint32_t nr_samples, - uint32_t size) + uint32_t size, + int *out_fd) { uint32_t res_create_buf[VCMD_RES_CREATE2_SIZE], vtest_hdr[VTEST_HDR_SIZE]; @@ -299,6 +300,7 @@ static int virgl_vtest_send_resource_create2(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)); + *out_fd = -1; return 0; } @@ -314,7 +316,8 @@ int virgl_vtest_send_resource_create(struct virgl_vtest_winsys *vws, uint32_t array_size, uint32_t last_level, uint32_t nr_samples, - uint32_t size) + uint32_t size, + int *out_fd) { uint32_t res_create_buf[VCMD_RES_CREATE_SIZE], vtest_hdr[VTEST_HDR_SIZE]; @@ -322,7 +325,7 @@ int virgl_vtest_send_resource_create(struct virgl_vtest_winsys *vws, return virgl_vtest_send_resource_create2(vws, handle, target, format, bind, width, height, depth, array_size, last_level, - nr_samples, size); + nr_samples, size, out_fd); vtest_hdr[VTEST_CMD_LEN] = VCMD_RES_CREATE_SIZE; vtest_hdr[VTEST_CMD_ID] = VCMD_RESOURCE_CREATE; diff --git a/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.c b/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.c index 681c0c25e6b..2952189dfb7 100644 --- a/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.c +++ b/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.c @@ -231,6 +231,7 @@ virgl_vtest_winsys_resource_create(struct virgl_winsys *vws, struct virgl_vtest_winsys *vtws = virgl_vtest_winsys(vws); struct virgl_hw_res *res; static int handle = 1; + int fd = -1; res = CALLOC_STRUCT(virgl_hw_res); if (!res) @@ -256,7 +257,7 @@ virgl_vtest_winsys_resource_create(struct virgl_winsys *vws, res->size = size; virgl_vtest_send_resource_create(vtws, handle, target, format, bind, width, height, depth, array_size, - last_level, nr_samples, size); + last_level, nr_samples, size, &fd); res->res_handle = handle++; pipe_reference_init(&res->reference, 1); diff --git a/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.h b/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.h index 012aa1c98b1..f5d8eb26e7c 100644 --- a/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.h +++ b/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.h @@ -73,7 +73,6 @@ struct virgl_hw_res { uint32_t bind; boolean cacheable; int64_t start, end; - }; struct virgl_vtest_cmd_buf { @@ -122,7 +121,8 @@ int virgl_vtest_send_resource_create(struct virgl_vtest_winsys *vws, uint32_t array_size, uint32_t last_level, uint32_t nr_samples, - uint32_t size); + uint32_t size, + int *out_fd); int virgl_vtest_send_resource_unref(struct virgl_vtest_winsys *vws, uint32_t handle); -- cgit v1.2.3