DXGKDDI_START_DEVICE callback function
该DDI为显卡接受I/O请求做准备。
Syntax
DXGKDDI_START_DEVICE DxgkddiStartDevice;
NTSTATUS DxgkddiStartDevice(
IN_CONST_PVOID MiniportDeviceContext,
IN_PDXGK_START_INFO DxgkStartInfo,
IN_PDXGKRNL_INTERFACE DxgkInterface,
OUT_PULONG NumberOfVideoPresentSources,
OUT_PULONG NumberOfChildren
)
{...}
Parameters
MiniportDeviceContext
显卡的句柄,其在之前的KMD的DxgkDdiAddDevice中提供给DXGK。
DxgkStartInfo
指向DXGK_START_INFO结构的指针,其中包含了KMD用于初始化所需要的信息。
DxgkInterface
指向DXGKRNL_INTERFACE结构的指针,其包含由DXGK实现的函数指针,KMD可以调用这些函数。
NumberOfVideoPresentSources
一个指向ULONG类型的指针,代表了该显卡所支持的Video present source的数量。参见Multiple Monitors and Video Present Networks。
NumberOfChildren
一个指向ULONG类型的指针,代表该显卡子设备的数量。该数量包括了潜在子设备的数量。例如笔记本电脑插入dock在,将增加更多的可用video output,而这些video output必须包含在内而无论笔记本是否插在dock上。更多信息参见Child Devices of the Display Adapter。
Return Value
DxgkDdiStartDevice returns STATUS_SUCCESS if it succeeds; otherwise, it returns one of the error codes defined in Ntstatus.h.
Remarks
DxgkDdiStartDevice中必须进行下列操作:
- 保存DxgkInterface参数中传入的DXGKRNL_INTERFACE提供的函数指针;保存DXGKRNL_INTERFACE结构中的DeviceHandle成员(由端口驱动创建,代表该显卡),之后回调DXGK需要传入该句柄。
- 分配并调用DxgkCbGetDeviceInformation填充该DXGK_DEVICE_INFO结构,其中包含了注册表路径,PDO,以及MiniportDeviceContext代表显卡中的一系列转换后的资源。将DXGK_DEVICE_INFO中需要的成员(KMD之后需要用到的成员)保存到MiniportDeviceContext代表的context中。
- 调用DxgkCbMapMemory映射内存资源到系统空间。
- 初始化MiniportDeviceContext所代表context,使其状态变为让硬件准备好接收I/O请求。
- 将MiniportDeviceContext代表显卡所支持的Video present source数量填入NumberOfVideoPresentSources。
- 将MiniportDeviceContext代表显卡所支持的子设备数量填入NumberOfChildren。
- 开启MiniportDeviceContext代表显卡的中断功能。
从WDDM1.2开始KMD调用DxgkCbAcquirePostDisplayOwnership来获得有关显示模式的信息,这些信息之前由firmware和syste loader所预设。如果DxgkCbAcquirePostDisplayOwnership 返回STATUS_SUCCESS则KMD确定是否需要根据返回的DisplayInfo显示mode信息重新初始化显示器。否则,驱动不应该假设显示器上由任何mode并需要初始化显示器。
The DxgkDdiStartDevice function should be made pageable.
Requirements
Minimum supported client | Available starting with Windows Vista. |
Target Platform | Desktop |
Header | dispmprt.h |
IRQL | PASSIVE_LEVEL |