From 9d81ab73768db6647c116f4710f7a93d8d41e3b1 Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Wed, 14 Jun 2017 15:53:40 +0200 Subject: [PATCH] svga: Relax the format checks for copy_region_vgpu10 somewhat The new generic checks were actually more restrictive than the previous svga- specific tests and not vice versa. So bypass the common format checks for copy_region_vgpu10. Signed-off-by: Thomas Hellstrom Reviewed-by: Neha Bhende --- src/gallium/drivers/svga/svga_pipe_blit.c | 28 +++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/svga/svga_pipe_blit.c b/src/gallium/drivers/svga/svga_pipe_blit.c index 28996062ab3..45bad97072f 100644 --- a/src/gallium/drivers/svga/svga_pipe_blit.c +++ b/src/gallium/drivers/svga/svga_pipe_blit.c @@ -275,8 +275,17 @@ static bool can_blit_via_svga_copy_region(struct svga_context *svga, const struct pipe_blit_info *blit_info) { - if (!util_can_blit_via_copy_region(blit_info, FALSE) && - !util_can_blit_via_copy_region(blit_info, TRUE)) + struct pipe_blit_info local_blit = *blit_info; + + /* First basic checks to catch incompatibilities in new or locally unchecked + * struct pipe_blit_info members but bypass the format check here. + * Also since util_can_blit_via_copy_region() requires a dimension match, + * PIPE_FILTER_LINEAR should be equal to PIPE_FILTER_NEAREST. + */ + local_blit.dst.format = local_blit.src.format; + if (local_blit.filter == PIPE_TEX_FILTER_LINEAR) + local_blit.filter = PIPE_TEX_FILTER_NEAREST; + if (!util_can_blit_via_copy_region(&local_blit, TRUE)) return false; /* For depth+stencil formats, copy with mask != PIPE_MASK_ZS is not @@ -331,6 +340,21 @@ can_blit_via_surface_copy(struct svga_context *svga, { struct svga_texture *dtex, *stex; + /* Mimic the format tests in util_can_blit_via_copy_region(), but + * skip the other tests that have already been performed. + */ + if (blit_info->src.format != blit_info->dst.format) { + const struct util_format_description *src_desc, *dst_desc; + + src_desc = util_format_description(blit_info->src.resource->format); + dst_desc = util_format_description(blit_info->dst.resource->format); + + if (blit_info->src.resource->format != blit_info->src.format || + blit_info->dst.resource->format != blit_info->dst.format || + !util_is_format_compatible(src_desc, dst_desc)); + return FALSE; + } + if (svga->render_condition && blit_info->render_condition_enable) return false; -- 2.30.2