Determining Supported Video Adapters

As already mentioned in Setting up Video Adapter Access Ranges, the HwVidFindAdapter or HwVidQueryDeviceCallback function calls a VideoPortReadXxx or, possibly, VideoPortWriteXxx function to identify its adapter.

However, the HwVidFindAdapter (or HwVidQueryDeviceCallback) routine should not change the state of any video adapter unnecessarily and must not leave any adapter in a changed state.

While the HwVidFindAdapter function runs, the HAL has control of the video adapter so it can write information to the screen in the early stages of the system boot process. If a HwVidFindAdapter routine’s attempt to identify its adapter might have affected an adapter’s state, this routine should restore the original state immediately so that on return from HwVidFindAdapter the HAL can continue to display boot-up messages.

As its name suggests, a HwVidFindAdapter function is responsible for detecting any adapters that the miniport driver supports. This function should not change the state of any video adapter permanently.

The HwVidInitialize routine should actually initialize the adapter because the HAL does not relinquish control of the video adapter to a video miniport driver until its HwVidInitialize function is called. For example, HwVidFindAdapter should defer determining the DAC type of an adapter to the HwVidInitialze function, because making this determination does not affect whether the miniport will be loaded but does change the state of the adapter permanently.