Mesa (main): virgl: flush cmd buffer when flushing frontbuffer

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sat Dec 11 18:09:50 UTC 2021


Module: Mesa
Branch: main
Commit: 6740f34568eef4cdf46b8903f17e7acf234d8424
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=6740f34568eef4cdf46b8903f17e7acf234d8424

Author: Italo Nicola <italonicola at collabora.com>
Date:   Fri Jul  9 07:27:01 2021 -0300

virgl: flush cmd buffer when flushing frontbuffer

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 at collabora.com>
Reviewed-by: Gert Wollny <gert.wollny at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11714>

---

 src/gallium/drivers/virgl/virgl_context.c | 2 +-
 src/gallium/drivers/virgl/virgl_context.h | 4 ++--
 src/gallium/drivers/virgl/virgl_screen.c  | 5 ++++-
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/virgl/virgl_context.c b/src/gallium/drivers/virgl/virgl_context.c
index dfa8bcbc6c7..8891901e703 100644
--- a/src/gallium/drivers/virgl/virgl_context.c
+++ b/src/gallium/drivers/virgl/virgl_context.c
@@ -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);
 
diff --git a/src/gallium/drivers/virgl/virgl_context.h b/src/gallium/drivers/virgl/virgl_context.h
index c84b992f20b..924f1a82227 100644
--- a/src/gallium/drivers/virgl/virgl_context.h
+++ b/src/gallium/drivers/virgl/virgl_context.h
@@ -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
diff --git a/src/gallium/drivers/virgl/virgl_screen.c b/src/gallium/drivers/virgl/virgl_screen.c
index c7610417e1b..57aca63ab12 100644
--- a/src/gallium/drivers/virgl/virgl_screen.c
+++ b/src/gallium/drivers/virgl/virgl_screen.c
@@ -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,



More information about the mesa-commit mailing list