virgl: Support DISCARD_WHOLE_RESOURCE for constant buffer transfer_maps

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

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
14 jobs for !666 with virgl-buffer-discard-whole-resource in 11 minutes and 52 seconds (queued for 1 second)
latest detached
Status Job ID Name Coverage
  Containers Build
passed #253741
debian

00:00:22

 
  Build+Test
passed #253743
meson-clang

00:11:28

passed #253749
meson-gallium-clover-llvm

00:05:21

passed #253750
meson-gallium-clover-llvm39

00:06:04

passed #253748
meson-gallium-drivers-other

00:07:10

passed #253747
meson-gallium-radeonsi

00:05:40

passed #253751
meson-gallium-st-other

00:04:56

passed #253742
meson-gallium-swr

00:10:04

passed #253746
meson-glvnd

00:05:02

passed #253745
meson-loader-classic-dri

00:05:26

passed #253744
meson-vulkan

00:04:54

passed #253753
scons-llvm

00:05:22

passed #253752
scons-nollvm

00:05:09

passed #253754
scons-swr

00:07:55