Do wait on device idle when destroying the swap chain.
Don't wait on device idle multiple times in resize.
Validation on NVIDA and AMD is happy when only keeping
the two idles when resizing and destroying the swapchain.
Use the same counter for frame and command buffers, as their number is
equal, which is retrieved from swapchain.image_count.
Use the struct member num_buffers in favor of passing it as parameter.
Reuse some command buffer functions.
This patch has been spun of the rather massive amount of work for adding input
devices into Monado. The interfaces feels somewhat stable now so could do
with another pair of eyes on them, before too much work is done on st/oxr.