WIP: virgl: Support PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE for buffer transfer_map
It's typical for GL apps to reuse a buffer in a frame by mapping it with the GL_MAP_INVALIDATE_BUFFER_BIT flag. For such use cases it's expected that drivers will heed the flag and ensure this use pattern doesn't cause unnecessary blocking. The current code causes a costly resource wait for every such map instead. This patch updates the transfer_map code for buffers to create a new backing virgl_hw_buf when we are allowed to discard the resource, thus avoiding costly resource waits.
Before: Twilight Struggle (Steam/Proton), QEMU: 5 fps, vtest: 25 fps After: Twilight Struggle (Steam/Proton), QEMU: 25 fps, vtest: 30 fps