From c7b0309723721495edd318eb6ecd4446900d702b Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Wed, 2 Mar 2022 14:08:09 -0500 Subject: [PATCH] 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 Reviewed-by: Charmaine Lee Reviewed-by: Neha Bhende Part-of: --- 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