virgl/vtest: plumb support for shared memory
authorGurchetan Singh <gurchetansingh@chromium.org>
Wed, 12 Dec 2018 18:08:06 +0000 (10:08 -0800)
committerGurchetan Singh <gurchetansingh@chromium.org>
Thu, 18 Apr 2019 22:38:58 +0000 (15:38 -0700)
Signed-off-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-By: Gert Wollny <gert.wollny@collabora.com>
Reviewed-By: Piotr Rak <p.rak@samsung.com>
src/gallium/winsys/virgl/vtest/virgl_vtest_socket.c
src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.c
src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.h

index 5baeaf4c952dcadd0bb2e8cc280846c0352d6b9e..71c10d9c5231bfc0d19f8630b06739ca2f33fa03 100644 (file)
@@ -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;
index 681c0c25e6b448dfe70cebac7585aeb18693797f..2952189dfb7504400769c293fba6c75b9aa851b2 100644 (file)
@@ -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);
index 012aa1c98b153e915520a3ff33b60773693e1066..f5d8eb26e7cfc21745bd36d16e827f8ef72326a1 100644 (file)
@@ -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);