From d989e5bbbe3df2df98dd03d79c771ee04e704d88 Mon Sep 17 00:00:00 2001 From: Ryan Neph Date: Wed, 16 Jun 2021 23:55:49 +0000 Subject: [PATCH] vrend: fix internal format mismatch for BGRX EGL-backed resources BGRX resources backed by EGL images are given GL_RGB8 internal format on creation outside of virglrenderer, so we must accomodate when creating a texture view. Signed-off-by: Ryan Neph Reviewed-by: Gert Wollny --- src/vrend_renderer.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c index 1c3df64..61af5ea 100644 --- a/src/vrend_renderer.c +++ b/src/vrend_renderer.c @@ -1893,6 +1893,11 @@ int vrend_create_surface(struct vrend_context *ctx, GLenum target = res->target; GLenum internalformat = tex_conv_table[format].internalformat; + if (res->base.format == VIRGL_FORMAT_B8G8R8X8_UNORM && + has_bit(res->storage_bits, VREND_STORAGE_EGL_IMAGE)) { + internalformat = GL_RGB8; + } + VREND_DEBUG(dbg_tex, ctx, "Create texture view from %s for %s\n", util_format_name(res->base.format), util_format_name(surf->format));