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@vmware.com>
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
Reviewed-by: Neha Bhende <bhenden@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16061>
This commit is contained in:
Zack Rusin 2022-03-02 14:08:09 -05:00 committed by Marge Bot
parent 71a749bc7b
commit c7b0309723

View file

@ -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