WIP: virgl: Wait for resources to be released before mapping them
Resources may be in use by the host when mapping and writing to them. We need to wait for any mapped resources to be released at map time.
Example problematic scenario:
- map, write A to uniform buffer U, unmap
- draw 1
- map, write B to uniform buffer U, unmap
- draw 2
Since writing to mapped resources is done out of band (relative to command buffer execution on the host), we could write B to the uniform buffer before executing draw 1, if we are not waiting for the uniform buffer to be released before writing B.
Showcase: https://github.com/glmark2/glmark2/tree/ubo run with 'glmark2 -b ubo' Before: Occasional flicker in colored rectangles After: No flicker
TODO: Be smarter about avoiding waiting when not required, could use fences to signal resource acquisition and release.
Signed-off-by: Alexandros Frantzis email@example.com