drisw: do an MSAA resolve when copying the backbuffer
authorItalo Nicola <italonicola@collabora.com>
Fri, 9 Jul 2021 10:34:02 +0000 (07:34 -0300)
committerMarge Bot <emma+marge@anholt.net>
Sat, 11 Dec 2021 17:49:00 +0000 (17:49 +0000)
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 <italonicola@collabora.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11714>

src/gallium/frontends/dri/drisw.c

index adb486c..64c7788 100644 (file)
@@ -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);
    }