st/mesa: Use the texture_subdata memcpy path for non-busy PBO sources.
Civilization VI wants to provide some data to a vertex shader via a texture buffer. Unfortunately, the OpenGL port doesn't actually use texture buffers, and instead does some interesting things:
- glMapBufferRange with GL_MAP_INVALIDATE_BUFFER_BIT | GL_WRITE_BIT, causing the buffer's contents to be dropped and it to be CPU idle.
- memcpy some data into the buffer.
- Bind that buffer as a PBO.
- glTexSubImage2D from the PBO into a 4096xN rectangle texture.
- Have the shader texelFetch with / and % 4096 coordinate munging.
During the glTexSubImage operation, we see that the source data is in a PBO and queue a blit. But in this case the buffer was newly populated on the CPU and is still idle, so we can simply map it for reading and upload directly from there.
Eliminates a bunch of unnecessary GPU blits, which seemed to be taking around 6ms when measured in isolation.