virgl: make resource_wait/resource_is_busy cheaper
authorChia-I Wu <olvaffe@gmail.com>
Fri, 10 May 2019 18:56:46 +0000 (11:56 -0700)
committerChia-I Wu <olvaffe@gmail.com>
Tue, 11 Jun 2019 17:03:54 +0000 (10:03 -0700)
commit9e4452cfd9cdad9cded9f75cca63036236b8b178
tree2932be360fd1b947851bac943e6a5ed42bfd0884
parentddc90be907a1386b071fa9cfffb4535a6fa0b19e
virgl: make resource_wait/resource_is_busy cheaper

The round trip to the kernel is expensive.  Add a local cache to
avoid it when possible.

There is a race condition when two contexts access the same resource
at the same time (e.g., ctx1 submits a cmdbuf that accesses a
resource while ctx2 maps the resource).  But that is probably an app
bug in the first place.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
src/gallium/winsys/virgl/drm/virgl_drm_winsys.c
src/gallium/winsys/virgl/drm/virgl_drm_winsys.h