virgl: let proxy ignore iovs to allow classic 3d resource import
Use virgl_resource_get_size to fill the size so that supported classic
3d resource can have a valid size as well.
This change also links venus .clang-format into server and proxy.
Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
diff --git a/server/.clang-format b/server/.clang-format
new file mode 120000
index 0000000..e06681e
--- /dev/null
+++ b/server/.clang-format
@@ -0,0 +1 @@
+../src/venus/.clang-format
\ No newline at end of file
diff --git a/server/render_context.c b/server/render_context.c
index 19dd5b2..c506dcd 100644
--- a/server/render_context.c
+++ b/server/render_context.c
@@ -301,6 +301,7 @@
return false;
}
+ /* classic 3d resource with valid size reuses the blob import path here */
struct render_context_resource *res =
render_context_resource_import(res_id, fd_type, fds[0], size);
if (!res) {
diff --git a/src/proxy/.clang-format b/src/proxy/.clang-format
new file mode 120000
index 0000000..2d1184b
--- /dev/null
+++ b/src/proxy/.clang-format
@@ -0,0 +1 @@
+../venus/.clang-format
\ No newline at end of file
diff --git a/src/proxy/proxy_context.c b/src/proxy/proxy_context.c
index 46b80a0..029893f 100644
--- a/src/proxy/proxy_context.c
+++ b/src/proxy/proxy_context.c
@@ -400,11 +400,6 @@
{
struct proxy_context *ctx = (struct proxy_context *)base;
- if (res->iov_count) {
- proxy_log("failed to attach resource with iov");
- return;
- }
-
enum virgl_resource_fd_type res_fd_type = res->fd_type;
int res_fd = res->fd;
bool close_res_fd = false;
@@ -418,11 +413,12 @@
close_res_fd = true;
}
+ /* the proxy ignores iovs since transfer_3d is not supported */
const struct render_context_op_attach_resource_request req = {
.header.op = RENDER_CONTEXT_OP_ATTACH_RESOURCE,
.res_id = res->res_id,
.fd_type = res_fd_type,
- .size = res->map_size,
+ .size = virgl_resource_get_size(res),
};
if (!proxy_socket_send_request_with_fds(&ctx->socket, &req, sizeof(req), &res_fd, 1))
proxy_log("failed to attach res %d", res->res_id);