A device extension is each miniport’s primary and only global storage area for adapter-specific state information.
Each miniport driver defines the size, internal structure, and contents of its device extension. A pointer to the device extension is an input parameter to every system-defined miniport driver function except DriverEntry and the HwVidSynchronizeExecutionCallback and SvgaHwIoPortXxx functions, if any. Many VideoPortXxx functions require this pointer as an argument.
The device extension should also be used to maintain the state information for a single adapter. Each adapter would have separate state information maintained in a separate device extension.
For example, VideoPortInitialize calls the miniport’s HwVidFindAdapter function with a pointer to the memory it allocated for the device extension. HwVidFindAdapter is responsible for determining whether an adapter it can support is present in the machine and for setting up whatever context the miniport maintains about that adapter in its device extension.