virgl: flush cmd buffer when flushing frontbuffer
authorItalo Nicola <italonicola@collabora.com>
Fri, 9 Jul 2021 10:27:01 +0000 (07:27 -0300)
committerMarge Bot <emma+marge@anholt.net>
Sat, 11 Dec 2021 17:49:00 +0000 (17:49 +0000)
When a resource is multisampled, we usually submit a multisampling
resolving blit before we present it or use it in some other way, but
currently we don't always flush the cmd buffer before flushing the
frontbuffer, this commit fixes that.

Fixes piglit's glx/glx-copy-sub-buffer MSAA cases on vtest, in
conjunction with other commits of this series.

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/drivers/virgl/virgl_context.c
src/gallium/drivers/virgl/virgl_context.h
src/gallium/drivers/virgl/virgl_screen.c

index dfa8bcb..8891901 100644 (file)
@@ -946,7 +946,7 @@ static void virgl_submit_cmd(struct virgl_winsys *vws,
 }
 
 void virgl_flush_eq(struct virgl_context *ctx, void *closure,
-                   struct pipe_fence_handle **fence)
+                    struct pipe_fence_handle **fence)
 {
    struct virgl_screen *rs = virgl_screen(ctx->base.screen);
 
index c84b992..924f1a8 100644 (file)
@@ -137,6 +137,6 @@ void
 virgl_rebind_resource(struct virgl_context *vctx,
                       struct pipe_resource *res);
 
-void virgl_flush_eq(struct virgl_context *ctx, void *closure,
-                   struct pipe_fence_handle **fence);
+void virgl_flush_eq(struct virgl_context *ctx, void *closure, struct pipe_fence_handle **fence);
+
 #endif
index c761041..57aca63 100644 (file)
@@ -801,10 +801,13 @@ static void virgl_flush_frontbuffer(struct pipe_screen *screen,
    struct virgl_screen *vscreen = virgl_screen(screen);
    struct virgl_winsys *vws = vscreen->vws;
    struct virgl_resource *vres = virgl_resource(res);
+   struct virgl_context *vctx = virgl_context(ctx);
 
-   if (vws->flush_frontbuffer)
+   if (vws->flush_frontbuffer) {
+      virgl_flush_eq(vctx, vctx, NULL);
       vws->flush_frontbuffer(vws, vres->hw_res, level, layer, winsys_drawable_handle,
                              sub_box);
+   }
 }
 
 static void virgl_fence_reference(struct pipe_screen *screen,