loader/dri3: avoid reusing the same back buffer with DRI_PRIME
For DRI_PRIME setup where the dGPU -> iGPU copy can happen asynchronously, we need to ensure that we're not continuously reusing the same back buffer.
The existing code relies on XCB_PRESENT_EVENT_IDLE_NOTIFY to decide if a buffer is busy or idle. If this event is received before the hardware is done using the buffer, then it will reuse the same buffer and introduce a dependency between the copy and the next frame.
This commit mitigates this by trying to allocate a different back buffer when called from dri3_get_buffer (not from dri3_find_back_alloc, because it seems that it expects dri3_get_buffer - see 0cc4c7e3).
An alternative would be to query the busy-ness using is_resource_busy but this complicates the code to achieve the same result.
One affected app is Unigine Superposition, and this change improves the score by 0% - 5% depending on the settings (when using !12763 (merged))