virgl: add local cache for resource idleness
This depends on !838 (merged) and is forked from !908 (merged).
After the two MRs, consecutive transfers to an idle resource results in multiple resource_is_busy
calls. This first two commits save us the kernel round trips.
The last commit treats newly created resources as idle. It prevents us from triggering !838 (merged) and !908 (merged) unnecessarily.
Take glbench buffer_upload_sub_dynamic_array_32 for example,
MR 838 750.00 mbytes_sec (this hits the buggy virgl_buffer_transfer_extend path)
MR 838 with the buggy transfer_extend removed 28.27 mbytes_sec
same as above, plus this MR 318.76 mbytes_sec
There was also a ~1% improvement to Unigine Valley, but that was measured before the recent changes. I am not sure if that still holds true.
Edited by Chia-I Wu