Synchronizing Video Decode Operations
The synchronization mechanism for DirectX VA 2.0 is improved from the 1.0 version and is more similar to the synchronization mechanisms used by Microsoft Direct3D operations.
In DirectX VA 1.0, synchronization is performed mainly by the decoder. Before the decoder can use a compressed buffer, it calls the DdMoCompQueryStatus function to determine if the buffer is available for use (that is, the hardware is not accessing the buffer). If the buffer is not available, the decoder must sleep, poll, or perform another operation.
DirectX VA 2.0 uses the synchronization model that Direct3D already uses on vertex buffers and index buffers. In DirectX VA 2.0, synchronization is performed by the decoder locking the compressed buffer. If the user-mode display driver attempts to lock the compressed buffer and the buffer is in use, the driver can either fail the lock or rename the buffer. The user-mode display driver requests that the video memory manager rename the buffer when the driver sets the Discard member of the D3DDDICB_LOCKFLAGS structure in a call to the pfnLockCb function. If the user-mode display driver renames the buffer, the driver returns a pointer to an alternative buffer so that the decoder can continue without being blocked.
Typically, for DirectX VA 2.0, synchronization is only an issue if the hardware can consume the compressed buffers directly without additional buffer copies.