From b04e55d18f70157e8718ea57f168bb75253dba9c Mon Sep 17 00:00:00 2001 From: Yiwei Zhang Date: Tue, 14 Dec 2021 01:05:29 +0000 Subject: [PATCH] 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 Reviewed-by: Chia-I Wu --- server/.clang-format | 1 + server/render_context.c | 1 + src/proxy/.clang-format | 1 + src/proxy/proxy_context.c | 8 ++------ 4 files changed, 5 insertions(+), 6 deletions(-) create mode 120000 server/.clang-format create mode 120000 src/proxy/.clang-format 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 @@ render_context_dispatch_attach_resource(struct render_context *ctx, 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 @@ proxy_context_attach_resource(struct virgl_context *base, struct virgl_resource { 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 @@ proxy_context_attach_resource(struct virgl_context *base, struct virgl_resource 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);