Submitting a Command Buffer
The following sequence of operations must be performed to pass a command buffer through the Windows Vista graphics stack:
The user-mode display driver initiates a command-buffer submission if the Direct3D runtime calls one of the following user-mode display driver functions to perform the specified operation:
- The Present function to display graphics.
- The Flush function to submit hardware commands.
- The Lock function to lock a resource, which is used in the current command batch.
Note that the user-mode display driver also always initiates a command-buffer submission whenever the command buffer is full.
The user-mode display driver calls the Direct3D runtime's pfnRenderCb function to submit the command buffer to the runtime.
The DirectX graphics kernel subsystem calls the display miniport driver's DxgkDdiRender or DxgkDdiRenderKm function to validate the command buffer, write a DMA buffer in the hardware's format, and produce an allocation list that describes the surfaces used. Note that the DMA buffer has not yet been patched (that is, assigned physical addresses). Note If the runtime initiated the command-buffer submission by calling the user-mode display driver's Present function, the graphics subsystem calls the display miniport driver's DxgkDdiPresent function, rather than DxgkDdiRender or DxgkDdiRenderKm.
The video memory manager calls the display miniport driver's DxgkDdiBuildPagingBuffer function to create special purpose DMA buffers, known as paging buffers, that move the allocations specified in the allocation list that accompanies the DMA buffer to and from GPU-accessible memory. For more information, see Paging Video Memory Resources.
The GPU scheduler calls the display miniport driver's DxgkDdiPatch function to assign physical addresses to the resources in the DMA buffer. However, the scheduler is not required to call DxgkDdiPatch to assign physical addresses to the paging buffer because physical addresses for the paging buffer were passed in and assigned during the DxgkDdiBuildPagingBuffer call.
The GPU scheduler calls the display miniport driver's DxgkDdiSubmitCommand function to request that the driver queue the paging buffer to the GPU execution unit.
The GPU scheduler calls the display miniport driver's DxgkDdiSubmitCommand function to request that the driver queue the DMA buffer to the GPU execution unit. Each DMA buffer submitted to the GPU contains a fence identifier. After the GPU finishes processing the DMA buffer, the GPU generates an interrupt.
The display miniport driver is notified of the interrupt in its DxgkDdiInterruptRoutine function. The display miniport driver should read, from the GPU, the fence identifier of the DMA buffer that just completed.
The display miniport driver should call the DxgkCbNotifyInterrupt function to notify the GPU scheduler that the DMA buffer completed.
The display miniport driver should call the DxgkCbQueueDpc function to queue a deferred procedure call (DPC).
The display miniport driver's DPC is notified to handle most of the DMA buffer processing.