Mesa (staging/22.1): svga: finish readbacks before mapping resources

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed May 18 23:21:02 UTC 2022


Module: Mesa
Branch: staging/22.1
Commit: 0a0c4009131461e67bbb825cfa8fa4c720be94d4
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=0a0c4009131461e67bbb825cfa8fa4c720be94d4

Author: Zack Rusin <zackr at vmware.com>
Date:   Wed Mar  2 14:08:09 2022 -0500

svga: finish readbacks before mapping resources

Flushing the command queue before mapping a resource is not enough
to guaruantee that the mapped content is not stale. We have to finish
to make sure that the gb readback actually updated the guest surface.

This fixes races in direct maps (map reads raced with gb readbacks)

Signed-off-by: Zack Rusin <zackr at vmware.com>
Reviewed-by: Charmaine Lee <charmainel at vmware.com>
Reviewed-by: Neha Bhende <bhenden at vmware.com>
(cherry picked from commit c7b0309723721495edd318eb6ecd4446900d702b)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16564>

---

 src/gallium/drivers/svga/svga_resource_texture.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_resource_texture.c b/src/gallium/drivers/svga/svga_resource_texture.c
index cc1514bff70..ff2c500dbb4 100644
--- a/src/gallium/drivers/svga/svga_resource_texture.c
+++ b/src/gallium/drivers/svga/svga_resource_texture.c
@@ -342,9 +342,9 @@ svga_texture_transfer_map_direct(struct svga_context *svga,
 
       if (!svga->swc->force_coherent || tex->imported) {
          /* Readback the whole surface */
-	 readback_texture_surface(svga, tex, surf);
+         readback_texture_surface(svga, tex, surf);
 
-         svga_context_flush(svga, NULL);
+         svga_context_finish(svga);
       }
       /*
        * Note: if PIPE_MAP_DISCARD_WHOLE_RESOURCE were specified



More information about the mesa-commit mailing list