From 3a55d4ba91e6fc6079b621dc66d56e80e6693e6f Mon Sep 17 00:00:00 2001 From: Gert Wollny Date: Fri, 14 Dec 2018 21:10:59 +0100 Subject: [PATCH] vrend,blit: Don't use GL blit when src and dest swizzles are the same Signed-off-by: Gert Wollny Signed-off-by: Dave Airlie --- src/vrend_renderer.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c index 273ad18..5bc482f 100644 --- a/src/vrend_renderer.c +++ b/src/vrend_renderer.c @@ -644,9 +644,14 @@ bool vrend_format_is_emulated_alpha(enum virgl_formats format) format == VIRGL_FORMAT_A16_UNORM); } -static bool vrend_format_needs_swizzle(enum virgl_formats format) +static bool vrend_blit_needs_swizzle(enum virgl_formats src, + enum virgl_formats dst) { - return tex_conv_table[format].flags & VIRGL_BIND_NEED_SWIZZLE; + for (int i = 0; i < 4; ++i) { + if (tex_conv_table[src].swizzle[i] != tex_conv_table[dst].swizzle[i]) + return true; + } + return false; } static inline const char *pipe_shader_to_prefix(int shader_type) @@ -7334,8 +7339,7 @@ static void vrend_renderer_blit_int(struct vrend_context *ctx, if (info->src.box.depth != info->dst.box.depth) use_gl = true; - if (vrend_format_needs_swizzle(info->dst.format) || - vrend_format_needs_swizzle(info->src.format)) + if (vrend_blit_needs_swizzle(info->dst.format, info->src.format)) use_gl = true; if (use_gl) {