From f0eb163ae0535ead5e89fd9d66dfc4b04488eb62 Mon Sep 17 00:00:00 2001 From: Italo Nicola Date: Fri, 9 Jul 2021 07:34:02 -0300 Subject: [PATCH] drisw: do an MSAA resolve when copying the backbuffer When calling glXCopySubBuffer, we must resolve the backbuffer before copying it the frontbuffer. Fixes piglit's glx/glx-copy-sub-buffer on virgl. Signed-off-by: Italo Nicola Reviewed-by: Gert Wollny Part-of: --- src/gallium/frontends/dri/drisw.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/gallium/frontends/dri/drisw.c b/src/gallium/frontends/dri/drisw.c index adb486ceb0b..64c77889de4 100644 --- a/src/gallium/frontends/dri/drisw.c +++ b/src/gallium/frontends/dri/drisw.c @@ -285,6 +285,13 @@ drisw_copy_sub_buffer(__DRIdrawable *dPriv, int x, int y, ctx->st->flush(ctx->st, ST_FLUSH_FRONT, NULL, NULL, NULL); + if (drawable->stvis.samples > 1) { + /* Resolve the back buffer. */ + dri_pipe_blit(ctx->st->pipe, + drawable->textures[ST_ATTACHMENT_BACK_LEFT], + drawable->msaa_textures[ST_ATTACHMENT_BACK_LEFT]); + } + u_box_2d(x, dPriv->h - y - h, w, h, &box); drisw_present_texture(ctx->st->pipe, dPriv, ptex, &box); }