From dbf20dac3374aa24fcd66d44b1d5fc1708feb957 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Wed, 15 Apr 2020 18:16:07 -0700 Subject: [PATCH] vrend: remove iov from vrend_renderer_resource_create Remove iov from vrend_renderer_resource_create and make a separate call to virgl_renderer_resource_attach_iov. In practice, this changes nothing because iov is always NULL. Signed-off-by: Chia-I Wu Tested-by: Gurchetan Singh Reviewed-by: Gurchetan Singh --- src/virglrenderer.c | 15 +++++++++++++-- src/vrend_renderer.c | 4 +--- src/vrend_renderer.h | 3 ++- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/virglrenderer.c b/src/virglrenderer.c index 0643cf1..a389407 100644 --- a/src/virglrenderer.c +++ b/src/virglrenderer.c @@ -55,13 +55,24 @@ static struct virgl_glx *glx_info; int virgl_renderer_resource_create(struct virgl_renderer_resource_create_args *args, struct iovec *iov, uint32_t num_iovs) { - return vrend_renderer_resource_create((struct vrend_renderer_resource_create_args *)args, iov, num_iovs, NULL); + int ret; + + ret = vrend_renderer_resource_create((struct vrend_renderer_resource_create_args *)args, NULL); + if (!ret && num_iovs) { + ret = virgl_renderer_resource_attach_iov(args->handle, iov, num_iovs); + if (ret) { + virgl_resource_remove(args->handle); + return ret; + } + } + + return ret; } int virgl_renderer_resource_import_eglimage(struct virgl_renderer_resource_create_args *args, void *image) { #ifdef HAVE_EPOXY_EGL_H - return vrend_renderer_resource_create((struct vrend_renderer_resource_create_args *)args, 0, 0, image); + return vrend_renderer_resource_create((struct vrend_renderer_resource_create_args *)args, image); #else return EINVAL; #endif diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c index cad32d7..c1c593e 100644 --- a/src/vrend_renderer.c +++ b/src/vrend_renderer.c @@ -6654,7 +6654,7 @@ static int vrend_renderer_resource_allocate_texture(struct vrend_resource *gr, } int vrend_renderer_resource_create(struct vrend_renderer_resource_create_args *args, - struct iovec *iov, uint32_t num_iovs, void *image_oes) + void *image_oes) { struct vrend_resource *gr; int ret; @@ -6671,8 +6671,6 @@ int vrend_renderer_resource_create(struct vrend_renderer_resource_create_args *a return ENOMEM; vrend_renderer_resource_copy_args(args, gr); - gr->iov = iov; - gr->num_iovs = num_iovs; gr->storage_bits = VREND_STORAGE_GUEST_MEMORY; if (args->flags & VIRGL_RESOURCE_Y_0_TOP) diff --git a/src/vrend_renderer.h b/src/vrend_renderer.h index e6fcea5..3262d4b 100644 --- a/src/vrend_renderer.h +++ b/src/vrend_renderer.h @@ -182,7 +182,8 @@ struct vrend_renderer_resource_create_args { uint32_t flags; }; -int vrend_renderer_resource_create(struct vrend_renderer_resource_create_args *args, struct iovec *iov, uint32_t num_iovs, void *image_eos); +int vrend_renderer_resource_create(struct vrend_renderer_resource_create_args *args, + void *image_eos); int vrend_create_surface(struct vrend_context *ctx, uint32_t handle,