Stall during unmap of staging texture

Hi,

a bit background:
I am using a staging texture to read data from the GPU. This information is used to drive texture uploads, which may be quite heavy (4k textures).

Transfer from CPU to GPU and vice versa is handled asynchronous in all possible cases, otherwise it is broken down in small chunks. Works fine, no problems.

Sometimes (no specific reason known) I get spikes in the frametime. I could catch a spike in a call to

pDeviceContext->Unmap( pResource, 0 );

pResource is the staging texture mentioned above. How is it possible that unmap stalls for something like 20ms? What is happening in the driver that causes this behaviour?

Any thoughts appreciated,
Andreas

Hi,

do you use a single staging texture for the transfers? Try using a ringbuffer of staging textures for the operation to avoid any resource conflicts. On the other hand, 4k is alot of data, maybe the bus is saturated.

I actually have a similar problem, though i am already using a ringbuffer to upload video frames produced by a software decoder. Map/Unmap blocks although there are no obvious resource conflicts. The Map/Unmap is done on separate thread (for every video stream, there are multiple). In this case Map blocks for up to 40ms, stalling the decoding or stalling the rendering thread.

Hi,

if map would block that would be expected behaviour. Data still has to be transferred before I can Access it.
Problem is, unmap blocks. To me there is no known reason why unmap would block the CPU, because I am just releasing ressources. GPU would block if it tries to Access the unmapped ressource before the upload has completed - fine. But it is the CPU (or, more specifically, the Driver) that stalls.

Is there some kind of garbage collection going on during unmap? Can I get around that behaviour?

Regards,
Andreas