From 8c140709bc0f1f58ea84d3d609354952cf4caaf1 Mon Sep 17 00:00:00 2001 From: Yurii Danilovskyi Date: Mon, 1 Nov 2021 19:58:24 +0200 Subject: [PATCH] vrend: Skip iov transfer if resource created from egl image. If resource created from egl image we don't need to attach iov to it. Therefore we don't need to do transfer iov to/from host for those resources. Signed-off-by: Yurii Danilovskyi Reviewed-by: maksym.wezdecki@collabora.com --- src/vrend_renderer.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c index 801057d..cc65263 100644 --- a/src/vrend_renderer.c +++ b/src/vrend_renderer.c @@ -7205,6 +7205,7 @@ static int vrend_resource_alloc_texture(struct vrend_resource *gr, glBindTexture(gr->target, 0); return EINVAL; } + gr->storage_bits |= VREND_STORAGE_EGL_IMAGE; } else { internalformat = tex_conv_table[format].internalformat; glformat = tex_conv_table[format].glformat; @@ -8403,11 +8404,20 @@ int vrend_renderer_transfer_iov(struct vrend_context *ctx, struct vrend_resource *res; res = vrend_renderer_ctx_res_lookup(ctx, dst_handle); - if (!res || !check_transfer_iovec(res, info)) { + if (!res) { vrend_report_context_error(ctx, VIRGL_ERROR_CTX_ILLEGAL_RESOURCE, dst_handle); return EINVAL; } + if (!check_transfer_iovec(res, info)) { + if (has_bit(res->storage_bits, VREND_STORAGE_EGL_IMAGE)) + return 0; + else { + vrend_report_context_error(ctx, VIRGL_ERROR_CTX_ILLEGAL_RESOURCE, dst_handle); + return EINVAL; + } + } + return vrend_renderer_transfer_internal(ctx, res, info, transfer_mode); }